Python PyQt5.QtGui.QDoubleValidator() Examples

The following are code examples for showing how to use PyQt5.QtGui.QDoubleValidator(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: Pythonic   Author: hANSIc99   File: binance_order.py    GNU General Public License v3.0 6 votes vote down vote up
def stopLoss(self):

        logging.debug('BinanceOrder::stopLoss() called')

        self.stop_loss_input = QWidget()
        self.stop_loss_layout = QVBoxLayout(self.stop_loss_input)

        self.stop_loss_price_txt = QLabel()
        self.stop_loss_price_txt.setText(QC.translate('', 'Stop price:'))

        self.stop_loss_price_input = QLineEdit()
        self.stop_loss_price_input.setValidator(QDoubleValidator(999999, -999999, 8))

        self.stop_loss_params = QLabel()
        self.stop_loss_params.setText(
                '{\'stopPrice\' : 12.345, \'quantity\' : 0.005}')


        self.stop_loss_layout.addWidget(self.stop_loss_price_txt)
        self.stop_loss_layout.addWidget(self.stop_loss_price_input)
        self.stop_loss_layout.addWidget(self.stop_loss_params)
        self.stop_loss_layout.addStretch(1)

        self.order_box.addWidget(self.stop_loss_input) 
Example 2
Project: Pythonic   Author: hANSIc99   File: binance_order.py    GNU General Public License v3.0 6 votes vote down vote up
def takeProfit(self):

        logging.debug('BinanceOrder::takeProfit() called')

        self.take_profit_input = QWidget()
        self.take_profit_layout = QVBoxLayout(self.take_profit_input)

        self.take_profit_stop_price = QLabel()
        self.take_profit_stop_price.setText(QC.translate('', 'Stop price:'))

        self.take_profit_stop_price_input = QLineEdit()
        self.take_profit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))

        self.take_profit_params = QLabel()
        self.take_profit_params.setText(
                '{\'stopPrice\': 12.345, \'quantity\' : 0.005}')


        self.take_profit_layout.addWidget(self.take_profit_stop_price)
        self.take_profit_layout.addWidget(self.take_profit_stop_price_input)
        self.take_profit_layout.addWidget(self.take_profit_params)
        self.take_profit_layout.addStretch(1)

        self.order_box.addWidget(self.take_profit_input) 
Example 3
Project: pywerami   Author: ondrolexa   File: mainapp.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(OptionsForm, self).__init__(parent)
        settings = QtCore.QSettings("LX", "pywerami")
        layout = QtWidgets.QVBoxLayout(self)
        form = QtWidgets.QWidget()
        formlayout = QtWidgets.QFormLayout(form)

        ## scale
        #self.scale = QLineEdit(repr(settings.value("scale", 1, type=float)), self)
        #self.scale.setValidator(QDoubleValidator(self.scale))
        #formlayout.addRow('Scale', self.scale)

        # not-a-number
        self.nan = QtWidgets.QLineEdit(settings.value("nan", "NaN", type=str), self)
        formlayout.addRow('Not a number', self.nan)

        form.setLayout(formlayout)
        buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout.addWidget(form)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.check)
        buttonBox.rejected.connect(self.reject)

        self.setWindowTitle("PyWerami options") 
Example 4
Project: eddy   Author: obdasystems   File: fields.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        """
        Initialize the float input field.
        """
        super().__init__(*args, **kwargs)
        self.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0)
        self.setValidator(QtGui.QDoubleValidator(self)) 
Example 5
Project: openspectra   Author: openspectra   File: plotdisplay.py    Apache License 2.0 5 votes vote down vote up
def set_validator(self, lower_limit:Union[int, float], upper_limit:Union[int, float], precision:int):
        super().setValidator(QDoubleValidator(lower_limit, upper_limit, precision))
        self.__set_precision(precision) 
Example 6
Project: qExchanger   Author: Qiceto   File: zdr.py    GNU General Public License v3.0 5 votes vote down vote up
def sepdot(self):
        zdr = QtGui.QDoubleValidator(QtCore.QLocale.setDefault(QtCore.QLocale(1)))
        self.firstCINP.setValidator(zdr)
        self.firstCINP.clear()
        self.secondCOUT.clear()
        self.firstCINP_2.setValidator(zdr)
        self.firstCINP_2.clear()
        self.secondCOUT_2.clear() 
Example 7
Project: qExchanger   Author: Qiceto   File: zdr.py    GNU General Public License v3.0 5 votes vote down vote up
def sepcomma(self):
        zdr = QtGui.QDoubleValidator(QtCore.QLocale.setDefault(QtCore.QLocale(22)))
        self.firstCINP.setValidator(zdr)
        self.firstCINP.clear()
        self.secondCOUT.clear()
        self.firstCINP_2.setValidator(zdr)
        self.firstCINP_2.clear()
        self.secondCOUT_2.clear() 
