コード例 #1
0
    def mTypeBoxCrrentIndexChanged(self, index):
        # FIXME: sync with providers/ogr/qgsogrprovider.cpp
        if isinstance(index, str) or isinstance(index, QString):
            return
        for case in switch(index):
            if case(0):  # Text data
                if (int(self.ui.mWidth.text()) < 1
                        or int(self.ui.mWidth.text()) > 255):
                    self.ui.mWidth.setText("80")
                self.ui.mPrecision.setEnabled(False)
                self.ui.mWidth.setValidator(QIntValidator(1, 255, self))
                break

            elif case(1):  # Whole number
                if (int(self.ui.mWidth.text()) < 1
                        or int(self.ui.mWidth.text()) > 10):
                    self.ui.mWidth.setText("10")
                self.ui.mPrecision.setEnabled(False)
                self.ui.mWidth.setValidator(QIntValidator(1, 10, self))
                break

            elif case(2):  # Decimal number
                if (int(self.ui.mWidth.text()) < 1
                        or int(self.ui.mWidth.text()) > 20):
                    self.ui.mWidth.setText("20")
                self.ui.mPrecision.setEnabled(True)
                self.ui.mWidth.setValidator(QIntValidator(1, 20, self))
                break

            else:
                QMessageBox.warning(self, "Warning", "unexpected index")
                break
コード例 #2
0
    def createWidgetEndXY(self):
        """
        Create widget 
        """
        self.endXyAndroidGroup = QGroupBox(self.tr(""))
        endXyAndroidlayout = QGridLayout()

        self.endxAndroidLine = QLineEdit(self)
        validatorEndXAndroid = QIntValidator(self)
        self.endxAndroidLine.setValidator(validatorEndXAndroid)
        self.endxAndroidLine.installEventFilter(self)

        self.endyAndroidLine = QLineEdit(self)
        validatorEndYAndroid = QIntValidator(self)
        self.endyAndroidLine.setValidator(validatorEndYAndroid)
        self.endyAndroidLine.installEventFilter(self)

        endXyAndroidlayout.addWidget(
            QLabel(self.tr("Destination Coordinate X:")), 0, 0)
        endXyAndroidlayout.addWidget(self.endxAndroidLine, 0, 1)
        endXyAndroidlayout.addWidget(
            QLabel(self.tr("Destination Coordinate Y:")), 1, 0)
        endXyAndroidlayout.addWidget(self.endyAndroidLine, 1, 1)

        self.endXyAndroidGroup.setLayout(endXyAndroidlayout)
        self.endXyAndroidGroup.hide()
コード例 #3
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)

        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)

        grid = QGridLayout()
        n = 0

        blockALabel = QLabel(self.tr('Block A: '))
        grid.addWidget(blockALabel, n, 0)
        self.blockAWidget = QLineEdit(str(self.prm['currentBlock']))
        self.blockAWidget.setValidator(QIntValidator(self))
        grid.addWidget(self.blockAWidget, n, 1)

        blockBLabel = QLabel(self.tr('Block B: '))
        grid.addWidget(blockBLabel, n, 2)
        self.blockBWidget = QLineEdit('')
        self.blockBWidget.setValidator(QIntValidator(self))
        grid.addWidget(self.blockBWidget, n, 3)

        n = n + 1
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
        grid.addWidget(buttonBox, n, 3)
        self.setLayout(grid)
        self.setWindowTitle(self.tr("Swap Blocks"))
コード例 #4
0
ファイル: ui_replace_i18n.py プロジェクト: zjykzk/conf-tool
  def __init__(self, config_name, parent=None):
    super(ReplaceI18NDialog, self).__init__(parent)
    self.parent = parent
    grid_layout = QGridLayout()
    grid_layout.addWidget(QLabel(u'表单名字/序号'), 0, 0)
    self.sheet_index_input = QLineEdit(config_name, self)
    grid_layout.addWidget(self.sheet_index_input, 0, 1)

    grid_layout.addWidget(QLabel(u'列'), 1, 0)
    self.column_input = QLineEdit("1", self)
    int_validator = QIntValidator()
    int_validator.setRange(1, 100)
    self.column_input.setValidator(int_validator)
    grid_layout.addWidget(self.column_input, 1, 1)

    grid_layout.addWidget(QLabel(u'文件'), 2, 0)
    self.file_input = QLineEdit("", self)
    grid_layout.addWidget(self.file_input, 2, 1)
    select_file_btn = QPushButton(u'选择')
    grid_layout.addWidget(select_file_btn, 2, 2)

    do_btn = QPushButton(u'替换')
    main_layout = QVBoxLayout()
    main_layout.addLayout(grid_layout)
    main_layout.addWidget(do_btn)
    self.setLayout(main_layout)

    self.connect(select_file_btn, SIGNAL("clicked()"), self.select_file)
    self.connect(do_btn, SIGNAL("clicked()"), self.replace)
コード例 #5
0
ファイル: lpfwgui.py プロジェクト: cryptoatropine/oldlpfw
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.pushButton_Add.clicked.connect(self.addIP)
     validator = QIntValidator()
     validator.setRange(0,255)
     self.lineEdit_IP_1.setValidator(validator)
     self.lineEdit_IP_2.setValidator(validator)
     self.lineEdit_IP_3.setValidator(validator)
     self.lineEdit_IP_4.setValidator(validator)
コード例 #6
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.pushButton_Add.clicked.connect(self.addIP)
     validator = QIntValidator()
     validator.setRange(0, 255)
     self.lineEdit_IP_1.setValidator(validator)
     self.lineEdit_IP_2.setValidator(validator)
     self.lineEdit_IP_3.setValidator(validator)
     self.lineEdit_IP_4.setValidator(validator)
