Ejemplo n.º 1
0
    def about(self):  # The About dialog
        Dialog = QDialog()
        Dialog.resize(341, 251)
        Dialog.setMinimumSize(QtCore.QSize(341, 251))
        Dialog.setMaximumSize(QtCore.QSize(341, 251))
        Dialog.setBaseSize(QtCore.QSize(341, 251))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("icons/iconbig.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.textEdit = QtGui.QTextEdit(Dialog)
        self.textEdit.setGeometry(QtCore.QRect(0, 0, 341, 251))
        self.textEdit.setAutoFillBackground(False)
        self.textEdit.setReadOnly(True)
        Dialog.setWindowTitle(_translate("Dialog", "About", None))
        self.textEdit.setHtml(_translate("Dialog",
                                         "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                                         "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                                         "p, li { white-space: pre-wrap; }\n"
                                         "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
                                         "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600; text-decoration: underline;\">Email Find v1.0</span></p>\n"
                                         "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;\"><br /></p>\n"
                                         "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt;\">It is a Freeware to extract email addresses from webpages and files.</span></p>\n"
                                         "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;\"><br /></p>\n"
                                         "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt;\">Programmed By / </span><span style=\" font-size:14pt; font-weight:600;\">Ahmed Abdelkareem</span><span style=\" font-size:14pt;\"> &lt;[email protected]&gt;</span></p>\n"
                                         "<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt;\"><br /></p>\n"
                                         "<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt;\">Under GNU/GPLv3</span></p></body></html>",
                                         None))

        Dialog.show()
        Dialog.exec_()
Ejemplo n.º 2
0
 def giveCreditWhereCreditIsDue(self):
     """Displays a simple dialog containing developer information,
     and credit is given where credit is due
     """
     credits = QDialog()
     Ui_AboutCredits().setupUi(credits)
     credits.exec_()
Ejemplo n.º 3
0
def anki_deck_manager_setup():
    """
    Configure the Ui_Dialog.

    This function starts with collecting the data
    needed to fill the table in the ui, then
    straps it all together and exec it to present
    it to the user.
    """
    if not mw.col.conf.get('pubSupFirstRun', ""):

        create_tables()
        ankiPubSubSettings()  # Open username and passwor dialog
        mw.col.conf['pubSupFirstRun'] = "True"
        mw.col.save()
        mw.col.db.commit()
    # create an cell widget

    f = QDialog()
    f.ui = Ui_AnkiPubSubDeckManager()
    f.ui.setupUi(f)

    f.ui.ankiPubSubSettings.clicked.connect(lambda: ankiPubSubSettings())  # Wireup username and passwor dialog
    f.ui.publishDeck.clicked.connect(partial(publishDeckGui, f))
    drawTable(f)  # draws the table for the decks
    f.ui.ankiPubSubAddDeck.clicked.connect(partial(addRemoteDeckButton, f))  # subscribe to remote deck button
    f.exec_()
Ejemplo n.º 4
0
 def iconChooser(self):
     ' Choose a Icon and copy it to clipboard '
     #
     from .std_icon_naming import std_icon_naming as a
     #
     prv = QDialog(self.dock)
     prv.setWindowFlags(Qt.FramelessWindowHint)
     prv.setAutoFillBackground(True)
     prv.setGeometry(self.fileView.geometry())
     table = QTableWidget(prv)
     table.setColumnCount(1)
     table.setRowCount(len(a))
     table.verticalHeader().setVisible(True)
     table.horizontalHeader().setVisible(False)
     table.setShowGrid(True)
     table.setIconSize(QSize(128, 128))
     for index, icon in enumerate(a):
         item = QTableWidgetItem(QIcon.fromTheme(icon), '')
         # item.setData(Qt.UserRole, '')
         item.setToolTip(icon)
         table.setItem(index, 0, item)
     table.clicked.connect(lambda: QApplication.clipboard().setText(
       'QtGui.QIcon.fromTheme("{}")'.format(table.currentItem().toolTip())))
     table.doubleClicked.connect(prv.close)
     table.resizeColumnsToContents()
     table.resizeRowsToContents()
     QLabel('<h3> <br> 1 Click Copy, 2 Clicks Close </h3>', table)
     table.resize(prv.size())
     prv.exec_()
Ejemplo n.º 5
0
 def on_actionShow_logfiles_triggered(self):
     self._item.setText(3, '')
     try:
         loglines = self._client.getServiceLogs(self._service,
                                                self._instance)
     except ClientError as err:
         self._item.setText(3, str(err))
         return
     if not loglines:
         self._item.setText(3, 'Service does not return logs')
         return
     dlg = QDialog(self)
     loadUi(dlg, 'details.ui')
     dlg.tabber.clear()
     logs = []
     for logline in loglines:
         filename, content = logline.split(':', 1)
         if not logs or filename != logs[-1][0]:
             logs.append((filename, []))
         logs[-1][1].append(content)
     for filename, content in logs:
         widget = QPlainTextEdit(dlg)
         font = widget.font()
         font.setFamily('Monospace')
         widget.setFont(font)
         widget.setPlainText(''.join(content))
         dlg.tabber.addTab(widget, filename)
     dlg.exec_()
Ejemplo n.º 6
0
    def show_paper_dialog(self):
        dialog = QDialog(self.gui.main_window)
        dialog.setModal(1)
        dialog.setWindowTitle(_("Prypto Redeem"))
        vbox = QVBoxLayout()
        grid = QGridLayout()
        grid.setColumnStretch(0,1)
       
       
       
       
        grid.addWidget(QLabel(_('Prypto Code') + ':'), 3, 0)
        self.pryp = QLineEdit()
           
        grid.addWidget(self.pryp, 3, 1)
       
        grid.addWidget(QLabel(_('Security Code') + ':'), 4, 0)
        self.sec = QLineEdit()
        grid.addWidget(self.sec, 4, 1)
       
       
        nextline = 5
       
       
        b = QPushButton(_("Redeem"))
        b.clicked.connect(self.do_credit)
        grid.addWidget(b, nextline, 0)                        
 
       
        vbox.addLayout(grid)
        dialog.setLayout(vbox)
        dialog.exec_()
Ejemplo n.º 7
0
 def showErrors(self, intro = None):
     if not self.errors:
         return
     dialog = QDialog(self.main_window)
     dialog.setObjectName('errorDialog')
     dialog.setWindowTitle(tr('Error(s)'))
     layout = QVBoxLayout(dialog)
     dialog.setLayout(layout)
     if intro != '':
         if intro is None:
             intro = translate('MainWindow',
                 'Some errors were found in this form:')
         label = QLabel(intro)
         layout.addWidget(label)
     for subject, messages in self.errors.items():
         for msg in messages:
             if msg:
                 label = QLabel('- %s%s%s' % (subject,
                     unicode(tr(': ')),
                     unicode(msg)))
             else:
                 label = QLabel('- %s' % unicode(subject))
             layout.addWidget(label)
     button = createButton(translate('MainWindow',
         'Edit again'), dialog, dialog, SLOT('close()'))
     layout.addWidget(button)
     dialog.exec_()
Ejemplo n.º 8
0
        def showMessageSlot(self):
            dialog = QDialog(core.mainWindow())
            uic.loadUi(os.path.join(DATA_FILES_PATH, 'ui/Exception.ui'), dialog)

            dialog.textBrowser.setText(text)

            dialog.exec_()
Ejemplo n.º 9
0
    def information(self, summary, msg, extended_msg=None):
        msg = "<big><b>%s</b></big><br />%s" % (summary, msg)

        dialogue = QDialog(self.window_main)
        loadUi("dialog_error.ui", dialogue)
        self.translate_widget_children(dialogue)
        dialogue.label_error.setText(msg)
        if extended_msg != None:
            dialogue.textview_error.setText(extended_msg)
            dialogue.textview_error.show()
        else:
            dialogue.textview_error.hide()
        dialogue.button_bugreport.hide()
        dialogue.setWindowTitle(_("Information"))

        if os.path.exists(
                "/usr/share/icons/oxygen/48x48/status/dialog-information.png"):
            messageIcon = QPixmap(
                "/usr/share/icons/oxygen/48x48/status/dialog-information.png")
        elif os.path.exists(
                "/usr/lib/kde4/share/icons/oxygen/48x48/status/dialog-information.png"
        ):
            messageIcon = QPixmap(
                "/usr/lib/kde4/share/icons/oxygen/48x48/status/dialog-information.png"
            )
        else:
            messageIcon = QPixmap(
                "/usr/share/icons/crystalsvg/32x32/actions/messagebox_info.png"
            )
        dialogue.image.setPixmap(messageIcon)
        dialogue.exec_()
Ejemplo n.º 10
0
 def exec_(self, intArg=0, strArg=None):
     if strArg is None:
         self.notice_content.setText(noticeDict[intArg])
     else:
         self.notice_content.setText(noticeDict[intArg] + u'\n' + strArg)
     self.status = False
     QDialog.exec_(self)
Ejemplo n.º 11
0
    def error(self, pkg, errormsg):
        InstallProgress.error(self, pkg, errormsg)
        logging.error("got an error from dpkg for pkg: '%s': '%s'" %
                      (pkg, errormsg))
        # we do not report followup errors from earlier failures
        if gettext.dgettext(
                'dpkg',
                "dependency problems - leaving unconfigured") in errormsg:
            return False
        summary = _("Could not install '%s'") % pkg
        msg = _("The upgrade will continue but the '%s' package may not "
                "be in a working state. Please consider submitting a "
                "bug report about it.") % pkg
        msg = "<big><b>%s</b></big><br />%s" % (summary, msg)

        dialogue = QDialog(self.parent.window_main)
        loadUi("dialog_error.ui", dialogue)
        self.parent.translate_widget_children(dialogue)
        dialogue.label_error.setText(msg)
        if errormsg != None:
            dialogue.textview_error.setText(errormsg)
            dialogue.textview_error.show()
        else:
            dialogue.textview_error.hide()
        dialogue.connect(dialogue.button_bugreport, SIGNAL("clicked()"),
                         self.parent.reportBug)
        dialogue.exec_()
Ejemplo n.º 12
0
    def _handleException(self, exctype, excvalue, exctb):
        """Crash handler."""

        if (issubclass(exctype, KeyboardInterrupt)
                or issubclass(exctype, SystemExit)):
            return

        # we handle the exception here, hand it to apport and run the
        # apport gui manually after it because we kill u-m during the upgrade
        # to prevent it from popping up for reboot notifications or FF restart
        # notifications or somesuch
        lines = traceback.format_exception(exctype, excvalue, exctb)
        logging.error("not handled exception in KDE frontend:\n%s" %
                      "\n".join(lines))
        # we can't be sure that apport will run in the middle of a upgrade
        # so we still show a error message here
        apport_crash(exctype, excvalue, exctb)
        if not run_apport():
            tbtext = ''.join(
                traceback.format_exception(exctype, excvalue, exctb))
            dialog = QDialog(self.window_main)
            loadUi("dialog_error.ui", dialog)
            self.translate_widget_children(self.dialog)
            #FIXME make URL work
            #dialog.connect(dialog.beastie_url, SIGNAL("leftClickedURL(const QString&)"), self.openURL)
            dialog.crash_detail.setText(tbtext)
            dialog.exec_()
        sys.exit(1)
Ejemplo n.º 13
0
    def error(self, summary, msg, extended_msg=None):
        msg = "<big><b>%s</b></big><br />%s" % (summary, msg)

        dialogue = QDialog(self.window_main)
        loadUi("dialog_error.ui", dialogue)
        self.translate_widget_children(dialogue)
        dialogue.label_error.setText(msg)
        if extended_msg != None:
            dialogue.textview_error.setText(extended_msg)
            dialogue.textview_error.show()
        else:
            dialogue.textview_error.hide()
        dialogue.button_close.show()
        self.app.connect(dialogue.button_bugreport, SIGNAL("clicked()"),
                         self.reportBug)

        if os.path.exists(
                "/usr/share/icons/oxygen/48x48/status/dialog-error.png"):
            messageIcon = QPixmap(
                "/usr/share/icons/oxygen/48x48/status/dialog-error.png")
        elif os.path.exists(
                "/usr/lib/kde4/share/icons/oxygen/48x48/status/dialog-error.png"
        ):
            messageIcon = QPixmap(
                "/usr/lib/kde4/share/icons/oxygen/48x48/status/dialog-error.png"
            )
        else:
            messageIcon = QPixmap(
                "/usr/share/icons/crystalsvg/32x32/actions/messagebox_critical.png"
            )
        dialogue.image.setPixmap(messageIcon)
        dialogue.exec_()

        return False
Ejemplo n.º 14
0
    def saveClicked(self):
        properties = self.propertyWidget().getCurrentUi()
        if self._widgetName not in self._app.storedSettings().keys():
            self._app.storedSettings()[self._widgetName] = []

        # Get the name the user wants to use
        nameDialog = QDialog(self)
        nameUi = Ui_StoredSettingsName()
        nameUi.setupUi(nameDialog)

        def saveSettings():
            name = Util.getWidgetValue(nameUi.name)
            name = name.strip()
            if name == "":
                failedMessage = QMessageBox(nameDialog)
                failedMessage.setText("Cannot use a blank name.")
                failedMessage.exec_()
            else:
                self._app.storedSettings()[self._widgetName].append([name, properties])
                nameDialog.close()

        def cancelSettings():
            nameDialog.close()

        nameUi.buttons.accepted.connect(saveSettings)
        nameUi.buttons.rejected.connect(cancelSettings)

        nameDialog.exec_()

        self.storedSettingsModel.doReset()
Ejemplo n.º 15
0
    def show_tx_qrcode(self, data, title):
        if not data: return
        d = QDialog(self.gui)
        d.setModal(1)
        d.setWindowTitle(title)
        d.setMinimumSize(250, 525)
        vbox = QVBoxLayout()
        qrw = QRCodeWidget(data)
        vbox.addWidget(qrw, 0)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        def print_qr(self):
            filename = "qrcode.bmp"
            electrum_gui.bmp.save_qrcode(qrw.qr, filename)
            QMessageBox.information(
                None, _('Message'),
                _("QR code saved to file") + " " + filename, _('OK'))

        b = QPushButton(_("Save"))
        hbox.addWidget(b)
        b.clicked.connect(print_qr)

        b = QPushButton(_("Close"))
        hbox.addWidget(b)
        b.clicked.connect(d.accept)
        b.setDefault(True)

        vbox.addLayout(hbox, 1)
        d.setLayout(vbox)
        d.exec_()
Ejemplo n.º 16
0
 def giveCreditWhereCreditIsDue(self):
     """Displays a simple dialog containing developer information,
     and credit is given where credit is due
     """
     credits = QDialog()
     Ui_AboutCredits().setupUi(credits)
     credits.exec_()
Ejemplo n.º 17
0
    def show_tx_qrcode(self, data, title):
        if not data: return
        d = QDialog(self.gui)
        d.setModal(1)
        d.setWindowTitle(title)
        d.setMinimumSize(250, 525)
        vbox = QVBoxLayout()
        qrw = QRCodeWidget(data)
        vbox.addWidget(qrw, 0)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        def print_qr(self):
            filename = "qrcode.bmp"
            electrum_gui.bmp.save_qrcode(qrw.qr, filename)
            QMessageBox.information(None, _('Message'), _("QR code saved to file") + " " + filename, _('OK'))

        b = QPushButton(_("Save"))
        hbox.addWidget(b)
        b.clicked.connect(print_qr)

        b = QPushButton(_("Close"))
        hbox.addWidget(b)
        b.clicked.connect(d.accept)
        b.setDefault(True)

        vbox.addLayout(hbox, 1)
        d.setLayout(vbox)
        d.exec_()
Ejemplo n.º 18
0
    def create_transaction_details_window(self, tx_dict):
        tx = Transaction(tx_dict["hex"])
            
        dialog = QDialog(self.gui)
        dialog.setMinimumWidth(500)
        dialog.setWindowTitle(_('Process Offline transaction'))
        dialog.setModal(1)

        l = QGridLayout()
        dialog.setLayout(l)

        l.addWidget(QLabel(_("Transaction status:")), 3,0)
        l.addWidget(QLabel(_("Actions")), 4,0)

        if tx_dict["complete"] == False:
            l.addWidget(QLabel(_("Unsigned")), 3,1)
            if self.gui.wallet.seed :
                b = QPushButton("Sign transaction")
                input_info = json.loads(tx_dict["input_info"])
                b.clicked.connect(lambda: self.sign_raw_transaction(tx, input_info, dialog))
                l.addWidget(b, 4, 1)
            else:
                l.addWidget(QLabel(_("Wallet is de-seeded, can't sign.")), 4,1)
        else:
            l.addWidget(QLabel(_("Signed")), 3,1)
            b = QPushButton("Broadcast transaction")
            b.clicked.connect(lambda: self.gui.send_raw_transaction(tx, dialog))
            l.addWidget(b,4,1)
    
        l.addWidget( self.gui.generate_transaction_information_widget(tx), 0,0,2,3)
        closeButton = QPushButton(_("Close"))
        closeButton.clicked.connect(lambda: dialog.done(0))
        l.addWidget(closeButton, 4,2)

        dialog.exec_()
Ejemplo n.º 19
0
    def on_pushButton_clicked(self):  #denglu jiemian
        admin = self.lineEdit.text()
        key = self.lineEdit_2.text()
        if admin == 'zhucheng' and key == '15':
            self.close()
            dlg = QDialog()
            secondUi.setupUi(dlg)
            global cap
            cap = cv2.VideoCapture(0)
            global cap1
            cap1 = cv2.VideoCapture(1)

            QtCore.QObject.connect(secondUi.pushButton_11,
                                   QtCore.SIGNAL(_fromUtf8("clicked()")),
                                   self.OpenCarCamera)
            QtCore.QObject.connect(secondUi.pushButton_10,
                                   QtCore.SIGNAL(_fromUtf8("clicked()")),
                                   self.CloseCarCamera)
            QtCore.QObject.connect(secondUi.pushButton_4,
                                   QtCore.SIGNAL(_fromUtf8("clicked()")),
                                   self.ConnectIP)
            QtCore.QObject.connect(secondUi.pushButton_6,
                                   QtCore.SIGNAL(_fromUtf8("clicked()")),
                                   self.OpenUAVCamera)
            dlg.exec_()
Ejemplo n.º 20
0
 def launch_preset_calibration(self):
     self.ui.cal_presets_ui = Ui_cal_presets()
     dialog = QDialog()
     dialog.ui = self.ui.cal_presets_ui
     dialog.ui.setupUi(dialog)
     dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     handler = PresetHandler(self.ui)
     dialog.exec_()
Ejemplo n.º 21
0
 def launch_ri(self):
     self.ui.ri_ui = Ui_RI_dialog() 
     dialog = QDialog()
     dialog.ui = self.ui.ri_ui
     dialog.ui.setupUi(dialog)
     dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     handler = RiHandler(self.ui)
     dialog.exec_()
Ejemplo n.º 22
0
 def onError(self, type):
     dialog = QDialog(self.window)
     text  = QLabel(dialog)
     if(type is "url"):
         text.setText("URL is invalid")
     else:
         text.setText("DIR is invalid")
     dialog.exec_()
Ejemplo n.º 23
0
        def showMessageSlot(self):
            dialog = QDialog(core.mainWindow())
            uic.loadUi(os.path.join(DATA_FILES_PATH, 'ui/Exception.ui'),
                       dialog)

            dialog.textBrowser.setText(text)

            dialog.exec_()
Ejemplo n.º 24
0
    def exec_(self):
        """QDialog.exec() implementation. Updates completion before showing widget
        """
        self.setWindowTitle(os.path.abspath(os.path.curdir))

        self._edit.setText("")
        self._updateCompletion()
        QDialog.exec_(self)
Ejemplo n.º 25
0
 def launch_calibration(self):
     self.ui.cal_ui = Ui_cal_dialog() # Make the calibration dialog available app-wise
     dialog = QDialog()
     dialog.ui = self.ui.cal_ui
     dialog.ui.setupUi(dialog)
     dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     handler = CalHandler(self.ui)
     dialog.exec_()
Ejemplo n.º 26
0
 def launch_conalt(self):
     self.ui.conalt_ui = Ui_conalt_dialog() 
     dialog = QDialog()
     dialog.ui = self.ui.conalt_ui
     dialog.ui.setupUi(dialog)
     dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     handler = ConAltHandler(self.ui)
     dialog.exec_()
Ejemplo n.º 27
0
def publishDeckGui(ankiDeckForm):
    f = QDialog()
    f.ui = Ui_publishDeckForm()
    f.ui.setupUi(f)
    f.ui.pushButtonPublishDeck.clicked.connect(partial(publishDeckGuiOk, f, ankiDeckForm))
    f.ui.comboBox.addItems(mw.col.decks.allNames())
    f.ui.pushButtonCancel.clicked.connect(lambda: f.done(0))
    f.exec_()
Ejemplo n.º 28
0
def ankiDeckSettings(did):
    f = QDialog()
    f.ui = Ui_Form()
    f.ui.setupUi(f)
    table = f.ui.tableWidget
    changes = Queue()
    groups = getAccessGroups(did,
                             mw.col.conf.get('ankipubsubServer',
                                             "http://144.76.172.187:5000/v0"),
                             mw.col.conf.get('pubSubName', ""),
                             mw.col.conf.get('pubSubPassword', ""))
    #users = uniqueList(groups.get('readGroup').append(groups.get('writeGroup').append(groups.get('adminGroup'))))
    readGroup = groups.get('readGroup') if groups.get('readGroup') else []
    writeGroup = groups.get('writeGroup') if groups.get('writeGroup') else []
    adminGroup = groups.get('adminGroup') if groups.get('adminGroup') else []
    users = uniqueList(readGroup + writeGroup + adminGroup)

    table.setColumnCount(4)
    table.setRowCount(len(users))
    for (i, user) in enumerate(users):
        isAdmin = DisableCheckBox(table)
        canWrite = DisableCheckBox(table)
        canRead = DisableCheckBox(table)
        if user in readGroup:
            canRead.setChecked(True)
        if user in writeGroup:
            canWrite.setChecked(True)
        if user in adminGroup:
            isAdmin.setChecked(True)
        if not mw.col.conf.get('pubSubName', "") in adminGroup and mw.col.conf.get('pubSubName', ""):
            isAdmin.setModifiable(False)
            canWrite.setModifiable(False)
            canRead.setModifiable(False)
            f.ui.AddUser.setEnabled(False)

        table.setItem(i, 0, QTableWidgetItem(str(user)))
        isAdmin.connect(isAdmin, SIGNAL("stateChanged(int)"), partial(changes.put, (i, 3, isAdmin)))
        canWrite.connect(canWrite, SIGNAL("stateChanged(int)"), partial(changes.put, (i, 2, canWrite)))
        canRead.connect(canRead, SIGNAL("stateChanged(int)"), partial(changes.put, (i, 1, canRead)))
        table.setCellWidget(i, 1, canRead)
        table.setCellWidget(i, 2, canWrite)
        table.setCellWidget(i, 3, isAdmin)

        """btnDelete = QPushButton(table)
        btnDelete.setGeometry(0, 0, 30, 30)

        btnDelete.setIcon(QIcon('../../addons/pubsub/images/Delete-Resized.jpg'))
        btnDelete.setIconSize(QSize(25, 25))
        btnDelete.clicked.connect(partial(table.removeRow, i))
        table.setCellWidget(i, 4, btnDelete)"""

    table.setHorizontalHeaderLabels(['Name', 'Read', 'Write', 'Admin', 'Delete'])
    table.resizeColumnsToContents()

    f.ui.AddUser.clicked.connect(lambda: addUser(table))
    f.ui.Cancel.clicked.connect(lambda: f.done(0))
    f.ui.Save.clicked.connect(lambda: deckSettingsSave(table, users, did, changes, f))
    f.exec_()
Ejemplo n.º 29
0
 def showThumbnail(self, record):
     d = QDialog()
     webView = QWebView(d)
     webView.setGeometry(300, 300, 300, 300)
     webView.load(QUrl(record["thumbnail"]))
     d.setWindowTitle("Thumbnail: " + record["satelliteName"] + ":" +
                      record["productId"])
     d.setWindowModality(Qt.ApplicationModal)
     d.exec_()
Ejemplo n.º 30
0
def ankiPubSubSettings():
    f = QDialog()
    f.ui = AnkiPubSubSettingsUI()
    f.ui.setupUi(f)
    f.ui.username.setText(mw.col.conf.get('pubSubName', ""))
    f.ui.password.setEchoMode(QLineEdit.Password)
    f.ui.password.setText(mw.col.conf.get('pubSubPassword', ""))
    f.ui.Login.clicked.connect(partial(ankiPubSubSettingsSave, form=f))
    f.exec_()
Ejemplo n.º 31
0
 def buttonInterfaceListClicked(self):
     obj = QDialog()
     objUi = loadUi(os.path.dirname(os.path.realpath(__file__)) + '/InterfaceSelectionDialog.ui', obj)
     count = 0
     for i in netifaces.interfaces():
         objUi.tableWidgetInterface.insertRow(count)
         objUi.tableWidgetInterface.setItem(count, 0, QTableWidgetItem(i))
         count = count + 1
     obj.exec_()
Ejemplo n.º 32
0
 def Configure(path, parent):
     wUi = devcfg()
     wUi.path = path
     w = QDialog(parent)
     wUi.setupUi(w)
     wUi.Load()
     #w.exec_()
     w.setModal(False)
     w.exec_()
Ejemplo n.º 33
0
 def seTitle(self):
     " set the title of the main window "
     dialog = QDialog(self)
     textEditInput = QLineEdit(" Type Title Here ")
     ok = QPushButton(" O K ")
     ok.clicked.connect(lambda: self.setWindowTitle(textEditInput.text()))
     ly = QVBoxLayout()
     [ly.addWidget(wdgt) for wdgt in (QLabel("Title:"), textEditInput, ok)]
     dialog.setLayout(ly)
     dialog.exec_()
Ejemplo n.º 34
0
 def buttonInterfaceListClicked(self):
     obj = QDialog()
     objUi = loadUi(
         os.path.dirname(os.path.realpath(__file__)) +
         '/InterfaceSelectionDialog.ui', obj)
     count = 0
     for i in netifaces.interfaces():
         objUi.tableWidgetInterface.insertRow(count)
         objUi.tableWidgetInterface.setItem(count, 0, QTableWidgetItem(i))
         count = count + 1
     obj.exec_()
Ejemplo n.º 35
0
 def on_actionShow_output_triggered(self):
     self._item.setText(3, '')
     try:
         output = self._client.getServiceOutput(self._service,
                                                self._instance)
     except ClientError as err:
         self._item.setText(3, str(err))
         return
     dlg = QDialog(self)
     loadUi(dlg, 'details.ui')
     dlg.outEdit.setPlainText(''.join(output))
     dlg.exec_()
Ejemplo n.º 36
0
    def exec_(self):
        """QDialog.exec() implementation. Updates completion before showing widget
        """
        try:
            curDir = os.path.abspath(os.path.curdir)
        except OSError:  # deleted
            curDir = '?'

        self.setWindowTitle(curDir)

        self._edit.setText('')
        self._updateCompletion()
        QDialog.exec_(self)
Ejemplo n.º 37
0
    def exec_(self):
        """QDialog.exec() implementation. Updates completion before showing widget
        """
        try:
            curDir = os.path.abspath(os.path.curdir)
        except OSError:  # deleted
            curDir = '?'

        self.setWindowTitle(curDir)

        self._edit.setText('')
        self._updateCompletion()
        QDialog.exec_(self)
Ejemplo n.º 38
0
def openImageViewer(pixmap, parent):
        dlg = QDialog()
        dlg.setWindowTitle("Image Viewer")
        dlg.setLayout(QGridLayout())
        dlg.layout().setContentsMargins(0,0,0,0)
        dlg.layout().setSizeConstraint(QLayout.SetNoConstraint)
        dlg.resize(600,600)
        label = QLabel()
        label.mouseReleaseEvent = lambda x: dlg.accept()
        label.setPixmap(pixmap)
        label.setScaledContents(True)
        dlg.layout().addWidget(label)
        dlg.exec_()
Ejemplo n.º 39
0
def openImageViewer(pixmap, parent):
        dlg = QDialog()
        dlg.setWindowTitle("Image Viewer")
        dlg.setLayout(QGridLayout())
        dlg.layout().setContentsMargins(0,0,0,0)
        dlg.layout().setSizeConstraint(QLayout.SetNoConstraint)
        dlg.resize(600,600)
        label = QLabel()
        label.mouseReleaseEvent = lambda x: dlg.accept()
        label.setPixmap(pixmap)
        label.setScaledContents(True)
        dlg.layout().addWidget(label)
        dlg.exec_()
Ejemplo n.º 40
0
 def on_pb_show_warnings_released(self):
     # show a dialog box with only the warnings from the conversion
     win = QDialog(self)
     win.resize(self.size() * 0.85)
     layout = QVBoxLayout()
     txt = QTextEdit(win)
     txt.setLineWrapMode(txt.NoWrap)
     txt.document().setPlainText('\n'.join(self.converter.warnings))
     pb = QPushButton('Close')
     self.connect(pb, SIGNAL('released()'), win.accept)
     layout.addWidget(txt)
     layout.addWidget(pb)
     win.setLayout(layout)
     win.exec_()
Ejemplo n.º 41
0
 def on_pb_show_warnings_released(self):
     # show a dialog box with only the warnings from the conversion
     win = QDialog(self)
     win.resize(self.size() * 0.85)
     layout = QVBoxLayout()
     txt = QTextEdit(win)
     txt.setLineWrapMode(txt.NoWrap)
     txt.document().setPlainText('\n'.join(self.converter.warnings))
     pb = QPushButton('Close')
     self.connect(pb, SIGNAL('released()'), win.accept)
     layout.addWidget(txt)
     layout.addWidget(pb)
     win.setLayout(layout)
     win.exec_()
Ejemplo n.º 42
0
 def addWindow(self, window, target):
     parent = QApplication.activeModalWidget()
     if not parent:
         parent = self
     dialog = QDialog(parent)
     dialog.setWindowTitle(_('Wizard'))
     dialog.setModal(True)
     layout = QHBoxLayout(dialog)
     layout.setContentsMargins(0, 0, 0, 0)
     layout.addWidget(window)
     window.setParent(dialog)
     self.connect(window, SIGNAL('closed()'), dialog.accept)
     window.show()
     dialog.exec_()
Ejemplo n.º 43
0
def showAbout():
    dialog = QDialog(mw)

    label = QLabel()
    label.setStyleSheet("QLabel { font-size: 14px; }")

    contributors = [
        "Scott Gigante",
        "Alex Griffin",
        "Chris Hatch",
        "Roland Sieker",
        "Thomas TEMPÉ",
        "Luo Li-Yan",
        "Scott Gigante",
    ]

    text = """
<div style="font-weight: bold">Korean Support (for CCBC) v%s</div><br>
<div>This is a modified version for the CCBC project.<br>
Bugs and problems may not be related to the original code.<br>
No support is given, but feel free to ask.</div><br>
<div><span style="font-weight: bold">
    Maintainer</span>: lovac42</div>
<div><span style="font-weight: bold">Contributors</span>: %s</div>
<div><span style="font-weight: bold">Website</span>: <a href="%s">%s</a></div>
<div style="font-size: 12px">
    <br>Based on the Chinese Support add-on by Thomas TEMPÉ and many others.
    <br>If your name is missing from here, please open an issue on GitHub.
</div>
""" % (
        __version__,
        ", ".join(contributors),
        CSR_GITHUB_URL,
        CSR_GITHUB_URL,
    )

    label.setText(text)
    label.setOpenExternalLinks(True)

    buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
    buttonBox.accepted.connect(dialog.accept)

    layout = QVBoxLayout()
    layout.addWidget(label)
    layout.addWidget(buttonBox)

    dialog.setLayout(layout)
    dialog.setWindowTitle("About")
    dialog.exec_()
 def getNewTitle(self):
     dialog = QDialog(mw)
     dialog.setWindowTitle('Extract Text')
     titleLabel = QLabel('Title')
     titleEditBox = QLineEdit()
     titleEditBox.setFixedWidth(300)
     buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
     buttonBox.accepted.connect(dialog.accept)
     layout = QHBoxLayout()
     layout.addWidget(titleLabel)
     layout.addWidget(titleEditBox)
     layout.addWidget(buttonBox)
     dialog.setLayout(layout)
     dialog.exec_()
     return titleEditBox.text()
Ejemplo n.º 45
0
 def timedate(self):
     " get the time and date "
     dialog = QDialog(self)
     clock = QLCDNumber()
     clock.setNumDigits(24)
     timer = QTimer()
     timer.timeout.connect(lambda: clock.display(datetime.now().strftime("%d-%m-%Y %H:%M:%S %p")))
     timer.start(1000)
     clock.setToolTip(datetime.now().strftime("%c %x"))
     ok = QPushButton(" O K ")
     ok.clicked.connect(dialog.close)
     ly = QVBoxLayout()
     [ly.addWidget(wdgt) for wdgt in (QCalendarWidget(), clock, ok)]
     dialog.setLayout(ly)
     dialog.exec_()
Ejemplo n.º 46
0
 def preview_file(self):
     preview_dialog = QDialog(self)
     preview_dialog.setWindowTitle("Preview file")
     preview_dialog.setMinimumSize(600, 400)
     # add a QTextEdit
     layout = QGridLayout(preview_dialog)
     file_textEdit = QTextEdit(preview_dialog)
     file_textEdit.setReadOnly(True)
     layout.addWidget(file_textEdit)
     # read file and display text in lineedit
     if self.fl_name:
         with open(self.fl_name, 'r') as fl:
             string_list = fl.readlines(20)
             file_textEdit.setText("\n".join(string_list))
         preview_dialog.exec_()
Ejemplo n.º 47
0
 def exec_( self ):
     if self.ctaBancomodel.rowCount() == 0:
         QMessageBox.critical( self.padre, "Cuentas Bancarias",
             "No existe ninguna cuenta bancaria con movimientos en este mes" )
         return self.reject()
     else:
         return QDialog.exec_( self )
Ejemplo n.º 48
0
 def exec_(self, bible_name):
     self.language_combo_box.addItem('')
     if bible_name:
         self.bible_label.setText(str(bible_name))
     items = BiblesResourcesDB.get_languages()
     self.language_combo_box.addItems([item['name'] for item in items])
     return QDialog.exec_(self)
    def authcfg_edit(self):
        dlg = QDialog(None)
        dlg.setWindowTitle(self.util.tr("Select Authentication"))
        layout = QtGui.QVBoxLayout(dlg)

        acs = QgsAuthConfigSelect(dlg)
        if self.IDC_leAuthCfg.text():
            acs.setConfigId(self.IDC_leAuthCfg.text())
        layout.addWidget(acs)

        buttonbox = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
            Qt.Horizontal, dlg
        )

        layout.addWidget(buttonbox)
        buttonbox.accepted.connect(dlg.accept)
        buttonbox.rejected.connect(dlg.close)

        dlg.setLayout(layout)
        dlg.setWindowModality(Qt.WindowModal)

        if dlg.exec_():
            self.IDC_leAuthCfg.setText(acs.configId())
            self.cc.authcfg = acs.configId()