Example 8
Project: GeoMop   Author: GeoMop   File: set_property.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, interface,  parent=None, min=None, max=None):
        super(SetSurfaceDlg, self).__init__(parent)
        self.setWindowTitle("Set Surface")

        grid = QtWidgets.QGridLayout(self)
        
        d_surface = QtWidgets.QLabel("Set Interface Surface:", self)
        grid.addWidget(d_surface, 0, 0)
        i = LayersHelpers.add_surface_to_grid(self, grid, 1, interface)
        
        self.validator = QtGui.QDoubleValidator()
        
        if min is not None:
            self.validator.setBottom( min)
        if max is not None:
            self.validator.setTop( max)
        self.validator.setNotation(QtGui.QDoubleValidator.StandardNotation)
        
        self.elevation.setValidator(self.validator)
        
        self._tranform_button = QtWidgets.QPushButton("Set Surface", self)
        self._tranform_button.clicked.connect(self.accept)
        self._cancel_button = QtWidgets.QPushButton("Cancel", self)
        self._cancel_button.clicked.connect(self.reject)

        button_box = QtWidgets.QDialogButtonBox()
        button_box.addButton(self._tranform_button, QtWidgets.QDialogButtonBox.AcceptRole)
        button_box.addButton(self._cancel_button, QtWidgets.QDialogButtonBox.RejectRole)

        grid.addWidget(button_box, i, 1, 1, 2)
        self.setLayout(grid) 
Example 9
Project: civilTools   Author: ebrahimraeyat   File: data_table.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent = None):
        QtCore.QObject.__init__(self)

        self.dbl_validator = QtGui.QDoubleValidator(parent)
        self.dbl_validator.setNotation(QtGui.QDoubleValidator.StandardNotation)

        self.signalMapper = QtCore.QSignalMapper()
        self.signalMapper.mapped[QtGui.QWidget].connect(self.on_signalMapper_mapped) 
Example 10
Project: radie   Author: dvincentwest   File: classes.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(LineEditNumeric, self).__init__(widthx=0.5, parent=parent)
        self.setValidator(QtGui.QDoubleValidator()) 
Example 11
Project: AutoSplit64   Author: Kainev   File: settings_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(title="Thresholds", parent=parent)

        # Layouts
        self.menu_layout = QtWidgets.QGridLayout()

        # Widgets
        self.prob_lb = QtWidgets.QLabel("Probability Threshold:")
        self.prob_le = QtWidgets.QLineEdit("")
        self.reset_lb = QtWidgets.QLabel("Reset Threshold:")
        self.reset_le = QtWidgets.QLineEdit("")
        self.confirmation_lb = QtWidgets.QLabel("Confirmation Threshold:")
        self.confirmation_le = QtWidgets.QLineEdit("")

        self.black_lb = QtWidgets.QLabel("Black Threshold:")
        self.black_le = QtWidgets.QLineEdit("")
        self.white_lb = QtWidgets.QLabel("White Threshold:")
        self.white_le = QtWidgets.QLineEdit("")

        self.xcam_bg_lb = QtWidgets.QLabel("X-Cam B-G Threshold:")
        self.xcam_bg_le = QtWidgets.QLineEdit("")
        self.xcam_bg_activation_lb = QtWidgets.QLabel("X-Cam B-G Activation:")
        self.xcam_bg_activation_le = QtWidgets.QLineEdit("")
        self.xcam_rg_lb = QtWidgets.QLabel("X-Cam R-G Threshold:")
        self.xcam_rg_le = QtWidgets.QLineEdit("")
        self.xcam_rg_activation_lb = QtWidgets.QLabel("X-Cam R-G Activation:")
        self.xcam_rg_activation_le = QtWidgets.QLineEdit("")
        self.xcam_pixel_lb = QtWidgets.QLabel("X-Cam Pixel Threshold:")
        self.xcam_pixel_le = QtWidgets.QLineEdit("")

        self.undo_lb = QtWidgets.QLabel("Undo Threshold:")
        self.undo_le = QtWidgets.QLineEdit()

        self.double_validator = QtGui.QDoubleValidator(0, 1, 3)
        self.double_validator.setRange(0, 1, 3)
        self.int_validator = QtGui.QIntValidator()

        self.init() 
