def __init__(self, parent, model): super(cTestrunInfoView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setModel(model) layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUNINFO_TABLE, "title")), 0, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUNINFO_TABLE, "description"), alignment=Qt.AlignTop), 1, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUNINFO_TABLE, "source")), 2, 0) ledTitle = QtGui.QLineEdit(self, readOnly=True) tedDescription = QtGui.QTextEdit(self, readOnly=True) ledSource = QtGui.QLineEdit(self, readOnly=True) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledTitle, 0, 1, 1, 1) layout.addWidget(tedDescription, 1, 1, 1, 1) layout.addWidget(ledSource, 2, 1, 1, 1) layout.setColumnStretch(1, 1) layout.setRowStretch(1, 2) self.mapper.addMapping(ledTitle, model.fieldIndex('title')) self.mapper.addMapping(tedDescription, model.fieldIndex('description')) self.mapper.addMapping(ledSource, model.fieldIndex('source'))
def __init__(self, priorities=None): super(Reviewer, self).__init__() # Set up the window self.setupUi(self) self.__set_keyboard_shortcuts() self.__connect_signals() # Set up model self.__model = FailedFilesModel(priorities=priorities) # Initialize self.tableview.setModel(self.__model) self.tableview.setUpdatesEnabled(True) for icol in range(9, self.__model.columnCount()): self.tableview.setColumnHidden(icol, True) # Set up data-widget mapping self.mapper = qtgui.QDataWidgetMapper() self.mapper.setModel(self.__model) self.mapper.addMapping(self.psr_text, 2) self.mapper.addMapping(self.rcvr_text, 3) self.mapper.addMapping(self.stage_text, 4) self.mapper.addMapping(self.mjd_text, 5) self.mapper.addMapping(self.obstype_text, 6) self.mapper.addMapping(self.file_text, 10) self.mapper.addMapping(self.notes_text, 11) self.mapper.addMapping(self.log_text, 12) # Link tableview's selection to the data-widget mapper self.selection = self.tableview.selectionModel() self.selection.currentRowChanged.connect(self.select_row)
def __init__(self, config, driver, uifile="", parent=None): super(AmtronController, self).__init__(config, driver, uifile, parent) self.ui.powerBtn = QtGui.QPushButton(u"Power", checkable=True) self.ui.gateBtn = QtGui.QPushButton(u"Gate", checkable=True) self.ui.pilotBtn = QtGui.QPushButton(u"Pilot laser", checkable=True) self.ui._layout = QtGui.QHBoxLayout() self.ui._layout.addWidget(self.ui.powerBtn) self.ui._layout.addWidget(self.ui.gateBtn) self.ui._layout.addWidget(self.ui.pilotBtn) self.ui.instrumentPanel.layout().addLayout(self.ui._layout) self.programPool.default_factory = ctrlr.SetpointRampProgram self.powerBtnMapper = QtGui.QDataWidgetMapper(self.ui.powerBtn) self.powerBtnMapper.setModel(self._driverModel) self.powerBtnMapper.setItemDelegate(_ButtonDelegate(self.powerBtnMapper)) self.ui.driverView.selectionModel().currentRowChanged.connect( self.powerBtnMapper.setCurrentModelIndex) self.populated.connect(self.powerBtnMapper.toFirst) self.ui.powerBtn.toggled.connect(self.powerBtnMapper.submit) self.gateBtnMapper = QtGui.QDataWidgetMapper(self.ui.gateBtn) self.gateBtnMapper.setModel(self._driverModel) self.gateBtnMapper.setItemDelegate(_ButtonDelegate(self.gateBtnMapper)) self.ui.driverView.selectionModel().currentRowChanged.connect( self.gateBtnMapper.setCurrentModelIndex) self.populated.connect(self.gateBtnMapper.toFirst) self.ui.gateBtn.toggled.connect(self.gateBtnMapper.submit) self.pilotBtnMapper = QtGui.QDataWidgetMapper(self.ui.pilotBtn) self.pilotBtnMapper.setModel(self._driverModel) self.pilotBtnMapper.setItemDelegate(_ButtonDelegate(self.pilotBtnMapper)) self.ui.driverView.selectionModel().currentRowChanged.connect( self.pilotBtnMapper.setCurrentModelIndex) self.populated.connect(self.pilotBtnMapper.toFirst) self.ui.pilotBtn.toggled.connect(self.pilotBtnMapper.submit) self._specialColumnMapper.update(dict( laserpower=lambda column: self.powerBtnMapper.addMapping(self.ui.powerBtn, column), lasergate=lambda column: self.gateBtnMapper.addMapping(self.ui.gateBtn, column), pilotlaser=lambda column: self.pilotBtnMapper.addMapping(self.ui.pilotBtn, column), ))
def __init__(self, config, driver, uifile="", parent=None): super(WatlowController, self).__init__(config, driver, uifile, parent) self.ui.initCombo = QtGui.QComboBox(self.ui) self.ui.initCombo.addItems([ "no ramp", "on startup", "on setpoint change" ]) self.ui.rateEdit = QtGui.QSpinBox(self.ui) self.ui.rateEdit.setRange(0, 9999) self.ui.initCombo.currentIndexChanged[str].connect( self._disableRateEditOnNoRamp) self.ui.rampSettings = QtGui.QWidget(self.ui) self.ui.instrumentPanel.layout().addWidget(self.ui.rampSettings) self.ui._layout = QtGui.QHBoxLayout(self.ui.rampSettings) self.ui._layout.addWidget(self.ui.initCombo) self.ui._layout.addWidget(self.ui.rateEdit) self.programPool.default_factory = WatlowProgram self._rampInitValuePool = {} self._rateValuePool = {} self._specialColumnMapper.update(dict( rampinit=self.setRampInitColumn, ramprate=self.setRampRateColumn)) self._rampInitColumn = None self._rampRateColumn = None self.rampInitMapper = QtGui.QDataWidgetMapper(self) self.rampInitMapper.setModel(self._driverModel) self.rampInitMapper.setItemDelegate(_ComboBoxDelegate(self)) self.ui.driverView.selectionModel().currentRowChanged.connect( self.rampInitMapper.setCurrentModelIndex) self.populated.connect(self.rampInitMapper.toFirst) self.ui.initCombo.currentIndexChanged[int].connect( self.rampInitMapper.submit) self.rateEditMapper = QtGui.QDataWidgetMapper(self) self.rateEditMapper.setModel(self._driverModel) self.ui.driverView.selectionModel().currentRowChanged.connect( self.rateEditMapper.setCurrentModelIndex) self.populated.connect(self.rampInitMapper.toFirst) self.ui.rateEdit.valueChanged.connect(self.rateEditMapper.submit)
def __init__(self, parent=None): super(DurationBandwidthEditor, self).__init__(parent) from labrad.units import WithUnit self.WithUnit = WithUnit self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper(self) self._dataMapper.setItemDelegate(parameter_delegate(self)) self.connect_signals()
def __init__(self, parent=None): super(lightBase, self).__init__(parent) self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper() for i in LIGHT_SHAPES.names: if i != "End": self.uiShape.addItem(i)
def __init__(self, parent, readOnly=True): super(cFeatureDetailsView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self)) self.mapper.setModel(cFeatureModel()) self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit) columns = self.mapper.model().getColumns() lbl = self.mapper.model().getLabel layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0) layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0) layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0) layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0) layout.addWidget(QtGui.QLabel(lbl("risk")), 3, 2) layout.addWidget(QtGui.QLabel(lbl("status")), 3, 4) lblDescription = self.makeEditLinkLabel("description", readOnly) lblDescription.linkActivated.connect(self.sendEditSignal) layout.addWidget(lblDescription, 4, 0) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=readOnly) cbxKeywords = QtGui.QComboBox(self, enabled=not readOnly, editable=True) cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view')) cbxPriority = QtGui.QComboBox(self, enabled=not readOnly) cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT')) cbxStatus = QtGui.QComboBox(self, enabled=not readOnly) cbxStatus.setModel(self.mapper.model().getLookupModel('statusLUT')) cbxRisk = QtGui.QComboBox(self, enabled=not readOnly) cbxRisk.setModel(self.mapper.model().getLookupModel('riskLUT')) tedDescription = _naf_textviewer.cTextEditor(self, readOnly=readOnly) tedDescription.setImageProvider(nafdb.getImageForId) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledId, 0, 1, 1, 5) layout.addWidget(ledTitle, 1, 1, 1, 5) layout.addWidget(cbxKeywords, 2, 1, 1, 5) layout.addWidget(cbxPriority, 3, 1, 1, 1) layout.addWidget(cbxRisk, 3, 3, 1, 1) layout.addWidget(cbxStatus, 3, 5, 1, 1) layout.addWidget(tedDescription, 4, 1, 1, 5) layout.setColumnStretch(1, 1) layout.setColumnStretch(3, 1) layout.setColumnStretch(5, 1) layout.setRowStretch(4, 1) self.mapper.addMapping(ledId, columns.index('id')) self.mapper.addMapping(ledTitle, columns.index('title')) self.mapper.addMapping(cbxKeywords, columns.index('keywords')) self.mapper.addMapping(cbxPriority, columns.index('priority')) self.mapper.addMapping(cbxStatus, columns.index('status')) self.mapper.addMapping(cbxRisk, columns.index('risk')) self.mapper.addMapping(tedDescription, columns.index('description'))
def __init__(self,parent = None): super(inChannelBase,self).__init__(parent) self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper(self) self.ui_range.clear() self.ui_range.addItems(DAQ_RANGES.names) self.ui_polarity.clear() self.ui_polarity.addItems(POLARITIES.names) self.ui_function.clear() self.ui_function.addItems(FANS_AI_FUNCTIONS.names)
def __init__(self, parent=None): super(EditWidget, self).__init__(parent) # Widgets self.list_view = QtGui.QListView() self.base_combo = UuidComboBox() self.counter_combo = UuidComboBox() new_button = QtGui.QPushButton( QtCore.QCoreApplication.translate('EditWidget', "new")) delete_button = QtGui.QPushButton( QtCore.QCoreApplication.translate('EditWidget', "remove")) layout = QtGui.QGridLayout() layout.addWidget(self.list_view, 0, 0, 2, 1) combo_layout = QtGui.QFormLayout() combo_layout.addRow( QtCore.QCoreApplication.translate('EditWidget', "base"), self.base_combo) combo_layout.addRow( QtCore.QCoreApplication.translate('EditWidget', "counter"), self.counter_combo) layout.addLayout(combo_layout, 0, 1, 1, 2) layout.addWidget(new_button, 1, 1) layout.addWidget(delete_button, 1, 2) self.setLayout(layout) # Model self.list_view.setModel(tulpenmanie.market.model) self.list_view.setModelColumn(tulpenmanie.market.model.NAME) self.base_combo.setModel(tulpenmanie.commodity.model) self.base_combo.setModelColumn(tulpenmanie.commodity.model.NAME) self.counter_combo.setModel(tulpenmanie.commodity.model) self.counter_combo.setModelColumn(tulpenmanie.commodity.model.NAME) self.mapper = QtGui.QDataWidgetMapper(self) self.mapper.setModel(tulpenmanie.market.model) self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.AutoSubmit) self.mapper.addMapping(self.base_combo, tulpenmanie.market.model.BASE, 'currentUuid') self.mapper.addMapping(self.counter_combo, tulpenmanie.market.model.COUNTER, 'currentUuid') # Connections self.list_view.clicked.connect(self._market_changed) new_button.clicked.connect(self._new) delete_button.clicked.connect(self._delete) # Load data self.list_view.setCurrentIndex( tulpenmanie.market.model.index(0, tulpenmanie.market.model.NAME)) self.mapper.toFirst()
def __init__(self, parent = None): super(acquisitionSettingsBase,self).__init__(parent) self.setupUi(self) self.amplifier.addItems(["1","2","5"]) self.pgaGain.addItems(PGA_GAINS.names) self.filterGain.addItems(FILTER_GAINS.names) self.filterCutoff.addItems(FILTER_CUTOFF_FREQUENCIES.names) self._dataMapper = QtGui.QDataWidgetMapper()
def __init__(self, parent=None): super(EditWidget, self).__init__(parent) # Widgets self.list_view = QtGui.QListView() prefix_edit = QtGui.QLineEdit() prefix_edit.setToolTip(u"optional, eg. $, €") suffix_edit = QtGui.QLineEdit() suffix_edit.setToolTip("optional, eg. kg, lb") precision_spin = QtGui.QSpinBox() precision_spin.setValue(3) precision_spin.setMinimum(-99) precision_spin.setToolTip( """Decimal precision used to display quantities and prices.\n""" """A negative precision is not recommended.""") new_button = QtGui.QPushButton("new") delete_button = QtGui.QPushButton("delete") edit_layout = QtGui.QFormLayout() edit_layout.addRow("prefix:", prefix_edit) edit_layout.addRow("suffix:", suffix_edit) edit_layout.addRow("display precision:", precision_spin) layout = QtGui.QGridLayout() layout.addWidget(self.list_view, 0, 0, 2, 1) layout.addLayout(edit_layout, 0, 1, 1, 2) layout.addWidget(new_button, 1, 1) layout.addWidget(delete_button, 1, 2) self.setLayout(layout) # Model self.list_view.setModel(tulpenmanie.commodity.model) self.list_view.setModelColumn(tulpenmanie.commodity.model.NAME) self.mapper = QtGui.QDataWidgetMapper(self) self.mapper.setModel(tulpenmanie.commodity.model) self.mapper.addMapping(prefix_edit, tulpenmanie.commodity.model.PREFIX) self.mapper.addMapping(suffix_edit, tulpenmanie.commodity.model.SUFFIX) self.mapper.addMapping(precision_spin, tulpenmanie.commodity.model.PRECISION) # Connect self.list_view.clicked.connect(self.mapper.setCurrentModelIndex) new_button.clicked.connect(self._new) delete_button.clicked.connect(self._delete) # Select self.list_view.setCurrentIndex( tulpenmanie.commodity.model.index( 0, tulpenmanie.commodity.model.NAME)) self.mapper.toFirst()
def __init__(self, parent, admin): QtGui.QWidget.__init__(self, parent) self._admin = admin widget_mapper = QtGui.QDataWidgetMapper(self) widget_mapper.setObjectName('widget_mapper') widget_layout = QtGui.QHBoxLayout() widget_layout.setSpacing(0) widget_layout.setMargin(0) self._index = 0 self._model = None self._form = None self._columns = None self._delegate = None self.setLayout(widget_layout)
def setUp( self ): super( FormActionsCase, self ).setUp() from camelot.model.party import Person from camelot.admin.application_admin import ApplicationAdmin self.query_proxy_case = test_proxy.QueryProxyCase('setUp') self.query_proxy_case.setUp() self.app_admin = ApplicationAdmin() self.model_context = MockModelContext() self.model_context.obj = Person.query.first() self.model_context.admin = self.app_admin.get_related_admin( Person ) self.gui_context = form_action.FormActionGuiContext() self.gui_context._model = self.query_proxy_case.proxy self.gui_context.widget_mapper = QtGui.QDataWidgetMapper() self.gui_context.widget_mapper.setModel( self.query_proxy_case.proxy ) self.gui_context.admin = self.app_admin.get_related_admin( Person )
def __init__(self, parent=None): super(base, self).__init__(parent) self.setupUi(self) self.db = QtSql.QSqlDatabase.addDatabase("QSQLITE") self.db.setDatabaseName("test.db") self.db.open() self.mdl = QtSql.QSqlTableModel(self, self.db) self.mdl.setTable("distinctpackets") self.mdl.setEditStrategy(QtSql.QSqlTableModel.OnFieldChange) self.mdl.select() self.proxymdl = QtGui.QSortFilterProxyModel(self) self.proxymdl.setSourceModel(self.mdl) self.proxymdl.setFilterKeyColumn(3) self.proxymdl.setDynamicSortFilter(True) self.uiView.setModel(self.proxymdl) self.uiView.setColumnWidth(0, 50) self.uiView.resizeColumnToContents(1) self.uiView.resizeColumnToContents(2) #self.uiView.setColumnWidth(1, 70) #self.uiView.setColumnWidth(2, 60) self.uiView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.uiView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.uiView.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.uiView.horizontalHeader().setStretchLastSection(True) self.uiView.setSortingEnabled(True) self.mapper = QtGui.QDataWidgetMapper(self) self.mapper.setModel(self.proxymdl) self.mapper.addMapping(self.uiDateTime, 1) self.mapper.addMapping(self.uiDirection, 2) self.mapper.addMapping(self.uiType, 3) self.mapper.addMapping(self.uiPacket, 4) self.mapper.toFirst() self.connect(self.uiView.selectionModel(), SIGNAL("currentChanged(QModelIndex, QModelIndex)"), self.mapper.setCurrentModelIndex) self.btnPrev.clicked.connect(self.toPrevious) self.btnNext.clicked.connect(self.toNext) self.btnInsert.clicked.connect(self.addItem) self.btnRemove.clicked.connect(self.removeRow) self.lineEdit.textChanged.connect(self.proxymdl.setFilterRegExp) self.query = QtSql.QSqlQuery(self.db)
def __init__(self, parent, admin): QtGui.QWidget.__init__(self, parent) self._admin = admin widget_mapper = QtGui.QDataWidgetMapper(self) widget_mapper.setObjectName('widget_mapper') if self._admin.get_save_mode() == 'on_leave': widget_mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit) widget_layout = QtGui.QHBoxLayout() widget_layout.setSpacing(0) widget_layout.setContentsMargins(0, 0, 0, 0) self._index = 0 self._model = None self._form = None self._columns = None self._delegate = None self.setLayout(widget_layout)
def __init__(self, parent=None): super(Window, self).__init__(parent) # Set up the model. self.setupModel() # Set up the widgets. nameLabel = QtGui.QLabel("Na&me:") nameEdit = QtGui.QLineEdit() addressLabel = QtGui.QLabel("&Address:") addressEdit = QtGui.QTextEdit() typeLabel = QtGui.QLabel("&Type:") typeComboBox = QtGui.QComboBox() self.nextButton = QtGui.QPushButton("&Next") self.previousButton = QtGui.QPushButton("&Previous") nameLabel.setBuddy(nameEdit) addressLabel.setBuddy(addressEdit) typeLabel.setBuddy(typeComboBox) typeComboBox.setModel(self.typeModel) # Set up the mapper. self.mapper = QtGui.QDataWidgetMapper(self) self.mapper.setModel(self.model) self.mapper.addMapping(nameEdit, 0) self.mapper.addMapping(addressEdit, 1) self.mapper.addMapping(typeComboBox, 2, 'currentIndex') # Set up connections and layouts. self.previousButton.clicked.connect(self.mapper.toPrevious) self.nextButton.clicked.connect(self.mapper.toNext) self.mapper.currentIndexChanged.connect(self.updateButtons) layout = QtGui.QGridLayout() layout.addWidget(nameLabel, 0, 0, 1, 1) layout.addWidget(nameEdit, 0, 1, 1, 1) layout.addWidget(self.previousButton, 0, 2, 1, 1) layout.addWidget(addressLabel, 1, 0, 1, 1) layout.addWidget(addressEdit, 1, 1, 2, 1) layout.addWidget(self.nextButton, 1, 2, 1, 1) layout.addWidget(typeLabel, 3, 0, 1, 1) layout.addWidget(typeComboBox, 3, 1, 1, 1) self.setLayout(layout) self.setWindowTitle("Delegate Widget Mapper") self.mapper.toFirst()
def __init__(self, parent, model): super(cTestsuiteView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setModel(model) layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "title")), 0, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "id")), 1, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "keywords")), 2, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "description"), alignment=Qt.AlignTop), 3, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "execorder")), 4, 0) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=True) ledKeywords = QtGui.QLineEdit(self, readOnly=True) tedDescription = _oatr_commons.getTextViewer(self) ledExecorder = QtGui.QLineEdit(self, readOnly=True) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledTitle, 0, 1, 1, 1) layout.addWidget(ledId, 1, 1, 1, 1) layout.addWidget(ledKeywords, 2, 1, 1, 1) layout.addWidget(tedDescription, 3, 1, 1, 1) layout.addWidget(ledExecorder, 4, 1, 1, 1) layout.setColumnStretch(1, 1) layout.setRowStretch(3, 2) self.mapper.addMapping(ledId, model.fieldIndex('id')) self.mapper.addMapping(ledTitle, model.fieldIndex('title')) self.mapper.addMapping(ledKeywords, model.fieldIndex('keywords')) self.mapper.addMapping(tedDescription, model.fieldIndex('description')) self.mapper.addMapping(ledExecorder, model.fieldIndex('execorder'))
def __init__(self, parent, isEditable=False): super(cSimplesectionView, self).__init__(parent) self.defaultTitle = self.tr("New Text Section") self.editTitle = self.tr("Edit text section") self.detailsView = self self.mapper = QtGui.QDataWidgetMapper() self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self)) self.mapper.setModel(cSimplesectionModel()) self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit) columns = self.mapper.model().getColumns() lbl = self.mapper.model().getLabel layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0) layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0) layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0) lblContent = self.makeEditLinkLabel("content", not isEditable) lblContent.linkActivated.connect(self.sendEditSignal) layout.addWidget(lblContent, 3, 0) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=not isEditable) cbxKeywords = QtGui.QComboBox(self, enabled=isEditable, editable=True) cbxKeywords.setModel( self.mapper.model().getHistoryModel('keywords_view')) tedContent = _naf_textviewer.cTextEditor(self, readOnly=not isEditable) tedContent.setImageProvider(nafdb.getImageForId) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledId, 0, 1, 1, 3) layout.addWidget(ledTitle, 1, 1, 1, 3) layout.addWidget(cbxKeywords, 2, 1, 1, 3) layout.addWidget(tedContent, 3, 1, 1, 3) layout.setColumnStretch(1, 1) layout.setColumnStretch(3, 1) self.mapper.addMapping(ledId, columns.index('id')) self.mapper.addMapping(ledTitle, columns.index('title')) self.mapper.addMapping(cbxKeywords, columns.index('keywords')) self.mapper.addMapping(tedContent, columns.index('content'))
def __init__(self, parent, isEditable=False): super(QtGui.QWidget, self).__init__(parent) self.defaultTitle = self.tr("New folder") self.detailsView = self self.mapper = QtGui.QDataWidgetMapper() self.mapper.setModel(cFolderModel()) self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit) columns = self.mapper.model().getColumns() lbl = self.mapper.model().getLabel layout = QtGui.QFormLayout() self.setLayout(layout) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=not isEditable) layout.addRow(QtGui.QLabel(lbl("id")), ledId) layout.addRow(QtGui.QLabel(lbl("title")), ledTitle) self.mapper.addMapping(ledId, columns.index('id')) self.mapper.addMapping(ledTitle, columns.index('title'))
def __init__(self, parent=None): super(EditDialog, self).__init__(parent) # Widgets self.list_view = CommoditiesListView() prefix_edit = QtGui.QLineEdit() prefix_edit.setToolTip("optional, eg. $, €") suffix_edit = QtGui.QLineEdit() suffix_edit.setToolTip("optional, eg. kg, lb") precision_spin = QtGui.QSpinBox() precision_spin.setMinimum(-99) precision_spin.setToolTip( QtCore.QCoreApplication.translate( 'EditWidget', """Decimal precision used to display quantities and prices.\n""" """A negative precision is not recommended.""")) button_box = QtGui.QDialogButtonBox() new_button = button_box.addButton( QtCore.QCoreApplication.translate('EditWidget', "&New"), button_box.ActionRole) delete_button = button_box.addButton( QtCore.QCoreApplication.translate('EditWidget', "&Delete"), button_box.ActionRole) save_button = button_box.addButton(button_box.Save) discard_button = button_box.addButton(button_box.Discard) edit_layout = QtGui.QFormLayout() edit_layout.addRow( QtCore.QCoreApplication.translate('EditWidget', "Prefix:"), prefix_edit) edit_layout.addRow( QtCore.QCoreApplication.translate('EditWidget', "Suffix:"), suffix_edit) edit_layout.addRow( QtCore.QCoreApplication.translate('EditWidget', "Display precision:"), precision_spin) layout = QtGui.QGridLayout() layout.addWidget(self.list_view, 0, 0) layout.addLayout(edit_layout, 0, 1) layout.addWidget(button_box, 1, 0, 1, 2) self.setLayout(layout) # Model self.list_view.setModel(dojima.model.commodities.local_model) self.list_view.setModelColumn( dojima.model.commodities.local_model.NAME) self.mapper = QtGui.QDataWidgetMapper(self) self.mapper.setModel(dojima.model.commodities.local_model) self.mapper.addMapping(prefix_edit, dojima.model.commodities.local_model.PREFIX) self.mapper.addMapping(suffix_edit, dojima.model.commodities.local_model.SUFFIX) self.mapper.addMapping(precision_spin, dojima.model.commodities.local_model.PRECISION) # Connect self.list_view.commodityChanged.connect( self.mapper.setCurrentModelIndex) new_button.clicked.connect(self.new) delete_button.clicked.connect(self.delete) save_button.clicked.connect(self.save) discard_button.clicked.connect(self.reject) # Select index = dojima.model.commodities.local_model.index( 0, dojima.model.commodities.local_model.NAME) self.list_view.setCurrentIndex(index) self.mapper.toFirst()
def __init__(self, parent=None): super(transformBase, self).__init__(parent) self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper()
def __init__(self, parent=None): super(EditWidget, self).__init__(parent) list_view = QtGui.QListView() list_view.setModel(exchanges_model) self.stacked_widget = QtGui.QStackedWidget() self.mappers = [] for row in range(exchanges_model.rowCount()): exchange_item = exchanges_model.item(row) exchange_layout = QtGui.QGridLayout() grid_row = 0 mapper = QtGui.QDataWidgetMapper() mapper.setModel(exchanges_model) mapper.setRootIndex(exchange_item.index()) mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.AutoSubmit) self.mappers.append(mapper) for setting, column in exchange_item.mappings: # TODO get required length if any and set that to # the edit length, or make a validator label = QtGui.QLabel(setting) if column in exchange_item.numeric_settings: edit = QtGui.QDoubleSpinBox() elif column in exchange_item.boolean_settings: edit = QtGui.QCheckBox() else: edit = QtGui.QLineEdit() if column in exchange_item.hidden_settings: edit.setEchoMode(QtGui.QLineEdit.Password) exchange_layout.addWidget(label, grid_row, 0) exchange_layout.addWidget(edit, grid_row, 1) grid_row += 1 mapper.addMapping(edit, column) mapper.toFirst() mapper.setCurrentIndex(row) markets_item = exchange_item.child(0, exchange_item.MARKETS) market_layout = QtGui.QGridLayout() for row in range(markets_item.rowCount()): mapper = QtGui.QDataWidgetMapper() mapper.setModel(exchanges_model) mapper.setRootIndex(markets_item.index()) mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.AutoSubmit) self.mappers.append(mapper) check_state = bool( markets_item.child(row, exchange_item.MARKET_ENABLE).text()) remote_label = QtGui.QLabel( markets_item.child(row, exchange_item.MARKET_REMOTE).text()) check_box = QtGui.QCheckBox() market_combo = dojima.ui.widget.UuidComboBox() market_combo.setModel(markets_model) market_combo.setModelColumn(1) market_combo.setEnabled(check_state) check_box.toggled.connect(market_combo.setEnabled) mapper.addMapping(check_box, exchange_item.MARKET_ENABLE) mapper.addMapping(market_combo, exchange_item.MARKET_LOCAL, 'currentUuid') mapper.toFirst() mapper.setCurrentIndex(row) market_layout.addWidget(remote_label, row, 0) market_layout.addWidget(check_box, row, 1) market_layout.addWidget(market_combo, row, 2) markets_widget = QtGui.QWidget() markets_widget.setLayout(market_layout) scroll = QtGui.QScrollArea() scroll.setWidget(markets_widget) exchange_layout.addWidget(scroll, grid_row, 0, 1, 2) exchange_widget = QtGui.QWidget() exchange_widget.setLayout(exchange_layout) self.stacked_widget.addWidget(exchange_widget) layout = QtGui.QHBoxLayout() layout.addWidget(list_view) layout.addWidget(self.stacked_widget) self.setLayout(layout) # Connections list_view.clicked.connect(self._exchange_changed)
def __init__(self, parent=None): super(tooleditBase, self).__init__(parent) self.setupUi(self) self._proxyModel = None self._dataMapper = QtGui.QDataWidgetMapper()
def __init__(self, parent=None): super(StringEditor, self).__init__(parent) self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper(self) self.connect_layout()
def __init__(self, parent=None): super(MyWindow, self).__init__(parent) self.labelRecord = QtGui.QLabel(self) self.pushButtonNext = QtGui.QPushButton(self) self.pushButtonNext.setText("Next!") self.pushButtonNext.clicked.connect(self.on_pushButtonNext_clicked) self.pushButtonPrevious = QtGui.QPushButton(self) self.pushButtonPrevious.setText("Previous!") self.pushButtonPrevious.clicked.connect( self.on_pushButtonPrevious_clicked) self.spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.layoutHorizontal = QtGui.QHBoxLayout() self.layoutHorizontal.addItem(self.spacerItem) self.layoutHorizontal.addWidget(self.pushButtonPrevious) self.layoutHorizontal.addWidget(self.pushButtonNext) self.labelProperty = QtGui.QLabel(self) self.labelProperty.setText("Property") self.labelType = QtGui.QLabel(self) self.labelType.setText("Type") self.checkBoxBool = QtGui.QCheckBox(self) self.checkBoxBool.setText("Bool") self.lineEditProperty = QtGui.QLineEdit(self) self.lineEditType = QtGui.QLineEdit(self) self.standardItemModel = QtGui.QStandardItemModel(self) self.itemDelegate = MyItemDelegate(self) for rowNumber in range(3): items = [] for columnNumber in range(3): itemData = "row: {0} column {1}".format( rowNumber, columnNumber) item = QtGui.QStandardItem( itemData if columnNumber != 2 else str(rowNumber - rowNumber / 2 * 2)) items.append(item) self.standardItemModel.appendRow(items) self.tableView = QtGui.QTableView(self) self.tableView.setModel(self.standardItemModel) self.dataWidgetMapper = QtGui.QDataWidgetMapper(self) self.dataWidgetMapper.setModel(self.standardItemModel) self.dataWidgetMapper.addMapping(self.lineEditProperty, 0) self.dataWidgetMapper.addMapping(self.lineEditType, 1) self.dataWidgetMapper.addMapping(self.checkBoxBool, 2) self.dataWidgetMapper.setItemDelegate(self.itemDelegate) self.dataWidgetMapper.currentIndexChanged.connect( self.on_dataWidgetMapper_currentIndexChanged) self.dataWidgetMapper.toFirst() self.layoutGrid = QtGui.QGridLayout(self) self.layoutGrid.addWidget(self.tableView, 0, 0, 1, 2) self.layoutGrid.addWidget(self.labelRecord, 1, 0, 1, 2) self.layoutGrid.addWidget(self.labelProperty, 2, 0, 1, 1) self.layoutGrid.addWidget(self.lineEditProperty, 2, 1, 1, 1) self.layoutGrid.addWidget(self.labelType, 3, 0, 1, 1) self.layoutGrid.addWidget(self.lineEditType, 3, 1, 1, 1) self.layoutGrid.addWidget(self.checkBoxBool, 4, 1, 1, 1) self.layoutGrid.addLayout(self.layoutHorizontal, 5, 0, 1, 2)
def __init__(self, parent=None): super(BladePyCore, self).__init__(parent) # declaring instance attributes ## This attribute is used all around the code and represents the "working" shape. self.current_h_ais_shape = None ## This attribute is the entity that represents the unity of a case self.case_node = None self.previous_case_node = None ## This attribute is one that is used by the program to tell whether the user is managing a shape or sub-shape self.selectionMode = "something" # change this stuff modificacao ## This attribute is a list that contains all shapes loaded in the program self.master_shape_list = [] self.list_settings = [] self.setupUi(self) self.setWindowTitle("BladePy - Output Viewer") # self.PreferencesManager = PreferencesBladePy(OutputViewerWidget=self) ## This attribute is an object used for managing shape properties self.ShapeManager = ShapeManager(OutputViewerWidget=self) # Setuping GUIs menus self._setGUIMenus() ## This attribute is the object node of all case nodes. self.rootNode = CaseNode("RootNode") ## This attribute is the model object that is the intermediary between the tree view and the case node self.model = CaseModel(self.rootNode, self) self.ui_case_treeview.setModel(self.model) self._dataMapper = QtGui.QDataWidgetMapper() self.ui_case_treeview.clicked.connect(self._setSelection) self.ui_subcase_list.itemClicked.connect(self._surfaceChanged) ## This is the object of the QtViewer of PythonOCC self.canva = customQtViewer3d(self) self.setCentralWidget(self.canva) self.canva.InitDriver() ## This attribute is OCCViewer.Viewer3d(self.GetHandle()), used to manage the 3D graphics. self.display = self.canva._display self.display.set_bg_gradient_color(137, 159, 200, 210, 218, 234) # Get default display Quality ais_context = self.display.GetContext().GetObject() self.DC = ais_context.DeviationCoefficient() self.DC_HLR = ais_context.HLRDeviationCoefficient() # Start linking objects to functions here # show/hide shape self.ui_shape_hide_btn.clicked.connect(self.ShapeManager.hideShape) self.ui_shape_display_btn.clicked.connect( self.ShapeManager.displayShape) # Linking graphic options buttons self.ui_shape_quality_btn.clicked.connect(self.ShapeManager.setQuality) self.ui_shape_settransparency_btn.clicked.connect( self.ShapeManager.setTransparency) self.ui_shape_setcolor_btn.clicked.connect(self.ShapeManager.setColor) # Linking translation and rotation buttons self.ui_shape_settranslation_btn.clicked.connect( self.ShapeManager.setTranslation) # Linking views signals self.ui_display_zoomfactor_dspn.valueChanged.connect( self.setZoomFactor) # Linking misc. functions self.ui_deletecase_btn.clicked.connect(self.deleteCase) # Setuping tecplot widget from tecplot_modules self.TecplotViewerWidget = TecPlotWindow(OutputViewerWidget=self) self.ui_tecplot_widget_vl.addWidget(self.TecplotViewerWidget) # Linking tecplot buttons self.ui_tecplot_setneutral_btn.clicked.connect( self.TecplotViewerWidget.setNeutral) self.ui_tecplot_setinvisible_btn.clicked.connect( self.TecplotViewerWidget.setVisibility) self.ui_tecplot_toggle_meanlines_btn.clicked.connect( self.TecplotViewerWidget.toggleMeanLines) self.ui_tecplot_toggle_bladeprofiles_btn.clicked.connect( self.TecplotViewerWidget.toggleBladeProfiles) # Setuping input writer widget from module. Linking signals self.InputWriterWidget = InputWriterWindow(OutputViewerWidget=self) self.InputWriterWidget.show() # Setuping default options self.PreferencesManager.applyAction()
def __init__(self, parent=None): super(UndefinedParameterEditor, self).__init__(parent) self._dataMapper = QtGui.QDataWidgetMapper(self) self.setupUi(self)
def __init__(self, parent=None): super(line_selection_editor, self).__init__(parent) self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper(self) self._dataMapper.setItemDelegate(line_selection_delegate(self))
def __init__(self, parent, readOnly=True): super(cRequirementDetailsView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self)) self.mapper.setModel(cRequirementModel()) self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit) columns = self.mapper.model().getColumns() lbl = self.mapper.model().getLabel layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0) layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0) layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0) layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0) layout.addWidget(QtGui.QLabel(lbl("status")), 3, 2) layout.addWidget(QtGui.QLabel(lbl("complexity")), 5, 0) layout.addWidget(QtGui.QLabel(lbl("assigned")), 5, 2) layout.addWidget(QtGui.QLabel(lbl("effort")), 6, 0) layout.addWidget(QtGui.QLabel(lbl("category")), 4, 2) layout.addWidget(QtGui.QLabel(lbl("origin")), 9, 0) layout.addWidget(QtGui.QLabel(lbl("risk")), 4, 0) layout.addWidget(QtGui.QLabel(lbl("baseline")), 6, 2) layout.addWidget(QtGui.QLabel(lbl("testability")), 8, 0) lblRationale = self.makeEditLinkLabel("rationale", readOnly) lblRationale.linkActivated.connect(self.sendEditSignal) lblDescription = self.makeEditLinkLabel("description", readOnly) lblDescription.linkActivated.connect(self.sendEditSignal) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=readOnly) cbxKeywords = QtGui.QComboBox(self, enabled=not readOnly, editable=True) cbxKeywords.setModel( self.mapper.model().getHistoryModel('keywords_view')) tedDescription = _naf_textviewer.cTextEditor(self, readOnly=readOnly) cbxAssigned = QtGui.QComboBox(self, enabled=not readOnly, editable=True) cbxAssigned.setModel( self.mapper.model().getHistoryModel('assigned_view')) tedRationale = _naf_textviewer.cTextEditor(self, readOnly=readOnly) tedRationale.setImageProvider(nafdb.getImageForId) self.mapper.addMapping(tedRationale, columns.index('rationale')) cbxOrigin = QtGui.QComboBox(self, enabled=not readOnly, editable=True) cbxOrigin.setModel(self.mapper.model().getHistoryModel('origin_view')) cbxPriority = QtGui.QComboBox(self, enabled=not readOnly) cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT')) cbxStatus = QtGui.QComboBox(self, enabled=not readOnly) cbxStatus.setModel(self.mapper.model().getLookupModel('statusLUT')) cbxComplexity = QtGui.QComboBox(self, enabled=not readOnly) cbxComplexity.setModel( self.mapper.model().getLookupModel('complexityLUT')) cbxEffort = QtGui.QComboBox(self, enabled=not readOnly) cbxEffort.setModel(self.mapper.model().getLookupModel('effortLUT')) cbxCategory = QtGui.QComboBox(self, enabled=not readOnly) cbxCategory.setModel(self.mapper.model().getLookupModel('categoryLUT')) tedDescription.setImageProvider(nafdb.getImageForId) cbxRisk = QtGui.QComboBox(self, enabled=not readOnly) cbxRisk.setModel(self.mapper.model().getLookupModel('riskLUT')) cbxBaseline = QtGui.QComboBox(self, enabled=not readOnly, editable=True) cbxBaseline.setModel( self.mapper.model().getHistoryModel('baseline_view')) cbxTestability = QtGui.QComboBox(self, enabled=not readOnly, editable=True) cbxTestability.setModel( self.mapper.model().getHistoryModel('testability_view')) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledId, 0, 1, 1, 3) layout.addWidget(ledTitle, 1, 1, 1, 3) layout.addWidget(cbxKeywords, 2, 1, 1, 3) layout.addWidget(cbxPriority, 3, 1, 1, 1) layout.addWidget(cbxRisk, 4, 1, 1, 1) layout.addWidget(cbxComplexity, 5, 1, 1, 1) layout.addWidget(cbxEffort, 6, 1, 1, 1) layout.addWidget(cbxStatus, 3, 3, 1, 1) layout.addWidget(cbxCategory, 4, 3, 1, 1) layout.addWidget(cbxAssigned, 5, 3, 1, 1) layout.addWidget(cbxBaseline, 6, 3, 1, 1) layout.addWidget(lblDescription, 7, 0) layout.addWidget(tedDescription, 7, 1, 1, 3) layout.addWidget(cbxTestability, 8, 1, 1, 3) layout.addWidget(cbxOrigin, 9, 1, 1, 3) layout.addWidget(lblRationale, 10, 0) layout.addWidget(tedRationale, 10, 1, 1, 3) layout.setColumnStretch(1, 1) layout.setColumnStretch(3, 1) layout.setRowStretch(7, 5) layout.setRowStretch(10, 1) self.mapper.addMapping(ledId, columns.index('id')) self.mapper.addMapping(ledTitle, columns.index('title')) self.mapper.addMapping(cbxKeywords, columns.index('keywords')) self.mapper.addMapping(tedDescription, columns.index('description')) self.mapper.addMapping(cbxAssigned, columns.index('assigned')) self.mapper.addMapping(cbxOrigin, columns.index('origin')) self.mapper.addMapping(cbxPriority, columns.index('priority')) self.mapper.addMapping(cbxStatus, columns.index('status')) self.mapper.addMapping(cbxComplexity, columns.index('complexity')) self.mapper.addMapping(cbxEffort, columns.index('effort')) self.mapper.addMapping(cbxCategory, columns.index('category')) self.mapper.addMapping(cbxRisk, columns.index('risk')) self.mapper.addMapping(cbxBaseline, columns.index('baseline')) self.mapper.addMapping(cbxTestability, columns.index('testability'))
def __init__(self,parent = None): super(outChannelBase, self).__init__(parent) self.setupUi(self) self._dataMapper = QtGui.QDataWidgetMapper(self)