Example #1
0
    def run(self):
        """Run method that performs all the real work"""
        # show the dialog
        self.dlg.show()

        self.dlg.vybrat.clicked.connect(self.selectFileName)

        # Run the dialog event loop
        result = self.dlg.exec_()
        # See if OK was pressed
        if result:
            # Do something useful here - delete the line containing pass and
            # substitute with your code.
            #pass
            if not hasattr(self,
                           'fileName') and self.dlg.radioButton_2.isChecked():
                QMessageBox.critical(
                    QDialog(), u"Není vybrán žádný soubor",
                    u"nejdříve je třeba vybrat soubor, nebo přepnout na stažení aktuálních dat"
                )
            else:
                self.lay = doprInfo_fce.createDoprInfoLayer()
                if self.dlg.radioButton_2.isChecked():
                    self.dta = doprInfo_fce.getDataFromFile(
                        open(self.fileName, 'r'))

                else:
                    self.dta = doprInfo_fce.getDataFromUrl()

                doprInfo_fce.populateDoprInfoLayer(self.lay, self.dta)

                if not self.dlg.aktualizovat.isEnabled():
                    self.dlg.aktualizovat.setEnabled(True)
                    self.dlg.aktualizovat.clicked.connect(
                        self.updateDoprInfoLayer)
Example #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_()
    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_()
Example #4
0
    def __init__(self, useDevelopmentRelease=False, useProposed=False):
        self.useDevelopmentRelease = useDevelopmentRelease
        self.useProposed = useProposed
        metaRelease = MetaReleaseCore(useDevelopmentRelease, useProposed)
        metaRelease.downloaded.wait()
        if metaRelease.new_dist is None and __name__ == "__main__":
            sys.exit()
        elif metaRelease.new_dist is None:
            return

        self.progressDialogue = QDialog()
        if os.path.exists("fetch-progress.ui"):
            self.APPDIR = QDir.currentPath()
        else:
            self.APPDIR = "/usr/share/ubuntu-release-upgrader"

        uic.loadUi(self.APPDIR + "/fetch-progress.ui", self.progressDialogue)
        self.progressDialogue.setWindowIcon(KIcon("system-software-update"))
        self.progressDialogue.setWindowTitle(_("Upgrade"))
        self.progress = KDEAcquireProgressAdapter(
            self.progressDialogue.installationProgress,
            self.progressDialogue.installingLabel,
            None)
        DistUpgradeFetcherCore.__init__(self, metaRelease.new_dist,
                                        self.progress)
    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
Example #6
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 _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)
    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_()
    def __init__(self, managerLogic=None):
        self.app = QApplication(sys.argv)
        self.window = QDialog()
        self.ui = Ui_NodesManagerWidget()
        self.ui.setupUi(self.window)
        self.uic = ManagerUiCustomizer(self.ui, self)
        self.timer = QTimer()
        self.timer.timeout.connect(self.polledUpdate)
        self.lock = Lock()
        self.statesBuffer = []
        self.managerLogic = managerLogic

        self.uic.enableDetailedView(False)

        self.managerServer = NodesManagerServer(self, 20301)

        #FIXME: some shitty python magic
        def closeEvent_(self_, event):
            try:
                self.managerLogic.getReactor().stop()
                self.managerLogic.terminateAllNodes()
            except Exception as ex:
                pass
            finally:
                GLOBAL_SHUTDOWN[0] = True
                event.accept()

        setattr(self.window.__class__, 'closeEvent', closeEvent_)
Example #10
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_()
Example #11
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()
Example #12
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)
Example #13
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_()
        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()
Example #15
0
    def _mostrar_dialogo(self):
        self.frame_snake.pause()
        self.dialogo = QDialog()
        self.dialogo.setWindowTitle(self.tr("Pyborita"))
        box = QVBoxLayout(self.dialogo)
        # Acerca de
        logo_pyborita = QLabel()
        logo_pyborita.setPixmap(QPixmap(":image/pyborita"))
        logo_pyborita.setAlignment(Qt.AlignCenter)
        box.addWidget(logo_pyborita)

        description = QLabel(
            self.tr("<b>Pyborita</b> es un clon de Snake "
                    "desarrollado por<br>Gabriel Acosta en Python"
                    " usando PyQt para la GUI.<br><br>Copyright (C) "
                    "<2015> Gabriel Acosta - Gabo<br>"
                    "License: GPLv3"))
        box.addWidget(description)
        # Botones
        hbox = QHBoxLayout()
        btn_nuevo_juego = QPushButton(self.tr("Nuevo Juego"))
        hbox.addWidget(btn_nuevo_juego)
        btn_salir = QPushButton(self.tr("Salir"))
        hbox.addWidget(btn_salir)
        box.addLayout(hbox)

        # Conexiones de botones
        btn_nuevo_juego.clicked.connect(self._nuevo_juego)
        btn_salir.clicked.connect(self._close)

        self.dialogo.exec_()
        self.frame_snake.reanude()
        self.frame_snake.setFocus()
