Ejemplo n.º 1
0
class NotesListUI(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("NotesListUI")

        self.notes_table = QTable(self,"notes_table")
        self.notes_table.setNumCols(self.notes_table.numCols() + 1)
        self.notes_table.horizontalHeader().setLabel(self.notes_table.numCols() - 1,self.__tr("Name"))
        self.notes_table.setNumCols(self.notes_table.numCols() + 1)
        self.notes_table.horizontalHeader().setLabel(self.notes_table.numCols() - 1,self.__tr("Content"))
        self.notes_table.setGeometry(QRect(20,20,510,360))
        self.notes_table.setMinimumSize(QSize(300,0))
        self.notes_table.setResizePolicy(QTable.AutoOne)
        self.notes_table.setVScrollBarMode(QTable.AlwaysOn)
        self.notes_table.setNumRows(0)
        self.notes_table.setNumCols(2)

        LayoutWidget = QWidget(self,"layout7")
        LayoutWidget.setGeometry(QRect(90,400,377,29))
        
                                                                                                                 
        layout7 = QHBoxLayout(LayoutWidget,5,5,"layout7")

        self.add_button = QPushButton(LayoutWidget,"add_button")
        layout7.addWidget(self.add_button)
        spacer = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout7.addItem(spacer)

        self.edit_button = QPushButton(LayoutWidget,"edit_button")
        layout7.addWidget(self.edit_button)
        layout7.addItem(spacer)

        self.delete_button = QPushButton(LayoutWidget,"delete_button")
        layout7.addWidget(self.delete_button)
        layout7.addItem(spacer)
        
        self.list_note_button = QPushButton(LayoutWidget,"list_note_button")
        layout7.addWidget(self.list_note_button)

        self.languageChange()

        self.resize(QSize(555,447).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)


    def languageChange(self):
        self.setCaption(self.__tr("Notes"))
        self.notes_table.horizontalHeader().setLabel(0,self.__tr("Name"))
        self.notes_table.horizontalHeader().setLabel(1,self.__tr("Content"))
        self.add_button.setText(self.__tr("New"))
        self.edit_button.setText(self.__tr("Edit"))
        self.delete_button.setText(self.__tr("Delete"))
        self.list_note_button.setText(self.__tr("List Notes"))


    def __tr(self,s,c = None):
        return qApp.translate("NotesListUI",s,c)
Ejemplo n.º 2
0
    def addRows(self, rows=1):
        row = self.numRows()

        QTable.setNumRows(self, row + rows)

        for i in range(rows):
            self.setItem(row + i, 0, QComboTableItem(self, self.choicesList))
            self.setItem(row + i, 1, MotorPositionReminder(self))

        self.adjustColumn(1)
        self.updateGeometry()
    def addRows(self, rows = 1):
        row = self.numRows()

        QTable.setNumRows(self, row + rows)

        for i in range(rows):
            self.setItem(row + i, 0, QComboTableItem(self, self.motorList))
            self.setItem(row + i, 1, MotorPositionReminder(self))

        self.adjustColumn(1)
        self.updateGeometry()
Ejemplo n.º 4
0
    def __init__(self, parent):
        QTable.__init__(self, parent)

        self.customColumns = {}

        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.setLeftMargin(0)  # no vertical header
        QTable.setNumCols(self, 0)
        QTable.setNumRows(self, 0)
        self.setVScrollBarMode(QScrollView.AlwaysOff)

        self.horizontalHeader().setResizeEnabled(False)
    def __init__(self, parent):
        QTable.__init__(self, parent)

        self.customColumns = {}

        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.setLeftMargin(0)  # no vertical header
        QTable.setNumCols(self, 0)
        QTable.setNumRows(self, 0)
        self.setVScrollBarMode(QScrollView.AlwaysOff)

        self.horizontalHeader().setResizeEnabled(False)
Ejemplo n.º 6
0
    def setFilters(self,axisno,filters):

        self.nfilt[axisno] = len(filters)
        nrows = reduce( lambda a,b: a>b and a or b, self.nfilt ) 
        QTable.setNumRows( self, nrows )

        filtno = 0

        for filterlab in filters:
           self.setItem(filtno, axisno, FilterItem( self, filterlab )  )
           self.updateCell( filtno, axisno )
           filtno += 1

        self.nfilt[axisno] = filtno
Ejemplo n.º 7
0
    def setFilters(self, axisno, filters):

        self.nfilt[axisno] = len(filters)
        nrows = reduce(lambda a, b: a > b and a or b, self.nfilt)
        QTable.setNumRows(self, nrows)

        filtno = 0

        for filterlab in filters:
            self.setItem(filtno, axisno, FilterItem(self, filterlab))
            self.updateCell(filtno, axisno)
            filtno += 1

        self.nfilt[axisno] = filtno
    def addRows(self, rows=1):
        row = self.numRows()

        QTable.setNumRows(self, row + rows)

        for i in range(rows):
            for col in self.customColumns:
                if self.customColumns[col]['type'] == 'combo':
                    optList = QStringList()

                    try:
                        for opt in self.customColumns[col]['opt']:
                            optList.append(str(opt))
                    except:
                        raise

                    self.setItem(row + i, col, QComboTableItem(self, optList))

                self.adjustColumn(col)
        self.updateGeometry()
Ejemplo n.º 9
0
    def addRows(self, rows=1):
        row = self.numRows()

        QTable.setNumRows(self, row + rows)

        for i in range(rows):
            for col in self.customColumns:
                if self.customColumns[col]["type"] == "combo":
                    optList = QStringList()

                    try:
                        for opt in self.customColumns[col]["opt"]:
                            optList.append(str(opt))
                    except BaseException:
                        raise

                    self.setItem(row + i, col, QComboTableItem(self, optList))

                self.adjustColumn(col)
        self.updateGeometry()
Ejemplo n.º 10
0
    def addRows(self, rows=1):
        row = self.numRows()

        QTable.setNumRows(self, row + rows)

        for i in range(rows):
            self.setItem(row + i, 0, QComboTableItem(self, self.motorsList))
            self.setItem(row + i, 1, MotorPositionReminder(self))

            for col in self.customColumns:
                if self.customColumns[col]["type"] == "combo":
                    optList = QStringList()

                    try:
                        for opt in self.customColumns[col]["opt"]:
                            optList.append(str(opt))
                    except BaseException:
                        pass

                    self.setItem(row + i, col, QComboTableItem(self, optList))

        self.adjustColumn(1)
        self.updateGeometry()
Ejemplo n.º 11
0
    def addRows(self, rows=1):
        row = self.numRows()

        QTable.setNumRows(self, row + rows)

        for i in range(rows):
            self.setItem(row + i, 0, QComboTableItem(self, self.motorsList))
            self.setItem(row + i, 1, MotorPositionReminder(self))

            for col in self.customColumns:
                if self.customColumns[col]['type'] == 'combo':
                    optList = QStringList()

                    try:
                        for opt in self.customColumns[col]['opt']:
                            optList.append(str(opt))
                    except:
                        pass

                    self.setItem(row + i, col, QComboTableItem(self, optList))

        self.adjustColumn(1)
        self.updateGeometry()
Ejemplo n.º 12
0
class VulnerabilitiesUi(QDialog):
    def __init__(self, parent=None, name=None, modal=0, fl=0):
        QDialog.__init__(self, parent, name, modal, fl)

        if not name:
            self.setName("VulnerabilitiesUi")

        self.t_vulns = QTable(self, "t_vulns")
        self.t_vulns.setNumCols(self.t_vulns.numCols() + 1)
        self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,
                                                 self.__tr("Name"))
        self.t_vulns.setNumCols(self.t_vulns.numCols() + 1)
        self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,
                                                 self.__tr("Refs"))
        self.t_vulns.setNumCols(self.t_vulns.numCols() + 1)
        self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,
                                                 self.__tr("Description"))
        self.t_vulns.setMinimumSize(QSize(700, 0))
        self.t_vulns.setResizePolicy(QTable.AutoOne)
        self.t_vulns.setVScrollBarMode(QTable.AlwaysOn)
        self.t_vulns.setNumRows(0)
        self.t_vulns.setNumCols(3)

        LayoutWidget = QWidget(self, "layout7")
        LayoutWidget.setGeometry(QRect(90, 500, 450, 29))

        layout7 = QHBoxLayout(LayoutWidget, 5, 5, "layout7")

        self.add_button = QPushButton(LayoutWidget, "add_button")
        layout7.addWidget(self.add_button)
        spacer6_2 = QSpacerItem(21, 21, QSizePolicy.Expanding,
                                QSizePolicy.Minimum)
        layout7.addItem(spacer6_2)

        self.edit_button = QPushButton(LayoutWidget, "edit_button")
        layout7.addWidget(self.edit_button)
        spacer6 = QSpacerItem(21, 21, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
        layout7.addItem(spacer6)

        self.delete_button = QPushButton(LayoutWidget, "delete_button")
        layout7.addWidget(self.delete_button)

        spacer6_3 = QSpacerItem(21, 21, QSizePolicy.Expanding,
                                QSizePolicy.Minimum)
        layout7.addItem(spacer6_3)

        self.list_note_button = QPushButton(LayoutWidget, "list_note_button")
        layout7.addWidget(self.list_note_button)

        spacer7_3 = QSpacerItem(21, 21, QSizePolicy.Expanding,
                                QSizePolicy.Minimum)
        layout7.addItem(spacer7_3)

        self.manage_evidence_button = QPushButton(LayoutWidget,
                                                  "manage_evidence_button")
        layout7.addWidget(self.manage_evidence_button)

        self.languageChange()

        self.resize(QSize(733, 550).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

    def languageChange(self):
        self.setCaption(self.__tr("Vulnerability List"))
        self.t_vulns.horizontalHeader().setLabel(0, self.__tr("Name"))
        self.t_vulns.horizontalHeader().setLabel(1, self.__tr("Refs"))
        self.t_vulns.horizontalHeader().setLabel(2, self.__tr("Description"))
        self.add_button.setText(self.__tr("New"))
        self.edit_button.setText(self.__tr("Edit"))
        self.delete_button.setText(self.__tr("Delete"))
        self.list_note_button.setText(self.__tr("List Notes"))
        self.manage_evidence_button.setText(self.__tr("Evidence"))

    def __tr(self, s, c=None):
        return qApp.translate("VulnerabilitiesUi", s, c)
Ejemplo n.º 13
0
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))
Ejemplo n.º 14
0
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())
Ejemplo n.º 15
0
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)
Ejemplo n.º 16
0
class Form2(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("Form2")



        self.pushButton2 = QPushButton(self,"pushButton2")
        self.pushButton2.setGeometry(QRect(620,330,141,31))

        self.pushButton3 = QPushButton(self,"pushButton3")
        self.pushButton3.setGeometry(QRect(620,370,141,31))

        self.pushButton5 = QPushButton(self,"pushButton5")
        self.pushButton5.setGeometry(QRect(260,340,111,31))

        self.table1 = QTable(self,"table1")
        self.table1.setGeometry(QRect(30,20,800,310))
        self.table1.setLineWidth(1)
        self.table1.setNumRows(101)
        self.table1.setNumCols(15)

        self.textLabel1 = QLabel(self,"textLabel1")
        self.textLabel1.setGeometry(QRect(140,340,70,31))
        self.textLabel1.setPaletteBackgroundColor(QColor(0,255,255))
        pal = QPalette()
        cg = QColorGroup()
        cg.setColor(QColorGroup.Foreground,Qt.black)
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(223,223,223))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,Qt.black)
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,Qt.black)
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,Qt.black)
        cg.setColor(QColorGroup.LinkVisited,Qt.black)
        pal.setActive(cg)
        cg.setColor(QColorGroup.Foreground,Qt.black)
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(220,220,220))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,Qt.black)
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,Qt.black)
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,QColor(0,0,255))
        cg.setColor(QColorGroup.LinkVisited,QColor(255,0,255))
        pal.setInactive(cg)
        cg.setColor(QColorGroup.Foreground,QColor(128,128,128))
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(220,220,220))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,QColor(128,128,128))
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,QColor(128,128,128))
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,QColor(0,0,255))
        cg.setColor(QColorGroup.LinkVisited,QColor(255,0,255))
        pal.setDisabled(cg)
        self.textLabel1.setPalette(pal)

        self.lineEdit2 = QLineEdit(self,"lineEdit2")
        self.lineEdit2.setGeometry(QRect(40,420,310,21))

        self.languageChange()

        self.resize(QSize(866,656).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.pushButton2,SIGNAL("clicked()"),self.addMatrix)
        self.connect(self.pushButton3,SIGNAL("clicked()"),self.addMem)
        self.connect(self.pushButton5,SIGNAL("clicked()"),self.percent)
        self.connect(self.lineEdit2,SIGNAL("returnPressed()"),self.intvec)


    def languageChange(self):
        self.setCaption(self.__tr("Form2"))
        self.pushButton2.setText(self.__tr("Generar BD"))
        self.pushButton3.setText(self.__tr("Memoria"))
        self.pushButton5.setText(self.__tr("Porcentaje"))
        self.textLabel1.setText(QString.null)


    def addMatrix(self):
        print "Form2.addMatrix(): Not implemented yet"

    def addMem(self):
        print "Form2.addMem(): Not implemented yet"

    def percent(self):
        print "Form2.percent(): Not implemented yet"

    def intvec(self):
        print "Form2.intvec(): Not implemented yet"

    def __tr(self,s,c = None):
        return qApp.translate("Form2",s,c)
