python类QDialog()的实例源码

universal_tool_template_0904.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def setupWin(self):
        super(self.__class__,self).setupWin()
        self.setGeometry(500, 300, 250, 110) # self.resize(250,250)

        #------------------------------
        # template list: for frameless or always on top option
        #------------------------------
        # - template : keep ui always on top of all;
        # While in Maya, dont set Maya as its parent
        '''
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
        '''

        # - template: hide ui border frame; 
        # While in Maya, use QDialog instead, as QMainWindow will make it disappear
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        '''

        # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
        '''

        # - template: for transparent and non-regular shape ui
        # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
        # note: black color better than white for better look of semi trans edge, like pre-mutiply
        '''
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
        '''
machine_mointor.py 文件源码 项目:Pyquino 作者: kmolLin 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __test__send(self):
        data = str("G29"+'\n')
        print('0')
        #if self._serial_context_.isRunning():
        print("1")
        if len(data) > 0:
            print("2")
            self._serial_context_.send(data, 0)
            print(data)


#    def __run__(self):
 #       import sys
  #      print("123")
  #      app = QtWidgets.QApplication(sys.argv)
  #      Dialog = QtWidgets.QDialog()
  #      ui = Ui_Dialog()
  #      ui.setupUi(Dialog)
  #      Dialog.show()
  #       sys.exit(app.exec_())
wb_scm_app.py 文件源码 项目:scm-workbench 作者: barry-scott 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def setAppStyles( self ) -> None:
        style_sheet_pieces = self.app_style_sheet[:]

        # get the feedback background-color that matches a dialog background
        dialog = QtWidgets.QDialog()
        palette = dialog.palette()
        feedback_bg = palette.color( palette.Active, palette.Window ).name()

        style_sheet_pieces.append( 'QPlainTextEdit#feedback {background-color: %s; color: #cc00cc}' % (feedback_bg,) )

        style_sheet_pieces.append( 'QPlainTextEdit:read-only {background-color: %s}' % (feedback_bg,) )
        style_sheet_pieces.append( 'QLineEdit:read-only {background-color: %s}' % (feedback_bg,) )
        style_sheet_pieces.append( 'QLineEdit[valid=false] {border: 1px solid #cc00cc; border-radius: 3px; padding: 5px}' )

        # set the users UI font
        if self.prefs.font_ui.face is not None:
            style_sheet_pieces.append( '* { font-family: "%s"; font-size: %dpt}' % (self.prefs.font_ui.face, self.prefs.font_ui.point_size) )

        style_sheet = '\n'.join( style_sheet_pieces )
        self.debugLogApp( style_sheet )
        self.setStyleSheet( style_sheet )
highlight_instructions.py 文件源码 项目:idapython 作者: mr-tz 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowCloseButtonHint)
        self.setWindowTitle("Highlighter v%s" % __version__)
        highlighter_layout = QtWidgets.QVBoxLayout()

        button_highlight = QtWidgets.QPushButton("&Highlight instructions")
        button_highlight.setDefault(True)
        button_highlight.clicked.connect(self.highlight)
        highlighter_layout.addWidget(button_highlight)

        button_clear = QtWidgets.QPushButton("&Clear all highlights")
        button_clear.clicked.connect(self.clear_colors)
        highlighter_layout.addWidget(button_clear)

        button_cancel = QtWidgets.QPushButton("&Close")
        button_cancel.clicked.connect(self.close)
        highlighter_layout.addWidget(button_cancel)

        self.setMinimumWidth(180)
        self.setLayout(highlighter_layout)
highlight_instructions.py 文件源码 项目:idapython 作者: mr-tz 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def highlight(self):
        self.done(QtWidgets.QDialog.Accepted)
        highlighters = []
        if HIGHLIGHT_CALLS:
            highlighters.append(CallHighlighter(Colors.MINT))
        if HIGHLIGHT_PUSHES:
            highlighters.append(PushHighlighter(Colors.CORNFLOWER))
        if HIGHLIGHT_ANTI_VM:
            highlighters.append(AntiVmHighlighter(Colors.FLAMINGO))
        if HIGHLIGHT_ANTI_DEBUG:
            highlighters.append(AntiDebugHighlighter(Colors.FLAMINGO))
            # do this once per binary
            AntiDebugHighlighter.highlight_anti_debug_api_calls()
        if HIGHLIGHT_SUSPICIOUS_INSTRUCTIONS:
            highlighters.append(SuspicousInstructionHighlighter(Colors.FLAMINGO))
        highlight_instructions(highlighters)