コード例 #7
0
    def __init__(self, parent=None):
        super(EditorWidgetTms, self).__init__(parent)
        self.setupUi(self)
        self.tms_validator = LineEditColorValidator(
            self.txtUrl,
            'http[s]?://.+',
            error_tooltip='http{s}://any_text/{z}/{x}/{y}/')
        self.txtCrsId.setValidator(QIntValidator())
        self.txtPostgisCrsId.setValidator(QIntValidator())

        QApplication.instance().focusChanged.connect(self.focus_changed)
コード例 #8
0
ファイル: pqMsgs.py プロジェクト: jlg234bob/PPQT
    def __init__(self, parent=None):
        super(QWidget, self).__init__(parent)
        # Create the four widgets:

        # 1, the line number widget
        self.lnum = QLineEdit()
        self.lnum.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        # allow up to 5 digits, and ensure only digits can be entered.
        val = QIntValidator()
        val.setRange(1,99999) # Line numbers start at 1
        self.lnum.setValidator(val)
        self.setWidth(self.lnum, 6)
        # connect the lnum ReturnPressed signal to our slot for that
        self.connect(self.lnum, SIGNAL("returnPressed()"), self.moveLine)

        # 2, the column number display
        self.cnum = QLabel()
        self.cnum.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.setWidth(self.cnum, 3)

        # 3, the png field. Scan image filenames are not always numeric!
        self.image = QLineEdit()
        self.image.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.setWidth(self.image, 6)
        #val = QIntValidator()
        #val.setRange(1,9999) # png numbers start at 1
        #self.image.setValidator(val)
        # Connect the image ReturnPressed signal to our slot for that
        self.connect(self.image, SIGNAL("returnPressed()"), self.movePng)

        # 4, the folio display
        self.folio = QLabel()
        self.folio.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.setWidth(self.folio, 12)

        # Make a layout frame and lay the four things out in it with captions
        # Line [      ] Column (  )    Image [      ] Folio (   )

        hb = QHBoxLayout()
        hb.addWidget(self.makeCaption(u"Line"))
        hb.addWidget(self.lnum)
        hb.addWidget(self.makeCaption(u"Column"))
        hb.addWidget(self.cnum)

        hb.addSpacing(5) # Qt doc doesn't say what the units are!

        hb.addWidget(self.makeCaption(u"Image"))
        hb.addWidget(self.image)
        hb.addWidget(self.makeCaption(u"Folio"))
        hb.addWidget(self.folio)

        hb.addStretch() # add stretch on the right to make things compact left
        self.setLayout(hb) # make it our layout
コード例 #9
0
    def createIntegerLineEdit(self, minimum=None, maximum=None, placeholder=""):
        line_edit = ClearableLineEdit(placeholder=placeholder)
        validator = QIntValidator()

        if minimum is not None:
            validator.setBottom(minimum)

        if maximum is not None:
            validator.setTop(maximum)

        line_edit.setValidator(validator)
        return line_edit
コード例 #10
0
    def ud_options(self):
        """ Dialog ud_options.ui """

        # Create dialog
        dlg_udoptions = UDoptions()
        utils_giswater.setDialog(dlg_udoptions)

        dlg_udoptions.min_slope.setValidator(QDoubleValidator())
        dlg_udoptions.lengthening_step.setValidator(QDoubleValidator())
        dlg_udoptions.max_trials.setValidator(QIntValidator())
        dlg_udoptions.sys_flow_tol.setValidator(QIntValidator())
        dlg_udoptions.variable_step.setValidator(QIntValidator())
        dlg_udoptions.min_surfarea.setValidator(QIntValidator())
        dlg_udoptions.head_tolerance.setValidator(QDoubleValidator())
        dlg_udoptions.lat_flow_tol.setValidator(QIntValidator())

        # Set values from widgets of type QComboBox
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".inp_value_options_fu ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("flow_units", rows, False)
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".inp_value_options_fr ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("flow_routing", rows, False)
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".inp_value_options_lo ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("link_offsets", rows, False)
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".inp_value_options_fme ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("force_main_equation", rows, False)
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".inp_value_options_nfl ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("normal_flow_limited", rows, False)
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".inp_value_options_id ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("inertial_damping", rows, False)
        sql = "SELECT DISTINCT(id) FROM " + self.schema_name + ".value_yesno ORDER BY id"
        rows = self.dao.get_rows(sql)
        utils_giswater.fillComboBox("allow_ponding", rows, False)
        utils_giswater.fillComboBox("skip_steady_state", rows, False)
        utils_giswater.fillComboBox("ignore_rainfall", rows, False)
        utils_giswater.fillComboBox("ignore_snowmelt", rows, False)
        utils_giswater.fillComboBox("ignore_groundwater", rows, False)
        utils_giswater.fillComboBox("ignore_routing", rows, False)
        utils_giswater.fillComboBox("ignore_quality", rows, False)
        update = True
        dlg_udoptions.btn_accept.pressed.connect(
            partial(self.insert_or_update, update, 'inp_options',
                    dlg_udoptions))
        dlg_udoptions.btn_cancel.pressed.connect(dlg_udoptions.close)
        self.go2epa_options_get_data('inp_options')
        dlg_udoptions.exec_()