Ejemplo n.º 17
0
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 ""
Ejemplo n.º 18
0
class QtResultBrowseUi(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("QtResultBrowseUi")


        QtResultBrowseUiLayout = QGridLayout(self,1,1,11,6,"QtResultBrowseUiLayout")

        self.splitter5 = QSplitter(self,"splitter5")
        self.splitter5.setOrientation(QSplitter.Vertical)

        self.splitter4 = QSplitter(self.splitter5,"splitter4")
        self.splitter4.setOrientation(QSplitter.Horizontal)

        self.tblValues = QTable(self.splitter4,"tblValues")
        self.tblValues.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding,0,0,self.tblValues.sizePolicy().hasHeightForWidth()))
        tblValues_font = QFont(self.tblValues.font())
        tblValues_font.setFamily("Lucida Sans Typewriter")
        self.tblValues.setFont(tblValues_font)
        self.tblValues.setResizePolicy(QTable.Default)
        self.tblValues.setNumRows(23)
        self.tblValues.setNumCols(7)
        self.tblValues.setSorting(0)

        self.tabWidget2 = QTabWidget(self.splitter4,"tabWidget2")

        self.tab = QWidget(self.tabWidget2,"tab")
        tabLayout = QGridLayout(self.tab,1,1,11,6,"tabLayout")

        self.tblDetails = QTable(self.tab,"tblDetails")
        tblDetails_font = QFont(self.tblDetails.font())
        tblDetails_font.setFamily("Lucida Sans Typewriter")
        self.tblDetails.setFont(tblDetails_font)
        self.tblDetails.setNumRows(3)
        self.tblDetails.setNumCols(3)

        tabLayout.addWidget(self.tblDetails,0,0)
        self.tabWidget2.insertTab(self.tab,QString.fromLatin1(""))

        self.TabPage = QWidget(self.tabWidget2,"TabPage")
        TabPageLayout = QGridLayout(self.TabPage,1,1,11,6,"TabPageLayout")

        self.txtPointSummary = QTextEdit(self.TabPage,"txtPointSummary")
        txtPointSummary_font = QFont(self.txtPointSummary.font())
        txtPointSummary_font.setFamily("Lucida Sans Typewriter")
        self.txtPointSummary.setFont(txtPointSummary_font)
        self.txtPointSummary.setWordWrap(QTextEdit.NoWrap)

        TabPageLayout.addWidget(self.txtPointSummary,0,0)
        self.tabWidget2.insertTab(self.TabPage,QString.fromLatin1(""))

        self.tab_2 = QWidget(self.tabWidget2,"tab_2")
        tabLayout_2 = QVBoxLayout(self.tab_2,11,6,"tabLayout_2")

        self.txtNetlist = QTextEdit(self.tab_2,"txtNetlist")
        txtNetlist_font = QFont(self.txtNetlist.font())
        txtNetlist_font.setFamily("Lucida Sans Typewriter")
        self.txtNetlist.setFont(txtNetlist_font)
        self.txtNetlist.setWordWrap(QTextEdit.NoWrap)
        tabLayout_2.addWidget(self.txtNetlist)

        layout3 = QHBoxLayout(None,0,6,"layout3")

        self.chkBlockInfo = QCheckBox(self.tab_2,"chkBlockInfo")
        layout3.addWidget(self.chkBlockInfo)

        self.chkInfoString = QCheckBox(self.tab_2,"chkInfoString")
        layout3.addWidget(self.chkInfoString)
        tabLayout_2.addLayout(layout3)
        self.tabWidget2.insertTab(self.tab_2,QString.fromLatin1(""))

        self.TabPage_2 = QWidget(self.tabWidget2,"TabPage_2")
        TabPageLayout_2 = QVBoxLayout(self.TabPage_2,11,6,"TabPageLayout_2")

        self.txtIndString = QTextEdit(self.TabPage_2,"txtIndString")
        txtIndString_font = QFont(self.txtIndString.font())
        txtIndString_font.setFamily("Lucida Sans Typewriter")
        self.txtIndString.setFont(txtIndString_font)
        self.txtIndString.setWordWrap(QTextEdit.WidgetWidth)
        self.txtIndString.setWrapPolicy(QTextEdit.AtWordBoundary)
        TabPageLayout_2.addWidget(self.txtIndString)
        self.tabWidget2.insertTab(self.TabPage_2,QString.fromLatin1(""))

        self.TabPage_3 = QWidget(self.tabWidget2,"TabPage_3")
        TabPageLayout_3 = QVBoxLayout(self.TabPage_3,11,6,"TabPageLayout_3")

        self.matplotlibWidget1 = MatplotlibWidget(self.TabPage_3,"matplotlibWidget1")
        self.matplotlibWidget1.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,self.matplotlibWidget1.sizePolicy().hasHeightForWidth()))
        TabPageLayout_3.addWidget(self.matplotlibWidget1)

        self.groupBox3 = QGroupBox(self.TabPage_3,"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)

        layout10 = QGridLayout(None,1,1,0,6,"layout10")

        self.textLabel1_2 = QLabel(self.groupBox3,"textLabel1_2")
        self.textLabel1_2.setSizePolicy(QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Preferred,0,0,self.textLabel1_2.sizePolicy().hasHeightForWidth()))

        layout10.addWidget(self.textLabel1_2,1,0)

        self.cmbXAxis = QComboBox(0,self.groupBox3,"cmbXAxis")

        layout10.addWidget(self.cmbXAxis,0,1)

        self.textLabel1 = QLabel(self.groupBox3,"textLabel1")
        self.textLabel1.setSizePolicy(QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Preferred,0,0,self.textLabel1.sizePolicy().hasHeightForWidth()))

        layout10.addWidget(self.textLabel1,0,0)

        self.cmbYAxis = QComboBox(0,self.groupBox3,"cmbYAxis")

        layout10.addWidget(self.cmbYAxis,1,1)

        groupBox3Layout.addMultiCellLayout(layout10,0,0,0,1)

        layout21 = QVBoxLayout(None,0,6,"layout21")

        layout19 = QHBoxLayout(None,0,6,"layout19")

        self.chkHoldPlot = QCheckBox(self.groupBox3,"chkHoldPlot")
        layout19.addWidget(self.chkHoldPlot)

        self.txtPlotFormatString = QLineEdit(self.groupBox3,"txtPlotFormatString")
        layout19.addWidget(self.txtPlotFormatString)
        layout21.addLayout(layout19)

        layout18 = QHBoxLayout(None,0,6,"layout18")

        self.chkTopoPlot = QCheckBox(self.groupBox3,"chkTopoPlot")
        layout18.addWidget(self.chkTopoPlot)

        layout15 = QHBoxLayout(None,0,6,"layout15")

        self.txtTopoMask = QLineEdit(self.groupBox3,"txtTopoMask")
        layout15.addWidget(self.txtTopoMask)

        self.txtTopoFilter = QLineEdit(self.groupBox3,"txtTopoFilter")
        layout15.addWidget(self.txtTopoFilter)
        layout18.addLayout(layout15)
        layout21.addLayout(layout18)

        layout17 = QHBoxLayout(None,0,6,"layout17")

        self.chkClustering = QCheckBox(self.groupBox3,"chkClustering")
        layout17.addWidget(self.chkClustering)

        self.chkFrontOnly = QCheckBox(self.groupBox3,"chkFrontOnly")
        layout17.addWidget(self.chkFrontOnly)

        self.chkNonFront = QCheckBox(self.groupBox3,"chkNonFront")
        layout17.addWidget(self.chkNonFront)
        layout21.addLayout(layout17)

        groupBox3Layout.addLayout(layout21,1,0)

        layout20 = QVBoxLayout(None,0,6,"layout20")

        self.btnUpdatePlot = QPushButton(self.groupBox3,"btnUpdatePlot")
        layout20.addWidget(self.btnUpdatePlot)

        self.btnClearPlot = QPushButton(self.groupBox3,"btnClearPlot")
        layout20.addWidget(self.btnClearPlot)

        self.btnSaveData = QPushButton(self.groupBox3,"btnSaveData")
        layout20.addWidget(self.btnSaveData)

        groupBox3Layout.addLayout(layout20,1,1)
        TabPageLayout_3.addWidget(self.groupBox3)
        self.tabWidget2.insertTab(self.TabPage_3,QString.fromLatin1(""))

        self.splitter4_2 = QSplitter(self.splitter5,"splitter4_2")
        self.splitter4_2.setOrientation(QSplitter.Horizontal)

        LayoutWidget = QWidget(self.splitter4_2,"layout20")
        layout20_2 = QVBoxLayout(LayoutWidget,11,6,"layout20_2")

        layout16 = QHBoxLayout(None,0,6,"layout16")

        self.btnSort = QPushButton(LayoutWidget,"btnSort")
        layout16.addWidget(self.btnSort)
        spacer4 = QSpacerItem(161,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout16.addItem(spacer4)
        layout20_2.addLayout(layout16)

        layout19_2 = QHBoxLayout(None,0,6,"layout19_2")

        self.btnIndEdit = QPushButton(LayoutWidget,"btnIndEdit")
        layout19_2.addWidget(self.btnIndEdit)
        spacer4_2 = QSpacerItem(250,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout19_2.addItem(spacer4_2)

        self.btnSheetSaveAs = QPushButton(LayoutWidget,"btnSheetSaveAs")
        layout19_2.addWidget(self.btnSheetSaveAs)

        self.btnIndSaveAs = QPushButton(LayoutWidget,"btnIndSaveAs")
        layout19_2.addWidget(self.btnIndSaveAs)
        layout20_2.addLayout(layout19_2)
        spacer5 = QSpacerItem(20,106,QSizePolicy.Minimum,QSizePolicy.Expanding)
        layout20_2.addItem(spacer5)

        self.groupBox3_2 = QGroupBox(LayoutWidget,"groupBox3_2")
        self.groupBox3_2.setColumnLayout(0,Qt.Vertical)
        self.groupBox3_2.layout().setSpacing(6)
        self.groupBox3_2.layout().setMargin(11)
        groupBox3_2Layout = QVBoxLayout(self.groupBox3_2.layout())
        groupBox3_2Layout.setAlignment(Qt.AlignTop)

        layout14 = QHBoxLayout(None,0,6,"layout14")

        self.chkNondom = QCheckBox(self.groupBox3_2,"chkNondom")
        self.chkNondom.setChecked(1)
        layout14.addWidget(self.chkNondom)

        self.chkFeasible = QCheckBox(self.groupBox3_2,"chkFeasible")
        self.chkFeasible.setChecked(1)
        layout14.addWidget(self.chkFeasible)
        groupBox3_2Layout.addLayout(layout14)

        layout20_3 = QHBoxLayout(None,0,6,"layout20_3")

        self.chkAgeLayer = QCheckBox(self.groupBox3_2,"chkAgeLayer")
        layout20_3.addWidget(self.chkAgeLayer)

        self.chkAddLowerLayer = QCheckBox(self.groupBox3_2,"chkAddLowerLayer")
        layout20_3.addWidget(self.chkAddLowerLayer)

        self.spinAgeLayer = QSpinBox(self.groupBox3_2,"spinAgeLayer")
        layout20_3.addWidget(self.spinAgeLayer)
        groupBox3_2Layout.addLayout(layout20_3)

        layout20_4 = QHBoxLayout(None,0,6,"layout20_4")

        self.textLabel1_3 = QLabel(self.groupBox3_2,"textLabel1_3")
        layout20_4.addWidget(self.textLabel1_3)

        self.txtListTopoFilter = QLineEdit(self.groupBox3_2,"txtListTopoFilter")
        layout20_4.addWidget(self.txtListTopoFilter)

        self.btnUpdateListTopoFilter = QPushButton(self.groupBox3_2,"btnUpdateListTopoFilter")
        layout20_4.addWidget(self.btnUpdateListTopoFilter)
        groupBox3_2Layout.addLayout(layout20_4)
        layout20_2.addWidget(self.groupBox3_2)

        LayoutWidget_2 = QWidget(self.splitter4_2,"layout17")
        layout17_2 = QHBoxLayout(LayoutWidget_2,11,6,"layout17_2")

        layout16_2 = QVBoxLayout(None,0,6,"layout16_2")

        self.btnUpdate = QPushButton(LayoutWidget_2,"btnUpdate")
        layout16_2.addWidget(self.btnUpdate)
        spacer3 = QSpacerItem(20,110,QSizePolicy.Minimum,QSizePolicy.Expanding)
        layout16_2.addItem(spacer3)

        self.btnCloseAll = QPushButton(LayoutWidget_2,"btnCloseAll")
        layout16_2.addWidget(self.btnCloseAll)

        self.btnClose = QPushButton(LayoutWidget_2,"btnClose")
        layout16_2.addWidget(self.btnClose)

        self.btnSave = QPushButton(LayoutWidget_2,"btnSave")
        layout16_2.addWidget(self.btnSave)

        self.btnLoad = QPushButton(LayoutWidget_2,"btnLoad")
        self.btnLoad.setDefault(1)
        layout16_2.addWidget(self.btnLoad)
        layout17_2.addLayout(layout16_2)

        layout12 = QVBoxLayout(None,0,6,"layout12")

        self.lstOpenStates = QListBox(LayoutWidget_2,"lstOpenStates")
        layout12.addWidget(self.lstOpenStates)

        layout11 = QHBoxLayout(None,0,6,"layout11")

        self.textLabel2 = QLabel(LayoutWidget_2,"textLabel2")
        layout11.addWidget(self.textLabel2)

        self.txtFilename = QLineEdit(LayoutWidget_2,"txtFilename")
        self.txtFilename.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed,0,0,self.txtFilename.sizePolicy().hasHeightForWidth()))
        layout11.addWidget(self.txtFilename)

        self.btnOpenFile = QPushButton(LayoutWidget_2,"btnOpenFile")
        self.btnOpenFile.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Fixed,0,0,self.btnOpenFile.sizePolicy().hasHeightForWidth()))
        self.btnOpenFile.setMaximumSize(QSize(30,32767))
        layout11.addWidget(self.btnOpenFile)
        layout12.addLayout(layout11)
        layout17_2.addLayout(layout12)

        QtResultBrowseUiLayout.addWidget(self.splitter5,0,0)

        self.languageChange()

        self.resize(QSize(1299,877).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)


    def languageChange(self):
        self.setCaption(self.__tr("Form1"))
        self.tabWidget2.changeTab(self.tab,self.__tr("Point"))
        self.tabWidget2.changeTab(self.TabPage,self.__tr("PointSummary"))
        self.chkBlockInfo.setText(self.__tr("Block Info"))
        self.chkInfoString.setText(self.__tr("Info String"))
        self.tabWidget2.changeTab(self.tab_2,self.__tr("Netlist"))
        self.tabWidget2.changeTab(self.TabPage_2,self.__tr("Ind"))
        self.groupBox3.setTitle(self.__tr("Options"))
        self.textLabel1_2.setText(self.__tr("Y-Axis"))
        self.textLabel1.setText(self.__tr("X-Axis"))
        self.chkHoldPlot.setText(self.__tr("Hold plots"))
        self.txtPlotFormatString.setText(self.__tr("."))
        QToolTip.add(self.txtPlotFormatString,self.__tr("Format string"))
        self.chkTopoPlot.setText(self.__tr("Topo plot"))
        QToolTip.add(self.txtTopoMask,self.__tr("topo mask"))
        QToolTip.add(self.txtTopoFilter,self.__tr("topo filter"))
        self.chkClustering.setText(self.__tr("Show clustering"))
        self.chkFrontOnly.setText(self.__tr("Front only"))
        self.chkNonFront.setText(self.__tr("Non-front"))
        self.btnUpdatePlot.setText(self.__tr("Plot"))
        self.btnClearPlot.setText(self.__tr("Clear Plot"))
        self.btnSaveData.setText(self.__tr("Save data"))
        self.tabWidget2.changeTab(self.TabPage_3,self.__tr("Plot"))
        self.btnSort.setText(self.__tr("Sort"))
        self.btnIndEdit.setText(self.__tr("Edit Ind"))
        self.btnSheetSaveAs.setText(self.__tr("Save Sheet as"))
        self.btnIndSaveAs.setText(self.__tr("Save Ind As"))
        self.groupBox3_2.setTitle(self.__tr("Set selection"))
        self.chkNondom.setText(self.__tr("Non dominated only"))
        self.chkFeasible.setText(self.__tr("Feasible only"))
        self.chkAgeLayer.setText(self.__tr("Age layer"))
        self.chkAddLowerLayer.setText(self.__tr("Include one lower layer"))
        self.textLabel1_3.setText(self.__tr("Topology filter"))
        QToolTip.add(self.txtListTopoFilter,self.__tr("topo filter"))
        self.btnUpdateListTopoFilter.setText(self.__tr("Update"))
        self.btnUpdate.setText(self.__tr("update"))
        self.btnCloseAll.setText(self.__tr("Close all"))
        self.btnClose.setText(self.__tr("Close"))
        self.btnSave.setText(self.__tr("Save"))
        self.btnLoad.setText(self.__tr("Load"))
        self.textLabel2.setText(self.__tr("Filename:"))
        self.btnOpenFile.setText(self.__tr("..."))


    def __tr(self,s,c = None):
        return qApp.translate("QtResultBrowseUi",s,c)