Example 12
Project: AutoSplit64   Author: Kainev   File: settings_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(title="Error Correction", parent=parent)

        # Layouts
        self.menu_layout = QtWidgets.QGridLayout()

        # Widgets
        self.processing_lb = QtWidgets.QLabel("Processing Length:")
        self.processing_le = QtWidgets.QLineEdit("")
        self.undo_count_lb = QtWidgets.QLabel("Undo Minimum Length:")
        self.undo_count_le = QtWidgets.QLineEdit("")

        self.undo_threshold_lb = QtWidgets.QLabel("Undo Average Threshold:")
        self.undo_threshold_le = QtWidgets.QLineEdit("")

        self.star_skip_lb = QtWidgets.QLabel("Star Skip Enabled:")
        self.star_skip_cb = QtWidgets.QCheckBox()
        self.max_skip_lb = QtWidgets.QLabel("Max Star Skip:")
        self.max_skip_le = QtWidgets.QLineEdit("")
        self.skip_count_lb = QtWidgets.QLabel("Consecutive Predictions:")
        self.skip_count_le = QtWidgets.QLineEdit("")

        self.double_validator = QtGui.QDoubleValidator(0, 1, 3)
        self.double_validator.setRange(0, 1, 3)
        self.int_validator = QtGui.QIntValidator()

        self.init() 
Example 13
Project: eddy   Author: danielepantaleone   File: fields.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        """
        Initialize the float input field.
        """
        super().__init__(*args, **kwargs)
        self.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0)
        self.setValidator(QtGui.QDoubleValidator(self)) 
Example 14
Project: Pythonic   Author: hANSIc99   File: binance_order.py    GNU General Public License v3.0 5 votes vote down vote up
def limitOrder(self):

        logging.debug('BinanceOrder::limitOrder() called')

        self.limit_input = QWidget()
        self.limit_layout = QVBoxLayout(self.limit_input)

        self.limit_time_in_force_txt = QLabel()
        self.limit_time_in_force_txt.setText(QC.translate('', 'Time in force:'))

        self.limit_time_in_force_input = QComboBox()
        self.limit_time_in_force_input.addItem(QC.translate('',
            'Good til canceled'), QVariant('GTC'))
        self.limit_time_in_force_input.addItem(QC.translate('',
            'Immediate or Cancel'), QVariant('IOC'))
        self.limit_time_in_force_input.addItem(QC.translate('', 'Fill or Kill'), QVariant('FOK'))

        self.limit_price_txt = QLabel()
        self.limit_price_txt.setText(QC.translate('', 'Limit price:'))

        self.limit_price_input = QLineEdit()
        self.limit_price_input.setValidator(QDoubleValidator(999999, -999999, 8))

        self.limit_input_params = QLabel()
        self.limit_input_params.setText(
                '{\'price\' : 12.345, \'quantity\' : 0.005, \'type\' : \'GTC\'/\'IOC\'/\'FOK\'}')

        self.limit_layout.addWidget(self.limit_time_in_force_txt)
        self.limit_layout.addWidget(self.limit_time_in_force_input)
        self.limit_layout.addWidget(self.limit_price_txt)
        self.limit_layout.addWidget(self.limit_price_input)
        self.limit_layout.addWidget(self.limit_input_params)


        self.order_box.addWidget(self.limit_input) 
Example 15
Project: quick   Author: szsdk   File: quick.py    GNU General Public License v3.0 5 votes vote down vote up
def to_widget(self, opt):
        return GStringLineEditor.to_widget(self, opt,
                validator=QtGui.QDoubleValidator()) 
Example 16
Project: quick   Author: szsdk   File: quick.py    GNU General Public License v3.0 5 votes vote down vote up
def select_type_validator(tp: click.types.ParamType)-> QtGui.QValidator:
    """ select the right validator for `tp`"""
    if isinstance(tp, click.types.IntParamType):
        return QtGui.QIntValidator()
    elif isinstance(tp, click.types.FloatParamType):
        return QtGui.QDoubleValidator()
    return None 