Ejemplo n.º 50
0
    def on_copy(self):
        self.ds_model.sort(DSManagerModel.COLUMN_GROUP_DS)

        select_data_sources_dialog = QDialog(self)
        select_data_sources_dialog.setWindowTitle(self.tr("Choose source service"))
        layout = QVBoxLayout(select_data_sources_dialog)
        select_data_sources_dialog.setLayout(layout)

        list_view = QTreeView(self)
        layout.addWidget(list_view)
        list_view.setModel(self.ds_model)
        list_view.setColumnHidden(DSManagerModel.COLUMN_VISIBILITY, True)
        list_view.setAlternatingRowColors(True)
        list_view.header().setResizeMode(DSManagerModel.COLUMN_GROUP_DS, QHeaderView.ResizeToContents)
        list_view.clicked.connect(
            lambda index: select_data_sources_dialog.accept()
            if not self.ds_model.isGroup(index) and index.column() == DSManagerModel.COLUMN_GROUP_DS
            else None
        )

        if select_data_sources_dialog.exec_() == QDialog.Accepted:
            data_source = self.ds_model.data(list_view.currentIndex(), Qt.UserRole)
            data_source.id += "_copy"
            edit_dialog = DsEditDialog()
            edit_dialog.setWindowTitle(self.tr("Create service from existing"))
            edit_dialog.fill_ds_info(data_source)
            if edit_dialog.exec_() == QDialog.Accepted:
                self.feel_list()
                self.ds_model.resetModel()
    def add_authentication(self):
        """Slot for when the add auth button is clicked."""
        if qgis_version() >= 21200:
            from qgis.gui import QgsAuthConfigSelect

            dlg = QDialog(self)
            dlg.setWindowTitle(self.tr("Select Authentication"))
            layout = QVBoxLayout(dlg)

            acs = QgsAuthConfigSelect(dlg)
            if self.line_edit_auth_id.text():
                acs.setConfigId(self.line_edit_auth_id.text())
            layout.addWidget(acs)

            button_box = QDialogButtonBox(
                QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                Qt.Horizontal,
                dlg)
            layout.addWidget(button_box)
            button_box.accepted.connect(dlg.accept)
            button_box.rejected.connect(dlg.close)

            dlg.setLayout(layout)
            dlg.setWindowModality(Qt.WindowModal)
            if dlg.exec_():
                self.line_edit_auth_id.setText(acs.configId())
            del dlg