コード例 #11
0
    def ud_options(self):
        """ Dialog ud_options.ui """
        
        # Create dialog
        dlg_udoptions = UDoptions()
        self.load_settings(dlg_udoptions)

        dlg_udoptions.min_slope.setValidator(QDoubleValidator())
        dlg_udoptions.lengthening_step.setValidator(QDoubleValidator())
        dlg_udoptions.max_trials.setValidator(QIntValidator())
        dlg_udoptions.sys_flow_tol.setValidator(QIntValidator())
        dlg_udoptions.variable_step.setValidator(QIntValidator())
        dlg_udoptions.min_surfarea.setValidator(QIntValidator())
        dlg_udoptions.head_tolerance.setValidator(QDoubleValidator())
        dlg_udoptions.lat_flow_tol.setValidator(QIntValidator())

        # Set values from widgets of type QComboBox
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".inp_value_options_fu ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.flow_units, rows, False)
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".inp_value_options_fr ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.flow_routing, rows, False)
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".inp_value_options_lo ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.link_offsets, rows, False)
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".inp_value_options_fme ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.force_main_equation, rows, False)
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".inp_value_options_nfl ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.normal_flow_limited, rows, False)
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".inp_value_options_id ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.inertial_damping, rows, False)
        sql = "SELECT DISTINCT(id) FROM "+self.schema_name+".value_yesno ORDER BY id"
        rows = self.controller.get_rows(sql)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.allow_ponding, rows, False)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.skip_steady_state, rows, False)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.ignore_rainfall, rows, False)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.ignore_snowmelt, rows, False)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.ignore_groundwater, rows, False)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.ignore_routing, rows, False)
        utils_giswater.fillComboBox(dlg_udoptions, dlg_udoptions.ignore_quality, rows, False)
        dlg_udoptions.btn_accept.clicked.connect(partial(self.update_table, 'inp_options', dlg_udoptions))
        dlg_udoptions.btn_cancel.clicked.connect(dlg_udoptions.close)
        self.go2epa_options_get_data('inp_options', dlg_udoptions)
        dlg_udoptions.setWindowFlags(Qt.WindowStaysOnTopHint)
        dlg_udoptions.exec_()
コード例 #12
0
    def __init__(self, iface, parent=None):

        super(PreVesperDialog, self).__init__(iface.mainWindow())

        # Set up the user interface from Designer.
        self.setupUi(self)

        # The qgis interface
        self.iface = iface
        self.DISP_TEMP_LAYERS = read_setting(
            PLUGIN_NAME + '/DISP_TEMP_LAYERS', bool)
        self.DEBUG = config.get_debug_mode()

        # Catch and redirect python errors directed at the log messages python
        # error tab.
        QgsMessageLog.instance().messageReceived.connect(errorCatcher)

        if not os.path.exists(TEMPDIR):
            os.mkdir(TEMPDIR)

        # Setup for validation messagebar on gui-----------------------------
        self.setWindowIcon(QtGui.QIcon(
            ':/plugins/pat/icons/icon_vesperKriging.svg'))

        self.validationLayout = QtGui.QFormLayout(self)
        # source: https://nathanw.net/2013/08/02/death-to-the-message-box-use-the-qgis-messagebar/
        # Add the error messages to top of form via a message bar.
        # leave this message bar for bailouts
        self.messageBar = QgsMessageBar(self)

        if isinstance(self.layout(), (QtGui.QFormLayout, QtGui.QGridLayout)):
            # create a validation layout so multiple messages can be added and
            # cleaned up.
            self.layout().insertRow(0, self.validationLayout)
            self.layout().insertRow(0, self.messageBar)
        else:
            # for use with Vertical/horizontal layout box
            self.layout().insertWidget(0, self.messageBar)

        # Set Class default variables -------------------------------------
        self.vesp_dict = None
        self.in_qgscrs = None
        self.dfCSV = None

        # this is a validation flag
        self.OverwriteCtrlFile = False
        self.cboMethod.addItems(
            ['High Density Kriging', 'Low Density Kriging (Advanced)'])

        # To allow only integers for the min number of pts.
        self.onlyInt = QIntValidator()
        self.lneMinPoint.setValidator(self.onlyInt)

        self.vesper_exe = check_vesper_dependency()
        if self.vesper_exe is None or self.vesper_exe == '':
            self.gbRunVesper.setTitle(
                'WARNING:Vesper not found please configure using the about dialog.')
            self.gbRunVesper.setChecked(False)
            self.gbRunVesper.setCheckable(False)
            self.gbRunVesper.setEnabled(False)
コード例 #13
0
    def init_gui(self):
        #Set integer validator for the port number
        int_validator = QIntValidator(1024, 49151)
        self.txtPort.setValidator(int_validator)

        #Load profiles
        self.load_profiles()

        #Set current profile in the combobox
        curr_profile = current_profile()
        if not curr_profile is None:
            setComboCurrentIndexWithText(self.cbo_profiles, curr_profile.name)

        #Load current database connection properties
        self._load_db_conn_properties()

        #Load existing PostgreSQL connections
        self._load_qgis_pg_connections()

        #Load directory paths
        self._load_directory_paths()

        self.edtEntityRecords.setMaximum(MAX_LIMIT)
        self.edtEntityRecords.setValue(get_entity_browser_record_limit())

        #Sorting order
        self.populate_sort_order()
        self.set_current_sort_order(get_entity_sort_order())

        # Debug logging
        lvl = debug_logging()
        if lvl:
            self.chk_logging.setCheckState(Qt.Checked)
        else:
            self.chk_logging.setCheckState(Qt.Unchecked)