Example 17
Project: USBIPManager   Author: lompal   File: ModalSoftwareSettings.py    MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        # noinspection PyArgumentList
        super(SoftwareSettingUI, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        uic.loadUi("ui/ModalSoftwareSettings.ui", self)

        # Getting the configuration from config.ini file
        self.config = config.get_config()
        # Interface
        self.language_index = int(self.config["SETTINGS"]["software_language"])
        self.language.setCurrentIndex(self.language_index)
        self.language.currentIndexChanged.connect(self.language_alert)
        #
        self.default_port.setText(self.config["SETTINGS"]["server_default_port"])
        self.socket_timeout.setText(self.config["SETTINGS"]["server_socket_timeout"].replace(".", ","))
        self.polling_time.setText(self.config["SETTINGS"]["server_polling_time"].replace(".", ","))
        self.connecting_timeout.setText(self.config["SETTINGS"]["connecting_timeout"].replace(".", ","))
        self.updating_time.setText(self.config["SETTINGS"]["device_updating_time"].replace(".", ","))

        # Obligatory line edit list
        self.linedit_list = [self.default_port, self.socket_timeout, self.polling_time, self.updating_time]
        #
        for linedit in self.linedit_list:
            linedit.textChanged.connect(partial(text_changed, linedit))

        # Setting input validation for line edits
        self.default_port.setValidator(QIntValidator())
        self.socket_timeout.setValidator(QDoubleValidator())
        self.polling_time.setValidator(QDoubleValidator())
        self.connecting_timeout.setValidator(QDoubleValidator())
        self.updating_time.setValidator(QDoubleValidator())

        #
        self.apply_button.clicked.connect(self.apply_action)
        self.cancel_button.clicked.connect(self.close)

    # 
Example 18
Project: MESmerize   Author: kushalkolar   File: row.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, pd_series=None, label=None):
        """
        :type pd_series: pd.Series
        :type label: str
        """
        QtWidgets.QWidget.__init__(self)

        self.hlayout = QtWidgets.QHBoxLayout()

        if label is not None:
            self.qlabel = QtWidgets.QLabel(self)
            self.qlabel.setText(label)
            self.hlayout.addWidget(self.qlabel)
        else:
            self.qlabel = QtWidgets.QLabel(self)

        self.name = QtWidgets.QLineEdit(self)
        self.name.setPlaceholderText('Stimulus Name')
        self.hlayout.addWidget(self.name)

        self.start = QtWidgets.QLineEdit(self)
        self.start.setValidator(QtGui.QDoubleValidator())
        self.start.setPlaceholderText('Start time')
        self.hlayout.addWidget(self.start)

        self.end = QtWidgets.QLineEdit(self)
        self.end.setPlaceholderText('End time')
        self.end.setValidator(QtGui.QDoubleValidator())
        self.hlayout.addWidget(self.end)

        self.color_btn = ColorButton(self)
        self.hlayout.addWidget(self.color_btn)

        self.btn_remove = QtWidgets.QPushButton(self)
        self.btn_remove.setText('Remove stim')
        self.hlayout.addWidget(self.btn_remove)

        if pd_series is not None:
            self.set_series(pd_series) 
Example 19
Project: geoscience   Author: rolandhill   File: sectionorthogonal_dialog.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, manager, dirWestEast=True, parent=None):
        """Constructor."""
        super(SectionOrthogonalDialog, self).__init__(parent)
        
        # Keep a reference to the DrillManager
        self.drillManager = manager
        self.dirWestEast = dirWestEast
        
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
        self.setupUi(self)

#        self.leSectionWidth.setText(str(self.drillManager.sectionWidth))
        
        if dirWestEast == True:
            self.leCenter.setText(str(self.drillManager.sectionNorth))
            self.leLimitMin.setText(str(self.drillManager.sectionLimitWest))
            self.leLimitMax.setText(str(self.drillManager.sectionLimitEast))
            self.leName.setText(self.drillManager.sectionWEName)
        else:
            self.setWindowTitle("Create South-North section")
            self.lCenter.setText("East")
            self.lLimitMin.setText("South Limit")
            self.lLimitMax.setText("North Limit")
            
            self.leCenter.setText(str(self.drillManager.sectionEast))
            self.leLimitMin.setText(str(self.drillManager.sectionLimitSouth))
            self.leLimitMax.setText(str(self.drillManager.sectionLimitNorth))
            self.leName.setText(self.drillManager.sectionSNName)
    
        self.leCenter.setValidator(QDoubleValidator())
        self.leLimitMin.setValidator(QDoubleValidator())
        self.leLimitMax.setValidator(QDoubleValidator())
#        self.leSectionWidth.setValidator(QDoubleValidator())
        self.checkSelectAllLayers.setChecked(True)
        self.checkSelectAllElevation.setChecked(True)

        fillVectorLayersForSection(self.listLayers)
        fillRasterLayersForSection(self.listElevation)
        
        self.checkSelectAllLayers.toggled.connect(self.onSelectAllCheckedLayers)
        self.checkSelectAllElevation.toggled.connect(self.onSelectAllCheckedElevation)
        self.leCenter.textChanged.connect(self.onCenterTextChanged)
        
        self.nameManual = False 
Example 20
Project: Simple-Temperature-Control-Project   Author: ditanh97   File: miscgraphic.py    MIT License 4 votes vote down vote up
def __init__(self, label: str, unit: str, float_fmt: str='{:.1f}', worker: worker.MainWorker=None, parent=None):
        """
        ValueGroupBox constructor

        :param label: name of the GroupBox
        :param unit: unit of the respective label
        :param worker: processsrc.MainWorker instance to connect to
        :param parent: [optional] parent class
        """

        super(ValueGroupBox, self).__init__(parent)


        self.setTitle(f"Parameter {label.capitalize()}")

        self.label = label

        self.worker = worker

        # prepare a template string using another template string :)
        self.valLabelTemplate = string.Template(f"Current $label: <b>{float_fmt}</b>").safe_substitute(label=label)
        self.valLabel = QLabel()



        self.unitLabel = QLabel(unit)

        self.writeLine = QLineEdit()
        self.writeLine.setPlaceholderText(f"Masukkan nilai '{label}'")
        self.writeLine.setValidator(QDoubleValidator())  # we can set a Locale() to correctly process floats
        self.writeLine.setToolTip("Float value")
        self.writeLine.setEnabled(True)


        hBox1 = QHBoxLayout()
        hBox1.addWidget(self.valLabel)
        hBox1.addStretch()  # need to not distort the button when resizing
        hBox1.addSpacing(25)
        hBox1.addWidget(self.unitLabel)

        vBox1 = QVBoxLayout()
        vBox1.addWidget(self.writeLine)
        vBox1.addLayout(hBox1)

        self.setLayout(vBox1)
        self.enable_pid(False) 
