示例#1
0
    def __getProfileLimitsGroupbox(self):
        " Creates the profile limits groupbox "
        limitsGroupbox = QGroupBox(self)
        limitsGroupbox.setTitle("Profiler diagram limits")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            limitsGroupbox.sizePolicy().hasHeightForWidth())
        limitsGroupbox.setSizePolicy(sizePolicy)

        layoutLimits = QGridLayout(limitsGroupbox)
        self.__nodeLimitEdit = QLineEdit()
        self.__nodeLimitEdit.textEdited.connect(self.__setRunButtonProps)
        self.__nodeLimitValidator = QDoubleValidator(0.0, 100.0, 2, self)
        self.__nodeLimitValidator.setNotation(
            QDoubleValidator.StandardNotation)
        self.__nodeLimitEdit.setValidator(self.__nodeLimitValidator)
        nodeLimitLabel = QLabel("Hide nodes below")
        self.__edgeLimitEdit = QLineEdit()
        self.__edgeLimitEdit.textEdited.connect(self.__setRunButtonProps)
        self.__edgeLimitValidator = QDoubleValidator(0.0, 100.0, 2, self)
        self.__edgeLimitValidator.setNotation(
            QDoubleValidator.StandardNotation)
        self.__edgeLimitEdit.setValidator(self.__edgeLimitValidator)
        edgeLimitLabel = QLabel("Hide edges below")
        layoutLimits.addWidget(nodeLimitLabel, 0, 0)
        layoutLimits.addWidget(self.__nodeLimitEdit, 0, 1)
        layoutLimits.addWidget(QLabel("%"), 0, 2)
        layoutLimits.addWidget(edgeLimitLabel, 1, 0)
        layoutLimits.addWidget(self.__edgeLimitEdit, 1, 1)
        layoutLimits.addWidget(QLabel("%"), 1, 2)
        return limitsGroupbox
示例#2
0
 def __init__(self, module, parent=None ):
     """Constructor."""
     super(fdtmSettingsDialog, self).__init__(parent)
     self.iface = module.iface
     self.setupUi(self)
     self.DEMLayer.setFilters(QgsMapLayerProxyModel.RasterLayer)
     self.isValidated = None
     self.newProjectIsNotYetSaved = None
     self.buttonBox.accepted.connect(self.datasetValidation)
     self.exportProjectButton.clicked.connect(self.export_action)
     self.exportProjectButton.setEnabled(False)
     self.averagePrecipitation.setText('10')
     self.defaultRoadsWidth.setText('8')
     self.averagePrecipitation.setValidator(QDoubleValidator(0, 1000, 2, self.averagePrecipitation) )
     self.defaultRoadsWidth.setValidator(QDoubleValidator(0, 100, 2, self.defaultRoadsWidth) )
     self.defaultRoadsWidth.hide()
     self.defaultRoadsWidthLabel.hide()
     self.projectFolderPath.hide()
     self.projectFolderLabel.hide()
     #self.projection.setOptionVisible(QgsProjectionSelectionWidget.ProjectCrs,True)
     self.updateDataset = None
     self.averagePrecipitationChanged = None
     self.setNullProjectFiles()
     self.setOptionalSupportFiles()
     self.validated.connect(self.handleUpdateSignals)
     self.debugCheck.stateChanged.connect(self.toggleDebug)
     self.qgis_stdout = sys.stdout
     self.debugCheck.setChecked(False)
     self.debugCheck.hide()
     self.debugLabel.hide()
     self.allowValidationLabel.show()
     self.adjustSize()
     self.loadRCCombo()
     self.activate()
    def createAdditionalControlWidgets(self):
        self.windowChooser = QComboBox()
        self.windowChooser.addItems(self.prm['data']['available_windows'])
        self.windowChooser.setCurrentIndex(self.windowChooser.findText(self.prm['pref']['smoothingWindow']))
        self.windowChooserLabel = QLabel(self.tr('Window:'))
        self.gridBox.addWidget(self.windowChooserLabel, 0, 4)
        self.gridBox.addWidget(self.windowChooser, 0, 5)
        self.windowChooser.currentIndexChanged[int].connect(self.onChangeWindowFunction)

        self.winLengthLabel= QLabel(self.tr('Window Length (s)'))
        self.winLengthWidget = QLineEdit(self.currLocale.toString(0)) 
        self.winLengthWidget.setValidator(QDoubleValidator(self))
        self.gridBox.addWidget(self.winLengthLabel, 2, 0)
        self.gridBox.addWidget(self.winLengthWidget, 2, 1)

        self.winOverlapLabel= QLabel(self.tr('Overlap (%)'))
        self.winOverlapWidget = QLineEdit(self.currLocale.toString(0)) 
        self.winOverlapWidget.setValidator(QDoubleValidator(self))
        self.gridBox.addWidget(self.winOverlapLabel, 2, 2)
        self.gridBox.addWidget(self.winOverlapWidget, 2, 3)

        self.cmapChooserLabel = QLabel(self.tr('Color Map:'))
        self.gridBox.addWidget(self.cmapChooserLabel, 1, 4)
        self.cmapChooser = QComboBox()
        self.cmapChooser.addItems(self.prm['data']['available_colormaps'])
        self.cmapChooser.setCurrentIndex(self.cmapChooser.findText(self.prm['pref']['colormap']))
        self.gridBox.addWidget(self.cmapChooser, 1, 5)

        self.windowChooser.currentIndexChanged[int].connect(self.onChangeWindowFunction)
        self.cmapChooser.currentIndexChanged[int].connect(self.onChangeWindowFunction)
        self.winLengthWidget.editingFinished.connect(self.onChangeWindowFunction)
        self.winOverlapWidget.editingFinished.connect(self.onChangeWindowFunction)
