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 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())
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 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 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)
class EventReceiverForm(QDialog): 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 languageChange(self): self.setCaption(self.__tr("Event Receiver")) self.groupBox6.setTitle(self.__tr("Interrupts")) self.irqMasterEnable.setText(self.__tr("Enable")) self.irqViolation.setText(self.__tr("Violation")) self.irqFifoFull.setText(self.__tr("Fifo Full")) self.irqHeartBeat.setText(self.__tr("HeartBeat")) self.irqEvent.setText(self.__tr("Event?")) self.irqPulse.setText(self.__tr("Pulse master (see pulses)")) self.irqDataBuf.setText(self.__tr("data buffer?")) self.clearInterrupts.setText(self.__tr("Clear")) self.groupBox9.setTitle(self.__tr("Front Panel Univ Out")) self.textLabel2.setText( self.__tr("STDDLY(0,1,2,3,4,5,6,7),FINEDLY(8,9,10,11)")) self.textLabel5.setText(self.__tr("Event Counter Presc")) self.textLabel4.setText(self.__tr("Event Clock[RF]")) self.groupBox18.setTitle(self.__tr("Prescalers")) self.prescalerOutputs.horizontalHeader().setLabel( 0, self.__tr("Prescaler")) self.prescalerOutputs.verticalHeader().setLabel(0, self.__tr("0")) self.prescalerOutputs.verticalHeader().setLabel(1, self.__tr("1")) self.prescalerOutputs.verticalHeader().setLabel(2, self.__tr("2")) self.prescalerOutputs.verticalHeader().setLabel(3, self.__tr("3")) self.groupBox3.setTitle(self.__tr("Pulses")) self.listPulse.header().setLabel(0, self.__tr("id")) self.listPulse.header().setLabel(1, self.__tr("eitscp")) self.listPulse.header().setLabel(2, self.__tr("Delay")) self.listPulse.header().setLabel(3, self.__tr("Width")) self.listPulse.header().setLabel(4, self.__tr("Prescaler")) self.groupBox7.setTitle(self.__tr("Ram")) self.ramSel.clear() self.ramSel.insertItem(self.__tr("Ram 1")) self.ramSel.insertItem(self.__tr("Ram 2")) self.ramEnable.setText(self.__tr("enable")) self.ramMod.setText(self.__tr("+")) self.ramDel.setText(self.__tr("-")) self.ramList.header().setLabel(0, self.__tr("Event")) self.ramClear.setText(self.__tr("Clear")) self.restoreConfig.setText(self.__tr("Restore")) self.saveConfig.setText(self.__tr("Save")) self.applyConfig.setText(self.__tr("Apply")) self.masterEnable.setText(self.__tr("Enable")) self.loadConfig.setText(self.__tr("Load")) self.setDefaultBt.setText(self.__tr("Set As Default")) def ramList_clicked(self, a0): print "EventReceiverForm.ramList_clicked(QListViewItem*): Not implemented yet" def ramList_doubleClicked(self, a0): print "EventReceiverForm.ramList_doubleClicked(QListViewItem*): Not implemented yet" def ramEnable_toggled(self, a0): print "EventReceiverForm.ramEnable_toggled(bool): Not implemented yet" def ramMod_clicked(self): print "EventReceiverForm.ramMod_clicked(): Not implemented yet" def ramDel_clicked(self): print "EventReceiverForm.ramDel_clicked(): Not implemented yet" def ramClear_clicked(self): print "EventReceiverForm.ramClear_clicked(): Not implemented yet" def ramSel_activated(self, a0): print "EventReceiverForm.ramSel_activated(int): Not implemented yet" def listPulse_doubleClicked(self, a0): print "EventReceiverForm.listPulse_doubleClicked(QListViewItem*): Not implemented yet" def loadConfig_clicked(self): print "EventReceiverForm.loadConfig_clicked(): Not implemented yet" def onRestoreConfig(self): print "EventReceiverForm.onRestoreConfig(): Not implemented yet" def onApplyConfig(self): print "EventReceiverForm.onApplyConfig(): Not implemented yet" def saveConfig_clicked(self): print "EventReceiverForm.saveConfig_clicked(): Not implemented yet" def statusUpdate_clicked(self): print "EventReceiverForm.statusUpdate_clicked(): Not implemented yet" def statusViolation_clicked(self): print "EventReceiverForm.statusViolation_clicked(): Not implemented yet" def onSetConfigAsDefault(self): print "EventReceiverForm.onSetConfigAsDefault(): Not implemented yet" def clearInterrupts_clicked(self): print "EventReceiverForm.clearInterrupts_clicked(): Not implemented yet" def __tr(self, s, c=None): return qApp.translate("EventReceiverForm", s, c)
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())
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
class PluginSettingsUi(QDialog): 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 languageChange(self): self.setCaption(self.__tr("Plugin Settings")) self.bt_ok.setText(self.__tr("&OK")) self.bt_ok.setAccel(QKeySequence(QString.null)) self.bt_cancel.setText(self.__tr("&Cancel")) self.bt_cancel.setAccel(QKeySequence(QString.null)) self.lw_plugins.header().setLabel(0,self.__tr("Plugin")) self.t_parameters.horizontalHeader().setLabel(0,self.__tr("Value")) self.t_parameters.verticalHeader().setLabel(0,self.__tr("Default ")) self.label_name.setText(self.__tr("Name:")) self.label_version.setText(self.__tr("Tool:")) self.label_pversion.setText(self.__tr("Plugin:")) def lv_parameters_currentChanged(self,a0): devlog("PluginSettingsUi.lv_parameters_currentChanged(QListViewItem*): Not implemented yet") def __tr(self,s,c = None): return qApp.translate("PluginSettingsUi",s,c)
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
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 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 Grid(QTabWidget): """La tabla que manejara los registros y las variables""" #Funciones de inicializacion 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_t_reg(self): """Inicializa la tabla de datos""" self.table1.setNumCols(16) self.table1.setNumRows(64) for i in range(self.table1.horizontalHeader().count()): self.table1.horizontalHeader().setLabel(i+1, '') def __init_t_var(self): """Inicializa la tabla de variables""" self.table2.setSelectionMode(QTable.MultiRow) self.table2.setNumRows(self.__nvar) self.table2.setNumCols(5) titulos = self.table2.horizontalHeader() titulos.setLabel (0, "Nombre") titulos.setLabel (1, "Tipo") titulos.setLabel (2, "Valor por defecto") titulos.setLabel (3, u"Etiqueta") titulos.setLabel (4, u"Etiquetas de valor") def __conexiones(self): """Conexiones""" self.connect(self.table1, SIGNAL("valueChanged(int, int)"), self.__modificacion_t_reg) self.connect(self.table2, SIGNAL("valueChanged(int, int)"), self.__modificacion_t_var) def myUpdate(self): """Actualizacion de contenido""" LOG.debug("Actualizando contenido del grid") self.__mostrar_t_reg() self.__mostrar_t_var() def showEvent(self, event): """Redefinición del show de la clase base""" self.myUpdate() QTabWidget.showEvent(self, event) def borrar_seleccion(self, borrardatos=False): """Esta funcion borra la seleccion de la tabla. El parametro opcional determina si se ha deborrar tambien los datos""" tablaactual = self.currentPageIndex() if tablaactual == 0: tabla = self.table1 else: tabla = self.table2 if borrardatos: lista = [] for seleccion in range(tabla.numSelections()): for fila in range(tabla.selection(seleccion).topRow(), tabla.selection(seleccion).bottomRow()+1): lista.append(fila) lista.sort() lista.reverse() for fila in lista: if tablaactual == 0: if fila < self.__idu.n_reg(): del self.__idu[fila] else: if fila < self.__idu.n_var(): self.__idu.delVar(fila) for seleccion in range(tabla.numSelections()): tabla.removeSelection(seleccion) def lista_seleccion(self, tabla=0): """Devuelve una lista con los registros que han sido seleccionados""" tabla = self.table1 listasalida = [] if tabla.numSelections(): toprow = tabla.numRows() bottomrow = 0 leftcol = tabla.numCols() rightcol = 0 for seleccion in range(tabla.numSelections()): misel = tabla.selection(seleccion) if misel.topRow() < toprow: toprow = misel.topRow() if misel.bottomRow()> bottomrow: bottomrow = misel.bottomRow() if misel.leftCol()< leftcol: leftcol = misel.leftCol() if misel.rightCol()> rightcol: rightcol = misel.rightCol() LOG.debug("Limites totales de seleccion:("+str(toprow)+","+str(leftcol)+")") LOG.debug("Limites totales de seleccion:("+str(bottomrow)+","+str(rightcol)+")") if bottomrow >= self.__idu.n_reg(): bottomrow = self.__idu.n_reg() - 1 if rightcol >= self.__idu.n_var(): rightcol = self.__idu.n_var() - 1 for fila in range(toprow, bottomrow+1): nuevafila = [] for columna in range(leftcol, rightcol+1): if self.__idu[fila][columna].valido() and tabla.isSelected(fila, columna): nuevafila.append(repr(self.__idu[fila][columna])) else: nuevafila.append(None) LOG.debug("Fila añadida a la seleccion de copiado: "+str(nuevafila)) listasalida.append(nuevafila) return listasalida def insertar_reg(self): """Inserta un registro en la posicion actual""" assert(self.currentPageIndex() == 0) #Estamos en la tabla de registros tabla = self.table1 pos = tabla.currentRow() self.__idu.ins_reg(pos) self.myUpdate() #TODO: Optimizar redibujado def verificar_seleccion_registros(self): """Verifica que la seleccion solamente consta de registros.""" tabla = self.table1 for indiceseleccion in range(tabla.numSelections()): seleccion = tabla.selection(indiceseleccion) if seleccion.leftCol()!=0 or seleccion.rightCol() < self.__idu.n_var()-1: LOG.debug("Seleccionincorrecta:"+str(seleccion.leftCol())+","+str(seleccion.rightCol())) from Driza.excepciones import SeleccionIncorrectaException raise SeleccionIncorrectaException def mostrar_t_reg(self): """Muestra el tab de casos""" self.showPage(self.tab) def mostrar_t_var(self): """Muestra el tab de variables""" self.showPage(self.tab_2) #Metodos privados def __mostrar_t_var(self): """ Representa la variable pos en la tabla de variables. Las propiedades de la variable las lee de los datos. Si no se indica posicion, se entiende que se quiere rellenar toda la tabla """ LOG.debug("Actualizando tabla de variables completa") if self.__nvar > (self.table2.numRows()-self.__idu.n_var()): self.table2.setNumRows(self.__idu.n_var()+self.__nvar) for fila in range(self.__idu.n_var(), self.table2.numRows()): for columna in range(self.table2.numCols()): self.table2.clearCell(fila, columna) for indicevar in range(self.__idu.n_var()): self.__mostrar_var(indicevar) self.__mostrar_titulo_t_reg() def __mostrar_var(self, pos): """Muestra una unica variable (fila) en la tabla segun el listado de variables""" variable = self.__idu.var(pos) self.table2.setText(pos, 0, str(variable.name())) self.table2.setItem(pos, 1, self.__combotableitem()) self.table2.item(pos, 1).setCurrentItem(variable.tipo) self.table2.setText(pos, 3, str(variable.descripcion)) self.table2.setText(pos, 2, str(variable.valorpordefecto)) self.table2.setItem(pos, 4, self.__botontableitem()) def __mostrar_t_reg(self): """ Rellena la tabla de datos con los registros actuales """ if self.__nreg > (self.table1.numRows() - self.__idu.n_reg()): self.table1.setNumRows(self.__idu.n_reg() + self.__nreg) for i in range(self.__idu.n_reg()): self.__mostrar_reg(i) self.__mostrar_titulo_t_reg() for i in range(self.__idu.n_reg(), self.table1.numRows()): for j in range(self.table1.numCols()): self.table1.clearCell(i, j) for i in range(self.table1.numRows()): for j in range(self.__idu.n_var(), self.table1.numCols()): self.table1.clearCell(i, j) self.__mostrar_lateral_t_reg() def __mostrar_reg(self, pos): """Muestra un solo dato""" if self.modoetiqueta: for i in range(self.__idu.n_var()): if hasattr(self.__idu[pos][i], "etiqueta"): self.table1.setText(pos, i, self.__idu[pos][i].etiqueta()) else: self.table1.setText(pos, i, str(self.__idu[pos][i])) else: for i in range(self.__idu.n_var()): self.table1.setText(pos, i, str(self.__idu[pos][i])) def __mostrar_columna_t_reg(self, pos): """Muestra una columna de la tabla de registros""" for i in range(self.__idu.n_reg()): self.table1.setText(i, pos, str(self.__idu[i][pos])) def __mostrar_titulo_t_reg(self, pos=None): """Actualiza los titulos de la tabla de datos segun las variables""" titulos = self.table1.horizontalHeader() if pos: titulos.setLabel(pos, self.__idu.var(pos).name()) else: i = 0 for _ in range(self.__idu.n_var()): self.table1.horizontalHeader().setLabel(i, self.__idu.var(i).name()) i += 1 for _ in range(self.__idu.n_var(), self.table1.horizontalHeader().count()): self.table1.horizontalHeader().setLabel(i, '') i += 1 def __mostrar_lateral_t_reg(self): """Muestra los numeros laterales. Sirve para el filtrado""" lateral = self.table1.verticalHeader() #lista=self.__idu.getCol(self.__gestorfiltro.variable,filtrado=False) for i in range(self.__idu.n_reg()): # if self.__gestorfiltro.variable and not lista[i]: # lateral.setLabel(i,"--"+str(i)) # else: lateral.setLabel(i, str(i+1)) def __combotableitem(self): """Devuelve un nuevo objeto tipo combotableitem con la lista de tipos""" lista = QStringList() from Driza.listas import SL for tipo in SL.nombrevariables: lista.append(tipo) return QComboTableItem(self.table2, lista) def __botontableitem(self): """Devuelve un nuevo objeto tipo combotableitem con la lista de tipos""" return ButtonTableItem(self.table2, self.dcasos) def __modificacion_t_var(self, fila, columna): """Funcion a que conecta con la introduccion de nuevos datos en la tabla de variables""" if columna == 1 and (self.table2.text(fila, columna).latin1() == self.__idu.var(fila).tipo): return # Se ha solicitado un cambio de tipo al propio tipo self.__portero.guardar_estado() if fila >= self.__idu.n_var(): #Es una nueva variable #Variables intermedias (creadas con los valores por defecto) for valorintermedio in range (self.__idu.n_var(), fila): self.__insertar_variable() self.__mostrar_var(valorintermedio) self.__insertar_variable() #Variable modificada variable = self.__idu.var(fila) if columna == 1: # El usuario quiere cambiar el tipo textoencuestion = self.table2.text(fila, columna).latin1() #preguntar el tipo de conversion metododeseado = self.__preguntar_conversion(variable, textoencuestion) if metododeseado: variable, columna = self.__agenteconversion(variable, textoencuestion, metododeseado) #Pareja variable-list self.__idu.establecer_var(fila, variable, columna) self.__mostrar_t_reg() else: #Restos de campos (Texto) from Driza.excepciones import VariableExisteException try: self.__idu.modificar_var(variable, columna, str(self.table2.text(fila, columna).latin1())) except VariableExisteException: QMessageBox.warning(self, u'Atención', u'El nombre de variable ya existe') except NameError: QMessageBox.warning(self, u'Atención', u'Nombre de variable Erróneo') self.__mostrar_var(fila) #En todos los casos, actualizamos el titulo de la tabla de datos self.__mostrar_titulo_t_reg() def __actualizar_reg_interfazdatos(self, row, col, valor): """actualiza un dato en interfazdatos,recogiendo la excepcion en caso de error """ LOG.debug("Actualizando datos de la interfaz:" + str(row) + "," + str(col)) try: self.__idu[row][col] = valor except ValueError: QMessageBox.warning(self, 'Atención', u'El dato no es válido') def __insertar_registro(self): """Inserta un registro genérico, y ademas comprueba que no nos estamos acercando al final de la tabla""" self.__idu.ana_reg() if self.__nreg > (self.table1.numRows() - self.__idu.n_reg()): self.table1.setNumRows(self.table1.numRows() + 1) def __insertar_variable(self): """Inserta una variable genérica, y ademas comprueba que no nos acercamos a ninguno de los limites de las tablas""" self.__idu.ana_var() if self.__nvar > (self.table2.numRows() - self.__idu.n_var()): self.table2.setNumRows(self.table2.numRows() + 1) self.table1.setNumCols(self.table1.numCols() + 1) def __modificacion_t_reg(self, fila, columna): """Actualiza los datos del objeto dato a partir de un cambio en la tabla de datos""" if (fila < self.__idu.n_reg())\ and (columna < self.__idu.n_var())\ and (self.table1.text(fila, columna).latin1() == str(self.__idu[fila][columna])): return #No hay cambio efectivo #FIXME: No detecta reales LOG.debug("Cambiado registro en la tabla") valor = self.table1.text(fila, columna).latin1() self.__portero.guardar_estado() if columna >= self.__idu.n_var(): LOG.debug("Creando nueva variable por demanda en la modificaicon de un registro") #Estamos trabajando sobre una variable inexistente for i in range(self.__idu.n_var(), columna + 1): self.__insertar_variable() self.__mostrar_columna_t_reg(i) self.__mostrar_t_var() #actualizamos la tabla de variables if fila >= self.__idu.n_reg(): #no existen registros intermedios LOG.debug("Creando nuevo registro por demanda en la modificaicon de un registro") for i in range (self.__idu.n_reg(), fila): self.__insertar_registro() self.__mostrar_reg(i) self.__idu.ana_reg() #El último se separa, tenemos que verificar si el usuario ha escrito correctamente self.__actualizar_reg_interfazdatos(fila, columna, valor) self.__mostrar_reg(fila) #Comprobacion de que sobra el numero correcto de celdas if self.__nreg > (self.table1.numRows() - self.__idu.n_reg()): self.table1.setNumRows(self.__idu.n_reg() + self.__nreg) self.parent().parent().parent().mostrar_undo_redo() def __preguntar_conversion(self, variable, objetivo): """Pregunta cual de los metodos disponibles para la conversion desea escoger el usuario""" lista = [] if variable.diccionarioconversion.has_key("Agrupador"): #Conversión a todos los tipos lista += variable.diccionarioconversion["Agrupador"] for tipo in variable.diccionarioconversion.iterkeys(): if tipo == objetivo: lista += variable.diccionarioconversion[tipo] #Elaborar una lista y preguntar al usuario qlista = QStringList() for elemento in lista: qlista.append(elemento) cadena = QInputDialog.getItem("Elige!", u"Elige una función de conversion", qlista, 0, False, self, "Dialogo") #devolver el nombre de la funcion if cadena[1]: return cadena[0].latin1() else: return ""
class Canvasinfo(QWidget): 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 deleteLabels(self): self.label.setText(QString()) for r in range(5): for c in range(2): self.canvaslabels.setText(r, c, QString()) def updateLabels(self,d): #set label[0] as main label self.label.setText(d[0]) #recurse through label[1] and set them for r in range(len(d[1])): for c in range(len(d[1][r])): self.canvaslabels.setText(r, c, QString(d[1][r][c])) def __tr(self,s,c = None): return qApp.translate("Canvasinfo",s,c)
class roamprofile(QWidget): def __init__(self,parent = None,name = None,fl = 0): QWidget.__init__(self,parent,name,fl) if not name: self.setName("roamprofile") self.setFocusPolicy(QWidget.TabFocus) roamprofileLayout = QGridLayout(self,1,1,11,6,"roamprofileLayout") self.textLabel1_2 = QLabel(self,"textLabel1_2") roamprofileLayout.addWidget(self.textLabel1_2,0,0) self.clientgroupListBox = QListBox(self,"clientgroupListBox") self.clientgroupListBox.setSizePolicy(QSizePolicy(5,7,0,0,self.clientgroupListBox.sizePolicy().hasHeightForWidth())) roamprofileLayout.addWidget(self.clientgroupListBox,1,0) self.roamProfileTabWidget = QTabWidget(self,"roamProfileTabWidget") self.tab = QWidget(self.roamProfileTabWidget,"tab") tabLayout = QGridLayout(self.tab,1,1,11,6,"tabLayout") layout36 = QHBoxLayout(None,0,6,"layout36") layout35 = QGridLayout(None,1,1,0,6,"layout35") layout7 = QVBoxLayout(None,0,6,"layout7") spacer6_2 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding) layout7.addItem(spacer6_2) layout6 = QVBoxLayout(None,0,6,"layout6") self.moveSelectedToolButton = QToolButton(self.tab,"moveSelectedToolButton") self.moveSelectedToolButton.setEnabled(1) self.moveSelectedToolButton.setFocusPolicy(QToolButton.TabFocus) self.moveSelectedToolButton.setIconSet(QIconSet()) layout6.addWidget(self.moveSelectedToolButton) self.moveAllToolButton = QToolButton(self.tab,"moveAllToolButton") self.moveAllToolButton.setEnabled(1) self.moveAllToolButton.setFocusPolicy(QToolButton.TabFocus) self.moveAllToolButton.setIconSet(QIconSet()) layout6.addWidget(self.moveAllToolButton) layout7.addLayout(layout6) spacer5_2 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding) layout7.addItem(spacer5_2) layout35.addLayout(layout7,1,1) layout8 = QHBoxLayout(None,0,6,"layout8") layout35.addLayout(layout8,0,0) self.availablePortListView = QListView(self.tab,"availablePortListView") self.availablePortListView.addColumn(self.__tr("Available Port List")) layout35.addWidget(self.availablePortListView,1,0) layout36.addLayout(layout35) layout33 = QVBoxLayout(None,0,6,"layout33") self.selectedPortListLabel = QLabel(self.tab,"selectedPortListLabel") layout33.addWidget(self.selectedPortListLabel) layout32 = QHBoxLayout(None,0,6,"layout32") self.selectedPortList = QListBox(self.tab,"selectedPortList") layout32.addWidget(self.selectedPortList) layout12 = QVBoxLayout(None,0,6,"layout12") spacer8 = QSpacerItem(20,30,QSizePolicy.Minimum,QSizePolicy.Expanding) layout12.addItem(spacer8) layout11 = QVBoxLayout(None,0,6,"layout11") self.upToolButton = QToolButton(self.tab,"upToolButton") self.upToolButton.setFocusPolicy(QToolButton.TabFocus) self.upToolButton.setIconSet(QIconSet()) layout11.addWidget(self.upToolButton) self.downToolButton = QToolButton(self.tab,"downToolButton") self.downToolButton.setFocusPolicy(QToolButton.TabFocus) self.downToolButton.setIconSet(QIconSet()) layout11.addWidget(self.downToolButton) self.deleteSelectedToolButton = QToolButton(self.tab,"deleteSelectedToolButton") self.deleteSelectedToolButton.setFocusPolicy(QToolButton.TabFocus) self.deleteSelectedToolButton.setIconSet(QIconSet()) layout11.addWidget(self.deleteSelectedToolButton) self.deleteAllToolButton = QToolButton(self.tab,"deleteAllToolButton") self.deleteAllToolButton.setFocusPolicy(QToolButton.TabFocus) self.deleteAllToolButton.setIconSet(QIconSet()) layout11.addWidget(self.deleteAllToolButton) layout12.addLayout(layout11) spacer7_2 = QSpacerItem(20,30,QSizePolicy.Minimum,QSizePolicy.Expanding) layout12.addItem(spacer7_2) layout32.addLayout(layout12) layout33.addLayout(layout32) layout36.addLayout(layout33) tabLayout.addLayout(layout36,0,0) self.tabWidget3 = QTabWidget(self.tab,"tabWidget3") self.time = QWidget(self.tabWidget3,"time") timeLayout = QHBoxLayout(self.time,11,6,"timeLayout") layout18 = QVBoxLayout(None,0,6,"layout18") self.dwellTimeButtonGroup = QButtonGroup(self.time,"dwellTimeButtonGroup") self.dwellTimeButtonGroup.setEnabled(1) self.dwellTimeButtonGroup.setColumnLayout(0,Qt.Vertical) self.dwellTimeButtonGroup.layout().setSpacing(6) self.dwellTimeButtonGroup.layout().setMargin(11) dwellTimeButtonGroupLayout = QGridLayout(self.dwellTimeButtonGroup.layout()) dwellTimeButtonGroupLayout.setAlignment(Qt.AlignTop) self.customDwellTimeRadioButton = QRadioButton(self.dwellTimeButtonGroup,"customDwellTimeRadioButton") self.customDwellTimeRadioButton.setEnabled(0) self.dwellTimeButtonGroup.insert( self.customDwellTimeRadioButton,1) dwellTimeButtonGroupLayout.addWidget(self.customDwellTimeRadioButton,1,0) self.fixedDwellTimeRadioButton = QRadioButton(self.dwellTimeButtonGroup,"fixedDwellTimeRadioButton") self.fixedDwellTimeRadioButton.setChecked(1) self.dwellTimeButtonGroup.insert( self.fixedDwellTimeRadioButton,0) dwellTimeButtonGroupLayout.addWidget(self.fixedDwellTimeRadioButton,0,0) self.fixedTimeSpinBox = QSpinBox(self.dwellTimeButtonGroup,"fixedTimeSpinBox") self.fixedTimeSpinBox.setMaxValue(100000) self.fixedTimeSpinBox.setMinValue(1) dwellTimeButtonGroupLayout.addWidget(self.fixedTimeSpinBox,0,1) self.customDwellOptionsGroupBox = QGroupBox(self.dwellTimeButtonGroup,"customDwellOptionsGroupBox") self.customDwellOptionsGroupBox.setEnabled(0) self.customDwellOptionsGroupBox.setColumnLayout(0,Qt.Vertical) self.customDwellOptionsGroupBox.layout().setSpacing(6) self.customDwellOptionsGroupBox.layout().setMargin(11) customDwellOptionsGroupBoxLayout = QGridLayout(self.customDwellOptionsGroupBox.layout()) customDwellOptionsGroupBoxLayout.setAlignment(Qt.AlignTop) self.endDwellLabel = QLabel(self.customDwellOptionsGroupBox,"endDwellLabel") self.endDwellLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) customDwellOptionsGroupBoxLayout.addWidget(self.endDwellLabel,1,0) self.dwellChangeLabel = QLabel(self.customDwellOptionsGroupBox,"dwellChangeLabel") self.dwellChangeLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) customDwellOptionsGroupBoxLayout.addWidget(self.dwellChangeLabel,2,0) self.startDwellLabel = QLabel(self.customDwellOptionsGroupBox,"startDwellLabel") self.startDwellLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) customDwellOptionsGroupBoxLayout.addWidget(self.startDwellLabel,0,0) self.changeStepSpinBox = QSpinBox(self.customDwellOptionsGroupBox,"changeStepSpinBox") self.changeStepSpinBox.setMaxValue(80) self.changeStepSpinBox.setMinValue(-80) customDwellOptionsGroupBoxLayout.addWidget(self.changeStepSpinBox,2,1) self.startDwellSpinBox = QSpinBox(self.customDwellOptionsGroupBox,"startDwellSpinBox") self.startDwellSpinBox.setMaxValue(80) customDwellOptionsGroupBoxLayout.addWidget(self.startDwellSpinBox,0,1) self.endDwellSpinBox = QSpinBox(self.customDwellOptionsGroupBox,"endDwellSpinBox") self.endDwellSpinBox.setMaxValue(80) customDwellOptionsGroupBoxLayout.addWidget(self.endDwellSpinBox,1,1) self.comboBox5 = QComboBox(0,self.customDwellOptionsGroupBox,"comboBox5") customDwellOptionsGroupBoxLayout.addWidget(self.comboBox5,0,2) self.comboBox6 = QComboBox(0,self.customDwellOptionsGroupBox,"comboBox6") customDwellOptionsGroupBoxLayout.addWidget(self.comboBox6,1,2) dwellTimeButtonGroupLayout.addMultiCellWidget(self.customDwellOptionsGroupBox,2,2,0,1) layout18.addWidget(self.dwellTimeButtonGroup) spacer8_2_2 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding) layout18.addItem(spacer8_2_2) timeLayout.addLayout(layout18) layout19 = QVBoxLayout(None,0,6,"layout19") self.repeatButtonGroup = QButtonGroup(self.time,"repeatButtonGroup") self.repeatButtonGroup.setColumnLayout(0,Qt.Vertical) self.repeatButtonGroup.layout().setSpacing(6) self.repeatButtonGroup.layout().setMargin(11) repeatButtonGroupLayout = QGridLayout(self.repeatButtonGroup.layout()) repeatButtonGroupLayout.setAlignment(Qt.AlignTop) self.repeatCountSpinBox = QSpinBox(self.repeatButtonGroup,"repeatCountSpinBox") self.repeatCountSpinBox.setMaxValue(1000000) repeatButtonGroupLayout.addWidget(self.repeatCountSpinBox,0,3) self.durationRadioButton = QRadioButton(self.repeatButtonGroup,"durationRadioButton") self.durationRadioButton.setFocusPolicy(QRadioButton.NoFocus) self.repeatButtonGroup.insert( self.durationRadioButton,2) repeatButtonGroupLayout.addWidget(self.durationRadioButton,1,0) self.durationSpinBox = QSpinBox(self.repeatButtonGroup,"durationSpinBox") self.durationSpinBox.setMaxValue(1000000) self.durationSpinBox.setMinValue(1) repeatButtonGroupLayout.addWidget(self.durationSpinBox,1,1) self.timeUnitComboBox = QComboBox(0,self.repeatButtonGroup,"timeUnitComboBox") repeatButtonGroupLayout.addMultiCellWidget(self.timeUnitComboBox,1,1,2,3) self.repeatCountRadioButton = QRadioButton(self.repeatButtonGroup,"repeatCountRadioButton") self.repeatCountRadioButton.setChecked(1) self.repeatButtonGroup.insert( self.repeatCountRadioButton,1) repeatButtonGroupLayout.addMultiCellWidget(self.repeatCountRadioButton,0,0,0,2) layout19.addWidget(self.repeatButtonGroup) spacer8_2 = QSpacerItem(20,31,QSizePolicy.Minimum,QSizePolicy.Expanding) layout19.addItem(spacer8_2) timeLayout.addLayout(layout19) self.tabWidget3.insertTab(self.time,QString("")) self.distribution = QWidget(self.tabWidget3,"distribution") distributionLayout = QGridLayout(self.distribution,1,1,11,6,"distributionLayout") self.clientDistButtonGroup = QButtonGroup(self.distribution,"clientDistButtonGroup") self.clientDistButtonGroup.setColumnLayout(0,Qt.Vertical) self.clientDistButtonGroup.layout().setSpacing(6) self.clientDistButtonGroup.layout().setMargin(11) clientDistButtonGroupLayout = QGridLayout(self.clientDistButtonGroup.layout()) clientDistButtonGroupLayout.setAlignment(Qt.AlignTop) self.clientDistRadio1 = QRadioButton(self.clientDistButtonGroup,"clientDistRadio1") self.clientDistRadio1.setChecked(1) self.clientDistButtonGroup.insert( self.clientDistRadio1,1) clientDistButtonGroupLayout.addWidget(self.clientDistRadio1,0,0) self.clientDistRadio2 = QRadioButton(self.clientDistButtonGroup,"clientDistRadio2") self.clientDistButtonGroup.insert( self.clientDistRadio2,2) clientDistButtonGroupLayout.addWidget(self.clientDistRadio2,1,0) distributionLayout.addWidget(self.clientDistButtonGroup,0,1) self.timeDistButtonGroup = QButtonGroup(self.distribution,"timeDistButtonGroup") self.timeDistButtonGroup.setColumnLayout(0,Qt.Vertical) self.timeDistButtonGroup.layout().setSpacing(6) self.timeDistButtonGroup.layout().setMargin(11) timeDistButtonGroupLayout = QGridLayout(self.timeDistButtonGroup.layout()) timeDistButtonGroupLayout.setAlignment(Qt.AlignTop) self.timeDistRadio1 = QRadioButton(self.timeDistButtonGroup,"timeDistRadio1") self.timeDistRadio1.setChecked(1) self.timeDistButtonGroup.insert( self.timeDistRadio1,1) timeDistButtonGroupLayout.addWidget(self.timeDistRadio1,0,0) self.timeDistRadio2 = QRadioButton(self.timeDistButtonGroup,"timeDistRadio2") self.timeDistRadio2.setChecked(0) self.timeDistButtonGroup.insert( self.timeDistRadio2,2) timeDistButtonGroupLayout.addWidget(self.timeDistRadio2,1,0) distributionLayout.addWidget(self.timeDistButtonGroup,0,0) spacer7_3 = QSpacerItem(20,41,QSizePolicy.Minimum,QSizePolicy.Expanding) distributionLayout.addMultiCell(spacer7_3,1,1,0,1) self.tabWidget3.insertTab(self.distribution,QString("")) self.power = QWidget(self.tabWidget3,"power") powerLayout = QGridLayout(self.power,1,1,11,6,"powerLayout") self.powerProfileGroupBox = QGroupBox(self.power,"powerProfileGroupBox") self.powerProfileGroupBox.setEnabled(1) self.powerProfileGroupBox.setFocusPolicy(QGroupBox.TabFocus) self.powerProfileGroupBox.setCheckable(1) self.powerProfileGroupBox.setChecked(0) self.powerProfileGroupBox.setColumnLayout(0,Qt.Vertical) self.powerProfileGroupBox.layout().setSpacing(6) self.powerProfileGroupBox.layout().setMargin(11) powerProfileGroupBoxLayout = QGridLayout(self.powerProfileGroupBox.layout()) powerProfileGroupBoxLayout.setAlignment(Qt.AlignTop) self.srcStartPrwSpinBox = QSpinBox(self.powerProfileGroupBox,"srcStartPrwSpinBox") self.srcStartPrwSpinBox.setMaxValue(-6) self.srcStartPrwSpinBox.setMinValue(-42) powerProfileGroupBoxLayout.addWidget(self.srcStartPrwSpinBox,0,1) self.srcEndPwrSpinBox = QSpinBox(self.powerProfileGroupBox,"srcEndPwrSpinBox") self.srcEndPwrSpinBox.setMaxValue(-6) self.srcEndPwrSpinBox.setMinValue(-42) powerProfileGroupBoxLayout.addWidget(self.srcEndPwrSpinBox,1,1) self.srcChangeStepSpinBox = QSpinBox(self.powerProfileGroupBox,"srcChangeStepSpinBox") self.srcChangeStepSpinBox.setMaxValue(20) self.srcChangeStepSpinBox.setMinValue(1) powerProfileGroupBoxLayout.addWidget(self.srcChangeStepSpinBox,2,1) self.endTxPowerALabel = QLabel(self.powerProfileGroupBox,"endTxPowerALabel") self.endTxPowerALabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.endTxPowerALabel,1,0) self.startTxPowerALabel = QLabel(self.powerProfileGroupBox,"startTxPowerALabel") self.startTxPowerALabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.startTxPowerALabel,0,0) self.changeStepALabel = QLabel(self.powerProfileGroupBox,"changeStepALabel") self.changeStepALabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.changeStepALabel,2,0) self.destStartPwrSpinBox = QSpinBox(self.powerProfileGroupBox,"destStartPwrSpinBox") self.destStartPwrSpinBox.setMaxValue(-6) self.destStartPwrSpinBox.setMinValue(-42) powerProfileGroupBoxLayout.addWidget(self.destStartPwrSpinBox,0,3) self.destEndPwrSpinBox = QSpinBox(self.powerProfileGroupBox,"destEndPwrSpinBox") self.destEndPwrSpinBox.setMaxValue(-6) self.destEndPwrSpinBox.setMinValue(-42) powerProfileGroupBoxLayout.addWidget(self.destEndPwrSpinBox,1,3) self.destChangeStepSpinBox = QSpinBox(self.powerProfileGroupBox,"destChangeStepSpinBox") self.destChangeStepSpinBox.setMaxValue(20) self.destChangeStepSpinBox.setMinValue(1) powerProfileGroupBoxLayout.addWidget(self.destChangeStepSpinBox,2,3) self.destChangeIntSpinBox = QSpinBox(self.powerProfileGroupBox,"destChangeIntSpinBox") self.destChangeIntSpinBox.setMaxValue(100000) self.destChangeIntSpinBox.setMinValue(1000) self.destChangeIntSpinBox.setLineStep(100) powerProfileGroupBoxLayout.addWidget(self.destChangeIntSpinBox,3,3) self.startTxPowerBLabel = QLabel(self.powerProfileGroupBox,"startTxPowerBLabel") self.startTxPowerBLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.startTxPowerBLabel,0,2) self.endTxPowerbLabel = QLabel(self.powerProfileGroupBox,"endTxPowerbLabel") self.endTxPowerbLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.endTxPowerbLabel,1,2) self.changeStepBLabel = QLabel(self.powerProfileGroupBox,"changeStepBLabel") self.changeStepBLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.changeStepBLabel,2,2) self.changeIntBLabel = QLabel(self.powerProfileGroupBox,"changeIntBLabel") self.changeIntBLabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.changeIntBLabel,3,2) self.changeIntALabel = QLabel(self.powerProfileGroupBox,"changeIntALabel") self.changeIntALabel.setAlignment(QLabel.AlignVCenter | QLabel.AlignRight) powerProfileGroupBoxLayout.addWidget(self.changeIntALabel,3,0) self.srcChangeIntSpinBox = QSpinBox(self.powerProfileGroupBox,"srcChangeIntSpinBox") self.srcChangeIntSpinBox.setMaxValue(1000000) self.srcChangeIntSpinBox.setMinValue(1000) self.srcChangeIntSpinBox.setLineStep(100) powerProfileGroupBoxLayout.addWidget(self.srcChangeIntSpinBox,3,1) powerLayout.addWidget(self.powerProfileGroupBox,0,0) spacer10 = QSpacerItem(51,21,QSizePolicy.Expanding,QSizePolicy.Minimum) powerLayout.addItem(spacer10,0,1) spacer11 = QSpacerItem(20,21,QSizePolicy.Minimum,QSizePolicy.Expanding) powerLayout.addItem(spacer11,1,0) self.tabWidget3.insertTab(self.power,QString("")) self.flows = QWidget(self.tabWidget3,"flows") flowsLayout = QVBoxLayout(self.flows,11,6,"flowsLayout") layout21 = QHBoxLayout(None,0,6,"layout21") self.flowParametersButtonGroup = QButtonGroup(self.flows,"flowParametersButtonGroup") self.flowParametersButtonGroup.setEnabled(1) self.flowParametersButtonGroup.setColumnLayout(0,Qt.Vertical) self.flowParametersButtonGroup.layout().setSpacing(6) self.flowParametersButtonGroup.layout().setMargin(11) flowParametersButtonGroupLayout = QGridLayout(self.flowParametersButtonGroup.layout()) flowParametersButtonGroupLayout.setAlignment(Qt.AlignTop) self.textLabel2_2 = QLabel(self.flowParametersButtonGroup,"textLabel2_2") flowParametersButtonGroupLayout.addWidget(self.textLabel2_2,0,0) self.flowPacketSizeSpinBox = QSpinBox(self.flowParametersButtonGroup,"flowPacketSizeSpinBox") self.flowPacketSizeSpinBox.setMaxValue(1518) self.flowPacketSizeSpinBox.setMinValue(88) self.flowPacketSizeSpinBox.setValue(256) flowParametersButtonGroupLayout.addWidget(self.flowPacketSizeSpinBox,0,1) self.textLabel3 = QLabel(self.flowParametersButtonGroup,"textLabel3") flowParametersButtonGroupLayout.addWidget(self.textLabel3,1,0) self.flowRateSpinBox = QSpinBox(self.flowParametersButtonGroup,"flowRateSpinBox") self.flowRateSpinBox.setMaxValue(10000) self.flowRateSpinBox.setMinValue(1) self.flowRateSpinBox.setValue(100) flowParametersButtonGroupLayout.addWidget(self.flowRateSpinBox,1,1) layout21.addWidget(self.flowParametersButtonGroup) self.learningFramesGroupBox = QGroupBox(self.flows,"learningFramesGroupBox") self.learningFramesGroupBox.setFocusPolicy(QGroupBox.TabFocus) self.learningFramesGroupBox.setCheckable(1) self.learningFramesGroupBox.setColumnLayout(0,Qt.Vertical) self.learningFramesGroupBox.layout().setSpacing(6) self.learningFramesGroupBox.layout().setMargin(11) learningFramesGroupBoxLayout = QGridLayout(self.learningFramesGroupBox.layout()) learningFramesGroupBoxLayout.setAlignment(Qt.AlignTop) self.textLabel4 = QLabel(self.learningFramesGroupBox,"textLabel4") learningFramesGroupBoxLayout.addWidget(self.textLabel4,0,0) self.learnDestIpComboBox = QComboBox(0,self.learningFramesGroupBox,"learnDestIpComboBox") self.learnDestIpComboBox.setEditable(1) self.learnDestIpComboBox.setSizeLimit(1) learningFramesGroupBoxLayout.addWidget(self.learnDestIpComboBox,0,1) self.learnDestMacComboBox = QComboBox(0,self.learningFramesGroupBox,"learnDestMacComboBox") self.learnDestMacComboBox.setEditable(1) self.learnDestMacComboBox.setSizeLimit(1) learningFramesGroupBoxLayout.addWidget(self.learnDestMacComboBox,1,1) self.textLabel6 = QLabel(self.learningFramesGroupBox,"textLabel6") learningFramesGroupBoxLayout.addWidget(self.textLabel6,1,0) self.learningPacketRateSpinBox = QSpinBox(self.learningFramesGroupBox,"learningPacketRateSpinBox") self.learningPacketRateSpinBox.setMaxValue(100) self.learningPacketRateSpinBox.setMinValue(10) self.learningPacketRateSpinBox.setValue(100) learningFramesGroupBoxLayout.addWidget(self.learningPacketRateSpinBox,2,1) self.textLabel5 = QLabel(self.learningFramesGroupBox,"textLabel5") learningFramesGroupBoxLayout.addWidget(self.textLabel5,2,0) layout21.addWidget(self.learningFramesGroupBox) flowsLayout.addLayout(layout21) spacer13 = QSpacerItem(20,31,QSizePolicy.Minimum,QSizePolicy.Expanding) flowsLayout.addItem(spacer13) self.tabWidget3.insertTab(self.flows,QString("")) self.options = QWidget(self.tabWidget3,"options") optionsLayout = QGridLayout(self.options,1,1,11,6,"optionsLayout") layout210 = QGridLayout(None,1,1,0,6,"layout210") layout209 = QGridLayout(None,1,1,0,6,"layout209") self.fastRoamingButtonGroup = QButtonGroup(self.options,"fastRoamingButtonGroup") self.fastRoamingButtonGroup.setColumnLayout(0,Qt.Vertical) self.fastRoamingButtonGroup.layout().setSpacing(6) self.fastRoamingButtonGroup.layout().setMargin(11) fastRoamingButtonGroupLayout = QGridLayout(self.fastRoamingButtonGroup.layout()) fastRoamingButtonGroupLayout.setAlignment(Qt.AlignTop) self.pmkidCheckBox = QCheckBox(self.fastRoamingButtonGroup,"pmkidCheckBox") fastRoamingButtonGroupLayout.addWidget(self.pmkidCheckBox,0,0) self.preauthCheckBox = QCheckBox(self.fastRoamingButtonGroup,"preauthCheckBox") self.preauthCheckBox.setEnabled(1) fastRoamingButtonGroupLayout.addWidget(self.preauthCheckBox,1,0) layout209.addWidget(self.fastRoamingButtonGroup,0,1) self.additionalOptionsButtonGroup = QButtonGroup(self.options,"additionalOptionsButtonGroup") self.additionalOptionsButtonGroup.setColumnLayout(0,Qt.Vertical) self.additionalOptionsButtonGroup.layout().setSpacing(6) self.additionalOptionsButtonGroup.layout().setMargin(11) additionalOptionsButtonGroupLayout = QGridLayout(self.additionalOptionsButtonGroup.layout()) additionalOptionsButtonGroupLayout.setAlignment(Qt.AlignTop) self.disassociateCheckBox = QCheckBox(self.additionalOptionsButtonGroup,"disassociateCheckBox") self.additionalOptionsButtonGroup.insert( self.disassociateCheckBox,1) additionalOptionsButtonGroupLayout.addWidget(self.disassociateCheckBox,0,0) self.deauthCheckBox = QCheckBox(self.additionalOptionsButtonGroup,"deauthCheckBox") self.additionalOptionsButtonGroup.insert( self.deauthCheckBox,2) additionalOptionsButtonGroupLayout.addWidget(self.deauthCheckBox,1,0) self.reassocCheckBox = QCheckBox(self.additionalOptionsButtonGroup,"reassocCheckBox") self.additionalOptionsButtonGroup.insert( self.reassocCheckBox,3) additionalOptionsButtonGroupLayout.addWidget(self.reassocCheckBox,2,0) self.renewDhcpCheckBox = QCheckBox(self.additionalOptionsButtonGroup,"renewDhcpCheckBox") self.additionalOptionsButtonGroup.insert( self.renewDhcpCheckBox,4) additionalOptionsButtonGroupLayout.addWidget(self.renewDhcpCheckBox,3,0) self.renewDhcpOnConnCheckBox = QCheckBox(self.additionalOptionsButtonGroup,"renewDhcpOnConnCheckBox") self.additionalOptionsButtonGroup.insert( self.renewDhcpOnConnCheckBox,5) additionalOptionsButtonGroupLayout.addWidget(self.renewDhcpOnConnCheckBox,4,0) layout209.addWidget(self.additionalOptionsButtonGroup,0,0) layout210.addLayout(layout209,0,0) spacer12 = QSpacerItem(20,50,QSizePolicy.Minimum,QSizePolicy.Expanding) layout210.addItem(spacer12,1,0) optionsLayout.addLayout(layout210,0,0) self.tabWidget3.insertTab(self.options,QString("")) tabLayout.addWidget(self.tabWidget3,1,0) self.roamProfileTabWidget.insertTab(self.tab,QString("")) self.TabPage = QWidget(self.roamProfileTabWidget,"TabPage") TabPageLayout = QGridLayout(self.TabPage,1,1,11,6,"TabPageLayout") self.roamStepsGroupBox = QGroupBox(self.TabPage,"roamStepsGroupBox") self.roamStepsGroupBox.setFrameShape(QGroupBox.NoFrame) self.roamStepsGroupBox.setColumnLayout(0,Qt.Vertical) self.roamStepsGroupBox.layout().setSpacing(6) self.roamStepsGroupBox.layout().setMargin(0) roamStepsGroupBoxLayout = QGridLayout(self.roamStepsGroupBox.layout()) roamStepsGroupBoxLayout.setAlignment(Qt.AlignTop) self.roamStepsTable = QTable(self.roamStepsGroupBox,"roamStepsTable") self.roamStepsTable.setNumCols(self.roamStepsTable.numCols() + 1) self.roamStepsTable.horizontalHeader().setLabel(self.roamStepsTable.numCols() - 1,self.__tr("Client Name")) self.roamStepsTable.setNumCols(self.roamStepsTable.numCols() + 1) self.roamStepsTable.horizontalHeader().setLabel(self.roamStepsTable.numCols() - 1,self.__tr("SrcPort Name, BSSID")) self.roamStepsTable.setNumCols(self.roamStepsTable.numCols() + 1) self.roamStepsTable.horizontalHeader().setLabel(self.roamStepsTable.numCols() - 1,self.__tr("DestPort Name,BSSID")) self.roamStepsTable.setNumCols(self.roamStepsTable.numCols() + 1) self.roamStepsTable.horizontalHeader().setLabel(self.roamStepsTable.numCols() - 1,self.__tr("Roam EventTime(secs)")) self.roamStepsTable.setNumRows(self.roamStepsTable.numRows() + 1) self.roamStepsTable.verticalHeader().setLabel(self.roamStepsTable.numRows() - 1,self.__tr("0")) self.roamStepsTable.setSizePolicy(QSizePolicy(7,7,0,0,self.roamStepsTable.sizePolicy().hasHeightForWidth())) self.roamStepsTable.setResizePolicy(QTable.Default) self.roamStepsTable.setNumRows(1) self.roamStepsTable.setNumCols(4) roamStepsGroupBoxLayout.addWidget(self.roamStepsTable,0,0) layout31 = QHBoxLayout(None,0,6,"layout31") layout23 = QHBoxLayout(None,0,6,"layout23") self.textLabel1_3 = QLabel(self.roamStepsGroupBox,"textLabel1_3") layout23.addWidget(self.textLabel1_3) self.numRoamsLineEdit = QLineEdit(self.roamStepsGroupBox,"numRoamsLineEdit") self.numRoamsLineEdit.setEnabled(0) layout23.addWidget(self.numRoamsLineEdit) layout31.addLayout(layout23) layout24 = QHBoxLayout(None,0,6,"layout24") self.textLabel2_3 = QLabel(self.roamStepsGroupBox,"textLabel2_3") layout24.addWidget(self.textLabel2_3) self.avgRoamsLineEdit = QLineEdit(self.roamStepsGroupBox,"avgRoamsLineEdit") self.avgRoamsLineEdit.setEnabled(0) layout24.addWidget(self.avgRoamsLineEdit) layout31.addLayout(layout24) layout25 = QHBoxLayout(None,0,6,"layout25") self.textLabel3_2 = QLabel(self.roamStepsGroupBox,"textLabel3_2") layout25.addWidget(self.textLabel3_2) self.numClientsLineEdit = QLineEdit(self.roamStepsGroupBox,"numClientsLineEdit") self.numClientsLineEdit.setEnabled(0) self.numClientsLineEdit.setFrameShape(QLineEdit.LineEditPanel) self.numClientsLineEdit.setFrameShadow(QLineEdit.Sunken) layout25.addWidget(self.numClientsLineEdit) layout31.addLayout(layout25) layout30 = QHBoxLayout(None,0,6,"layout30") self.autoUpdateCheckBox = QCheckBox(self.roamStepsGroupBox,"autoUpdateCheckBox") self.autoUpdateCheckBox.setFocusPolicy(QCheckBox.TabFocus) layout30.addWidget(self.autoUpdateCheckBox) self.applyPushButton = QPushButton(self.roamStepsGroupBox,"applyPushButton") self.applyPushButton.setFocusPolicy(QPushButton.TabFocus) layout30.addWidget(self.applyPushButton) layout31.addLayout(layout30) roamStepsGroupBoxLayout.addLayout(layout31,1,0) TabPageLayout.addWidget(self.roamStepsGroupBox,0,0) self.roamProfileTabWidget.insertTab(self.TabPage,QString("")) roamprofileLayout.addWidget(self.roamProfileTabWidget,1,1) self.languageChange() self.resize(QSize(846,537).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.setTabOrder(self.clientgroupListBox,self.roamProfileTabWidget) self.setTabOrder(self.roamProfileTabWidget,self.availablePortListView) self.setTabOrder(self.availablePortListView,self.moveSelectedToolButton) self.setTabOrder(self.moveSelectedToolButton,self.moveAllToolButton) self.setTabOrder(self.moveAllToolButton,self.selectedPortList) self.setTabOrder(self.selectedPortList,self.upToolButton) self.setTabOrder(self.upToolButton,self.downToolButton) self.setTabOrder(self.downToolButton,self.deleteSelectedToolButton) self.setTabOrder(self.deleteSelectedToolButton,self.deleteAllToolButton) self.setTabOrder(self.deleteAllToolButton,self.tabWidget3) self.setTabOrder(self.tabWidget3,self.timeDistRadio1) self.setTabOrder(self.timeDistRadio1,self.clientDistRadio1) self.setTabOrder(self.clientDistRadio1,self.fixedDwellTimeRadioButton) self.setTabOrder(self.fixedDwellTimeRadioButton,self.fixedTimeSpinBox) self.setTabOrder(self.fixedTimeSpinBox,self.startDwellSpinBox) self.setTabOrder(self.startDwellSpinBox,self.comboBox5) self.setTabOrder(self.comboBox5,self.endDwellSpinBox) self.setTabOrder(self.endDwellSpinBox,self.comboBox6) self.setTabOrder(self.comboBox6,self.changeStepSpinBox) self.setTabOrder(self.changeStepSpinBox,self.repeatCountRadioButton) self.setTabOrder(self.repeatCountRadioButton,self.repeatCountSpinBox) self.setTabOrder(self.repeatCountSpinBox,self.durationRadioButton) self.setTabOrder(self.durationRadioButton,self.durationSpinBox) self.setTabOrder(self.durationSpinBox,self.timeUnitComboBox) self.setTabOrder(self.timeUnitComboBox,self.numRoamsLineEdit) self.setTabOrder(self.numRoamsLineEdit,self.avgRoamsLineEdit) self.setTabOrder(self.avgRoamsLineEdit,self.numClientsLineEdit) self.setTabOrder(self.numClientsLineEdit,self.autoUpdateCheckBox) self.setTabOrder(self.autoUpdateCheckBox,self.applyPushButton) self.setTabOrder(self.applyPushButton,self.roamStepsTable) def languageChange(self): self.setCaption(self.__tr("Roam Profile")) self.textLabel1_2.setText(self.__tr("Client Group List")) self.moveSelectedToolButton.setText(self.__tr("Add >")) QToolTip.add(self.moveSelectedToolButton,self.__tr("Select")) self.moveAllToolButton.setText(self.__tr("Add All >>")) QToolTip.add(self.moveAllToolButton,self.__tr("Select All")) self.availablePortListView.header().setLabel(0,self.__tr("Available Port List")) self.selectedPortListLabel.setText(self.__tr("Selected Roam Sequence")) self.upToolButton.setText(self.__tr("Move Up")) QToolTip.add(self.upToolButton,self.__tr("Move Up")) self.downToolButton.setText(self.__tr("Move Down")) QToolTip.add(self.downToolButton,self.__tr("Move Down")) self.deleteSelectedToolButton.setText(self.__tr("Delete")) QToolTip.add(self.deleteSelectedToolButton,self.__tr("Delete")) self.deleteAllToolButton.setText(self.__tr("Delete All")) QToolTip.add(self.deleteAllToolButton,self.__tr("Delete All")) self.dwellTimeButtonGroup.setTitle(self.__tr("Dwell Time")) self.customDwellTimeRadioButton.setText(self.__tr("Custom")) self.fixedDwellTimeRadioButton.setText(self.__tr("Fixed Time")) self.fixedTimeSpinBox.setSuffix(self.__tr(" secs")) self.customDwellOptionsGroupBox.setTitle(self.__tr("Custom Options")) self.endDwellLabel.setText(self.__tr("End Dwell Time:")) self.dwellChangeLabel.setText(self.__tr("Change Step:")) self.startDwellLabel.setText(self.__tr("Start Dwell Time:")) self.startDwellSpinBox.setSuffix(QString.null) self.endDwellSpinBox.setSuffix(QString.null) self.comboBox5.clear() self.comboBox5.insertItem(self.__tr("msecs")) self.comboBox5.insertItem(self.__tr("secs")) self.comboBox6.clear() self.comboBox6.insertItem(self.__tr("msecs")) self.comboBox6.insertItem(self.__tr("secs")) self.repeatButtonGroup.setTitle(self.__tr("Total Roaming Duration")) self.durationRadioButton.setText(self.__tr("Time")) self.timeUnitComboBox.clear() self.timeUnitComboBox.insertItem(self.__tr("secs")) self.timeUnitComboBox.insertItem(self.__tr("mins")) self.timeUnitComboBox.insertItem(self.__tr("hrs")) self.repeatCountRadioButton.setText(self.__tr("Repeat Roam Sequence")) self.tabWidget3.changeTab(self.time,self.__tr("Duration")) self.clientDistButtonGroup.setTitle(self.__tr("Client Distribution")) self.clientDistRadio1.setText(self.__tr("All clients start from same AP")) self.clientDistRadio2.setText(self.__tr("Clients distibuted among APs")) self.timeDistButtonGroup.setTitle(self.__tr("Time Distribution")) self.timeDistRadio1.setText(self.__tr("All Client roam at same time")) self.timeDistRadio2.setText(self.__tr("Even Time Distribution")) self.tabWidget3.changeTab(self.distribution,self.__tr("Distribution")) self.powerProfileGroupBox.setTitle(self.__tr("Power Profile")) self.srcStartPrwSpinBox.setPrefix(self.__tr("Max ")) self.srcStartPrwSpinBox.setSuffix(self.__tr(" dB")) self.srcStartPrwSpinBox.setSpecialValueText(self.__tr("Max")) self.srcEndPwrSpinBox.setPrefix(self.__tr("Max ")) self.srcEndPwrSpinBox.setSuffix(self.__tr(" dB")) self.srcEndPwrSpinBox.setSpecialValueText(self.__tr("Max")) self.srcChangeStepSpinBox.setSuffix(self.__tr(" dB")) self.endTxPowerALabel.setText(self.__tr("Src Ap End Tx Power:")) self.startTxPowerALabel.setText(self.__tr("Src AP Start Tx Power:")) self.changeStepALabel.setText(self.__tr("Src AP Change Step:")) self.destStartPwrSpinBox.setPrefix(self.__tr("Max ")) self.destStartPwrSpinBox.setSuffix(self.__tr(" dB")) self.destStartPwrSpinBox.setSpecialValueText(self.__tr("Max")) self.destEndPwrSpinBox.setPrefix(self.__tr("Max ")) self.destEndPwrSpinBox.setSuffix(self.__tr(" dB")) self.destEndPwrSpinBox.setSpecialValueText(self.__tr("Max")) self.destChangeStepSpinBox.setSuffix(self.__tr(" dB")) self.destChangeIntSpinBox.setSuffix(self.__tr(" mSec")) self.startTxPowerBLabel.setText(self.__tr("Dst AP Start Tx Power:")) self.endTxPowerbLabel.setText(self.__tr("Dst AP End Tx Power:")) self.changeStepBLabel.setText(self.__tr("Dst AP Change Step:")) self.changeIntBLabel.setText(self.__tr("Dst AP Change Int:")) self.changeIntALabel.setText(self.__tr("Src AP Change Int:")) self.srcChangeIntSpinBox.setSuffix(self.__tr(" mSec")) self.tabWidget3.changeTab(self.power,self.__tr("Power")) self.flowParametersButtonGroup.setTitle(self.__tr("Flow Parameters")) self.textLabel2_2.setText(self.__tr("Packet Size")) self.textLabel3.setText(self.__tr("Flow Rate (Per Client)")) self.flowRateSpinBox.setSuffix(self.__tr(" pps")) self.learningFramesGroupBox.setTitle(self.__tr("Learning Frames")) self.textLabel4.setText(self.__tr("Dest IP address")) self.textLabel6.setText(self.__tr("Dest MAC Address")) self.learningPacketRateSpinBox.setSuffix(self.__tr(" fps")) self.textLabel5.setText(self.__tr("Learning Frame Rate")) self.tabWidget3.changeTab(self.flows,self.__tr("Flows")) self.fastRoamingButtonGroup.setTitle(self.__tr("Fast Roaming Options")) self.pmkidCheckBox.setText(self.__tr("PMKID Caching Enabled")) self.preauthCheckBox.setText(self.__tr("Pre-authentication Enabled")) self.additionalOptionsButtonGroup.setTitle(self.__tr("Client Options")) self.disassociateCheckBox.setText(self.__tr("Disassociate Client before Roam")) self.deauthCheckBox.setText(self.__tr("Deauth Client before Roam")) self.reassocCheckBox.setText(self.__tr("Re-Associate with New AP")) self.renewDhcpCheckBox.setText(self.__tr("Renew DHCP on Roam")) QToolTip.add(self.renewDhcpCheckBox,QString.null) self.renewDhcpOnConnCheckBox.setText(self.__tr("Renew DHCP on Reconnect")) QToolTip.add(self.renewDhcpOnConnCheckBox,QString.null) self.tabWidget3.changeTab(self.options,self.__tr("Options")) self.roamProfileTabWidget.changeTab(self.tab,self.__tr("Port Selection")) self.roamStepsGroupBox.setTitle(QString.null) self.roamStepsTable.horizontalHeader().setLabel(0,self.__tr("Client Name")) self.roamStepsTable.horizontalHeader().setLabel(1,self.__tr("SrcPort Name, BSSID")) self.roamStepsTable.horizontalHeader().setLabel(2,self.__tr("DestPort Name,BSSID")) self.roamStepsTable.horizontalHeader().setLabel(3,self.__tr("Roam EventTime(secs)")) self.roamStepsTable.verticalHeader().setLabel(0,self.__tr("0")) self.textLabel1_3.setText(self.__tr("Number of Roams:")) self.textLabel2_3.setText(self.__tr("Number of Roams/sec:")) self.textLabel3_2.setText(self.__tr("Number of Clients:")) self.autoUpdateCheckBox.setText(self.__tr("Auto Update")) self.applyPushButton.setText(self.__tr("Update")) self.roamProfileTabWidget.changeTab(self.TabPage,self.__tr("Roam Schedule")) def __tr(self,s,c = None): return qApp.translate("roamprofile",s,c)