Example 21
Project: GeoMop   Author: GeoMop   File: split_layer.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, min, max, copy_block, parent=None):
        super(SplitLayerDlg, self).__init__(parent)
        self.setWindowTitle("Split Layer")

        grid = QtWidgets.QGridLayout(self)

        d_layer_name = QtWidgets.QLabel("Layer Name:", self)
        self.layer_name = QtWidgets.QLineEdit()
        self.layer_name.setToolTip("New Layer name (New layer is in the bottom)")
        self.have_default_name = True
        self.set_default_name()
        self.layer_name.textChanged.connect(self.lay_name_changed)

        self.image = QtWidgets.QLabel(self)
        self.image.setMinimumWidth(self.layer_name.sizeHint().height())
        self.image.setPixmap(icon.get_app_icon("sign-check").pixmap(self.layer_name.sizeHint().height()))
        self.image.setToolTip('Layer name is unique, everything is fine.')

        grid.addWidget(d_layer_name, 0, 0)
        grid.addWidget(self.layer_name, 0, 1)
        grid.addWidget(self.image, 0, 2)
        
        d_split_type = QtWidgets.QLabel("Split Interface Type:", self)
        self.split_type = LayersHelpers.split_type_combo(copy_block)
        
        grid.addWidget(d_split_type, 1, 0)
        grid.addWidget(self.split_type, 1, 1)
        
        d_surface = QtWidgets.QLabel("Split in Surface:", self)
        grid.addWidget(d_surface, 2, 0)
        i = LayersHelpers.add_surface_to_grid(self, grid, 3)
        
        self.validator = QtGui.QDoubleValidator()
        self.validator.setBottom(min)
        self.validator.setTop(max)
        self.elevation.setValidator(self.validator)
        self.elevation.setText(str((min+max)/2))
        
        self._tranform_button = QtWidgets.QPushButton("Split", self)
        self._tranform_button.clicked.connect(self.accept)
        self._cancel_button = QtWidgets.QPushButton("Cancel", self)
        self._cancel_button.clicked.connect(self.reject)

        button_box = QtWidgets.QDialogButtonBox()
        button_box.addButton(self._tranform_button, QtWidgets.QDialogButtonBox.AcceptRole)
        button_box.addButton(self._cancel_button, QtWidgets.QDialogButtonBox.RejectRole)

        grid.addWidget(button_box, i, 1, 1, 2)
        self.setLayout(grid) 
Example 22
Project: GeoMop   Author: GeoMop   File: append_layer.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, min_elevation=None, max_elevation=None, prepend=False, add=False):
        super(AppendLayerDlg, self).__init__(parent)
        if add:
            self.setWindowTitle("Add Layer to Shadow Block")
        elif prepend:
            self.setWindowTitle("Prepend Layer")
        else:
            self.setWindowTitle("Append Layer")
        grid = QtWidgets.QGridLayout(self)

        d_layer_name = QtWidgets.QLabel("Layer Name:", self)
        self.layer_name = QtWidgets.QLineEdit()
        self.have_default_name = True
        self.set_default_name()
        self.layer_name.textChanged.connect(self.lay_name_changed)

        self.image = QtWidgets.QLabel(self)
        self.image.setMinimumWidth(self.layer_name.sizeHint().height())
        self.image.setPixmap(icon.get_app_icon("sign-check").pixmap(self.layer_name.sizeHint().height()))
        self.image.setToolTip('Layer name is unique, everything is fine.')

        grid.addWidget(d_layer_name, 0, 0)
        grid.addWidget(self.layer_name, 0, 1)
        grid.addWidget(self.image, 0, 2)
        
        d_surface = QtWidgets.QLabel("Bottom Interface Surface:", self)
        grid.addWidget(d_surface, 1, 0)
        i = LayersHelpers.add_surface_to_grid(self, grid, 2)
        
        self.validator = QtGui.QDoubleValidator()
        if add:
            self.validator.setBottom(min_elevation)
            self.validator.setTop(max_elevation)
            self.elevation.setText(str((min_elevation + max_elevation) / 2))
        elif prepend:
            self.validator.setBottom(min_elevation)
            self.elevation.setText(str(min_elevation + 100))
        else:
            self.validator.setTop(max_elevation)
            self.elevation.setText(str(max_elevation - 100))
        self.elevation.setValidator(self.validator)
        
        if add:
            self._tranform_button = QtWidgets.QPushButton("Add", self)
        elif prepend:
            self._tranform_button = QtWidgets.QPushButton("Prepend", self)
        else:
            self._tranform_button = QtWidgets.QPushButton("Append", self)
        self._tranform_button.clicked.connect(self.accept)
        self._cancel_button = QtWidgets.QPushButton("Cancel", self)
        self._cancel_button.clicked.connect(self.reject)

        button_box = QtWidgets.QDialogButtonBox()
        button_box.addButton(self._tranform_button, QtWidgets.QDialogButtonBox.AcceptRole)
        button_box.addButton(self._cancel_button, QtWidgets.QDialogButtonBox.RejectRole)

        grid.addWidget(button_box, i, 3, 1, 3)
        self.setLayout(grid) 