Example #16
0
    def __init__(self, parent):
        self.window = QDialog(parent)
        self.ui = Ui_AddTaskResourcesDialog()

        self.ui.setupUi(self.window)
        self.__initFolderTreeView()
        self.__setupConnections()
    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()
Example #18
0
def edit_csp_configs(buf_time, freqs):
    """
    >>> a,b = edit_csp_configs(1.0, [1,2,3,4,5,6,7,8])

    """
    from PyQt4.QtGui import QDialog, QApplication
    from ssvep_csp_params_dialog import CspParamsDialog
    l_app = QApplication(None)
    d = QDialog()
    m = CspParamsDialog()
    m.setupUi(d)

    fields = ['f' + str(i) for i in range(len(freqs))]
    m.buf_time.setValue(buf_time)
    for i, f in enumerate(fields):
        m.__dict__[f].setValue(freqs[i])

    d.show()
    l_app.exec_()
    if d.result():
        buf_time = m.buf_time.value()
        freqs = []
        for i, f in enumerate(fields):
            freqs.append(m.__dict__[f].value())

    return buf_time, freqs
Example #19
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_()
Example #20
0
          
 def _connect(self):
     ''' connect two items'''
             
     # open Connect window,
     self._cur_selected_connection = None
     self.dia = QDialog(self.gui); main_lo = QVBoxLayout()        
     GBuilder().set_props(self.dia, None, 250, 130, max_sz_x=400, max_sz_y=250)
     try:
         self.selected_env_elems = EnvironmentElement.icons_to_env_els(DragSelection().selected, self.env_map[self.selected_env])
         self.clicked_elem = EnvironmentElement.icons_to_env_els([DragSelection().clicked], self.env_map[self.selected_env])[0]
         self.selected_env_elems.remove(self.clicked_elem)
     except:
         return
     
     # show possible connections
     if not self.selected_env_elems: return
     acts = self.clicked_elem.processor.get_actions()
     main_lo.addWidget(GBuilder().label(self.dia, "Select a connection to be executed between type %s and type %s" % (self.clicked_elem.comp_type, self.selected_env_elems[0].comp_type)))
     hl, self._con_cb, te = GBuilder().label_combobox(self.dia, "Select Connection ", list(acts.values()), self.dia.show)
     main_lo.addLayout(hl)
     
     # ok cancel
     main_lo.addWidget(GBuilder().hor_line(self.dia))
     ok = GBuilder().pushbutton(self.dia, "Apply", self._ok_dia_hit); ok.setFixedWidth(100)
     canc = GBuilder().pushbutton(self.dia, "Cancel", self._cancel_dia_hit); canc.setFixedWidth(100)
     
     hl = QHBoxLayout() 
     hl.addWidget(GBuilder().label(self.dia, ""))
     hl.addWidget(ok)
     hl.addWidget(canc)
     main_lo.addLayout(hl)
     
     self.dia.setLayout(main_lo)
Example #21
0
    def __init__(self, iface):
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)

        self.q_commit_msg_dlg = QDialog(self.iface.mainWindow())
        self.q_commit_msg_dlg = uic.loadUi(self.plugin_dir + "/commit_msg.ui")
        self.commit_msg_dlg = ""

        self.current_layers = []
        self.actions = []
        self._pg_conn_info = ''
        self.current_group_idx = -1
        self.info = QLabel()

        # this is not really nice since this is hidden in the interface
        # but nothing else is available to get a selected group in the legend
        self.legend = self.iface.mainWindow().findChild(
            QTreeWidget, 'theMapLegend')
        if self.legend:  # qgis 2.2
            self.legend.itemClicked.connect(self.on_legend_click)
            self.legend.itemChanged.connect(self.on_legend_click)
        else:  # qgis 2.4
            self.legend = self.iface.mainWindow().findChild(
                QTreeView, 'theLayerTreeView')
            self.legend.clicked.connect(self.on_legend_click)
