我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QLineEdit()。
def generateWidget( self, idGDT, ContainerOfData ): self.idGDT = idGDT self.ContainerOfData = ContainerOfData self.lineEdit = QtGui.QLineEdit() if self.Mask <> None: self.lineEdit.setInputMask(self.Mask) if self.Dictionary == None: self.lineEdit.setText('text') self.text = 'text' else: NumberOfObjects = self.getNumberOfObjects() if NumberOfObjects > len(self.Dictionary)-1: NumberOfObjects = len(self.Dictionary)-1 self.lineEdit.setText(self.Dictionary[NumberOfObjects]) self.text = self.Dictionary[NumberOfObjects] self.lineEdit.textChanged.connect(self.valueChanged) self.ContainerOfData.textName = self.text.strip() return GDTDialog_hbox(self.Text,self.lineEdit)
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u'Add new category') # self.categoryName = QtGui.QLineEdit('') self.categoryName.setStyleSheet('background-color:#FFF;') self.categoryDescription = QtGui.QTextEdit('') # buttons buttons = QtGui.QDialogButtonBox() buttons.setOrientation(QtCore.Qt.Vertical) buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Add", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # lay = QtGui.QGridLayout(self) lay.addWidget(QtGui.QLabel(u'Name'), 0, 0, 1, 1) lay.addWidget(self.categoryName, 0, 1, 1, 1) lay.addWidget(QtGui.QLabel(u'Desctiption'), 1, 0, 1, 1, QtCore.Qt.AlignTop) lay.addWidget(self.categoryDescription, 1, 1, 1, 1) lay.addWidget(buttons, 0, 2, 2, 1, QtCore.Qt.AlignCenter) lay.setRowStretch(1, 10)
def __init__(self, filename=None, parent=None): dialogMAIN_FORM.__init__(self, parent) self.databaseType = "razen" ### self.generateLayers() self.spisWarstw.sortItems(1) # self.razenBiblioteki = QtGui.QLineEdit('') if PCBconf.supSoftware[self.databaseType]['libPath'] != "": self.razenBiblioteki.setText(PCBconf.supSoftware[self.databaseType]['libPath']) lay = QtGui.QHBoxLayout() lay.addWidget(QtGui.QLabel('Library')) lay.addWidget(self.razenBiblioteki) self.lay.addLayout(lay, 12, 0, 1, 6)
def check_state(self, *args, **kwargs): """ Update the background color of a QLineEdit object based on whether the input is valid. """ sender = self.sender() validator = sender.validator() state = validator.validate(sender.text(), 0)[0] if state == QtGui.QValidator.Acceptable: color = 'none' # normal background color elif state == QtGui.QValidator.Intermediate: color = '#fff79a' # yellow else: color = '#f6989d' # red sender.setStyleSheet('QLineEdit { background-color: %s }' % color)
def get_wavelength_region(self): try: wl_lower = float(self.text_lower_wl.text()) except ValueError: wl_lower = None self.text_lower_wl.setStyleSheet(\ 'QLineEdit { background-color: %s }' % '#f6989d') #red else: self.text_lower_wl.setStyleSheet(\ 'QLineEdit { background-color: %s }' % 'none') try: wl_upper = float(self.text_upper_wl.text()) except ValueError: wl_upper = None self.text_upper_wl.setStyleSheet(\ 'QLineEdit { background-color: %s }' % '#f6989d') #red else: self.text_upper_wl.setStyleSheet(\ 'QLineEdit { background-color: %s }' % 'none') if wl_lower is None or wl_upper is None: return None if wl_lower >= wl_upper: return None return (wl_lower, wl_upper)
def _check_lineedit_state(self, *args, **kwargs): """ Update the background color of a QLineEdit object based on whether the input is valid. """ # TODO: Implement from # http://stackoverflow.com/questions/27159575/pyside-modifying-widget-colour-at-runtime-without-overwriting-stylesheet sender = self.sender() validator = sender.validator() state = validator.validate(sender.text(), 0)[0] if state == QtGui.QValidator.Acceptable: color = 'none' # normal background color elif state == QtGui.QValidator.Intermediate: color = '#fff79a' # yellow else: color = '#f6989d' # red sender.setStyleSheet('QLineEdit { background-color: %s }' % color) return None
def check_state(self, *args, **kwargs): """ Update the background color of a QLineEdit object based on whether the input is valid. """ # TODO: Implement from # http://stackoverflow.com/questions/27159575/pyside-modifying-widget-colour-at-runtime-without-overwriting-stylesheet sender = self.sender() validator = sender.validator() state = validator.validate(sender.text(), 0)[0] if state == QtGui.QValidator.Acceptable: color = 'none' # normal background color elif state == QtGui.QValidator.Intermediate: color = '#fff79a' # yellow else: color = '#f6989d' # red sender.setStyleSheet('QLineEdit { background-color: %s }' % color)
def check_lineedit_state(self, *args, **kwargs): """ Update the background color of a QLineEdit object based on whether the input is valid. """ sender = self.sender() state = sender.validator().validate(sender.text(), 0)[0] color = { QtGui.QValidator.Acceptable: 'none', # Normal background QtGui.QValidator.Intermediate: "#FFF79A", # Yellow }.get(state, "#F6989D") # Red sender.setStyleSheet("QLineEdit {{ background-color: {} }}".format(color)) return None
def __init__(self, parent=None, win=None, element="", info=()): super(RenameDialog, self).__init__(parent) self.sourceWin = parent self.info = info self.element = element title = "Rename: " + element self.setWindowTitle(title) layout = QtGui.QGridLayout() question = QtGui.QLabel("Please enter new name:") layout.addWidget(question, 0, 0) self.lineEdit = QtGui.QLineEdit() layout.addWidget(self.lineEdit, 0, 1) self.buttonOK = QtGui.QPushButton("OK", self) layout.addWidget(self.buttonOK, 1, 1) self.buttonCancel = QtGui.QPushButton("Cancel", self) layout.addWidget(self.buttonCancel, 1, 0) self.lineEdit.setText(self.element) self.setLayout(layout) self.buttonCancel.clicked.connect(self.cancelClicked) self.buttonOK.clicked.connect(self.okClicked)
def __init__(self, parent=None, win=None, xrefs=None, headers=["Origin", "Method"]): super(XrefListView, self).__init__(parent) self.parent = parent self.mainwin = win self.xrefs = xrefs self.headers = headers self.setMinimumSize(600, 400) self.filterPatternLineEdit = QtGui.QLineEdit() self.filterPatternLabel = QtGui.QLabel("&Filter origin pattern:") self.filterPatternLabel.setBuddy(self.filterPatternLineEdit) self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged) self.xrefwindow = XrefValueWindow(self, win, self.xrefs, self.headers) sourceLayout = QtGui.QVBoxLayout() sourceLayout.addWidget(self.xrefwindow) sourceLayout.addWidget(self.filterPatternLabel) sourceLayout.addWidget(self.filterPatternLineEdit) self.setLayout(sourceLayout)
def __init__(self, parent=None, win=None, session=None): super(StringsWindow, self).__init__(parent) self.mainwin = win self.session = session self.title = "Strings" self.filterPatternLineEdit = QtGui.QLineEdit() self.filterPatternLabel = QtGui.QLabel("&Filter string pattern:") self.filterPatternLabel.setBuddy(self.filterPatternLineEdit) self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged) self.stringswindow = StringsValueWindow(self, win, session) sourceLayout = QtGui.QVBoxLayout() sourceLayout.addWidget(self.stringswindow) sourceLayout.addWidget(self.filterPatternLabel) sourceLayout.addWidget(self.filterPatternLineEdit) self.setLayout(sourceLayout)
def create_text_input_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) text = QtGui.QLineEdit() text.setValidator(Validator(setting.filter, setting.filter_action)) text.setObjectName(setting.name) text.textChanged.connect(self.call_with_object('setting_changed', text, setting)) if setting.value: text.setText(str(setting.value)) text.setStatusTip(setting.description) text.setToolTip(setting.description) hlayout.addWidget(text) return hlayout
def createNodeMenu(self): menuEntry = QtGui.QGraphicsWidget() menuEntryLayout = QtGui.QHBoxLayout() menuEntry.setLayout(menuEntryLayout) menuEntry.setGeometry(0,0,100,100) menuEntryTextField = QtGui.QLineEdit() menuEntryLayout.addWidget(menuEntryTextField) menu = QtGui.QMenu("Create Node") menu.addAction("Node1") menu.addAction("Node2") menu.popup(QtGui.QCursor.pos()) menu.setZValue(100000) print "Menu"
def __init__(self): super(HeaderParameterPanel,self).__init__() layout = QtGui.QHBoxLayout() self.setLayout(layout) self.nodeTypeLabel = QtGui.QLabel("<NodeDefaultType>") self.nodeNameField = QtGui.QLineEdit("<NodeDefaultName>") self.lockButton = QtGui.QPushButton("L") self.editInterfaceButton = QtGui.QPushButton("G") layout.addWidget(self.nodeTypeLabel) layout.addWidget(self.nodeNameField) layout.addWidget(self.lockButton) layout.addWidget(self.editInterfaceButton) # This is the graphical aspect of the ParameterTemplate
def __init__(self,orientation,parent=None): super(MetaHeaderView, self).__init__(orientation,parent) self.setMovable(True) self.setClickable(True) # This block sets up the edit line by making setting the parent # to the Headers Viewport. self.line = QtGui.QLineEdit(parent=self.viewport()) #Create self.line.setAlignment(QtCore.Qt.AlignTop) # Set the Alignmnet self.line.setHidden(True) # Hide it till its needed # This is needed because I am having a werid issue that I believe has # to do with it losing focus after editing is done. self.line.blockSignals(True) self.sectionedit = 0 # Connects to double click self.sectionDoubleClicked.connect(self.editHeader) self.line.editingFinished.connect(self.doneEditing)
def dialog(fn): w=QtGui.QWidget() box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel("Path to Image" ) box.addWidget(l) w.anz = QtGui.QLineEdit() w.anz.setText(fn) box.addWidget(w.anz) loff=QtGui.QLabel("Offset Border" ) box.addWidget(loff) w.off = QtGui.QLineEdit() w.off.setText("100") box.addWidget(w.off) w.rotpos=QtGui.QCheckBox("Rot +90") box.addWidget(w.rotpos) w.rotneg=QtGui.QCheckBox("Rot -90") box.addWidget(w.rotneg) w.rot180=QtGui.QCheckBox("Rot 180") box.addWidget(w.rot180) w.r=QtGui.QPushButton("run") box.addWidget(w.r) w.r.pressed.connect(lambda :runw(w)) w.show() return w
def testme(): layout=''' VerticalLayoutTab: id:'main' QtGui.QLabel: setText:"*** N U R B S E D I T O R ***" VerticalLayout: HorizontalLayout: QtGui.QLabel: setText: "huhuwas 1 3" QtGui.QLabel: setText: "huhuwas 2 3" QtGui.QLabel: setText: "huhuwas 3 3" HorizontalLayout: QtGui.QLabel: setText:"Action " QtGui.QPushButton: setText: "Run Action" VerticalLayout: QtGui.QLineEdit: setText:"edit Axample" QtGui.QLineEdit: setText:"edit B" QtGui.QLineEdit: setText:"horizel " HorizontalLayout: QtGui.QLineEdit: setText:"AA" QtGui.QLineEdit: setText:"BB" ''' miki=Miki() #app.root=miki miki.parse2(layout) miki.run(layout)
def setupUi(self): self.setAutoFillBackground(True) hLayout = QtGui.QHBoxLayout(self) self.setLayout(hLayout) self.taskNameWidget = QtGui.QLineEdit(self.task.name) self.priorityWidget = PriorityWidget() self.priorityWidget.setValue(self.task.priority) self.statusWidget = StatusWidgetBar() self.statusWidget.setCurrentIndex(self.task.status) self.deleteWidget = DeleteWidget('delete') hLayout.addWidget(self.taskNameWidget) hLayout.addWidget(self.priorityWidget) hLayout.addWidget(self.statusWidget) hLayout.addWidget(self.deleteWidget)
def lineEdit(self): """Drawing the Line editor for the purpose of manualling entering the edge threshold""" self.Lineditor = QtGui.QLineEdit() self.Lineditor.setText(str(self.EdgeSliderValue)) self.Lineditor.returnPressed.connect(self.LineEditChanged) self.EdgeWeight.connect(self.EdgeSliderForGraph.setValue)
def __init__(self, categoryID, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u'Update category') self.categoryID = categoryID categoryData = readCategories()[self.categoryID] # self.categoryName = QtGui.QLineEdit('') self.categoryName.setStyleSheet('background-color:#FFF;') self.categoryName.setText(categoryData[0]) self.categoryDescription = QtGui.QTextEdit('') self.categoryDescription.setText(categoryData[1]) # buttons buttons = QtGui.QDialogButtonBox() buttons.setOrientation(QtCore.Qt.Vertical) buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Update", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # lay = QtGui.QGridLayout(self) lay.addWidget(QtGui.QLabel(u'Name'), 0, 0, 1, 1) lay.addWidget(self.categoryName, 0, 1, 1, 1) lay.addWidget(QtGui.QLabel(u'Desctiption'), 1, 0, 1, 1, QtCore.Qt.AlignTop) lay.addWidget(self.categoryDescription, 1, 1, 1, 1) lay.addWidget(buttons, 0, 2, 2, 1, QtCore.Qt.AlignCenter) lay.setRowStretch(1, 10)
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle("Convert old database to a new format") self.setMinimumWidth(500) # stary plik z modelami self.oldFilePath = QtGui.QLineEdit(os.path.join(__currentPath__, "param.py")) # nowy plik z modelami self.newFilePath = QtGui.QLineEdit(os.path.join(__currentPath__, "data/dane.cfg")) # self.pominDuplikaty = QtGui.QCheckBox(u"Skip duplicates") self.pominDuplikaty.setChecked(True) self.pominDuplikaty.setDisabled(True) # self.removeOld = QtGui.QCheckBox(u"Remove old database") self.removeOld.setChecked(True) # przyciski buttons = QtGui.QDialogButtonBox() buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Convert", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self.konwertuj) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # self.mainLayout = QtGui.QGridLayout(self) #self.mainLayout.setContentsMargins(0, 0, 0, 0) self.mainLayout.addWidget(QtGui.QLabel(u"Old database"), 0, 0, 1, 1) self.mainLayout.addWidget(self.oldFilePath, 0, 1, 1, 1) self.mainLayout.addWidget(QtGui.QLabel(u"New database"), 1, 0, 1, 1) self.mainLayout.addWidget(self.newFilePath, 1, 1, 1, 1) self.mainLayout.addWidget(self.pominDuplikaty, 3, 0, 1, 2) self.mainLayout.addWidget(self.removeOld, 4, 0, 1, 2) self.mainLayout.addWidget(buttons, 5, 1, 1, 1, QtCore.Qt.AlignRight) self.mainLayout.setRowStretch(6, 10)
def create_text_input_with_file_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) text = QtGui.QLineEdit() text.setObjectName(setting.name) button = QtGui.QPushButton('...') button.setMaximumWidth(30) button.setMaximumHeight(26) button.clicked.connect(self.call_with_object('get_file', button, text, setting)) if setting.value: text.setText(setting.value) text.setStatusTip(setting.description) text.setToolTip(setting.description) text.textChanged.connect(self.call_with_object('setting_changed', text, setting)) hlayout.addWidget(text) hlayout.addWidget(button) return hlayout
def create_text_input_with_folder_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) text = QtGui.QLineEdit() text.setObjectName(setting.name) button = QtGui.QPushButton('...') button.setMaximumWidth(30) button.setMaximumHeight(26) button.clicked.connect(self.call_with_object('get_folder', button, text, setting)) if setting.value: text.setText(setting.value) text.setStatusTip(setting.description) text.setToolTip(setting.description) text.textChanged.connect(self.call_with_object('setting_changed', text, setting)) hlayout.addWidget(text) hlayout.addWidget(button) return hlayout
def setupUi(self, LineEditDialog): LineEditDialog.setObjectName("LineEditDialog") LineEditDialog.resize(294, 112) self.verticalLayoutWidget = QtGui.QWidget(LineEditDialog) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 271, 91)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.lineEdit = QtGui.QLineEdit(self.verticalLayoutWidget) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.buttonBox = QtGui.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(LineEditDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), LineEditDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), LineEditDialog.reject) QtCore.QMetaObject.connectSlotsByName(LineEditDialog)
def elementForm(self): self.elementFormWidget = QtGui.QWidget() self.elementFormLayout = QtGui.QGridLayout() self.elementFormWidget.setLayout(self.elementFormLayout) self.showList=QtGui.QComboBox() self.sqList=QtGui.QComboBox() self.shotList=QtGui.QComboBox() self.taskList=QtGui.QComboBox() self.userFilterLabel = QtGui.QLabel("User Filter") self.userFilter = QtGui.QLineEdit(str(os.getenv("USER"))) self.renderList = QtGui.QListWidget() self.renderList.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) self.generateList() self.backButton=QtGui.QPushButton("Back") self.nextButton=QtGui.QPushButton("Next") self.elementFormLayout.addWidget(self.showList,4,0) self.elementFormLayout.addWidget(self.sqList,4,1) self.elementFormLayout.addWidget(self.shotList,4,2) self.elementFormLayout.addWidget(self.taskList,4,3) self.elementFormLayout.addWidget(self.userFilterLabel,7,0) self.elementFormLayout.addWidget(self.userFilter,7,1,1,3) self.elementFormLayout.addWidget(self.renderList,6,0,1,4)
def initUI(self): self._layout = QtGui.QGridLayout(None) self.setLayout(self._layout) self._layout.setContentsMargins(0,5,0,5) self._layout.setSpacing(0) self._topBar = QtGui.QFrame() self._topBarLayout = QtGui.QHBoxLayout(self._topBar) self._refreshProgression = QtGui.QProgressBar() self._refreshProgression.setMinimum(0) self._refreshProgression.setMaximum(100) self._refreshProgression.setValue(10) self._refreshButton = QtGui.QPushButton("Refresh") self._filterLabel = QtGui.QLabel("Filter :") self._filterField = QtGui.QLineEdit() self._topBarLayout.addWidget(self._refreshProgression) self._topBarLayout.addWidget(self._refreshButton) self._topBarLayout.addWidget(self._filterLabel) self._topBarLayout.addWidget(self._filterField) self.generateJobList() self._layout.addWidget(self._topBar) self._layout.addWidget(self._jobList) self._autoRefresh = JobListAutoRefresh(self,self._refreshProgression) #autoRefresh.run() self._refreshButton.clicked.connect(self.startRefresh)
def initUI(self): # Define Layout self._layout = QtGui.QHBoxLayout() self._layout.setContentsMargins(0,0,0,0) self._layout.setSpacing(5) self.setLayout(self._layout) # Create Elements self._label = QtGui.QPushButton(self._parameter.label()) self._field = QtGui.QLineEdit(str(self._parameter.value())) self._slider = ParameterSlider() self._layout.addWidget(self._label) self._layout.addWidget(self._field) self._layout.addWidget(self._slider)
def __init__(self,parent=None): super(MainMenu,self).__init__(parent) self.setNativeMenuBar(False) self.setFixedHeight(24) self._home = self.addMenu("Home") self._project = self.addMenu("Project") self._windows = self.addMenu("Windows") self._help = self.addMenu("Help") self._home.addAction("Home Screen") self._home.addAction("Show") self._home.addAction("Render") self._home.addAction("Daily") self._home.addAction("Review") self._project.addAction("Monster Trucks") self._project.addAction("Sputnik") self._project.addAction("Monster Trucks") self._project.addAction("Monster Trucks") self._windows.addAction("Node Editor") self._windows.addAction("Render Manager") self._windows.addAction("Console") self._windows.addAction("Script Editor") w = QtGui.QWidget() w.show() self._cornerWidget = QtGui.QWidget() self._cornerWidgetLayout = QtGui.QHBoxLayout() self._cornerWidget.setLayout(self._cornerWidgetLayout) self._cornerWidgetLayout.setContentsMargins(1,1,1,1) button = QtGui.QLineEdit("Search") self._cornerWidgetLayout.addWidget(button) self.setCornerWidget(self._cornerWidget,QtCore.Qt.TopRightCorner)
def build_ui(self): self.setLayout(QtGui.QVBoxLayout()) self.label = QtGui.QLabel("some label") self.btn = QtGui.QPushButton("button") self.lineedit = QtGui.QLineEdit() self.textedit = QtGui.QTextEdit() self.grp = QtGui.QGroupBox("group box grid layout") self.grp.setLayout(QtGui.QGridLayout()) self.chkbx_1 = QtGui.QCheckBox("chkbx_1") self.chkbx_2 = QtGui.QCheckBox("chkbx_2l") self.chkbx_2.setDisabled(True) self.chkbx_3 = QtGui.QCheckBox("chkbx_2r") self.chkbx_4 = QtGui.QCheckBox("chkbx_3") self.chkbx_5 = QtGui.QCheckBox("chkbx_4") self.grp.layout().addWidget(self.chkbx_1, 0, 0) self.grp.layout().addWidget(self.chkbx_2, 1, 0) self.grp.layout().addWidget(self.chkbx_3, 1, 1) self.grp.layout().addWidget(self.chkbx_4, 2, 0) self.grp.layout().addWidget(self.chkbx_5, 3, 0) self.grp.layout().setColumnStretch(2,1) self.lrbox = QtGui.QHBoxLayout() self.lrbox.addWidget(self.textedit) self.lrbox.addWidget(self.grp) self.layout().addWidget(self.label) self.layout().addWidget(self.btn) self.layout().addWidget(self.lineedit) self.layout().addLayout(self.lrbox)
def setAttributes(self): for attr in self.attributes: qw = self.__getattribute__(attr) if isinstance(qw, QtGui.QCheckBox): value = qw.isChecked() elif isinstance(qw, QtGui.QLineEdit): value = str(qw.text()) else: value = qw.value() config.__setattr__(attr, value) config.saveConfig()
def dialog(): w=QtGui.QWidget() box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel("String" ) box.addWidget(l) w.anz = QtGui.QLineEdit() w.anz.setText('OK') box.addWidget(w.anz) l=QtGui.QLabel("Degree" ) box.addWidget(l) w.degree = QtGui.QLineEdit() w.degree.setText('0') box.addWidget(w.degree) w.r=QtGui.QPushButton("run") box.addWidget(w.r) w.r.pressed.connect(lambda :_run(w)) w.progressbar=QtGui.QProgressBar() box.addWidget(w.progressbar) w.show() return w
def testme(): layout=''' VerticalLayoutTab: # id:'main' QtGui.QLabel: setText:"*** N U R B S E D I T O R ***" VerticalLayout: HorizontalLayout: QtGui.QLabel: setText: "huhuwas 1 3" QtGui.QLabel: setText: "huhuwas 2 3" QtGui.QLabel: setText: "huhuwas 3 3" HorizontalLayout: QtGui.QLabel: setText:"Action " QtGui.QPushButton: setText: "Run Action" VerticalLayout: QtGui.QLineEdit: setText:"edit Axample" QtGui.QLineEdit: setText:"edit B" QtGui.QLineEdit: setText:"horizel " HorizontalLayout: QtGui.QLineEdit: setText:"AA" QtGui.QLineEdit: setText:"BB" ''' miki=Miki() app.root=miki miki.parse2(layout) miki.run(layout)
def create_item(self, widget_config, grid, row_index): widget_config.widget_title = QtGui.QLabel(self.form) widget_config.widget_title.setText("%s : " % widget_config.show_name) if widget_config.type == float and not hasattr(widget_config, 'step'): widget_config.widget = QtGui.QLabel(self.form) widget_config.widget.setText("%f" % self.get_property_value(widget_config.name)) elif widget_config.type == float: widget_config.widget = QtGui.QDoubleSpinBox(self.form) widget_config.widget.setDecimals(widget_config.decimals) widget_config.widget.setSingleStep(widget_config.step) widget_config.widget.setMinimum(widget_config.interval_value[0]) widget_config.widget.setValue(self.get_property_value(widget_config.name)) widget_config.widget.setMaximum(widget_config.interval_value[-1]) elif widget_config.type == bool: widget_config.widget = QtGui.QCheckBox("", self.form) state = QtCore.Qt.Checked if self.get_property_value(widget_config.name) == True else QtCore.Qt.Unchecked widget_config.widget.setCheckState(state) elif widget_config.type == list: widget_config.widget = QtGui.QComboBox(self.form) widget_config.widget.addItems(widget_config.interval_value) default_value_index = 0 for str_value in widget_config.interval_value: if self.get_property_value(widget_config.name) == str_value: break default_value_index += 1 if default_value_index == len(widget_config.interval_value): raise ValueError("Default value not found for list" + widget_config.name) widget_config.widget.setCurrentIndex(default_value_index) widget_config.widget.currentIndexChanged.connect(self.listchangeIndex) elif widget_config.type == str: widget_config.widget = QtGui.QLineEdit(self.form) widget_config.widget.setText(self.get_property_value(widget_config.name)) else: raise ValueError("Undefined widget type") grid.addWidget(widget_config.widget_title, row_index, 0) grid.addWidget(widget_config.widget, row_index, 1)
def setupUi(self, findReplace): findReplace.setObjectName("findReplace") findReplace.resize(246, 101) self.verticalLayout = QtGui.QVBoxLayout(findReplace) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.replace_le = QtGui.QLineEdit(findReplace) self.replace_le.setObjectName("replace_le") self.gridLayout.addWidget(self.replace_le, 1, 0, 1, 1) self.find_le = QtGui.QLineEdit(findReplace) self.find_le.setObjectName("find_le") self.gridLayout.addWidget(self.find_le, 0, 0, 1, 1) self.find_btn = QtGui.QPushButton(findReplace) self.find_btn.setObjectName("find_btn") self.gridLayout.addWidget(self.find_btn, 0, 1, 1, 1) self.replace_btn = QtGui.QPushButton(findReplace) self.replace_btn.setObjectName("replace_btn") self.gridLayout.addWidget(self.replace_btn, 1, 1, 1, 1) self.replaceAll_btn = QtGui.QPushButton(findReplace) self.replaceAll_btn.setObjectName("replaceAll_btn") self.gridLayout.addWidget(self.replaceAll_btn, 2, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.retranslateUi(findReplace) QtCore.QMetaObject.connectSlotsByName(findReplace) findReplace.setTabOrder(self.find_le, self.replace_le) findReplace.setTabOrder(self.replace_le, self.find_btn) findReplace.setTabOrder(self.find_btn, self.replace_btn) findReplace.setTabOrder(self.replace_btn, self.replaceAll_btn)
def setupUi(self, setupAPI): setupAPI.setObjectName("setupAPI") setupAPI.resize(374, 188) self.verticalLayout = QtGui.QVBoxLayout(setupAPI) self.verticalLayout.setObjectName("verticalLayout") self.apiFileLocationDisplay = QtGui.QLineEdit(setupAPI) self.apiFileLocationDisplay.setDragEnabled(True) self.apiFileLocationDisplay.setReadOnly(True) self.apiFileLocationDisplay.setObjectName("apiFileLocationDisplay") self.verticalLayout.addWidget(self.apiFileLocationDisplay) self.groupBox = QtGui.QGroupBox(setupAPI) self.groupBox.setObjectName("groupBox") self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.portSpin = QtGui.QSpinBox(self.groupBox) self.portSpin.setMinimum(1000) self.portSpin.setMaximum(10000) self.portSpin.setProperty("value", 1234) self.portSpin.setObjectName("portSpin") self.verticalLayout_2.addWidget(self.portSpin) self.verticalLayout.addWidget(self.groupBox) self.selectAPIFileButton = QtGui.QPushButton(setupAPI) self.selectAPIFileButton.setObjectName("selectAPIFileButton") self.verticalLayout.addWidget(self.selectAPIFileButton) self.addAPIEntryButton = QtGui.QPushButton(setupAPI) self.addAPIEntryButton.setObjectName("addAPIEntryButton") self.verticalLayout.addWidget(self.addAPIEntryButton) self.retranslateUi(setupAPI) QtCore.QMetaObject.connectSlotsByName(setupAPI)
def __init__(self, model, attr, traits): self.widget = QtGui.QLineEdit() self.model = model self.attr = attr self.traits = traits self.widget.setText(self.traits.fmt(getattr(self.model, self.attr))) self.widget.setValidator(self.traits.validator())
def __init__(self, model, attr): self.widget = QtGui.QLineEdit() self.model = model self.attr = attr self.value = getattr(self.model, self.attr) self.widget.setValidator(QtGui.QIntValidator())
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(186, 154) Form.setMaximumSize(QtCore.QSize(200, 16777215)) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 7, 0, 1, 2) self.linkCombo = QtGui.QComboBox(Form) self.linkCombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.linkCombo.setObjectName("linkCombo") self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2) self.autoPercentSpin = QtGui.QSpinBox(Form) self.autoPercentSpin.setEnabled(True) self.autoPercentSpin.setMinimum(1) self.autoPercentSpin.setMaximum(100) self.autoPercentSpin.setSingleStep(1) self.autoPercentSpin.setProperty("value", 100) self.autoPercentSpin.setObjectName("autoPercentSpin") self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2) self.autoRadio = QtGui.QRadioButton(Form) self.autoRadio.setChecked(True) self.autoRadio.setObjectName("autoRadio") self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2) self.manualRadio = QtGui.QRadioButton(Form) self.manualRadio.setObjectName("manualRadio") self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2) self.minText = QtGui.QLineEdit(Form) self.minText.setObjectName("minText") self.gridLayout.addWidget(self.minText, 1, 2, 1, 1) self.maxText = QtGui.QLineEdit(Form) self.maxText.setObjectName("maxText") self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1) self.invertCheck = QtGui.QCheckBox(Form) self.invertCheck.setObjectName("invertCheck") self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4) self.mouseCheck = QtGui.QCheckBox(Form) self.mouseCheck.setChecked(True) self.mouseCheck.setObjectName("mouseCheck") self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4) self.visibleOnlyCheck = QtGui.QCheckBox(Form) self.visibleOnlyCheck.setObjectName("visibleOnlyCheck") self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2) self.autoPanCheck = QtGui.QCheckBox(Form) self.autoPanCheck.setObjectName("autoPanCheck") self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def dialog(points): print "dialog ",points.Label w=QtGui.QWidget() w.source=points box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel("Model" ) box.addWidget(l) w.mode = QtGui.QListWidget() w.mode.addItems( ['linear','thin_plate', 'cubic','inverse','multiquadric','gaussian' ,'quintic' ]) box.addWidget(w.mode) l=QtGui.QLabel("count grid lines" ) box.addWidget(l) w.grid = QtGui.QLineEdit() w.grid.setText('20') box.addWidget(w.grid) l=QtGui.QLabel("z-scale factor" ) box.addWidget(l) w.zfac = QtGui.QLineEdit() w.zfac.setText('10') box.addWidget(w.zfac) l=QtGui.QLabel("z-max " ) box.addWidget(l) w.zmax = QtGui.QLineEdit() w.zmax.setText('0') box.addWidget(w.zmax) w.matplot=QtGui.QCheckBox("show Matplot") box.addWidget(w.matplot) w.colormap=QtGui.QCheckBox("show colors") box.addWidget(w.colormap) # h=QtGui.QDial() # h.setMaximum(100) # h.setMinimum(0) # w.ha=h # box.addWidget(h) w.r=QtGui.QPushButton("run") box.addWidget(w.r) w.r.pressed.connect(lambda :srun(w)) w.show() return w
def setupUi(self, Form): """Setting up Log in UI Form """ Form.setObjectName("Form") Form.setFixedSize(400, 300) self.formLayoutWidget = QtGui.QWidget(Form) self.formLayoutWidget.setGeometry(QtCore.QRect(70, 110, 251, 71)) self.formLayoutWidget.setObjectName("formLayoutWidget") self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setContentsMargins(0, 0, 0, 0) self.formLayout.setObjectName("formLayout") self.Username = QtGui.QLabel(self.formLayoutWidget) self.Username.setObjectName("Username") self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.Username) self.Password = QtGui.QLabel(self.formLayoutWidget) self.Password.setObjectName("Password") self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.Password) self.iUsername = QtGui.QLineEdit(self.formLayoutWidget) self.iUsername.setObjectName("iUsername") self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.iUsername) self.iPassword = QtGui.QLineEdit(self.formLayoutWidget) self.iPassword.setObjectName("iPassword") self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.iPassword) spacerItem = QtGui.QSpacerItem( 20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.formLayout.setItem(1, QtGui.QFormLayout.LabelRole, spacerItem) self.Login = QtGui.QPushButton(Form) self.Login.setGeometry(QtCore.QRect(210, 220, 75, 23)) self.Login.setObjectName("Login") self.Captslog = QtGui.QLabel(Form) self.Captslog.setGeometry(QtCore.QRect(90, 50, 221, 41)) font = QtGui.QFont() font.setPointSize(30) font.setWeight(75) font.setBold(True) self.Captslog.setFont(font) self.Captslog.setObjectName("Captslog") self.ErrorMessage = QtGui.QLabel(Form) self.ErrorMessage.setGeometry(QtCore.QRect(120, 190, 151, 20)) self.ErrorMessage.setText("") self.ErrorMessage.setAlignment(QtCore.Qt.AlignCenter) self.ErrorMessage.setObjectName("ErrorMessage") self.Signup = QtGui.QPushButton(Form) self.Signup.setGeometry(QtCore.QRect(100, 220, 75, 23)) self.Signup.setObjectName("Signup") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, sql, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u'Import database') self.sql = sql # file self.filePath = QtGui.QLineEdit('') self.filePath.setReadOnly(True) filePathButton = QtGui.QPushButton('...') self.connect(filePathButton, QtCore.SIGNAL("clicked()"), self.chooseFile) filePathFrame = QtGui.QFrame() filePathFrame.setObjectName('lay_path_widget') filePathFrame.setStyleSheet('''#lay_path_widget {background-color:#fff; border:1px solid rgb(199, 199, 199); padding: 5px;}''') filePathLayout = QtGui.QHBoxLayout(filePathFrame) filePathLayout.addWidget(QtGui.QLabel(u'File:\t')) filePathLayout.addWidget(self.filePath) filePathLayout.addWidget(filePathButton) filePathLayout.setContentsMargins(0, 0, 0, 0) # tabs self.tabs = QtGui.QTabWidget() self.tabs.setTabPosition(QtGui.QTabWidget.West) self.tabs.setObjectName('tabs_widget') self.tabs.addTab(self.tabCategories(), u'Categories') self.tabs.addTab(self.tabModels(), u'Models') self.tabs.setTabEnabled(1, False) self.connect(self.tabs, QtCore.SIGNAL("currentChanged (int)"), self.activeModelsTab) # buttons buttons = QtGui.QDialogButtonBox() buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Import", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) buttonsFrame = QtGui.QFrame() buttonsFrame.setObjectName('lay_path_widget') buttonsFrame.setStyleSheet('''#lay_path_widget {background-color:#fff; border:1px solid rgb(199, 199, 199); padding: 5px;}''') buttonsLayout = QtGui.QHBoxLayout(buttonsFrame) buttonsLayout.addWidget(buttons) buttonsLayout.setContentsMargins(0, 0, 0, 0) # main layout lay = QtGui.QGridLayout(self) lay.addWidget(filePathFrame, 0, 0, 1, 1) lay.addWidget(self.tabs, 1, 0, 1, 1) lay.addWidget(buttonsFrame, 2, 0, 1, 1) lay.setRowStretch(1, 10) lay.setContentsMargins(5, 5, 5, 5)
def __init__(self, parent=None): reload(PCBconf) QtGui.QWidget.__init__(self, parent) freecadSettings = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/PCB") self.form = self self.form.setWindowTitle(u"Create PCB") self.form.setWindowIcon(QtGui.QIcon(":/data/img/board.png")) # self.gruboscPlytki = QtGui.QDoubleSpinBox(self) self.gruboscPlytki.setSingleStep(0.1) self.gruboscPlytki.setValue(freecadSettings.GetFloat("boardThickness", 1.5)) self.gruboscPlytki.setSuffix(u" mm") # self.pcbBorder = QtGui.QLineEdit('') self.pcbBorder.setReadOnly(True) pickPcbBorder = pickSketch(self.pcbBorder) # self.pcbHoles = QtGui.QLineEdit('') self.pcbHoles.setReadOnly(True) pickPcbHoles = pickSketch(self.pcbHoles) # self.pcbColor = kolorWarstwy() self.pcbColor.setColor(self.pcbColor.PcbColorToRGB(PCBconf.PCB_COLOR)) self.pcbColor.setToolTip(u"Click to change color") # lay = QtGui.QGridLayout() lay.addWidget(QtGui.QLabel(u'Border:'), 0, 0, 1, 1) lay.addWidget(self.pcbBorder, 0, 1, 1, 1) lay.addWidget(pickPcbBorder, 0, 2, 1, 1) lay.addWidget(QtGui.QLabel(u'Holes:'), 1, 0, 1, 1) lay.addWidget(self.pcbHoles, 1, 1, 1, 1) lay.addWidget(pickPcbHoles, 1, 2, 1, 1) lay.addWidget(QtGui.QLabel(u'Thickness:'), 2, 0, 1, 1) lay.addWidget(self.gruboscPlytki, 2, 1, 1, 2) lay.addWidget(QtGui.QLabel(u'Color:'), 3, 0, 1, 1) lay.addWidget(self.pcbColor, 3, 1, 1, 2) # self.setLayout(lay)
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u"Create drilling map") # # Output file format self.formatList = QtGui.QComboBox() for i, j in exportList.items(): self.formatList.addItem(j['name'], i) # Output directory self.pathToFile = QtGui.QLineEdit('') self.pathToFile.setReadOnly(True) zmianaSciezki = QtGui.QPushButton('...') zmianaSciezki.setToolTip(u'Change path') QtCore.QObject.connect(zmianaSciezki, QtCore.SIGNAL("pressed ()"), self.zmianaSciezkiF) # buttons saveButton = QtGui.QPushButton(u"Export") self.connect(saveButton, QtCore.SIGNAL("clicked ()"), self, QtCore.SLOT("accept()")) closeButton = QtGui.QPushButton(u"Close") self.connect(closeButton, QtCore.SIGNAL("clicked ()"), self, QtCore.SLOT('close()')) packageFooter = QtGui.QHBoxLayout() packageFooter.addStretch(10) packageFooter.addWidget(saveButton) packageFooter.addWidget(closeButton) packageFooter.setContentsMargins(10, 0, 10, 10) # header icon = QtGui.QLabel('') icon.setPixmap(QtGui.QPixmap(":/data/img/drill-icon.png")) headerWidget = QtGui.QWidget() headerWidget.setStyleSheet("padding: 10px; border-bottom: 1px solid #dcdcdc; background-color:#FFF;") headerLay = QtGui.QGridLayout(headerWidget) headerLay.addWidget(icon, 0, 0, 1, 1) headerLay.setContentsMargins(0, 0, 0, 0) ######## centerLay = QtGui.QGridLayout() centerLay.addWidget(QtGui.QLabel(u'Output file format:'), 0, 0, 1, 1) centerLay.addWidget(self.formatList, 0, 1, 1, 2) centerLay.addWidget(QtGui.QLabel(u'Output directory:'), 1, 0, 1, 1) centerLay.addWidget(self.pathToFile, 1, 1, 1, 1) centerLay.addWidget(zmianaSciezki, 1, 2, 1, 1) centerLay.setContentsMargins(10, 20, 10, 20) mainLay = QtGui.QVBoxLayout(self) mainLay.addWidget(headerWidget) mainLay.addLayout(centerLay) mainLay.addStretch(10) mainLay.addLayout(packageFooter) mainLay.setContentsMargins(0, 0, 0, 0) # self.formatList.setCurrentIndex(self.formatList.findData('dxf'))