Ejemplo n.º 19
0
class ParametersTable(QWidget):
    def __init__(self, parent=None, name="parameter_table"):
        QWidget.__init__(self, parent, name)

        self.__dc_parameters = None

        self.add_dc_cb = None

        self.parameters_label = QLabel(self, "parameters_label")

        self.parameter_table = QTable(self, "parameter_table")
        self.parameter_table.setNumCols(3)
        self.parameter_table.horizontalHeader().\
            setLabel(0, self.__tr("Name"), -1)
        self.parameter_table.horizontalHeader().\
            setLabel(1, self.__tr("Value"))
        self.parameter_table.verticalHeader().hide()
        self.parameter_table.horizontalHeader().setClickEnabled(False, 0)
        self.parameter_table.horizontalHeader().setClickEnabled(False, 1)
        self.parameter_table.setColumnWidth(0, 200)
        self.parameter_table.setColumnWidth(1, 200)
        self.parameter_table.hideColumn(2)
        self.parameter_table.setColumnReadOnly(0, True)
        self.parameter_table.setLeftMargin(0)
        self.parameter_table.setNumRows(0)
        self.position_label = QLabel("Positions", self, "position_view")
        self.position_label.setAlignment(Qt.AlignTop)

        ##        self.add_button = QPushButton(self, "add_button")
        #self.add_button.setDisabled(True)

        h_layout = QGridLayout(self, 1, 2)
        v_layout_position = QVBoxLayout(self)
        v_layout_position.addWidget(self.position_label)
        v_layout_table = QVBoxLayout(self)
        h_layout.addLayout(v_layout_table, 0, 0)
        h_layout.addLayout(v_layout_position, 0, 1)
        v_layout_table.addWidget(self.parameters_label)
        v_layout_table.addWidget(self.parameter_table)
        ##        v_layout_table.addWidget(self.add_button)

        ##        self.languageChange()

        ##        QObject.connect(self.add_button, SIGNAL("clicked()"),
        ##                        self.__add_data_collection)

        QObject.connect(self.parameter_table, SIGNAL("valueChanged(int, int)"),
                        self.__parameter_value_change)

        #self.populate_parameter_table(self.__dc_parameters)