ccdialog.py 文件源码 项目:pisi-player 作者: mthnzbk 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        super().__init__()
        self.parent = parent
        self.setVisible(False)
        self.setStyleSheet("QDialog {background-color: rgba(22, 22, 22, 150); border-color:  rgba(22, 22, 22, 150);" \
                           "border-width: 1px; border-style outset; border-radius: 10px; color:white; font-weight:bold;}")

        layout = QHBoxLayout()
        self.setLayout(layout)

        label = QLabel()
        label.setStyleSheet("QLabel {color:white;}")
        label.setText("Kodlama:")

        layout.addWidget(label)

        self.combobox = QComboBox()
        self.combobox.addItems(["ISO 8859-9", "UTF-8"])
        self.combobox.setStyleSheet("QComboBox {background-color: rgba(22, 22, 22, 150); border-color:  rgba(22, 22, 22, 150);" \
                           " color:white; font-weight:bold;}")
        self.combobox.setCurrentText(settings().value("Subtitle/codec"))

        layout.addWidget(self.combobox)

        self.combobox.currentTextChanged.connect(self.textCodecChange)
main.py 文件源码 项目:desktop-stream-viewer 作者: AbiosGaming 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def show_settings(self):
        """Shows a dialog containing settings for DSW"""
        self.dialog = QDialog(self)
        self.dialog.ui = uic.loadUi(SETTINGS_UI_FILE, self.dialog)
        self.dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.dialog.findChild(QtCore.QObject, BUTTONBOX) \
            .accepted.connect(self.generate_conf)
        if cfg[CONFIG_BUFFER_STREAM]:
            self.dialog.findChild(QtCore.QObject, RECORD_SETTINGS).setChecked(True)
        if cfg[CONFIG_MUTE]:
            self.dialog.findChild(QtCore.QObject, MUTE_SETTINGS).setChecked(True)
        self.dialog.findChild(QtCore.QObject, QUALITY_SETTINGS) \
            .setText(CONFIG_QUALITY_DELIMITER_JOIN.join(cfg[CONFIG_QUALITY]))
        self.dialog.findChild(QtCore.QObject, BUFFER_SIZE).setValue(cfg[CONFIG_BUFFER_SIZE])
        self.dialog.show()
breathing_phrase_list_wt.py 文件源码 项目:mindfulness-at-the-computer 作者: SunyataZero 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def add_new_phrase_button_clicked(self):
        text_sg = self.add_to_list_qle.text().strip()  # strip is needed to remove a newline at the end (why?)
        if not (text_sg and text_sg.strip()):
            return
        mc.model.PhrasesM.add(
            text_sg,
            BREATHING_IN_DEFAULT_PHRASE,
            BREATHING_OUT_DEFAULT_PHRASE,
            "", ""
        )
        self.add_to_list_qle.clear()

        self.update_gui()
        self.list_widget.setCurrentRow(self.list_widget.count() - 1)
        # self.in_breath_phrase_qle.setFocus()

        # if dialog_result == QtWidgets.QDialog.Accepted:
        EditDialog.launch_edit_dialog()
        self.phrase_changed_signal.emit(True)
rest_action_list_wt.py 文件源码 项目:mindfulness-at-the-computer 作者: SunyataZero 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def launch_edit_dialog():
        dialog = EditDialog()
        dialog_result = dialog.exec_()

        if dialog_result == QtWidgets.QDialog.Accepted:
            model.RestActionsM.update_title(
                mc_global.active_rest_action_id_it,
                dialog.rest_action_title_qle.text()
            )
            model.RestActionsM.update_rest_action_image_path(
                mc_global.active_rest_action_id_it,
                dialog.temporary_image_file_path_str
            )
        else:
            pass

        return dialog_result
closePopup.py 文件源码 项目:DCheat 作者: DCheat 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parentUi, sock, multiprocess, messgae, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.ui = uic.loadUi(config.config.ROOT_PATH +'view/closePopup.ui', self)

        self.parentUi = parentUi
        self.sock = sock
        self.mp = multiprocess
        self.closeMessage = "??? ???????.\n %d? ? ?????."
        self.message = messgae
        self.count = 10

        self.ui.label.setText(self.closeMessage % (self.count))

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.message_display)
        self.timer.start(1100)

        self.ui.show()
