Esempio n. 1
0
 def evEditItem(self, event=None):
     # get selected member
     indices = self.itemList.curselection()
     index = int(indices[0]) if indices else 0
     item = self.items[index]
     ownerID = item[3]
     ownerName = data.get_member_name(ownerID)
     dlg = od.OptionsDialog(top, (["Name", item[1]], [
         "Description", item[2]
     ], ["Owner", ownerName], ["Price", item[4]], ["Condition", item[5]]))
     if dlg.changed:
         if dlg.options[2][1] != ownerName:  # its changed
             ownerID = self.get_member_id(dlg.options[2][1])
         data.update_item(item[0],
                          dlg.options[0][1], dlg.options[1][1], ownerID,
                          int(dlg.options[3][1]), dlg.options[4][1])
         self.items = data.get_items()
         self.populateItemList()
Esempio n. 2
0
 def ev_edit_item(self, event=None):
     # get selected member
     indices = self.item_list.curselection()
     index = int(indices[0]) if indices else 0
     item = self.items[index]
     owner_id = item[3]
     owner_name = data.get_member_name(owner_id)
     dlg = od.OptionsDialog(top, (
         ["Name", item[1]],
         ["Description", item[2]],
         ["Owner", owner_name],
         ["Price", item[4]],
         ["Condition", item[5]]))
     if dlg.changed:
         if dlg.options[2][1] != owner_name:  # its changed
             owner_id = self.get_member_id(dlg.options[2][1])
         data.update_item(item[0], dlg.options[0][1], dlg.options[1][1], owner_id, int(dlg.options[3][1]),
                          dlg.options[4][1])
         self.items = data.get_items()
         self.populate_item_list()
Esempio n. 3
0
 def populateItemList(self):
     self.itemList.delete('0', 'end')
     for item in self.items:
         item = list(item[1:])
         item[2] = data.get_member_name(item[2])
         self.itemList.insert('end', self.itemFmt.format(*item))
Esempio n. 4
0
print(ld.get_members())
print(ld.get_items())

ld.insert_item('Python Projects','Book',6,30,'Excellent')
###
# this should not have worked..... BUT IT DID. WTF PRAGMA?!>!?
###

ld.insert_member('Alan','*****@*****.**')
print(ld.get_members())
ld.insert_item('Python Projects','Book',6,30,'Excellent')
ld.get_items()

ld.update_item(7,Price=25)
ld.get_item_details(7)
ld.get_member_name(6)
ld.update_member(6,Name='Alan Gould')
ld.get_member_details(6)

ld.delete_member(6)  # this also shouldn't work due to referential integrity, but does...
ld.delete_item(7)
ld.delete_member(6)

ld.cursor.execute("""
    select * from item
    where OwnerID in (select id from member where name like '%e%')
    """).fetchall()

ld.cursor.execute("""
    select * from item
    where ownerid not in (select id from member where name like '%e%')
Esempio n. 5
0
 def populate_item_list(self):
     self.item_list.delete("0", "end")
     for item in self.items:
         item = list(item[1:])
         item[2] = data.get_member_name(item[2])
         self.item_list.insert("end", self.item_fmt.format(*item))
Esempio n. 6
0
 def populateItemList(self):
     self.itemList.delete('0','end')
     for item in self.items:
         item = list(item[1:])
         item[2] = data.get_member_name(item[2])
         self.itemList.insert('end', self.itemFmt.format(*item))
Esempio n. 7
0
 def populate_item_list(self):
     self.item_list.delete("0", "end")
     for item in self.items:
         item = list(item[1:])
         item[2] = data.get_member_name(item[2])
         self.item_list.insert("end", self.item_fmt.format(*item))