コード例 #14
0
ファイル: multirunEditor.py プロジェクト: ssquantum/PyDex
 def change_array_size(self):
     """Update the size of the multirun array based on the number of rows
     and columns specified in the line edit."""
     self.nrows = int(self.rows_edit.text()) if self.rows_edit.text() else 1
     if self.nrows < 1:
         self.nrows = 1
     self.table.setRowCount(self.nrows)
     self.ncols = int(self.cols_edit.text()) if self.cols_edit.text() else 1
     if self.ncols < 1:
         self.ncols = 1
     self.table.setColumnCount(self.ncols)
     self.col_index.setValidator(QIntValidator(1, self.ncols - 1))
     if self.col_index.text() and int(
             self.col_index.text()) > self.ncols - 1:
         self.col_index.setText(str(self.ncols - 1))
     self.reset_array()
     self.col_range_text = self.col_range_text[:self.ncols] + [''] * (
         self.ncols - len(self.col_range_text))
     self.ui_param['runs included'] = [[] for i in range(self.nrows)]
     for key, default in zip([
             'Type', 'Analogue type', 'Time step name', 'Analogue channel',
             'list index'
     ], ['Time step length', 'Fast analogue', [], [], '0']):
         for i in range(len(self.ui_param[key]), self.ncols):
             self.ui_param[key].append(default)
         if len(self.ui_param[key]) > self.ncols:
             self.ui_param[key] = self.ui_param[key][:self.ncols]
コード例 #15
0
    def __init__(self, parent=None):
        super(ClassPropertiesDlg, self).__init__(parent)
        idlabel = QLabel("&ID(Digits)")
        self.idLineEditBox = QLineEdit(self)
        self.idLineEditBox.setValidator(QIntValidator())
        idlabel.setBuddy(self.idLineEditBox)

        namelabel = QLabel("&Name")
        self.nameLineEditBox = QLineEdit(self)
        namelabel.setBuddy(self.nameLineEditBox)

        descriptionlabel = QLabel("&Description")
        self.descriptionLineEditBox = QTextEdit(self)
        descriptionlabel.setBuddy(self.descriptionLineEditBox)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        layout = QGridLayout()
        layout.addWidget(idlabel, 0, 0)
        layout.addWidget(self.idLineEditBox, 0, 1)
        layout.addWidget(namelabel, 1, 0)
        layout.addWidget(self.nameLineEditBox, 1, 1, 1, 3)
        layout.addWidget(descriptionlabel, 2, 0, 1, 4)
        layout.addWidget(self.descriptionLineEditBox, 3, 0, 3, 4)
        layout.addWidget(self.buttonBox)

        self.setLayout(layout)

        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.setWindowTitle("Class Properties")
コード例 #16
0
 def createMetronomeWidget(self):
     self.metronomeLabel = QLabel()
     self.metronomeNote = QComboBox()
     self.metronomeNote.setModel(
         listmodel.ListModel(
             durations,
             display=None,
             icon=lambda item: symbols.icon('note_{0}'.format(
                 item.replace('.', 'd')))))
     self.metronomeNote.setCurrentIndex(durations.index('4'))
     self.metronomeNote.view().setIconSize(QSize(22, 22))
     self.metronomeEqualSign = QLabel('=')
     self.metronomeEqualSign.setFixedWidth(
         self.metronomeEqualSign.minimumSizeHint().width())
     self.metronomeValue = QComboBox(editable=True)
     self.metronomeValue.setModel(
         listmodel.ListModel(metronomeValues,
                             self.metronomeValue,
                             display=format))
     self.metronomeValue.setCompleter(None)
     self.metronomeValue.setValidator(
         QIntValidator(0, 999, self.metronomeValue))
     self.metronomeValue.setCurrentIndex(metronomeValues.index(100))
     self.metronomeTempo = widgets.tempobutton.TempoButton()
     self.metronomeTempo.tempo.connect(self.setMetronomeValue)
     self.metronomeLabel.setBuddy(self.metronomeNote)
     self.metronomeRound = QCheckBox()
コード例 #17
0
    def __init__(self, iface, parent=None):
        super(AccuratePCISettingDlg, self).__init__()
        self.iface = iface
        self.parent = parent

        self.setWindowTitle(u"PCI规划(高级)")
        self.setWindowFlags(Qt.WindowStaysOnTopHint)

        label = QLabel(u"请选择算法循环次数:")
        self.Cycles = QLineEdit()
        validator = QIntValidator(0, 999, self)
        self.Cycles.setValidator(validator)
        setting_grid = QGridLayout()
        setting_grid.setSpacing(15)
        setting_grid.addWidget(label, 0, 0)
        setting_grid.addWidget(self.Cycles, 0, 1)

        ok = QPushButton(u"确定")
        self.connect(ok, SIGNAL("clicked()"), self.run)
        cancel = QPushButton(u"取消")
        self.connect(cancel, SIGNAL("clicked()"), self.accept)
        btn_hbox = QHBoxLayout()
        btn_hbox.setSpacing(10)
        btn_hbox.addStretch(1)
        btn_hbox.addWidget(ok)
        btn_hbox.addWidget(cancel)
        btn_hbox.addStretch(1)

        vbox = QVBoxLayout()
        vbox.addLayout(setting_grid)
        vbox.addStretch(1)
        vbox.addLayout(btn_hbox)

        self.setLayout(vbox)
        self.resize(180, 80)
コード例 #18
0
    def settings(self, parent):
        # CRIANDO LABEL PARA SELECIONAR O TEMPO DE AMOSTRAGEM
        self.lbTimeAmostragem = QLabel(parent)
        mensagem = "Digite o tempo de amostragem em segundos (Deve ser no mínimo 2 segundos): "
        self.lbTimeAmostragem.setText(mensagem)
        self.lbTimeAmostragem.setAlignment(Qt.AlignCenter)

        # CRIANDO O LINEEDIT PARA SELECIONAR O TEMPO DE AMOSTRAGEM
        self.LETimeAmostragem = QLineEdit(parent)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.LETimeAmostragem.sizePolicy().hasHeightForWidth())
        self.LETimeAmostragem.setSizePolicy(sizePolicy)
        self.LETimeAmostragem.setMaximumSize(QSize(40, 16777215))
        self.LETimeAmostragem.setLayoutDirection(Qt.LeftToRight)
        self.validator = QIntValidator(0, 999999, self)
        self.LETimeAmostragem.setValidator(self.validator)

        # CRIANDO UM SPACER PARA ORGANIZAR DENTRO DO LAYOUT OS ITENS
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)

        # ADICIONANDO OS WIDGETS NO LAYOUT
        self.addWidget(self.lbTimeAmostragem)
        self.addWidget(self.LETimeAmostragem)
        self.addItem(spacerItem)
