def evEditMember(self, event=None): indices = self.memberList.curselection() index = int(indices[0]) if indices else 0 mbr = self.members[index] dlg = od.OptionsDialog(top, (["Name", mbr[1]], ["Email", mbr[2]])) if dlg.changed: data.update_member(mbr[0], dlg.options[0][1], dlg.options[1][1]) self.members = data.get_members() self.populateMemberList()
def evNewItem(self): dlg = od.OptionsDialog( top, (["Name", ""], ["Description", ""], ["Owner", ""], ["Price", ""], ["Condition", ""])) if dlg.changed: ownerID = self.get_member_id(dlg.options[2][1]) data.insert_item(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()
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()
def evNewMember(self): dlg = od.OptionsDialog(top, (["Name", ""], ["Email", ""])) if dlg.changed: data.update_member(None, dlg.options[0][1], dlg.options[1][1]) self.members = data.get_members() self.populateMemberList()