adminSelectCourse.py 文件源码 项目:DCheat 作者: DCheat 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, courseList, socket, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.ui = uic.loadUi(config.config.ROOT_PATH +'view/adminSelectCourse.ui', self)

        self.sock = socket
        self.courseList = []
        self.courseList = self.courseList + courseList
        self.register = object
        self.dataPos = -1
        pListWidget = QtWidgets.QWidget()
        self.ui.scrollArea.setWidgetResizable(True)
        self.ui.scrollArea.setWidget(pListWidget)
        self.pListLayout = QtWidgets.QGridLayout()
        self.pListLayout.setAlignment(Qt.AlignTop)
        pListWidget.setLayout(self.pListLayout)

        self.makeCourseLayout()
pyENL.py 文件源码 项目:pyENL 作者: jon85p 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def settingsWindow(self):
        langs = {"es": 0, "en": 1, "fr": 2, "pt": 3}
        methods = {'hybr':0, 'lm':1, 'broyden1':2, 'broyden2':3, 'anderson':4,
                   'linearmixing':5, 'diagbroyden':6, 'excitingmixing':7, 'krylov':8, 'df-sane':9}
        dialog = QtWidgets.QDialog()
        dialog.ui = settings_class()
        dialog.ui.setupUi(dialog)
        # Hay que conectar ANTES de que se cierre la ventana de diálogo
        dialog.ui.buttonBox.accepted.connect(partial(self.saveSettings, dialog.ui))
        dialog.ui.comboBox.setCurrentIndex(langs[self.lang])
        dialog.ui.format_line.setText(self.format)
        dialog.ui.method_opt.setCurrentIndex(methods[self.opt_method])
        dialog.ui.tol_line.setText(str(self.opt_tol))
        dialog.ui.timeout_spin.setValue(self.timeout)
        dialog.exec_()
        dialog.show()
        # dialog.ui.buttonBox.accepted.connect(self.pruebaprint)
        # print(dir(dialog.ui.comboBox))
FailedDownloadsDialog.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, fail_list):
        """
        A dialog box that shows the failed downloads and any relevent information about them, such as: the user that
        posted the content to reddit, the subreddit it was posted in, the title of the post, the url that failed and
        a reason as to why it failed (ex: download or extraction error)

        :param fail_list: A list supplied to the dialog of the failed content
        """
        QtWidgets.QDialog.__init__(self)
        self.setupUi(self)
        self.settings_manager = Core.Injector.get_settings_manager()
        geom = self.settings_manager.failed_downloads_dialog_geom
        self.restoreGeometry(geom if geom is not None else self.saveGeometry())

        for x in fail_list:
            self.textBrowser.append(x)
            self.textBrowser.append(' ')

        self.buttonBox.accepted.connect(self.accept)
AddUserDialog.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self):
        """
        A dialog that opens to allow for the user to add a new reddit username to the username list. An instance of this
        class is also used as a dialog to add subreddits, but two object names are overwritten. This dialog is basically
        a standard input dialog, but with the addition of a third button that allows the user to add more than one name
        without closing the dialog.  Shortcut keys have also been added to facilitate ease of use
        """
        QtWidgets.QDialog.__init__(self)
        self.setupUi(self)
        self.settings_manager = Core.Injector.get_settings_manager()
        geom = self.settings_manager.add_user_dialog_geom
        self.restoreGeometry(geom if geom is not None else self.saveGeometry())
        self.name = None

        self.ok_cancel_button_box.accepted.connect(self.accept)
        self.ok_cancel_button_box.rejected.connect(self.close)
        self.add_another_button.clicked.connect(self.add_multiple)
InsertSinePlugin.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self):

        self.__dialog_ui = None  # type: QDialog
        self.complex_wave = None

        self.__amplitude = 0.5
        self.__frequency = 10
        self.__phase = 0
        self.__sample_rate = 1e6
        self.__num_samples = int(1e6)

        self.original_data = None
        self.draw_data = None
        self.position = 0

        super().__init__(name="InsertSine")