コード例 #19
0
 def __init__(self):
     QDialog.__init__(self)
     self.ui = Ui_ComputerDialog()
     self.ui.setupUi(self)
     self.valid = QIntValidator(0, 1000000, self)
     self.ui.speed.setValidator(self.valid)
     self.ui.ram.setValidator(self.valid)
コード例 #20
0
    def __createLayout(self):
        " Creates the dialog layout "

        self.resize(400, 80)
        self.setSizeGripEnabled(True)

        vboxLayout = QVBoxLayout(self)

        hboxLayout = QHBoxLayout()
        hboxLayout.addWidget(QLabel("Status update interval, sec."))
        self.__intervalEdit = QLineEdit()
        self.__intervalEdit.setValidator(QIntValidator(1, 3600, self))
        self.__intervalEdit.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        hboxLayout.addWidget(self.__intervalEdit)

        # Buttons at the bottom
        self.__buttonBox = QDialogButtonBox(self)
        self.__buttonBox.setOrientation(Qt.Horizontal)
        self.__buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                            | QDialogButtonBox.Cancel)
        self.__buttonBox.accepted.connect(self.userAccept)
        self.__buttonBox.rejected.connect(self.close)

        vboxLayout.addLayout(hboxLayout)
        vboxLayout.addWidget(self.__buttonBox)
        return
コード例 #21
0
 def __init__(self):
     QDialog.__init__(self)
     self.ui = Ui_LinkDialog()
     self.ui.setupUi(self)
     self.valid = QIntValidator(0, 1000000, self)
     self.ui.capacity.setValidator(self.valid)
     self.ui.length.setValidator(self.valid)
コード例 #22
0
ファイル: options_base.py プロジェクト: wondie/stdm
    def init_gui(self):
        #Set integer validator for the port number
        int_validator = QIntValidator(1024, 49151)
        self.txtPort.setValidator(int_validator)

        #Load profiles
        self.load_profiles()

        #Set current profile in the combobox
        curr_profile = current_profile()
        if not curr_profile is None:
            setComboCurrentIndexWithText(self.cbo_profiles, curr_profile.name)

        #Load current database connection properties
        self._load_db_conn_properties()

        #Load existing PostgreSQL connections
        self._load_qgis_pg_connections()

        #Load directory paths
        self._load_directory_paths()

        # Debug logging
        lvl = debug_logging()
        if lvl:
            self.chk_logging.setCheckState(Qt.Checked)
        else:
            self.chk_logging.setCheckState(Qt.Unchecked)
コード例 #23
0
ファイル: contact_in_group.py プロジェクト: fadiga/waritchi
    def __init__(self, table_group, parent, *args, **kwargs):
        QDialog.__init__(self, parent, *args, **kwargs)

        self.parent = table_group
        group_id = self.parent.table_group.group.group_id
        self.group = Group.select().where(Group.id == group_id).get()
        vbox = QVBoxLayout()
        vbox.addWidget(
            FBoxTitle(u"<h3>Groupe: {}</h3>".format(self.group.name)))
        self.order_number = LineEdit()

        # form transfer
        self.amount = LineEdit()
        self.amount.setFont(QFont("Arial", 15))
        self.amount.setValidator(QIntValidator())
        self.amount.setToolTip(u"Taper le montant du transfert")
        # self.solde = FLabel(get_solde())
        self.amount_error = ErrorLabel(u"")

        send_butt = Button(u"Envoyer")
        send_butt.clicked.connect(self.sender)
        cancel_but = Button(u"Annuler")
        cancel_but.clicked.connect(self.cancel)

        formbox = QGridLayout()
        formbox.addWidget(FLabel(u"Montant: "), 0, 0)
        formbox.addWidget(self.amount, 0, 1)
        formbox.addWidget(send_butt, 2, 1)
        formbox.addWidget(cancel_but, 2, 0)

        vbox.addLayout(formbox)
        self.setLayout(vbox)
コード例 #24
0
    def __init__(self, parent=None):
        super(login, self).__init__(parent)
        self.setupUi(self)

        db = QSqlDatabase.addDatabase('QMYSQL')
        db.setHostName("localhost")
        db.setDatabaseName("TiendaVrt")
        db.setUserName("root")
        db.setPassword("")

        if not db.open():
            print("Could not open testdb database")
            print(db.lastError().driverText())
            print(db.lastError().databaseText())
        else:
            print("Database is OK")

        self.txt_id.setValidator(QIntValidator())
        self.r = Registro.Reg()  #llama la clase que sera en el documento .py
        self.p = Productos.products()
        self.btn_registro.clicked.connect(
            self.r.show)  #muesta la clase en un boton
        self.btn_Ingresar.clicked.connect(self.login)

        db.close()
コード例 #25
0
    def setData(self, m):
        self.method = m
        self.visualizer.Visualize(self.method)
        self.ui.stepforth.setEnabled(True)
        self.ui.lineEdit.setEnabled(True)
        self.ui.labelTotal.setText(str(self.method.trace.length()))
        self.ui.lineEdit.setText(str(self.method.trace.current + 1))
        self.validator = QIntValidator(1, self.method.trace.length(), self)
        self.ui.lineEdit.setValidator(self.validator)
        op = self.method.trace.getCurrent()
        self.showTotals(op[1])

        if self.method.trace.current == 0:
            self.ui.stepback.setEnabled(False)
            self.ui.rewind.setEnabled(False)
        else:
            self.ui.stepback.setEnabled(True)
            self.ui.rewind.setEnabled(True)

        if self.method.trace.current == self.method.trace.length() - 1:
            self.ui.stepforth.setEnabled(False)
            self.ui.replay.setEnabled(False)
        else:
            self.ui.stepforth.setEnabled(True)
            self.ui.replay.setEnabled(True)
