Add field with possible device after reading signature

This commit is contained in:
Joerg Wunsch
2024-03-26 14:48:16 +01:00
parent 09ece3753e
commit 2b4058887e
2 changed files with 73 additions and 86 deletions

View File

@@ -411,8 +411,13 @@ class adgui(QObject):
read_sig = m.get(3)
sigstr = read_sig.hex(' ').upper()
self.memories.deviceSig.setText(sigstr)
p = ad.locate_part_by_signature(ad.cvar.part_list, read_sig)
if p:
self.memories.candidate.setText(p.desc)
else:
self.memories.candidate.setText("???")
else:
print("Could not find signature memory", file = sys.stderr)
ad.log("Could not find signature memory", ad.MSG_ERROR)
def main():
gui = adgui(sys.argv)

View File

@@ -48,75 +48,16 @@
<attribute name="title">
<string>Signature</string>
</attribute>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<x>30</x>
<y>30</y>
<width>681</width>
<height>112</height>
<width>651</width>
<height>76</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="5">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>From device:</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="deviceSig">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="text">
<string>1E XX XX</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
@@ -150,19 +91,6 @@
</layout>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="readSig">
<property name="sizePolicy">
@@ -172,22 +100,76 @@
</sizepolicy>
</property>
<property name="text">
<string>Read</string>
<string>Read →</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="4">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>From device:</string>
</property>
<property name="sizeHint" stdset="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="deviceSig">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="text">
<string>1E XX XX</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="5">
<widget class="QGroupBox" name="groupBox_3">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>160</width>
<height>0</height>
</size>
</property>
</spacer>
<property name="title">
<string>Candidate:</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="candidate">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="text">
<string>---</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>