示例#1
0
 def __init__(self, parent=None, min=0, max=999999):
     super(intLineEdit, self).__init__(parent)
     self.min = min
     self.max = max
     qiv = QIntValidator()
     qiv.setRange(min, max)
     self.setValidator(qiv)
示例#2
0
 def __init__(self, ui_file, devMode, parent=None):
     super(MainWindow, self).__init__()
     self.uiFileName = ui_file  # use this if there are multiple UI files
     if devMode == "development":  # use ui file directly made by QDesigner
         uiFile = QFile(ui_file)
         uiFile.open(QFile.ReadOnly)  # read in UI for the form
         loader = QUiLoader()
         self.window = loader.load(uiFile)
         uiFile.close()
     else:  #deployment - use .py version of ui file, with slightly different setup
         self.ui = Ui_MainWindow()
         self.ui.setupUi(self)
     self.getParts()  # identify form objects
     self.connectParts()  # connect buttons to operations
     self.convs = Converters(
     )  # load converters for main conversion categories
     self.yc = YearConverters(
     )  # load converters for japanese years, zodiac years
     self.mess = Mess()  # instructions and messages in local language
     self.validFloat = QDoubleValidator()
     self.validYear = QIntValidator()
     self.validYear.setRange(1, 9999)  # used for years
     self.btnConvert.hide()
     self.widgetSetup("start")  # initial conditions for form
     if devMode == "development": self.window.show()
     else: self.show()
示例#3
0
    def __init__(self, parent=None):
        QWidget.__init__(self, None)
        self.layout = QGridLayout()

        self.label = QLabel("Files selected:")
        self.layout.addWidget(self.label, 0, 0, 1, 4)

        self.file_list = QListWidget()
        self.select_all = QListWidgetItem("(De)select all")
        self.select_all.setFlags(self.select_all.flags()
                                 | Qt.ItemIsUserCheckable)
        self.select_all.setCheckState(Qt.Unchecked)
        self.file_list.addItem(self.select_all)

        self.layout.addWidget(self.file_list, 1, 0, 1, 4)
        self.layout.addWidget(QLabel("First line:"), 2, 0)
        self.first_line = QLineEdit("", self)
        self.first_line.setValidator(QIntValidator(1, 100000))
        self.layout.addWidget(self.first_line, 2, 1)
        self.layout.addWidget(QLabel("Last line:"), 2, 2)
        self.last_line = QLineEdit("", self)
        self.last_line.setValidator(QIntValidator(1, 100000))
        self.layout.addWidget(self.last_line, 2, 3)
        self.convert_button = QPushButton("EXPORT")
        self.convert_button.clicked.connect(parent.on_convert)
        self.convert_button.setStyleSheet("background-color: green")
        self.layout.addWidget(self.convert_button, 3, 0, 1, 4)
        self.setLayout(self.layout)
        self.list_items = {}

        self.file_list.itemChanged.connect(self.on_item_changed)
示例#4
0
    def __init__(self, parent):
        super().__init__(parent)
        layout = QFormLayout(self)
        self.setWindowTitle("Enter New Record")
        only_int = QIntValidator(self)
        only_int.setTop(999999)
        self._ap_phase_id_entry = QLineEdit(self)
        self._ap_phase_id_entry.setPlaceholderText("e.g. 212421")
        self._ap_phase_id_entry.setValidator(only_int)
        self._address_entry = QLineEdit(self)
        self._address_entry.setPlaceholderText("1234 Sample Ave")
        button_row = QWidget(self)
        button_layout = QHBoxLayout(button_row)
        self._enter_button = QPushButton("Enter")
        self._enter_button.clicked.connect(self.enter)
        self._cancel_button = QPushButton("Cancel")
        self._canceled = True 
        self._cancel_button.clicked.connect(self.close) 

        button_layout.addWidget(self._enter_button)
        button_layout.addWidget(self._cancel_button) 
        layout.addRow(QLabel("Enter the ApPhase ID and Address:\n(the ApPhase ID must 6 numbers, neither field can be blank.)\n", self))
        layout.addRow("ApPhase ID:", self._ap_phase_id_entry)
        layout.addRow("Address:", self._address_entry)
        layout.addRow(button_row)
