From 58d225607f4e93ec247c1ed2610f7362f960e561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Tue, 20 Nov 2012 21:33:15 +0100 Subject: [PATCH] sync --- reflowctl/reflowctl_gui.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/reflowctl/reflowctl_gui.py b/reflowctl/reflowctl_gui.py index ab4d769..f175290 100755 --- a/reflowctl/reflowctl_gui.py +++ b/reflowctl/reflowctl_gui.py @@ -153,7 +153,7 @@ class Solder(object): xmltree = etree.parse(filename) root = xmltree.getroot() solder_node = root[0] - s = Solder(solder_node.attrib["name"], solder_node) + s = Solder(solder_node.attrib["name"], solder_node.attrib["description"]) env_count = 0 for temp_level in solder_node.findall("state"): tstr = temp_level.attrib["temperature"] @@ -190,6 +190,7 @@ class Solder(object): return s + class SolderListModel(QtCore.QAbstractListModel): def __init__(self, parent=None, *args): """ datain: a list where each item is a row @@ -206,7 +207,6 @@ class SolderListModel(QtCore.QAbstractListModel): #print e #pass - print len(self.listdata) def rowCount(self, parent=QtCore.QModelIndex()): return len(self.listdata) @@ -223,6 +223,12 @@ class SolderListModel(QtCore.QAbstractListModel): else: return QtCore.QVariant() + def create_solder(self): + solder = Solder("new", "") + solder.add_temp_level("environment temp", getTemperature(), True) + self.listdata.append(solder) + self.reset() + class TempLevelModel(QtCore.QAbstractTableModel): def __init__(self, parent): @@ -704,6 +710,11 @@ class ApplicationWindow(QtGui.QMainWindow): QtCore.SIGNAL("clicked(QModelIndex)"), self.solder_selected) + self.connect( + self.solder_controls.add_button, + QtCore.SIGNAL("clicked()"), + self.solder_model.create_solder) + self.settings_widget = QtGui.QWidget(self) pl = QtGui.QHBoxLayout(self.settings_widget) pl.addWidget(self.solder_view, 1)