This commit is contained in:
Stefan Kögl 2012-11-20 21:33:15 +01:00
parent e7ade6bb92
commit 58d225607f
1 changed files with 13 additions and 2 deletions

View File

@ -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)