Example 23
Project: GeoMop   Author: GeoMop   File: make_mesh.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle("Make mesh")

        grid = QtWidgets.QGridLayout(self)

        # edit for process output
        self._output_edit = QtWidgets.QTextEdit()
        self._output_edit.setReadOnly(True)
        self._output_edit.setFont(QtGui.QFont("monospace"))
        grid.addWidget(self._output_edit, 0, 0, 4, 6)

        # label for showing status
        self._status_label = QtWidgets.QLabel()
        self._set_status("Ready")
        self._status_label.setMaximumHeight(40)
        grid.addWidget(self._status_label, 4, 0, 1, 1)

        # checkbox for apply step size
        self._step_checkbox = QtWidgets.QCheckBox("Mesh step:")
        self._step_checkbox.setMaximumWidth(110)
        self._step_checkbox.stateChanged.connect(self._step_checkbox_changed)
        grid.addWidget(self._step_checkbox, 5, 0)

        # edit for setting step size
        self._step_edit = QtWidgets.QLineEdit()
        self._step_edit.setText("1.0")
        self._step_edit.setValidator(QtGui.QDoubleValidator())
        self._step_edit.setMinimumWidth(100)
        self._step_edit.setMaximumWidth(200)
        self._step_edit.setEnabled(False)
        grid.addWidget(self._step_edit, 5, 1)

        # process
        self._proc = QtCore.QProcess(self)
        self._proc.setProcessChannelMode(QtCore.QProcess.MergedChannels)
        self._proc.readyReadStandardOutput.connect(self._read_proc_output)
        self._proc.started.connect(self._proc_started)
        self._proc.finished.connect(self._proc_finished)
        self._proc.error.connect(self._proc_error)

        # buttons
        self._start_button = QtWidgets.QPushButton("Start", self)
        self._start_button.clicked.connect(self._start)
        grid.addWidget(self._start_button, 5, 3)
        self._kill_button = QtWidgets.QPushButton("Kill", self)
        self._kill_button.clicked.connect(self._proc.kill)
        self._kill_button.setEnabled(False)
        grid.addWidget(self._kill_button, 5, 4)
        self._close_button = QtWidgets.QPushButton("Close", self)
        self._close_button.clicked.connect(self.reject)
        grid.addWidget(self._close_button, 5, 5)

        self.setLayout(grid)

        self.setMinimumSize(500, 300)
        self.resize(700, 500) 
Example 24
Project: GeoMop   Author: GeoMop   File: display_size.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self,  rect, parent=None):
        super(DisplaySizeDlg, self).__init__(parent)
        self.setWindowTitle("Display Size Settings")

        grid = QtWidgets.QGridLayout(self)
        
        d_x = QtWidgets.QLabel("Origin X:", self)
        d_y = QtWidgets.QLabel("Origin Y:", self)
        d_dx = QtWidgets.QLabel("Size X:", self)
        d_dy = QtWidgets.QLabel("Size Y:", self)
        self.x = QtWidgets.QLineEdit()
        self.x.setValidator(QtGui.QDoubleValidator())
        self.x.setText(str(rect.left()))
        self.y = QtWidgets.QLineEdit()
        self.y.setValidator(QtGui.QDoubleValidator())
        self.y.setText(str(-rect.bottom()))
        self.dx = QtWidgets.QLineEdit()
        self.dx.setValidator(QtGui.QDoubleValidator())
        self.dx.setText(str(rect.width()))
        self.dy = QtWidgets.QLineEdit()
        self.dy.setValidator(QtGui.QDoubleValidator())
        self.dy.setText(str(rect.height()))
        
        grid.addWidget(d_x, 0, 0)
        grid.addWidget(self.x, 0, 1)
        grid.addWidget(d_y, 1, 0)
        grid.addWidget(self.y, 1, 1)
        grid.addWidget(d_dx, 2, 0)
        grid.addWidget(self.dx, 2, 1)
        grid.addWidget(d_dy, 3, 0)
        grid.addWidget(self.dy, 3, 1)

        self._set_button = QtWidgets.QPushButton("Set Display", self)
        self._set_button.clicked.connect(self.accept)
        self._cancel_button = QtWidgets.QPushButton("Cancel", self)
        self._cancel_button.clicked.connect(self.reject)

        button_box = QtWidgets.QDialogButtonBox()
        button_box.addButton(self._set_button, QtWidgets.QDialogButtonBox.AcceptRole)
        button_box.addButton(self._cancel_button, QtWidgets.QDialogButtonBox.RejectRole)

        grid.addWidget(button_box, 4, 1)
        self.setLayout(grid) 
