Python PyQt5.QtCore.Qt 模块,ApplicationModal() 实例源码

我们从Python开源项目中,提取了以下19个代码示例,用于说明如何使用PyQt5.QtCore.Qt.ApplicationModal()

项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent, f=Qt.WindowCloseButtonHint):
        super(DirectDownload, self).__init__(parent, f)
        self.parent = parent
        self.setWindowTitle('Download Progress')
        self.setWindowModality(Qt.ApplicationModal)
        self.setMinimumWidth(485)
        self.setContentsMargins(20, 20, 20, 20)
        layout = QVBoxLayout()
        self.progress_label = QLabel(alignment=Qt.AlignCenter)
        self.progress = QProgressBar(self.parent)
        self.progress.setMinimum(0)
        self.progress.setMaximum(100)
        layout.addWidget(self.progress_label)
        layout.addWidget(self.progress)
        self.setLayout(layout)
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent, f=Qt.WindowCloseButtonHint):
        super(HosterLinks, self).__init__(parent, f)
        self.parent = parent
        self.setObjectName('hosters')
        self.loading_progress = QProgressDialog('Retrieving hoster links...', None, 0, 0, self.parent,
                                                Qt.WindowCloseButtonHint)
        self.loading_progress.setStyle(QStyleFactory.create('Fusion'))
        self.loading_progress.setWindowTitle('Hoster Links')
        self.loading_progress.setMinimumWidth(485)
        self.loading_progress.setWindowModality(Qt.ApplicationModal)
        self.loading_progress.setStyleSheet('QProgressDialog::chunk { background-color:#6A687D; }')
        self.loading_progress.show()
        self.layout = QVBoxLayout()
        self.layout.setSpacing(15)
        self.setLayout(self.layout)
        self.setWindowTitle('Hoster Links')
        self.setWindowModality(Qt.ApplicationModal)
        self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent, settings: QSettings, f=Qt.WindowCloseButtonHint):
        super(Settings, self).__init__(parent, f)
        self.parent = parent
        self.settings = settings
        self.setWindowModality(Qt.ApplicationModal)
        self.tab_general = GeneralTab(self.settings)
        self.tab_favorites = FavoritesTab(self.settings)
        tabs = QTabWidget()
        tabs.addTab(self.tab_general, 'General')
        tabs.addTab(self.tab_favorites, 'Favorites')
        button_box = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        button_box.accepted.connect(self.save_settings)
        button_box.rejected.connect(self.close)
        layout = QVBoxLayout()
        layout.addWidget(tabs)
        layout.addWidget(button_box)
        self.setLayout(layout)
        self.setWindowTitle('%s Settings' % qApp.applicationName())
        self.setWindowIcon(self.parent.icon_settings)
