def _createValidator(self): validator = QIntValidator(self.parent) if "min" in self.config: validator.setBottom(int(self.config["min"])) if "max" in self.config: validator.setTop(int(self.config["max"])) return validator
def _setupGui(self): self._ui.screenshotPixelXLineEdit.setValidator(QIntValidator()) self._ui.screenshotPixelYLineEdit.setValidator(QIntValidator()) for l in self._landmarkNames: self._ui.comboBoxFHC.addItem(l) self._ui.comboBoxMEC.addItem(l) self._ui.comboBoxLEC.addItem(l) self._ui.comboBoxFGT.addItem(l)
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)
def buildColorStepsControl(self): """Builds the portion of this widget for color cycling options.""" widget = QWidget() layout = QHBoxLayout() self.stepBox = QCheckBox(self.color_step_label) self.stepBox.stateChanged.connect(self.colorstepsChange) self.stepEdit = QLineEdit("8", self) # Setting max to sys.maxint in the validator causes an overflow! D: self.stepEdit.setValidator(QIntValidator(1, 65536, self.stepEdit)) self.stepEdit.setEnabled(False) self.stepEdit.editingFinished.connect(self.colorstepsChange) if self.color_step > 0: self.stepBox.setCheckState(Qt.Checked) self.stepEdit.setEnabled(True) layout.addWidget(self.stepBox) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(QLabel("with")) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(self.stepEdit) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(QLabel(self.number_steps_label)) widget.setLayout(layout) return widget
def bake(self): self.bakeWidget = QDialog( self ) def doCommand(): ctlsGroup = [] for widget in self.mainWindow.w_ctlListGroup.getChildrenWidgets(): ctls = widget.items allExists=True for ctl in ctls: if not pymel.core.objExists( ctl ): allExists=False break if not allExists: continue ctlsGroup.append( ctls ) mainCtl = self.mainWindow.w_mainCtl.lineEdit.text() minFrame = int( self.bakeWidget.le_minFrame.text() ) maxFrame = int( self.bakeWidget.le_maxFrame.text() ) BaseCommands.bake( mainCtl, ctlsGroup, minFrame, maxFrame ) def closeCommand(): self.bakeWidget.close() validator = QIntValidator( self ) minFrame = pymel.core.playbackOptions( q=1, min=0 ) maxFrame = pymel.core.playbackOptions( q=1, max=1 ) mainLayout = QVBoxLayout( self.bakeWidget ) timeRangeLayout = QHBoxLayout() l_minFrame = QLabel( "Min Frame : " ) le_minFrame = QLineEdit(); le_minFrame.setValidator( validator ) l_maxFrame = QLabel( "Max Frame : " ) le_maxFrame = QLineEdit(); le_maxFrame.setValidator( validator ) timeRangeLayout.addWidget( l_minFrame ) timeRangeLayout.addWidget( le_minFrame ) timeRangeLayout.addWidget( l_maxFrame ) timeRangeLayout.addWidget( le_maxFrame ) le_minFrame.setText( str( int(minFrame) ) ) le_maxFrame.setText( str( int(maxFrame) ) ) buttonsLayout = QHBoxLayout() b_bake = QPushButton( "Bake" ) b_close = QPushButton( "Close" ) buttonsLayout.addWidget( b_bake ) buttonsLayout.addWidget( b_close ) mainLayout.addLayout( timeRangeLayout ) mainLayout.addLayout( buttonsLayout ) QtCore.QObject.connect( b_bake, QtCore.SIGNAL( "clicked()" ), doCommand ) QtCore.QObject.connect( b_close, QtCore.SIGNAL( "clicked()" ), closeCommand ) self.bakeWidget.show() self.bakeWidget.le_minFrame = le_minFrame self.bakeWidget.le_maxFrame = le_maxFrame
def __init__(self, *args, **kwargs): QDialog.__init__(self, *args, **kwargs) self.installEventFilter(self) self.setWindowTitle(Window.title) mainLayout = QVBoxLayout(self) wLabelDescription = QLabel("Select Object or Group") validator = QIntValidator() hLayout = QHBoxLayout() wLabel = QLabel("Num Controller : ") wLineEdit = QLineEdit() wLineEdit.setValidator(validator) wLineEdit.setText('5') hLayout.addWidget(wLabel) hLayout.addWidget(wLineEdit) button = QPushButton("Create") mainLayout.addWidget(wLabelDescription) mainLayout.addLayout(hLayout) mainLayout.addWidget(button) self.resize(Window.defaultWidth, Window.defaultHeight) self.wlineEdit = wLineEdit QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.cmd_create)
def initUI(self): self.layoutFile = FileBrowseWidget( "Layout settings file .yaml (*.yaml)") self.layoutFile.setText(DEFAULT_LAYOUT_FILE) self.rfSettingsFile = FileBrowseWidget( "Device settings file .yaml (*.yaml)") self.rfSettingsFile.setText(DEFAULT_RF_FILE) layout = QFormLayout() layout.addRow(QLabel("Layout settings file (.yaml):"), self.layoutFile) layout.addRow(QLabel("RF settings file (.yaml):"), self.rfSettingsFile) self.idLine = QLineEdit() self.idLine.setText(str(DEFAULT_DEVICE_ID)) self.idLine.setMaximumWidth(50) self.idLine.setValidator(QIntValidator(0, 63)) layout.addRow(QLabel("Device id (0-63):"), self.idLine) self.generateButton = QPushButton("Generate new RF settings") self.generateButton.setMaximumWidth(230) self.generateButton.clicked.connect(self.generateRFSettings) layout.addRow(None, self.generateButton) label = QLabel( "<b>Note:</b> These settings only need to be loaded on each " "device once and are persistent when you update the layout. " "To ensure proper operation and security, each device must " "have a unique device ID for a given RF settings file. " "Since RF settings file contains your encryption key, make " "sure to keep it secret.") label.setTextInteractionFlags(Qt.TextSelectableByMouse) label.setWordWrap(True) layout.addRow(label) self.setLayout(layout)
def _init_num_instances(self): SubmitWindowController.submit_dialog.num_instances.setValidator( QIntValidator(1, 100)) SubmitWindowController.submit_dialog.num_instances.setText( str(self._num_instances)) SubmitWindowController.submit_dialog.num_instances.textChanged.connect( lambda: self._on_change_num_instances())
def __init__(self, *args, **kwargs): super(Widget_numController, self).__init__() self.installEventFilter(self) mainLayout = QHBoxLayout(self) mainLayout.setContentsMargins(5, 0, 5, 0) validator = QIntValidator() label = QLabel("Num Controller") lineEdit_width = QLineEdit() lineEdit_width.setValidator(validator) lineEdit_height = QLineEdit() lineEdit_height.setValidator(validator) lineEdit_width.setText('5') lineEdit_height.setText('5') mainLayout.addWidget(label) mainLayout.addWidget(lineEdit_width) mainLayout.addWidget(lineEdit_height) self.lineEdit_width = lineEdit_width self.lineEdit_height = lineEdit_height self.load_lineEdit_text([self.lineEdit_width, self.lineEdit_height], Widget_numController.path_uiInfo) QtCore.QObject.connect(self.lineEdit_width, QtCore.SIGNAL("returnPressed()"), self.save_info) QtCore.QObject.connect(self.lineEdit_height, QtCore.SIGNAL("returnPressed()"), self.save_info)
def add_row(self, *args): """adds a new row entry""" table = self.addeachweek.add_eachweek_table table.setSelectionBehavior(QAbstractItemView.SelectRows) table.setEditTriggers(QAbstractItemView.NoEditTriggers) table.setShowGrid(False) table.setAlternatingRowColors(True) table.setStyleSheet("color:#000000;") if args: table.setRowCount(len(args)) for i, j in enumerate(args): checkbox = QCheckBox() table.setCellWidget(i, 0, checkbox) item = QTableWidgetItem(j['item_no']) table.setItem(i, 1, item) item = QTableWidgetItem(j['item']) table.setItem(i, 2, item) item = QTableWidgetItem(j['category']) table.setItem(i, 3, item) item = QTableWidgetItem(j['rate']) table.setItem(i, 4, item) quantity = QLineEdit() quantity.setValidator(QIntValidator(0, 99999)) table.setCellWidget(i, 5, quantity) table.setColumnWidth(0, table.width() / 9) table.setColumnWidth(1, table.width() / 5) table.setColumnWidth(2, table.width() / 5) table.setColumnWidth(3, table.width() / 5) table.setColumnWidth(4, table.width() / 5)
def _setupGui(self): self._ui.samplesLineEdit.setValidator(QIntValidator()) self._ui.xtolLineEdit.setValidator(QDoubleValidator()) self._ui.initTransXLineEdit.setValidator(QDoubleValidator()) self._ui.initTransYLineEdit.setValidator(QDoubleValidator()) self._ui.initTransZLineEdit.setValidator(QDoubleValidator()) self._ui.initRotXLineEdit.setValidator(QDoubleValidator()) self._ui.initRotYLineEdit.setValidator(QDoubleValidator()) self._ui.initRotZLineEdit.setValidator(QDoubleValidator()) self._ui.initScaleLineEdit.setValidator(QDoubleValidator())
def __init__(self, parent=None, args=None): logger.info('Inside MenuAddDialogue') QDialog.__init__(self) self.parent = parent self.dialogue = Ui_add_menu_dialogue() self.dialogue.setupUi(self) self.setFocusPolicy(Qt.StrongFocus) self.focusInEvent = self.got_focus self.search = CategoryOfProduct() self.dialogue.menudialogu_delete_button.clicked.connect(self.delete_menu_item) self.dialogue.menudialogue_menuIngredients_table_addrow_button.clicked.connect(self.add_new_rows) self.dialogue.menudialogue_menuIngredients_table_save_button.clicked.connect(self.save_ingredients) self.dialogue.menudialogue_menuIngredients_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.dialogue.menudialogue_menuIngredients_table.itemDoubleClicked.connect(self.popup_edit) self.dialogue.menudialogue_add_button.clicked.connect(self.add_menu) self.setWindowFlags(Qt.WindowCloseButtonHint) self.editable = False self.menuproduct = MenuProduct() self.dish = MenuProduct() self.complete_category() self.dialogue.menudialogue_rate_lineedit.setValidator(QDoubleValidator(1.000, 999.000, 3)) self.dialogue.menudialogue_codenumber_linedit.setValidator(QIntValidator(0, 999)) self.dialogue.menudialogue_newcategory_button.clicked.connect(self.create_category) self.dialogue.menudialogue_itemname_linedit.textChanged.connect( lambda: self.auto_capital(self.dialogue.menudialogue_itemname_linedit)) self.id = None self.dialogue.menudialogue_serve_lineedit.setValidator(QIntValidator(0, 999)) if not args: self.dialogue.menudialogu_delete_button.setDisabled(True) self.dialogue.menudialogu_delete_button.setToolTip("Cannot Delete Uncreated Dish") self.dialogue.menudialogue_codenumber_linedit.setPlaceholderText('Not Assigned') self.dialogue.menudialogue_menuIngredients_table_addrow_button.setToolTip( "Cannot Add ingredients of unsaved Menu") self.dialogue.menudialogue_serve_lineedit.setPlaceholderText('No of Servings') self.dialogue.menudialogue_menuIngredients_table_addrow_button.setDisabled(True) self.dialogue.menudialogue_menuIngredients_table_save_button.setDisabled(True) else: self.edit_mode(args.text())
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) #Validators for data input ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])" ipRegex = QRegExp("^" + ipRange + "\\." + ipRange + "\\." + ipRange + "\\." + ipRange + "$") ipValidator = QRegExpValidator(self.leGraylogIP) ipValidator.setRegExp(ipRegex) self.leGraylogIP.setValidator(ipValidator) self.leGraylogPort.setValidator(QIntValidator(1, 65535)) self.leGraylogHttpPort.setValidator(QIntValidator(1, 65535)) ipValidator = QRegExpValidator(self.leAsterixIP) ipValidator.setRegExp(ipRegex) self.leAsterixIP.setValidator(ipValidator) self.leAsterixPort.setValidator(QIntValidator(1, 65535)) self.leAsterixSic.setValidator(QIntValidator(1, 256)) self.leIamodPort.setValidator(QIntValidator(1, 65535)) self.leIamodThreshold.setValidator(QIntValidator(0, 99999)) #Define functions for GUI actions self.pbStart.clicked.connect(self.__startServer) self.pbStop.clicked.connect(self.__stopServer) self.actionLicense.triggered.connect(self.__license) self.actionLoad_Config_File.triggered.connect(self.__dialogConfigFile) self.pbSaveConfiguration.clicked.connect(self.__writeConfigFile) self.pbStart.setEnabled(False) if self.__checkServerIsRunning(): self.__serverStatusImage(True) else: self.__serverStatusImage(False) self.configFile = ConfigParser.ConfigParser() self.view = QWebView() self.webLayout.addWidget(self.view) self.view.settings().setAttribute( QWebSettings.JavascriptCanOpenWindows, True) self.view.settings().setAttribute(QWebSettings.LocalStorageEnabled, True) self.pbConnect.clicked.connect(self.__connectHttpServer) l = QVBoxLayout(self.tab2) sc = StaticCanvas(self.tab2, width=5, height=4, dpi=100) dc = DynamicCanvas(self.tab2, width=5, height=4, dpi=100) l.addWidget(sc) l.addWidget(dc)
def __init__(self, *args, **kwargs ): super( Widget_startIndex, self ).__init__( *args, **kwargs ) mainLayout = QHBoxLayout( self ); mainLayout.setContentsMargins(15, 0, 10, 10 ) validator = QIntValidator() label = QLabel( "Start Index : " ); label.setFixedWidth( 120 ) lineEdit = QLineEdit(); lineEdit.setValidator( validator ); lineEdit.setText( "0" ); lineEdit.setFixedWidth( 50 ) space = QLabel(); space.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred ) mainLayout.addWidget(label) mainLayout.addWidget(lineEdit) mainLayout.addWidget( space ) self.lineEdit = lineEdit QtCore.QObject.connect(lineEdit, QtCore.SIGNAL("textChanged(const QString & )"), self.save_info) self.load_info()
def __init__(self, parent=None, code=None, name=None, day=None, quantity=None): logger.info('Inside MenuQuantityEditPopup') QDialog.__init__(self) self.today = Ui_menu_this_day() self.today.setupUi(self) self.parent = parent self.today.menuperday_quantity_linedit.setValidator(QIntValidator(0, 99999)) self.today.menuperday_save_button.clicked.connect(self.update_weeklydata) self.today.menuperday_delete_button.clicked.connect(self.remove_from_weeklymenu) if code: self.code = code self.name = name self.day = day self.quantity = quantity self.today.menuperday_code_label.setText(self.code) self.today.menuperday_name_label.setText(self.name) self.today.menuperday_quantity_linedit.setText(self.quantity) self.week = WeeklyMenu(code=self.code, name=self.name, day=self.day, quantity=self.quantity)
def _init_xy_res(self): validator = QIntValidator(1, 1000000) SubmitWindowController.submit_dialog.x_res.setValidator(validator) SubmitWindowController.submit_dialog.x_res.setText("1920") SubmitWindowController.submit_dialog.y_res.setValidator(validator) SubmitWindowController.submit_dialog.y_res.setText("1080")
def _init_frame_specs(self): SubmitWindowController.submit_dialog.frame_step.setValidator( QIntValidator(1, sys.maxint)) SubmitWindowController.submit_dialog.chunk_size.setValidator( QIntValidator(1, sys.maxint))
def create_widget(self, parent): self._widget = widget = QLineEdit(parent) widget.setValidator(QIntValidator(widget)) self._widget.setText(str(self.initial)) return widget
def __init__(self, parent=None): QWidget.__init__(self, parent) QIntValidator.__init__(self, parent)
def __init__(self, *args, **kwargs): self.minimum = 1 self.maximum = 100 self.lineEditMaximum = 10000 QMainWindow.__init__(self, *args, **kwargs) self.installEventFilter(self) #self.setWindowFlags( QtCore.Qt.Drawer ) self.setWindowTitle(Window_global.title) widgetMain = QWidget() layoutVertical = QVBoxLayout(widgetMain) self.setCentralWidget(widgetMain) layoutSlider = QHBoxLayout() lineEdit = QLineEdit() lineEdit.setFixedWidth(100) lineEdit.setText(str(1)) validator = QIntValidator(self.minimum, self.lineEditMaximum, self) lineEdit.setValidator(validator) slider = QSlider() slider.setOrientation(QtCore.Qt.Horizontal) slider.setMinimum(self.minimum) slider.setMaximum(self.maximum) layoutSlider.addWidget(lineEdit) layoutSlider.addWidget(slider) layoutAngle = QVBoxLayout() checkBox = QCheckBox('Connect Angle By Tangent') layoutVector = QHBoxLayout() leVx = QLineEdit() leVx.setText(str(1.000)) leVx.setEnabled(False) leVx.setValidator(QDoubleValidator(-100, 100, 5, self)) leVy = QLineEdit() leVy.setText(str(0.000)) leVy.setEnabled(False) leVy.setValidator(QDoubleValidator(-100, 100, 5, self)) leVz = QLineEdit() leVz.setText(str(0.000)) leVz.setEnabled(False) leVz.setValidator(QDoubleValidator(-100, 100, 5, self)) layoutAngle.addWidget(checkBox) layoutAngle.addLayout(layoutVector) layoutVector.addWidget(leVx) layoutVector.addWidget(leVy) layoutVector.addWidget(leVz) button = QPushButton('Create') layoutVertical.addLayout(layoutSlider) layoutVertical.addLayout(layoutAngle) layoutVertical.addWidget(button) QtCore.QObject.connect(slider, QtCore.SIGNAL('valueChanged(int)'), self.sliderValueChanged) QtCore.QObject.connect(lineEdit, QtCore.SIGNAL('textEdited(QString)'), self.lineEditValueChanged) QtCore.QObject.connect(button, QtCore.SIGNAL('clicked()'), Functions.createPointOnCurve) QtCore.QObject.connect(checkBox, QtCore.SIGNAL('clicked()'), Functions.setAngleEnabled) self.slider = slider self.lineEdit = lineEdit Window_global.slider = slider Window_global.button = button Window_global.checkBox = checkBox Window_global.leVx = leVx Window_global.leVy = leVy Window_global.leVz = leVz
def __init__(self): QWidget.__init__(self) self.setGeometry(QRect(100, 100, 400, 200)) self.layout = QtGui.QGridLayout(self) #lblAssetType self.lblAssetType = QLabel("Asset Type") self.layout.addWidget(self.lblAssetType, 0, 0) #cmdAssetType self.cmdAssetType = QComboBox(self) self.cmdAssetType.addItems(DaoAsset().getAssetTypes()) self.layout.addWidget(self.cmdAssetType, 0, 1) #lblAssetName self.lblAssetName = QLabel("Asset Name") self.layout.addWidget(self.lblAssetName, 1, 0) #cmdAssetName self.cmdAssetName = QComboBox(self) self.layout.addWidget(self.cmdAssetName, 1, 1) #lblCustody self.lblCustody = QLabel("Custody") self.layout.addWidget(self.lblCustody, 2, 0) #cmbCustody self.cmbCustody = QComboBox(self) custodyList = DaoCustody().getCustodyList() for (row) in custodyList: self.cmbCustody.addItem(row[1], row[0]) self.layout.addWidget(self.cmbCustody, 2, 1) #lblBuySell self.lblBuySell = QLabel("Buy Sell") self.layout.addWidget(self.lblBuySell, 3, 0) #cmdBuySell self.cmdBuySell = QComboBox(self) self.cmdBuySell.addItem("BUY") self.cmdBuySell.addItem("SELL") self.layout.addWidget(self.cmdBuySell, 3, 1) #lblByAmount self.lblByAmount = QLabel("By Amount") self.layout.addWidget(self.lblByAmount, 4, 0) #chkByAmount self.chkByAmount = QCheckBox(self) self.layout.addWidget(self.chkByAmount, 4, 1) #lblGrossAmount self.lblGrossAmount = QLabel("Gross Amount") self.layout.addWidget(self.lblGrossAmount, 5, 0) #txtGrossAmount self.txtGrossAmount = QLineEdit(self) self.txtGrossAmount.setValidator(QDoubleValidator( 0, 99999999, 6, self)) self.layout.addWidget(self.txtGrossAmount, 5, 1) #lblAcquisitionDate self.lblAcquisitionDate = QLabel("Acquisition Date") self.layout.addWidget(self.lblAcquisitionDate, 6, 0) #cmdAcquisitionDate self.dateAcquisitionDate = QDateEdit(self) self.dateAcquisitionDate.setDisplayFormat("dd-MM-yyyy") self.dateAcquisitionDate.setDate(datetime.datetime.now()) self.layout.addWidget(self.dateAcquisitionDate, 6, 1) #lblQuantity self.lblQuantity = QLabel("Quantity") self.layout.addWidget(self.lblQuantity, 7, 0) #txtQuantity self.txtQuantity = QLineEdit(self) self.txtQuantity.setValidator(QIntValidator(0, 1000000000, self)) self.layout.addWidget(self.txtQuantity, 7, 1) #lblPrice self.lblPrice = QLabel("Price") self.layout.addWidget(self.lblPrice, 8, 0) #txtPrice self.txtPrice = QLineEdit(self) self.txtPrice.setValidator(QDoubleValidator(0, 99999999, 6, self)) self.layout.addWidget(self.txtPrice, 8, 1) #lblRate self.lblRate = QLabel("Rate") self.layout.addWidget(self.lblRate, 9, 0) #txtRate self.txtRate = QLineEdit(self) self.txtRate.setValidator(QDoubleValidator(0, 99999999, 4, self)) self.txtRate.setEnabled(0) self.layout.addWidget(self.txtRate, 9, 1) #lblNetAmount self.lblNetAmount = QLabel("Net Amount") self.layout.addWidget(self.lblNetAmount, 10, 0) #txtNetAmount self.txtNetAmount = QLineEdit(self) self.txtNetAmount.setEnabled(0) self.txtNetAmount.setValidator(QDoubleValidator(0, 99999999, 6, self)) self.layout.addWidget(self.txtNetAmount, 10, 1) #lblCommissionPercentage self.lblCommissionPercentage = QLabel("Commission Percentage") self.layout.addWidget(self.lblCommissionPercentage, 11, 0) #txtCommissionPercentage self.txtCommissionPercentage = QLineEdit(self) self.txtCommissionPercentage.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionPercentage, 11, 1) #lblCommissionAmount self.lblCommissionAmount = QLabel("Commission Amount") self.layout.addWidget(self.lblCommissionAmount, 12, 0) #txtCommissionAmmount self.txtCommissionAmount = QLineEdit(self) self.txtCommissionAmount.setEnabled(0) self.txtCommissionAmount.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionAmount, 12, 1) #lblCommissionAmount self.lblCommissionVATAmount = QLabel("Commission VAT Amount") self.layout.addWidget(self.lblCommissionVATAmount, 13, 0) #txtCommissionAmmount self.txtCommissionVATAmount = QLineEdit(self) self.txtCommissionVATAmount.setEnabled(0) self.txtCommissionVATAmount.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionVATAmount, 13, 1) #lblTenor self.lblTenor = QLabel("Tenor") self.layout.addWidget(self.lblTenor, 14, 0) #txtTenor self.txtTenor = QLineEdit(self) self.txtTenor.setEnabled(0) self.txtTenor.setValidator(QDoubleValidator(0, 9999999, 0, self)) self.layout.addWidget(self.txtTenor, 14, 1) #btnAdd self.btnAdd = QPushButton("Add", self) self.layout.addWidget(self.btnAdd) #btnClear self.btnClear = QPushButton("Clear", self) self.layout.addWidget(self.btnClear) #clearEditor self.clearEditor() self.initListener()
def validate(self,input,pos): if input == '': return QValidator.Acceptable, input, pos else: return QIntValidator.validate(self,input,pos)
def setup_pop(self): """ sets up the form. """ self.grid_layout = QGridLayout(self) self.label_1 = QLabel(self) self.grid_layout.addWidget(self.label_1, 0, 0, 1, 1) self.code_line = QLineEdit(self) self.code_line.setValidator(QIntValidator(0, 99999)) self.grid_layout.addWidget(self.code_line, 0, 1, 1, 1) self.label_2 = QLabel(self) self.grid_layout.addWidget(self.label_2, 1, 0, 1, 1) self.date_line = QDateEdit(self) self.date_line.setCalendarPopup(True) self.grid_layout.addWidget(self.date_line, 1, 1, 1, 1) self.label_3 = QLabel(self) self.grid_layout.addWidget(self.label_3, 2, 0, 1, 1) self.organization_line = QLineEdit(self) self.grid_layout.addWidget(self.organization_line, 2, 1, 1, 1) self.label_4 = QLabel(self) self.grid_layout.addWidget(self.label_4, 3, 0, 1, 1) self.test_line = QLineEdit(self) self.grid_layout.addWidget(self.test_line, 3, 1, 1, 1) self.label_5 = QLabel(self) self.grid_layout.addWidget(self.label_5, 4, 0, 1, 1) self.description_line = QLineEdit(self) self.grid_layout.addWidget(self.description_line, 4, 1, 1, 1) self.image_label = QLabel(self) self.pixmap = QPixmap(':/images/upload.png') # self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation) #not used self.image_label.setPixmap(self.pixmap) self.image_label.setScaledContents(True) self.grid_layout.addWidget(self.image_label, 0, 2, 5, 2) self.horizontal = QHBoxLayout() self.delete_button = QPushButton(self) self.horizontal.addWidget(self.delete_button) self.create_button = QPushButton(self) self.horizontal.addWidget(self.create_button) self.update_button = QPushButton(self) self.horizontal.addWidget(self.update_button) self.upload_button = QPushButton(self) self.horizontal.addWidget(self.upload_button) self.grid_layout.addLayout(self.horizontal, 5, 0, 1, 4) ### retanslate self.label_1.setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.label_2.setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.date_line.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.label_3.setText( QApplication.translate("MainWindow", "Organization Name", None, QApplication.UnicodeUTF8)) self.label_4.setText( QApplication.translate("MainWindow", "Test", None, QApplication.UnicodeUTF8)) self.label_5.setText( QApplication.translate("MainWindow", "Description", None, QApplication.UnicodeUTF8)) self.delete_button.setText( QApplication.translate("MainWindow", "Delete", None, QApplication.UnicodeUTF8)) self.create_button.setText( QApplication.translate("MainWindow", "Create", None, QApplication.UnicodeUTF8)) self.update_button.setText( QApplication.translate("MainWindow", "Update", None, QApplication.UnicodeUTF8)) self.upload_button.setText( QApplication.translate("MainWindow", "Upload", None, QApplication.UnicodeUTF8)) self.create_button.clicked.connect(self.create_report) self.upload_button.clicked.connect(self.open_file) self.update_button.clicked.connect(self.update_report) self.delete_button.clicked.connect(self.delete_report) self.image_label.mouseReleaseEvent = self.image_viewer
def _setupGui(self): self._ui.samplesLineEdit.setValidator(QIntValidator()) self._ui.xtolLineEdit.setValidator(QDoubleValidator())
def validate(self, input, pos): if input == '': return QValidator.Acceptable, input, pos else: return QIntValidator.validate(self, input, pos)
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_SelectionGrow.txt" sgCmds.makeFile( self.infoPath ) validator = QIntValidator() layout = QHBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox() layout.addWidget( groupBox ) hLayout = QHBoxLayout() labelTitle = QLabel( "Grow Selection : " ) buttonGrow = QPushButton( "Grow" ); buttonGrow.setFixedWidth( 50 ) buttonShrink = QPushButton( "Shrink" ); buttonShrink.setFixedWidth( 50 ) lineEdit = QLineEdit(); lineEdit.setValidator( validator );lineEdit.setText( '0' ) hLayout.addWidget( labelTitle ) hLayout.addWidget( buttonGrow ) hLayout.addWidget( buttonShrink ) hLayout.addWidget( lineEdit ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( buttonGrow, QtCore.SIGNAL("clicked()"), self.growNum ) QtCore.QObject.connect( buttonShrink, QtCore.SIGNAL("clicked()"), self.shrinkNum ) self.vtxLineEditList = [] self.loadInfo()