Example 25
Project: AutoSplit64   Author: Kainev   File: settings_dialog.py    GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(title="Advanced", parent=parent)

        # Layouts
        self.menu_layout = QtWidgets.QGridLayout()

        # Widgets
        self.reset_one_lb = QtWidgets.QLabel("Reset Frame One:")
        self.reset_one_le = QtWidgets.QLineEdit("")
        self.reset_one_btn = QtWidgets.QPushButton("Browse")

        self.reset_two_lb = QtWidgets.QLabel("Reset Frame Two:")
        self.reset_two_le = QtWidgets.QLineEdit("")
        self.reset_two_btn = QtWidgets.QPushButton("Browse")

        self.restart_delay_lb = QtWidgets.QLabel("Restart Split Offset:")
        self.restart_delay_sb = QtWidgets.QSpinBox()

        self.file_select_offset_lb = QtWidgets.QLabel("File Select Offset:")
        self.file_select_offset_sb = QtWidgets.QSpinBox()

        self.star_delay_lb = QtWidgets.QLabel("Star Frame Rate:")
        self.star_delay_le = QtWidgets.QLineEdit("")

        self.fadeout_delay_lb = QtWidgets.QLabel("Fadeout Frame Rate:")
        self.fadeout_delay_le = QtWidgets.QLineEdit("")

        self.model_lb = QtWidgets.QLabel("Detection Model:")
        self.model_le = QtWidgets.QLineEdit("")
        self.model_btn = QtWidgets.QPushButton("Browse")

        self.model_width_lb = QtWidgets.QLabel("Model Width:")
        self.model_width_le = QtWidgets.QLineEdit()
        self.model_height_lb = QtWidgets.QLabel("Model Height:")
        self.model_height_le = QtWidgets.QLineEdit()

        self.int_validator = QtGui.QIntValidator()

        self.int_validator = QtGui.QIntValidator()
        self.double_validator = QtGui.QDoubleValidator()

        self.init() 
Example 26
Project: Pythonic   Author: hANSIc99   File: binance_order.py    GNU General Public License v3.0 4 votes vote down vote up
def stopLossLimit(self):

        logging.debug('BinanceOrder::stopLossLimit() called')

        self.stop_loss_limit_input = QWidget()
        self.stop_loss_limit_layout = QVBoxLayout(self.stop_loss_limit_input)

        self.stop_loss_limit_time_in_force_txt = QLabel()
        self.stop_loss_limit_time_in_force_txt.setText(QC.translate('', 'Time in force:'))

        self.stop_loss_limit_time_in_force_input = QComboBox()
        self.stop_loss_limit_time_in_force_input.addItem(QC.translate('',
            'Good til canceled'), QVariant('GTC'))
        self.stop_loss_limit_time_in_force_input.addItem(QC.translate('',
            'Immediate or Cancel'), QVariant('IOC'))
        self.stop_loss_limit_time_in_force_input.addItem(QC.translate('',
            'Fill or Kill'), QVariant('FOK'))


        self.stop_loss_limit_price_txt = QLabel()
        self.stop_loss_limit_price_txt.setText(QC.translate('', 'Price:'))

        self.stop_loss_limit_price_input = QLineEdit()
        self.stop_loss_limit_price_input.setValidator(QDoubleValidator(999999, -999999, 8))


        self.stop_loss_limit_stop_price_txt = QLabel()
        self.stop_loss_limit_stop_price_txt.setText(QC.translate('', 'Stop price:'))

        self.stop_loss_limit_stop_price_input = QLineEdit()
        self.stop_loss_limit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))

        self.stop_loss_limit_params = QLabel()
        self.stop_loss_limit_params.setText(
                '{\'price\' : 12.345, \'stopPrice\': 12.345, \'quantity\' : 0.005, \'type\' : \'GTC\'/\'IOC\'/\'FOK\'}')

        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_time_in_force_txt)
        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_time_in_force_input)
        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_price_txt)
        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_price_input)
        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_stop_price_txt)
        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_stop_price_input)
        self.stop_loss_limit_layout.addWidget(self.stop_loss_limit_params)

        self.order_box.addWidget(self.stop_loss_limit_input) 