Ejemplo n.º 52
0
        def changeTileWidth():
            '''Change tile width (tile block size) and reset image-scene'''
            dlg = QDialog(self)
            layout = QHBoxLayout()
            layout.addWidget(QLabel("Tile Width:"))

            spinBox = QSpinBox(parent=dlg)
            spinBox.setRange(128, 10 * 1024)
            spinBox.setValue(512)

            if self.editor.imageScenes[0].tileWidth:
                spinBox.setValue(self.editor.imageScenes[0].tileWidth)

            layout.addWidget(spinBox)
            okButton = QPushButton("OK", parent=dlg)
            okButton.clicked.connect(dlg.accept)
            layout.addWidget(okButton)
            dlg.setLayout(layout)
            dlg.setModal(True)

            if dlg.exec_() == QDialog.Accepted:
                for s in self.editor.imageScenes:
                    if s.tileWidth != spinBox.value():
                        s.tileWidth = spinBox.value()
                        s.reset()
Ejemplo n.º 53
0
 def show_dialog(dialog_str, showed_msg):
     d = QDialog()
     d.setGeometry(500, 400, 200, 60)
     icon = QtGui.QIcon()
     icon.addPixmap(
         QtGui.QPixmap(design._fromUtf8("gui_assets/app_logo.png")),
         QtGui.QIcon.Normal, QtGui.QIcon.Off)
     d.setWindowIcon(icon)
     label = QLabel(showed_msg, d)
     label.move(10, 10)
     button = QPushButton('Ok', d)
     button.move(100, 100)
     button.connect(button, SIGNAL("clicked()"), d.close)
     d.setWindowTitle(dialog_str)
     d.setWindowModality(Qt.ApplicationModal)
     d.exec_()
