Python PyQt5.QtWidgets 模块,QDialog() 实例源码

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

项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
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);")
        '''
项目:Pyquino    作者:kmolLin    | 项目源码 | 文件源码
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_())
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
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 )
项目:idapython    作者:mr-tz    | 项目源码 | 文件源码
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)
项目:idapython    作者:mr-tz    | 项目源码 | 文件源码
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)
项目:pisi-player    作者:mthnzbk    | 项目源码 | 文件源码
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)
项目:desktop-stream-viewer    作者:AbiosGaming    | 项目源码 | 文件源码
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()
项目:mindfulness-at-the-computer    作者:SunyataZero    | 项目源码 | 文件源码
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)
项目:mindfulness-at-the-computer    作者:SunyataZero    | 项目源码 | 文件源码
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
项目:DCheat    作者:DCheat    | 项目源码 | 文件源码
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()
项目:DCheat    作者:DCheat    | 项目源码 | 文件源码
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    作者:jon85p    | 项目源码 | 文件源码
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))
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
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)
项目:DownloaderForReddit    作者:MalloyDelacroix    | 项目源码 | 文件源码
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)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
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")
项目:urh    作者:jopohl    | 项目源码 | 文件源码
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
项目:urh    作者:jopohl    | 项目源码 | 文件源码
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
项目:opensnitch    作者:evilsocket    | 项目源码 | 文件源码
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()
项目:dayworkspace    作者:copie    | 项目源码 | 文件源码
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
项目:dottorrent-gui    作者:kz26    | 项目源码 | 文件源码
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_()
项目:Recruit    作者:Weiyanyu    | 项目源码 | 文件源码
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()
项目:rockthetaskbar    作者:jamesabel    | 项目源码 | 文件源码
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_()
项目:Qyoutube-dl    作者:lzambella    | 项目源码 | 文件源码
def on_actionAbout_triggered(self):
        dialog = QDialog()
        dialog.ui = Ui_About()
        dialog.ui.setupUi(dialog)
        dialog.setAttribute(Qt.WA_DeleteOnClose)
        dialog.exec_()
项目:idapython    作者:mr-tz    | 项目源码 | 文件源码
def clear_colors(self):
        self.done(QtWidgets.QDialog.Accepted)
        highlighters = []
        highlighters.append(ClearHighlighter())
        highlight_instructions(highlighters)
项目:OnCue    作者:featherbear    | 项目源码 | 文件源码
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    作者:featherbear    | 项目源码 | 文件源码
def __init__(self, text, **kwargs):
            QtWidgets.QDialog.__init__(self)
            self.setupUi(self, text, **kwargs)
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
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()
项目:VIRTUAL-PHONE    作者:SumanKanrar-IEM    | 项目源码 | 文件源码
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()
项目:cookiecutter-pyqt5    作者:mandeep    | 项目源码 | 文件源码
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)
项目:doc    作者:bit-team    | 项目源码 | 文件源码
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_()
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def __init__(self, media_object, parent=None):
        super().__init__(parent)
        self.setWindowTitle('Preferences')
        self.form = QtWidgets.QFormLayout(self)
        server = media_object.container.server
        settings = server.container(media_object.key)
        self.ids = []
        for item in settings['_children']:
            itype = item['type']
            if itype == 'bool':
                input_widget = QtWidgets.QCheckBox()
                input_widget.setCheckState(QtCore.Qt.Checked if item['value'] == 'true' else QtCore.Qt.Unchecked)
            elif itype == 'enum':
                input_widget = QtWidgets.QComboBox()
                input_widget.addItems(item['values'].split('|'))
                input_widget.setCurrentIndex(int(item['value']))
            elif itype == 'text':
                input_widget = QtWidgets.QLineEdit(item['value'])
                if item['secure'] == 'true':
                    input_widget.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
            else:
                input_widget = QtWidgets.QLabel('...')
            self.form.addRow(QtWidgets.QLabel(item['label']), input_widget)
            self.ids.append((item['id'], input_widget))

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)
        if self.exec_() == QtWidgets.QDialog.Accepted:
            media_object.container.server.request(media_object.key + '/set', params=self.extract_values())
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        s = plexdesktop.settings.Settings()
        self.setWindowTitle('Preferences')
        self.form = QtWidgets.QFormLayout(self)

        i = QtWidgets.QComboBox()
        i.addItems(plexdesktop.style.Style.Instance().themes)
        i.setCurrentIndex(i.findText(s.value('theme')))
        self.form.addRow(QtWidgets.QLabel('theme'), i)

        bf = QtWidgets.QSpinBox()
        bf.setValue(int(s.value('browser_font', 9)))
        self.form.addRow(QtWidgets.QLabel('browser font size'), bf)

        icon_size = QtWidgets.QLineEdit(str(s.value('thumb_size', 240)))
        icon_size.setValidator(QtGui.QIntValidator(0, 300))
        self.form.addRow(QtWidgets.QLabel('thumbnail size'), icon_size)

        widget_player = QtWidgets.QCheckBox()
        widget_player.setCheckState(QtCore.Qt.Checked if bool(int(s.value('widget_player', 0))) else QtCore.Qt.Unchecked)
        self.form.addRow(QtWidgets.QLabel('use widget player'), widget_player)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)

        if self.exec_() == QtWidgets.QDialog.Accepted:
            # s = Settings()
            theme = i.currentText()
            s.setValue('theme', theme)
            plexdesktop.style.Style.Instance().theme(theme)

            s.setValue('browser_font', bf.value())

            s.setValue('thumb_size', int(icon_size.text()))

            s.setValue('widget_player', 1 if widget_player.checkState() == QtCore.Qt.Checked else 0)
项目:DGP    作者:DynamicGravitySystems    | 项目源码 | 文件源码
def flight_info(self, item):
        data = item.getData(QtCore.Qt.UserRole)
        if isinstance(data, prj.Flight):
            dialog = QtWidgets.QDialog(self)
            dialog.setLayout(QtWidgets.QVBoxLayout())
            dialog.exec_()
            print("Flight info: {}".format(item.text()))
        else:
            print("Info event: Not a flight")
项目:DGP    作者:DynamicGravitySystems    | 项目源码 | 文件源码
def accept(self, project=None):
        """Runs some basic verification before calling QDialog accept()."""

        # Case where project object is passed to accept() (when creating new project)
        if isinstance(project, prj.GravityProject):
            self.log.debug("Opening new project: {}".format(project.name))
        elif not self.project_path:
            self.log.error("No valid project selected.")
        else:
            try:
                project = prj.AirborneProject.load(self.project_path)
            except FileNotFoundError:
                self.log.error("Project could not be loaded from path: {}".format(self.project_path))
                return

        self.update_recent_files(self.recent_file, {project.name: project.projectdir})
        # Show a progress dialog for loading the project (as we generate plots upon load)
        progress = QtWidgets.QProgressDialog("Loading Project", "Cancel", 0, len(project), self)
        progress.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint | QtCore.Qt.CustomizeWindowHint)
        progress.setModal(True)
        progress.setMinimumDuration(0)
        progress.setCancelButton(None)  # Remove the cancel button. Possibly add a slot that has load() check and cancel
        progress.setValue(1)  # Set an initial value to show the dialog

        main_window = MainWindow(project)
        main_window.status.connect(progress.setLabelText)
        main_window.progress.connect(progress.setValue)
        main_window.load()
        progress.close()  # This isn't necessary if the min/max is set correctly, but just in case.
        super().accept()
        return main_window
项目:Enibar    作者:ENIB    | 项目源码 | 文件源码
def keyPressEvent(self, event):
        """ Rewrite QDialog KeyPressEvent to enable on the fly model deletion
        """
        if event.key() == QtCore.Qt.Key_Delete:
            item = self.model_list.currentItem()
            if not item:
                return
            if api.mail.delete_model(item.text()):
                self.model_list.takeItem(self.model_list.row(item))
项目:vivisect-py3    作者:bat-serjo    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent=parent)
        self.modinfo = None

        self.setWindowTitle('Select a module...')

        vlyt = QtWidgets.QVBoxLayout()
        hlyt = QtWidgets.QHBoxLayout()

        self.structtree = VQStructNamespacesView(parent=self)

        hbox = QtWidgets.QWidget(parent=self)

        ok = QtWidgets.QPushButton("Ok", parent=hbox)
        cancel = QtWidgets.QPushButton("Cancel", parent=hbox)

        self.structtree.doubleClicked.connect(self.dialog_activated)

        ok.clicked.connect(self.dialog_ok)
        cancel.clicked.connect(self.dialog_cancel)

        hlyt.addStretch(1)
        hlyt.addWidget(cancel)
        hlyt.addWidget(ok)
        hbox.setLayout(hlyt)

        vlyt.addWidget(self.structtree)
        vlyt.addWidget(hbox)
        self.setLayout(vlyt)

        self.resize(500, 500)
项目:vivisect-py3    作者:bat-serjo    | 项目源码 | 文件源码
def main():
    app = QtWidgets.QApplication([])
    dlg = MemSearchDialog()
    font = QtWidgets.QFont('Courier')  # 'Consolas', 10)#'Courier New', 10)
    dlg.hex_edit.setFont(font)
    if dlg.exec_() == QtWidgets.QDialog.Accepted:
        print(dlg.pattern)
        print(dlg.filename)
项目:vivisect-py3    作者:bat-serjo    | 项目源码 | 文件源码
def main():
    app = QtWidgets.QApplication([])
    dlg = MemDumpDialog(0x1234, '5678', 0x9ab)
    if dlg.exec_() == QtWidgets.QDialog.Accepted:
        print(dlg.filename)
        print(dlg.size)
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        if Wolke.Debug:
            print("Initializing Minderpakt...")
        self.formVor = QtWidgets.QDialog()
        self.uiVor = CharakterMinderpakt.Ui_Dialog()
        self.uiVor.setupUi(self.formVor)
        self.formVor.setWindowFlags(
                QtCore.Qt.Window |
                QtCore.Qt.CustomizeWindowHint |
                QtCore.Qt.WindowTitleHint |
                QtCore.Qt.WindowCloseButtonHint)

        self.uiVor.treeWidget.itemSelectionChanged.connect(self.vortClicked)
        self.uiVor.treeWidget.header().setSectionResizeMode(0,1)
        if len(Wolke.Char.vorteile) > 0:
            self.currentVort = Wolke.Char.vorteile[0]
        else:
            self.currentVort = ""
        self.initVorteile()
        self.formVor.setWindowModality(QtCore.Qt.ApplicationModal)
        self.formVor.show()
        self.ret = self.formVor.exec_()
        if self.ret == QtWidgets.QDialog.Accepted:
            if self.currentVort not in Wolke.DB.vorteile:
                self.minderpakt = None
            else:
                self.minderpakt = self.currentVort
        else:
            self.minderpakt = None
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()
        Dialog = QtWidgets.QDialog()
        ui = DatenbankSelectType.Ui_Dialog()
        ui.setupUi(Dialog)

        Dialog.setWindowFlags(
                QtCore.Qt.Window |
                QtCore.Qt.CustomizeWindowHint |
                QtCore.Qt.WindowTitleHint |
                QtCore.Qt.WindowCloseButtonHint)

        Dialog.show()
        ret = Dialog.exec_()
        if ret == QtWidgets.QDialog.Accepted:
            if ui.buttonTalent.isChecked():
                self.entryType = "Talent"
            elif ui.buttonVorteil.isChecked():
                self.entryType = "Vorteil"
            elif ui.buttonFertigkeit.isChecked():
                self.entryType = "Fertigkeit"
            elif ui.buttonUebernatuerlich.isChecked():
                self.entryType = "Uebernatuerlich"
            else:
                self.entryType = "Waffe"
        else: 
            self.entryType = None
项目:Sephrasto    作者:Aeolitus    | 项目源码 | 文件源码
def __init__(self, vorteil=None):
        super().__init__()
        if vorteil is None:
            vorteil = Fertigkeiten.Vorteil()
        vorteilDialog = QtWidgets.QDialog()
        ui = DatenbankEditVorteil.Ui_talentDialog()
        ui.setupUi(vorteilDialog)

        vorteilDialog.setWindowFlags(
                QtCore.Qt.Window |
                QtCore.Qt.CustomizeWindowHint |
                QtCore.Qt.WindowTitleHint |
                QtCore.Qt.WindowCloseButtonHint)

        ui.nameEdit.setText(vorteil.name)
        ui.kostenEdit.setValue(vorteil.kosten)
        ui.comboNachkauf.setCurrentText(vorteil.nachkauf)
        ui.comboTyp.setCurrentIndex(vorteil.typ)
        ui.voraussetzungenEdit.setPlainText(Hilfsmethoden.VorArray2Str(vorteil.voraussetzungen, None))
        ui.textEdit.setPlainText(vorteil.text)
        ui.checkVariable.setChecked(vorteil.variable!=0)
        vorteilDialog.show()
        ret = vorteilDialog.exec_()
        if ret == QtWidgets.QDialog.Accepted:
            self.vorteil = Fertigkeiten.Vorteil()
            self.vorteil.name = ui.nameEdit.text()
            self.vorteil.kosten = ui.kostenEdit.value()
            self.vorteil.nachkauf = ui.comboNachkauf.currentText()
            self.vorteil.voraussetzungen = Hilfsmethoden.VorStr2Array(ui.voraussetzungenEdit.toPlainText(),None)
            self.vorteil.typ = ui.comboTyp.currentIndex()
            self.vorteil.variable = int(ui.checkVariable.isChecked())
            self.vorteil.text = ui.textEdit.toPlainText()
        else:
            self.vorteil = None
项目:pisi-player    作者:mthnzbk    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__()
        self.parent = parent
        self.resize(400, 75)
        self.setWindowFlags(Qt.Tool)
        self.move(settings().value("Youtube/position") or QPoint(250, 250))
        self.setWindowIcon(QIcon.fromTheme("pisiplayer"))
        self.setWindowTitle(self.tr("Youtube'dan Oynat"))
        self.setStyleSheet("QDialog {background-color: rgba(255, 255, 255, 200); border-color:  rgba(255, 255, 255, 200); border-width: 1px; border-style outset;}")
        self.setVisible(False)

        vlayout = QVBoxLayout()
        self.setLayout(vlayout)

        hlayout = QHBoxLayout()
        vlayout.addLayout(hlayout)


        self.tube_line = QLineEdit(self)
        self.tube_line.setMinimumHeight(30)
        self.tube_line.setStyleSheet("QLineEdit {background-color: white; color: black; border-radius: 3px;\
                                     border-color: lightgray; border-style: solid; border-width:2px;}")
        self.tube_line.setPlaceholderText("https://www.youtube.com/watch?v=mY--4-vzY6E")
        hlayout.addWidget(self.tube_line)

        self.tube_button = QPushButton(self)
        self.tube_button.setMinimumHeight(30)
        self.tube_button.setStyleSheet("QPushButton {background-color: #55aaff; color: white; border-width:1px; font-weight: bold; \
                                       border-color: #55aaff; border-style: solid; padding-left: 3px; padding-right: 3px; border-radius: 3px;}")
        self.tube_button.setText(self.tr("Video Oynat"))
        hlayout.addWidget(self.tube_button)

        self.tube_warning = QLabel(self)
        self.tube_warning.setVisible(False)
        self.tube_warning.setStyleSheet("QLabel {color: rgb(255, 0, 0); font-weight: bold; background-color: white;}")
        self.tube_warning.setText(self.tr("Verilen ba?lant? geçersiz!"))
        vlayout.addWidget(self.tube_warning)

        self.tube_line.returnPressed.connect(self.tube_button.animateClick)
        self.tube_button.clicked.connect(self.videoParse)
项目:unist_bb_downloader    作者:kcm4482    | 项目源码 | 文件源码
def Download(self):
        import bb_downloader_downloadUi as downloadUi
        DownloadDialog = QtWidgets.QDialog(self.MainWindow)
        ui = downloadUi.Ui_DownloadDialog(DownloadDialog, self.download_list, self.account)
        ui.setupUi(DownloadDialog)
        DownloadDialog.exec_()
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout('vbox', 'main_layout')
            self.setLayout(main_layout)

        #------------------------------
        # user ui creation part
        #------------------------------
        # + template: qui version since universal tool template v7
        #   - no extra variable name, all text based creation and reference

        self.qui('dict_table | source_txtEdit | result_txtEdit','info_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileLang_choice | fileExport_btn;Export', 'fileBtn_layout;hbox')

        self.qui('info_split | process_btn;Process and Update Memory From UI | fileBtn_layout', 'main_layout')
        self.uiList["source_txtEdit"].setWrap(0)
        self.uiList["result_txtEdit"].setWrap(0)

        #------------- end ui creation --------------------
        for name,each in self.uiList.items():
            if isinstance(each, QtWidgets.QLayout) and name!='main_layout' and not name.endswith('_grp_layout'):
                each.setContentsMargins(0,0,0,0) # clear extra margin some nested layout
        #self.quickInfo('Ready')
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self, layout='grid'):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout(layout, 'main_layout')
            self.setLayout(main_layout)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self, layout='grid'):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout(layout, 'main_layout')
            self.setLayout(main_layout)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupWin(self):
        self.setWindowTitle(self.name + " - v" + self.version + " - host: " + hostMode)
        self.setWindowIcon(self.icon)
        # initial win drag position
        self.drag_position=QtGui.QCursor.pos()

        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);")
        '''

    #############################################
    # customized SUPER quick ui function for speed up programming
    #############################################
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout('vbox', 'main_layout')
            self.setLayout(main_layout)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
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);")
        '''
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self, layout='grid'):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout(layout, 'main_layout')
            self.setLayout(main_layout)