self.selection = selection
self.collist = ("uid", "status", "title", "quantitiy", "unit", "price", "priority", "date", "private", "stores", "note", "custom1", "custom2")
- #sql = "DROP TABLE items"
- #self.db.speichereSQL(sql)
-
sql = "CREATE TABLE items (uid TEXT, list TEXT, category TEXT, status TEXT, title TEXT, quantitiy TEXT, unit TEXT, price TEXT, priority TEXT, date TEXT, pcdate TEXT, private TEXT, stores TEXT, note TEXT, custom1 TEXT, custom2 TEXT)"
self.db.speichereSQL(sql)
self.selection.connect("changed", self.update_list)
#self.selection.connect("changedCategory", self.update_category)
- """
- sql = "INSERT INTO items (uid, list, category, title) VALUES (?, ?, ?, ?)"
- import uuid
- self.db.speichereSQL(sql, (str(uuid.uuid4()), "default", "default", "atitel1"))
- self.db.speichereSQL(sql, (str(uuid.uuid4()), "default", "default", "btitel2"))
- self.db.speichereSQL(sql, (str(uuid.uuid4()), "default", "default", "ctitel3"))
-
- print "inserted"
- """
-
def set_filter(self, filter):
assert filter in self.ALL_FILTERS
self.__filter = filter
pass
#unit = ""
self.liststore.append([uid, status, title, quantitiy, unit, price, priority, date, private, stores, note, custom1, custom2])
- #else:
- #self.liststore.append(["-1", "-1", "", " ", "", "", "", "", "", "", "", "", ""])
- #import uuid
- #self.liststore.append(["-1", "-1", "", "", "", "", "", "", "", "", "", "", ""])
return self.liststore
return False
def update_row(self, irow, icol, new_text):
- #print "liststore 1"
- #for x in self.liststore:
- # print x[0], x[2]
-
if -1 < irow and self.liststore[irow][0] != "-1" and self.liststore[irow][0] is not None:
sql = "UPDATE items SET "+self.collist[icol]+" = ? WHERE uid = ?"
self.db.speichereSQL(sql, (new_text, self.liststore[irow][0]), rowid = self.liststore[irow][0])
else:
_moduleLogger.warning("update_row: row does not exist")
return
- #if (self.emptyValueExists() == True)and(icol<2):
- # #print "letzter Eintrag ohne inhalt"
- # return
-
- #print "liststore 2"
- #for x in self.liststore:
- # print x[0], x[2]
def checkout_rows(self):
sql = "UPDATE items SET status = ? WHERE list = ? AND category LIKE ? AND status = ?"
self.liststore[i][1] = "-1"
def add_row(self, title = ""):
- #self.update_row(-1, 1, "-1")
- #for x in self.liststore:
- # print x[0], x[2]
status = self.__calculate_status()
import uuid
uid = str(uuid.uuid4())
sql = "INSERT INTO items (uid, list, category, status, title) VALUES (?, ?, ?, ?, ?)"
self.db.speichereSQL(sql, (uid, self.selection.get_list(), self.selection.get_category(), status, title), rowid = uid)
_moduleLogger.info("Insertet row: status = "+status+" with uid "+str(uid))
- #self.liststore[irow][0] = str(uuid.uuid4())
self.liststore.append([uid, status, title, " ", "", "", "", "", "", "", "", "", ""])
self.selection.comboLists_check_for_update()
- # if (irow>-1):
- # self.liststore[irow][icol] = new_text
- # self.liststore[irow][0] = uid
- # else:
- # self.liststore.append([uid, "-1", "", " ", "", "", "", "", "", "", "", "", ""])
- #print "xy", self.liststore[len(self.liststore)-1][0]
- #Check if a new list/category is opened
- # self.selection.comboLists_check_for_update()
def del_row(self, irow, row_iter):
uid = self.liststore[irow][0]
self.scrolled_window = None
self.reload_view()
- """
- bearbeitenFrame = gtk.Frame("Verteilung kopieren nach")
- bearbeitenvBox = gtk.VBox(homogeneous = False, spacing = 0)
-
- bearbeitenhBox = gtk.HBox(homogeneous = False, spacing = 0)
- self.comboKlassen = gtk.combo_box_new_text()
- bearbeitenhBox.pack_start(self.comboKlassen, expand = False, fill = True, padding = 0)
- button = gtk.Button("Kopieren")
- button.connect("clicked", self.kopiereStoffverteilung, None)
- bearbeitenhBox.pack_start(button, expand = False, fill = True, padding = 0)
-
- label = gtk.Label(" ")
- bearbeitenhBox.pack_start(label, expand = False, fill = True, padding = 0)
-
- button = gtk.Button("Export in CSV-Datei")
- button.connect("clicked", self.exportStoffverteilung, None)
- bearbeitenhBox.pack_start(button, expand = False, fill = True, padding = 0)
-
- bearbeitenvBox.pack_start(bearbeitenhBox, expand = False, fill = True, padding = 0)
-
-
- bearbeitenFrame.add(bearbeitenvBox)
- self.pack_start(bearbeitenFrame, expand = False, fill = True, padding = 0)
- """
-
- #self.connect("unmap", self.speichere)
- #self.connect("map", self.ladeWirklich)
-
- #self.show_all()
-
- #print "libstoffverteilung 9: ", time.clock()
-
def loadList(self):
ls = self.liststorehandler.get_liststore()
self.treeview.set_model(ls)
- #self.tvcolumn[i].add_attribute( self.cell[i], "active", 1)
- #print "setup", ls
def col_edited(self, cell, irow, new_text, icol = None):
if (irow != 4):
print cell, irow, new_text, icol
def col_toggled(self, widget, irow, status ):
- #print irow, ls[irow][1], status
ls = self.treeview.get_model()
if self.liststorehandler.get_filter() == self.liststorehandler.SHOW_ACTIVE:
else:
self.liststorehandler.update_row(irow, 1, "0")
- #self.tvcolumn[i].set_attributes( self.cell[i], active = i)
-
def convert(self, s):
- #print s
- if (s == "1"):
+ if s == "1":
return 1
else:
return 0
def del_active_row(self):
path, col = self.treeview.get_cursor()
- #print path, col
if path is not None:
irow = path[0]
row_iter = self.treeview.get_model().get_iter(path)
self.liststorehandler.del_row(irow, row_iter)
- #treemodel.get_iter()
-
def sort_func_function(self, model, iter1, iter2, data = None):
print "sorting"
if self.db.ladeDirekt("showcol_"+str(self.liststorehandler.get_colname(i)), default) == "1":
if (i == 1):
self.cell[i] = CellRendererTriple()
- self.tvcolumn[i] = gtk.TreeViewColumn(self.liststorehandler.get_colname(i), self.cell[i])
+ self.tvcolumn[i] = gtk.TreeViewColumn("", self.cell[i])
self.cell[i].connect( 'status_changed', self.col_toggled)
self.tvcolumn[i].set_attributes( self.cell[i], status = i)
elif (i == 3)or(i == 4)or(i == 6):