Ejemplo n.º 54
0
 def getText(cls,
             parent=None,
             windowTitle='Get Text',
             label='',
             text='',
             plain=True,
             wrapped=True):
     """
     Prompts the user for a text entry using the text edit class.
     
     :param      parent | <QWidget>
                 windowTitle | <str>
                 label       | <str>
                 text        | <str>
                 plain       | <bool> | return plain text or not
     
     :return     (<str> text, <bool> accepted)
     """
     # create the dialog
     dlg = QDialog(parent)
     dlg.setWindowTitle(windowTitle)
     
     # create the layout
     layout = QVBoxLayout()
     
     # create the label
     if label:
         lbl = QLabel(dlg)
         lbl.setText(label)
         layout.addWidget(lbl)
     
     # create the widget
     widget = cls(dlg)
     widget.setText(text)
     
     if not wrapped:
         widget.setLineWrapMode(XTextEdit.NoWrap)
     
     layout.addWidget(widget)
     
     # create the buttons
     btns = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                             Qt.Horizontal,
                             dlg)
     layout.addWidget(btns)
     
     dlg.setLayout(layout)
     dlg.adjustSize()
     
     # create connections
     btns.accepted.connect(dlg.accept)
     btns.rejected.connect(dlg.reject)
     
     if dlg.exec_():
         if plain:
             return (widget.toPlainText(), True)
         else:
             return (widget.toHtml(), True)
     else:
         return ('', False)
        def changeTileWidth():
            '''Change tile width (tile block size) and reset image-scene'''
            dlg = QDialog(self)
            dlg.setWindowTitle("Viewer Tile Width")
            dlg.setModal(True)
            
            spinBox = QSpinBox( parent=dlg )
            spinBox.setRange( 128, 10*1024 )
            spinBox.setValue( self.editor.imageScenes[0].tileWidth() )
                
            ctrl_layout = QHBoxLayout()
            ctrl_layout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding))
            ctrl_layout.addWidget( QLabel("Tile Width:") )
            ctrl_layout.addWidget( spinBox )

            button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, parent=dlg)
            button_box.accepted.connect( dlg.accept )
            button_box.rejected.connect( dlg.reject )
            
            dlg_layout = QVBoxLayout()
            dlg_layout.addLayout( ctrl_layout )
            dlg_layout.addWidget( QLabel("Setting will apply current view immediately,\n"
                                         "and all other views upon restart.") )
            dlg_layout.addWidget( button_box )

            dlg.setLayout( dlg_layout )
            
            if dlg.exec_() == QDialog.Accepted:
                for s in self.editor.imageScenes:
                    if s.tileWidth != spinBox.value():
                        s.setTileWidth( spinBox.value() )
                        s.reset()
    def on_copy(self):
        self.ds_model.sort(DSManagerModel.COLUMN_GROUP_DS)

        select_data_sources_dialog = QDialog(self)
        select_data_sources_dialog.resize(400, 400)
        select_data_sources_dialog.setWindowTitle(
            self.tr("Choose source service"))
        layout = QVBoxLayout(select_data_sources_dialog)
        select_data_sources_dialog.setLayout(layout)

        list_view = QTreeView(self)
        layout.addWidget(list_view)
        list_view.setModel(self.ds_model)
        #list_view.expandAll()
        list_view.setColumnHidden(DSManagerModel.COLUMN_VISIBILITY, True)
        list_view.setAlternatingRowColors(True)
        list_view.header().setResizeMode(DSManagerModel.COLUMN_GROUP_DS,
                                         QHeaderView.ResizeToContents)
        list_view.clicked.connect(
            lambda index: select_data_sources_dialog.accept() \
                if not self.ds_model.isGroup(index) and \
                    index.column() == DSManagerModel.COLUMN_GROUP_DS \
                else None
        )

        if select_data_sources_dialog.exec_() == QDialog.Accepted:
            data_source = self.ds_model.data(list_view.currentIndex(),
                                             Qt.UserRole)
            data_source.id += "_copy"
            edit_dialog = DsEditDialog()
            edit_dialog.setWindowTitle(self.tr('Create service from existing'))
            edit_dialog.fill_ds_info(data_source)
            if edit_dialog.exec_() == QDialog.Accepted:
                self.feel_list()
                self.ds_model.resetModel()