##    def languageChange(self):
##        self.add_button.setText("Add")

    def __tr(self, s, c=None):
        return qApp.translate("parameter_table", s, c)

    def __add_data_collection(self):
        return self.add_dc_cb(self.__dc_parameters, self.collection_type)

    def populate_parameter_table(self, parameters):
        self.parameter_table.setNumRows(11)
        i = 0
        for param_key, parameter in parameters.items():

            if param_key != 'positions':
                self.parameter_table.setText(i, 0, parameter[0])
                self.parameter_table.setText(i, 1, parameter[1])
                self.parameter_table.setText(i, 2, param_key)
                i += 1

##     def add_positions(self, positions):
##         self.__dc_parameters['positions'].extend(positions)

    def __parameter_value_change(self, row, col):
        self.__dc_parameters[str(self.parameter_table.item(row, 2).text())][1] = \
            str(self.parameter_table.item(row, 1).text())
 def removeRows(self, fromRow):
     QTable.setNumRows(self, fromRow)
     
     self.updateGeometry()
Ejemplo n.º 21
0
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)
Ejemplo n.º 22
0
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
Ejemplo n.º 23
0
class Form2(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("Form2")



        self.pushButton2 = QPushButton(self,"pushButton2")
        self.pushButton2.setGeometry(QRect(620,330,141,31))

        self.pushButton3 = QPushButton(self,"pushButton3")
        self.pushButton3.setGeometry(QRect(620,370,141,31))

        self.pushButton5 = QPushButton(self,"pushButton5")
        self.pushButton5.setGeometry(QRect(260,340,111,31))

        self.table1 = QTable(self,"table1")
        self.table1.setGeometry(QRect(30,20,800,310))
        self.table1.setLineWidth(1)
        self.table1.setNumRows(101)
        self.table1.setNumCols(15)

        self.textLabel1 = QLabel(self,"textLabel1")
        self.textLabel1.setGeometry(QRect(140,340,70,31))
        self.textLabel1.setPaletteBackgroundColor(QColor(0,255,255))
        pal = QPalette()
        cg = QColorGroup()
        cg.setColor(QColorGroup.Foreground,Qt.black)
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(223,223,223))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,Qt.black)
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,Qt.black)
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,Qt.black)
        cg.setColor(QColorGroup.LinkVisited,Qt.black)
        pal.setActive(cg)
        cg.setColor(QColorGroup.Foreground,Qt.black)
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(220,220,220))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,Qt.black)
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,Qt.black)
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,QColor(0,0,255))
        cg.setColor(QColorGroup.LinkVisited,QColor(255,0,255))
        pal.setInactive(cg)
        cg.setColor(QColorGroup.Foreground,QColor(128,128,128))
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(220,220,220))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,QColor(128,128,128))
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,QColor(128,128,128))
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,QColor(0,0,255))
        cg.setColor(QColorGroup.LinkVisited,QColor(255,0,255))
        pal.setDisabled(cg)
        self.textLabel1.setPalette(pal)

        self.lineEdit2 = QLineEdit(self,"lineEdit2")
        self.lineEdit2.setGeometry(QRect(40,420,310,21))

        self.languageChange()

        self.resize(QSize(866,656).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.pushButton2,SIGNAL("clicked()"),self.addMatrix)
        self.connect(self.pushButton3,SIGNAL("clicked()"),self.addMem)
        self.connect(self.pushButton5,SIGNAL("clicked()"),self.percent)
        self.connect(self.lineEdit2,SIGNAL("returnPressed()"),self.intvec)


    def languageChange(self):
        self.setCaption(self.__tr("Form2"))
        self.pushButton2.setText(self.__tr("Generar BD"))
        self.pushButton3.setText(self.__tr("Memoria"))
        self.pushButton5.setText(self.__tr("Porcentaje"))
        self.textLabel1.setText(QString.null)


    def addMatrix(self):
            filas = self.table1.numRows()
	    col = self.table1.numCols()
	    for i in range(0, filas):
		for j in range(0, col):
			val = str(dbanimales[i][j])
			self.table1.setText(i,j,val)
        

    def addMem(self):
        filas = self.table1.numRows()
	col = self.table1.numCols()
	for i in range(0, filas):
		for j in range(0, col):
			self.table1.clearCell(i,j)
        for i in range(0, 7):
		for j in range(0, 15):
			v = str(memoria[i][j])
			self.table1.setText(i,j,v)			


    def percent(self):
        suma = cony1 + cony2 + cony3 + cony4 + cony5 + cony6 + cony7
	por = str((suma * 100)/101)
	self.textLabel1.setText(por)

    def intvec(self):
	x = self.lineEdit2.text().ascii()
	x = list(x)
	x = map(int, x)
	x = np.array([x])
	x = x.transpose()
	clase = np.dot(memoria,x)
	aux= clase.max()
	for i in xrange(0, 7):
	 if clase[i][0] == aux:
	  clase [i][0] = 1
	 elif clase[i][0] < aux:
	  clase [i][0] = 0
	clase = clase.transpose()
	if np.all(clase == y7) == True:
	 cad = 'Clase 7'
	 self.textLabel1.setText(cad)
	elif np.all(clase == y6) == True:
	 cad = 'Clase 6'
	 self.textLabel1.setText(cad)
	elif np.all(clase == y5) == True:
	 cad = 'Clase 5'
	 self.textLabel1.setText(cad)
	elif np.all(clase == y4) == True:
	 cad = 'Clase 4'
	 self.textLabel1.setText(cad)
	elif np.all(clase == y3) == True:
	 cad = 'Clase 3'
	 self.textLabel1.setText(cad)
	elif np.all(clase == y2) == True:
	 cad = 'Clase 2'
	 self.textLabel1.setText(cad)	
	elif np.all(clase == y1) == True:
	 cad = 'Clase 1'
	 self.textLabel1.setText(cad)


    def __tr(self,s,c = None):
        return qApp.translate("Form2",s,c)
Ejemplo n.º 24
0
class Form2(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("Form2")



        self.lineEdit2 = QLineEdit(self,"lineEdit2")
        self.lineEdit2.setGeometry(QRect(40,420,310,21))

        self.textLabel1 = QLabel(self,"textLabel1")
        self.textLabel1.setGeometry(QRect(30,340,181,31))
        self.textLabel1.setPaletteBackgroundColor(QColor(0,255,255))
        pal = QPalette()
        cg = QColorGroup()
        cg.setColor(QColorGroup.Foreground,Qt.black)
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(223,223,223))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,Qt.black)
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,Qt.black)
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,Qt.black)
        cg.setColor(QColorGroup.LinkVisited,Qt.black)
        pal.setActive(cg)
        cg.setColor(QColorGroup.Foreground,Qt.black)
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(220,220,220))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,Qt.black)
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,Qt.black)
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,QColor(0,0,255))
        cg.setColor(QColorGroup.LinkVisited,QColor(255,0,255))
        pal.setInactive(cg)
        cg.setColor(QColorGroup.Foreground,QColor(128,128,128))
        cg.setColor(QColorGroup.Button,QColor(192,192,192))
        cg.setColor(QColorGroup.Light,Qt.white)
        cg.setColor(QColorGroup.Midlight,QColor(220,220,220))
        cg.setColor(QColorGroup.Dark,QColor(96,96,96))
        cg.setColor(QColorGroup.Mid,QColor(128,128,128))
        cg.setColor(QColorGroup.Text,QColor(128,128,128))
        cg.setColor(QColorGroup.BrightText,Qt.white)
        cg.setColor(QColorGroup.ButtonText,QColor(128,128,128))
        cg.setColor(QColorGroup.Base,Qt.white)
        cg.setColor(QColorGroup.Background,QColor(0,255,255))
        cg.setColor(QColorGroup.Shadow,Qt.black)
        cg.setColor(QColorGroup.Highlight,QColor(0,0,128))
        cg.setColor(QColorGroup.HighlightedText,Qt.white)
        cg.setColor(QColorGroup.Link,QColor(0,0,255))
        cg.setColor(QColorGroup.LinkVisited,QColor(255,0,255))
        pal.setDisabled(cg)
        self.textLabel1.setPalette(pal)

        self.pushButton2 = QPushButton(self,"pushButton2")
        self.pushButton2.setGeometry(QRect(620,330,141,31))

        self.pushButton3 = QPushButton(self,"pushButton3")
        self.pushButton3.setGeometry(QRect(620,370,141,31))

        self.table1 = QTable(self,"table1")
        self.table1.setGeometry(QRect(30,20,800,310))
        self.table1.setLineWidth(1)
        self.table1.setNumRows(101)
        self.table1.setNumCols(15)

        self.languageChange()

        self.resize(QSize(866,656).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.pushButton2,SIGNAL("clicked()"),self.addMatrix)
        self.connect(self.pushButton3,SIGNAL("clicked()"),self.addMem)


    def languageChange(self):
        self.setCaption(self.__tr("Form2"))
        self.textLabel1.setText(QString.null)
        self.pushButton2.setText(self.__tr("Generar BD"))
        self.pushButton3.setText(self.__tr("Memoria"))


    def addMatrix(self):
		filas = self.table1.numRows()
		col = self.table1.numCols()
		for i in range(0, filas):
			for j in range(0, col):
				val = str(dbanimales[i][j])
				self.table1.setText(i,j,val)
        

    def addMem(self):
	filas = self.table1.numRows()
	col = self.table1.numCols()
	for i in range(0, filas):
		for j in range(0, col):
			self.table1.clearCell(i,j)
        for i in range(0, 7):
		for j in range(0, 15):
			v = str(memoria[i][j])
			self.table1.setText(i,j,v)			

    def __tr(self,s,c = None):
        return qApp.translate("Form2",s,c)
