def __saveData(self, evt): """ gather and save data to DB""" data = { "file_number":int(self.folderNumber.GetValue()), "surname":self.surname.GetValue(), "first_names":self.name.GetValue(), "birth_date":self.birthdate.GetValue(), "gender":self.gender.GetStringSelection(), "nationalid":self.ID.GetValue(), "nationality":self.nationality.GetValue(), "note":self.note.GetValue(), "callname":self.callname.GetValue(), "language":self.language.GetValue(), "occupation":self.occupation.GetValue(), "marital_status":self.marital_status.GetStringSelection(), "dependants":self.dependants.GetValue(), "ethnicity":self.race.GetValue(), "employer":self.employer.GetValue() } for k, v in data.items(): if type(v) == type(u""): data[k] = str(v) if self.modeLabel.GetLabel() == editstr: CONN.saveBio(data) else: CONN.addnewBioEntry(data)
def __saveData(self, evt): """ save the data""" # telephone numbers data = self.grid.getData() CONN.saveContacts(self.file_number, data) # addresses adata = [] for k, w in self.addWidgets.items(): lines = w.getLines().strip() code = w.getCode().strip() if lines or code: adata.append((k, lines, code)) CONN.saveAddress(self.file_number, adata)
def deleteEntry(self, evt): """ delete selected entry""" from Dialogs.ConfirmationDialog import ConfirmationDialog i = self.normalResult.GetSelection() data = Result.getResult()[i] file_number = data["file_number"] msg = "Delete %(surname)s, %(first_names)s Folder %(file_number)d from database ?" % data dlg = ConfirmationDialog(self, msg=msg) if dlg.ShowModal() == wx.ID_OK: CONN.deleteEntry(file_number) self.__searchDB() Result.notify(self.normalResult.GetSelection())
def __saveData(self, evt): """ save the data""" if not self.visits: displayMessage("Nothing Selected") return curval = self.visitListCtrl.GetStringSelection() self.visits[curval] = self.note.GetValue() print self.visits # only work with visits data = {} if self.file_number: for k, v in self.visits.items(): if k[0] == "*": data[k[1:]] = v CONN.saveVisits(self.file_number, data) self.reload()
def __reloadLastQuery(self): """ reload the last query""" if os.path.exists(LASTQFILE): data = pickle.load(open(LASTQFILE, 'r')) # qdata = {"folderno": folderno, # "surname": surname, # "name": name} if data["folderno"]: self.folderNumber.SetValue(data["folderno"]) if data["surname"]: self.surname.SetValue(data["surname"]) if data["name"]: self.name.SetValue(data["name"]) if data["bdate"]: self.bdate.SetValue(data["bdate"]) CONN.search(data) self.presentResult()
def reload(self, data=None): """ load data""" if data: self.file_number = data["file_number"] # contact numbers contacts = CONN.getContacts(self.file_number) self.grid.setData(contacts) # addresses for k, w in self.addWidgets.items(): w.setLines('') w.setCode('') addresses = CONN.getAddresses(self.file_number) print addresses for ad in addresses: desc = ad['description'] if self.addWidgets.has_key(desc): w = self.addWidgets[desc] w.setLines(ad["lines"]) w.setCode(ad["code"])
def reload(self, data=None): """ reload the panel """ self.visits = {} self.visitListCtrl.Clear() self.note.Clear() if data != None: self.file_number = data["file_number"] self.visits = CONN.getVisits(self.file_number) # dict vd = self.visits.keys() vd.sort() vd.reverse() if vd: self.visitListCtrl.Set(vd) self.visitListCtrl.SetSelection(0) self.currentdate = vd[0] self.note.SetValue(self.visits[self.currentdate])