def __init__(self, parent): QTable.__init__(self, parent) self.choicesList = QStringList() self.motors = {} self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.setLeftMargin(0) # no vertical header self.setNumCols(5) self.setNumRows(0) self.setVScrollBarMode(QScrollView.AlwaysOff) self.horizontalHeader().setLabel(0, 'Axis') self.horizontalHeader().setLabel(1, 'Motor pos.') self.horizontalHeader().setLabel(2, 'Start pos.') self.horizontalHeader().setLabel(3, 'End pos.') self.horizontalHeader().setLabel(4, 'Nb points') #self.horizontalHeader().setLabel(5, 'Ct. time') self.adjustColumn(2) self.adjustColumn(3) self.adjustColumn(4) self.horizontalHeader().setResizeEnabled(False) #self.adjustColumn(5) self.connect(self, SIGNAL('valueChanged(int, int)'), self.valueChanged)
def __init__(self,parent,*pars): QTable.__init__(self,parent,*pars) # Defaults self.setNumAxes ( 1 ) self.setLeftMargin ( 0 )
def __init__(self, padre, interfazdatos, porterodatos): from Driza.datos.conversion import AgenteConversion self.__portero = porterodatos QTabWidget.__init__(self, padre, "Grid") self.setTabPosition(QTabWidget.Bottom) self.tab = QWidget(self, "tab") tabLayout = QVBoxLayout(self.tab, 11, 6, "tabLayout") self.table1 = QTable(self.tab, "table1") tabLayout.addWidget(self.table1) self.insertTab(self.tab, QString.fromLatin1("&Registros")) self.tab_2 = QWidget(self, "tab_2") tabLayout_2 = QVBoxLayout(self.tab_2, 11, 6, "tabLayout_2") self.table2 = QTable(self.tab_2, "table2") tabLayout_2.addWidget(self.table2) self.insertTab(self.tab_2, QString.fromLatin1("&Variables")) from Driza.iuqt3.vprincipal.dcasos import DCasos self.dcasos = DCasos(self.table1, interfazdatos) self.modoetiqueta = False # Variable que guarda si estamos en modo etiqueta o normal self.__nreg = 10 self.__nvar = 10 self.__idu = interfazdatos self.__init_t_reg() self.__init_t_var() self.__conexiones() self.__agenteconversion = AgenteConversion(self.__idu)
def __init__(self, parent): QTable.__init__(self, parent, 'configurationTable') self.setFrameShape(QTable.ToolBarPanel) self.setFrameShadow(QTable.Sunken) self.setResizePolicy(QTable.Default) self.setLeftMargin(0) self.setNumCols(3) self.setSelectionMode(QTable.NoSelection) self.horizontalHeader().setLabel(0, self.trUtf8('Properties')) self.horizontalHeader().setLabel(1, self.trUtf8('Values')) self.horizontalHeader().setLabel(2, self.trUtf8('')) self.horizontalHeader().setResizeEnabled(False) self.horizontalHeader().setClickEnabled(False) self.horizontalHeader().setMovingEnabled(False) self.setColumnReadOnly(0, 1) # column 0 is read-only self.setColumnReadOnly(0, 2) self.setColumnStretchable(0, 0) self.setColumnStretchable(1, 1) self.setColumnStretchable(2, 0) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.propertyBag = None QObject.connect(self, SIGNAL('valueChanged(int, int)'), self.OnValueChanged)
def __init__(self, parent): QTable.__init__(self, parent) self.motorsList = QStringList() self.motors = {} self.customColumns = {} self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setLeftMargin(0) # no vertical header self.setNumCols(5) self.setNumRows(1) self.setVScrollBarMode(QScrollView.AlwaysOff) self.horizontalHeader().setLabel(0, "Motor") self.horizontalHeader().setLabel(1, "Motor pos.") self.horizontalHeader().setLabel(2, "Start pos.") self.horizontalHeader().setLabel(3, "End pos.") self.horizontalHeader().setLabel(4, "Nb points") self.adjustColumn(2) self.adjustColumn(3) self.adjustColumn(4) self.horizontalHeader().setResizeEnabled(False) QObject.connect(self, SIGNAL("valueChanged(int, int)"), self.valueChanged)
def __init__(self, parent, searchForm, editForm, *args): QTable.__init__(self, parent, *args) self.setSelectionMode(QTable.SingleRow) self.setShowGrid(True) self.app = kuraapp.app self.searchForm = searchForm self.editForm = editForm self.headers = [] self.connect(self, SIGNAL("valueChanged(int, int)"), self.commit) self.setSorting(True)
def addRows(self, rows = 1): row = self.numRows() QTable.setNumRows(self, row + rows) for i in range(rows): self.setItem(row + i, 0, QComboTableItem(self, self.motorList)) self.setItem(row + i, 1, MotorPositionReminder(self)) self.adjustColumn(1) self.updateGeometry()
def setNumAxes(self,naxes): self.naxes = naxes self.current = [0,] * self.naxes self.states = [None,] * self.naxes self.nfilt = [2,] * self.naxes QTable.setNumCols( self, self.naxes ) self.header = self.horizontalHeader() self.header.setClickEnabled( 0 ) self.current = [0,] * self.naxes self.states = [ON,] * self.naxes self.nfilt = [2,] * self.naxes
def setFilters(self,axisno,filters): self.nfilt[axisno] = len(filters) nrows = reduce( lambda a,b: a>b and a or b, self.nfilt ) QTable.setNumRows( self, nrows ) filtno = 0 for filterlab in filters: self.setItem(filtno, axisno, FilterItem( self, filterlab ) ) self.updateCell( filtno, axisno ) filtno += 1 self.nfilt[axisno] = filtno
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("EvidencesListUI") self.evidences_table = QTable(self,"evidences_table") self.evidences_table.setNumCols(self.evidences_table.numCols() + 1) self.evidences_table.horizontalHeader().setLabel(self.evidences_table.numCols() - 1,self.__tr("Id")) self.evidences_table.setNumCols(self.evidences_table.numCols() + 1) self.evidences_table.horizontalHeader().setLabel(self.evidences_table.numCols() - 1,self.__tr("Path")) self.evidences_table.setGeometry(QRect(20,20,510,360)) self.evidences_table.setMinimumSize(QSize(300,0)) self.evidences_table.setResizePolicy(QTable.AutoOne) self.evidences_table.setVScrollBarMode(QTable.AlwaysOn) self.evidences_table.setNumRows(0) self.evidences_table.setNumCols(2) LayoutWidget = QWidget(self,"layout7") LayoutWidget.setGeometry(QRect(90,400,377,29)) layout7 = QHBoxLayout(LayoutWidget,5,5,"layout7") self.add_button = QPushButton(LayoutWidget,"add_button") layout7.addWidget(self.add_button) spacer = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum) layout7.addItem(spacer) self.delete_button = QPushButton(LayoutWidget,"delete_button") layout7.addWidget(self.delete_button) self.languageChange() self.resize(QSize(555,447).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished)
def endEdit(self, row, col, accept, replace): if col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]["type"] if type == "integer": try: v = int(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid integer value" % value, QMessageBox.Ok, ) accept = False elif type == "float": try: v = float(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid float value" % value, QMessageBox.Ok, ) accept = False return QTable.endEdit(self, row, col, accept, replace)
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("VulnerabilitiesUi") self.t_vulns = QTable(self,"t_vulns") self.t_vulns.setNumCols(self.t_vulns.numCols() + 1) self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,self.__tr("Name")) self.t_vulns.setNumCols(self.t_vulns.numCols() + 1) self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,self.__tr("Refs")) self.t_vulns.setNumCols(self.t_vulns.numCols() + 1) self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,self.__tr("Description")) self.t_vulns.setMinimumSize(QSize(700,0)) self.t_vulns.setResizePolicy(QTable.AutoOne) self.t_vulns.setVScrollBarMode(QTable.AlwaysOn) self.t_vulns.setNumRows(0) self.t_vulns.setNumCols(3) LayoutWidget = QWidget(self,"layout7") LayoutWidget.setGeometry(QRect(90,500,450,29)) layout7 = QHBoxLayout(LayoutWidget,5,5,"layout7") self.add_button = QPushButton(LayoutWidget,"add_button") layout7.addWidget(self.add_button) spacer6_2 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum) layout7.addItem(spacer6_2) self.edit_button = QPushButton(LayoutWidget,"edit_button") layout7.addWidget(self.edit_button) spacer6 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum) layout7.addItem(spacer6) self.delete_button = QPushButton(LayoutWidget,"delete_button") layout7.addWidget(self.delete_button) spacer6_3 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum) layout7.addItem(spacer6_3) self.list_note_button = QPushButton(LayoutWidget,"list_note_button") layout7.addWidget(self.list_note_button) spacer7_3 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum) layout7.addItem(spacer7_3) self.manage_evidence_button = QPushButton(LayoutWidget,"manage_evidence_button") layout7.addWidget(self.manage_evidence_button) self.languageChange() self.resize(QSize(733,550).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished)
def endEdit(self, row, col, accept, replace): if col == 1 and row >= 0: self.item(row, 2).setEnabled(0) if accept: property = self.propertyBag.getProperty(str(self.text(row, 0))) oldValue = property.getUserValue() if property.getType() == 'boolean': property.setValue(self.item(row, 1).isChecked()) elif property.getType() == 'combo': property.setValue(self.item(row, 1).currentText()) else: try: property.setValue(str(self.text(row, 1))) except: logging.getLogger().error('Cannot assign value to property') if property.getUserValue() is None: self.setText(row, 1, '') else: self.setText(row, 1, str(property.getUserValue())) if not oldValue == property.getUserValue(): self.emit(PYSIGNAL('propertyChanged'), (property.getName(), oldValue, property.getUserValue(), )) return QTable.endEdit(self, row, col, accept, replace)
def addRows(self, rows=1): row = self.numRows() QTable.setNumRows(self, row + rows) for i in range(rows): for col in self.customColumns: if self.customColumns[col]["type"] == "combo": optList = QStringList() try: for opt in self.customColumns[col]["opt"]: optList.append(str(opt)) except BaseException: raise self.setItem(row + i, col, QComboTableItem(self, optList)) self.adjustColumn(col) self.updateGeometry()
def addRows(self, rows=1): row = self.numRows() QTable.setNumRows(self, row + rows) for i in range(rows): self.setItem(row + i, 0, QComboTableItem(self, self.motorsList)) self.setItem(row + i, 1, MotorPositionReminder(self)) for col in self.customColumns: if self.customColumns[col]["type"] == "combo": optList = QStringList() try: for opt in self.customColumns[col]["opt"]: optList.append(str(opt)) except BaseException: pass self.setItem(row + i, col, QComboTableItem(self, optList)) self.adjustColumn(1) self.updateGeometry()
def __init__(self, parent = None, name = "parameter_table"): QWidget.__init__(self, parent, name) self.__dc_parameters = None self.add_dc_cb = None self.parameters_label = QLabel(self, "parameters_label") self.parameter_table = QTable(self, "parameter_table") self.parameter_table.setNumCols(3) self.parameter_table.horizontalHeader().\ setLabel(0, self.__tr("Name"), -1) self.parameter_table.horizontalHeader().\ setLabel(1, self.__tr("Value")) self.parameter_table.verticalHeader().hide() self.parameter_table.horizontalHeader().setClickEnabled(False, 0); self.parameter_table.horizontalHeader().setClickEnabled(False, 1); self.parameter_table.setColumnWidth(0, 200) self.parameter_table.setColumnWidth(1, 200) self.parameter_table.hideColumn(2) self.parameter_table.setColumnReadOnly(0, True) self.parameter_table.setLeftMargin(0) self.parameter_table.setNumRows(0) self.position_label = QLabel("Positions", self, "position_view") self.position_label.setAlignment(Qt.AlignTop) ## self.add_button = QPushButton(self, "add_button") #self.add_button.setDisabled(True) h_layout = QGridLayout(self, 1, 2) v_layout_position = QVBoxLayout(self) v_layout_position.addWidget(self.position_label) v_layout_table = QVBoxLayout(self) h_layout.addLayout(v_layout_table, 0, 0) h_layout.addLayout(v_layout_position, 0, 1) v_layout_table.addWidget(self.parameters_label) v_layout_table.addWidget(self.parameter_table) ## v_layout_table.addWidget(self.add_button) ## self.languageChange() ## QObject.connect(self.add_button, SIGNAL("clicked()"), ## self.__add_data_collection) QObject.connect(self.parameter_table, SIGNAL("valueChanged(int, int)"), self.__parameter_value_change)
def __init__(self, *args): QDialog.__init__(self, *args) self.setCaption("%s - channel properties" % str(self.name())) self.innerbox = QSplitter(Qt.Horizontal, self) grid = QGrid(2, self.innerbox) grid.setSpacing(5) grid.setMargin(5) QLabel("Label", grid) self.txtLabel = QLineEdit(grid) QLabel("Label position", grid) labelpos_group = QVButtonGroup(grid) self.optLabelAbove = QRadioButton("above", labelpos_group) self.optLabelLeft = QRadioButton("on the left", labelpos_group) self.optLabelLeft.setChecked(True) QLabel("Label alignment", grid) labelalign_group = QHButtonGroup(grid) self.optLabelAlignLeft = QRadioButton("left", labelalign_group) self.optLabelAlignCenter = QRadioButton("centre", labelalign_group) self.optLabelAlignRight = QRadioButton("right", labelalign_group) self.optLabelAlignLeft.setChecked(True) QLabel("Value display format", grid) self.txtFormat = QLineEdit(grid) QLabel("Value display style", grid) self.lstChannelStyles = QComboBox(grid) self.lstChannelStyles.insertStrList(["LCD", "label", "combo", "editable"]) QObject.connect(self.lstChannelStyles, SIGNAL('activated(int)'), self.lstChannelStylesChanged) self.combopanel = QHBox(self.innerbox) self.tblComboChoices = QTable(self.combopanel) self.tblComboChoices.setNumCols(2) self.tblComboChoices.setNumRows(10) for i in range(10): self.tblComboChoices.verticalHeader().setLabel(i, "%2.0f" % (i+1)) self.tblComboChoices.setText(i, 0, "%2.0f" % (i+1)) self.tblComboChoices.horizontalHeader().setLabel(0, "value") self.tblComboChoices.horizontalHeader().setLabel(1, "label") self.combopanel.hide() ok_cancel = QHBox(self) self.cmdOk = QPushButton("ok", ok_cancel) HorizontalSpacer(ok_cancel) self.cmdCancel = QPushButton("cancel", ok_cancel) QObject.connect(self.cmdOk, SIGNAL("clicked()"), self.accept) QObject.connect(self.cmdCancel, SIGNAL("clicked()"), self.reject) QVBoxLayout(self, 5, 10) self.layout().addWidget(self.innerbox) self.layout().addWidget(ok_cancel)
def __init__(self, parent): QTable.__init__(self, parent) self.customColumns = {} self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setLeftMargin(0) # no vertical header QTable.setNumCols(self, 0) QTable.setNumRows(self, 0) self.setVScrollBarMode(QScrollView.AlwaysOff) self.horizontalHeader().setResizeEnabled(False)
def endEdit(self, row, col, accept, replace): if col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]['type'] if type == 'integer': try: v = int(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid integer value' % value, QMessageBox.Ok) accept = False elif type == 'float': try: v = float(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid float value' % value, QMessageBox.Ok) accept = False return QTable.endEdit(self, row, col, accept, replace)
def __init__(self,parent = None,name = None,fl = 0): QWidget.__init__(self,parent,name,fl) if not name: self.setName("Canvasinfo") self.canvaslabels = QTable(self,"canvaslabels") self.canvaslabels.setNumCols(2) self.canvaslabels.horizontalHeader().setLabel(0,"X") self.canvaslabels.horizontalHeader().setLabel(1,"Y") self.canvaslabels.setNumRows(5) for i in range (5): self.canvaslabels.verticalHeader().setLabel(i, QIconSet(QPixmap(sys.path[0]+"/larm_utilities/sprite%d.png" % (i + 1))),QString.null) self.canvaslabels.setGeometry(QRect(0,20,300,128)) self.canvaslabels.setCursor(QCursor(13)) self.canvaslabels.setFocusPolicy(QTable.NoFocus) self.canvaslabels.setFrameShape(QTable.StyledPanel) self.canvaslabels.setResizePolicy(QTable.AutoOne) self.canvaslabels.setReadOnly(1) self.canvaslabels.setSelectionMode(QTable.NoSelection) self.canvaslabels.setFocusStyle(QTable.FollowStyle) self.label = QLabel(self,"label") self.label.setGeometry(QRect(0,0,300,20)) self.label.setPaletteForegroundColor(QColor('gold')) label_font = QFont(self.label.font()) label_font.setFamily("Pigiarniq Heavy") self.label.setFont(label_font) self.label.setAlignment(Qt.AlignCenter) self.canvaslabels.setPaletteBackgroundColor(QColor(50, 50, 50)) self.canvaslabels.setPaletteForegroundColor(QColor('gold')) self.canvaslabels.setColumnWidth(0, 132) self.canvaslabels.setColumnWidth(1, 132) self.canvaslabels.setShowGrid(False) self.clearWState(Qt.WState_Polished) self.connect(self,PYSIGNAL("showMachineLabel"),self.updateLabels) self.connect(self,PYSIGNAL("hideMachineLabel"),self.deleteLabels)
def endEdit(self, row, col, accept, replace): if col == 2: # start pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) < lowlimit: raise except: QMessageBox.warning(None, 'Invalid value', 'Cannot set start pos. below low limit %f' % lowlimit, QMessageBox.Ok) accept = False elif col == 3: # end pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) > highlimit: raise except: QMessageBox.warning(None, 'Invalid value', 'Cannot set end pos. beyond high limit %f' % highlimit, QMessageBox.Ok) accept = False elif col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]['type'] if type == 'integer': try: v = int(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid integer value' % value, QMessageBox.Ok) accept = False elif type == 'float': try: v = float(value) except: QMessageBox.warning(None, 'Invalid value', '%s is not a valid float value' % value, QMessageBox.Ok) accept = False return QTable.endEdit(self, row, col, accept, replace)
def __init__(self, row, col, routeToSelf = True, parent = None,name = None,fl = 0): QWidget.__init__(self,parent,name,fl) if not name: self.setName("Form4") self.routeToSelf = routeToSelf self.empty_cells = [] self.currentvalue = None #holds current slider value self.table1 = QTable(self,"table1") self.table1.setPaletteBackgroundColor(QColor(0,0,0)) self.table1.viewport().setPaletteBackgroundColor(QColor(0,0,0)) self.table1.setResizePolicy(QTable.AutoOne) self.table1.setVScrollBarMode(QTable.AlwaysOff) for r in range(self.table1.numRows()): self.table1.setRowHeight(r, 18) self.table1.setRowStretchable(r, False) pr = Param()#Holding param self.root_param.insertChild(pr) self.params.append(pr) for c in range(self.table1.numCols()): if r == 0: self.table1.setColumnWidth(c, self.columnwidth) if self.routeToSelf is True or r is not c: p = Param(type=float) pr.insertChild(p) self.table1.setCellWidget(r, c, ParamProgress(p, self.table1)) else: #do nothing #self.params[r].append(-1) self.empty_cells.append((r, c)) self.table1.setHScrollBarMode(QTable.AlwaysOff) self.table1.setShowGrid(0) self.table1.setReadOnly(1) self.table1.setSelectionMode(QTable.NoSelection) self.table1.setFocusPolicy(QWidget.NoFocus) self.root_param = Param() self.params = [] #holds all parent Params self.columnwidth = 50 self.setsize(row, col) self.adjustSize()
class EventGeneratorForm(QMainWindow): def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar() if not name: self.setName("EventGeneratorForm") self.setCentralWidget(QWidget(self,"qt_central_widget")) EventGeneratorFormLayout = QHBoxLayout(self.centralWidget(),11,6,"EventGeneratorFormLayout") layout9 = QVBoxLayout(None,0,6,"layout9") self.groupBox4 = QGroupBox(self.centralWidget(),"groupBox4") self.groupBox4.setColumnLayout(0,Qt.Vertical) self.groupBox4.layout().setSpacing(6) self.groupBox4.layout().setMargin(11) groupBox4Layout = QGridLayout(self.groupBox4.layout()) groupBox4Layout.setAlignment(Qt.AlignTop) self.mxcTable = QTable(self.groupBox4,"mxcTable") self.mxcTable.setNumCols(self.mxcTable.numCols() + 1) self.mxcTable.horizontalHeader().setLabel(self.mxcTable.numCols() - 1,self.__tr("Prescaler")) self.mxcTable.setNumCols(self.mxcTable.numCols() + 1) self.mxcTable.horizontalHeader().setLabel(self.mxcTable.numCols() - 1,self.__tr("Trigger")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("0")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("1")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("2")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("3")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("4")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("5")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("6")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("7")) self.mxcTable.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding,0,0,self.mxcTable.sizePolicy().hasHeightForWidth())) self.mxcTable.setNumRows(8) self.mxcTable.setNumCols(2) groupBox4Layout.addWidget(self.mxcTable,0,0) layout9.addWidget(self.groupBox4) self.groupBox6 = QGroupBox(self.centralWidget(),"groupBox6") self.groupBox6.setColumnLayout(0,Qt.Vertical) self.groupBox6.layout().setSpacing(0) self.groupBox6.layout().setMargin(11) groupBox6Layout = QGridLayout(self.groupBox6.layout()) groupBox6Layout.setAlignment(Qt.AlignTop) self.enev_1 = QPushButton(self.groupBox6,"enev_1") self.enev_1.setToggleButton(1) groupBox6Layout.addMultiCellWidget(self.enev_1,1,2,0,0) self.enev_2 = QPushButton(self.groupBox6,"enev_2") self.enev_2.setToggleButton(1) groupBox6Layout.addWidget(self.enev_2,3,0) self.enev_5 = QPushButton(self.groupBox6,"enev_5") self.enev_5.setToggleButton(1) groupBox6Layout.addWidget(self.enev_5,6,0) self.enev_6 = QPushButton(self.groupBox6,"enev_6") self.enev_6.setToggleButton(1) groupBox6Layout.addWidget(self.enev_6,7,0) self.enev_7 = QPushButton(self.groupBox6,"enev_7") self.enev_7.setToggleButton(1) groupBox6Layout.addWidget(self.enev_7,8,0) self.enev_4 = QPushButton(self.groupBox6,"enev_4") self.enev_4.setToggleButton(1) groupBox6Layout.addWidget(self.enev_4,5,0) self.enev_3 = QPushButton(self.groupBox6,"enev_3") self.enev_3.setToggleButton(1) groupBox6Layout.addWidget(self.enev_3,4,0) self.enev_0 = QPushButton(self.groupBox6,"enev_0") self.enev_0.setToggleButton(1) groupBox6Layout.addWidget(self.enev_0,0,0) self.trigev_1 = QLineEdit(self.groupBox6,"trigev_1") groupBox6Layout.addWidget(self.trigev_1,2,2) self.trigev_2 = QLineEdit(self.groupBox6,"trigev_2") groupBox6Layout.addWidget(self.trigev_2,3,2) self.trigev_3 = QLineEdit(self.groupBox6,"trigev_3") groupBox6Layout.addWidget(self.trigev_3,4,2) self.trigev_4 = QLineEdit(self.groupBox6,"trigev_4") groupBox6Layout.addWidget(self.trigev_4,5,2) self.trigev_5 = QLineEdit(self.groupBox6,"trigev_5") groupBox6Layout.addWidget(self.trigev_5,6,2) self.trigev_6 = QLineEdit(self.groupBox6,"trigev_6") groupBox6Layout.addWidget(self.trigev_6,7,2) self.trigev_7 = QLineEdit(self.groupBox6,"trigev_7") groupBox6Layout.addWidget(self.trigev_7,8,2) self.trigev_0 = QLineEdit(self.groupBox6,"trigev_0") groupBox6Layout.addWidget(self.trigev_0,0,2) layout9.addWidget(self.groupBox6) self.groupBox9 = QGroupBox(self.centralWidget(),"groupBox9") self.groupBox9.setColumnLayout(0,Qt.Vertical) self.groupBox9.layout().setSpacing(6) self.groupBox9.layout().setMargin(11) groupBox9Layout = QGridLayout(self.groupBox9.layout()) groupBox9Layout.setAlignment(Qt.AlignTop) self.textLabel2_2 = QLabel(self.groupBox9,"textLabel2_2") groupBox9Layout.addWidget(self.textLabel2_2,0,0) self.ckMode = QComboBox(0,self.groupBox9,"ckMode") groupBox9Layout.addWidget(self.ckMode,0,1) self.ckSynth = QComboBox(0,self.groupBox9,"ckSynth") groupBox9Layout.addWidget(self.ckSynth,1,1) self.textLabel4 = QLabel(self.groupBox9,"textLabel4") groupBox9Layout.addWidget(self.textLabel4,1,0) layout9.addWidget(self.groupBox9) EventGeneratorFormLayout.addLayout(layout9) layout8 = QVBoxLayout(None,0,6,"layout8") self.gbDBus = QGroupBox(self.centralWidget(),"gbDBus") self.gbDBus.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Preferred,0,0,self.gbDBus.sizePolicy().hasHeightForWidth())) self.gbDBus.setMinimumSize(QSize(250,0)) self.gbDBus.setColumnLayout(0,Qt.Vertical) self.gbDBus.layout().setSpacing(6) self.gbDBus.layout().setMargin(11) gbDBusLayout = QVBoxLayout(self.gbDBus.layout()) gbDBusLayout.setAlignment(Qt.AlignTop) layout8.addWidget(self.gbDBus) self.groupBox3 = QGroupBox(self.centralWidget(),"groupBox3") self.groupBox3.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Maximum,0,0,self.groupBox3.sizePolicy().hasHeightForWidth())) self.groupBox3.setColumnLayout(0,Qt.Vertical) self.groupBox3.layout().setSpacing(6) self.groupBox3.layout().setMargin(11) groupBox3Layout = QGridLayout(self.groupBox3.layout()) groupBox3Layout.setAlignment(Qt.AlignTop) self.textLabel2 = QLabel(self.groupBox3,"textLabel2") groupBox3Layout.addWidget(self.textLabel2,1,0) self.textLabel1 = QLabel(self.groupBox3,"textLabel1") groupBox3Layout.addWidget(self.textLabel1,0,0) self.acSyncMXC7 = QCheckBox(self.groupBox3,"acSyncMXC7") groupBox3Layout.addMultiCellWidget(self.acSyncMXC7,3,3,0,1) self.acByPass = QCheckBox(self.groupBox3,"acByPass") groupBox3Layout.addWidget(self.acByPass,3,2) self.acDelay = QLineEdit(self.groupBox3,"acDelay") groupBox3Layout.addMultiCellWidget(self.acDelay,1,1,1,2) self.acPrescaler = QLineEdit(self.groupBox3,"acPrescaler") groupBox3Layout.addMultiCellWidget(self.acPrescaler,0,0,1,2) self.textLabel1_3 = QLabel(self.groupBox3,"textLabel1_3") groupBox3Layout.addWidget(self.textLabel1_3,2,0) self.acTrigger = QComboBox(0,self.groupBox3,"acTrigger") groupBox3Layout.addMultiCellWidget(self.acTrigger,2,2,1,2) layout8.addWidget(self.groupBox3) self.groupBox9_2 = QGroupBox(self.centralWidget(),"groupBox9_2") self.groupBox9_2.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Maximum,0,0,self.groupBox9_2.sizePolicy().hasHeightForWidth())) self.groupBox9_2.setColumnLayout(0,Qt.Vertical) self.groupBox9_2.layout().setSpacing(6) self.groupBox9_2.layout().setMargin(11) groupBox9_2Layout = QGridLayout(self.groupBox9_2.layout()) groupBox9_2Layout.setAlignment(Qt.AlignTop) self.fp0 = QComboBox(0,self.groupBox9_2,"fp0") groupBox9_2Layout.addWidget(self.fp0,1,0) self.fp1 = QComboBox(0,self.groupBox9_2,"fp1") groupBox9_2Layout.addWidget(self.fp1,1,1) self.fp2 = QComboBox(0,self.groupBox9_2,"fp2") groupBox9_2Layout.addWidget(self.fp2,2,0) self.fp3 = QComboBox(0,self.groupBox9_2,"fp3") groupBox9_2Layout.addWidget(self.fp3,2,1) self.fp4 = QComboBox(0,self.groupBox9_2,"fp4") groupBox9_2Layout.addWidget(self.fp4,3,0) self.fp5 = QComboBox(0,self.groupBox9_2,"fp5") groupBox9_2Layout.addWidget(self.fp5,3,1) self.fp6 = QComboBox(0,self.groupBox9_2,"fp6") groupBox9_2Layout.addWidget(self.fp6,4,0) self.fp7 = QComboBox(0,self.groupBox9_2,"fp7") groupBox9_2Layout.addWidget(self.fp7,4,1) self.fp8 = QComboBox(0,self.groupBox9_2,"fp8") groupBox9_2Layout.addWidget(self.fp8,5,0) self.fp9 = QComboBox(0,self.groupBox9_2,"fp9") groupBox9_2Layout.addWidget(self.fp9,5,1) self.fp10 = QComboBox(0,self.groupBox9_2,"fp10") groupBox9_2Layout.addWidget(self.fp10,6,0) self.fp11 = QComboBox(0,self.groupBox9_2,"fp11") groupBox9_2Layout.addWidget(self.fp11,6,1) self.fp12 = QComboBox(0,self.groupBox9_2,"fp12") groupBox9_2Layout.addWidget(self.fp12,7,0) self.fp13 = QComboBox(0,self.groupBox9_2,"fp13") groupBox9_2Layout.addWidget(self.fp13,7,1) self.fp14 = QComboBox(0,self.groupBox9_2,"fp14") groupBox9_2Layout.addWidget(self.fp14,8,0) self.fp15 = QComboBox(0,self.groupBox9_2,"fp15") groupBox9_2Layout.addWidget(self.fp15,8,1) self.fp16 = QComboBox(0,self.groupBox9_2,"fp16") groupBox9_2Layout.addWidget(self.fp16,9,0) self.fp17 = QComboBox(0,self.groupBox9_2,"fp17") groupBox9_2Layout.addWidget(self.fp17,9,1) self.fp18 = QComboBox(0,self.groupBox9_2,"fp18") groupBox9_2Layout.addWidget(self.fp18,10,0) self.fp19 = QComboBox(0,self.groupBox9_2,"fp19") groupBox9_2Layout.addWidget(self.fp19,10,1) self.textLabel2_3 = QLabel(self.groupBox9_2,"textLabel2_3") groupBox9_2Layout.addMultiCellWidget(self.textLabel2_3,0,0,0,1) layout8.addWidget(self.groupBox9_2) EventGeneratorFormLayout.addLayout(layout8) layout11 = QVBoxLayout(None,0,6,"layout11") self.groupBox8 = QGroupBox(self.centralWidget(),"groupBox8") self.groupBox8.setEnabled(0) self.groupBox8.setColumnLayout(0,Qt.Vertical) self.groupBox8.layout().setSpacing(6) self.groupBox8.layout().setMargin(11) groupBox8Layout = QGridLayout(self.groupBox8.layout()) groupBox8Layout.setAlignment(Qt.AlignTop) self.dataBufData = QTable(self.groupBox8,"dataBufData") self.dataBufData.setNumRows(self.dataBufData.numRows() + 1) self.dataBufData.verticalHeader().setLabel(self.dataBufData.numRows() - 1,self.__tr("0")) self.dataBufData.setNumRows(1) self.dataBufData.setNumCols(1) groupBox8Layout.addMultiCellWidget(self.dataBufData,2,2,0,2) self.dataBufSize = QLineEdit(self.groupBox8,"dataBufSize") groupBox8Layout.addWidget(self.dataBufSize,1,2) self.textLabel1_2 = QLabel(self.groupBox8,"textLabel1_2") groupBox8Layout.addWidget(self.textLabel1_2,1,1) self.dataBufEnable = QCheckBox(self.groupBox8,"dataBufEnable") groupBox8Layout.addMultiCellWidget(self.dataBufEnable,0,0,0,1) self.dataBuffTrigger = QCheckBox(self.groupBox8,"dataBuffTrigger") groupBox8Layout.addWidget(self.dataBuffTrigger,1,0) self.dataBufMode = QCheckBox(self.groupBox8,"dataBufMode") groupBox8Layout.addWidget(self.dataBufMode,0,2) layout11.addWidget(self.groupBox8) self.groupBox7 = QGroupBox(self.centralWidget(),"groupBox7") self.groupBox7.setColumnLayout(0,Qt.Vertical) self.groupBox7.layout().setSpacing(6) self.groupBox7.layout().setMargin(11) groupBox7Layout = QVBoxLayout(self.groupBox7.layout()) groupBox7Layout.setAlignment(Qt.AlignTop) layout7 = QHBoxLayout(None,0,6,"layout7") self.triggerSeq1 = QPushButton(self.groupBox7,"triggerSeq1") layout7.addWidget(self.triggerSeq1) self.triggerSeq2 = QPushButton(self.groupBox7,"triggerSeq2") layout7.addWidget(self.triggerSeq2) groupBox7Layout.addLayout(layout7) layout11_2 = QHBoxLayout(None,0,6,"layout11_2") self.swEvent = QLineEdit(self.groupBox7,"swEvent") layout11_2.addWidget(self.swEvent) self.sendSwEvent = QPushButton(self.groupBox7,"sendSwEvent") layout11_2.addWidget(self.sendSwEvent) groupBox7Layout.addLayout(layout11_2) layout11.addWidget(self.groupBox7) layout10 = QHBoxLayout(None,0,6,"layout10") self.masterEnable = QCheckBox(self.centralWidget(),"masterEnable") layout10.addWidget(self.masterEnable) self.swEventEnable = QCheckBox(self.centralWidget(),"swEventEnable") layout10.addWidget(self.swEventEnable) layout11.addLayout(layout10) layout12 = QGridLayout(None,1,1,0,6,"layout12") self.editSeq1 = QPushButton(self.centralWidget(),"editSeq1") layout12.addWidget(self.editSeq1,0,0) self.loadConfig = QPushButton(self.centralWidget(),"loadConfig") layout12.addWidget(self.loadConfig,0,1) self.saveConfig = QPushButton(self.centralWidget(),"saveConfig") layout12.addWidget(self.saveConfig,1,1) self.editSeq2 = QPushButton(self.centralWidget(),"editSeq2") layout12.addWidget(self.editSeq2,1,0) self.restoreConfig = QPushButton(self.centralWidget(),"restoreConfig") layout12.addWidget(self.restoreConfig,0,2) self.applyConfig = QPushButton(self.centralWidget(),"applyConfig") layout12.addWidget(self.applyConfig,1,2) layout11.addLayout(layout12) EventGeneratorFormLayout.addLayout(layout11) self.languageChange() self.resize(QSize(795,520).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.restoreConfig,SIGNAL("clicked()"),self.onRestoreConfig) self.connect(self.applyConfig,SIGNAL("clicked()"),self.onApplyConfig) self.connect(self.loadConfig,SIGNAL("clicked()"),self.loadConfig_clicked) self.connect(self.saveConfig,SIGNAL("clicked()"),self.saveConfig_clicked) self.connect(self.dataBufSize,SIGNAL("returnPressed()"),self.dataBufSize_returnPressed) self.connect(self.dataBufSize,SIGNAL("lostFocus()"),self.dataBufSize_returnPressed) self.connect(self.editSeq1,SIGNAL("clicked()"),self.editSeq1_clicked) self.connect(self.editSeq2,SIGNAL("clicked()"),self.editSeq2_clicked) self.connect(self.sendSwEvent,SIGNAL("clicked()"),self.sendSwEvent_clicked) self.connect(self.mxcTable,SIGNAL("valueChanged(int,int)"),self.mxcTable_valueChanged) self.connect(self.triggerSeq2,SIGNAL("clicked()"),self.triggerSeq2_clicked) self.connect(self.triggerSeq1,SIGNAL("clicked()"),self.triggerSeq1_clicked) self.textLabel1_3.setBuddy(self.acTrigger) def languageChange(self): self.setCaption(self.__tr("Event Generator")) self.groupBox4.setTitle(self.__tr("MXC")) self.mxcTable.horizontalHeader().setLabel(0,self.__tr("Prescaler")) self.mxcTable.horizontalHeader().setLabel(1,self.__tr("Trigger")) self.mxcTable.verticalHeader().setLabel(0,self.__tr("0")) self.mxcTable.verticalHeader().setLabel(1,self.__tr("1")) self.mxcTable.verticalHeader().setLabel(2,self.__tr("2")) self.mxcTable.verticalHeader().setLabel(3,self.__tr("3")) self.mxcTable.verticalHeader().setLabel(4,self.__tr("4")) self.mxcTable.verticalHeader().setLabel(5,self.__tr("5")) self.mxcTable.verticalHeader().setLabel(6,self.__tr("6")) self.mxcTable.verticalHeader().setLabel(7,self.__tr("7")) self.groupBox6.setTitle(self.__tr("Trigger Enable / Event Sent")) self.enev_1.setText(self.__tr("tr1")) self.enev_2.setText(self.__tr("tr2")) self.enev_5.setText(self.__tr("tr5")) self.enev_6.setText(self.__tr("tr6")) self.enev_7.setText(self.__tr("tr7")) self.enev_4.setText(self.__tr("tr4")) self.enev_3.setText(self.__tr("tr3")) self.enev_0.setText(self.__tr("tr0")) self.groupBox9.setTitle(self.__tr("Clock")) self.textLabel2_2.setText(self.__tr("tipus")) self.textLabel4.setText(self.__tr("frac synth")) self.gbDBus.setTitle(self.__tr("Distrib Bus")) self.groupBox3.setTitle(self.__tr("AC")) self.textLabel2.setText(self.__tr("delay")) self.textLabel1.setText(self.__tr("prescaler")) self.acSyncMXC7.setText(self.__tr("SYNCMXC7")) self.acByPass.setText(self.__tr("BYPASS")) self.textLabel1_3.setText(self.__tr("trigger")) self.groupBox9_2.setTitle(self.__tr("Front Panel Univ In")) self.textLabel2_3.setText(self.__tr("0 (dbus, trig) .. 1.. 2")) self.groupBox8.setTitle(self.__tr("Data Buffer")) self.dataBufData.verticalHeader().setLabel(0,self.__tr("0")) self.dataBufSize.setText(self.__tr("4")) self.textLabel1_2.setText(self.__tr("size")) self.dataBufEnable.setText(self.__tr("enable dbuf")) self.dataBuffTrigger.setText(self.__tr("trigger")) self.dataBufMode.setText(self.__tr("Mode")) self.groupBox7.setTitle(self.__tr("Actions")) self.triggerSeq1.setText(self.__tr("Tr Seq 1")) QToolTip.add(self.triggerSeq1,self.__tr("Trigger Seq 1")) self.triggerSeq2.setText(self.__tr("Tr Seq 2")) QToolTip.add(self.triggerSeq2,self.__tr("Trigger Sequence 2")) self.sendSwEvent.setText(self.__tr("Send SW event:")) self.masterEnable.setText(self.__tr("enable")) self.swEventEnable.setText(self.__tr("SW event enable")) self.editSeq1.setText(self.__tr("Edit Seq 1")) self.loadConfig.setText(self.__tr("Load")) self.saveConfig.setText(self.__tr("Save")) self.editSeq2.setText(self.__tr("Edit Seq 2")) self.restoreConfig.setText(self.__tr("Restore")) self.applyConfig.setText(self.__tr("Apply")) def onRestoreConfig(self): print "EventGeneratorForm.onRestoreConfig(): Not implemented yet" def onApplyConfig(self): print "EventGeneratorForm.onApplyConfig(): Not implemented yet" def loadConfig_clicked(self): print "EventGeneratorForm.loadConfig_clicked(): Not implemented yet" def saveConfig_clicked(self): print "EventGeneratorForm.saveConfig_clicked(): Not implemented yet" def dataBufSize_returnPressed(self): print "EventGeneratorForm.dataBufSize_returnPressed(): Not implemented yet" def editSeq1_clicked(self): print "EventGeneratorForm.editSeq1_clicked(): Not implemented yet" def editSeq2_clicked(self): print "EventGeneratorForm.editSeq2_clicked(): Not implemented yet" def sendDataBuf_clicked(self): print "EventGeneratorForm.sendDataBuf_clicked(): Not implemented yet" def resetEvan_clicked(self): print "EventGeneratorForm.resetEvan_clicked(): Not implemented yet" def resetFifo_clicked(self): print "EventGeneratorForm.resetFifo_clicked(): Not implemented yet" def resetRXVio_clicked(self): print "EventGeneratorForm.resetRXVio_clicked(): Not implemented yet" def mxrs7_clicked(self): print "EventGeneratorForm.mxrs7_clicked(): Not implemented yet" def mxrs6_clicked(self): print "EventGeneratorForm.mxrs6_clicked(): Not implemented yet" def mxrs5_clicked(self): print "EventGeneratorForm.mxrs5_clicked(): Not implemented yet" def mxrs4_clicked(self): print "EventGeneratorForm.mxrs4_clicked(): Not implemented yet" def mxrs3_clicked(self): print "EventGeneratorForm.mxrs3_clicked(): Not implemented yet" def mxrs2_clicked(self): print "EventGeneratorForm.mxrs2_clicked(): Not implemented yet" def mxrs1_clicked(self): print "EventGeneratorForm.mxrs1_clicked(): Not implemented yet" def mxrs0_clicked(self): print "EventGeneratorForm.mxrs0_clicked(): Not implemented yet" def sendSwEvent_clicked(self): print "EventGeneratorForm.sendSwEvent_clicked(): Not implemented yet" def mxcTable_valueChanged(self,a0,a1): print "EventGeneratorForm.mxcTable_valueChanged(int,int): Not implemented yet" def triggerSeq2_clicked(self): print "EventGeneratorForm.triggerSeq2_clicked(): Not implemented yet" def triggerSeq1_clicked(self): print "EventGeneratorForm.triggerSeq1_clicked(): Not implemented yet" def __tr(self,s,c = None): return qApp.translate("EventGeneratorForm",s,c)
def removeRows(self, fromRow): QTable.setNumRows(self, fromRow) self.updateGeometry()
def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("PluginSettingsUi") self.setSizeGripEnabled(1) PluginSettingsUiLayout = QGridLayout(self,1,1,11,6,"PluginSettingsUiLayout") Layout1 = QHBoxLayout(None,0,6,"Layout1") Horizontal_Spacing2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum) Layout1.addItem(Horizontal_Spacing2) self.bt_ok = QPushButton(self,"bt_ok") self.bt_ok.setAutoDefault(1) self.bt_ok.setDefault(1) Layout1.addWidget(self.bt_ok) self.bt_cancel = QPushButton(self,"bt_cancel") self.bt_cancel.setAutoDefault(1) Layout1.addWidget(self.bt_cancel) PluginSettingsUiLayout.addMultiCellLayout(Layout1,1,1,0,1) self.lw_plugins = QListView(self,"lw_plugins") self.lw_plugins.addColumn(self.__tr("Plugin")) self.lw_plugins.header().setClickEnabled(0,self.lw_plugins.header().count() - 1) self.lw_plugins.setMinimumSize(QSize(300,0)) self.lw_plugins.setMaximumSize(QSize(300,32767)) self.lw_plugins.setResizePolicy(QListView.AutoOneFit) self.lw_plugins.setResizeMode(QListView.LastColumn) PluginSettingsUiLayout.addWidget(self.lw_plugins,0,0) self.frame3 = QFrame(self,"frame3") self.frame3.setMinimumSize(QSize(330,0)) self.frame3.setFrameShape(QFrame.StyledPanel) self.frame3.setFrameShadow(QFrame.Raised) frame3Layout = QGridLayout(self.frame3,1,1,11,6,"frame3Layout") self.line1 = QFrame(self.frame3,"line1") self.line1.setFrameShape(QFrame.HLine) self.line1.setFrameShadow(QFrame.Sunken) self.line1.setFrameShape(QFrame.HLine) frame3Layout.addWidget(self.line1,3,0) self.t_parameters = QTable(self.frame3,"t_parameters") self.t_parameters.setSelectionMode(QTable.NoSelection) self.t_parameters.setNumCols(self.t_parameters.numCols() + 1) self.t_parameters.horizontalHeader().setLabel(self.t_parameters.numCols() - 1,self.__tr("Value")) self.t_parameters.horizontalHeader().setClickEnabled(False) self.t_parameters.setNumRows(self.t_parameters.numRows() + 1) self.t_parameters.verticalHeader().setLabel(self.t_parameters.numRows() - 1,self.__tr("Default ")) self.t_parameters.setMinimumSize(QSize(300,0)) self.t_parameters.setResizePolicy(QTable.Default) self.t_parameters.setVScrollBarMode(QTable.AlwaysOn) self.t_parameters.setNumRows(1) self.t_parameters.setNumCols(1) self.t_parameters.setSorting(1) frame3Layout.addWidget(self.t_parameters,3,0) layout5 = QHBoxLayout(None,0,6,"layout5") self.label_name = QLabel(self.frame3,"label_name") self.label_name.setMinimumSize(QSize(67,0)) self.label_name.setMaximumSize(QSize(67,32767)) label_name_font = QFont(self.label_name.font()) label_name_font.setBold(1) self.label_name.setFont(label_name_font) layout5.addWidget(self.label_name) self.le_name = QLineEdit(self.frame3,"le_name") self.le_name.setMinimumSize(QSize(250,0)) self.le_name.setReadOnly(1) layout5.addWidget(self.le_name) frame3Layout.addLayout(layout5,0,0) layout6 = QHBoxLayout(None,0,6,"layout6") self.label_version = QLabel(self.frame3,"label_version") self.label_version.setMinimumSize(QSize(67,0)) self.label_version.setMaximumSize(QSize(67,32767)) label_version_font = QFont(self.label_version.font()) label_version_font.setBold(1) self.label_version.setFont(label_version_font) layout6.addWidget(self.label_version) self.le_version = QLineEdit(self.frame3,"le_version") self.le_version.setMinimumSize(QSize(250,0)) self.le_version.setReadOnly(1) layout6.addWidget(self.le_version) frame3Layout.addLayout(layout6,1,0) layout7 = QHBoxLayout(None,0,6,"layout7") self.label_pversion = QLabel(self.frame3,"label_pversion") self.label_pversion.setMinimumSize(QSize(67,0)) self.label_pversion.setMaximumSize(QSize(67,32767)) label_pversion_font = QFont(self.label_pversion.font()) label_pversion_font.setBold(1) self.label_pversion.setFont(label_pversion_font) layout7.addWidget(self.label_pversion) self.le_pversion = QLineEdit(self.frame3,"le_pversion") self.le_pversion.setMinimumSize(QSize(250,0)) self.le_pversion.setReadOnly(1) layout7.addWidget(self.le_pversion) frame3Layout.addLayout(layout7,2,0) PluginSettingsUiLayout.addWidget(self.frame3,0,1) self.languageChange() self.resize(QSize(782,593).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.bt_ok,SIGNAL("clicked()"),self.accept) self.connect(self.bt_cancel,SIGNAL("clicked()"),self.reject)
def __init__(self,parent = None,name = None,fl = 0): QWidget.__init__(self,parent,name,fl) if not name: self.setName("FormJoystickController") FormJoystickControllerLayout = QGridLayout(self,1,1,11,6,"FormJoystickControllerLayout") self.groupBox12 = QGroupBox(self,"groupBox12") self.ledVertAxis = QLineEdit(self.groupBox12,"ledVertAxis") self.ledVertAxis.setGeometry(QRect(210,25,207,23)) self.ledHoriAxis = QLineEdit(self.groupBox12,"ledHoriAxis") self.ledHoriAxis.setGeometry(QRect(210,58,207,23)) self.textLabel1 = QLabel(self.groupBox12,"textLabel1") self.textLabel1.setGeometry(QRect(112,22,92,30)) self.ledRotaAxis = QLineEdit(self.groupBox12,"ledRotaAxis") self.ledRotaAxis.setGeometry(QRect(210,87,207,23)) self.ledButtonClicked = QLineEdit(self.groupBox12,"ledButtonClicked") self.ledButtonClicked.setGeometry(QRect(210,116,207,23)) self.textLabel1_3 = QLabel(self.groupBox12,"textLabel1_3") self.textLabel1_3.setGeometry(QRect(112,87,92,23)) self.btStart = QPushButton(self.groupBox12,"btStart") self.btStart.setGeometry(QRect(11,22,95,30)) self.textLabel1_2 = QLabel(self.groupBox12,"textLabel1_2") self.textLabel1_2.setGeometry(QRect(112,58,92,23)) self.btCalibrate = QPushButton(self.groupBox12,"btCalibrate") self.btCalibrate.setGeometry(QRect(11,69,95,30)) self.textLabel1_3_2 = QLabel(self.groupBox12,"textLabel1_3_2") self.textLabel1_3_2.setGeometry(QRect(112,116,92,23)) self.cbxCalibration = QComboBox(0,self.groupBox12,"cbxCalibration") self.cbxCalibration.setGeometry(QRect(10,110,92,27)) FormJoystickControllerLayout.addWidget(self.groupBox12,0,0) self.groupBox2 = QGroupBox(self,"groupBox2") self.groupBox2.setColumnLayout(0,Qt.Vertical) self.groupBox2.layout().setSpacing(6) self.groupBox2.layout().setMargin(11) groupBox2Layout = QGridLayout(self.groupBox2.layout()) groupBox2Layout.setAlignment(Qt.AlignTop) self.ledCommand = QLineEdit(self.groupBox2,"ledCommand") groupBox2Layout.addMultiCellWidget(self.ledCommand,1,1,1,2) self.textLabel1_4 = QLabel(self.groupBox2,"textLabel1_4") groupBox2Layout.addMultiCellWidget(self.textLabel1_4,0,0,1,2) self.textLabel1_4_2 = QLabel(self.groupBox2,"textLabel1_4_2") groupBox2Layout.addWidget(self.textLabel1_4_2,0,0) self.tblConfig = QTable(self.groupBox2,"tblConfig") self.tblConfig.setNumCols(self.tblConfig.numCols() + 1) self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Action")) self.tblConfig.setNumCols(self.tblConfig.numCols() + 1) self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Input")) self.tblConfig.setNumCols(self.tblConfig.numCols() + 1) self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Command")) self.tblConfig.setNumCols(self.tblConfig.numCols() + 1) self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Description")) self.tblConfig.setNumRows(0) self.tblConfig.setNumCols(4) groupBox2Layout.addMultiCellWidget(self.tblConfig,1,4,0,0) self.btSave = QPushButton(self.groupBox2,"btSave") groupBox2Layout.addMultiCellWidget(self.btSave,4,4,1,2) self.btNew = QPushButton(self.groupBox2,"btNew") groupBox2Layout.addMultiCellWidget(self.btNew,3,3,1,2) self.textLabel1_5 = QLabel(self.groupBox2,"textLabel1_5") groupBox2Layout.addWidget(self.textLabel1_5,2,1) self.spbDogNumber = QSpinBox(self.groupBox2,"spbDogNumber") groupBox2Layout.addWidget(self.spbDogNumber,2,2) FormJoystickControllerLayout.addWidget(self.groupBox2,1,0) self.languageChange() self.resize(QSize(450,367).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.btStart,SIGNAL("clicked()"),self.slotStartStopJoystick) self.connect(self.btNew,SIGNAL("clicked()"),self.slotNewAction) self.connect(self.btSave,SIGNAL("clicked()"),self.slotSaveConfiguration)
def sortColumn(self, col, ascending, wholeRows): QTable.sortColumn(self, col, ascending, True)
def closeEvent(self, ev): w = [] for i in range(len(self.headers)): w.append("%s,%i" % (self.headers[i], self.columnWidth(i))) setattr(guiConf, "%s_table_width" % self.tableDef.name, "|".join(w)) QTable.closeEvent(self, ev)
class BrowserBrick(BaseComponents.BlissWidget): def __init__(self, *args): BaseComponents.BlissWidget.__init__(self, *args) #map displayed string in the history list -> actual file path self.history_map = dict() self.layout = QVBoxLayout(self) self.defineSlot('load_file', ()) self.defineSlot('login_changed', ()) self.addProperty('mnemonic', 'string', '') self.addProperty('history', 'string', '', hidden=True) self.addProperty('sessions ttl (in days)', 'integer', '30') #make sure the history property is a pickled dict try: hist = pickle.loads(self.getProperty('history').getValue()) except: # EOFError if the string is empty but let's not count on it self.getProperty('history').setValue(pickle.dumps(dict())) # maybe defer that for later self.cleanup_history() self.main_layout = QSplitter(self) self.main_layout.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) # left part of the splitter self.history_box = QVBox(self.main_layout) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.sort_order = True self.sort_col = None self.history = QTable(self.history_box) self.history.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)) self.history.setSelectionMode(QTable.SingleRow) self.history.setNumCols(3) self.history.verticalHeader().hide() self.history.setLeftMargin(0) self.history.setSorting(False) QObject.connect(self.history, SIGNAL('currentChanged(int,int)'), self.history_changed) #by default sorting only sorts the columns and not whole rows. #let's reimplement that QObject.connect(self.history.horizontalHeader(), SIGNAL('clicked(int)'), self.sort_column) header = self.history.horizontalHeader() header.setLabel(0, 'Time and date') header.setLabel(1, 'Prefix') header.setLabel(2, 'Run number') self.clear_history_button = QPushButton('Clear history', self.history_box) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) QObject.connect(self.clear_history_button, SIGNAL('clicked()'), self.clear_history) # Right part of the splitter self.browser_box = QWidget(self.main_layout) QVBoxLayout(self.browser_box) self.browser_box.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.top_layout = QHBoxLayout(self.browser_box) self.back_button = QToolButton(self.browser_box) self.back_button.setIconSet(QIconSet(Icons.load('Left2'))) self.back_button.setTextLabel('Back') self.back_button.setUsesTextLabel(True) self.back_button.setTextPosition(QToolButton.BelowIcon) self.back_button.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.forward_button = QToolButton(self.browser_box) self.forward_button.setIconSet(QIconSet(Icons.load('Right2'))) self.forward_button.setTextLabel('Forward') self.forward_button.setUsesTextLabel(True) self.forward_button.setTextPosition(QToolButton.BelowIcon) self.forward_button.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.top_layout.addWidget(self.back_button) self.top_layout.addWidget(self.forward_button) self.browser_box.layout().addLayout(self.top_layout) self.browser = QTextBrowser(self.browser_box) self.browser.setReadOnly(True) self.browser_box.layout().addWidget(self.browser) self.layout.addWidget(self.main_layout) #initially disabled self.forward_button.setEnabled(False) self.back_button.setEnabled(False) #connections QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'), self.back_button.setEnabled) QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'), self.forward_button.setEnabled) QObject.connect(self.back_button, SIGNAL('clicked()'), self.browser.backward) QObject.connect(self.forward_button, SIGNAL('clicked()'), self.browser.forward) self.edna = None # resize the splitter to something like 1/4-3/4 # width = self.main_layout.width() # left = width / 4.0 # right = width - left # logging.debug('setting splitter sizes to %d and %d', left, right) # self.main_layout.setSizes([left, right]) def sort_column(self, col_number): logging.debug('%s: sorting with column %d', self, col_number) if col_number == self.sort_column: # switch the sort order self.sort_order = self.sort_order ^ True else: self.sort_order = True #else, ascending self.sort_column = col_number self.history.sortColumn(col_number, self.sort_order, True) # put the right decoration on the header label if self.sort_order: direction = Qt.Ascending else: direction = Qt.Descending self.history.horizontalHeader().setSortIndicator(col_number, direction) def load_file(self, path): if self.browser.mimeSourceFactory().data(path) == None: self.browser.setText('<center>FILE NOT FOUND</center>') else: self.browser.setSource(abspath(path)) def history_changed(self, row, col): logging.debug('history elem selected: %d:%d', row, col) index = (str(self.history.text(row, 0)), str(self.history.text(row, 1)), str(self.history.text(row, 2))) try: path = self.history_map[index] self.load_file(path) except KeyError as e: # can happen when qt sends us the signal with # null data and we get the key ("","","") pass def new_html(self, html_path, image_prefix, run_number): logging.getLogger().debug( 'got a new html page: %s, prefix: %r, run number: %s', html_path, image_prefix, run_number) # prepend the time and date to the path we just got so # the history is more readable time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) index = (time_string, str(image_prefix), str(run_number)) self.history_map[index] = html_path # synchronize the history prop if self.current_user is not None: whole_history = pickle.loads( self.getProperty('history').getValue()) whole_history[self.current_user] = self.history_map self.getProperty('history').setValue(pickle.dumps(whole_history)) self.history.insertRows(self.history.numRows()) logging.debug('numRows() is %d', self.history.numRows()) rows = self.history.numRows() - 1 self.history.setText(rows, 0, QString(time_string)) self.history.setText(rows, 1, QString(str(image_prefix))) self.history.setText(rows, 2, QString(str(run_number))) logging.debug('numRows() is %d', self.history.numRows()) self.load_file(html_path) def clear_history(self): self.history_map.clear() self.history.setNumRows(0) def propertyChanged(self, prop, oldval, newval): if prop == 'mnemonic': logging.getLogger().debug('BrowserBrick: using edna object %s', newval) if self.edna is not None: self.disconnect(self.edna, PYSIGNAL('newEDNAHTML'), self.new_html) self.edna = self.getHardwareObject(newval) logging.getLogger().debug('edna object is now: %s', self.edna) self.connect(self.edna, PYSIGNAL('newEDNAHTML'), self.new_html) def run(self): pass def login_changed(self, session_id, prop_code=None, prop_number=None, prop_id=None, expiration_time=0): logging.debug('BrowserBrick::login_changed: login changed to %r', session_id) if session_id is None: # user logged out logging.debug('user logged out') self.current_user = None else: self.current_user = (prop_code, prop_number) logging.debug('current user is now %r', self.current_user) self.clear_all() self.fill_history_for(self.current_user) def clear_all(self): self.clear_history() self.browser.setText('') def fill_history_for(self, user): if user is None: return logging.debug('loading history for user %s', user) whole_history = pickle.loads(self.getProperty('history').getValue()) try: self.history_map = whole_history[user] except KeyError: #user has no history yet self.history_map = dict() for k, v in self.history_map.items(): self.history.insertRows(self.history.numRows()) logging.debug('numRows() is %d', self.history.numRows()) rows = self.history.numRows() - 1 self.history.setText(rows, 0, k[0]) self.history.setText(rows, 1, k[1]) self.history.setText(rows, 2, k[2]) def cleanup_history(self): histories = pickle.loads(self.getProperty('history').getValue()) sessions_ttl = self.getProperty('sessions ttl (in days)').getValue() limit_date = datetime.now() - timedelta(sessions_ttl) #we're mutating the dict so do not use iteritems() just to be sure for user in list(histories.keys()): history = histories[user] #get the keys where the date is more recent than the limit date valid_keys = [ x for x in list(history.keys()) if datetime.strptime(x[0], '%Y-%m-%d %H:%M:%S') > limit_date ] #NB: old format was "%a, %d %b %Y %H:%M:%S" if len(valid_keys) != len(history): # some entries are too old, copy only the ones that are recent enough new_hist = dict((k, history[k]) for k in valid_keys) logging.debug( 'BrowserBrick: removed %d entries from saved history for user %s', len(history) - len(valid_keys), user) histories[user] = new_hist self.getProperty('history').setValue(pickle.dumps(histories))
class BrowserBrick(BaseComponents.BlissWidget): def __init__(self, *args): BaseComponents.BlissWidget.__init__(self, *args) #map displayed string in the history list -> actual file path self.history_map = dict() self.layout = QVBoxLayout(self) self.defineSlot('load_file', ()) self.defineSlot('login_changed', ()) self.addProperty('mnemonic', 'string', '') self.addProperty('history', 'string', '', hidden=True) self.addProperty('sessions ttl (in days)', 'integer', '30') #make sure the history property is a pickled dict try: hist = pickle.loads(self.getProperty('history').getValue()) except: # EOFError if the string is empty but let's not count on it self.getProperty('history').setValue(pickle.dumps(dict())) # maybe defer that for later self.cleanup_history() self.main_layout = QSplitter(self) self.main_layout.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) # left part of the splitter self.history_box = QVBox(self.main_layout) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.sort_order = True self.sort_col = None self.history = QTable(self.history_box) self.history.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)) self.history.setSelectionMode(QTable.SingleRow) self.history.setNumCols(3) self.history.verticalHeader().hide() self.history.setLeftMargin(0) self.history.setSorting(False) QObject.connect(self.history, SIGNAL('currentChanged(int,int)'), self.history_changed) #by default sorting only sorts the columns and not whole rows. #let's reimplement that QObject.connect(self.history.horizontalHeader(), SIGNAL('clicked(int)'), self.sort_column) header = self.history.horizontalHeader() header.setLabel(0, 'Time and date') header.setLabel(1, 'Prefix') header.setLabel(2, 'Run number') self.clear_history_button = QPushButton('Clear history', self.history_box) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) QObject.connect(self.clear_history_button, SIGNAL('clicked()'), self.clear_history) # Right part of the splitter self.browser_box = QWidget(self.main_layout) QVBoxLayout(self.browser_box) self.browser_box.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.top_layout = QHBoxLayout(self.browser_box) self.back_button = QToolButton(self.browser_box) self.back_button.setIconSet(QIconSet(Icons.load('Left2'))) self.back_button.setTextLabel('Back') self.back_button.setUsesTextLabel(True) self.back_button.setTextPosition(QToolButton.BelowIcon) self.back_button.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.forward_button = QToolButton(self.browser_box) self.forward_button.setIconSet(QIconSet(Icons.load('Right2'))) self.forward_button.setTextLabel('Forward') self.forward_button.setUsesTextLabel(True) self.forward_button.setTextPosition(QToolButton.BelowIcon) self.forward_button.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.top_layout.addWidget(self.back_button) self.top_layout.addWidget(self.forward_button) self.browser_box.layout().addLayout(self.top_layout) self.browser = QTextBrowser(self.browser_box) self.browser.setReadOnly(True) self.browser_box.layout().addWidget(self.browser) self.layout.addWidget(self.main_layout) #initially disabled self.forward_button.setEnabled(False) self.back_button.setEnabled(False) #connections QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'), self.back_button.setEnabled) QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'), self.forward_button.setEnabled) QObject.connect(self.back_button, SIGNAL('clicked()'), self.browser.backward) QObject.connect(self.forward_button, SIGNAL('clicked()'), self.browser.forward) self.edna = None # resize the splitter to something like 1/4-3/4 # width = self.main_layout.width() # left = width / 4.0 # right = width - left # logging.debug('setting splitter sizes to %d and %d', left, right) # self.main_layout.setSizes([left, right]) def sort_column(self, col_number): logging.debug('%s: sorting with column %d', self, col_number) if col_number == self.sort_column: # switch the sort order self.sort_order = self.sort_order ^ True else: self.sort_order = True #else, ascending self.sort_column = col_number self.history.sortColumn(col_number, self.sort_order, True) # put the right decoration on the header label if self.sort_order: direction = Qt.Ascending else: direction = Qt.Descending self.history.horizontalHeader().setSortIndicator(col_number, direction) def load_file(self, path): if self.browser.mimeSourceFactory().data(path) == None: self.browser.setText('<center>FILE NOT FOUND</center>') else: self.browser.setSource(abspath(path)) def history_changed(self, row, col): logging.debug('history elem selected: %d:%d', row, col) index = (str(self.history.text(row, 0)), str(self.history.text(row, 1)), str(self.history.text(row, 2))) try: path = self.history_map[index] self.load_file(path) except KeyError, e: # can happen when qt sends us the signal with # null data and we get the key ("","","") pass
class ParametersTable(QWidget): def __init__(self, parent = None, name = "parameter_table"): QWidget.__init__(self, parent, name) self.__dc_parameters = None self.add_dc_cb = None self.parameters_label = QLabel(self, "parameters_label") self.parameter_table = QTable(self, "parameter_table") self.parameter_table.setNumCols(3) self.parameter_table.horizontalHeader().\ setLabel(0, self.__tr("Name"), -1) self.parameter_table.horizontalHeader().\ setLabel(1, self.__tr("Value")) self.parameter_table.verticalHeader().hide() self.parameter_table.horizontalHeader().setClickEnabled(False, 0); self.parameter_table.horizontalHeader().setClickEnabled(False, 1); self.parameter_table.setColumnWidth(0, 200) self.parameter_table.setColumnWidth(1, 200) self.parameter_table.hideColumn(2) self.parameter_table.setColumnReadOnly(0, True) self.parameter_table.setLeftMargin(0) self.parameter_table.setNumRows(0) self.position_label = QLabel("Positions", self, "position_view") self.position_label.setAlignment(Qt.AlignTop) ## self.add_button = QPushButton(self, "add_button") #self.add_button.setDisabled(True) h_layout = QGridLayout(self, 1, 2) v_layout_position = QVBoxLayout(self) v_layout_position.addWidget(self.position_label) v_layout_table = QVBoxLayout(self) h_layout.addLayout(v_layout_table, 0, 0) h_layout.addLayout(v_layout_position, 0, 1) v_layout_table.addWidget(self.parameters_label) v_layout_table.addWidget(self.parameter_table) ## v_layout_table.addWidget(self.add_button) ## self.languageChange() ## QObject.connect(self.add_button, SIGNAL("clicked()"), ## self.__add_data_collection) QObject.connect(self.parameter_table, SIGNAL("valueChanged(int, int)"), self.__parameter_value_change) #self.populate_parameter_table(self.__dc_parameters) ## def languageChange(self): ## self.add_button.setText("Add") def __tr(self, s, c = None): return qApp.translate("parameter_table", s, c) def __add_data_collection(self): return self.add_dc_cb(self.__dc_parameters, self.collection_type) def populate_parameter_table(self, parameters): self.parameter_table.setNumRows(11) i = 0 for param_key, parameter in parameters.items(): if param_key != 'positions': self.parameter_table.setText(i, 0, parameter[0]) self.parameter_table.setText(i, 1, parameter[1]) self.parameter_table.setText(i, 2, param_key) i += 1 ## def add_positions(self, positions): ## self.__dc_parameters['positions'].extend(positions) def __parameter_value_change(self, row, col): self.__dc_parameters[str(self.parameter_table.item(row, 2).text())][1] = \ str(self.parameter_table.item(row, 1).text())
def __init__(self, parent=None, name=None, modal=0, fl=0): QDialog.__init__(self, parent, name, modal, fl) if not name: self.setName("EventReceiverForm") self.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum, 0, 0, self.sizePolicy().hasHeightForWidth())) EventReceiverFormLayout = QHBoxLayout(self, 11, 6, "EventReceiverFormLayout") layout20 = QVBoxLayout(None, 0, 6, "layout20") self.groupBox6 = QGroupBox(self, "groupBox6") self.groupBox6.setColumnLayout(0, Qt.Vertical) self.groupBox6.layout().setSpacing(6) self.groupBox6.layout().setMargin(11) groupBox6Layout = QVBoxLayout(self.groupBox6.layout()) groupBox6Layout.setAlignment(Qt.AlignTop) self.irqMasterEnable = QCheckBox(self.groupBox6, "irqMasterEnable") groupBox6Layout.addWidget(self.irqMasterEnable) self.irqViolation = QCheckBox(self.groupBox6, "irqViolation") groupBox6Layout.addWidget(self.irqViolation) self.irqFifoFull = QCheckBox(self.groupBox6, "irqFifoFull") groupBox6Layout.addWidget(self.irqFifoFull) self.irqHeartBeat = QCheckBox(self.groupBox6, "irqHeartBeat") groupBox6Layout.addWidget(self.irqHeartBeat) self.irqEvent = QCheckBox(self.groupBox6, "irqEvent") groupBox6Layout.addWidget(self.irqEvent) self.irqPulse = QCheckBox(self.groupBox6, "irqPulse") groupBox6Layout.addWidget(self.irqPulse) self.irqDataBuf = QCheckBox(self.groupBox6, "irqDataBuf") groupBox6Layout.addWidget(self.irqDataBuf) self.clearInterrupts = QPushButton(self.groupBox6, "clearInterrupts") groupBox6Layout.addWidget(self.clearInterrupts) layout20.addWidget(self.groupBox6) self.groupBox9 = QGroupBox(self, "groupBox9") self.groupBox9.setColumnLayout(0, Qt.Vertical) self.groupBox9.layout().setSpacing(6) self.groupBox9.layout().setMargin(11) groupBox9Layout = QGridLayout(self.groupBox9.layout()) groupBox9Layout.setAlignment(Qt.AlignTop) self.fp0 = QComboBox(0, self.groupBox9, "fp0") groupBox9Layout.addWidget(self.fp0, 1, 0) self.fp1 = QComboBox(0, self.groupBox9, "fp1") groupBox9Layout.addWidget(self.fp1, 1, 1) self.fp2 = QComboBox(0, self.groupBox9, "fp2") groupBox9Layout.addWidget(self.fp2, 2, 0) self.fp3 = QComboBox(0, self.groupBox9, "fp3") groupBox9Layout.addWidget(self.fp3, 2, 1) self.fp4 = QComboBox(0, self.groupBox9, "fp4") groupBox9Layout.addWidget(self.fp4, 3, 0) self.fp5 = QComboBox(0, self.groupBox9, "fp5") groupBox9Layout.addWidget(self.fp5, 3, 1) self.fp6 = QComboBox(0, self.groupBox9, "fp6") groupBox9Layout.addWidget(self.fp6, 4, 0) self.fp7 = QComboBox(0, self.groupBox9, "fp7") groupBox9Layout.addWidget(self.fp7, 4, 1) self.fp8 = QComboBox(0, self.groupBox9, "fp8") groupBox9Layout.addWidget(self.fp8, 5, 0) self.fp9 = QComboBox(0, self.groupBox9, "fp9") groupBox9Layout.addWidget(self.fp9, 5, 1) self.fp10 = QComboBox(0, self.groupBox9, "fp10") groupBox9Layout.addWidget(self.fp10, 6, 0) self.fp11 = QComboBox(0, self.groupBox9, "fp11") groupBox9Layout.addWidget(self.fp11, 6, 1) self.textLabel2 = QLabel(self.groupBox9, "textLabel2") groupBox9Layout.addMultiCellWidget(self.textLabel2, 0, 0, 0, 1) layout20.addWidget(self.groupBox9) layout16 = QGridLayout(None, 1, 1, 0, 6, "layout16") self.evcountPresc = QLineEdit(self, "evcountPresc") self.evcountPresc.setEnabled(0) layout16.addWidget(self.evcountPresc, 0, 1) self.textLabel5 = QLabel(self, "textLabel5") layout16.addWidget(self.textLabel5, 0, 0) layout20.addLayout(layout16) layout24 = QHBoxLayout(None, 0, 6, "layout24") self.textLabel4 = QLabel(self, "textLabel4") layout24.addWidget(self.textLabel4) self.ckSynthesiser = QComboBox(0, self, "ckSynthesiser") layout24.addWidget(self.ckSynthesiser) layout20.addLayout(layout24) EventReceiverFormLayout.addLayout(layout20) layout13 = QVBoxLayout(None, 0, 6, "layout13") self.groupBox18 = QGroupBox(self, "groupBox18") self.groupBox18.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed, 0, 0, self.groupBox18.sizePolicy().hasHeightForWidth())) self.groupBox18.setColumnLayout(0, Qt.Vertical) self.groupBox18.layout().setSpacing(6) self.groupBox18.layout().setMargin(11) groupBox18Layout = QGridLayout(self.groupBox18.layout()) groupBox18Layout.setAlignment(Qt.AlignTop) self.prescalerOutputs = QTable(self.groupBox18, "prescalerOutputs") self.prescalerOutputs.setNumCols(self.prescalerOutputs.numCols() + 1) self.prescalerOutputs.horizontalHeader().setLabel( self.prescalerOutputs.numCols() - 1, self.__tr("Prescaler")) self.prescalerOutputs.setNumRows(self.prescalerOutputs.numRows() + 1) self.prescalerOutputs.verticalHeader().setLabel( self.prescalerOutputs.numRows() - 1, self.__tr("0")) self.prescalerOutputs.setNumRows(self.prescalerOutputs.numRows() + 1) self.prescalerOutputs.verticalHeader().setLabel( self.prescalerOutputs.numRows() - 1, self.__tr("1")) self.prescalerOutputs.setNumRows(self.prescalerOutputs.numRows() + 1) self.prescalerOutputs.verticalHeader().setLabel( self.prescalerOutputs.numRows() - 1, self.__tr("2")) self.prescalerOutputs.setNumRows(self.prescalerOutputs.numRows() + 1) self.prescalerOutputs.verticalHeader().setLabel( self.prescalerOutputs.numRows() - 1, self.__tr("3")) self.prescalerOutputs.setNumRows(4) self.prescalerOutputs.setNumCols(1) groupBox18Layout.addWidget(self.prescalerOutputs, 0, 0) layout13.addWidget(self.groupBox18) self.groupBox3 = QGroupBox(self, "groupBox3") self.groupBox3.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum, 0, 0, self.groupBox3.sizePolicy().hasHeightForWidth())) self.groupBox3.setColumnLayout(0, Qt.Vertical) self.groupBox3.layout().setSpacing(6) self.groupBox3.layout().setMargin(11) groupBox3Layout = QVBoxLayout(self.groupBox3.layout()) groupBox3Layout.setAlignment(Qt.AlignTop) self.listPulse = QListView(self.groupBox3, "listPulse") self.listPulse.addColumn(self.__tr("id")) self.listPulse.header().setClickEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.header().setResizeEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.addColumn(self.__tr("eitscp")) self.listPulse.header().setClickEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.header().setResizeEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.addColumn(self.__tr("Delay")) self.listPulse.header().setClickEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.header().setResizeEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.addColumn(self.__tr("Width")) self.listPulse.header().setClickEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.header().setResizeEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.addColumn(self.__tr("Prescaler")) self.listPulse.header().setClickEnabled( 0, self.listPulse.header().count() - 1) self.listPulse.header().setResizeEnabled( 0, self.listPulse.header().count() - 1) listPulse_font = QFont(self.listPulse.font()) listPulse_font.setFamily("Courier") self.listPulse.setFont(listPulse_font) groupBox3Layout.addWidget(self.listPulse) layout13.addWidget(self.groupBox3) EventReceiverFormLayout.addLayout(layout13) layout11 = QVBoxLayout(None, 0, 6, "layout11") self.groupBox7 = QGroupBox(self, "groupBox7") self.groupBox7.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum, 0, 0, self.groupBox7.sizePolicy().hasHeightForWidth())) self.groupBox7.setColumnLayout(0, Qt.Vertical) self.groupBox7.layout().setSpacing(6) self.groupBox7.layout().setMargin(11) groupBox7Layout = QVBoxLayout(self.groupBox7.layout()) groupBox7Layout.setAlignment(Qt.AlignTop) layout7 = QHBoxLayout(None, 0, 6, "layout7") self.ramSel = QComboBox(0, self.groupBox7, "ramSel") layout7.addWidget(self.ramSel) self.ramEnable = QCheckBox(self.groupBox7, "ramEnable") layout7.addWidget(self.ramEnable) groupBox7Layout.addLayout(layout7) layout21 = QHBoxLayout(None, 0, 6, "layout21") self.ramEvent = QLineEdit(self.groupBox7, "ramEvent") layout21.addWidget(self.ramEvent) self.ramMod = QPushButton(self.groupBox7, "ramMod") layout21.addWidget(self.ramMod) self.ramDel = QPushButton(self.groupBox7, "ramDel") layout21.addWidget(self.ramDel) groupBox7Layout.addLayout(layout21) self.ramList = QListView(self.groupBox7, "ramList") self.ramList.addColumn(self.__tr("Event")) self.ramList.header().setClickEnabled( 0, self.ramList.header().count() - 1) self.ramList.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding, 0, 0, self.ramList.sizePolicy().hasHeightForWidth())) ramList_font = QFont(self.ramList.font()) ramList_font.setFamily("Courier") self.ramList.setFont(ramList_font) groupBox7Layout.addWidget(self.ramList) layout19 = QHBoxLayout(None, 0, 6, "layout19") spacer4 = QSpacerItem(81, 21, QSizePolicy.Expanding, QSizePolicy.Minimum) layout19.addItem(spacer4) self.ramClear = QPushButton(self.groupBox7, "ramClear") layout19.addWidget(self.ramClear) groupBox7Layout.addLayout(layout19) layout11.addWidget(self.groupBox7) layout10 = QGridLayout(None, 1, 1, 0, 6, "layout10") self.restoreConfig = QPushButton(self, "restoreConfig") layout10.addWidget(self.restoreConfig, 0, 2) self.saveConfig = QPushButton(self, "saveConfig") layout10.addWidget(self.saveConfig, 1, 1) self.applyConfig = QPushButton(self, "applyConfig") layout10.addWidget(self.applyConfig, 1, 2) self.masterEnable = QCheckBox(self, "masterEnable") layout10.addWidget(self.masterEnable, 1, 0) self.loadConfig = QPushButton(self, "loadConfig") layout10.addWidget(self.loadConfig, 0, 1) self.setDefaultBt = QPushButton(self, "setDefaultBt") self.setDefaultBt.setEnabled(0) layout10.addWidget(self.setDefaultBt, 0, 0) layout11.addLayout(layout10) EventReceiverFormLayout.addLayout(layout11) self.languageChange() self.resize(QSize(816, 484).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.ramList, SIGNAL("clicked(QListViewItem*)"), self.ramList_clicked) self.connect(self.ramList, SIGNAL("doubleClicked(QListViewItem*)"), self.ramList_doubleClicked) self.connect(self.ramEnable, SIGNAL("toggled(bool)"), self.ramEnable_toggled) self.connect(self.ramMod, SIGNAL("clicked()"), self.ramMod_clicked) self.connect(self.ramDel, SIGNAL("clicked()"), self.ramDel_clicked) self.connect(self.ramClear, SIGNAL("clicked()"), self.ramClear_clicked) self.connect(self.ramSel, SIGNAL("activated(int)"), self.ramSel_activated) self.connect(self.listPulse, SIGNAL("doubleClicked(QListViewItem*)"), self.listPulse_doubleClicked) self.connect(self.restoreConfig, SIGNAL("clicked()"), self.onRestoreConfig) self.connect(self.loadConfig, SIGNAL("clicked()"), self.loadConfig_clicked) self.connect(self.saveConfig, SIGNAL("clicked()"), self.saveConfig_clicked) self.connect(self.applyConfig, SIGNAL("clicked()"), self.onApplyConfig) self.connect(self.setDefaultBt, SIGNAL("clicked()"), self.onSetConfigAsDefault) self.connect(self.ramEvent, SIGNAL("returnPressed()"), self.ramMod_clicked) self.connect(self.clearInterrupts, SIGNAL("clicked()"), self.clearInterrupts_clicked) self.setTabOrder(self.ramEnable, self.ramEvent) self.setTabOrder(self.ramEvent, self.ramMod) self.setTabOrder(self.ramMod, self.ramList) self.setTabOrder(self.ramList, self.ramClear) self.setTabOrder(self.ramClear, self.listPulse) self.setTabOrder(self.listPulse, self.ckSynthesiser) self.setTabOrder(self.ckSynthesiser, self.evcountPresc) self.setTabOrder(self.evcountPresc, self.irqMasterEnable) self.setTabOrder(self.irqMasterEnable, self.irqViolation) self.setTabOrder(self.irqViolation, self.irqHeartBeat) self.setTabOrder(self.irqHeartBeat, self.irqFifoFull) self.setTabOrder(self.irqFifoFull, self.irqEvent) self.setTabOrder(self.irqEvent, self.fp0) self.setTabOrder(self.fp0, self.fp1) self.setTabOrder(self.fp1, self.fp2) self.setTabOrder(self.fp2, self.fp3) self.setTabOrder(self.fp3, self.fp4) self.setTabOrder(self.fp4, self.fp5) self.setTabOrder(self.fp5, self.fp6)
def __init__(self, parent=None, name=None, modal=0, fl=0): QDialog.__init__(self, parent, name, modal, fl) if not name: self.setName("VulnerabilitiesUi") self.t_vulns = QTable(self, "t_vulns") self.t_vulns.setNumCols(self.t_vulns.numCols() + 1) self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1, self.__tr("Name")) self.t_vulns.setNumCols(self.t_vulns.numCols() + 1) self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1, self.__tr("Refs")) self.t_vulns.setNumCols(self.t_vulns.numCols() + 1) self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1, self.__tr("Description")) self.t_vulns.setMinimumSize(QSize(700, 0)) self.t_vulns.setResizePolicy(QTable.AutoOne) self.t_vulns.setVScrollBarMode(QTable.AlwaysOn) self.t_vulns.setNumRows(0) self.t_vulns.setNumCols(3) LayoutWidget = QWidget(self, "layout7") LayoutWidget.setGeometry(QRect(90, 500, 450, 29)) layout7 = QHBoxLayout(LayoutWidget, 5, 5, "layout7") self.add_button = QPushButton(LayoutWidget, "add_button") layout7.addWidget(self.add_button) spacer6_2 = QSpacerItem(21, 21, QSizePolicy.Expanding, QSizePolicy.Minimum) layout7.addItem(spacer6_2) self.edit_button = QPushButton(LayoutWidget, "edit_button") layout7.addWidget(self.edit_button) spacer6 = QSpacerItem(21, 21, QSizePolicy.Expanding, QSizePolicy.Minimum) layout7.addItem(spacer6) self.delete_button = QPushButton(LayoutWidget, "delete_button") layout7.addWidget(self.delete_button) spacer6_3 = QSpacerItem(21, 21, QSizePolicy.Expanding, QSizePolicy.Minimum) layout7.addItem(spacer6_3) self.list_note_button = QPushButton(LayoutWidget, "list_note_button") layout7.addWidget(self.list_note_button) spacer7_3 = QSpacerItem(21, 21, QSizePolicy.Expanding, QSizePolicy.Minimum) layout7.addItem(spacer7_3) self.manage_evidence_button = QPushButton(LayoutWidget, "manage_evidence_button") layout7.addWidget(self.manage_evidence_button) self.languageChange() self.resize(QSize(733, 550).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished)
class BrowserBrick(BaseComponents.BlissWidget): def __init__(self, *args): BaseComponents.BlissWidget.__init__(self, *args) #map displayed string in the history list -> actual file path self.history_map = dict() self.layout = QVBoxLayout(self) self.defineSlot('load_file', ()) self.defineSlot('login_changed', ()) self.addProperty('mnemonic', 'string', '') self.addProperty('history', 'string', '', hidden=True) self.addProperty('sessions ttl (in days)', 'integer', '30') #make sure the history property is a pickled dict try: hist = pickle.loads(self.getProperty('history').getValue()) except: # EOFError if the string is empty but let's not count on it self.getProperty('history').setValue(pickle.dumps(dict())) # maybe defer that for later self.cleanup_history() self.main_layout = QSplitter(self) self.main_layout.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) # left part of the splitter self.history_box = QVBox(self.main_layout) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.sort_order = True self.sort_col = None self.history = QTable(self.history_box) self.history.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)) self.history.setSelectionMode(QTable.SingleRow) self.history.setNumCols(3) self.history.verticalHeader().hide() self.history.setLeftMargin(0) self.history.setSorting(False) QObject.connect(self.history, SIGNAL('currentChanged(int,int)'), self.history_changed) #by default sorting only sorts the columns and not whole rows. #let's reimplement that QObject.connect(self.history.horizontalHeader(), SIGNAL('clicked(int)'), self.sort_column) header = self.history.horizontalHeader() header.setLabel(0, 'Time and date') header.setLabel(1, 'Prefix') header.setLabel(2, 'Run number') self.clear_history_button = QPushButton('Clear history', self.history_box) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) QObject.connect(self.clear_history_button, SIGNAL('clicked()'), self.clear_history) # Right part of the splitter self.browser_box = QWidget(self.main_layout) QVBoxLayout(self.browser_box) self.browser_box.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.top_layout = QHBoxLayout(self.browser_box) self.back_button = QToolButton(self.browser_box) self.back_button.setIconSet(QIconSet(Icons.load('Left2'))) self.back_button.setTextLabel('Back') self.back_button.setUsesTextLabel(True) self.back_button.setTextPosition(QToolButton.BelowIcon) self.back_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.forward_button = QToolButton(self.browser_box) self.forward_button.setIconSet(QIconSet(Icons.load('Right2'))) self.forward_button.setTextLabel('Forward') self.forward_button.setUsesTextLabel(True) self.forward_button.setTextPosition(QToolButton.BelowIcon) self.forward_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.top_layout.addWidget(self.back_button) self.top_layout.addWidget(self.forward_button) self.browser_box.layout().addLayout(self.top_layout) self.browser = QTextBrowser(self.browser_box) self.browser.setReadOnly(True) self.browser_box.layout().addWidget(self.browser) self.layout.addWidget(self.main_layout) #initially disabled self.forward_button.setEnabled(False) self.back_button.setEnabled(False) #connections QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'), self.back_button.setEnabled) QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'), self.forward_button.setEnabled) QObject.connect(self.back_button, SIGNAL('clicked()'), self.browser.backward) QObject.connect(self.forward_button, SIGNAL('clicked()'), self.browser.forward) self.edna = None # resize the splitter to something like 1/4-3/4 # width = self.main_layout.width() # left = width / 4.0 # right = width - left # logging.debug('setting splitter sizes to %d and %d', left, right) # self.main_layout.setSizes([left, right]) def sort_column(self, col_number): logging.debug('%s: sorting with column %d', self, col_number) if col_number == self.sort_column: # switch the sort order self.sort_order = self.sort_order ^ True else: self.sort_order = True #else, ascending self.sort_column = col_number self.history.sortColumn(col_number, self.sort_order, True) # put the right decoration on the header label if self.sort_order: direction = Qt.Ascending else: direction = Qt.Descending self.history.horizontalHeader().setSortIndicator(col_number, direction) def load_file(self, path): if self.browser.mimeSourceFactory().data(path) == None: self.browser.setText('<center>FILE NOT FOUND</center>') else: self.browser.setSource(abspath(path)) def history_changed(self, row, col): logging.debug('history elem selected: %d:%d', row, col) index = (str(self.history.text(row,0)), str(self.history.text(row,1)), str(self.history.text(row,2))) try: path = self.history_map[index] self.load_file(path) except KeyError as e: # can happen when qt sends us the signal with # null data and we get the key ("","","") pass def new_html(self, html_path, image_prefix, run_number): logging.getLogger().debug('got a new html page: %s, prefix: %r, run number: %s', html_path, image_prefix, run_number) # prepend the time and date to the path we just got so # the history is more readable time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) index = (time_string, str(image_prefix), str(run_number)) self.history_map[index] = html_path # synchronize the history prop if self.current_user is not None: whole_history = pickle.loads(self.getProperty('history').getValue()) whole_history[self.current_user] = self.history_map self.getProperty('history').setValue(pickle.dumps(whole_history)) self.history.insertRows(self.history.numRows()) logging.debug('numRows() is %d', self.history.numRows()) rows = self.history.numRows() - 1 self.history.setText(rows, 0, QString(time_string)) self.history.setText(rows, 1, QString(str(image_prefix))) self.history.setText(rows, 2, QString(str(run_number))) logging.debug('numRows() is %d', self.history.numRows()) self.load_file(html_path) def clear_history(self): self.history_map.clear() self.history.setNumRows(0) def propertyChanged(self, prop, oldval, newval): if prop == 'mnemonic': logging.getLogger().debug('BrowserBrick: using edna object %s', newval) if self.edna is not None: self.disconnect(self.edna, PYSIGNAL('newEDNAHTML'), self.new_html) self.edna = self.getHardwareObject(newval) logging.getLogger().debug('edna object is now: %s', self.edna) self.connect(self.edna, PYSIGNAL('newEDNAHTML'), self.new_html) def run(self): pass def login_changed(self, session_id,prop_code=None,prop_number=None,prop_id=None,expiration_time=0): logging.debug('BrowserBrick::login_changed: login changed to %r', session_id) if session_id is None: # user logged out logging.debug('user logged out') self.current_user = None else: self.current_user = (prop_code, prop_number) logging.debug('current user is now %r', self.current_user) self.clear_all() self.fill_history_for(self.current_user) def clear_all(self): self.clear_history() self.browser.setText('') def fill_history_for(self, user): if user is None: return logging.debug('loading history for user %s', user) whole_history = pickle.loads(self.getProperty('history').getValue()) try: self.history_map = whole_history[user] except KeyError: #user has no history yet self.history_map = dict() for k,v in self.history_map.items(): self.history.insertRows(self.history.numRows()) logging.debug('numRows() is %d', self.history.numRows()) rows = self.history.numRows() - 1 self.history.setText(rows, 0, k[0]) self.history.setText(rows, 1, k[1]) self.history.setText(rows, 2, k[2]) def cleanup_history(self): histories = pickle.loads(self.getProperty('history').getValue()) sessions_ttl = self.getProperty('sessions ttl (in days)').getValue() limit_date = datetime.now() - timedelta(sessions_ttl) #we're mutating the dict so do not use iteritems() just to be sure for user in list(histories.keys()): history = histories[user] #get the keys where the date is more recent than the limit date valid_keys = [x for x in list(history.keys()) if datetime.strptime(x[0], '%Y-%m-%d %H:%M:%S') > limit_date] #NB: old format was "%a, %d %b %Y %H:%M:%S" if len(valid_keys) != len(history): # some entries are too old, copy only the ones that are recent enough new_hist = dict((k,history[k]) for k in valid_keys) logging.debug('BrowserBrick: removed %d entries from saved history for user %s', len(history) - len(valid_keys), user) histories[user] = new_hist self.getProperty('history').setValue(pickle.dumps(histories))
def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar() if not name: self.setName("EventGeneratorForm") self.setCentralWidget(QWidget(self,"qt_central_widget")) EventGeneratorFormLayout = QHBoxLayout(self.centralWidget(),11,6,"EventGeneratorFormLayout") layout9 = QVBoxLayout(None,0,6,"layout9") self.groupBox4 = QGroupBox(self.centralWidget(),"groupBox4") self.groupBox4.setColumnLayout(0,Qt.Vertical) self.groupBox4.layout().setSpacing(6) self.groupBox4.layout().setMargin(11) groupBox4Layout = QGridLayout(self.groupBox4.layout()) groupBox4Layout.setAlignment(Qt.AlignTop) self.mxcTable = QTable(self.groupBox4,"mxcTable") self.mxcTable.setNumCols(self.mxcTable.numCols() + 1) self.mxcTable.horizontalHeader().setLabel(self.mxcTable.numCols() - 1,self.__tr("Prescaler")) self.mxcTable.setNumCols(self.mxcTable.numCols() + 1) self.mxcTable.horizontalHeader().setLabel(self.mxcTable.numCols() - 1,self.__tr("Trigger")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("0")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("1")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("2")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("3")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("4")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("5")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("6")) self.mxcTable.setNumRows(self.mxcTable.numRows() + 1) self.mxcTable.verticalHeader().setLabel(self.mxcTable.numRows() - 1,self.__tr("7")) self.mxcTable.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding,0,0,self.mxcTable.sizePolicy().hasHeightForWidth())) self.mxcTable.setNumRows(8) self.mxcTable.setNumCols(2) groupBox4Layout.addWidget(self.mxcTable,0,0) layout9.addWidget(self.groupBox4) self.groupBox6 = QGroupBox(self.centralWidget(),"groupBox6") self.groupBox6.setColumnLayout(0,Qt.Vertical) self.groupBox6.layout().setSpacing(0) self.groupBox6.layout().setMargin(11) groupBox6Layout = QGridLayout(self.groupBox6.layout()) groupBox6Layout.setAlignment(Qt.AlignTop) self.enev_1 = QPushButton(self.groupBox6,"enev_1") self.enev_1.setToggleButton(1) groupBox6Layout.addMultiCellWidget(self.enev_1,1,2,0,0) self.enev_2 = QPushButton(self.groupBox6,"enev_2") self.enev_2.setToggleButton(1) groupBox6Layout.addWidget(self.enev_2,3,0) self.enev_5 = QPushButton(self.groupBox6,"enev_5") self.enev_5.setToggleButton(1) groupBox6Layout.addWidget(self.enev_5,6,0) self.enev_6 = QPushButton(self.groupBox6,"enev_6") self.enev_6.setToggleButton(1) groupBox6Layout.addWidget(self.enev_6,7,0) self.enev_7 = QPushButton(self.groupBox6,"enev_7") self.enev_7.setToggleButton(1) groupBox6Layout.addWidget(self.enev_7,8,0) self.enev_4 = QPushButton(self.groupBox6,"enev_4") self.enev_4.setToggleButton(1) groupBox6Layout.addWidget(self.enev_4,5,0) self.enev_3 = QPushButton(self.groupBox6,"enev_3") self.enev_3.setToggleButton(1) groupBox6Layout.addWidget(self.enev_3,4,0) self.enev_0 = QPushButton(self.groupBox6,"enev_0") self.enev_0.setToggleButton(1) groupBox6Layout.addWidget(self.enev_0,0,0) self.trigev_1 = QLineEdit(self.groupBox6,"trigev_1") groupBox6Layout.addWidget(self.trigev_1,2,2) self.trigev_2 = QLineEdit(self.groupBox6,"trigev_2") groupBox6Layout.addWidget(self.trigev_2,3,2) self.trigev_3 = QLineEdit(self.groupBox6,"trigev_3") groupBox6Layout.addWidget(self.trigev_3,4,2) self.trigev_4 = QLineEdit(self.groupBox6,"trigev_4") groupBox6Layout.addWidget(self.trigev_4,5,2) self.trigev_5 = QLineEdit(self.groupBox6,"trigev_5") groupBox6Layout.addWidget(self.trigev_5,6,2) self.trigev_6 = QLineEdit(self.groupBox6,"trigev_6") groupBox6Layout.addWidget(self.trigev_6,7,2) self.trigev_7 = QLineEdit(self.groupBox6,"trigev_7") groupBox6Layout.addWidget(self.trigev_7,8,2) self.trigev_0 = QLineEdit(self.groupBox6,"trigev_0") groupBox6Layout.addWidget(self.trigev_0,0,2) layout9.addWidget(self.groupBox6) self.groupBox9 = QGroupBox(self.centralWidget(),"groupBox9") self.groupBox9.setColumnLayout(0,Qt.Vertical) self.groupBox9.layout().setSpacing(6) self.groupBox9.layout().setMargin(11) groupBox9Layout = QGridLayout(self.groupBox9.layout()) groupBox9Layout.setAlignment(Qt.AlignTop) self.textLabel2_2 = QLabel(self.groupBox9,"textLabel2_2") groupBox9Layout.addWidget(self.textLabel2_2,0,0) self.ckMode = QComboBox(0,self.groupBox9,"ckMode") groupBox9Layout.addWidget(self.ckMode,0,1) self.ckSynth = QComboBox(0,self.groupBox9,"ckSynth") groupBox9Layout.addWidget(self.ckSynth,1,1) self.textLabel4 = QLabel(self.groupBox9,"textLabel4") groupBox9Layout.addWidget(self.textLabel4,1,0) layout9.addWidget(self.groupBox9) EventGeneratorFormLayout.addLayout(layout9) layout8 = QVBoxLayout(None,0,6,"layout8") self.gbDBus = QGroupBox(self.centralWidget(),"gbDBus") self.gbDBus.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Preferred,0,0,self.gbDBus.sizePolicy().hasHeightForWidth())) self.gbDBus.setMinimumSize(QSize(250,0)) self.gbDBus.setColumnLayout(0,Qt.Vertical) self.gbDBus.layout().setSpacing(6) self.gbDBus.layout().setMargin(11) gbDBusLayout = QVBoxLayout(self.gbDBus.layout()) gbDBusLayout.setAlignment(Qt.AlignTop) layout8.addWidget(self.gbDBus) self.groupBox3 = QGroupBox(self.centralWidget(),"groupBox3") self.groupBox3.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Maximum,0,0,self.groupBox3.sizePolicy().hasHeightForWidth())) self.groupBox3.setColumnLayout(0,Qt.Vertical) self.groupBox3.layout().setSpacing(6) self.groupBox3.layout().setMargin(11) groupBox3Layout = QGridLayout(self.groupBox3.layout()) groupBox3Layout.setAlignment(Qt.AlignTop) self.textLabel2 = QLabel(self.groupBox3,"textLabel2") groupBox3Layout.addWidget(self.textLabel2,1,0) self.textLabel1 = QLabel(self.groupBox3,"textLabel1") groupBox3Layout.addWidget(self.textLabel1,0,0) self.acSyncMXC7 = QCheckBox(self.groupBox3,"acSyncMXC7") groupBox3Layout.addMultiCellWidget(self.acSyncMXC7,3,3,0,1) self.acByPass = QCheckBox(self.groupBox3,"acByPass") groupBox3Layout.addWidget(self.acByPass,3,2) self.acDelay = QLineEdit(self.groupBox3,"acDelay") groupBox3Layout.addMultiCellWidget(self.acDelay,1,1,1,2) self.acPrescaler = QLineEdit(self.groupBox3,"acPrescaler") groupBox3Layout.addMultiCellWidget(self.acPrescaler,0,0,1,2) self.textLabel1_3 = QLabel(self.groupBox3,"textLabel1_3") groupBox3Layout.addWidget(self.textLabel1_3,2,0) self.acTrigger = QComboBox(0,self.groupBox3,"acTrigger") groupBox3Layout.addMultiCellWidget(self.acTrigger,2,2,1,2) layout8.addWidget(self.groupBox3) self.groupBox9_2 = QGroupBox(self.centralWidget(),"groupBox9_2") self.groupBox9_2.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Maximum,0,0,self.groupBox9_2.sizePolicy().hasHeightForWidth())) self.groupBox9_2.setColumnLayout(0,Qt.Vertical) self.groupBox9_2.layout().setSpacing(6) self.groupBox9_2.layout().setMargin(11) groupBox9_2Layout = QGridLayout(self.groupBox9_2.layout()) groupBox9_2Layout.setAlignment(Qt.AlignTop) self.fp0 = QComboBox(0,self.groupBox9_2,"fp0") groupBox9_2Layout.addWidget(self.fp0,1,0) self.fp1 = QComboBox(0,self.groupBox9_2,"fp1") groupBox9_2Layout.addWidget(self.fp1,1,1) self.fp2 = QComboBox(0,self.groupBox9_2,"fp2") groupBox9_2Layout.addWidget(self.fp2,2,0) self.fp3 = QComboBox(0,self.groupBox9_2,"fp3") groupBox9_2Layout.addWidget(self.fp3,2,1) self.fp4 = QComboBox(0,self.groupBox9_2,"fp4") groupBox9_2Layout.addWidget(self.fp4,3,0) self.fp5 = QComboBox(0,self.groupBox9_2,"fp5") groupBox9_2Layout.addWidget(self.fp5,3,1) self.fp6 = QComboBox(0,self.groupBox9_2,"fp6") groupBox9_2Layout.addWidget(self.fp6,4,0) self.fp7 = QComboBox(0,self.groupBox9_2,"fp7") groupBox9_2Layout.addWidget(self.fp7,4,1) self.fp8 = QComboBox(0,self.groupBox9_2,"fp8") groupBox9_2Layout.addWidget(self.fp8,5,0) self.fp9 = QComboBox(0,self.groupBox9_2,"fp9") groupBox9_2Layout.addWidget(self.fp9,5,1) self.fp10 = QComboBox(0,self.groupBox9_2,"fp10") groupBox9_2Layout.addWidget(self.fp10,6,0) self.fp11 = QComboBox(0,self.groupBox9_2,"fp11") groupBox9_2Layout.addWidget(self.fp11,6,1) self.fp12 = QComboBox(0,self.groupBox9_2,"fp12") groupBox9_2Layout.addWidget(self.fp12,7,0) self.fp13 = QComboBox(0,self.groupBox9_2,"fp13") groupBox9_2Layout.addWidget(self.fp13,7,1) self.fp14 = QComboBox(0,self.groupBox9_2,"fp14") groupBox9_2Layout.addWidget(self.fp14,8,0) self.fp15 = QComboBox(0,self.groupBox9_2,"fp15") groupBox9_2Layout.addWidget(self.fp15,8,1) self.fp16 = QComboBox(0,self.groupBox9_2,"fp16") groupBox9_2Layout.addWidget(self.fp16,9,0) self.fp17 = QComboBox(0,self.groupBox9_2,"fp17") groupBox9_2Layout.addWidget(self.fp17,9,1) self.fp18 = QComboBox(0,self.groupBox9_2,"fp18") groupBox9_2Layout.addWidget(self.fp18,10,0) self.fp19 = QComboBox(0,self.groupBox9_2,"fp19") groupBox9_2Layout.addWidget(self.fp19,10,1) self.textLabel2_3 = QLabel(self.groupBox9_2,"textLabel2_3") groupBox9_2Layout.addMultiCellWidget(self.textLabel2_3,0,0,0,1) layout8.addWidget(self.groupBox9_2) EventGeneratorFormLayout.addLayout(layout8) layout11 = QVBoxLayout(None,0,6,"layout11") self.groupBox8 = QGroupBox(self.centralWidget(),"groupBox8") self.groupBox8.setEnabled(0) self.groupBox8.setColumnLayout(0,Qt.Vertical) self.groupBox8.layout().setSpacing(6) self.groupBox8.layout().setMargin(11) groupBox8Layout = QGridLayout(self.groupBox8.layout()) groupBox8Layout.setAlignment(Qt.AlignTop) self.dataBufData = QTable(self.groupBox8,"dataBufData") self.dataBufData.setNumRows(self.dataBufData.numRows() + 1) self.dataBufData.verticalHeader().setLabel(self.dataBufData.numRows() - 1,self.__tr("0")) self.dataBufData.setNumRows(1) self.dataBufData.setNumCols(1) groupBox8Layout.addMultiCellWidget(self.dataBufData,2,2,0,2) self.dataBufSize = QLineEdit(self.groupBox8,"dataBufSize") groupBox8Layout.addWidget(self.dataBufSize,1,2) self.textLabel1_2 = QLabel(self.groupBox8,"textLabel1_2") groupBox8Layout.addWidget(self.textLabel1_2,1,1) self.dataBufEnable = QCheckBox(self.groupBox8,"dataBufEnable") groupBox8Layout.addMultiCellWidget(self.dataBufEnable,0,0,0,1) self.dataBuffTrigger = QCheckBox(self.groupBox8,"dataBuffTrigger") groupBox8Layout.addWidget(self.dataBuffTrigger,1,0) self.dataBufMode = QCheckBox(self.groupBox8,"dataBufMode") groupBox8Layout.addWidget(self.dataBufMode,0,2) layout11.addWidget(self.groupBox8) self.groupBox7 = QGroupBox(self.centralWidget(),"groupBox7") self.groupBox7.setColumnLayout(0,Qt.Vertical) self.groupBox7.layout().setSpacing(6) self.groupBox7.layout().setMargin(11) groupBox7Layout = QVBoxLayout(self.groupBox7.layout()) groupBox7Layout.setAlignment(Qt.AlignTop) layout7 = QHBoxLayout(None,0,6,"layout7") self.triggerSeq1 = QPushButton(self.groupBox7,"triggerSeq1") layout7.addWidget(self.triggerSeq1) self.triggerSeq2 = QPushButton(self.groupBox7,"triggerSeq2") layout7.addWidget(self.triggerSeq2) groupBox7Layout.addLayout(layout7) layout11_2 = QHBoxLayout(None,0,6,"layout11_2") self.swEvent = QLineEdit(self.groupBox7,"swEvent") layout11_2.addWidget(self.swEvent) self.sendSwEvent = QPushButton(self.groupBox7,"sendSwEvent") layout11_2.addWidget(self.sendSwEvent) groupBox7Layout.addLayout(layout11_2) layout11.addWidget(self.groupBox7) layout10 = QHBoxLayout(None,0,6,"layout10") self.masterEnable = QCheckBox(self.centralWidget(),"masterEnable") layout10.addWidget(self.masterEnable) self.swEventEnable = QCheckBox(self.centralWidget(),"swEventEnable") layout10.addWidget(self.swEventEnable) layout11.addLayout(layout10) layout12 = QGridLayout(None,1,1,0,6,"layout12") self.editSeq1 = QPushButton(self.centralWidget(),"editSeq1") layout12.addWidget(self.editSeq1,0,0) self.loadConfig = QPushButton(self.centralWidget(),"loadConfig") layout12.addWidget(self.loadConfig,0,1) self.saveConfig = QPushButton(self.centralWidget(),"saveConfig") layout12.addWidget(self.saveConfig,1,1) self.editSeq2 = QPushButton(self.centralWidget(),"editSeq2") layout12.addWidget(self.editSeq2,1,0) self.restoreConfig = QPushButton(self.centralWidget(),"restoreConfig") layout12.addWidget(self.restoreConfig,0,2) self.applyConfig = QPushButton(self.centralWidget(),"applyConfig") layout12.addWidget(self.applyConfig,1,2) layout11.addLayout(layout12) EventGeneratorFormLayout.addLayout(layout11) self.languageChange() self.resize(QSize(795,520).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.restoreConfig,SIGNAL("clicked()"),self.onRestoreConfig) self.connect(self.applyConfig,SIGNAL("clicked()"),self.onApplyConfig) self.connect(self.loadConfig,SIGNAL("clicked()"),self.loadConfig_clicked) self.connect(self.saveConfig,SIGNAL("clicked()"),self.saveConfig_clicked) self.connect(self.dataBufSize,SIGNAL("returnPressed()"),self.dataBufSize_returnPressed) self.connect(self.dataBufSize,SIGNAL("lostFocus()"),self.dataBufSize_returnPressed) self.connect(self.editSeq1,SIGNAL("clicked()"),self.editSeq1_clicked) self.connect(self.editSeq2,SIGNAL("clicked()"),self.editSeq2_clicked) self.connect(self.sendSwEvent,SIGNAL("clicked()"),self.sendSwEvent_clicked) self.connect(self.mxcTable,SIGNAL("valueChanged(int,int)"),self.mxcTable_valueChanged) self.connect(self.triggerSeq2,SIGNAL("clicked()"),self.triggerSeq2_clicked) self.connect(self.triggerSeq1,SIGNAL("clicked()"),self.triggerSeq1_clicked) self.textLabel1_3.setBuddy(self.acTrigger)
class ParametersTable(QWidget): def __init__(self, parent=None, name="parameter_table"): QWidget.__init__(self, parent, name) self.__dc_parameters = None self.add_dc_cb = None self.parameters_label = QLabel(self, "parameters_label") self.parameter_table = QTable(self, "parameter_table") self.parameter_table.setNumCols(3) self.parameter_table.horizontalHeader().\ setLabel(0, self.__tr("Name"), -1) self.parameter_table.horizontalHeader().\ setLabel(1, self.__tr("Value")) self.parameter_table.verticalHeader().hide() self.parameter_table.horizontalHeader().setClickEnabled(False, 0) self.parameter_table.horizontalHeader().setClickEnabled(False, 1) self.parameter_table.setColumnWidth(0, 200) self.parameter_table.setColumnWidth(1, 200) self.parameter_table.hideColumn(2) self.parameter_table.setColumnReadOnly(0, True) self.parameter_table.setLeftMargin(0) self.parameter_table.setNumRows(0) self.position_label = QLabel("Positions", self, "position_view") self.position_label.setAlignment(Qt.AlignTop) ## self.add_button = QPushButton(self, "add_button") #self.add_button.setDisabled(True) h_layout = QGridLayout(self, 1, 2) v_layout_position = QVBoxLayout(self) v_layout_position.addWidget(self.position_label) v_layout_table = QVBoxLayout(self) h_layout.addLayout(v_layout_table, 0, 0) h_layout.addLayout(v_layout_position, 0, 1) v_layout_table.addWidget(self.parameters_label) v_layout_table.addWidget(self.parameter_table) ## v_layout_table.addWidget(self.add_button) ## self.languageChange() ## QObject.connect(self.add_button, SIGNAL("clicked()"), ## self.__add_data_collection) QObject.connect(self.parameter_table, SIGNAL("valueChanged(int, int)"), self.__parameter_value_change) #self.populate_parameter_table(self.__dc_parameters) ## def languageChange(self): ## self.add_button.setText("Add") def __tr(self, s, c=None): return qApp.translate("parameter_table", s, c) def __add_data_collection(self): return self.add_dc_cb(self.__dc_parameters, self.collection_type) def populate_parameter_table(self, parameters): self.parameter_table.setNumRows(11) i = 0 for param_key, parameter in parameters.items(): if param_key != 'positions': self.parameter_table.setText(i, 0, parameter[0]) self.parameter_table.setText(i, 1, parameter[1]) self.parameter_table.setText(i, 2, param_key) i += 1 ## def add_positions(self, positions): ## self.__dc_parameters['positions'].extend(positions) def __parameter_value_change(self, row, col): self.__dc_parameters[str(self.parameter_table.item(row, 2).text())][1] = \ str(self.parameter_table.item(row, 1).text())
def __init__(self, *args): BaseComponents.BlissWidget.__init__(self, *args) #map displayed string in the history list -> actual file path self.history_map = dict() self.layout = QVBoxLayout(self) self.defineSlot('load_file', ()) self.defineSlot('login_changed', ()) self.addProperty('mnemonic', 'string', '') self.addProperty('history', 'string', '', hidden=True) self.addProperty('sessions ttl (in days)', 'integer', '30') #make sure the history property is a pickled dict try: hist = pickle.loads(self.getProperty('history').getValue()) except: # EOFError if the string is empty but let's not count on it self.getProperty('history').setValue(pickle.dumps(dict())) # maybe defer that for later self.cleanup_history() self.main_layout = QSplitter(self) self.main_layout.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) # left part of the splitter self.history_box = QVBox(self.main_layout) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.sort_order = True self.sort_col = None self.history = QTable(self.history_box) self.history.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)) self.history.setSelectionMode(QTable.SingleRow) self.history.setNumCols(3) self.history.verticalHeader().hide() self.history.setLeftMargin(0) self.history.setSorting(False) QObject.connect(self.history, SIGNAL('currentChanged(int,int)'), self.history_changed) #by default sorting only sorts the columns and not whole rows. #let's reimplement that QObject.connect(self.history.horizontalHeader(), SIGNAL('clicked(int)'), self.sort_column) header = self.history.horizontalHeader() header.setLabel(0, 'Time and date') header.setLabel(1, 'Prefix') header.setLabel(2, 'Run number') self.clear_history_button = QPushButton('Clear history', self.history_box) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) QObject.connect(self.clear_history_button, SIGNAL('clicked()'), self.clear_history) # Right part of the splitter self.browser_box = QWidget(self.main_layout) QVBoxLayout(self.browser_box) self.browser_box.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.top_layout = QHBoxLayout(self.browser_box) self.back_button = QToolButton(self.browser_box) self.back_button.setIconSet(QIconSet(Icons.load('Left2'))) self.back_button.setTextLabel('Back') self.back_button.setUsesTextLabel(True) self.back_button.setTextPosition(QToolButton.BelowIcon) self.back_button.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.forward_button = QToolButton(self.browser_box) self.forward_button.setIconSet(QIconSet(Icons.load('Right2'))) self.forward_button.setTextLabel('Forward') self.forward_button.setUsesTextLabel(True) self.forward_button.setTextPosition(QToolButton.BelowIcon) self.forward_button.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.top_layout.addWidget(self.back_button) self.top_layout.addWidget(self.forward_button) self.browser_box.layout().addLayout(self.top_layout) self.browser = QTextBrowser(self.browser_box) self.browser.setReadOnly(True) self.browser_box.layout().addWidget(self.browser) self.layout.addWidget(self.main_layout) #initially disabled self.forward_button.setEnabled(False) self.back_button.setEnabled(False) #connections QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'), self.back_button.setEnabled) QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'), self.forward_button.setEnabled) QObject.connect(self.back_button, SIGNAL('clicked()'), self.browser.backward) QObject.connect(self.forward_button, SIGNAL('clicked()'), self.browser.forward) self.edna = None
class ChannelWidgetSettingsDialog(QDialog): value_display_widgets = { "LCD": QLCDNumber, "label": QLabel, "combo": QComboBox, "editable": QLineEdit } alignment_flags = { 'vleft': Qt.AlignLeft | Qt.AlignBottom, 'vright': Qt.AlignRight | Qt.AlignBottom, 'vcentre': Qt.AlignHCenter | Qt.AlignBottom, 'hleft': Qt.AlignLeft | Qt.AlignVCenter, 'hright': Qt.AlignRight | Qt.AlignVCenter, 'hcentre': Qt.AlignCenter } def __init__(self, *args): QDialog.__init__(self, *args) self.setCaption("%s - channel properties" % str(self.name())) self.innerbox = QSplitter(Qt.Horizontal, self) grid = QGrid(2, self.innerbox) grid.setSpacing(5) grid.setMargin(5) QLabel("Label", grid) self.txtLabel = QLineEdit(grid) QLabel("Label position", grid) labelpos_group = QVButtonGroup(grid) self.optLabelAbove = QRadioButton("above", labelpos_group) self.optLabelLeft = QRadioButton("on the left", labelpos_group) self.optLabelLeft.setChecked(True) QLabel("Label alignment", grid) labelalign_group = QHButtonGroup(grid) self.optLabelAlignLeft = QRadioButton("left", labelalign_group) self.optLabelAlignCenter = QRadioButton("centre", labelalign_group) self.optLabelAlignRight = QRadioButton("right", labelalign_group) self.optLabelAlignLeft.setChecked(True) QLabel("Value display format", grid) self.txtFormat = QLineEdit(grid) QLabel("Value display style", grid) self.lstChannelStyles = QComboBox(grid) self.lstChannelStyles.insertStrList( ["LCD", "label", "combo", "editable"]) QObject.connect(self.lstChannelStyles, SIGNAL('activated(int)'), self.lstChannelStylesChanged) self.combopanel = QHBox(self.innerbox) self.tblComboChoices = QTable(self.combopanel) self.tblComboChoices.setNumCols(2) self.tblComboChoices.setNumRows(10) for i in range(10): self.tblComboChoices.verticalHeader().setLabel( i, "%2.0f" % (i + 1)) self.tblComboChoices.setText(i, 0, "%2.0f" % (i + 1)) self.tblComboChoices.horizontalHeader().setLabel(0, "value") self.tblComboChoices.horizontalHeader().setLabel(1, "label") self.combopanel.hide() ok_cancel = QHBox(self) self.cmdOk = QPushButton("ok", ok_cancel) HorizontalSpacer(ok_cancel) self.cmdCancel = QPushButton("cancel", ok_cancel) QObject.connect(self.cmdOk, SIGNAL("clicked()"), self.accept) QObject.connect(self.cmdCancel, SIGNAL("clicked()"), self.reject) QVBoxLayout(self, 5, 10) self.layout().addWidget(self.innerbox) self.layout().addWidget(ok_cancel) def _showComboPanel(self, show=True): if show: self.resize(QSize(self.width() * 2, self.height())) self.combopanel.show() self.innerbox.setSizes([self.width() / 2, self.width() / 2]) else: self.resize(QSize(self.width() / 2, self.height())) self.combopanel.hide() def lstChannelStylesChanged(self, idx): if idx == 2: # combo self._showComboPanel() else: self._showComboPanel(False) def channelWidget(self, parent, running=False, config=None): if config is None: config = self.channelConfig() else: self.setChannelConfig(config) w = ControlPanelWidget(parent, config, running=running) if config["label_pos"] == "above": QVBoxLayout(w, 2, 0) alignment_prefix = "v" else: QHBoxLayout(w, 2, 0) alignment_prefix = "h" alignment_flag = ChannelWidgetSettingsDialog.alignment_flags[ alignment_prefix + config["label_align"]] w.layout().addWidget(QLabel(config["label"], w), 0, alignment_flag) w.value = ChannelWidgetSettingsDialog.value_display_widgets[ config["value_display_style"]](w) if "combo" in config: for value, label in config["combo"]: w.value.insertItem(label) w.layout().addWidget(w.value) return w def setChannelConfig(self, config): self.txtLabel.setText(config["label"]) self.optLabelAbove.setChecked(config["label_pos"] == "above") self.optLabelLeft.setChecked(config["label_pos"] == "left") self.optLabelAlignLeft.setChecked(config["label_align"] == "left") self.optLabelAlignRight.setChecked(config["label_align"] == "right") self.optLabelAlignCenter.setChecked(config["label_align"] == "centre") self.lstChannelStyles.setCurrentText(config["value_display_style"]) self.txtFormat.setText(config["value_display_format"]) if "combo" in config: i = 0 for value, label in config["combo"]: self.tblComboChoices.setText(i, 0, value) self.tblComboChoices.setText(i, 1, label) i += 1 self._showComboPanel() def channelConfig(self): config = { "type": "channel", "name": str(self.name()), "label": str(self.txtLabel.text()), "label_pos": self.optLabelAbove.isChecked() and "above" or "left", "value_display_style": str(self.lstChannelStyles.currentText()), "label_align": self.optLabelAlignLeft.isChecked() and "left" or self.optLabelAlignRight.isChecked() and "right" or "centre", "value_display_format": str(self.txtFormat.text()) } if config["value_display_style"] == "combo": combocfg = [] for i in range(10): value = self.tblComboChoices.text(i, 0) label = self.tblComboChoices.text(i, 1) combocfg.append((value, label)) config["combo"] = combocfg return config
def endEdit(self, row, col, accept, replace): if col == 2: # start pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) < lowlimit: raise except BaseException: QMessageBox.warning( None, "Invalid value", "Cannot set start pos. below low limit %f" % lowlimit, QMessageBox.Ok, ) accept = False elif col == 3: # end pos. motor = self.motors[str(self.text(row, 0))] if motor is not None and motor.isReady(): lowlimit, highlimit = motor.getLimits() try: if float(self.text(row, col)) > highlimit: raise except BaseException: QMessageBox.warning( None, "Invalid value", "Cannot set end pos. beyond high limit %f" % highlimit, QMessageBox.Ok, ) accept = False elif col in self.customColumns: value = str(self.text(row, col)) type = self.customColumns[col]["type"] if type == "integer": try: v = int(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid integer value" % value, QMessageBox.Ok, ) accept = False elif type == "float": try: v = float(value) except BaseException: QMessageBox.warning( None, "Invalid value", "%s is not a valid float value" % value, QMessageBox.Ok, ) accept = False return QTable.endEdit(self, row, col, accept, replace)
def keyPressEvent(self, ev): if ev.key() == Qt.Key_Enter or ev.key() == Qt.Key_Return: self.editCell(self.currentRow(), self.currentColumn()) else: QTable.keyPressEvent(self, ev)
def __init__(self, parent=None): QTable.__init__(self, parent) self.data = None
def beginEdit(self, row, col, replace): if col == 1 and row >= 0: self.item(row, 2).setEnabled(1) return QTable.beginEdit(self, row, col, replace)
class Routing(QWidget): """A variable-sized table with sliders, ideal for signal routing purposes. Args: rows (int), columns (int), route to self (bool), Parent (obj) (None),""" def __init__(self, row, col, routeToSelf = True, parent = None,name = None,fl = 0): QWidget.__init__(self,parent,name,fl) if not name: self.setName("Form4") self.routeToSelf = routeToSelf self.empty_cells = [] self.currentvalue = None #holds current slider value self.table1 = QTable(self,"table1") self.table1.setPaletteBackgroundColor(QColor(0,0,0)) self.table1.viewport().setPaletteBackgroundColor(QColor(0,0,0)) self.table1.setResizePolicy(QTable.AutoOne) self.table1.setVScrollBarMode(QTable.AlwaysOff) for r in range(self.table1.numRows()): self.table1.setRowHeight(r, 18) self.table1.setRowStretchable(r, False) pr = Param()#Holding param self.root_param.insertChild(pr) self.params.append(pr) for c in range(self.table1.numCols()): if r == 0: self.table1.setColumnWidth(c, self.columnwidth) if self.routeToSelf is True or r is not c: p = Param(type=float) pr.insertChild(p) self.table1.setCellWidget(r, c, ParamProgress(p, self.table1)) else: #do nothing #self.params[r].append(-1) self.empty_cells.append((r, c)) self.table1.setHScrollBarMode(QTable.AlwaysOff) self.table1.setShowGrid(0) self.table1.setReadOnly(1) self.table1.setSelectionMode(QTable.NoSelection) self.table1.setFocusPolicy(QWidget.NoFocus) self.root_param = Param() self.params = [] #holds all parent Params self.columnwidth = 50 self.setsize(row, col) self.adjustSize() def setsize(self, row, col): """set size of table: row, col Creates a parent Param for every row, with child params for every col. No other adjustments, namings or range settings are done here, but has to be done in the subclass, preferrably after the init of this class.""" self.table1.setNumRows(row) self.table1.setNumCols(col) self.setUpdatesEnabled(False) for r in range(self.table1.numRows()): self.table1.setRowHeight(r, 18) self.table1.setRowStretchable(r, False) pr = Param()#Holding param self.root_param.insertChild(pr) self.params.append(pr) for c in range(self.table1.numCols()): if r == 0: self.table1.setColumnWidth(c, self.columnwidth) if self.routeToSelf is True or r is not c: p = Param(type=float) pr.insertChild(p) self.table1.setCellWidget(r, c, ParamProgress(p, self.table1)) else: #do nothing #self.params[r].append(-1) self.empty_cells.append((r, c)) self.table1.viewport().adjustSize() self.table1.adjustSize() self.setUpdatesEnabled(True) def set_row_labels(self, lust): self.table1.setRowLabels(lust) #self.table1.viewport().adjustSize() self.table1.adjustSize() def set_col_labels(self, lust): self.table1.setColumnLabels(lust) self.table1.setTopMargin(18) #self.table1.viewport().adjustSize() self.table1.adjustSize() def params_reparent(self, parent): for p in self.params: parent.insertChild(p) def set_column_width(self, i): for c in range(self.table1.numCols()): self.table1.setColumnWidth(c, i) self.table1.adjustSize() self.table1.viewport().adjustSize() self.columnwidth = i def set_row_height(self, i): for c in range(self.table1.numRows()): self.table1.setRowHeight(c, i) self.table1.adjustSize() self.table1.viewport().adjustSize() def setlabels(self, row, col): """set labels for headers: row(list), col(list)""" for i, item in enumerate(row): self.table1.verticalHeader().setLabel(i, QString(item)) for i, item in enumerate(col): self.table1.horizontalHeader().setLabel(i, QString(item)) def clear_cell(self, r, c): self.table1.clearCellWidget(r, c) self.table1.setCellWidget(r, c, QFrame()) self.table1.cellWidget(r, c).setPaletteBackgroundColor(QColor(50, 50, 50)) self.empty_cells.append((r, c))
class NotesListUI(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("NotesListUI") self.notes_table = QTable(self,"notes_table") self.notes_table.setNumCols(self.notes_table.numCols() + 1) self.notes_table.horizontalHeader().setLabel(self.notes_table.numCols() - 1,self.__tr("Name")) self.notes_table.setNumCols(self.notes_table.numCols() + 1) self.notes_table.horizontalHeader().setLabel(self.notes_table.numCols() - 1,self.__tr("Content")) self.notes_table.setGeometry(QRect(20,20,510,360)) self.notes_table.setMinimumSize(QSize(300,0)) self.notes_table.setResizePolicy(QTable.AutoOne) self.notes_table.setVScrollBarMode(QTable.AlwaysOn) self.notes_table.setNumRows(0) self.notes_table.setNumCols(2) LayoutWidget = QWidget(self,"layout7") LayoutWidget.setGeometry(QRect(90,400,377,29)) layout7 = QHBoxLayout(LayoutWidget,5,5,"layout7") self.add_button = QPushButton(LayoutWidget,"add_button") layout7.addWidget(self.add_button) spacer = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum) layout7.addItem(spacer) self.edit_button = QPushButton(LayoutWidget,"edit_button") layout7.addWidget(self.edit_button) layout7.addItem(spacer) self.delete_button = QPushButton(LayoutWidget,"delete_button") layout7.addWidget(self.delete_button) layout7.addItem(spacer) self.list_note_button = QPushButton(LayoutWidget,"list_note_button") layout7.addWidget(self.list_note_button) self.languageChange() self.resize(QSize(555,447).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) def languageChange(self): self.setCaption(self.__tr("Notes")) self.notes_table.horizontalHeader().setLabel(0,self.__tr("Name")) self.notes_table.horizontalHeader().setLabel(1,self.__tr("Content")) self.add_button.setText(self.__tr("New")) self.edit_button.setText(self.__tr("Edit")) self.delete_button.setText(self.__tr("Delete")) self.list_note_button.setText(self.__tr("List Notes")) def __tr(self,s,c = None): return qApp.translate("NotesListUI",s,c)
def __init__(self, *args): BaseComponents.BlissWidget.__init__(self, *args) #map displayed string in the history list -> actual file path self.history_map = dict() self.layout = QVBoxLayout(self) self.defineSlot('load_file', ()) self.defineSlot('login_changed', ()) self.addProperty('mnemonic', 'string', '') self.addProperty('history', 'string', '', hidden=True) self.addProperty('sessions ttl (in days)', 'integer', '30') #make sure the history property is a pickled dict try: hist = pickle.loads(self.getProperty('history').getValue()) except: # EOFError if the string is empty but let's not count on it self.getProperty('history').setValue(pickle.dumps(dict())) # maybe defer that for later self.cleanup_history() self.main_layout = QSplitter(self) self.main_layout.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) # left part of the splitter self.history_box = QVBox(self.main_layout) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.sort_order = True self.sort_col = None self.history = QTable(self.history_box) self.history.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)) self.history.setSelectionMode(QTable.SingleRow) self.history.setNumCols(3) self.history.verticalHeader().hide() self.history.setLeftMargin(0) self.history.setSorting(False) QObject.connect(self.history, SIGNAL('currentChanged(int,int)'), self.history_changed) #by default sorting only sorts the columns and not whole rows. #let's reimplement that QObject.connect(self.history.horizontalHeader(), SIGNAL('clicked(int)'), self.sort_column) header = self.history.horizontalHeader() header.setLabel(0, 'Time and date') header.setLabel(1, 'Prefix') header.setLabel(2, 'Run number') self.clear_history_button = QPushButton('Clear history', self.history_box) self.history_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) QObject.connect(self.clear_history_button, SIGNAL('clicked()'), self.clear_history) # Right part of the splitter self.browser_box = QWidget(self.main_layout) QVBoxLayout(self.browser_box) self.browser_box.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.top_layout = QHBoxLayout(self.browser_box) self.back_button = QToolButton(self.browser_box) self.back_button.setIconSet(QIconSet(Icons.load('Left2'))) self.back_button.setTextLabel('Back') self.back_button.setUsesTextLabel(True) self.back_button.setTextPosition(QToolButton.BelowIcon) self.back_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.forward_button = QToolButton(self.browser_box) self.forward_button.setIconSet(QIconSet(Icons.load('Right2'))) self.forward_button.setTextLabel('Forward') self.forward_button.setUsesTextLabel(True) self.forward_button.setTextPosition(QToolButton.BelowIcon) self.forward_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)) self.top_layout.addWidget(self.back_button) self.top_layout.addWidget(self.forward_button) self.browser_box.layout().addLayout(self.top_layout) self.browser = QTextBrowser(self.browser_box) self.browser.setReadOnly(True) self.browser_box.layout().addWidget(self.browser) self.layout.addWidget(self.main_layout) #initially disabled self.forward_button.setEnabled(False) self.back_button.setEnabled(False) #connections QObject.connect(self.browser, SIGNAL('backwardAvailable(bool)'), self.back_button.setEnabled) QObject.connect(self.browser, SIGNAL('forwardAvailable(bool)'), self.forward_button.setEnabled) QObject.connect(self.back_button, SIGNAL('clicked()'), self.browser.backward) QObject.connect(self.forward_button, SIGNAL('clicked()'), self.browser.forward) self.edna = None
def __init__(self, parent=None, name=None, modal=0, fl=0): QDialog.__init__(self, parent, name, modal, fl) if not name: self.setName("GUIcreatePort") GUIcreatePortLayout = QGridLayout(self, 1, 1, 11, 6, "GUIcreatePortLayout") self.cancelbutton = QPushButton(self, "cancelbutton") GUIcreatePortLayout.addWidget(self.cancelbutton, 4, 4) self.okbutton = QPushButton(self, "okbutton") GUIcreatePortLayout.addWidget(self.okbutton, 4, 3) spacer2 = QSpacerItem(421, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) GUIcreatePortLayout.addMultiCell(spacer2, 4, 4, 0, 2) self.table = QTable(self, "table") self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Device Name")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Port Nr")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Port Type")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Port Way")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Port Speed")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("PXI?")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("OK?")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Phy")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("MAC Adress")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("IP Adress")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Sub net")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("IP Name")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Bia")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("PortID")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Modified")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Modify parameters")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Old IP")) self.table.setNumCols(self.table.numCols() + 1) self.table.horizontalHeader().setLabel(self.table.numCols() - 1, self.__tr("Save Satus")) self.table.setNumRows(0) self.table.setNumCols(18) GUIcreatePortLayout.addMultiCellWidget(self.table, 3, 3, 0, 4) self.removebutton = QPushButton(self, "removebutton") GUIcreatePortLayout.addWidget(self.removebutton, 2, 0) spacer1 = QSpacerItem(351, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) GUIcreatePortLayout.addMultiCell(spacer1, 2, 2, 1, 3) self.addportbutton = QPushButton(self, "addportbutton") GUIcreatePortLayout.addMultiCellWidget(self.addportbutton, 1, 1, 0, 4) self.buttonGroup3 = QButtonGroup(self, "buttonGroup3") self.textLabel2 = QLabel(self.buttonGroup3, "textLabel2") self.textLabel2.setGeometry(QRect(11, 11, 126, 16)) self.textLabel2_2_2 = QLabel(self.buttonGroup3, "textLabel2_2_2") self.textLabel2_2_2.setGeometry(QRect(10, 60, 156, 16)) self.porttype = QLineEdit(self.buttonGroup3, "porttype") self.porttype.setGeometry(QRect(10, 80, 150, 22)) self.porttype.setMaximumSize(QSize(200, 32767)) self.textLabel2_2_3 = QLabel(self.buttonGroup3, "textLabel2_2_3") self.textLabel2_2_3.setGeometry(QRect(100, 110, 21, 16)) self.textLabel2_2_3_2 = QLabel(self.buttonGroup3, "textLabel2_2_3_2") self.textLabel2_2_3_2.setGeometry(QRect(10, 110, 56, 16)) self.textLabel2_2_2_2 = QLabel(self.buttonGroup3, "textLabel2_2_2_2") self.textLabel2_2_2_2.setGeometry(QRect(194, 11, 40, 16)) self.textLabel2_2 = QLabel(self.buttonGroup3, "textLabel2_2") self.textLabel2_2.setGeometry(QRect(190, 60, 80, 16)) self.admstatus = QCheckBox(self.buttonGroup3, "admstatus") self.admstatus.setGeometry(QRect(100, 170, 77, 20)) self.buttonGroup1 = QButtonGroup(self.buttonGroup3, "buttonGroup1") self.buttonGroup1.setGeometry(QRect(190, 110, 100, 80)) self.portwayOUT = QRadioButton(self.buttonGroup1, "portwayOUT") self.portwayOUT.setGeometry(QRect(30, 40, 40, 20)) self.portwayIN = QRadioButton(self.buttonGroup1, "portwayIN") self.portwayIN.setGeometry(QRect(30, 20, 30, 20)) self.portid = QLineEdit(self.buttonGroup3, "portid") self.portid.setGeometry(QRect(195, 30, 100, 22)) self.portid.setMaximumSize(QSize(200, 32767)) self.portnumber = QSpinBox(self.buttonGroup3, "portnumber") self.portnumber.setGeometry(QRect(189, 79, 90, 22)) self.portnumber.setMaxValue(10000) self.portspeed = QSpinBox(self.buttonGroup3, "portspeed") self.portspeed.setGeometry(QRect(10, 130, 80, 22)) self.portspeed.setMaximumSize(QSize(200, 32767)) self.portspeed.setMaxValue(100000) self.devicename = QLineEdit(self.buttonGroup3, "devicename") self.devicename.setGeometry(QRect(11, 31, 150, 22)) self.phy = QComboBox(0, self.buttonGroup3, "phy") self.phy.setGeometry(QRect(100, 130, 78, 22)) self.pxibooting = QCheckBox(self.buttonGroup3, "pxibooting") self.pxibooting.setGeometry(QRect(10, 170, 77, 20)) GUIcreatePortLayout.addMultiCellWidget(self.buttonGroup3, 0, 0, 0, 1) self.buttonGroup2 = QButtonGroup(self, "buttonGroup2") self.buttonGroup2.setSizePolicy( QSizePolicy(4, 0, 0, 0, self.buttonGroup2.sizePolicy().hasHeightForWidth())) self.textLabel2_3_2_3_2 = QLabel(self.buttonGroup2, "textLabel2_3_2_3_2") self.textLabel2_3_2_3_2.setGeometry(QRect(10, 140, 50, 16)) self.textLabel2_3_2_3 = QLabel(self.buttonGroup2, "textLabel2_3_2_3") self.textLabel2_3_2_3.setGeometry(QRect(10, 110, 50, 16)) self.textLabel2_3_2_2 = QLabel(self.buttonGroup2, "textLabel2_3_2_2") self.textLabel2_3_2_2.setGeometry(QRect(10, 80, 80, 16)) self.textLabel2_3_2 = QLabel(self.buttonGroup2, "textLabel2_3_2") self.textLabel2_3_2.setGeometry(QRect(10, 50, 60, 16)) self.textLabel2_3 = QLabel(self.buttonGroup2, "textLabel2_3") self.textLabel2_3.setGeometry(QRect(10, 20, 70, 16)) self.macadress = QLineEdit(self.buttonGroup2, "macadress") self.macadress.setGeometry(QRect(90, 20, 180, 22)) self.ipadress = QLineEdit(self.buttonGroup2, "ipadress") self.ipadress.setGeometry(QRect(90, 50, 180, 22)) self.subnetadress = QLineEdit(self.buttonGroup2, "subnetadress") self.subnetadress.setGeometry(QRect(90, 80, 180, 22)) self.ipname = QLineEdit(self.buttonGroup2, "ipname") self.ipname.setGeometry(QRect(90, 110, 180, 22)) self.bia = QLineEdit(self.buttonGroup2, "bia") self.bia.setGeometry(QRect(90, 140, 180, 22)) GUIcreatePortLayout.addMultiCellWidget(self.buttonGroup2, 0, 0, 2, 4) self.languageChange() self.resize(QSize(645, 548).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.setTabOrder(self.table, self.devicename) self.setTabOrder(self.devicename, self.portid) self.setTabOrder(self.portid, self.porttype) self.setTabOrder(self.porttype, self.portnumber) self.setTabOrder(self.portnumber, self.portspeed) self.setTabOrder(self.portspeed, self.phy) self.setTabOrder(self.phy, self.portwayIN) self.setTabOrder(self.portwayIN, self.portwayOUT) self.setTabOrder(self.portwayOUT, self.pxibooting) self.setTabOrder(self.pxibooting, self.admstatus) self.setTabOrder(self.admstatus, self.macadress) self.setTabOrder(self.macadress, self.ipadress) self.setTabOrder(self.ipadress, self.subnetadress) self.setTabOrder(self.subnetadress, self.ipname) self.setTabOrder(self.ipname, self.bia) self.setTabOrder(self.bia, self.addportbutton) self.setTabOrder(self.addportbutton, self.removebutton) self.setTabOrder(self.removebutton, self.okbutton) self.setTabOrder(self.okbutton, self.cancelbutton)