示例#4
0
def double_validator(widget,
                     min=0,
                     max=999999,
                     decimals=3,
                     notation=QDoubleValidator().StandardNotation):
    validator = QDoubleValidator(min, max, decimals)
    validator.setNotation(notation)
    widget.setValidator(validator)
    def __init__(self):
        super().__init__()

        box0 = gui.widgetBox(self.controlArea, " ",orientation="horizontal") 
        #widget buttons: compute, set defaults, help
        gui.button(box0, self, "Compute", callback=self.calculate_IdealPhaseRetarder)
        gui.button(box0, self, "Defaults", callback=self.defaults)
        gui.button(box0, self, "Help", callback=self.get_doc)
        self.process_showers()
        box = gui.widgetBox(self.controlArea, " ",orientation="vertical") 
        
        
        idx = -1 
        
        # widget index 0 
        idx += 1 
        box1 = gui.widgetBox(box) 
        gui.comboBox(box1, self, "TYPE",
                     label=self.unitLabels()[idx], addSpace=True,
                     items=['general', 'Quarter Wave Plate (fast-axis horizontal)', 'Quarter Wave Plate (fast-axis vertical)', 'Half Wave Plate (also Ideal Mirror)'],
                     valueType=int, orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box1) 
        
        # widget index 1 
        idx += 1 
        box1 = gui.widgetBox(box) 
        gui.lineEdit(box1, self, "THETA",
                     label=self.unitLabels()[idx], addSpace=True,
                     valueType=float, validator=QDoubleValidator())
        self.show_at(self.unitFlags()[idx], box1) 
        
        # widget index 2 
        idx += 1 
        box1 = gui.widgetBox(box) 
        gui.lineEdit(box1, self, "DELTA",
                     label=self.unitLabels()[idx], addSpace=True,
                     valueType=float, validator=QDoubleValidator())
        self.show_at(self.unitFlags()[idx], box1) 

        # widget index 3
        idx += 1
        box1 = gui.widgetBox(box)
        gui.comboBox(box1, self, "DUMP_TO_FILE",
                     label=self.unitLabels()[idx], addSpace=True,
                     items=["No","Yes"],
                     orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box1)

        # widget index 4
        idx += 1
        box1 = gui.widgetBox(box)
        gui.lineEdit(box1, self, "FILE_NAME",
                     label=self.unitLabels()[idx], addSpace=True)
        self.show_at(self.unitFlags()[idx], box1)

        gui.rubber(self.controlArea)
示例#6
0
    def __init__(self, parent=None):
        super(NumberWidgetConfig, self).__init__(parent)
        self.setupUi(self)
        self.minEdit.setValidator(QDoubleValidator())
        self.maxEdit.setValidator(QDoubleValidator())

        self.minEdit.textChanged.connect(self.widgetchanged)
        self.maxEdit.textChanged.connect(self.widgetchanged)
        self.prefixEdit.textChanged.connect(self.widgetchanged)
        self.suffixEdit.textChanged.connect(self.widgetchanged)
