def refresh(self): """Populates the table.""" self.disconnect(self.table, SIGNAL("cellChanged(int, int)"), self.cellChanged) self.table.setRowCount(len(self._traceManager.traceSegments)) for p, t in enumerate(self._traceManager.traceSegments): if not self.table.cellWidget(p, 0): # check if the enable/disable button already exist self.table.setVerticalHeaderItem(p, QTableWidgetItem("%d" % p)) cb = QCheckBox() cb.clicked.connect(util.Command(self.changeTraceStatus, p)) cb.setToolTip("Enable/disable trace set") self.table.setCellWidget(p, 0, cb) if t: self.table.cellWidget(p, 0).setChecked(t.enabled) rangeWidget = QTableWidgetItem(("%d-%d" % (t.mappedRange[0], t.mappedRange[1])) if (t.enabled and t.numTraces()>0) else "") rangeWidget.setFlags(rangeWidget.flags() & ~Qt.ItemIsEditable) self.table.setItem(p, self.findCol("Mapped Range"), rangeWidget) for column in t.config.attrHeaderValues(): col = self.findCol(column["header"]) if col: wid = QTableWidgetItem("%s" % t.config.attr(column["name"])) traceAattribute = t.config.attrDict(column["name"]) if not traceAattribute.get("editable", False): wid.setFlags(wid.flags() & ~Qt.ItemIsEditable) self.table.setItem(p, col, wid) else: logging.error("Column doesn't exists: " + column["header"]) else: logging.error('Sequence #%d should never be None: ' % p) self.table.horizontalHeader().setStretchLastSection(True) self.connect(self.table, SIGNAL("cellChanged(int, int)"), self.cellChanged)
def __init__(self, parent): AutoScript.__init__(self) PassiveTraceObserver.__init__(self) self.getParams().getChild("Input").hide() self._project = None self.params.addChildren([ { 'name': 'Load Template', 'type': 'group', 'children': [] }, { 'name': 'Generate New Template', 'type': 'group', 'children': [{ 'name': 'Trace Start', 'key': 'tgenstart', 'value': 0, 'type': 'int', 'action': self.updateScript }, { 'name': 'Trace End', 'key': 'tgenstop', 'value': parent.traceMax, 'type': 'int', 'action': self.updateScript }, { 'name': 'POI Selection', 'key': 'poimode', 'type': 'list', 'values': { 'TraceExplorer Table': 0, 'Read from Project File': 1 }, 'value': 0, 'action': self.updateScript }, { 'name': 'Read POI', 'type': 'action', 'action': self.updateScript }, { 'name': 'Generate Templates', 'type': 'action', 'action': util.Command(self.runScriptFunction.emit, "generateTemplates") }] }, ]) self.addGroup("generateTemplates") self.sr = None self.stats = DataTypeDiffs() self.setProfileAlgorithm(TemplateBasic)
def __init__(self): AlgorithmsBase.__init__(self) self.profiling = None self.getParams().addChildren([ { 'name': 'Load Template', 'type': 'group', 'children': [] }, { 'name': 'Generate New Template', 'type': 'group', 'children': [{ 'name': 'Trace Start', 'key': 'tgenstart', 'value': 0, 'type': 'int', 'action': self.updateScript }, { 'name': 'Trace End', 'key': 'tgenstop', 'value': 0, 'type': 'int', 'action': self.updateScript }, { 'name': 'POI Selection', 'key': 'poimode', 'type': 'list', 'values': { 'TraceExplorer Table': 0, 'Read from Project File': 1 }, 'value': 0, 'action': self.updateScript }, { 'name': 'Read POI', 'type': 'action', 'action': self.updateScript }, { 'name': 'Generate Templates', 'type': 'action', 'action': util.Command(self.runScriptFunction.emit, "generateTemplates") }] }, ]) self.addGroup("generateTemplates") self.setProfileAlgorithm(TemplateUsingMVS) self.updateScript()
def addExampleScripts(self, scripts): self.exampleScriptAct = QAction('&Example Scripts', self, statusTip='Predefined Scripts') self.projectMenu.addSeparator() self.projectMenu.addAction(self.exampleScriptAct) subMenu = QMenu("Submenu", self) for name, script in scripts.iteritems(): subMenu.addAction( QAction(name, self, statusTip=script.getDescription(), triggered=util.Command(self.runScript, script))) self.exampleScriptAct.setMenu(subMenu)