コード例 #26
0
 def __init__(self):
     QDialog.__init__(self)
     self.ui = Ui_ComputerDialog()
     self.ui.setupUi(self)
     self.valid = QIntValidator(0, 1000000, self)
     self.ui.speed.setValidator(self.valid)
     self.ui.ram.setValidator(self.valid)
     self.setWindowTitle(self.tr("Edit VM")) #we use the same dialog for resources and demands
コード例 #27
0
ファイル: GraphCanvas.py プロジェクト: DanielZorin/movepoint
 def __init__(self):
     QDialog.__init__(self)
     self.ui = Ui_VertexDialog()
     self.ui.setupUi(self)
     self.valid = QIntValidator(0, 1000000, self)
     self.ui.time.setValidator(self.valid)
     self.ui.versions.verticalHeader().hide()
     self.ui.versions.horizontalHeader().setStretchLastSection(True)
コード例 #28
0
    def __init__(self):
        super().__init__()

        gui.lineEdit(self.controlArea, self, "number", "Enter a number",
                     box="Number",
                     callback=self.number_changed,
                     valueType=int, validator=QIntValidator())
        self.number_changed()
コード例 #29
0
 def __init__(self):
     QDialog.__init__(self)
     self.ui = Ui_OptionsDialog()
     self.ui.setupUi(self)
     self.valid = QIntValidator(0, 10000, self)
     self.ui.esDelayEdit.setValidator(self.valid)
     self.ui.switchDelayEdit.setValidator(self.valid)
     self.ui.ifgEdit.setValidator(self.valid)
コード例 #30
0
 def setup(self):
     self.ui.reportBtn.setEnabled(False)
     self.ui.downloadBtn.setEnabled(False)
     self.ui.stopSelectionBtn.setEnabled(False)
     self.ui.courseNo.setValidator(QIntValidator(99999999, 1000000000))
     self.ui.courseNo.setFocus()
     self.ui.courseNo.paste()
     # self.autoSearch()
     self.ui.folderLE.setText(os.getcwd())
コード例 #31
0
 def setContent(self):
     self.content = QLineEdit(self)
     self.validator = QIntValidator(0, 2147483647, self)
     self.content.setValidator(self.validator)
     self.hlayout.addWidget(self.content)
     self.connect(self.content, SIGNAL("textChanged(const QString &)"),
                  self.updateQuery)
     self.connect(self.content, SIGNAL("textEdited(const QString &)"),
                  self.updateQuery)
コード例 #32
0
    def __set_validators(self):
        '''
        set validators for edit fields
        '''

        validator_positive_integer = QIntValidator()
        validator_positive_integer.setBottom(0)

        validator_positive_double = MyDoubleValidator(True, self)
        validator_zero_one = MyZeroOneValidator(self)

        self.edit_specific_data_0.setValidator(validator_positive_double)
        self.edit_specific_data_1.setValidator(validator_positive_double)
        self.edit_specific_data_2.setValidator(validator_positive_double)
        self.edit_geometry_coeficient.setValidator(validator_positive_double)
        self.edit_geometry_type.setValidator(validator_positive_integer)
        self.edit_storativity.setValidator(validator_zero_one)
        self.editl_dual_porosity.setValidator(validator_zero_one)
        self.edit_type.setValidator(validator_positive_integer)
コード例 #33
0
    def __init__(self, parent=None):
        """Constructor."""
        super(NetworkAPIDialog, self).__init__(parent)
        self.setupUi(self)
        # After setupUI you can access any designer object by doing
        # self.<objectname>

        self.port.setValidator(QIntValidator(0, 65536))
        self.buttons.clicked.connect(self.handleButtonClick)
        self.loadSettings()
コード例 #34
0
    def ud_times(self):
        """ Dialog ud_times.ui """

        dlg_udtimes = UDtimes()
        self.load_settings(dlg_udtimes)
        dlg_udtimes.dry_days.setValidator(QIntValidator())
        dlg_udtimes.btn_accept.clicked.connect(partial(self.update_table, 'inp_options', dlg_udtimes))
        dlg_udtimes.btn_cancel.clicked.connect(dlg_udtimes.close)
        self.go2epa_options_get_data('inp_options', dlg_udtimes)
        dlg_udtimes.setWindowFlags(Qt.WindowStaysOnTopHint)
        dlg_udtimes.exec_()
コード例 #35
0
 def createEditor(self, parent, option, index):
     if index.column() == DATAINS:
         editor = QDateEdit(parent)
         editor.setCalendarPopup(True)
         editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
         return editor
     elif index.column() == QT:
         editor = QLineEdit(parent)
         validator = QIntValidator(self)
         editor.setValidator(validator)
         editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
         return editor
     elif index.column() == IMP:
         editor = QLineEdit(parent)
         validator = QDoubleValidator(self)
         validator.setDecimals(3)
         editor.setValidator(validator)
         editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
         return editor
     else:
         return QSqlRelationalDelegate.createEditor(self, parent, option,
                                                    index)