Example 27
Project: Pythonic   Author: hANSIc99   File: binance_order.py    GNU General Public License v3.0 4 votes vote down vote up
def takeProfitLimit(self):

        logging.debug('BinanceOrder::takeProfitLimit() called')

        self.take_profit_limit_input = QWidget()
        self.take_profit_limit_layout = QVBoxLayout(self.take_profit_limit_input)

        self.take_profit_limit_time_in_force_txt = QLabel()
        self.take_profit_limit_time_in_force_txt.setText(QC.translate('', 'Time in force:'))

        self.take_profit_limit_time_in_force_input = QComboBox()
        self.take_profit_limit_time_in_force_input.addItem(QC.translate('',
            'Good til canceled'), QVariant('GTC'))
        self.take_profit_limit_time_in_force_input.addItem(QC.translate('',
            'Immediate or Cancel'), QVariant('IOC'))
        self.take_profit_limit_time_in_force_input.addItem(QC.translate('',
            'Fill or Kill'), QVariant('FOK'))

        self.take_profit_limit_price = QLabel()
        self.take_profit_limit_price.setText(QC.translate('', 'Price:'))

        self.take_profit_limit_price_input = QLineEdit()
        self.take_profit_limit_price_input.setValidator(QDoubleValidator(999999, -999999, 8))


        self.take_profit_limit_stop_price = QLabel()
        self.take_profit_limit_stop_price.setText(QC.translate('', 'Stop price:'))

        self.take_profit_limit_stop_price_input = QLineEdit()
        self.take_profit_limit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))

        self.take_profit_limit_params = QLabel()
        self.take_profit_limit_params.setText(
                '{\'price\' : 12.345, \'stopPrice\': 12.345, \'quantity\' : 0.005, \'type\' : \'GTC\'/\'IOC\'/\'FOK\'}')

        self.take_profit_limit_layout.addWidget(self.take_profit_limit_time_in_force_txt)
        self.take_profit_limit_layout.addWidget(self.take_profit_limit_time_in_force_input)
        self.take_profit_limit_layout.addWidget(self.take_profit_limit_price)
        self.take_profit_limit_layout.addWidget(self.take_profit_limit_price_input)
        self.take_profit_limit_layout.addWidget(self.take_profit_limit_stop_price)
        self.take_profit_limit_layout.addWidget(self.take_profit_limit_stop_price_input)
        self.take_profit_limit_layout.addWidget(self.take_profit_limit_params)

        self.order_box.addWidget(self.take_profit_limit_input) 
Example 28
Project: pid-controller-gui   Author: ussserrr   File: miscgraphics.py    MIT License 4 votes vote down vote up
def __init__(self, label: str, float_fmt: str='{:.3f}', conn: remotecontroller.RemoteController=None, parent=None):
        """
        ValueGroupBox constructor

        :param label: name of the GroupBox
        :param conn: RemoteController instance to connect to
        :param parent: [optional] parent class
        """

        super(ValueGroupBox, self).__init__(parent)

        self.setTitle(f"{label.capitalize()} control")

        self.label = label
        self.conn = conn

        # prepare a template string using another template string :)
        self.valLabelTemplate = string.Template(f"Current $label: <b>{float_fmt}</b>").safe_substitute(label=label)
        self.valLabel = QLabel()
        self.refreshVal()

        refreshButton = PicButton(util.resource_path('../img/refresh.png'),
                                  util.resource_path('../img/refresh_hover.png'),
                                  util.resource_path('../img/refresh_pressed.png'))
        refreshButton.clicked.connect(self.refreshVal)

        self.writeLine = QLineEdit()
        self.writeLine.setPlaceholderText(f"Enter new '{label}'")
        self.writeLine.setValidator(QDoubleValidator())  # we can set a Locale() to correctly process floats
        self.writeLine.setToolTip("Float value")

        writeButton = QPushButton(QIcon(self.style().standardIcon(QStyle.SP_DialogApplyButton)), 'Send')
        writeButton.clicked.connect(self.writeButtonClicked)

        hBox1 = QHBoxLayout()
        hBox1.addWidget(self.valLabel)
        hBox1.addStretch()  # need to not distort the button when resizing
        hBox1.addSpacing(25)
        hBox1.addWidget(refreshButton)

        hBox2 = QHBoxLayout()
        hBox2.addWidget(self.writeLine)
        hBox2.addWidget(writeButton)

        vBox1 = QVBoxLayout()
        vBox1.addLayout(hBox1)
        vBox1.addLayout(hBox2)

        self.setLayout(vBox1)