示例#5
0
 def init_ui(self):
     '''Initializes the UI'''
     self.setWindowTitle(self.title)
     self.model = QFileSystemModel()
     self.model.setRootPath(ROOT_PATH)
     self.tree = QTreeView()
     self.tree.setModel(self.model)
     self.tree.setRootIndex(self.model.index(self.root_path))
     self.start_box = QLineEdit()
     self.stop_box = QLineEdit()
     self.start_box.setValidator(QIntValidator())
     self.stop_box.setValidator(QIntValidator())
     self.make_btn = QPushButton("Create Project Folders")
     self.make_btn.clicked.connect(self.on_btn)
     layout = QVBoxLayout()
     layout.addWidget(self.tree)
     subgrid = QGridLayout()
     subgrid.addWidget(self.start_box, 0, 1)
     subgrid.addWidget(self.stop_box, 1, 1)
     subgrid.addWidget(QLabel('From (inc.): '), 0, 0)
     subgrid.addWidget(QLabel('To (not inc.): '), 1, 0)
     layout.addLayout(subgrid)
     layout.addWidget(self.make_btn)
     self.setLayout(layout)
     self.show()
示例#6
0
    def __init__(self, parent=None) -> None:
        super(AddContractor, self).__init__(parent)
        self.ui = Ui_AddContractor()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Widget)

        self.ui.label_logo.setPixmap(
            QPixmap(ctx.resource("add_contractor.png")))

        self.ui.input_zip_1.setValidator(QIntValidator(0, 99))
        self.ui.input_zip_2.setValidator(QIntValidator(0, 999))
        self.ui.input_zip_1.textEdited.connect(self.skip_zip_1)
        self.ui.input_zip_2.textEdited.connect(self.skip_zip_2)

        self.ui.input_nip.setValidator(QRegExpValidator(QRegExp("[0-9]*")))
        self.ui.input_nip.textEdited.connect(self.validate_nip)

        self.ui.input_regon.setValidator(QRegExpValidator(QRegExp("[0-9]*")))
        self.ui.input_regon.textEdited.connect(self.validate_regon)

        self.valid_pixmap = QPixmap(ctx.resource("valid.png"))
        self.invalid_pixmap = QPixmap(ctx.resource("invalid.png"))

        self.ui.button_add.clicked.connect(self.add_contractor)
        self.ui.button_cancel.clicked.connect(self.ask_close)
    def __init__(self, parent=None):
        QWidget.__init__(self)
        self.ui = Ui_Form()
        self.ui.setupUi(self)

        # Validator (line Edit 의 input 제한, setupUi 로 객체들을 만든다음에 코드로 수정)
        # Qt Designer 에는 수정 기능 없음
        self.ui.lineEdit_int.setValidator(QIntValidator(self))  # 정수
        self.ui.lineEdit_int.setValidator(QIntValidator(
            100, 999, self))  # 100..999사이의 정수

        self.ui.lineEdit_double.setValidator(
            QDoubleValidator(self))  # 실수, 1.2, -1.3, 1E-2 등 가능
        self.ui.lineEdit_double.setValidator(
            QDoubleValidator(-0.1, 100, 2,
                             self))  # -0.1, 100 사이의 실수, 2개의 소수자리수만 허용.

        validator = QDoubleValidator(self)  # 0 이상 실수
        validator.setBottom(0.)
        self.ui.lineEdit_over0.setValidator(validator)

        # 복잡한 패턴 제약
        regExp = QRegExpValidator("[A-Za-z][1-9][0-9]{0,2}")
        # 첫 번째 문자는 대소문자의 알파벳이고, 두 번째는 1-9사이의 숫자가,
        # 이후 0-9사이의 숫자가 0개부터 2개까지 올 수 있도록 lineEdit의 입력을 제한한다는 의미이다.
        self.ui.lineEdit_combo.setValidator(QRegExpValidator(regExp, self))
        """
示例#8
0
    def __init__(self, parent=None, configFile=""):
        '''
        Constructor        
        '''
        super(EcManConfigDialog, self).__init__(parent)
        self.ui = Ui_Dialog()

        self.ui.setupUi(self)
        self.setWindowTitle("ECMan - Konfiguration")
        self.ui.lineEdit_MaxFiles.setValidator(QIntValidator(10, 10000, self))
        self.ui.lineEdit_MaxFileSize.setValidator(QIntValidator(
            10, 1000, self))

        self.ui.comboBox_LbServer.addItem("")
        self.ui.comboBox_LbServer.addItem("//NSSGSC01/LBV")
        self.ui.comboBox_LbServer.addItem("//NSZHSC02/LBV")
        self.ui.comboBox_LbServer.addItem("//NSBESC02/LBV")
        self.config = ConfigParser()
        self.configFile = configFile

        if self.configFile == "":
            self.configFile = Path(str(Path.home()) + "/.ecman.conf")
        else:
            self.configFile = Path(configFile)

        if self.configFile.exists():

            self.config.read_file(open(str(self.configFile)))
            self.ui.comboBox_LbServer.setCurrentText(
                self.config.get("General", "lb_server", fallback=""))
            self.ui.lineEdit_StdLogin.setText(
                self.config.get("Client", "lb_user", fallback="student"))
            self.ui.lineEdit_winRmPort.setText(
                self.config.get("General", "winrm_port", fallback="5986"))
            self.ui.lineEdit_OnlineWiki.setText(
                self.config.get(
                    "General",
                    "wikiurl",
                    fallback="https://github.com/greenorca/ECMan/wiki"))
            self.ui.lineEdit_winRmUser.setText(
                self.config.get("Client", "user", fallback="winrm"))
            self.ui.lineEdit_winRmPwd.setText(
                self.config.get("Client", "pwd", fallback=""))
            self.ui.lineEdit_MaxFiles.setText(
                self.config.get("Client", "max_files", fallback="1000"))
            filesize = self.config.get("Client",
                                       "max_filesize",
                                       fallback="1000")
            try:
                filesize = int(filesize)
            except Exception as ex:
                filesize = 42

            self.ui.lineEdit_MaxFileSize.setText(str(filesize))
            self.ui.checkBox_advancedFeatures.setChecked(
                self.config.get("General", "advanced_ui", fallback="False") ==
                "True")
示例#9
0
 def setEvaluationArea(self):
     form_box = FormGroupBox("Evaluation", self)
     #form_box = FormBox("Evaluation", self)
     only_int = QIntValidator(self)
     only_int.setTop(999999)
     Client.AP_PHASE_ID.value.setValidator(only_int)
     form_box.frame_layout.addRow("ApPhase ID:", Client.AP_PHASE_ID.value)
     form_box.frame_layout.addRow("Date:", Client.DATE.value)
     form_box.frame_layout.addRow("Address:", Client.ADDRESS.value)
     self._scroll_layout.addRow(form_box)
示例#10
0
 def setup_validators(self):
     color_re = QRegExp(r"#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})")
     color_validator = QRegExpValidator(color_re, None)
     self.ui.port_edit.setValidator(QIntValidator(1024, 65535, None))
     # 255 splits seems like a lot
     self.ui.previous_edit.setValidator(QIntValidator(0, 255, None))
     self.ui.advance_edit.setValidator(QIntValidator(0, 255, None))
     # I don't know why you'd set a font size of 10k but sure why not
     self.ui.fontsize_edit.setValidator(QIntValidator(0, 10000, None))
     self.ui.textcolor_edit.setValidator(color_validator)
     self.ui.bgcolor_edit.setValidator(color_validator)
    def _setupGui(self):
        self._ui.screenshotPixelXLineEdit.setValidator(QIntValidator())
        self._ui.screenshotPixelYLineEdit.setValidator(QIntValidator())
        for l in self._landmarkNames:
            self._ui.comboBoxLASIS.addItem(l)
            self._ui.comboBoxRASIS.addItem(l)
            self._ui.comboBoxLPSIS.addItem(l)
            self._ui.comboBoxRPSIS.addItem(l)
            self._ui.comboBoxPS.addItem(l)

        for m in self._predMethods:
            self._ui.comboBoxPredMethod.addItem(m)

        for p in self._popClasses:
            self._ui.comboBoxPopClass.addItem(p)
示例#12
0
    def getData(self, currentAmount):

        amtTitle = QLabel('Total: $')
        amtTitle.setMaximumWidth(120)

        validator = QIntValidator(1, 99999, self)

        amtEdit = QLineEdit()
        amtEdit.setValidator(validator)
        amtEdit.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
        amtEdit.returnPressed.connect(self.okClicked)
        amtEdit.setText(str(currentAmount))
        amtEdit.selectAll()

        okButton = QPushButton('OK')
        okButton.clicked.connect(self.okClicked)

        amtLayout = QHBoxLayout()
        amtLayout.addWidget(amtTitle)
        amtLayout.addWidget(amtEdit)
        amtLayout.addWidget(okButton)

        self.setLayout(amtLayout)
        retValue = self.exec()
        if retValue:
            return amtEdit.text()
        else:
            return 0
示例#13
0
    def __init__(self,
                 title,
                 expected_columns,
                 all_columns=None,
                 parent: typing.Optional[PySide2.QtWidgets.QWidget] = None):
        super().__init__(title, parent)

        self.allcolumns = all_columns if all_columns else expected_columns
        self.columns = expected_columns

        layout = QFormLayout()
        self.coledits = {}
        for col in self.allcolumns:
            e = QLineEdit()
            e.setValidator(QIntValidator(0, 100))
            try:
                n = self.columns.index(col)
                e.setText(str(n))
            except ValueError:
                pass
            handler = partial(self.on_column_change, col=col)
            e.textEdited.connect(handler)
            self.coledits[col] = e
            layout.addRow(col, e)
        self.setLayout(layout)
示例#14
0
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        self.sound = QSoundEffect()
        self.sound.setVolume(0.5)
        self.sound.setLoopCount(1)

        self.reset_timer()

        self.layout = QHBoxLayout()
        self.question = 0
        self.answer = -1

        self.label = QLabel()
        f = QFont("Arial", 120, QFont.Bold)
        self.label.setFont(f)
        self.layout.addWidget(self.label)
        self.edit = QLineEdit()
        self.edit.setMaxLength(3)
        self.edit.setFixedWidth(250)
        self.edit.setFont(f)
        self.edit.setValidator(QIntValidator())
        self.layout.addWidget(self.edit)

        self.setWindowTitle("")
        self.setLayout(self.layout)

        self.next_question()
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle(APP_NAME)
        self.setWindowIcon(QIcon(get_resource_path(os.path.join('resources', 'noun_Plant.ico'))))
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)
        self.ui.lineEdit_invoiceNumber.setValidator(QIntValidator())
        self.ui.progressBar.setMaximum(1)
        self.proc = QProcess()

        self.ui.tableWidget_invoiceContent.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
        self.savePath = create_path_it_not_exist(os.path.join(get_config_path(APP_CONFIG_FOLDER), 'save.json'))
        self.saveData = SaveData(self.savePath)
        self.outputPath = os.path.join(get_exe_path(), create_path_it_not_exist(os.path.join(get_exe_path(), 'output')))
        self.texGenerator = LatexTemplateGenerator(get_resource_path('resources').replace('\\', '/'))

        self.currentGeneralInfo = GeneralInfo()
        self.currentClientInfo = ClientInfo()
        self.currentInvoiceInfo = InvoiceInfo()

        self.ui.pushButton_saveQuickRecallInvoice.clicked.connect(self.save_invoice_info)
        self.ui.pushButton_saveQuickRecallClient.clicked.connect(self.save_client_info)
        self.ui.pushButton_saveQuickRecallGeneral.clicked.connect(self.save_general_info)

        self.ui.comboBox_quickRecallInvoice.activated.connect(self.on_combo_box_invoice_changed)
        self.ui.comboBox_quickRecallClient.activated.connect(self.on_combo_box_client_changed)
        self.ui.comboBox_quickRecallGeneral.activated.connect(self.on_combo_box_general_changed)

        self.ui.pushButton_generateInvoice.clicked.connect(self.generate_invoice)

        self.proc.finished.connect(functools.partial(self._handleProcFinished, self.proc))

        self.ui.toolButton_add.clicked.connect(self.add_row)
        self.ui.toolButton_delete.clicked.connect(self.delete_row)
        self.update_ui()
示例#16
0
 def __init__(self, prompt, headers, n_elements=6):
     super().__init__()
     layout2 = qtw.QVBoxLayout()
     
     grid_wid = qtw.QWidget()
     layout = qtw.QGridLayout()
     layout.addWidget(JustText(headers[0]), 0, 0, Qt.AlignCenter)
     layout.addWidget(JustText(headers[1]), 0, 1, Qt.AlignCenter)
     validator = QIntValidator(1, 1000)
     self.groups = []
     self.nums = []
     for i in range(n_elements):
         group_name = qtw.QLineEdit()
         group_name.setMaximumWidth(200)
         fnt = group_name.font()
         fnt.setPointSize(26)
         group_name.setFont(fnt)
         num_people = qtw.QLineEdit()
         num_people.setMaximumWidth(200)
         num_people.setFont(fnt)
         num_people.setValidator(validator)
         self.groups.append(group_name)
         self.nums.append(num_people)
         layout.addWidget(group_name, i + 1, 0, Qt.AlignCenter)
         layout.addWidget(num_people, i + 1, 1, Qt.AlignCenter)
     
     grid_wid.setLayout(layout)
     layout2.addWidget(JustText(prompt))
     layout2.addWidget(grid_wid)
     self.setLayout(layout2)
示例#17
0
def new_text_input(parent, title_str, hint_str, only_numbers=False):
    """
    creates input with title
    :param parent:
    :param title_str:
    :param hint_str:
    :param only_numbers:
    :return:
    """
    widget = QWidget(parent)
    widget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

    # layout
    layout = QVBoxLayout()
    layout.setMargin(0)
    layout.setSpacing(2)

    # label
    widget.label_title = QLabel(widget)
    widget.label_title.setText(title_str)
    widget.label_title.setSizePolicy(QSizePolicy.Preferred,
                                     QSizePolicy.Maximum)

    # text edit
    widget.text_edit = LineEdit(widget, hint_str)
    if only_numbers:
        widget.text_edit.setValidator(QIntValidator(0, 100, widget))

    # add to layout
    layout.addWidget(widget.label_title)
    layout.addWidget(widget.text_edit)

    widget.setLayout(layout)

    return widget
示例#18
0
 def __init__(self, parent=None):
     BaseEdit.__init__(self, parent)
     intval = QIntValidator()
     self.setValidator(intval)
     font = QFont("Times New Roman", 12, QFont.Bold)
     self.setFont(font)
     # self.setStyleSheet( "color: red;" )
     self.setAlignment(Qt.AlignRight)
示例#19
0
    def __init__(self, parent=None):
        super(BlockingClient, self).__init__(parent)

        self.thread = FortuneThread()
        self.currentFortune = ''

        hostLabel = QLabel("&Server name:")
        portLabel = QLabel("S&erver port:")

        for ipAddress in QNetworkInterface.allAddresses():
            if ipAddress != QHostAddress.LocalHost and ipAddress.toIPv4Address(
            ) != 0:
                break
        else:
            ipAddress = QHostAddress(QHostAddress.LocalHost)

        ipAddress = ipAddress.toString()

        self.hostLineEdit = QLineEdit(ipAddress)
        self.portLineEdit = QLineEdit()
        self.portLineEdit.setValidator(QIntValidator(1, 65535, self))

        hostLabel.setBuddy(self.hostLineEdit)
        portLabel.setBuddy(self.portLineEdit)

        self.statusLabel = QLabel(
            "This example requires that you run the Fortune Server example as well."
        )
        self.statusLabel.setWordWrap(True)

        self.getFortuneButton = QPushButton("Get Fortune")
        self.getFortuneButton.setDefault(True)
        self.getFortuneButton.setEnabled(False)

        quitButton = QPushButton("Quit")

        buttonBox = QDialogButtonBox()
        buttonBox.addButton(self.getFortuneButton, QDialogButtonBox.ActionRole)
        buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole)

        self.getFortuneButton.clicked.connect(self.requestNewFortune)
        quitButton.clicked.connect(self.close)
        self.hostLineEdit.textChanged.connect(self.enableGetFortuneButton)
        self.portLineEdit.textChanged.connect(self.enableGetFortuneButton)
        self.thread.newFortune.connect(self.showFortune)
        self.thread.error.connect(self.displayError)

        mainLayout = QGridLayout()
        mainLayout.addWidget(hostLabel, 0, 0)
        mainLayout.addWidget(self.hostLineEdit, 0, 1)
        mainLayout.addWidget(portLabel, 1, 0)
        mainLayout.addWidget(self.portLineEdit, 1, 1)
        mainLayout.addWidget(self.statusLabel, 2, 0, 1, 2)
        mainLayout.addWidget(buttonBox, 3, 0, 1, 2)
        self.setLayout(mainLayout)

        self.setWindowTitle("Blocking Fortune Client")
        self.portLineEdit.setFocus()
示例#20
0
class ControlInt(ControlText):
    _line_edit_validator = QIntValidator()

    @property
    def value(self) -> int:
        return _str2int(self.control.text())

    @value.setter
    def value(self, value: int):
        self.control.setText(str(value))
示例#21
0
    def __init__(self, tab_service: TabService,
                 background_processor: BackgroundTaskMixin, options: Options):
        super().__init__()
        self.setupUi(self)
        self.tab_service = tab_service
        self.background_processor = background_processor

        self._options = options

        # Progress
        background_processor.background_tasks_button_lock_signal.connect(
            self.enable_buttons_with_background_tasks)
        self.failed_to_generate_signal.connect(
            show_failed_generation_exception)

        # ISO Packing
        self.loaded_game_updated.connect(self._update_displayed_game)
        self.load_game_button.clicked.connect(self._load_game_button)
        self.export_game_button.hide()
        self.export_game_button.clicked.connect(self.export_game)
        self.clear_game_button.clicked.connect(self.delete_loaded_game)
        self.output_folder_edit.textChanged.connect(
            self._on_new_output_directory)
        self.output_folder_button.clicked.connect(self._change_output_folder)

        # Seed/Permalink
        self.seed_number_edit.setValidator(QIntValidator(0, 2**31 - 1))
        self.seed_number_edit.textChanged.connect(self._on_new_seed_number)
        self.seed_number_button.clicked.connect(self._generate_new_seed_number)

        self.permalink_edit.textChanged.connect(self._on_permalink_changed)
        self.permalink_import_button.clicked.connect(
            self._import_permalink_from_field)

        self.reset_settings_button.clicked.connect(self._reset_settings)

        # Randomize
        self.randomize_and_export_button.clicked.connect(
            self._randomize_and_export)
        self.randomize_log_only_button.clicked.connect(
            self._create_log_file_pressed)
        self.create_from_log_button.clicked.connect(self._randomize_from_file)

        # Game Patching
        self.create_spoiler_check.stateChanged.connect(
            self._persist_option_then_notify("create_spoiler"))
        self.remove_hud_popup_check.stateChanged.connect(
            self._persist_option_then_notify("hud_memo_popup_removal"))
        self.include_menu_mod_check.stateChanged.connect(
            self._persist_option_then_notify("include_menu_mod"))
        self.faster_credits_check.stateChanged.connect(
            self._persist_option_then_notify("speed_up_credits"))

        # Post setup update
        self.loaded_game_updated.emit()
示例#22
0
    def __init__(self, on_serves_entered: CallbackType) -> None:
        self._on_serves_entered = on_serves_entered

        serves_amount_line_edit = QLineEdit("1")
        serves_amount_line_edit.setFixedWidth(30)
        serves_amount_line_edit.setValidator(QIntValidator())
        serves_amount_line_edit.setMaxLength(2)

        super().__init__("Количество порций:", serves_amount_line_edit)

        self._connect_slots()
示例#23
0
 def __init__(self):
     super().__init__()
     self.resize(800, 150)
     self.setWindowTitle('AI智能打轴 (测试版)')
     layout = QGridLayout()
     self.setLayout(layout)
     layout.addWidget(QLabel('前侧留白(ms)'), 0, 0, 1, 1)
     self.beforeEdit = QLineEdit('20')
     validator = QIntValidator()
     validator.setRange(0, 5000)
     self.beforeEdit.setValidator(validator)
     self.beforeEdit.setFixedWidth(50)
     layout.addWidget(self.beforeEdit, 0, 1, 1, 1)
     layout.addWidget(QLabel(''), 0, 2, 1, 1)
     layout.addWidget(QLabel('后侧留白(ms)'), 0, 3, 1, 1)
     self.afterEdit = QLineEdit('300')
     self.afterEdit.setValidator(validator)
     self.afterEdit.setFixedWidth(50)
     layout.addWidget(self.afterEdit, 0, 4, 1, 1)
     layout.addWidget(QLabel(''), 0, 5, 1, 1)
     self.autoFill = QPushButton('填充字符')
     self.autoFill.setStyleSheet('background-color:#3daee9')
     self.autoFill.clicked.connect(self.setAutoFill)
     layout.addWidget(self.autoFill, 0, 6, 1, 1)
     self.fillWord = QLineEdit('#AI自动识别#')
     layout.addWidget(self.fillWord, 0, 7, 1, 1)
     layout.addWidget(QLabel(''), 0, 8, 1, 1)
     self.autoSpan = QPushButton('自动合并')
     self.autoSpan.setStyleSheet('background-color:#3daee9')
     self.autoSpan.clicked.connect(self.setAutoSpan)
     layout.addWidget(self.autoSpan, 0, 9, 1, 1)
     self.multiCheck = QPushButton('启用多进程')
     self.multiCheck.setStyleSheet('background-color:#3daee9')
     self.multiCheck.clicked.connect(self.setMultipleThread)
     layout.addWidget(self.multiCheck, 0, 10, 1, 1)
     self.processBar = QProgressBar()
     layout.addWidget(self.processBar, 1, 0, 1, 10)
     self.checkButton = QPushButton('开始')
     self.checkButton.setFixedWidth(100)
     self.checkButton.clicked.connect(self.separateProcess)
     layout.addWidget(self.checkButton, 1, 10, 1, 1)
示例#24
0
 def getEditor(self) -> AbsOperationEditor:
     factory = OptionsEditorFactory()
     factory.initEditor()
     factory.withAttributeTable('attributes', True, False, True,
                                {
                                    'bins': (
                                        'K', OptionValidatorDelegate(QIntValidator(1, 10000000)), None
                                    )}, types=self.acceptedTypes())
     values = [(s.name, s) for s in BinStrategy]
     factory.withRadioGroup('Select strategy:', 'strategy', values)
     factory.withAttributeNameOptionsForTable('suffix')
     return factory.getEditor()
示例#25
0
    def __init__(self, lien):
        QWidget.__init__(self)
        self.setFixedWidth(340)

        self.__restriction = QIntValidator()
        self.precision = 0
        self.masse = 0
        self.rho = 1000
        self.__label_title = QLabel('''Tirant d'Eau''')
        self.__label_title.setAlignment(QtCore.Qt.AlignCenter
                                        | QtCore.Qt.AlignVCenter)
        A = QFont("DIN Condensed", 45)
        self.__label_title.setFixedHeight(100)

        self.__label_title.setFont(A)
        self.layout = QGridLayout()
        self.button_compute = QPushButton('Compute')
        self.button_compute.sizeHint()
        self.__label_precision = QLabel('Tolérance')
        self.__label_precision.setAlignment(QtCore.Qt.AlignCenter
                                            | QtCore.Qt.AlignVCenter)
        self.text_precision = QLineEdit()
        self.__label_poids = QLabel('Masse (kg)')
        self.__label_poids.setAlignment(QtCore.Qt.AlignCenter
                                        | QtCore.Qt.AlignVCenter)
        self.text_poids = QLineEdit()
        self.text_poids.setValidator(self.__restriction)

        self.text_precision.textChanged.connect(self.l1)
        self.text_poids.textChanged.connect(self.l2)

        self.eau_de_mer = QRadioButton('''Eau De Mer''')
        self.eau_de_mer.setChecked(True)
        self.eau_douce = QRadioButton('''Eau Douce''')

        A = QFont("DIN Condensed", 20)
        self.__label_LCD = QLabel('''Tirant d'eau (m)''')
        self.__label_LCD.setAlignment(QtCore.Qt.AlignCenter
                                      | QtCore.Qt.AlignVCenter)
        self.__label_LCD.setFont(A)
        self.LCD = QLCDNumber()
        '''Association Layout'''
        self.layout.addWidget(self.__label_title, 0, 0, 1, 0)
        self.layout.addWidget(self.__label_precision, 2, 0, 1, 0)
        self.layout.addWidget(self.text_precision, 3, 0, 1, 0)
        self.layout.addWidget(self.__label_poids, 4, 0, 1, 0)
        self.layout.addWidget(self.text_poids, 5, 0, 1, 0)
        self.layout.addWidget(self.eau_de_mer, 8, 0)
        self.layout.addWidget(self.eau_douce, 8, 1)
        self.layout.addWidget(self.button_compute, 9, 0, 1, 0)
        self.layout.addWidget(self.__label_LCD, 11, 0, 1, 0)
        self.layout.addWidget(self.LCD, 12, 0, 1, 0)
        self.setLayout(self.layout)
示例#26
0
 def __init__(self, parent=None, double_only=False, int_only=False, fixed=False, comma_sort=False):
     super().__init__(parent)
     self.__type = Types.TEXT
     self._double_only = double_only
     self._int_only = int_only
     if self._double_only:
         self.setValidator(QDoubleValidator())
         self.__type = Types.NUMBER
     elif self._int_only:
         self.setValidator(QIntValidator())
         self.__type = Types.INTEGER
     if fixed:
         self.setFixedWidth(250)
     self._comma_sort = comma_sort
     self.setMaximumWidth(250)
    def __init__(self, toolbox):
        """
        Args:
            toolbox (ToolboxUI): The toolbox instance where this widget should be embedded
        """
        super().__init__()
        from ..ui.data_store_properties import Ui_Form

        self._toolbox = toolbox
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.ui.comboBox_dialect.addItems(list(SUPPORTED_DIALECTS.keys()))
        self.ui.comboBox_dialect.setCurrentIndex(-1)
        self.ui.lineEdit_port.setValidator(QIntValidator())
        toolbox.ui.tabWidget_item_properties.addTab(self, "Data Store")
示例#28
0
 def __init__(self):
     super(MainWindow, self).__init__()
     Ui_MainWindow.__init__(self)
     self.setupUi(self)
     self.start_button.clicked.connect(self.start)
     self.stop_button.clicked.connect(self.stop)
     self.main_controller = None
     validator = QIntValidator(1, 200, self) # Validator for the operation time input. Only allow values 1 to 100 seconds
     self.operation_time_entry.setValidator(validator)
     self.current_elapsed_time = 0
     self.timer = QTimer(self)
     self.timer.setInterval(1000)
     self.timer.timeout.connect(self.update_elapsed_time)
     self.max_deburr_time = 0
     self.thread_pool = QThreadPool()
示例#29
0
    def __init__(self,
                 parent: QWidget, parent_layout: QVBoxLayout,
                 resource_database: ResourceDatabase, item: ResourceRequirement,
                 rows: List["ItemRow"]
                 ):
        self.parent = parent
        self.resource_database = resource_database
        self._rows = rows
        rows.append(self)

        self.layout = QHBoxLayout()
        self.layout.setObjectName(f"Box layout for {item.resource.long_name}")
        parent_layout.addLayout(self.layout)

        self.resource_type_combo = _create_resource_type_combo(item.resource.resource_type, parent)
        self.resource_type_combo.setMinimumWidth(75)
        self.resource_type_combo.setMaximumWidth(75)

        self.resource_name_combo = _create_resource_name_combo(self.resource_database,
                                                               item.resource.resource_type,
                                                               item.resource,
                                                               self.parent)

        self.negate_combo = QComboBox(parent)
        self.negate_combo.addItem("≥", False)
        self.negate_combo.addItem("<", True)
        self.negate_combo.setCurrentIndex(int(item.negate))
        self.negate_combo.setMinimumWidth(40)
        self.negate_combo.setMaximumWidth(40)

        self.amount_edit = QLineEdit(parent)
        self.amount_edit.setValidator(QIntValidator(1, 10000))
        self.amount_edit.setText(str(item.amount))
        self.amount_edit.setMinimumWidth(45)
        self.amount_edit.setMaximumWidth(45)

        self.remove_button = QPushButton(parent)
        self.remove_button.setText("X")
        self.remove_button.setMaximumWidth(20)

        self.layout.addWidget(self.resource_type_combo)
        self.layout.addWidget(self.resource_name_combo)
        self.layout.addWidget(self.negate_combo)
        self.layout.addWidget(self.amount_edit)
        self.layout.addWidget(self.remove_button)

        self.resource_type_combo.currentIndexChanged.connect(self._update_type)
        self.remove_button.clicked.connect(self._delete_row)
    def __init__(self, parent=None):
        super(BrokerConnectionDialog, self).__init__(parent)
        
        self.settings = LazySettings('settings')
        self.broker = BrokerConnection()

        onlyInt = QIntValidator(1, 9999)

        hostLabel = QLabel("Host:")
        self.hostEdit = QLineEdit(self.settings.HOST)

        portLabel = QLabel("Port:")
        self.portEdit = QLineEdit(str(self.settings.PORT))
        self.portEdit.setValidator(onlyInt)

        clientIdLabel = QLabel("Client ID:")
        self.clientIdEdit = QLineEdit('1')
        self.clientIdEdit.setValidator(onlyInt)


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

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

        self.groupBox = QGroupBox()
        groupLayout = QVBoxLayout()
        groupLayout.addWidget(hostLabel)
        groupLayout.addWidget(self.hostEdit)
        groupLayout.addWidget(portLabel)
        groupLayout.addWidget(self.portEdit)
        groupLayout.addWidget(clientIdLabel)
        groupLayout.addWidget(self.clientIdEdit)
        groupLayout.addStretch(1)
        self.groupBox.setLayout(groupLayout)
        
        if self.broker.isConnected():
            buttonBox.button(QDialogButtonBox.Ok).setText('Disconnect')
            self.groupBox.setEnabled(False)
        else:
            buttonBox.button(QDialogButtonBox.Ok).setText('Connect')
        
        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.groupBox)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle("Settings")
示例#31
0
 def validate(self,input,pos):
     if input == '':
         return QValidator.Acceptable, input, pos
     else:
         return QIntValidator.validate(self,input,pos)
示例#32
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     QIntValidator.__init__(self, parent)