Ejemplo n.º 25
0
class VulnerabilitiesUi(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("VulnerabilitiesUi")

                                        

                                                                                       

        self.t_vulns = QTable(self,"t_vulns")
        self.t_vulns.setNumCols(self.t_vulns.numCols() + 1)
        self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,self.__tr("Name"))
        self.t_vulns.setNumCols(self.t_vulns.numCols() + 1)
        self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,self.__tr("Refs"))
        self.t_vulns.setNumCols(self.t_vulns.numCols() + 1)
        self.t_vulns.horizontalHeader().setLabel(self.t_vulns.numCols() - 1,self.__tr("Description"))
        self.t_vulns.setMinimumSize(QSize(700,0))
        self.t_vulns.setResizePolicy(QTable.AutoOne)
        self.t_vulns.setVScrollBarMode(QTable.AlwaysOn)
        self.t_vulns.setNumRows(0)
        self.t_vulns.setNumCols(3)

                                                            
        LayoutWidget = QWidget(self,"layout7")
        LayoutWidget.setGeometry(QRect(90,500,450,29))
        
                                                                                                                 
        layout7 = QHBoxLayout(LayoutWidget,5,5,"layout7")

        self.add_button = QPushButton(LayoutWidget,"add_button")
        layout7.addWidget(self.add_button)
        spacer6_2 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout7.addItem(spacer6_2)

        self.edit_button = QPushButton(LayoutWidget,"edit_button")
        layout7.addWidget(self.edit_button)
        spacer6 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout7.addItem(spacer6)

        self.delete_button = QPushButton(LayoutWidget,"delete_button")
        layout7.addWidget(self.delete_button)
        
        spacer6_3 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout7.addItem(spacer6_3)

        self.list_note_button = QPushButton(LayoutWidget,"list_note_button")
        layout7.addWidget(self.list_note_button)

        spacer7_3 = QSpacerItem(21,21,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout7.addItem(spacer7_3)

        self.manage_evidence_button = QPushButton(LayoutWidget,"manage_evidence_button")
        layout7.addWidget(self.manage_evidence_button)

        self.languageChange()
        
        
        self.resize(QSize(733,550).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)


    def languageChange(self):
        self.setCaption(self.__tr("Vulnerability List"))
        self.t_vulns.horizontalHeader().setLabel(0,self.__tr("Name"))
        self.t_vulns.horizontalHeader().setLabel(1,self.__tr("Refs"))
        self.t_vulns.horizontalHeader().setLabel(2,self.__tr("Description"))
        self.add_button.setText(self.__tr("New"))
        self.edit_button.setText(self.__tr("Edit"))
        self.delete_button.setText(self.__tr("Delete"))
        self.list_note_button.setText(self.__tr("List Notes"))
        self.manage_evidence_button.setText(self.__tr("Evidence"))


    def __tr(self,s,c = None):
        return qApp.translate("VulnerabilitiesUi",s,c)
Ejemplo n.º 26
0
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)
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
Ejemplo n.º 28
0
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)
Ejemplo n.º 29
0
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))
Ejemplo n.º 30
0
class FormJoystickController(QWidget):
    def __init__(self,parent = None,name = None,fl = 0):
        QWidget.__init__(self,parent,name,fl)

        if not name:
            self.setName("FormJoystickController")


        FormJoystickControllerLayout = QGridLayout(self,1,1,11,6,"FormJoystickControllerLayout")

        self.groupBox12 = QGroupBox(self,"groupBox12")

        self.ledVertAxis = QLineEdit(self.groupBox12,"ledVertAxis")
        self.ledVertAxis.setGeometry(QRect(210,25,207,23))

        self.ledHoriAxis = QLineEdit(self.groupBox12,"ledHoriAxis")
        self.ledHoriAxis.setGeometry(QRect(210,58,207,23))

        self.textLabel1 = QLabel(self.groupBox12,"textLabel1")
        self.textLabel1.setGeometry(QRect(112,22,92,30))

        self.ledRotaAxis = QLineEdit(self.groupBox12,"ledRotaAxis")
        self.ledRotaAxis.setGeometry(QRect(210,87,207,23))

        self.ledButtonClicked = QLineEdit(self.groupBox12,"ledButtonClicked")
        self.ledButtonClicked.setGeometry(QRect(210,116,207,23))

        self.textLabel1_3 = QLabel(self.groupBox12,"textLabel1_3")
        self.textLabel1_3.setGeometry(QRect(112,87,92,23))

        self.btStart = QPushButton(self.groupBox12,"btStart")
        self.btStart.setGeometry(QRect(11,22,95,30))

        self.textLabel1_2 = QLabel(self.groupBox12,"textLabel1_2")
        self.textLabel1_2.setGeometry(QRect(112,58,92,23))

        self.btCalibrate = QPushButton(self.groupBox12,"btCalibrate")
        self.btCalibrate.setGeometry(QRect(11,69,95,30))

        self.textLabel1_3_2 = QLabel(self.groupBox12,"textLabel1_3_2")
        self.textLabel1_3_2.setGeometry(QRect(112,116,92,23))

        self.cbxCalibration = QComboBox(0,self.groupBox12,"cbxCalibration")
        self.cbxCalibration.setGeometry(QRect(10,110,92,27))

        FormJoystickControllerLayout.addWidget(self.groupBox12,0,0)

        self.groupBox2 = QGroupBox(self,"groupBox2")
        self.groupBox2.setColumnLayout(0,Qt.Vertical)
        self.groupBox2.layout().setSpacing(6)
        self.groupBox2.layout().setMargin(11)
        groupBox2Layout = QGridLayout(self.groupBox2.layout())
        groupBox2Layout.setAlignment(Qt.AlignTop)

        self.ledCommand = QLineEdit(self.groupBox2,"ledCommand")

        groupBox2Layout.addMultiCellWidget(self.ledCommand,1,1,1,2)

        self.textLabel1_4 = QLabel(self.groupBox2,"textLabel1_4")

        groupBox2Layout.addMultiCellWidget(self.textLabel1_4,0,0,1,2)

        self.textLabel1_4_2 = QLabel(self.groupBox2,"textLabel1_4_2")

        groupBox2Layout.addWidget(self.textLabel1_4_2,0,0)

        self.tblConfig = QTable(self.groupBox2,"tblConfig")
        self.tblConfig.setNumCols(self.tblConfig.numCols() + 1)
        self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Action"))
        self.tblConfig.setNumCols(self.tblConfig.numCols() + 1)
        self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Input"))
        self.tblConfig.setNumCols(self.tblConfig.numCols() + 1)
        self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Command"))
        self.tblConfig.setNumCols(self.tblConfig.numCols() + 1)
        self.tblConfig.horizontalHeader().setLabel(self.tblConfig.numCols() - 1,self.__tr("Description"))
        self.tblConfig.setNumRows(0)
        self.tblConfig.setNumCols(4)

        groupBox2Layout.addMultiCellWidget(self.tblConfig,1,4,0,0)

        self.btSave = QPushButton(self.groupBox2,"btSave")

        groupBox2Layout.addMultiCellWidget(self.btSave,4,4,1,2)

        self.btNew = QPushButton(self.groupBox2,"btNew")

        groupBox2Layout.addMultiCellWidget(self.btNew,3,3,1,2)

        self.textLabel1_5 = QLabel(self.groupBox2,"textLabel1_5")

        groupBox2Layout.addWidget(self.textLabel1_5,2,1)

        self.spbDogNumber = QSpinBox(self.groupBox2,"spbDogNumber")

        groupBox2Layout.addWidget(self.spbDogNumber,2,2)

        FormJoystickControllerLayout.addWidget(self.groupBox2,1,0)

        self.languageChange()

        self.resize(QSize(450,367).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.btStart,SIGNAL("clicked()"),self.slotStartStopJoystick)
        self.connect(self.btNew,SIGNAL("clicked()"),self.slotNewAction)
        self.connect(self.btSave,SIGNAL("clicked()"),self.slotSaveConfiguration)


    def languageChange(self):
        self.setCaption(self.__tr("Joystick Controller"))
        self.groupBox12.setTitle(self.__tr("Input"))
        self.ledVertAxis.setText(self.__tr("0.0"))
        self.ledHoriAxis.setText(self.__tr("0.0"))
        self.textLabel1.setText(self.__tr("Verical Axis"))
        self.ledRotaAxis.setText(self.__tr("0.0"))
        self.textLabel1_3.setText(self.__tr("Rotation Axis"))
        self.btStart.setText(self.__tr("Start Joystick"))
        self.textLabel1_2.setText(self.__tr("Horizontal Axis"))
        self.btCalibrate.setText(self.__tr("Calibrate"))
        self.textLabel1_3_2.setText(self.__tr("Button Clicked"))
        self.cbxCalibration.clear()
        self.cbxCalibration.insertItem(self.__tr("1.0"))
        self.cbxCalibration.insertItem(self.__tr("63.998046875043258"))
        self.groupBox2.setTitle(self.__tr("Output"))
        self.textLabel1_4.setText(self.__tr("Command send"))
        self.textLabel1_4_2.setText(self.__tr("Configuration"))
        self.tblConfig.horizontalHeader().setLabel(0,self.__tr("Action"))
        self.tblConfig.horizontalHeader().setLabel(1,self.__tr("Input"))
        self.tblConfig.horizontalHeader().setLabel(2,self.__tr("Command"))
        self.tblConfig.horizontalHeader().setLabel(3,self.__tr("Description"))
        self.btSave.setText(self.__tr("Save"))
        self.btNew.setText(self.__tr("New"))
        self.textLabel1_5.setText(self.__tr("Dog No"))


    def slotStartStopJoystick(self):
        print "FormJoystickController.slotStartStopJoystick(): Not implemented yet"

    def slotNewAction(self):
        print "FormJoystickController.slotNewAction(): Not implemented yet"

    def slotSaveConfiguration(self):
        print "FormJoystickController.slotSaveConfiguration(): Not implemented yet"

    def __tr(self,s,c = None):
        return qApp.translate("FormJoystickController",s,c)
