Skip to content

Commit

Permalink
fix measurements and cursors
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-demin committed Sep 13, 2016
1 parent 395aa2f commit a749e7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 11 additions & 3 deletions PyQtScope.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def read_data(self):
if typ == 'NONE':
val = ''
uni = ''
elif val == '9.9E37':
elif abs(float(val)) > 9.9E9:
val = '?'
uni = ''
else:
Expand All @@ -221,8 +221,16 @@ def read_data(self):
curs = self.receive_result()[:-1].decode("utf-8").rsplit(';')
self.curst.setText('%s %s' % (curs[1], self.cursors[curs[0]]))
if curs[0] == 'VBARS':
self.curs1.setText('%ss\t%sV' % (metric_prefix(float(curs[3])), metric_prefix(float(curs[8]))))
self.curs2.setText('%ss\t%sV' % (metric_prefix(float(curs[4])), metric_prefix(float(curs[9]))))
val = float(curs[8])
if abs(val) > 9.9E9:
self.curs1.setText('%ss' % (metric_prefix(float(curs[3]))))
else:
self.curs1.setText('%ss\t%sV' % (metric_prefix(float(curs[3])), metric_prefix(float(curs[8]))))
val = float(curs[9])
if abs(val) > 9.9E9:
self.curs2.setText('%ss' % (metric_prefix(float(curs[4]))))
else:
self.curs2.setText('%ss\t%sV' % (metric_prefix(float(curs[4])), metric_prefix(float(curs[9]))))
elif curs[0] == 'HBARS':
self.curs1.setText('%sV' % metric_prefix(float(curs[6])))
self.curs2.setText('%sV' % metric_prefix(float(curs[7])))
Expand Down
8 changes: 4 additions & 4 deletions PyQtScope.ui
Original file line number Diff line number Diff line change
Expand Up @@ -105,28 +105,28 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="meas4">
<widget class="QLabel" name="meas1">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="meas1">
<widget class="QLabel" name="meas2">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="meas2">
<widget class="QLabel" name="meas3">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="meas3">
<widget class="QLabel" name="meas4">
<property name="text">
<string/>
</property>
Expand Down

0 comments on commit a749e7a

Please sign in to comment.