项目:EMFT    作者:132nd-etcher    | 项目源码 | 文件源码
def progress_start(title: str = '', length: int = 100, label: str = ''):
        MainUiProgress.progress = QProgressDialog()
        MainUiProgress.progress.setWindowFlags(Qt.FramelessWindowHint)
        MainUiProgress.progress.setWindowFlags(Qt.WindowTitleHint)
        MainUiProgress.progress.setMinimumWidth(400)
        from PyQt5.QtWidgets import QPushButton
        # QString() seems to be deprecated in v5
        # PyQt does not support setCancelButton(0) as it expects a QPushButton instance
        # Get your shit together, Qt !
        MainUiProgress.progress.findChild(QPushButton).hide()
        MainUiProgress.progress.setMinimumDuration(1)
        MainUiProgress.progress.setWindowModality(Qt.ApplicationModal)
        MainUiProgress.progress.setCancelButtonText('')
        MainUiProgress.progress.setWindowIcon(QIcon(':/ico/app.ico'))
        MainUiProgress.progress.setWindowTitle(title)
        MainUiProgress.progress.setLabelText(label)
        MainUiProgress.progress.setMaximum(length)
        MainUiProgress.progress.show()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None, flags=Qt.Dialog | Qt.FramelessWindowHint):
        super(VCProgressBar, self).__init__(parent, flags)
        self.parent = parent
        self.setWindowModality(Qt.ApplicationModal)
        self.setStyleSheet('QDialog { border: 2px solid #000; }')
        self._progress = QProgressBar(self)
        self._progress.setRange(0, 0)
        self._progress.setTextVisible(False)
        self._progress.setStyle(QStyleFactory.create('Fusion'))
        self._label = QLabel(self)
        self._label.setAlignment(Qt.AlignCenter)
        layout = QGridLayout()
        layout.addWidget(self._progress, 0, 0)
        layout.addWidget(self._label, 0, 0)
        self._timerprefix = QLabel('<b>Elapsed time:</b>', self)
        self._timerprefix.setObjectName('progresstimer')
        self._timervalue = QLabel(self)
        self._timervalue.setObjectName('progresstimer')
        timerlayout = QHBoxLayout()
        timerlayout.addWidget(self._timerprefix)
        timerlayout.addWidget(self._timervalue)
        self._timerwidget = QWidget(self)
        self._timerwidget.setLayout(timerlayout)
        self._timerwidget.hide()
        self._time = QTime()
        self._timer = QTimer(self)
        self._timer.timeout.connect(self.updateTimer)
        self.setLayout(layout)
        self.setFixedWidth(550)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, icon: str, parent=None, f=Qt.Dialog | Qt.FramelessWindowHint):
        super(Notification, self).__init__(parent, f)
        self.parent = parent
        self.theme = self.parent.theme
        self.setObjectName('notification')
        self.setContentsMargins(10, 10, 10, 10)
        self.shown.connect(lambda: QTimer.singleShot(self.duration * 1000, self.fadeOut))
        self.setWindowModality(Qt.ApplicationModal)
        self.setMinimumWidth(550)
        self._title, self._message = '', ''
        self.buttons = []
        self.msgLabel = QLabel(self._message, self)
        self.msgLabel.setWordWrap(True)
        logo_label = QLabel('<img src="{}" width="82" />'.format(icon), self)
        logo_label.setFixedSize(82, 82)
        self.left_layout = QVBoxLayout()
        self.left_layout.addWidget(logo_label)
        layout = QHBoxLayout()
        layout.addStretch(1)
        layout.addLayout(self.left_layout)
        layout.addSpacing(10)
        layout.addWidget(self.msgLabel, Qt.AlignVCenter)
        layout.addStretch(1)
        self.setLayout(layout)
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def conflict_tags_submit(self):
        """
        submit conflict tags
        :return:
        """
        updata_tag_message_list = self.get_table_data()
        again_conflict_data = self.get_conflict_data(updata_tag_message_list)
        self.wait_dialog = WaitDialog(self)
        self.wait_dialog.setWindowModality(Qt.ApplicationModal)
        if again_conflict_data:
            message = str(again_conflict_data) + " has existed, whether to continue to submit"
            reply = QMessageBox.information(self, "merge conflicts", message, QMessageBox.Yes | QMessageBox.No)
            if reply == QMessageBox.Yes:
                self.wait_dialog.show()
                thread = Thread(target=self.case_data_manager.merge_conflict_data_callback,
                                args=(updata_tag_message_list, self.callback))
                thread.start()
        else:
            self.wait_dialog.show()
            thread = Thread(target=self.case_data_manager.merge_conflict_data_callback,
                            args=(updata_tag_message_list, self.callback))
            thread.start()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent=None, theme: str='light', title: str='Checking for updates',
                 flags=Qt.Dialog | Qt.WindowCloseButtonHint):
        super(UpdaterMsgBox, self).__init__(parent, flags)
        self.parent = parent
        self.theme = theme
        self.setWindowTitle(title)
        self.setWindowModality(Qt.ApplicationModal)
        self.setObjectName('updaterdialog')
        self.loading = VCProgressBar(self.parent)
        self.loading.setText('contacting server')
        self.loading.setMinimumWidth(485)
        self.loading.show()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, errors: list, parent=None, flags=Qt.WindowCloseButtonHint):
        super(ClipErrorsDialog, self).__init__(parent, flags)
        self.errors = errors
        self.parent = parent
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowTitle('Cannot add media file(s)')
        self.headingcolor = '#C681D5' if self.parent.theme == 'dark' else '#642C68'
        self.pencolor = '#FFF' if self.parent.theme == 'dark' else '#222'
        self.toolbox = ClipErrorsDialog.VCToolBox(self)
        self.toolbox.currentChanged.connect(self.selectItem)
        self.detailedLabel = QLabel(self)
        self.buttons = QDialogButtonBox(self)
        closebutton = self.buttons.addButton(QDialogButtonBox.Close)
        closebutton.clicked.connect(self.close)
        closebutton.setDefault(True)
        closebutton.setAutoDefault(True)
        closebutton.setCursor(Qt.PointingHandCursor)
        closebutton.setFocus()
        introLabel = self.intro()
        introLabel.setWordWrap(True)
        layout = QVBoxLayout()
        layout.addWidget(introLabel)
        layout.addSpacing(10)
        layout.addWidget(self.toolbox)
        layout.addSpacing(10)
        layout.addWidget(self.buttons)
        self.setLayout(layout)
        self.parseErrors()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def click_add_case(self):
        """
        click the button to show add case widget
        :return:
        """
        self.add_case_widget = AddCaseWidget()
        self.add_case_widget.select_case_signal.connect(self.show_cases, Qt.QueuedConnection)
        self.add_case_widget.setWindowModality(Qt.ApplicationModal)
        self.add_case_widget.show()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def click_run_stop_btn(self):
        """
        start or stop to run case
        :return:
        """
        devices = []
        if self.running:
            self.stop_case()
            return
        if not self.cases:  # cases is null
            self.message_box.warning(self, "Message", "Please add cases first.", QMessageBox.Ok)
            return
        try:
            devices = self.tester.devices()
        except Exception as e:
            self.add_log("<font color='red'>" + str(e) + "</font>")
        if not devices:  # There is no device connected
            self.message_box.warning(self, "Message", "Please connect the device to your computer.", QMessageBox.Ok)
            return
        self.add_device_widget = AddDeviceWidget()
        self.add_device_widget.setWindowModality(Qt.ApplicationModal)
        self.add_device_widget.add_log_signal.connect(self.add_log, Qt.QueuedConnection)
        self.add_device_widget.run_case_signal.connect(self.run_case, Qt.QueuedConnection)
        self.device_list_signal.connect(self.add_device_widget.add_radio_to_widget, Qt.QueuedConnection)
        self.add_device_widget.show()
        try:
            self.device_list_signal.emit(devices)
        except Exception as e:
            self.add_log("<font color='red'><pre>" + str(e) + "</pre></font>")
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def table_widget_clicked(self, row, column):
        table_item = self.table_widget.item(row, column)
        if row == 0:  # ?????
            self.data_header_editor = DataHeaderQWidget(self.refresh_table_item_signal,
                                                        row, column, table_item.text())
            self.data_header_editor.setWindowModality(Qt.ApplicationModal)
            self.data_header_editor.show()
        else:  # ????
            self.data_editor = DataEditorQWidget(self.refresh_table_item_signal,
                                                 row, column, table_item.text())
            self.data_editor.setWindowModality(Qt.ApplicationModal)
            self.data_editor.show()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def add_tag(self):
        '''
        add tag
        :return:
        '''
        self.tag_editor_window = TagEditorWidget(self.refresh_signal)
        self.tag_editor_window.setWindowModality(Qt.ApplicationModal)
        self.tag_editor_window.show()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def modify_tag(self):
        items = self.tag_list_widget.selectedItems()
        item = items[0]
        if item.text() == '??' or item.text() == '???':
            QMessageBox.warning(self, 'tag select ', 'please select a tag')
        else:
            self.tag_editor_window = TagEditorWidget(self.refresh_signal, item.text())
            self.tag_editor_window.setWindowModality(Qt.ApplicationModal)
            self.tag_editor_window.show()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def choose_event(self):
        """
        choose tag event, show tags
        :return:
        """
        self.tag_manage_widget = TagManageWidget(self.config)
        self.tag_manage_widget.selected_tag_names_signal.connect(self.set_selected_tag_names)
        self.tag_manage_widget.setWindowModality(Qt.ApplicationModal)
        self.tag_manage_widget.show()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def run_btn_event(self):
        """
        click run button, show add_device_widget
        :return:
        """
        self.add_device_widget = AddDeviceWidget()  # add device
        self.add_device_widget.setWindowModality(Qt.ApplicationModal)
        self.device_and_data_signal.connect(self.add_device_widget.add_radio_to_widget, Qt.QueuedConnection)
        self.add_device_widget.run_editor_signal.connect(self.run_case, Qt.QueuedConnection)
        devices = []
        if self.is_running:
            self.stop_case()
        try:
            devices = self.tester.devices()
        except Exception as e:
            self.add_info_console("<font color='red'>" + str(e) + "</font>")
        if not devices:  # There is no device connected
            self.message_box.warning(self, "Message", "Please connect the device to your computer.", QMessageBox.Ok)
            return

        # get case data count
        if self.case_id is not None:
            self.case_data_count = self.case_data_manage.get_case_data_count(self.case_id)

        self.device_and_data_signal.emit(devices, self.case_data_count)
        self.add_device_widget.show()
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def new_tag_event(self):
        """
        show tag editor
        :return:
        """
        self.tag_editor = TagEditorWidget(self.refresh_signal)
        self.tag_editor.setWindowModality(Qt.ApplicationModal)
        self.tag_editor.show()
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, media, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint):
        super(VideoInfo, self).__init__(parent, flags)
        self.logger = logging.getLogger(__name__)
        self.media = media
        self.parent = parent
        self.setObjectName('videoinfo')
        self.setContentsMargins(0, 0, 0, 0)
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowTitle('Media information - {}'.format(os.path.basename(self.media)))
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.setMinimumSize(self.modes.get(self.parent.parent.scale))
        metadata = '''<style>
    table {
        font-family: "Noto Sans UI", sans-serif;
        font-size: 13px;
        margin-top: -10px;
    }
    td i {
        font-family: "Noto Sans UI", sans-serif;
        font-weight: normal;
        font-style: normal;
        text-align: right;
        color: %s;
        white-space: nowrap;
    }
    td {
        font-weight: normal;
        text-align: right;
    }
    td + td { text-align: left; }
    h1, h2, h3 { color: %s; }
</style>
<div align="center">%s</div>''' % ('#C681D5' if self.parent.theme == 'dark' else '#642C68',
                                   '#C681D5' if self.parent.theme == 'dark' else '#642C68',
                                   self.parent.videoService.mediainfo(self.media))
        content = QTextBrowser(self.parent)
        content.setStyleSheet('QTextBrowser { border: none; background-color: transparent; }')
        content.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        content.setHtml(metadata)
        keyframesButton = QPushButton('View keyframes', self)
        keyframesButton.clicked.connect(self.showKeyframes)
        okButton = QDialogButtonBox(QDialogButtonBox.Ok)
        okButton.accepted.connect(self.close)
        button_layout = QHBoxLayout()
        mediainfo_version = self.parent.videoService.cmdExec(self.parent.videoService.backends.mediainfo,
                                                             '--version', True)
        if len(mediainfo_version) >= 2:
            mediainfo_version = mediainfo_version.split('\n')[1]
            mediainfo_label = QLabel('<div style="font-size:11px;"><b>Media information by:</b><br/>%s @ '
                                     % mediainfo_version + '<a href="https://mediaarea.net" target="_blank">' +
                                     'mediaarea.net</a></div>')
            button_layout.addWidget(mediainfo_label)
        button_layout.addStretch(1)
        button_layout.addWidget(keyframesButton)
        button_layout.addWidget(okButton)
        layout = QVBoxLayout()
        layout.addWidget(content)
        layout.addLayout(button_layout)
        self.setLayout(layout)