コード例 #36
0
ファイル: fatture.py プロジェクト: L0cutus/Gestione-Fatture
    def createEditor(self, parent, option, index):
        if index.column() == SQT:
            editor = MyQLineEdit(parent)
            validator = QIntValidator(self)
            editor.setValidator(validator)
            editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
            self.connect(editor, SIGNAL("keyDownPressEvent()"),
                        self.gestEvt)
            return editor
        elif index.column() == SIMP:
            editor = MyQLineEdit(parent)
            validator = QDoubleValidator(self)
            validator.setDecimals(3)
            editor.setValidator(validator)
            editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
            self.connect(editor, SIGNAL("keyDownPressEvent()"),
                        self.gestEvt)
            return editor
        elif index.column() == SIVA:
            editor = MyQLineEdit(parent)
            validator = QDoubleValidator(self)
            validator.setDecimals(3)
            editor.setValidator(validator)
            editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
            self.connect(editor, SIGNAL("keyDownPressEvent()"),
                        self.gestEvt)
            return editor
        elif index.column() == SDESC:
            editor = MyQLineEdit(parent)
            editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
            self.connect(editor, SIGNAL("keyDownPressEvent()"),
                        self.gestEvt)
            return editor

        editor = QSqlRelationalDelegate.createEditor(self, parent,
                                                    option, index)
        return editor
コード例 #37
0
ファイル: NuConfValidators.py プロジェクト: maximerobin/Ufwi
def portValidator(parent):
    validator = QIntValidator(0, 65535, parent)
    validator.setObjectName('portValidator')
    return validator
コード例 #38
0
    def __init__(self, status, actions):
        super (I2CControlView, self).__init__()
        self.status = status
        self.actions = actions

        f = open(I2C_DESC_LOC, 'r')
        s = f.read()
        f.close()
        s = s.split("DESCRIPTION START")[1]
        s = s.split("DESCRIPTION END")[0]
        #print "s: %s" % s
        i2c_desc = QLabel(s)
        i2c_desc.setMaximumWidth(500)
        i2c_desc.setWordWrap(True)
        i2c_desc.setAlignment(QtCore.Qt.AlignTop)


        run_button = QPushButton("Run")
        run_button.setToolTip("Execute the I2C Transaction")
        run_button.clicked.connect(self.actions.i2c_run)

        reload_button = QPushButton("Reload")
        reload_button.setToolTip("Reload I2C Transactions")
        reload_button.clicked.connect(self.actions.i2c_run)

        pause_button = QPushButton("Pause")
        pause_button.setToolTip("Pause I2C Execution flow")
        pause_button.clicked.connect(self.actions.i2c_pause)

        stop_button = QPushButton("Stop")
        stop_button.setToolTip("Stop I2C Execution")
        stop_button.clicked.connect(self.actions.i2c_stop)

        reset_button = QPushButton("Reset")
        reset_button.setToolTip("Reset the current execution")
        reset_button.clicked.connect(self.actions.i2c_reset)

        step_button = QPushButton("Step")
        step_button.setToolTip("Execute one I2C Transaction")
        step_button.clicked.connect(self.actions.i2c_step)
       
        loop_step_button = QPushButton("Loop Step")
        loop_step_button.setToolTip("Iterate through the I2C Loop one time")
        loop_step_button.clicked.connect(self.actions.i2c_loop_step)

        update_delay_button = QPushButton("Update Delay (ms)")
        update_delay_button.setToolTip("Update the delay in ms between I2C Transactions")
        update_delay_button.clicked.connect(self.update_delay)

        self.delay_le = QLineEdit("100")
        self.delay_le.setAlignment(QtCore.Qt.AlignRight)
        v = QIntValidator()
        v.setBottom(1)


        self.execute_status = QLabel("Idle")

        self.default_slave_addr = QLineEdit()
        self.default_slave_addr.setAlignment(QtCore.Qt.AlignRight)
        self.default_slave_addr.setText("0x10")
        self.default_slave_addr.textChanged.connect(self.custom_validator)
        self.default_slave_addr.returnPressed.connect(self.update_all_slave_addresses)
        self.update_all_slave_addr = QPushButton("Update All Slave Addr")
        self.update_all_slave_addr.clicked.connect(self.update_all_slave_addresses)

        layout = QGridLayout()

        layout.addWidget(i2c_desc, 0, 0, 1, 2)
        #Add Default I2C Address
        default_addr_layout = QGridLayout()

        default_addr_layout.addWidget(QLabel("Default Slave Addr"), 0, 0, 1, 1)
        default_addr_layout.addWidget(self.default_slave_addr, 0, 1, 1, 1)
        default_addr_layout.addWidget(self.update_all_slave_addr, 1, 0, 1, 2)

        #Add Buttons/Status Layout
        layout.addLayout(default_addr_layout,         2, 0, 1, 2)
                                                      

        buttons_layout = QGridLayout()
        buttons_layout.addWidget(run_button,          0, 0, 1, 2)
        buttons_layout.addWidget(reload_button,       1, 0, 1, 2)
        buttons_layout.addWidget(step_button,         2, 0, 1, 2)
        buttons_layout.addWidget(loop_step_button,    3, 0, 1, 2)
        buttons_layout.addWidget(pause_button,        4, 0, 1, 2)
        buttons_layout.addWidget(stop_button,         5, 0, 1, 2)
        buttons_layout.addWidget(reset_button,        6, 0, 1, 2)
        buttons_layout.addWidget(update_delay_button, 7, 0, 1, 1)
        buttons_layout.addWidget(self.delay_le,       7, 1, 1, 1)
        buttons_layout.addWidget(QLabel("Status:"),   8, 0, 1, 1)
        buttons_layout.addWidget(self.execute_status, 8, 1, 1, 1)

        layout.addLayout(buttons_layout,              3, 0, 1, 2)
        self.actions.i2c_execute_status_update.connect(self.status_update)
        self.setLayout(layout)
