def changeECU(self, index): item = self.treeview_ecu.model().itemData(index) ecu_name = unicode(item[0].toString().toUtf8(), encoding="UTF-8") self.treeview_params.clear() ecu = self.ecu_scan.ecus[ecu_name] ecu_file = "ecus/" + ecu.href ecu_addr = ecu.addr self.paramview = parameters.paramWidget(self.scrollview, ecu_file, ecu_addr, ecu_name, self.logview) self.scrollview.setWidget(self.paramview) self.protocolstatus.setText(ecu.protocol) screens = self.paramview.categories.keys() for screen in screens: item = gui.QTreeWidgetItem(self.treeview_params, [screen]) for param in self.paramview.categories[screen]: param_item = gui.QTreeWidgetItem(item, [param]) param_item.setData(0, core.Qt.UserRole, param)
def set_param_file(self, ecu_file, ecu_addr, ecu_name, isxml): self.diagaction.setEnabled(True) self.hexinput.setEnabled(True) self.treeview_params.clear() uiscale_mem = 12 if self.paramview: uiscale_mem = self.paramview.uiscale self.paramview.setParent(None) self.paramview.close() self.paramview.destroy() self.paramview = parameters.paramWidget(self.scrollview, ecu_file, ecu_addr, ecu_name, self.logview, self.protocolstatus) if options.simulation_mode: self.requesteditor.set_ecu(self.paramview.ecurequestsparser) self.dataitemeditor.set_ecu(self.paramview.ecurequestsparser) self.buttonEditor.set_ecu(self.paramview.ecurequestsparser) self.ecuparameditor.set_ecu(self.paramview.ecurequestsparser) self.ecuparameditor.set_targets(self.paramview.targetsdata) if isxml: self.requesteditor.enable_view(False) self.dataitemeditor.enable_view(False) self.buttonEditor.enable_view(False) self.ecuparameditor.enable_view(False) self.paramview.uiscale = uiscale_mem self.scrollview.setWidget(self.paramview) screens = self.paramview.categories.keys() self.screennames = [] for screen in screens: item = widgets.QTreeWidgetItem(self.treeview_params, [screen]) for param in self.paramview.categories[screen]: param_item = widgets.QTreeWidgetItem(item, [param]) param_item.setData(0, core.Qt.UserRole, param) self.screennames.append(param)
def changeECU(self, index): self.diagaction.setEnabled(False) self.hexinput.setEnabled(False) item = self.treeview_ecu.model().itemData(index) ecu_name = unicode(item[0].toString().toUtf8(), encoding="UTF-8") self.treeview_params.clear() if ecu_name in self.ecu_scan.ecus: ecu = self.ecu_scan.ecus[ecu_name] elif ecu_name in self.ecu_scan.approximate_ecus: ecu = self.ecu_scan.approximate_ecus[ecu_name] else: return ecu_file = "ecus/" + ecu.href ecu_addr = ecu.addr uiscale_mem = 8 if self.paramview: uiscale_mem = self.paramview.uiscale self.paramview.setParent(None) self.paramview.close() self.paramview.destroy() self.paramview = parameters.paramWidget(self.scrollview, ecu_file, ecu_addr, ecu_name, self.logview) self.paramview.uiscale = uiscale_mem self.scrollview.setWidget(self.paramview) self.protocolstatus.setText(ecu.protocol) screens = self.paramview.categories.keys() for screen in screens: item = gui.QTreeWidgetItem(self.treeview_params, [screen]) for param in self.paramview.categories[screen]: param_item = gui.QTreeWidgetItem(item, [param]) param_item.setData(0, core.Qt.UserRole, param)
def changeECU(self, index): item = self.treeview_ecu.model().itemData(index) ecu_name = unicode(item[0].toString().toUtf8(), encoding="UTF-8") isxml = True ecu = None ecu_file = ecu_name if ecu_name in self.ecu_scan.ecus: ecu = self.ecu_scan.ecus[ecu_name] elif ecu_name in self.ecu_scan.approximate_ecus: ecu = self.ecu_scan.approximate_ecus[ecu_name] elif ecu_name in self.ecunamemap: name = self.ecunamemap[ecu_name] ecu = self.ecu_scan.ecu_database.getTarget(name) else: ecu = self.ecu_scan.ecu_database.getTarget(ecu_name) if ecu: if '.xml' not in ecu.href.lower(): isxml = False ecu_file = options.ecus_dir + ecu.href ecu_addr = ecu.addr if self.snifferview.set_file(ecu_file): self.tabbedview.setCurrentIndex(2) if self.paramview: if ecu_file == self.paramview.ddtfile: return self.diagaction.setEnabled(True) self.hexinput.setEnabled(True) self.treeview_params.clear() uiscale_mem = 12 if self.paramview: uiscale_mem = self.paramview.uiscale self.paramview.setParent(None) self.paramview.close() self.paramview.destroy() self.paramview = parameters.paramWidget(self.scrollview, ecu_file, ecu_addr, ecu_name, self.logview, self.protocolstatus) if options.simulation_mode: self.requesteditor.set_ecu(self.paramview.ecurequestsparser) self.dataitemeditor.set_ecu(self.paramview.ecurequestsparser) self.buttonEditor.set_ecu(self.paramview.ecurequestsparser) self.ecuparameditor.set_ecu(self.paramview.ecurequestsparser) self.ecuparameditor.set_targets(self.paramview.targetsdata) if isxml: self.requesteditor.enable_view(False) self.dataitemeditor.enable_view(False) self.buttonEditor.enable_view(False) self.ecuparameditor.enable_view(False) self.paramview.uiscale = uiscale_mem self.scrollview.setWidget(self.paramview) screens = self.paramview.categories.keys() self.screennames = [] for screen in screens: item = gui.QTreeWidgetItem(self.treeview_params, [screen]) for param in self.paramview.categories[screen]: param_item = gui.QTreeWidgetItem(item, [param]) param_item.setData(0, core.Qt.UserRole, param) self.screennames.append(param)