Skip to content

Commit

Permalink
Fix: correctly sort instruments in device annotator (#16)
Browse files Browse the repository at this point in the history
* Fix: correctly sort instruments in device annotator

* Fix: device annotator improve formatting

* Fix: use pyqt5 directly
jenshnielsen committed Aug 22, 2017
1 parent 17475f2 commit 98e3b0a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions qcodes/utils/qcodes_device_annotator.py
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
import os
import json
import glob
import qtpy.QtWidgets as qt
import qtpy.QtGui as gui
import qtpy.QtCore as core
import PyQt5.QtWidgets as qt
import PyQt5.QtGui as gui
import PyQt5.QtCore as core

from shutil import copyfile

@@ -49,7 +49,8 @@ def __init__(self, folder, station):
self.model.setHorizontalHeaderLabels([self.tr("Instruments")])
self.addStation(self.model, station)
self.treeView.setModel(self.model)

self.treeView.sortByColumn(0, core.Qt.AscendingOrder)
self.treeView.setSortingEnabled(True)
grid.addWidget(self.imageCanvas, 0, 0, 4, 6)
grid.addWidget(self.loadButton, 4, 0)
grid.addWidget(self.labelButton, 4, 1)
@@ -73,7 +74,6 @@ def addStation(self, parent, station):
paramitem = gui.QStandardItem(param)
paramitem.setEditable(False)
item.appendRow(paramitem)
item.sortChildren(0)

def loadimage(self):
"""
@@ -262,7 +262,16 @@ def updateValues(self, station):

for instrument, parameters in self._data.items():
for parameter in parameters.keys():
self._data[instrument][parameter]['value'] = str(station.components[instrument][parameter].get_latest())
value = station.components[instrument][parameter].get_latest()
try:
floatvalue = float(station.components[instrument][parameter].get_latest())
if floatvalue > 1000 or floatvalue < 0.1:
valuestr = "{:.2e}".format(floatvalue)
else:
valuestr = "{:.2f}".format(floatvalue)
except ValueError:
valuestr = str(value)
self._data[instrument][parameter]['value'] = valuestr

def makePNG(self, counter, path=None):
"""

0 comments on commit 98e3b0a

Please sign in to comment.