Ejemplo n.º 57
0
    def view(self):
        """create view and import layers"""
        layer = QgsMapLayerRegistry.instance().mapLayer(self.current_layers[0])
        uri = QgsDataSourceURI(layer.source())
        mtch = re.match(r'(.+)_([^_]+)_rev_(head|\d+)', uri.schema())
        schema = mtch.group(1)
        assert (schema)
        dlg = QDialog()
        layout = QVBoxLayout(dlg)
        button_box = QDialogButtonBox(dlg)
        button_box.setStandardButtons(QDialogButtonBox.Cancel
                                      | QDialogButtonBox.Ok)
        button_box.accepted.connect(dlg.accept)
        button_box.rejected.connect(dlg.reject)

        pcur = versioning_base.Db(psycopg2.connect(self.pg_conn_info()))
        pcur.execute("SELECT rev, commit_msg, branch, date, author "
                     "FROM " + schema + ".revisions")
        revs = pcur.fetchall()
        pcur.close()
        tblw = QTableWidget(dlg)
        tblw.setRowCount(len(revs))
        tblw.setColumnCount(5)
        tblw.setSortingEnabled(True)
        tblw.setHorizontalHeaderLabels(
            ['Revision', 'Commit Message', 'Branch', 'Date', 'Author'])
        tblw.verticalHeader().setVisible(False)
        for i, rev in enumerate(revs):
            for j, item in enumerate(rev):
                tblw.setItem(i, j, QTableWidgetItem(str(item)))
        layout.addWidget(tblw)
        layout.addWidget(button_box)
        dlg.resize(600, 300)
        if not dlg.exec_():
            return

        rows = set()
        for i in tblw.selectedIndexes():
            rows.add(i.row())
        for row in rows:
            branch = revs[row][2]
            rev = revs[row][0]
            versioning_base.add_revision_view(uri.connectionInfo(), schema,
                                              branch, rev)
            grp_name = branch + ' revision ' + str(rev)
            grp_idx = self.iface.legendInterface().addGroup(grp_name)
            for layer_id in reversed(self.current_layers):
                layer = QgsMapLayerRegistry.instance().mapLayer(layer_id)
                new_uri = QgsDataSourceURI(layer.source())
                new_uri.setDataSource(
                    schema + '_' + branch + '_rev_' + str(rev),
                    new_uri.table(), new_uri.geometryColumn(), new_uri.sql(),
                    new_uri.keyColumn())
                display_name = QgsMapLayerRegistry.instance().mapLayer(
                    layer_id).name()
                src = new_uri.uri().replace('()', '')
                new_layer = self.iface.addVectorLayer(src, display_name,
                                                      'postgres')
                self.iface.legendInterface().moveLayer(new_layer, grp_idx)