InsertSinePlugin.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def dialog_ui(self) -> QDialog:
        if self.__dialog_ui is None:
            dir_name = os.path.dirname(os.readlink(__file__)) if os.path.islink(__file__) else os.path.dirname(__file__)
            self.__dialog_ui = uic.loadUi(os.path.realpath(os.path.join(dir_name, "insert_sine_dialog.ui")))
            self.__dialog_ui.setAttribute(Qt.WA_DeleteOnClose)
            self.__dialog_ui.setModal(True)
            self.__dialog_ui.doubleSpinBoxAmplitude.setValue(self.__amplitude)
            self.__dialog_ui.doubleSpinBoxFrequency.setValue(self.__frequency)
            self.__dialog_ui.doubleSpinBoxPhase.setValue(self.__phase)
            self.__dialog_ui.doubleSpinBoxSampleRate.setValue(self.__sample_rate)
            self.__dialog_ui.doubleSpinBoxNSamples.setValue(self.__num_samples)
            self.__dialog_ui.lineEditTime.setValidator(
                QRegExpValidator(QRegExp("[0-9]+([nmµ]*|([\.,][0-9]{1,3}[nmµ]*))?$")))

            scene_manager = SceneManager(self.dialog_ui.graphicsViewSineWave)
            self.__dialog_ui.graphicsViewSineWave.scene_manager = scene_manager
            self.insert_indicator = scene_manager.scene.addRect(0, -2, 0, 4,
                                                                QPen(QColor(Qt.transparent), Qt.FlatCap),
                                                                QBrush(self.INSERT_INDICATOR_COLOR))
            self.insert_indicator.stackBefore(scene_manager.scene.selection_area)

            self.set_time()

        return self.__dialog_ui
InsertSinePlugin.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def get_insert_sine_dialog(self, original_data, position, sample_rate=None, num_samples=None) -> QDialog:
        self.create_dialog_connects()
        if sample_rate is not None:
            self.sample_rate = sample_rate
            self.dialog_ui.doubleSpinBoxSampleRate.setValue(sample_rate)

        if num_samples is not None:
            self.num_samples = int(num_samples)
            self.dialog_ui.doubleSpinBoxNSamples.setValue(num_samples)

        self.original_data = original_data
        self.position = position

        self.set_time()
        self.draw_sine_wave()

        return self.dialog_ui
dialog.py 文件源码 项目:opensnitch 作者: evilsocket 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, app, desktop_parser, parent=None):
        self.connection = None
        QtWidgets.QDialog.__init__(self, parent,
                                   QtCore.Qt.WindowStaysOnTopHint)
        self.setupUi(self)
        self.init_widgets()
        self.start_listeners()

        self.connection_queue = app.connection_queue
        self.add_connection_signal.connect(self.handle_connection)

        self.app = app

        self.desktop_parser = desktop_parser

        self.rule_lock = threading.Lock()
fygui.py 文件源码 项目:dayworkspace 作者: copie 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        self.app = QApplication(sys.argv)
        self.mainWindow = QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.mainWindow)

        self.Dialog = QtWidgets.QDialog()
        self.ui2 = Ui_Form()
        self.ui2.setupUi(self.Dialog)

        self.ui.textEdit.setReadOnly(True)
        self.clipboard = QApplication.clipboard()
        self.clipboard.selectionChanged.connect(self.fanyi)
        self.mainWindow.setWindowTitle("????")
        self.mainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.ui2.lineEdit.editingFinished.connect(self.callInput)
        self.Dialog.moveEvent = self.mainMove
        self.wordutil = wordutil()
        self.time = time.time()
        self.ui.textEdit.mouseDoubleClickEvent = self.inputText
gui.py 文件源码 项目:dottorrent-gui 作者: kz26 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def showAboutDialog(self):
        qdlg = QtWidgets.QDialog()
        ad = Ui_AboutDialog()
        ad.setupUi(qdlg)
        ad.programVersionLabel.setText("version {}".format(__version__))
        ad.dtVersionLabel.setText("(dottorrent {})".format(
            dottorrent.__version__))
        qdlg.exec_()
mainWIndow.py 文件源码 项目:Recruit 作者: Weiyanyu 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def outPutFile(self):
        self.Filedialog = QtWidgets.QDialog(self.centralwidget)
        self.Filedialog.setFixedSize(600,150)
        self.Filedialog.setWindowTitle('??EXCEL??')
        self.Filedialog.setModal(True)


        self.Dirlabel = QtWidgets.QLabel(self.Filedialog)
        self.Dirlabel.move(20,40)
        self.Dirlabel.setFixedSize(70,30)
        self.Dirlabel.setText('????: ')

        self.DirlineEdit = QtWidgets.QLineEdit(self.Filedialog)
        self.DirlineEdit.move(100,40)
        self.DirlineEdit.setFixedSize(350,30)
        self.DirlineEdit.setText(os.getcwd())

        self.Filelabel = QtWidgets.QLabel(self.Filedialog)
        self.Filelabel.move(20,100)
        self.Filelabel.setFixedSize(70,30)
        self.Filelabel.setText('????: ')

        self.FilelineEdit = QtWidgets.QLineEdit(self.Filedialog)
        self.FilelineEdit.move(100,100)
        self.FilelineEdit.setFixedSize(350,30)

        self.YesButton = QtWidgets.QPushButton(self.Filedialog)
        self.YesButton.move(470,100)
        self.YesButton.setFixedSize(100,30)
        self.YesButton.setText('??')
        self.YesButton.clicked.connect(self.saveFileToExcel)

        self.browlButton = QtWidgets.QPushButton(self.Filedialog)
        self.browlButton.move(470,40)
        self.browlButton.setFixedSize(100,30)
        self.browlButton.setText('??')
        self.browlButton.clicked.connect(self.openFile)

        self.Filedialog.show()