Ejemplo n.º 31
0
class GUIcreatePort(QDialog):
    def __init__(self, parent=None, name=None, modal=0, fl=0):
        QDialog.__init__(self, parent, name, modal, fl)

        if not name:
            self.setName("GUIcreatePort")

        GUIcreatePortLayout = QGridLayout(self, 1, 1, 11, 6,
                                          "GUIcreatePortLayout")

        self.cancelbutton = QPushButton(self, "cancelbutton")

        GUIcreatePortLayout.addWidget(self.cancelbutton, 4, 4)

        self.okbutton = QPushButton(self, "okbutton")

        GUIcreatePortLayout.addWidget(self.okbutton, 4, 3)
        spacer2 = QSpacerItem(421, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
        GUIcreatePortLayout.addMultiCell(spacer2, 4, 4, 0, 2)

        self.table = QTable(self, "table")
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Device Name"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Port Nr"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Port Type"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Port Way"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Port Speed"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("PXI?"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("OK?"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Phy"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("MAC Adress"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("IP Adress"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Sub net"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("IP Name"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Bia"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("PortID"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Modified"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Modify parameters"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Old IP"))
        self.table.setNumCols(self.table.numCols() + 1)
        self.table.horizontalHeader().setLabel(self.table.numCols() - 1,
                                               self.__tr("Save Satus"))
        self.table.setNumRows(0)
        self.table.setNumCols(18)

        GUIcreatePortLayout.addMultiCellWidget(self.table, 3, 3, 0, 4)

        self.removebutton = QPushButton(self, "removebutton")

        GUIcreatePortLayout.addWidget(self.removebutton, 2, 0)
        spacer1 = QSpacerItem(351, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
        GUIcreatePortLayout.addMultiCell(spacer1, 2, 2, 1, 3)

        self.addportbutton = QPushButton(self, "addportbutton")

        GUIcreatePortLayout.addMultiCellWidget(self.addportbutton, 1, 1, 0, 4)

        self.buttonGroup3 = QButtonGroup(self, "buttonGroup3")

        self.textLabel2 = QLabel(self.buttonGroup3, "textLabel2")
        self.textLabel2.setGeometry(QRect(11, 11, 126, 16))

        self.textLabel2_2_2 = QLabel(self.buttonGroup3, "textLabel2_2_2")
        self.textLabel2_2_2.setGeometry(QRect(10, 60, 156, 16))

        self.porttype = QLineEdit(self.buttonGroup3, "porttype")
        self.porttype.setGeometry(QRect(10, 80, 150, 22))
        self.porttype.setMaximumSize(QSize(200, 32767))

        self.textLabel2_2_3 = QLabel(self.buttonGroup3, "textLabel2_2_3")
        self.textLabel2_2_3.setGeometry(QRect(100, 110, 21, 16))

        self.textLabel2_2_3_2 = QLabel(self.buttonGroup3, "textLabel2_2_3_2")
        self.textLabel2_2_3_2.setGeometry(QRect(10, 110, 56, 16))

        self.textLabel2_2_2_2 = QLabel(self.buttonGroup3, "textLabel2_2_2_2")
        self.textLabel2_2_2_2.setGeometry(QRect(194, 11, 40, 16))

        self.textLabel2_2 = QLabel(self.buttonGroup3, "textLabel2_2")
        self.textLabel2_2.setGeometry(QRect(190, 60, 80, 16))

        self.admstatus = QCheckBox(self.buttonGroup3, "admstatus")
        self.admstatus.setGeometry(QRect(100, 170, 77, 20))

        self.buttonGroup1 = QButtonGroup(self.buttonGroup3, "buttonGroup1")
        self.buttonGroup1.setGeometry(QRect(190, 110, 100, 80))

        self.portwayOUT = QRadioButton(self.buttonGroup1, "portwayOUT")
        self.portwayOUT.setGeometry(QRect(30, 40, 40, 20))

        self.portwayIN = QRadioButton(self.buttonGroup1, "portwayIN")
        self.portwayIN.setGeometry(QRect(30, 20, 30, 20))

        self.portid = QLineEdit(self.buttonGroup3, "portid")
        self.portid.setGeometry(QRect(195, 30, 100, 22))
        self.portid.setMaximumSize(QSize(200, 32767))

        self.portnumber = QSpinBox(self.buttonGroup3, "portnumber")
        self.portnumber.setGeometry(QRect(189, 79, 90, 22))
        self.portnumber.setMaxValue(10000)

        self.portspeed = QSpinBox(self.buttonGroup3, "portspeed")
        self.portspeed.setGeometry(QRect(10, 130, 80, 22))
        self.portspeed.setMaximumSize(QSize(200, 32767))
        self.portspeed.setMaxValue(100000)

        self.devicename = QLineEdit(self.buttonGroup3, "devicename")
        self.devicename.setGeometry(QRect(11, 31, 150, 22))

        self.phy = QComboBox(0, self.buttonGroup3, "phy")
        self.phy.setGeometry(QRect(100, 130, 78, 22))

        self.pxibooting = QCheckBox(self.buttonGroup3, "pxibooting")
        self.pxibooting.setGeometry(QRect(10, 170, 77, 20))

        GUIcreatePortLayout.addMultiCellWidget(self.buttonGroup3, 0, 0, 0, 1)

        self.buttonGroup2 = QButtonGroup(self, "buttonGroup2")
        self.buttonGroup2.setSizePolicy(
            QSizePolicy(4, 0, 0, 0,
                        self.buttonGroup2.sizePolicy().hasHeightForWidth()))

        self.textLabel2_3_2_3_2 = QLabel(self.buttonGroup2,
                                         "textLabel2_3_2_3_2")
        self.textLabel2_3_2_3_2.setGeometry(QRect(10, 140, 50, 16))

        self.textLabel2_3_2_3 = QLabel(self.buttonGroup2, "textLabel2_3_2_3")
        self.textLabel2_3_2_3.setGeometry(QRect(10, 110, 50, 16))

        self.textLabel2_3_2_2 = QLabel(self.buttonGroup2, "textLabel2_3_2_2")
        self.textLabel2_3_2_2.setGeometry(QRect(10, 80, 80, 16))

        self.textLabel2_3_2 = QLabel(self.buttonGroup2, "textLabel2_3_2")
        self.textLabel2_3_2.setGeometry(QRect(10, 50, 60, 16))

        self.textLabel2_3 = QLabel(self.buttonGroup2, "textLabel2_3")
        self.textLabel2_3.setGeometry(QRect(10, 20, 70, 16))

        self.macadress = QLineEdit(self.buttonGroup2, "macadress")
        self.macadress.setGeometry(QRect(90, 20, 180, 22))

        self.ipadress = QLineEdit(self.buttonGroup2, "ipadress")
        self.ipadress.setGeometry(QRect(90, 50, 180, 22))

        self.subnetadress = QLineEdit(self.buttonGroup2, "subnetadress")
        self.subnetadress.setGeometry(QRect(90, 80, 180, 22))

        self.ipname = QLineEdit(self.buttonGroup2, "ipname")
        self.ipname.setGeometry(QRect(90, 110, 180, 22))

        self.bia = QLineEdit(self.buttonGroup2, "bia")
        self.bia.setGeometry(QRect(90, 140, 180, 22))

        GUIcreatePortLayout.addMultiCellWidget(self.buttonGroup2, 0, 0, 2, 4)

        self.languageChange()

        self.resize(QSize(645, 548).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.setTabOrder(self.table, self.devicename)
        self.setTabOrder(self.devicename, self.portid)
        self.setTabOrder(self.portid, self.porttype)
        self.setTabOrder(self.porttype, self.portnumber)
        self.setTabOrder(self.portnumber, self.portspeed)
        self.setTabOrder(self.portspeed, self.phy)
        self.setTabOrder(self.phy, self.portwayIN)
        self.setTabOrder(self.portwayIN, self.portwayOUT)
        self.setTabOrder(self.portwayOUT, self.pxibooting)
        self.setTabOrder(self.pxibooting, self.admstatus)
        self.setTabOrder(self.admstatus, self.macadress)
        self.setTabOrder(self.macadress, self.ipadress)
        self.setTabOrder(self.ipadress, self.subnetadress)
        self.setTabOrder(self.subnetadress, self.ipname)
        self.setTabOrder(self.ipname, self.bia)
        self.setTabOrder(self.bia, self.addportbutton)
        self.setTabOrder(self.addportbutton, self.removebutton)
        self.setTabOrder(self.removebutton, self.okbutton)
        self.setTabOrder(self.okbutton, self.cancelbutton)

    def languageChange(self):
        self.setCaption(self.__tr("Create Port(s)"))
        self.cancelbutton.setText(self.__tr("Cancel"))
        self.okbutton.setText(self.__tr("Ok"))
        self.table.horizontalHeader().setLabel(0, self.__tr("Device Name"))
        self.table.horizontalHeader().setLabel(1, self.__tr("Port Nr"))
        self.table.horizontalHeader().setLabel(2, self.__tr("Port Type"))
        self.table.horizontalHeader().setLabel(3, self.__tr("Port Way"))
        self.table.horizontalHeader().setLabel(4, self.__tr("Port Speed"))
        self.table.horizontalHeader().setLabel(5, self.__tr("PXI?"))
        self.table.horizontalHeader().setLabel(6, self.__tr("OK?"))
        self.table.horizontalHeader().setLabel(7, self.__tr("Phy"))
        self.table.horizontalHeader().setLabel(8, self.__tr("MAC Adress"))
        self.table.horizontalHeader().setLabel(9, self.__tr("IP Adress"))
        self.table.horizontalHeader().setLabel(10, self.__tr("Sub net"))
        self.table.horizontalHeader().setLabel(11, self.__tr("IP Name"))
        self.table.horizontalHeader().setLabel(12, self.__tr("Bia"))
        self.table.horizontalHeader().setLabel(13, self.__tr("PortID"))
        self.table.horizontalHeader().setLabel(14, self.__tr("Modified"))
        self.table.horizontalHeader().setLabel(15,
                                               self.__tr("Modify parameters"))
        self.table.horizontalHeader().setLabel(16, self.__tr("Old IP"))
        self.table.horizontalHeader().setLabel(17, self.__tr("Save Satus"))
        self.removebutton.setText(self.__tr("Remove"))
        self.addportbutton.setText(self.__tr("Add Port"))
        self.buttonGroup3.setTitle(self.__tr("General :"))
        self.textLabel2.setText(self.__tr("Device Name(s):"))
        self.textLabel2_2_2.setText(self.__tr("Port Type(s):"))
        self.textLabel2_2_3.setText(self.__tr("Phy:"))
        self.textLabel2_2_3_2.setText(self.__tr("Port Speed:"))
        self.textLabel2_2_2_2.setText(self.__tr("Port ID:"))
        self.textLabel2_2.setText(self.__tr("Port Number(s):"))
        self.admstatus.setText(self.__tr("Adm Status"))
        self.buttonGroup1.setTitle(self.__tr("Port Way :"))
        self.portwayOUT.setText(self.__tr("Out"))
        self.portwayIN.setText(self.__tr("In"))
        self.pxibooting.setText(self.__tr("PXI Booting"))
        self.buttonGroup2.setTitle(self.__tr("Network :"))
        self.textLabel2_3_2_3_2.setText(self.__tr("Bia:"))
        self.textLabel2_3_2_3.setText(self.__tr("IP Name:"))
        self.textLabel2_3_2_2.setText(self.__tr("Subnet Adress:"))
        self.textLabel2_3_2.setText(self.__tr("IP Adress:"))
        self.textLabel2_3.setText(self.__tr("MAC Adress:"))

    def __tr(self, s, c=None):
        return qApp.translate("GUIcreatePort", s, c)
Ejemplo n.º 32
0
class Form1(QMainWindow):
    def __init__(self,parent = None,name = None,fl = 0):
        QMainWindow.__init__(self,parent,name,fl)
        self.statusBar()

        self.image0 = QPixmap()
        self.image0.loadFromData(image0_data,"PNG")
        self.image1 = QPixmap()
        self.image1.loadFromData(image1_data,"PNG")
        self.image2 = QPixmap()
        self.image2.loadFromData(image2_data,"PNG")
        self.image3 = QPixmap()
        self.image3.loadFromData(image3_data,"PNG")
        if not name:
            self.setName("Form1")


        self.setCentralWidget(QWidget(self,"qt_central_widget"))

        self.addButton = QPushButton(self.centralWidget(),"addButton")
        self.addButton.setGeometry(QRect(620,20,111,31))
        self.addButton.setAutoDefault(1)

        self.replaceButton = QPushButton(self.centralWidget(),"replaceButton")
        self.replaceButton.setGeometry(QRect(740,20,110,31))
        self.replaceButton.setAutoDefault(1)

        self.deleteButton = QPushButton(self.centralWidget(),"deleteButton")
        self.deleteButton.setGeometry(QRect(860,20,111,31))
        self.deleteButton.setAutoDefault(1)

        self.pushButton1 = QPushButton(self.centralWidget(),"pushButton1")
        self.pushButton1.setGeometry(QRect(290,430,121,41))
        self.pushButton1.setAutoDefault(1)

        self.pushButton1_2 = QPushButton(self.centralWidget(),"pushButton1_2")
        self.pushButton1_2.setGeometry(QRect(420,430,121,41))
        self.pushButton1_2.setAutoDefault(1)

        self.table1 = QTable(self.centralWidget(),"table1")
        self.table1.setGeometry(QRect(10,70,980,350))
        self.table1.setNumRows(100)
        self.table1.setNumCols(100)
        self.table1.setReadOnly(1)
        self.table1.setSelectionMode(QTable.Single)

        self.lineEdit1 = QLineEdit(self.centralWidget(),"lineEdit1")
        self.lineEdit1.setGeometry(QRect(10,20,601,31))

        self.fileNewAction = QAction(self,"fileNewAction")
        self.fileNewAction.setIconSet(QIconSet(self.image0))
        self.fileOpenAction = QAction(self,"fileOpenAction")
        self.fileOpenAction.setIconSet(QIconSet(self.image1))
        self.fileSaveAction = QAction(self,"fileSaveAction")
        self.fileSaveAction.setIconSet(QIconSet(self.image2))
        self.fileSaveAsAction = QAction(self,"fileSaveAsAction")
        self.filePrintAction = QAction(self,"filePrintAction")
        self.filePrintAction.setIconSet(QIconSet(self.image3))
        self.fileExitAction = QAction(self,"fileExitAction")
        self.helpContentsAction = QAction(self,"helpContentsAction")
        self.helpIndexAction = QAction(self,"helpIndexAction")
        self.helpAboutAction = QAction(self,"helpAboutAction")
        self.editSettingsAction = QAction(self,"editSettingsAction")
        self.menunew_itemAction = QAction(self,"menunew_itemAction")


        self.toolBar = QToolBar(QString(""),self,Qt.DockTop)

        self.fileNewAction.addTo(self.toolBar)
        self.fileOpenAction.addTo(self.toolBar)
        self.fileSaveAction.addTo(self.toolBar)
        self.fileSaveAsAction.addTo(self.toolBar)


        self.MenuBar = QMenuBar(self,"MenuBar")


        self.fileMenu = QPopupMenu(self)
        self.fileNewAction.addTo(self.fileMenu)
        self.fileOpenAction.addTo(self.fileMenu)
        self.fileSaveAction.addTo(self.fileMenu)
        self.fileSaveAsAction.addTo(self.fileMenu)
        self.fileMenu.insertSeparator()
        self.fileExitAction.addTo(self.fileMenu)
        self.MenuBar.insertItem(QString(""),self.fileMenu,1)

        self.Edit = QPopupMenu(self)
        self.editSettingsAction.addTo(self.Edit)
        self.MenuBar.insertItem(QString(""),self.Edit,2)

        self.helpMenu = QPopupMenu(self)
        self.helpAboutAction.addTo(self.helpMenu)
        self.MenuBar.insertItem(QString(""),self.helpMenu,3)


        self.languageChange()

        self.resize(QSize(1000,556).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.fileExitAction,SIGNAL("activated()"),self.close)
        self.connect(self.pushButton1_2,SIGNAL("clicked()"),self.close)
        self.connect(self.table1,SIGNAL("pressed(int,int,int,const QPoint&)"),self.table_click)
        self.connect(self.addButton,SIGNAL("clicked()"),self.add_entry)
        self.connect(self.replaceButton,SIGNAL("clicked()"),self.replace_entry)
        self.connect(self.lineEdit1,SIGNAL("returnPressed()"),self.add_entry)
        self.connect(self.deleteButton,SIGNAL("clicked()"),self.delete_entry)
        self.connect(self.addButton,SIGNAL("clicked()"),self.lineEdit1.clear)
        self.connect(self.lineEdit1,SIGNAL("returnPressed()"),self.lineEdit1.clear)
        self.connect(self.replaceButton,SIGNAL("clicked()"),self.lineEdit1.clear)
        self.connect(self.deleteButton,SIGNAL("clicked()"),self.lineEdit1.clear)
        self.connect(self.pushButton1,SIGNAL("clicked()"),self.run_programs)
        self.connect(self.fileNewAction,SIGNAL("activated()"),self.new_graph)
        self.connect(self.editSettingsAction,SIGNAL("activated()"),self.display_config)
        self.connect(self.fileOpenAction,SIGNAL("activated()"),self.open_command)
        self.connect(self.fileSaveAction,SIGNAL("activated()"),self.save_command)
        self.connect(self.fileSaveAsAction,SIGNAL("activated()"),self.saveas_command)
        self.connect(self.helpAboutAction,SIGNAL("activated()"),self.show_about)

        self.setTabOrder(self.lineEdit1,self.addButton)
        self.setTabOrder(self.addButton,self.replaceButton)
        self.setTabOrder(self.replaceButton,self.deleteButton)
        self.setTabOrder(self.deleteButton,self.pushButton1)
        self.setTabOrder(self.pushButton1,self.pushButton1_2)
        self.setTabOrder(self.pushButton1_2,self.table1)


    def languageChange(self):
        self.setCaption(self.__tr("QTPlumb"))
        self.addButton.setText(self.__tr("Add"))
        self.replaceButton.setText(self.__tr("Replace"))
        self.deleteButton.setText(self.__tr("Delete"))
        self.pushButton1.setText(self.__tr("Run Programs"))
        self.pushButton1_2.setText(self.__tr("Close"))
        QToolTip.add(self.table1,self.__tr("Click on the spreadsheet to create connections"))
        QToolTip.add(self.lineEdit1,self.__tr("Enter your programs here"))
        self.fileNewAction.setText(self.__tr("New"))
        self.fileNewAction.setMenuText(self.__tr("&New"))
        self.fileNewAction.setAccel(self.__tr("Ctrl+N"))
        self.fileOpenAction.setText(self.__tr("Open"))
        self.fileOpenAction.setMenuText(self.__tr("&Open..."))
        self.fileOpenAction.setAccel(self.__tr("Ctrl+O"))
        self.fileSaveAction.setText(self.__tr("Save"))
        self.fileSaveAction.setMenuText(self.__tr("&Save"))
        self.fileSaveAction.setAccel(self.__tr("Ctrl+S"))
        self.fileSaveAsAction.setText(self.__tr("Save As"))
        self.fileSaveAsAction.setMenuText(self.__tr("Save &As..."))
        self.fileSaveAsAction.setAccel(QString.null)
        self.filePrintAction.setText(self.__tr("Print"))
        self.filePrintAction.setMenuText(self.__tr("&Print..."))
        self.filePrintAction.setAccel(self.__tr("Ctrl+P"))
        self.fileExitAction.setText(self.__tr("E&xit"))
        self.fileExitAction.setMenuText(self.__tr("E&xit"))
        self.fileExitAction.setAccel(QString.null)
        self.helpContentsAction.setText(self.__tr("Contents"))
        self.helpContentsAction.setMenuText(self.__tr("&Contents..."))
        self.helpContentsAction.setAccel(QString.null)
        self.helpIndexAction.setText(self.__tr("Index"))
        self.helpIndexAction.setMenuText(self.__tr("&Index..."))
        self.helpIndexAction.setAccel(QString.null)
        self.helpAboutAction.setText(self.__tr("About"))
        self.helpAboutAction.setMenuText(self.__tr("&About"))
        self.helpAboutAction.setAccel(QString.null)
        self.editSettingsAction.setText(self.__tr("Options"))
        self.editSettingsAction.setMenuText(self.__tr("Options"))
        self.menunew_itemAction.setText(self.__tr("new item"))
        self.menunew_itemAction.setMenuText(self.__tr("new item"))
        self.toolBar.setLabel(self.__tr("Tools"))
        if self.MenuBar.findItem(1):
            self.MenuBar.findItem(1).setText(self.__tr("&File"))
        if self.MenuBar.findItem(2):
            self.MenuBar.findItem(2).setText(self.__tr("Edit"))
        if self.MenuBar.findItem(3):
            self.MenuBar.findItem(3).setText(self.__tr("&Help"))


    def run_programs(self):
        	import glob
        	from commands import getoutput
        	from thread import start_new_thread
        	if len(glob.glob(getoutput("echo ~") + "/.qtplumb")) > 0:
        		file = open(getoutput("echo ~") + "/.qtplumb", "r")
        		command = file.readline()
        		xterm_loc = file.readline()
        		for i in range(0, 5):
        			if xterm_loc != "\n":
        				break
        			xterm_loc = file.readline()
        		file.close()
        		command = command[0:(len(command) - 1)]
        		command = xterm_loc + " -hold -e " + command
        	else:
        		command = "../testadj "
        	for i in range(0, len(self.programs)):
        		command += " \"%d:" % (i + 1) + self.programs[i] + "\" "
        	command += " -e "
        	for i in range(1, len(self.programs) + 2):
        		for j in range(1, len(self.programs) + 2):
        			if self.table1.text(i, j).ascii() == "X":
        				command += " %d," % (i - 1) + "%d " % (j - 1)
        	def command_runner(x):
        		getoutput(command)
        	start_new_thread(command_runner, (0, ))
        

    def table_click(self,row,col,button,point):
        	if (row == 0) or (row > len(self.programs) + 1) or (col > (len(self.programs) + 1)) or ((row == 1) and (col == 0)):
        		self.disable_ed()	
        		return
        	if col == 0:
        		self.selectedEntry = [row,col]
        		self.replaceButton.setEnabled(1)
        		self.deleteButton.setEnabled(1)
        		self.lineEdit1.setText(self.table1.text(row,col))
        		return
        	if self.table1.text(row, col).ascii() != "X":
        		self.table1.setText(row, col, QString("X"))
        	else:
        		self.table1.setText(row, col, QString(""))
        	self.disable_ed()	
        

    def add_entry(self):
        	s = self.lineEdit1.text().ascii()
        	self.programs.append(s)
        	self.table1.setText(len(self.programs) + 1, 0, s)
        	self.table1.setText(0, len(self.programs) + 1, s)
        

    def replace_entry(self):
        	s = self.lineEdit1.text().ascii()
        	self.programs[self.selectedEntry[0] - 1] = s
        	self.table1.setText(self.selectedEntry[0], 0, s)
        	self.table1.setText(0, self.selectedEntry[0], s)
        

    def init_two(self):
        	self.programs = []
        	self.table1.setText(0, 1, QString("Console"))
        	self.table1.setText(1, 0, QString("Console"))
        	self.disable_ed()
        	self.filename = ""
        

    def delete_entry(self):
        	self.table1.removeRow(self.selectedEntry[0])
        	self.table1.removeColumn(self.selectedEntry[0])
        	self.programs.pop(self.selectedEntry[0] - 2)
        	self.disable_ed()
        

    def disable_ed(self):
        	self.selectedEntry = [0,0]
        	self.deleteButton.setEnabled(0)
        	self.replaceButton.setEnabled(0)
        

    def new_graph(self):
        	for i in range(0, len(self.programs) + 2):
        		for j in range(0, len(self.programs) + 2):
        			self.table1.clearCell(i, j)
        	self.init_two()
        

    def open_command(self):
        	from commands import getoutput
        	if self.filename == "":
        		temp = QFileDialog.getOpenFileName(getoutput("echo ~"), "Commands (*.cmd);;All Files (*.*)", self, "Save as", "Choose a file").ascii()
        	else:
        		temp = QFileDialog.getOpenFileName(self.filename, "Commands (*.cmd);;All Files (*.*)", self, "Save as", "Choose a file").ascii()
        	if temp == None:
        		return
        	self.filename = temp
        	file = open(self.filename, "r")
        	command = file.read()
        	file.close()
        	
        	def add_to_graph(s):
        		self.lineEdit1.setText(s)
        		self.add_entry()
        	
        	tempstring = ""
        	mode = 1
        	for i in range(0, len(command)):
        		if command[i] == '-' and mode == 1:
        			if command[i + 1] == 'e':
        				i += 2
        				mode = 2
        		if command[i] == ":" and mode == 1:
        			i += 1
        			tempstring = ""
        			while command[i] != '"' and command[i - 1] != '\\':
        				tempstring += command[i]
        				i += 1
        			add_to_graph(tempstring)
        		if command[i] == ',' and mode == 2:
        			tempstring = ""
        			frm = 0
        			dest = 0
        			while command[i] != ' ':
        				i -= 1
        			i += 1
        			while command[i] != ',':
        				tempstring += command[i]
        				i += 1
        			i += 1
        			frm = int(tempstring)
        			tempstring = ""
        			while command[i] != " " and command[i] != "\n":
        				tempstring += command[i]
        				i += 1
        			dest = int(tempstring)
        			self.table1.setText(frm + 1, dest + 1, "X")
        

    def save_command(self):
        	if self.filename == "":
        		self.saveas_command()
        		return
        	command = "../testadj "
        	for i in range(0, len(self.programs)):
        		command += " \"%d:" % (i + 1) + self.programs[i] + "\" "
        	command += "-e "
        	for i in range(1, len(self.programs) + 1):
        		for j in range(1, len(self.programs) + 2):
        			if self.table1.text(i, j).ascii() == "X":
        				command += " %d," % i + "%d " % (j - 1)
        	file = open(self.filename, "w")
        	file.write(command)
        	file.write("\n")
        	file.close()
        

    def saveas_command(self):
        	from commands import getoutput
        	if self.filename == "":
        		temp = QFileDialog.getSaveFileName(getoutput("echo ~"), "Commands (*.cmd);;All Files (*.*)", self, "Save as", "Choose a file").ascii()
        	else:
        		temp = QFileDialog.getSaveFileName(self.filename, "Commands (*.cmd);;All Files (*.*)", self, "Save as", "Choose a file").ascii()
        	if temp != None:
        		self.filename = temp
        		self.save_command()
        

    def show_about(self):
        	from aboutbox import aboutBox
        	box = aboutBox(self, "About", 0, 0)
        	box.show()
        	box.exec_loop()	
        

    def display_config(self):
        	from configbox import configBox
        	box = configBox(self, "QTPlumb Config", 0, 0)
        	box.init_two()
        	box.show()
        	box.exec_loop()
        

    def __tr(self,s,c = None):
        return qApp.translate("Form1",s,c)
Ejemplo n.º 33
0
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)
Ejemplo n.º 34
0
    def removeRows(self, fromRow):
        QTable.setNumRows(self, fromRow)

        self.updateGeometry()
Ejemplo n.º 35
0
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)
Ejemplo n.º 36
0
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))
Ejemplo n.º 37
0
class ChangeSettingsUI(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("Form1")


        Form1Layout = QVBoxLayout(self,11,6,"Form1Layout")

        self.splitter4 = QSplitter(self,"splitter4")
        self.splitter4.setOrientation(QSplitter.Horizontal)

        LayoutWidget = QWidget(self.splitter4,"layout29")
        layout29 = QGridLayout(LayoutWidget,1,1,11,6,"layout29")

        self.tblValues = QTable(LayoutWidget,"tblValues")
        self.tblValues.setResizePolicy(QTable.Default)
        self.tblValues.setNumRows(23)
        self.tblValues.setNumCols(7)
        self.tblValues.setSorting(0)

        layout29.addMultiCellWidget(self.tblValues,0,0,0,2)

        self.groupBox1 = QGroupBox(LayoutWidget,"groupBox1")
        self.groupBox1.setColumnLayout(0,Qt.Vertical)
        self.groupBox1.layout().setSpacing(6)
        self.groupBox1.layout().setMargin(11)
        groupBox1Layout = QGridLayout(self.groupBox1.layout())
        groupBox1Layout.setAlignment(Qt.AlignTop)

        layout5 = QGridLayout(None,1,1,0,6,"layout5")

        self.spinAnalysis = QSpinBox(self.groupBox1,"spinAnalysis")

        layout5.addWidget(self.spinAnalysis,1,1)

        self.textLabel1_2 = QLabel(self.groupBox1,"textLabel1_2")

        layout5.addWidget(self.textLabel1_2,2,0)

        self.chkSimulatable = QCheckBox(self.groupBox1,"chkSimulatable")

        layout5.addWidget(self.chkSimulatable,0,0)

        self.textLabel1 = QLabel(self.groupBox1,"textLabel1")

        layout5.addWidget(self.textLabel1,1,0)

        self.spinEnv = QSpinBox(self.groupBox1,"spinEnv")

        layout5.addWidget(self.spinEnv,2,1)

        groupBox1Layout.addLayout(layout5,0,0)

        layout8 = QVBoxLayout(None,0,6,"layout8")

        layout7 = QHBoxLayout(None,0,6,"layout7")

        self.chkAnnBB = QCheckBox(self.groupBox1,"chkAnnBB")
        layout7.addWidget(self.chkAnnBB)

        self.chkAnnPoint = QCheckBox(self.groupBox1,"chkAnnPoint")
        layout7.addWidget(self.chkAnnPoint)
        layout8.addLayout(layout7)

        layout4 = QHBoxLayout(None,0,6,"layout4")

        self.textLabel2 = QLabel(self.groupBox1,"textLabel2")
        layout4.addWidget(self.textLabel2)

        self.txtFilename = QLineEdit(self.groupBox1,"txtFilename")
        self.txtFilename.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed,0,0,self.txtFilename.sizePolicy().hasHeightForWidth()))
        layout4.addWidget(self.txtFilename)

        self.btnOpenFile = QPushButton(self.groupBox1,"btnOpenFile")
        self.btnOpenFile.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Fixed,0,0,self.btnOpenFile.sizePolicy().hasHeightForWidth()))
        self.btnOpenFile.setMaximumSize(QSize(30,32767))
        layout4.addWidget(self.btnOpenFile)
        layout8.addLayout(layout4)

        self.btnNetlist = QPushButton(self.groupBox1,"btnNetlist")
        layout8.addWidget(self.btnNetlist)

        groupBox1Layout.addLayout(layout8,0,1)

        layout29.addMultiCellWidget(self.groupBox1,2,2,0,2)

        self.btnSave = QPushButton(LayoutWidget,"btnSave")

        layout29.addWidget(self.btnSave,1,1)

        self.btnUpdate = QPushButton(LayoutWidget,"btnUpdate")

        layout29.addWidget(self.btnUpdate,1,0)

        self.btnPrint = QPushButton(LayoutWidget,"btnPrint")

        layout29.addWidget(self.btnPrint,1,2)

        self.tabWidget4 = QTabWidget(self.splitter4,"tabWidget4")

        self.tab = QWidget(self.tabWidget4,"tab")
        tabLayout = QVBoxLayout(self.tab,11,6,"tabLayout")

        self.txtNetlist = QTextEdit(self.tab,"txtNetlist")
        self.txtNetlist.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding,0,0,self.txtNetlist.sizePolicy().hasHeightForWidth()))
        self.txtNetlist.setWordWrap(QTextEdit.NoWrap)
        self.txtNetlist.setWrapPolicy(QTextEdit.AtWordBoundary)
        tabLayout.addWidget(self.txtNetlist)
        self.tabWidget4.insertTab(self.tab,QString.fromLatin1(""))
        Form1Layout.addWidget(self.splitter4)

        self.languageChange()

        self.resize(QSize(854,621).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)


    def languageChange(self):
        self.setCaption(self.__tr("Form1"))
        self.groupBox1.setTitle(self.__tr("Netlist"))
        self.textLabel1_2.setText(self.__tr("Env point:"))
        self.chkSimulatable.setText(self.__tr("Simulatable"))
        self.textLabel1.setText(self.__tr("Analysis:"))
        self.chkAnnBB.setText(self.__tr("Annotate BB"))
        self.chkAnnPoint.setText(self.__tr("Annotate Point"))
        self.textLabel2.setText(self.__tr("Filename:"))
        self.btnOpenFile.setText(self.__tr("..."))
        self.btnNetlist.setText(self.__tr("Netlist"))
        self.btnSave.setText(self.__tr("save"))
        self.btnUpdate.setText(self.__tr("update"))
        self.btnPrint.setText(self.__tr("print"))
        self.tabWidget4.changeTab(self.tab,self.__tr("Netlist"))


    def __tr(self,s,c = None):
        return qApp.translate("ChangeSettingsUI",s,c)