Ejemplo n.º 58
0
def simple_dialog(parent, title, message, checkbox_text=None, yes_no=True):
    """
    A simple dialog the enable you show an html message with checkbox.
    :param parent: The parent of the dialog.
    :type parent: QWidget
    :param title: The title of the dialog
    :type title: String
    :param message: The message of the dialog. Use <br>
    to add a new line as it is html.
    :type message: String
    :param checkbox_text: Add a checkbox text, if None,
    the checkbox will not be shown.
    :type checkbox_text: String
    :param yes_no: A boolean to add the Yes No buttons.
    If false, the Ok button is shown.
    :type yes_no: Boolean
    :return: Tuple containing the dialog exec_ result
    and the checkbox result.
    :rtype: Tuple
    """
    simple_dialog = QDialog(
        parent,
        Qt.WindowSystemMenuHint | Qt.WindowTitleHint
    )
    simple_layout = QVBoxLayout(simple_dialog)
    simple_label = QLabel()

    simple_dialog.setWindowTitle(title)
    simple_label.setTextFormat(Qt.RichText)
    simple_label.setText(message)

    simple_layout.addWidget(simple_label)

    if checkbox_text:
        confirm_checkbox = QCheckBox()
        confirm_checkbox.setText(checkbox_text)
        simple_layout.addWidget(confirm_checkbox)
    simple_buttons = QDialogButtonBox()

    if yes_no:
        simple_buttons.setStandardButtons(
            QDialogButtonBox.Yes | QDialogButtonBox.No
        )
        simple_buttons.rejected.connect(simple_dialog.reject)

    else:
        simple_buttons.setStandardButtons(
            QDialogButtonBox.Ok
        )
    simple_buttons.accepted.connect(simple_dialog.accept)

    simple_layout.addWidget(simple_buttons)

    simple_dialog.setModal(True)
    result = simple_dialog.exec_()
    if not checkbox_text is None:
        return result, confirm_checkbox.isChecked()
    else:
        return result, False
Ejemplo n.º 59
0
 def exec_(self):
     """Add the defined new machine into the database"""
     if QDialog.exec_(self) == QDialog.Rejected:
         return False
     self.dbhandler.add_new_machine(self.client, self.machine,
                                    self.selldate, self.deltamonth,
                                    self.anticiped)
     return True