Example #22
0
    def __init__(self, values, checked_values=[]):
        self.dial = QDialog()
        self.result = ""

        # Layout Principal
        m_vbl = QVBoxLayout(self.dial)

        # List item checkable
        view = QListView()
        m_vbl.addWidget(view)

        self.m_sim = QStandardItemModel()
        view.setModel(self.m_sim)

        self._load_item(values, checked_values)

        # List buttons
        bt_all = QPushButton(self.tr("All"))
        bt_all.clicked.connect(lambda: self._check_all())

        bt_nothing = QPushButton(self.tr("Nothing"))
        bt_nothing.clicked.connect(lambda: self._check_nothing())

        bt_print = QPushButton(self.tr("Ok"))
        bt_print.clicked.connect(lambda: self._check_ok())

        # Sub layout for buttons
        m_vbh = QHBoxLayout()
        m_vbl.addLayout(m_vbh)

        m_vbh.addWidget(bt_all)
        m_vbh.addWidget(bt_nothing)
        m_vbh.addWidget(bt_print)
Example #23
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_()
Example #24
0
    def reject(self):
        if not self._ensureNotMostA():
            self.tooManyAsMessage()

        if self.listEnabled:
            super(SetEditor, self).reject()
        else:
            d = QDialog(self)

            txt = QLabel(
                "Do you want to save your changes to the current question?")
            txtBox = QHBoxLayout()
            txtBox.addWidget(txt)

            a = QPushButton("&Save")
            a.clicked.connect(self.onExitSave)
            b = QPushButton("&Don't Save")
            b.clicked.connect(self.onExitDiscard)
            c = QPushButton("&Cancel")
            c.clicked.connect(d.close)
            bBox = QHBoxLayout()
            bBox.addWidget(a)
            bBox.addWidget(b)
            bBox.addWidget(c)

            vBox = QVBoxLayout()
            vBox.addLayout(txtBox)
            vBox.addLayout(bBox)
            d.setLayout(vBox)
            d.setWindowTitle("Save question?")
            d.show()
            self.rejectDialog = d
    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
def display(sc, title="SVG scene"):
    """Display a scene in a Qdialog
	
	:Parameters:
	 - `sc` (`SVGScene`)
	 - `title` (str) - window title
	"""
    qapp = QApplication.instance()
    if qapp is None:
        qapp = QApplication([])

    dial = QDialog()
    dial.setWindowTitle(title)
    dial.setPalette(QPalette(QColor(255, 255, 255)))
    lay = QVBoxLayout(dial)

    w = QSvgWidget(dial)
    data = QByteArray(str(to_xml(sc)))
    w.load(data)

    r = w.renderer()
    w.setMinimumSize(r.defaultSize())
    lay.addWidget(w)

    dial.show()

    qapp.exec_()
Example #27
0
def get_iface_config():
    win = QDialog()
    win.setWindowTitle('CAN Interface Configuration')
    win.setWindowIcon(APP_ICON)

    combo = QtGui.QComboBox(win)
    combo.setEditable(True)
    combo.setAutoCompletion(True)
    combo.setAutoCompletionCaseSensitivity(Qt.CaseSensitive)
    combo.setInsertPolicy(QtGui.QComboBox.NoInsert)
    combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
    combo.addItems(list_ifaces())

    bitrate = QtGui.QSpinBox()
    bitrate.setMaximum(1000000)
    bitrate.setMinimum(10000)
    bitrate.setValue(1000000)

    extra_args = QtGui.QLineEdit()

    ok = QtGui.QPushButton('OK', win)

    result = None
    kwargs = {}

    def on_ok():
        nonlocal result, kwargs
        a = str(extra_args.text())
        if a:
            try:
                kwargs = dict(eval(a))
            except Exception as ex:
                mbox = QtGui.QMessageBox(win)
                mbox.setWindowTitle('Invalid parameters')
                mbox.setText('Could not parse optional arguments')
                mbox.setInformativeText(str(ex))
                mbox.setIcon(QtGui.QMessageBox.Critical)
                mbox.setStandardButtons(QtGui.QMessageBox.Ok)
                mbox.exec()
                return
        kwargs['bitrate'] = int(bitrate.value())
        result = str(combo.currentText())
        win.close()

    ok.clicked.connect(on_ok)

    layout = QVBoxLayout()
    layout.addWidget(
        QtGui.QLabel('Select CAN interface or serial port for SLCAN:'))
    layout.addWidget(combo)
    layout.addWidget(QtGui.QLabel('Interface bitrate (SLCAN only):'))
    layout.addWidget(bitrate)
    layout.addWidget(
        QtGui.QLabel('Optional arguments (refer to Pyuavcan for info):'))
    layout.addWidget(extra_args)
    layout.addWidget(ok)
    win.setLayout(layout)
    win.exec()

    return result, kwargs
Example #28
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
Example #29
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)
Example #30
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_()