コード例 #39
0
    def __init__(self, parent=None, aptinkerQSettings=None):
        """Constructor"""

        QDialog.__init__(self, parent=parent)

        self.setupUi(self)

        self.setWindowFlags(Qt.Window) # To add Maximize & Minimize buttons
        self.setWindowTitle('Select Snapshot from Database')

        # Load Startup Preferences for Snapshot Table
        self.default_ss_pref = dict(
            vis_col_key_list=config.DEF_VIS_COL_KEYS['snapshot_DB'][:])
        if osp.exists(PREF_SS_JSON_FILEPATH):
            with open(PREF_SS_JSON_FILEPATH, 'r') as f:
                self.ss_pref = json.load(f)
        else:
            self.ss_pref = self.default_ss_pref

        # Load Startup Preferences for Snapshot Meta Table
        self.default_ss_meta_pref = dict(
            vis_col_key_list=['ss_id', 'config_id', 'ss_ctime', 'ss_name',
                              'ss_username'])
        if osp.exists(PREF_SS_META_JSON_FILEPATH):
            with open(PREF_SS_META_JSON_FILEPATH, 'r') as f:
                self.ss_meta_pref = json.load(f)
        else:
            self.ss_meta_pref = self.default_ss_meta_pref

        self.ssDBViewWidget = SnapshotDBViewWidget(self.groupBox_selected_ss,
                                                   DB_selector=True)
        self.tableView_ss = self.ssDBViewWidget.tableView

        self.ssMetaDBViewWidget = SnapshotMetaDBViewWidget(
            self.groupBox_search_result)
        self.tableView_ss_meta = self.ssMetaDBViewWidget.tableView
        self.textEdit_description = \
            self.ssMetaDBViewWidget.textEdit_description

        self.settings = QSettings('APHLA', 'TinkerSSDBSelector')
        self.loadViewSettings()

        self._aptinkerQSettings = aptinkerQSettings

        self.pushButton_search.setIcon(QIcon(':/search.png'))

        all_ctime_operators = [
            self.comboBox_time_created_1.itemText(i)
            for i in range(self.comboBox_time_created_1.count())]
        self.comboBox_time_created_1.setCurrentIndex(
            all_ctime_operators.index(''))
        self.dateTimeEdit_time_created_1.setDateTime(
            QDateTime.currentDateTime())
        self.dateTimeEdit_time_created_2.setDateTime(
            QDateTime.currentDateTime())

        self.search_params = dict(
            ss_id_1='', ss_id_2='', config_id_1='', config_id_2='',
            ss_ref_step_size_1='', ss_ref_step_size_2='',
            ss_name='', ss_desc='', ss_username='', ss_ctime_1='', ss_ctime_2='',
            ss_synced_gruop_weight='', ss_masar_id_1='', ss_masar_id_2='')

        db_id_validator = QIntValidator()
        db_id_validator.setBottom(1)
        self.lineEdit_ss_id_1.setValidator(db_id_validator)
        self.lineEdit_ss_id_2.setValidator(db_id_validator)
        self.lineEdit_config_id_1.setValidator(db_id_validator)
        self.lineEdit_config_id_2.setValidator(db_id_validator)
        self.lineEdit_masar_id_1.setValidator(db_id_validator)
        self.lineEdit_masar_id_2.setValidator(db_id_validator)

        self.prev_valid_ref_step_sizes = dict(
            lineEdit_ref_step_size_1=np.nan, lineEdit_ref_step_size_2=np.nan)

        # Set up Snapshot Table
        self.ss_model = SnapshotModel(self.ss_pref['vis_col_key_list'])
        self.tableModel_ss = self.ss_model.table
        proxyModel = QSortFilterProxyModel()
        proxyModel.setSourceModel(self.tableModel_ss)
        proxyModel.setDynamicSortFilter(False)
        tbV = self.tableView_ss
        tbV.setModel(proxyModel)
        tbV.setItemDelegate(SnapshotDBTableViewItemDelegate(
            tbV, self.tableModel_ss, tbV.parent()))

        #self.db = TinkerMainDatabase()
        self.db = self.ss_model.db
        if '[ss_meta_table text view]' not in self.db.getViewNames(
            square_brackets=True):
            self.db.create_temp_ss_meta_table_text_view()

        # Set up Snapshot Meta Table
        self.ss_meta_all_col_keys = self.ssMetaDBViewWidget.all_col_keys
        self.search_result = {k: [] for k in self.ss_meta_all_col_keys}

        self.tableModel_ss_meta = MetaTableModel(
            self.search_result, self.ssMetaDBViewWidget)
        proxyModel = QSortFilterProxyModel()
        proxyModel.setSourceModel(self.tableModel_ss_meta)
        proxyModel.setDynamicSortFilter(False)
        tbV = self.tableView_ss_meta
        tbV.setModel(proxyModel)
        self.selectionModel = QItemSelectionModel(proxyModel)
        tbV.setSelectionModel(self.selectionModel)

        # Apply Visible Column Preference to Snapshot Meta Table
        ss_meta_vis_col_name_list = [
            self.ssMetaDBViewWidget.col_names_wo_desc[
                self.ssMetaDBViewWidget.col_keys_wo_desc.index(k)]
            for k in self.ss_meta_pref['vis_col_key_list']]
        self.ssMetaDBViewWidget.on_column_selection_change(
            ss_meta_vis_col_name_list, force_visibility_update=True)

        # Make connection

        self.connect(self.lineEdit_ref_step_size_1, SIGNAL('editingFinished()'),
                     self.validate_ref_step_size)
        self.connect(self.lineEdit_ref_step_size_2, SIGNAL('editingFinished()'),
                     self.validate_ref_step_size)

        self.connect(self.pushButton_search, SIGNAL('clicked()'),
                     self.update_search)

        self.connect(
            self.selectionModel,
            SIGNAL(
                'currentRowChanged(const QModelIndex &, const QModelIndex &)'),
            self.on_selection_change
        )