helloworld.py 文件源码 项目:rockthetaskbar 作者: jamesabel 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def about(self):
        about_box = QDialog()
        layout = QGridLayout(about_box)
        layout.addWidget(QLabel('hello world'))
        about_box.setLayout(layout)
        about_box.show()
        about_box.exec_()
MainWindowController.py 文件源码 项目:Qyoutube-dl 作者: lzambella 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def on_actionAbout_triggered(self):
        dialog = QDialog()
        dialog.ui = Ui_About()
        dialog.ui.setupUi(dialog)
        dialog.setAttribute(Qt.WA_DeleteOnClose)
        dialog.exec_()
highlight_instructions.py 文件源码 项目:idapython 作者: mr-tz 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def clear_colors(self):
        self.done(QtWidgets.QDialog.Accepted)
        highlighters = []
        highlighters.append(ClearHighlighter())
        highlight_instructions(highlighters)
colorPicker.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, colorDict, theme=("d8d8d8", "808080", "bcbcbc")):
        QtWidgets.QDialog.__init__(self)
        self.colorDict = colorDict
        self.theme = theme
        self.colordialog = customQColorDialog()
        self.setupUi(self)
        self.setWindowTitle("Colour Picker")
OnCue.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __init__(self, text, **kwargs):
            QtWidgets.QDialog.__init__(self)
            self.setupUi(self, text, **kwargs)
phonebook_app.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def addContact(self):
        print("add contact clicked")
        QtCore.QCoreApplication.processEvents()
        os.system('python addcontact_app.py')
        # self.window = QtWidgets.QDialog()
        # self.ui = addcontact_class()
        # self.ui.setupUi(self.window)
        # self.window.show()
        #phonebook_obj.hide()
phonebook_app.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def addContact(self):
        print("add contact clicked")
        QtCore.QCoreApplication.processEvents()
        os.system('python addcontact_app.py')
        # self.window = QtWidgets.QDialog()
        # self.ui = addcontact_class()
        # self.ui.setupUi(self.window)
        # self.window.show()
        #phonebook_obj.hide()
test_{{cookiecutter.application_name}}.py 文件源码 项目:cookiecutter-pyqt5 作者: mandeep 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_about_dialog(window, qtbot, mock):
    """Test the About item of the Help submenu.

    Qtbot clicks on the help sub menu and then navigates to the About item. Mock creates
    a QDialog object to be used for the test.
    """
    qtbot.mouseClick(window.help_sub_menu, Qt.LeftButton)
    qtbot.keyClick(window.help_sub_menu, Qt.Key_Down)
    mock.patch.object(QDialog, 'exec_', return_value='accept')
    qtbot.keyClick(window.help_sub_menu, Qt.Key_Enter)
makeScreenshots.py 文件源码 项目:doc 作者: bit-team 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def setScreenshotTimerDlg(mainWindow, dlgFunct, filename):
    def close():
        for child in mainWindow.children():
            if isinstance(child, QDialog):
                child.close()

    mainWindow.hide()

    def moveDlg():
        for child in mainWindow.children():
            if isinstance(child, QDialog):
                child.move(100, 50)

    dlgTimer = QTimer(mainWindow)
    dlgTimer.setInterval(10)
    dlgTimer.setSingleShot(True)
    dlgTimer.timeout.connect(dlgFunct)

    dlgMoveTimer = QTimer(mainWindow)
    dlgMoveTimer.setInterval(100)
    dlgMoveTimer.setSingleShot(True)
    dlgMoveTimer.timeout.connect(moveDlg)

    scrTimer = QTimer(mainWindow)
    scrTimer.setInterval(2000)
    scrTimer.setSingleShot(True)
    scrTimer.timeout.connect(lambda: takeScreenshot(filename))

    quitTimer = QTimer(mainWindow)
    quitTimer.setInterval(2500)
    quitTimer.setSingleShot(True)
    quitTimer.timeout.connect(close)

    scrTimer.start()
    quitTimer.start()
    dlgTimer.start()
    dlgMoveTimer.start()
    qapp.exec_()


问题


面经


文章

微信
公众号

扫码关注公众号