示例#7
0
 def set_coords_limits(self):
     """
     sets min and max X and Y coords for user input validation
     :return: void
     """
     self.coords_line_edit_list = self.coords_dlg.findChildren(QLineEdit)
     x_coords_validator = QDoubleValidator(-100000.00, 600000.00, 2, None)
     y_coords_validator = QDoubleValidator(100000.00, 1300000.00, 2, None)
     for coords_line_edit in self.coords_line_edit_list:
         if "X" in coords_line_edit.objectName():
             coords_line_edit.setValidator(x_coords_validator)
         else:
             coords_line_edit.setValidator(y_coords_validator)
示例#8
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_()
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = parent.prm
        self.currLocale = self.parent().prm['data']['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)
        vbl = QVBoxLayout()
        self.grid = QGridLayout()

        filterTypeLabel = QLabel(self.tr('Filter Type: '))
        self.filterChooser = QComboBox()
        self.filterChooser.addItems([
            self.tr('lowpass'),
            self.tr('highpass'),
            self.tr('bandpass'),
            self.tr('bandstop')
        ])
        self.filterChooser.setCurrentIndex(0)
        self.grid.addWidget(self.filterChooser, 0, 1)
        self.filterChooser.currentIndexChanged[int].connect(
            self.onChangeFilterType)
        self.filterOrderLabel = QLabel(self.tr('Filter Order: '))
        self.filterOrderWidget = QLineEdit('256')
        self.filterOrderWidget.setValidator(QIntValidator(self))
        self.grid.addWidget(self.filterOrderLabel, 0, 2)
        self.grid.addWidget(self.filterOrderWidget, 0, 3)

        self.currFilterType = self.tr('lowpass')
        self.cutoffLabel = QLabel(self.tr('Cutoff: '))
        self.endCutoffLabel = QLabel(self.tr('End Transition Band = Cutoff *'))
        self.cutoffWidget = QLineEdit('')
        self.cutoffWidget.setValidator(QDoubleValidator(self))
        endCutoff = 1.2
        self.endCutoffWidget = QLineEdit(self.currLocale.toString(endCutoff))
        self.endCutoffWidget.setValidator(QDoubleValidator(self))
        self.grid.addWidget(self.cutoffLabel, 2, 1)
        self.grid.addWidget(self.cutoffWidget, 2, 2)
        self.grid.addWidget(self.endCutoffLabel, 2, 3)
        self.grid.addWidget(self.endCutoffWidget, 2, 4)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        vbl.addLayout(self.grid)
        vbl.addWidget(buttonBox)
        self.setLayout(vbl)
        self.setWindowTitle(self.tr("Apply Filter"))
示例#10
0
 def __init__(self, iface):
     QDialog.__init__(self, iface.mainWindow())
     self.iface = iface
     self.setupUi(self)
     self.xMin.setValidator(QDoubleValidator(self.xMin))
     self.xMax.setValidator(QDoubleValidator(self.xMax))
     self.yMin.setValidator(QDoubleValidator(self.yMin))
     self.yMax.setValidator(QDoubleValidator(self.yMax))
     QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
     self.setWindowTitle(self.tr("Regular points"))
     self.buttonOk = self.buttonBox_2.button(QDialogButtonBox.Ok)
     self.progressBar.setValue(0)
     self.mapCanvas = self.iface.mapCanvas()
     self.populateLayers()
示例#11
0
    def build_gui(self):

        box = oasysgui.widgetBox(self.controlArea,
                                 self.name + " Input Parameters",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 5)

        idx = -1

        #widget index 0
        idx += 1
        box1 = gui.widgetBox(box)
        oasysgui.lineEdit(box1,
                          self,
                          "VOLTAGE",
                          label=self.unitLabels()[idx],
                          addSpace=False,
                          valueType=float,
                          validator=QDoubleValidator(),
                          orientation="horizontal",
                          labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1)

        #widget index 1
        idx += 1
        box1 = gui.widgetBox(box)
        oasysgui.lineEdit(box1,
                          self,
                          "RIPPLE",
                          label=self.unitLabels()[idx],
                          addSpace=False,
                          valueType=float,
                          validator=QDoubleValidator(),
                          orientation="horizontal",
                          labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1)

        #widget index 2
        idx += 1
        box1 = gui.widgetBox(box)
        oasysgui.lineEdit(box1,
                          self,
                          "AL_FILTER",
                          label=self.unitLabels()[idx],
                          addSpace=False,
                          valueType=float,
                          validator=QDoubleValidator(),
                          orientation="horizontal",
                          labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1)
示例#12
0
    def __init__(self):
        super().__init__()

        box0 = gui.widgetBox(self.controlArea, " ", orientation="horizontal")
        #widget buttons: compute, set defaults, help
        gui.button(box0, self, "Compute", callback=self.compute)
        gui.button(box0, self, "Defaults", callback=self.defaults)
        gui.button(box0, self, "Help", callback=self.help1)
        self.process_showers()
        box = gui.widgetBox(self.controlArea, " ", orientation="vertical")

        idx = -1

        #widget index 0
        idx += 1
        box1 = gui.widgetBox(box)
        gui.lineEdit(box1,
                     self,
                     "coating",
                     label=self.unitLabels()[idx],
                     addSpace=True)
        self.show_at(self.unitFlags()[idx], box1)

        #widget index 1
        idx += 1
        box1 = gui.widgetBox(box)
        gui.lineEdit(box1,
                     self,
                     "thickness",
                     label=self.unitLabels()[idx],
                     addSpace=True,
                     valueType=float,
                     validator=QDoubleValidator())
        self.show_at(self.unitFlags()[idx], box1)

        #widget index 2
        idx += 1
        box1 = gui.widgetBox(box)
        gui.lineEdit(box1,
                     self,
                     "density",
                     label=self.unitLabels()[idx],
                     addSpace=True,
                     valueType=float,
                     validator=QDoubleValidator())
        self.show_at(self.unitFlags()[idx], box1)

        self.process_showers()
        gui.rubber(self.controlArea)
示例#13
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_()
示例#14
0
    def __init__(self, parent=None):
        super(NumberWidgetConfig, self).__init__(parent)
        self.setupUi(self)
        self.minEdit.setValidator(QDoubleValidator())
        self.maxEdit.setValidator(QDoubleValidator())

        self.minEdit.textChanged.connect(self.widgetchanged)
        self.maxEdit.textChanged.connect(self.widgetchanged)
        self.prefixEdit.textChanged.connect(self.widgetchanged)
        self.suffixEdit.textChanged.connect(self.widgetchanged)
        self.places_spin.valueChanged.connect(self.widgetchanged)
        self.step_spin.valueChanged.connect(self.widgetchanged)

        self.places_spin.setVisible(False)
        self.places_label.setVisible(False)
示例#15
0
    def get_point(self, virtual_layer_name):
    
        validator = QDoubleValidator(0.00, 999.00, 3)
        validator.setNotation(QDoubleValidator().StandardNotation)

        self.dlg_create_circle.radius.setValidator(validator)
        self.dlg_create_circle.btn_accept.pressed.connect(self.get_radius)
        self.dlg_create_circle.btn_cancel.pressed.connect(self.cancel)
        self.dlg_create_circle.radius.setFocus()

        self.active_layer = self.iface.mapCanvas().currentLayer()
        self.virtual_layer_polygon = self.controller.get_layer_by_layername(virtual_layer_name, True)
        
        # Open dialog
        self.open_dialog(self.dlg_create_circle, maximize_button=False)
示例#16
0
    def createDialog (self):
        """
        Create qt dialog
        """
                
        self.TIMEOUT_ACTION = Settings.instance().readValue( key = 'TestGenerator/timeout-framework-action' )

        self.timeoutLine = QLineEdit()
        self.timeoutLine.setText(str(self.TIMEOUT_ACTION))
        validatorTimeout = QDoubleValidator(self)
        validatorTimeout.setNotation(QDoubleValidator.StandardNotation)
        self.timeoutLine.setValidator(validatorTimeout)
        self.timeoutLine.installEventFilter(self)

        optionLayout = QHBoxLayout()
        optionLayout.addWidget(QLabel( self.tr("Max time to run action (in seconds):") ) )
        optionLayout.addWidget(self.timeoutLine)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(optionLayout)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Framework Options"))
示例#17
0
    def init_create_circle_form(self, point):

        # Create the dialog and signals
        self.dlg_create_circle = Cad_add_circle()
        self.load_settings(self.dlg_create_circle)
        self.cancel_circle = False
        validator = QDoubleValidator(0.00, 999.00, 3)
        validator.setNotation(QDoubleValidator().StandardNotation)
        self.dlg_create_circle.radius.setValidator(validator)

        self.dlg_create_circle.btn_accept.clicked.connect(
            partial(self.get_radius, point))
        self.dlg_create_circle.btn_cancel.clicked.connect(self.cancel)
        self.dlg_create_circle.radius.setFocus()

        self.dlg_create_circle.exec_()
示例#18
0
 def __init__(self, iface):
     QDialog.__init__(self, iface.mainWindow())
     self.iface = iface
     self.setupUi(self)
     QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
     QObject.connect(self.spnX, SIGNAL("valueChanged(double)"), self.offset)
     QObject.connect(self.btnUpdate, SIGNAL("clicked()"), self.updateLayer)
     QObject.connect(self.btnCanvas, SIGNAL("clicked()"), self.updateCanvas)
     QObject.connect(self.chkAlign, SIGNAL("toggled(bool)"), self.chkAlignToggled)
     self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
     self.setWindowTitle(self.tr("Vector grid"))
     self.xMin.setValidator(QDoubleValidator(self.xMin))
     self.xMax.setValidator(QDoubleValidator(self.xMax))
     self.yMin.setValidator(QDoubleValidator(self.yMin))
     self.yMax.setValidator(QDoubleValidator(self.yMax))
     self.populateLayers()
示例#19
0
    def __init__(self, edge, line_name, proc_ev):
        super(Dialog_edge, self).__init__()

        # Entry window name
        self.setWindowTitle("Line {}-{}".format(line_name[0], line_name[1]))

        # Entry forms
        self.entry_susceptance = QLineEdit()
        self.entry_susceptance.setText(str(edge["susceptance"]))
        self.entry_susceptance.setValidator(QDoubleValidator(0.01, 10, 2))

        self.entry_status = QCheckBox()
        self.entry_status.setChecked(edge["status"])

        self.layout = QFormLayout()
        self.layout.addRow("Susceptance", self.entry_susceptance)
        self.layout.addRow("Connected", self.entry_status)

        # Entry window set button
        self.button = QPushButton()
        self.button.setText("Set")
        self.button.clicked.connect(partial(self.button_click, edge))
        self.layout.addWidget(self.button)

        # Set entry window layout
        self.setLayout(self.layout)

        self.proc_ev = proc_ev
        self.show()
示例#20
0
 def createEditor(self, parent, option, index):
     editor = QLineEdit(parent)
     if index.column() == 0:
         editor.setValidator(QDoubleValidator(0, 1, 6, editor))
     else:
         editor.setInputMask(r"\#HHHHHHHH")
     return editor
示例#21
0
 def setDefaultParameters(self):
 
     self.field = list(range(self.sndPrm['nFields']))
     self.fieldLabel = list(range(self.sndPrm['nFields']))
     fieldLabelColumn = 0
     fieldColumn = 1
     chooserLabelColumn = 2
     chooserColumn = 3
     fshift = self.nrows
     for f in range(self.sndPrm['nFields']):
         self.fieldLabel[f] = QLabel(self.tr(self.sndPrm['fieldLabel'][f]))
         self.grid_0.addWidget(self.fieldLabel[f], f+fshift, fieldLabelColumn)
         self.field[f] = QLineEdit()
         self.field[f].setText(str(self.sndPrm['field'][f]))
         self.field[f].setValidator(QDoubleValidator(self))
         self.grid_0.addWidget(self.field[f], f+fshift, fieldColumn)
      
     self.chooser = list(range(self.sndPrm['nChoosers']))
     self.chooserLabel = list(range(self.sndPrm['nChoosers']))
     self.chooserOptions = list(range(self.sndPrm['nChoosers']))
     for c in range(self.sndPrm['nChoosers']):
         self.chooserLabel[c] = QLabel(self.tr(self.sndPrm['chooserLabel'][c]))
         self.grid_1.addWidget(self.chooserLabel[c], c, chooserLabelColumn)
         self.chooserOptions[c] = self.sndPrm['chooserOptions'][c]
         self.chooser[c] = QComboBox()  
         self.chooser[c].addItems(self.chooserOptions[c])
         self.chooser[c].setCurrentIndex(self.chooserOptions[c].index(self.sndPrm['chooser'][c]))
         self.grid_1.addWidget(self.chooser[c], c, chooserColumn)
     for c in range(len(self.chooser)):
         self.chooser[c].activated[str].connect(self.onChooserChange)
         self.onChooserChange()
     self.sndPrm['nFields'] = len(self.field)
     self.sndPrm['nChoosers'] = len(self.chooser)
示例#22
0
    def master_estimate_result_new(self,
                                   tablename=None,
                                   result_id=None,
                                   index=0):
        """ Button 38: New estimate result """

        # Create dialog
        dlg_estimate_result_new = EstimateResultNew()
        self.load_settings(dlg_estimate_result_new)

        # Set signals
        dlg_estimate_result_new.btn_close.clicked.connect(
            partial(self.close_dialog, dlg_estimate_result_new))
        dlg_estimate_result_new.prices_coefficient.setValidator(
            QDoubleValidator())

        self.populate_cmb_result_type(dlg_estimate_result_new.cmb_result_type,
                                      'plan_result_type', False)

        if result_id != 0 and result_id:
            sql = ("SELECT * FROM " + self.schema_name + "." + tablename + " "
                   " WHERE result_id = '" + str(result_id) +
                   "' AND current_user = cur_user")
            row = self.controller.get_row(sql)
            if row is None:
                message = "Any record found for current user in table"
                self.controller.show_warning(message,
                                             parameter='plan_result_cat')
                return

            utils_giswater.setWidgetText(dlg_estimate_result_new,
                                         dlg_estimate_result_new.result_name,
                                         row['result_id'])
            dlg_estimate_result_new.cmb_result_type.setCurrentIndex(index)
            utils_giswater.setWidgetText(
                dlg_estimate_result_new,
                dlg_estimate_result_new.prices_coefficient,
                row['network_price_coeff'])
            utils_giswater.setWidgetText(dlg_estimate_result_new,
                                         dlg_estimate_result_new.observ,
                                         row['descript'])
            dlg_estimate_result_new.result_name.setEnabled(False)
            dlg_estimate_result_new.cmb_result_type.setEnabled(False)
            dlg_estimate_result_new.prices_coefficient.setEnabled(False)
            dlg_estimate_result_new.observ.setEnabled(False)
            dlg_estimate_result_new.btn_calculate.setText("Close")
            dlg_estimate_result_new.btn_calculate.clicked.connect(
                partial(self.close_dialog))
        else:
            dlg_estimate_result_new.btn_calculate.clicked.connect(
                partial(self.master_estimate_result_new_calculate,
                        dlg_estimate_result_new))
        # TODO pending translation
        # Manage i18n of the form and open it
        # self.controller.translate_form(dlg_estimate_result_new, 'estimate_result_new')

        self.open_dialog(dlg_estimate_result_new,
                         dlg_name="plan_estimate_result_new",
                         maximize_button=False)
示例#23
0
    def get_point(self, virtual_layer_name):
        validator = QDoubleValidator(-99999.99, 99999.999, 3)
        validator.setNotation(QDoubleValidator().StandardNotation)
        self.dlg_create_point.dist_x.setValidator(validator)
        validator = QDoubleValidator(-99999.99, 99999.999, 3)
        validator.setNotation(QDoubleValidator().StandardNotation)
        self.dlg_create_point.dist_y.setValidator(validator)
        self.dlg_create_point.btn_accept.pressed.connect(self.get_values)
        self.dlg_create_point.btn_cancel.pressed.connect(self.cancel)
        self.dlg_create_point.dist_x.setFocus()

        self.active_layer = self.iface.mapCanvas().currentLayer()
        self.virtual_layer_point = self.controller.get_layer_by_layername(
            virtual_layer_name, True)

        # Open dialog
        self.open_dialog(self.dlg_create_point, maximize_button=False)
示例#24
0
 def check_slice_duration(self, newtxt):
     """If the acquisition duration is changed, make sure the slices can't
     use times beyond this."""
     self.check_settings() # update DAQ acquisition settings first
     for i in range(self.slices.rowCount()):
         for j in [1,2]: # force slice to be within max duration
             validator = QDoubleValidator(0.,float(self.stats['Duration (ms)']),3)
             self.slices.cellWidget(i, j).setValidator(validator)
示例#25
0
 def createBaseControlWidgets(self):
     self.xminLabel = QLabel(self.tr('xmin'))
     self.xminWidget = QLineEdit(self.currLocale.toString(self.axes.get_xlim()[0]))               
     self.xminWidget.setValidator(QDoubleValidator(self))
     self.xmaxLabel = QLabel(self.tr('xmax'))
     self.xmaxWidget = QLineEdit(self.currLocale.toString(self.axes.get_xlim()[1]))
     self.xmaxWidget.setValidator(QDoubleValidator(self))
     self.yminLabel = QLabel(self.tr('ymin'))
     self.yminWidget = QLineEdit(self.currLocale.toString(self.axes.get_ylim()[0])) 
     self.yminWidget.setValidator(QDoubleValidator(self))
     self.ymaxLabel = QLabel(self.tr('ymax'))
     self.ymaxWidget = QLineEdit(self.currLocale.toString(self.axes.get_ylim()[1])) 
     self.ymaxWidget.setValidator(QDoubleValidator(self))
     self.xminWidget.editingFinished.connect(self.onAxesChange)
     self.xmaxWidget.editingFinished.connect(self.onAxesChange)
     self.yminWidget.editingFinished.connect(self.onAxesChange)
     self.ymaxWidget.editingFinished.connect(self.onAxesChange)
示例#26
0
    def widget(self, parent):
        config = createForm("plot_param_dir_fct.ui", parent)
        self._config = config
        config.selectDataFile.clicked.connect(self._selectDataFile)
        config.changeColorMap.clicked.connect(self._changeColorMap)
        config.dataFile.textChanged.connect(self._checkAndLoad)
        config.orthogonal.toggled.connect(self._set_orthogonal)
        config.symetricColoring.toggled[bool].connect(
            self._set_symetric_coloring)
        config.capping.toggled[bool].connect(self._cappingChanged)
        config.minCap.setValidator(QDoubleValidator(config.minCap))
        config.maxCap.setValidator(QDoubleValidator(config.minCap))
        config.minCap.textChanged['QString'].connect(self._minCapStringChanged)
        config.maxCap.textChanged['QString'].connect(self._maxCapStringChanged)
        config.point1.currentIndexChanged['QString'].connect(
            self._changePoint1)
        config.point2.currentIndexChanged['QString'].connect(
            self._changePoint2)
        config.drawLine.toggled.connect(self._set_draw_line)
        config.lineWidth.valueChanged.connect(self._set_line_width)
        config.selectLineColor.clicked.connect(self._changeLineColor)

        config.dataFile.setText(self.data_file)
        value = self.minmax_values
        self.resetMinMax(value)
        config.orthogonal.setChecked(self.orthogonal)
        config.symetricColoring.setChecked(self._symetric_coloring)
        config.drawLine.setChecked(self.draw_line)
        config.lineWidth.setValue(self.line_width)
        setColor(config.lineColor, self.line_color)
        if self._value_capping is not None:
            config.capping.setChecked(True)
            config.minCap.setText(u"{:.5g}".format(self._value_capping[0]))
            config.maxCap.setText(u"{:.5g}".format(self._value_capping[1]))
        if self.data is not None:
            config = self._config
            config.point1.clear()
            config.point2.clear()
            for i in self.points:
                config.point1.addItem(str(i))
                config.point2.addItem(str(i))
            config.point1.setCurrentIndex(0)
            config.point2.setCurrentIndex(1)
        self.addScaleBarWidget(config)
        return self._config
示例#27
0
    def setupUi(self):
        super().setupUi(self)
        # self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowContextHelpButtonHint)

        self.ui_normal_handler.setChecked(True)
        self.ui_composed_handler.setChecked(False)
        self.ui_normal_handler.toggled.connect(self.on_composite_view_changed)
        self.ui_composed_handler.toggled.connect(
            self.on_composite_view_changed)
        self.ui_composite_ranges.hide()

        self.ui_handler_selector.currentIndexChanged.connect(
            self.on_range_handler_changed)
        self.ui_span_mode.stateChanged.connect(self.on_span_mode_changed)

        self.ui_span_mode.setChecked(False)
        self.ui_span_mode.hide()
        self.on_span_mode_changed(0)

        self.ui_view_range_dock.hide()

        self.rangeMode = HandlersEnum.normal
        self.adjustSize()

        self.ui_start_val.setValidator(QDoubleValidator())
        self.ui_stop_val.setValidator(QDoubleValidator())
        self.ui_step_val.setValidator(QDoubleValidator())
        self.ui_center_val.setValidator(QDoubleValidator())
        self.ui_span_val.setValidator(QDoubleValidator())

        self.plot = self.ui_range_plot.addPlot()
        self.range_curve = self.plot.plot(
            pen=pg.mkPen(color="r", width=2),
            symbolPen=pg.mkPen(color="r", width=1),
            symbolBrush="r",
            symbol='o',
            size=0,
            pxMode=True)  #pg.ScatterPlotItem()#size=10, pen=pg.mkPen('r'))
        # self.plot.setLabel("left", "<font size=\"5\">Value</font>")#, units="<font size=\"15\">V^2Hz-1</font>")
        # self.plot.setLabel("bottom", "<font size=\"5\">Index</font>")#, units="Hz")
        self.plot.getAxis("left").setWidth(20)
        self.plot.showAxis("right", show=True)
        self.plot.showAxis("top", show=True)
        self.plot.getAxis("right").setStyle(showValues=False)
        self.plot.getAxis("top").setStyle(showValues=False)
示例#28
0
    def __init__(self, parent=None):
        super(Dialog, self).__init__(parent)
        self._filename = None
        self._page = None
        self._rect = None
        self.imageViewer = widgets.imageviewer.ImageViewer()
        self.dpiLabel = QLabel()
        self.dpiCombo = QComboBox(insertPolicy=QComboBox.NoInsert,
                                  editable=True)
        self.dpiCombo.lineEdit().setCompleter(None)
        self.dpiCombo.setValidator(
            QDoubleValidator(10.0, 1200.0, 4, self.dpiCombo))
        self.dpiCombo.addItems(
            [format(i) for i in (72, 100, 200, 300, 600, 1200)])

        self.colorButton = widgets.colorbutton.ColorButton()
        self.colorButton.setColor(QColor(Qt.white))
        self.crop = QCheckBox()
        self.antialias = QCheckBox(checked=True)
        self.dragfile = QPushButton(icons.get("image-x-generic"), None, None)
        self.fileDragger = FileDragger(self.dragfile)
        self.buttons = QDialogButtonBox(QDialogButtonBox.Close)
        self.copyButton = self.buttons.addButton('',
                                                 QDialogButtonBox.ApplyRole)
        self.copyButton.setIcon(icons.get('edit-copy'))
        self.saveButton = self.buttons.addButton('',
                                                 QDialogButtonBox.ApplyRole)
        self.saveButton.setIcon(icons.get('document-save'))

        layout = QVBoxLayout()
        self.setLayout(layout)

        layout.addWidget(self.imageViewer)

        controls = QHBoxLayout()
        layout.addLayout(controls)
        controls.addWidget(self.dpiLabel)
        controls.addWidget(self.dpiCombo)
        controls.addWidget(self.colorButton)
        controls.addWidget(self.crop)
        controls.addWidget(self.antialias)
        controls.addStretch()
        controls.addWidget(self.dragfile)
        layout.addWidget(widgets.Separator())
        layout.addWidget(self.buttons)

        app.translateUI(self)
        self.readSettings()
        self.finished.connect(self.writeSettings)
        self.dpiCombo.editTextChanged.connect(self.drawImage)
        self.colorButton.colorChanged.connect(self.drawImage)
        self.antialias.toggled.connect(self.drawImage)
        self.crop.toggled.connect(self.cropImage)
        self.buttons.rejected.connect(self.reject)
        self.copyButton.clicked.connect(self.copyToClipboard)
        self.saveButton.clicked.connect(self.saveAs)
        qutil.saveDialogSize(self, "copy_image/dialog/size", QSize(480, 320))
示例#29
0
 def createFloatingPointEditor(self,
                               value=0.0,
                               minValue=float("-inf"),
                               maxValue=float("+inf"),
                               decimals=1000):
     floatingPointEditor = QLineEdit(str(value))
     floatingPointEditor.setValidator(
         QDoubleValidator(minValue, maxValue, decimals))
     return floatingPointEditor
示例#30
0
    def build_gui(self):

        box = oasysgui.widgetBox(self.controlArea, self.name + " Input Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH-5)
        
        idx = -1 
        
        #widget index 0 
        idx += 1 
        box1 = gui.widgetBox(box) 
        oasysgui.lineEdit(box1, self, "TITLE",
                     label=self.unitLabels()[idx], addSpace=False, orientation="horizontal")
        self.show_at(self.unitFlags()[idx], box1) 
        
        #widget index 1 
        idx += 1 
        box1 = gui.widgetBox(box) 
        oasysgui.lineEdit(box1, self, "TEMPERATURE",
                     label=self.unitLabels()[idx], addSpace=False,
                    valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1) 
        
        #widget index 2 
        idx += 1 
        box1 = gui.widgetBox(box) 
        oasysgui.lineEdit(box1, self, "E_MIN",
                     label=self.unitLabels()[idx], addSpace=False,
                    valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1) 
        
        #widget index 3 
        idx += 1 
        box1 = gui.widgetBox(box) 
        oasysgui.lineEdit(box1, self, "E_MAX",
                     label=self.unitLabels()[idx], addSpace=False,
                    valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1) 
        
        #widget index 4 
        idx += 1 
        box1 = gui.widgetBox(box) 
        oasysgui.lineEdit(box1, self, "NPOINTS",
                     label=self.unitLabels()[idx], addSpace=False,
                    valueType=int, validator=QIntValidator(), orientation="horizontal", labelWidth=250)
        self.show_at(self.unitFlags()[idx], box1)