Python PyQt5.QtWidgets.QDialog() Examples


Python PyQt5.QtWidgets.QDialog() Examples

The following are 50 code examples for showing how to use PyQt5.QtWidgets.QDialog(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

+ Save to library
Example 1
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0904.py View Source Project 7 votesvote down vote up
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);")
        ''' 
Example 2
Project: Pyquino   Author: kmolLin   File: machine_mointor.py View Source Project 6 votesvote down vote up
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_()) 
Example 3
Project: scm-workbench   Author: barry-scott   File: wb_scm_app.py View Source Project 6 votesvote down vote up
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 ) 
Example 4
Project: idapython   Author: mr-tz   File: highlight_instructions.py View Source Project 6 votesvote down vote up
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) 
Example 5
Project: idapython   Author: mr-tz   File: highlight_instructions.py View Source Project 6 votesvote down vote up
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) 
Example 6
Project: pisi-player   Author: mthnzbk   File: ccdialog.py View Source Project 6 votesvote down vote up
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) 
Example 7
Project: desktop-stream-viewer   Author: AbiosGaming   File: main.py View Source Project 6 votesvote down vote up
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() 
Example 8
Project: mindfulness-at-the-computer   Author: SunyataZero   File: breathing_phrase_list_wt.py View Source Project 6 votesvote down vote up
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) 
Example 9
Project: mindfulness-at-the-computer   Author: SunyataZero   File: rest_action_list_wt.py View Source Project 6 votesvote down vote up
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 
Example 10
Project: DCheat   Author: DCheat   File: closePopup.py View Source Project 6 votesvote down vote up
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() 
Example 11
Project: DCheat   Author: DCheat   File: adminSelectCourse.py View Source Project 6 votesvote down vote up
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() 
Example 12
Project: pyENL   Author: jon85p   File: pyENL.py View Source Project 6 votesvote down vote up
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)) 
Example 13
Project: DownloaderForReddit   Author: MalloyDelacroix   File: FailedDownloadsDialog.py View Source Project 6 votesvote down vote up
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) 
Example 14
Project: DownloaderForReddit   Author: MalloyDelacroix   File: AddUserDialog.py View Source Project 6 votesvote down vote up
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) 
Example 15
Project: urh   Author: jopohl   File: InsertSinePlugin.py View Source Project 6 votesvote down vote up
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") 
Example 16
Project: urh   Author: jopohl   File: InsertSinePlugin.py View Source Project 6 votesvote down vote up
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 
Example 17
Project: urh   Author: jopohl   File: InsertSinePlugin.py View Source Project 6 votesvote down vote up
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 
Example 18
Project: opensnitch   Author: evilsocket   File: dialog.py View Source Project 6 votesvote down vote up
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() 
Example 19
Project: dayworkspace   Author: copie   File: fygui.py View Source Project 6 votesvote down vote up
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 
Example 20
Project: dottorrent-gui   Author: kz26   File: gui.py View Source Project 5 votesvote down vote up
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_() 
Example 21
Project: Recruit   Author: Weiyanyu   File: mainWIndow.py View Source Project 5 votesvote down vote up
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() 
Example 22
Project: rockthetaskbar   Author: jamesabel   File: helloworld.py View Source Project 5 votesvote down vote up
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_() 
Example 23
Project: Qyoutube-dl   Author: lzambella   File: MainWindowController.py View Source Project 5 votesvote down vote up
def on_actionAbout_triggered(self):
        dialog = QDialog()
        dialog.ui = Ui_About()
        dialog.ui.setupUi(dialog)
        dialog.setAttribute(Qt.WA_DeleteOnClose)
        dialog.exec_() 
Example 24
Project: idapython   Author: mr-tz   File: highlight_instructions.py View Source Project 5 votesvote down vote up
def clear_colors(self):
        self.done(QtWidgets.QDialog.Accepted)
        highlighters = []
        highlighters.append(ClearHighlighter())
        highlight_instructions(highlighters) 
Example 25
Project: OnCue   Author: featherbear   File: colorPicker.py View Source Project 5 votesvote down vote up
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") 
Example 26
Project: OnCue   Author: featherbear   File: OnCue.py View Source Project 5 votesvote down vote up
def __init__(self, text, **kwargs):
            QtWidgets.QDialog.__init__(self)
            self.setupUi(self, text, **kwargs) 
Example 27
Project: VIRTUAL-PHONE   Author: SumanKanrar-IEM   File: phonebook_app.py View Source Project 5 votesvote down vote up
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() 
Example 28
Project: VIRTUAL-PHONE   Author: SumanKanrar-IEM   File: phonebook_app.py View Source Project 5 votesvote down vote up
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() 
Example 29
Project: cookiecutter-pyqt5   Author: mandeep   File: test_{{cookiecutter.application_name}}.py View Source Project 5 votesvote down vote up
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) 
Example 30
Project: doc   Author: bit-team   File: makeScreenshots.py View Source Project 5 votesvote down vote up
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_() 
Example 31
Project: plexdesktop   Author: coryo   File: extra_widgets.py View Source Project 5 votesvote down vote up
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()) 
Example 32
Project: plexdesktop   Author: coryo   File: extra_widgets.py View Source Project 5 votesvote down vote up
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) 
Example 33
Project: DGP   Author: DynamicGravitySystems   File: main.py View Source Project 5 votesvote down vote up
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") 
Example 34
Project: DGP   Author: DynamicGravitySystems   File: splash.py View Source Project 5 votesvote down vote up
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 
Example 35
Project: Enibar   Author: ENIB   File: load_mail_model_window.py View Source Project 5 votesvote down vote up
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)) 
Example 36
Project: vivisect-py3   Author: bat-serjo   File: __init__.py View Source Project 5 votesvote down vote up
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) 
Example 37
Project: vivisect-py3   Author: bat-serjo   File: memsearch.py View Source Project 5 votesvote down vote up
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) 
Example 38
Project: vivisect-py3   Author: bat-serjo   File: memdump.py View Source Project 5 votesvote down vote up
def main():
    app = QtWidgets.QApplication([])
    dlg = MemDumpDialog(0x1234, '5678', 0x9ab)
    if dlg.exec_() == QtWidgets.QDialog.Accepted:
        print(dlg.filename)
        print(dlg.size) 
Example 39
Project: Sephrasto   Author: Aeolitus   File: CharakterMinderpaktWrapper.py View Source Project 5 votesvote down vote up
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 
Example 40
Project: Sephrasto   Author: Aeolitus   File: DatenbankSelectTypeWrapper.py View Source Project 5 votesvote down vote up
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 
Example 41
Project: Sephrasto   Author: Aeolitus   File: DatenbankEditVorteilWrapper.py View Source Project 5 votesvote down vote up
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 
Example 42
Project: pisi-player   Author: mthnzbk   File: tubedialog.py View Source Project 5 votesvote down vote up
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) 
Example 43
Project: unist_bb_downloader   Author: kcm4482   File: bb_downloader_mainUi.py View Source Project 5 votesvote down vote up
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_() 
Example 44
Project: universal_tool_template.py   Author: shiningdesign   File: UITranslator.py View Source Project 5 votesvote down vote up
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') 
Example 45
Project: universal_tool_template.py   Author: shiningdesign   File: GearBox_template_1010.py View Source Project 5 votesvote down vote up
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) 
Example 46
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0904.py View Source Project 5 votesvote down vote up
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) 
Example 47
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0803.py View Source Project 5 votesvote down vote up
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
    ############################################# 
Example 48
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0903.py View Source Project 5 votesvote down vote up
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) 
Example 49
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0903.py View Source Project 5 votesvote down vote up
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);")
        ''' 
Example 50
Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1010.py View Source Project 5 votesvote down vote up
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) 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值