项目:360fy-360_video_creator    作者:SapneshNaik    | 项目源码 | 文件源码
def help_dialog(self):

        self.helpDialog = QDialog()
        self.helpDialog.setObjectName("self.helpDialog")
        self.helpDialog.setWindowModality(Qt.ApplicationModal)
        self.helpDialog.setFixedSize(362, 151)
        icon = QIcon()
        icon.addPixmap(QPixmap("../resource/logo.png"), QIcon.Normal, QIcon.Off)
        self.helpDialog.setWindowIcon(icon)
        self.helpDialog.setLayoutDirection(Qt.LeftToRight)
        self.helpDialog.setAutoFillBackground(False)
        self.helpDialog.setSizeGripEnabled(False)
        self.helpDialog.setModal(False)
        self.docButton = QPushButton(self.helpDialog)
        self.docButton.setGeometry(QRect(200, 100, 111, 41))
        icon1 = QIcon()
        icon1.addPixmap(QPixmap("../resource/Doc.png"), QIcon.Normal, QIcon.Off)
        self.docButton.setIcon(icon1)
        self.docButton.setObjectName("docButton")
        self.tubeButton = QPushButton(self.helpDialog)
        self.tubeButton.setGeometry(QRect(50, 100, 111, 41))
        icon2 = QIcon()
        icon2.addPixmap(QPixmap("../resource/YouTube.png"), QIcon.Normal, QIcon.Off)
        self.tubeButton.setIcon(icon2)
        self.tubeButton.setObjectName("tubeButton")
        self.label = QLabel(self.helpDialog)
        self.label.setGeometry(QRect(20, 10, 331, 21))
        font = QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.label_2 = QLabel(self.helpDialog)
        self.label_2.setGeometry(QRect(20, 30, 321, 21))
        font = QFont()
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label_3 = QLabel(self.helpDialog)
        self.label_3.setGeometry(QRect(20, 50, 321, 20))
        font = QFont()
        font.setPointSize(12)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.label_4 = QLabel(self.helpDialog)
        self.label_4.setGeometry(QRect(30, 80, 211, 17))
        font = QFont()
        font.setPointSize(8)
        font.setItalic(True)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")

        self.retranslate_help_ui(self.helpDialog)
        QMetaObject.connectSlotsByName(self.helpDialog)
        self.docButton.clicked.connect(self.open_github)


        self.helpDialog.exec_()



    #help_dialog calls this inturn to set some labels messages