def __init__(self, notebook, appointmentdata): self.appointmentdata = appointmentdata wx.Panel.__init__(self, notebook) self.viewappointmentspanel = False if self.appointmentdata.operation == 0: pagetitle = self.GetLabel("appointmentappointmentforlabel") + " " + self.appointmentdata.animaldata.name + " " + self.appointmentdata.clientdata.surname else: pagetitle = self.GetLabel("appointmentoperationforlabel") + " " + self.appointmentdata.animaldata.name + " " + self.appointmentdata.clientdata.surname self.pagetitle = miscmethods.GetPageTitle(notebook, pagetitle) datesizer = wx.BoxSizer(wx.HORIZONTAL) self.appointmententry = customwidgets.DateCtrl(self, self.appointmentdata) appointmentdate = miscmethods.GetWXDateFromSQLDate(self.appointmentdata.date) self.appointmententry.SetValue(appointmentdate) action = "SELECT Name FROM user WHERE Position = \"Vet\" OR Position = \"Manager\"" results = db.SendSQL(action, self.appointmentdata.localsettings.dbconnection) vets = [] if len(results) != 0: for a in results: vets.append(a[0]) self.vetcombobox = wx.ComboBox(self, -1, "Vet", choices=vets) if self.appointmentdata.vet != "None": self.vetcombobox.SetValue(str(self.appointmentdata.vet)) self.vetcombobox.Bind(wx.EVT_CHAR, self.UseVetComboBox) self.vetcombobox.SetToolTipString(self.GetLabel("appointmententervettooltip")) refreshbitmap = wx.Bitmap("icons/refresh.png") refreshappointmentsbutton = wx.BitmapButton(self, -1, refreshbitmap) refreshappointmentsbutton.Bind(wx.EVT_BUTTON, self.RefreshAppointment) refreshappointmentsbutton.SetToolTipString(self.GetLabel("appointmentrefreshtooltip")) datesizer.Add(self.appointmententry, 1, wx.EXPAND) datesizer.Add(self.vetcombobox, 1, wx.EXPAND) datesizer.Add(refreshappointmentsbutton, 0, wx.ALIGN_LEFT) reasonsizer = wx.BoxSizer(wx.VERTICAL) self.reasonlabel = wx.StaticText(self, -1, self.GetLabel("appointmentreasonlabel")) reasonsizer.Add(self.reasonlabel, 0, wx.ALIGN_LEFT) self.reasonentry = wx.TextCtrl(self, -1, self.appointmentdata.reason, style=wx.TE_MULTILINE, size=(-1,100)) self.reasonentry.SetFocus() reasonsizer.Add(self.reasonentry, 0, wx.EXPAND) searchsizer = wx.BoxSizer(wx.VERTICAL) searchsizer.Add(datesizer, 0, wx.EXPAND) searchsizer.Add(reasonsizer, 0, wx.EXPAND) searchspacer2 = wx.StaticText(self, -1, "", size=(-1,10)) searchsizer.Add(searchspacer2, 0, wx.EXPAND) appointmenttimesizer = wx.BoxSizer(wx.HORIZONTAL) self.appointmenttimelabel = wx.StaticText(self, -1, self.GetLabel("appointmenttimelabel")) time = str(self.appointmentdata.time) if len(str(time)) == 7: time = "0" + time[:4] else: time = time[:5] self.appointmenttimeentry = wx.TextCtrl(self, -1, time) appointmenttimesizer.Add(self.appointmenttimelabel, 0, wx.ALIGN_CENTER) appointmenttimesizer.Add(self.appointmenttimeentry, 0, wx.EXPAND) appointmenttimespacer = wx.StaticText(self, -1, "") appointmenttimesizer.Add(appointmenttimespacer, 1, wx.EXPAND) self.opcheckbox = wx.CheckBox(self, -1, self.GetButtonLabel("appointmentisopcheckbox", 0)) self.opcheckbox.Bind(wx.EVT_CHECKBOX, self.SwitchToOps) self.opcheckbox.SetToolTipString(self.GetButtonLabel("appointmentisopcheckbox", 1)) appointmenttimesizer.Add(self.opcheckbox, 0, wx.ALIGN_CENTER) appointmenttimespacer1 = wx.StaticText(self, -1, "") appointmenttimesizer.Add(appointmenttimespacer1, 1, wx.EXPAND) submitbitmap = wx.Bitmap("icons/submit.png") appointmentsubmitbutton = wx.BitmapButton(self, -1, submitbitmap) appointmentsubmitbutton.Bind(wx.EVT_BUTTON, self.Submit) appointmentsubmitbutton.SetToolTipString(self.GetLabel("appointmentsubmittooltip")) appointmenttimesizer.Add(appointmentsubmitbutton) searchsizer.Add(appointmenttimesizer, 0, wx.EXPAND) searchspacer3 = wx.StaticText(self, -1, "", size=(-1,10)) searchsizer.Add(searchspacer3, 0, wx.EXPAND) buttonssizer = wx.BoxSizer(wx.HORIZONTAL) deletebitmap = wx.Bitmap("icons/delete.png") deletebutton = wx.BitmapButton(self, -1, deletebitmap) deletebutton.SetToolTipString(self.GetLabel("appointmentdeletetooltip")) deletebutton.Bind(wx.EVT_BUTTON, self.Delete) buttonssizer.Add(deletebutton, 0, wx.EXPAND) if self.appointmentdata.localsettings.deleteappointments == 0: deletebutton.Disable() buttonsspacer = wx.StaticText(self, -1, "") buttonssizer.Add(buttonsspacer, 1, wx.EXPAND) statuslabel = wx.StaticText(self, -1, self.GetLabel("appointmentstatuslabel")) buttonssizer.Add(statuslabel, 0, wx.ALIGN_CENTER) statuschoice = wx.Choice(self, -1, choices=(self.GetLabel("appointmentnotarrivedlabel"), self.GetLabel("appointmentwaitinglabel"), self.GetLabel("appointmentwithvetlabel"), self.GetLabel("appointmentdonelabel"))) if self.appointmentdata.done == 1: statuschoice.SetSelection(3) elif self.appointmentdata.withvet == 1: statuschoice.SetSelection(2) elif self.appointmentdata.arrived == 1: statuschoice.SetSelection(1) else: statuschoice.SetSelection(0) buttonssizer.Add(statuschoice, 0, wx.EXPAND) searchsizer.Add(buttonssizer, 0, wx.EXPAND) searchspacer = wx.StaticText(self, -1, "", size=(-1,10)) searchsizer.Add(searchspacer, 0, wx.EXPAND) owneranimalsizer = wx.BoxSizer(wx.HORIZONTAL) editownerbutton = wx.Button(self, -1, self.GetButtonLabel("appointmenteditownerbutton", 0)) editownerbutton.SetForegroundColour("blue") editownerbutton.SetToolTipString(self.GetButtonLabel("appointmenteditownerbutton", 1)) editownerbutton.Bind(wx.EVT_BUTTON, self.OpenClientRecord) owneranimalsizer.Add(editownerbutton, 0, wx.EXPAND) if self.appointmentdata.localsettings.editclients == 0: editownerbutton.Disable() owneranimalspacer = wx.StaticText(self, -1, "") owneranimalsizer.Add(owneranimalspacer, 1, wx.EXPAND) editanimalbutton = wx.Button(self, -1, self.GetButtonLabel("appointmenteditanimalbutton", 0)) editanimalbutton.SetForegroundColour("blue") editanimalbutton.SetToolTipString(self.GetButtonLabel("appointmenteditanimalbutton", 1)) editanimalbutton.Bind(wx.EVT_BUTTON, self.OpenAnimalRecord) owneranimalsizer.Add(editanimalbutton, 0, wx.EXPAND) if self.appointmentdata.localsettings.editanimals == 0: editanimalbutton.Disable() searchsizer.Add(owneranimalsizer, 0, wx.EXPAND) searchspacer1 = wx.StaticText(self, -1, "") searchsizer.Add(searchspacer1, 1, wx.EXPAND) #Right hand pane date = self.appointmententry.GetValue() date = miscmethods.GetDateFromWXDate(date) date = miscmethods.FormatDate(date, self.appointmentdata.localsettings) appointmentslistboxlabeltext = self.GetLabel("appointmentappointmentsforlabel") + " " + str(date) self.appointmentslistboxlabel = wx.StaticText(self, -1, appointmentslistboxlabeltext) self.appointmentslistbox = customwidgets.DayPlannerListbox(self, appointmentdata.localsettings, date, 10) self.appointmentslistbox.Bind(wx.EVT_LISTBOX_DCLICK, self.GetTime) appointmentslistboxsizer = wx.BoxSizer(wx.VERTICAL) appointmentslistboxsizer.Add(self.appointmentslistboxlabel, 0, wx.EXPAND) appointmentslistboxsizer.Add(self.appointmentslistbox, 1, wx.EXPAND) self.appointmentlistboxtotal = wx.StaticText(self, -1, self.GetLabel("totallabel") + ": 0") appointmentslistboxsizer.Add(self.appointmentlistboxtotal, 0, wx.ALIGN_RIGHT) mainsizer = wx.BoxSizer(wx.HORIZONTAL) mainsizer.Add(searchsizer, 1, wx.EXPAND) spacer = wx.StaticText(self, -1, "", size=(50,-1)) mainsizer.Add(spacer, 0, wx.EXPAND) mainsizer.Add(appointmentslistboxsizer, 2, wx.EXPAND) topsizer = wx.BoxSizer(wx.VERTICAL) closebuttonsizer = wx.BoxSizer(wx.HORIZONTAL) closebuttonspacer2 = wx.StaticText(self, -1, "") closebuttonsizer.Add(closebuttonspacer2, 1, wx.EXPAND) topsizer.Add(closebuttonsizer, 0, wx.EXPAND) topsizer.Add(mainsizer, 1, wx.EXPAND) self.SetSizer(topsizer) self.appointmentslistboxsizer = appointmentslistboxsizer self.statuschoice = statuschoice if self.appointmentdata.operation == 1: self.opcheckbox.SetValue(True) self.SwitchToOps() self.RefreshAppointment()
def __init__(self, notebook, localsettings): self.localsettings = localsettings self.pagetitle = miscmethods.GetPageTitle( notebook, self.GetLabel("editrotapagetitle")) wx.Panel.__init__(self, notebook) topsizer = wx.BoxSizer(wx.VERTICAL) action = "SELECT Name FROM user WHERE Position LIKE \"%Vet%\" ORDER BY Name" results = db.SendSQL(action, localsettings.dbconnection) vets = [] for a in results: vets.append(a[0]) toolssizer = wx.FlexGridSizer(rows=1) vetlabel = wx.StaticText(self, -1, self.GetLabel("vetlabel") + ": ") toolssizer.Add(vetlabel, 0, wx.ALIGN_CENTER) vetentry = wx.ComboBox(self, -1, "", choices=vets) toolssizer.Add(vetentry, 1, wx.EXPAND) timeonlabel = wx.StaticText(self, -1, " " + self.GetLabel("timeonlabel") + ": ") toolssizer.Add(timeonlabel, 0, wx.ALIGN_CENTER) timeonentry = wx.TextCtrl(self, -1, "") toolssizer.Add(timeonentry, 1, wx.EXPAND) timeofflabel = wx.StaticText( self, -1, " " + self.GetLabel("timeofflabel") + ": ") toolssizer.Add(timeofflabel, 0, wx.ALIGN_CENTER) timeoffentry = wx.TextCtrl(self, -1, "") toolssizer.Add(timeoffentry, 1, wx.EXPAND) operatingcheckbox = wx.CheckBox( self, -1, " " + self.GetLabel("operatinglabel") + ": ") toolssizer.Add(operatingcheckbox, 0, wx.ALIGN_CENTER) #spacer2 = wx.StaticText(self, -1, "") #toolssizer.Add(spacer2, 2, wx.EXPAND) for a in (1, 3, 5): toolssizer.AddGrowableCol(a) submitbitmap = wx.Bitmap("icons/submit.png") submitbutton = wx.BitmapButton(self, -1, submitbitmap) submitbutton.Bind(wx.EVT_BUTTON, self.Submit) toolssizer.Add(submitbutton, 0, wx.ALIGN_CENTER) topsizer.Add(toolssizer, 0, wx.EXPAND) spacer = wx.StaticText(self, -1, "") topsizer.Add(spacer, 0, wx.EXPAND) listssizer = wx.BoxSizer(wx.HORIZONTAL) datesizer = wx.BoxSizer(wx.VERTICAL) datelabel = wx.StaticText(self, -1, self.GetLabel("datelabel") + ":") datesizer.Add(datelabel, 0, wx.ALIGN_LEFT) datepickersizer = wx.BoxSizer(wx.HORIZONTAL) #self.dateentry = wx.DatePickerCtrl(self, -1, size=(200,-1)) self.dateentry = customwidgets.DateCtrl(self, self.localsettings) #self.dateentry.Bind(wx.EVT_DATE_CHANGED, self.RefreshRota) datepickersizer.Add(self.dateentry, 1, wx.EXPAND) refreshbitmap = wx.Bitmap("icons/refresh.png") refreshbutton = wx.BitmapButton(self, -1, refreshbitmap) refreshbutton.Bind(wx.EVT_BUTTON, self.RefreshRota) datepickersizer.Add(refreshbutton, 0, wx.wx.EXPAND) datesizer.Add(datepickersizer, 0, wx.EXPAND) listssizer.Add(datesizer, 1, wx.EXPAND) spacer1 = wx.StaticText(self, -1, "", size=(20, -1)) listssizer.Add(spacer1, 0, wx.EXPAND) summarysizer = wx.BoxSizer(wx.VERTICAL) staffsummarylabel = wx.StaticText( self, -1, self.GetLabel("staffsummarylabel") + ":") summarysizer.Add(staffsummarylabel, 0, wx.ALIGN_LEFT) staffsummarylistbox = customwidgets.StaffSummaryListbox( self, self.localsettings) staffsummarylistbox.Bind(wx.EVT_LISTBOX, self.SlotSelected) summarysizer.Add(staffsummarylistbox, 1, wx.EXPAND) summarybuttonssizer = wx.BoxSizer(wx.HORIZONTAL) editbitmap = wx.Bitmap("icons/edit.png") editbutton = wx.BitmapButton(self, -1, editbitmap) editbutton.Bind(wx.EVT_BUTTON, self.Edit) summarybuttonssizer.Add(editbutton, 0, wx.ALIGN_LEFT) deletebitmap = wx.Bitmap("icons/delete.png") deletebutton = wx.BitmapButton(self, -1, deletebitmap) deletebutton.Bind(wx.EVT_BUTTON, self.Delete) summarybuttonssizer.Add(deletebutton, 0, wx.ALIGN_LEFT) summarysizer.Add(summarybuttonssizer, 0, wx.ALIGN_LEFT) listssizer.Add(summarysizer, 2, wx.EXPAND) spacer3 = wx.StaticText(self, -1, "", size=(20, -1)) listssizer.Add(spacer3, 0, wx.EXPAND) dayplansizer = wx.BoxSizer(wx.VERTICAL) dayplanlabel = wx.StaticText(self, -1, self.GetLabel("dayplanlabel") + ":") dayplansizer.Add(dayplanlabel, 0, wx.ALIGN_LEFT) dayplan = wx.html.HtmlWindow(self) dayplansizer.Add(dayplan, 1, wx.EXPAND) listssizer.Add(dayplansizer, 3, wx.EXPAND) topsizer.Add(listssizer, 1, wx.EXPAND) self.SetSizer(topsizer) self.vetentry = vetentry self.timeonentry = timeonentry self.timeoffentry = timeoffentry self.staffsummarylistbox = staffsummarylistbox self.dayplan = dayplan self.operatingcheckbox = operatingcheckbox self.staffsummarylistbox.RefreshList() self.GenerateDayPlan()
def __init__(self, notebook, localsettings, linktype, linkid, title, ID=False, parent=False): self.localsettings = localsettings self.parent = parent self.diarydata = DiarySettings(self.localsettings, ID) self.diarydata.linktype = linktype self.diarydata.linkid = linkid self.pagetitle = self.GetLabel("diarynotelabel") + " - " + title self.pagetitle = miscmethods.GetPageTitle(notebook, self.pagetitle) self.pageimage = "icons/diary.png" users = [] positions = [] action = "SELECT Name, Position FROM user" results = db.SendSQL(action, self.localsettings.dbconnection) for a in results: users.append(a[0]) if positions.__contains__(a[1]) == False: positions.append(a[1]) users.sort() positions.sort() wx.Panel.__init__(self, notebook) topsizer = wx.BoxSizer(wx.VERTICAL) horizontalsizer = wx.BoxSizer(wx.HORIZONTAL) horizontalsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) gridsizer = wx.FlexGridSizer(cols=2) gridsizer.AddGrowableCol(1) gridsizer.AddGrowableRow(4) gridsizer.AddGrowableRow(6) datelabel = wx.StaticText(self, -1, self.GetLabel("datelabel") + ":") gridsizer.Add(datelabel, 0, wx.ALIGN_RIGHT) dateentry = customwidgets.DateCtrl(self, self.localsettings) gridsizer.Add(dateentry, 0, wx.ALIGN_LEFT) namelabel = wx.StaticText(self, -1, self.GetLabel("usernamelabel") + ":") gridsizer.Add(namelabel, 0, wx.ALIGN_RIGHT) nameentry = wx.ComboBox(self, -1, self.diarydata.name, choices=users, size=(300, -1)) gridsizer.Add(nameentry, 0, wx.ALIGN_LEFT) positionlabel = wx.StaticText(self, -1, self.GetLabel("positionlabel") + ":") gridsizer.Add(positionlabel, 0, wx.ALIGN_RIGHT) positionentry = wx.ComboBox(self, -1, self.diarydata.position, choices=positions, size=(300, -1)) gridsizer.Add(positionentry, 0, wx.ALIGN_LEFT) subjectlabel = wx.StaticText(self, -1, self.GetLabel("subjectlabel") + ":") gridsizer.Add(subjectlabel, 0, wx.ALIGN_RIGHT) subjectentry = wx.TextCtrl(self, -1, self.diarydata.subject) gridsizer.Add(subjectentry, 1, wx.EXPAND) notelabel = wx.StaticText(self, -1, self.GetLabel("notelabel") + ":") gridsizer.Add(notelabel, 0, wx.ALIGN_RIGHT) noteentry = wx.TextCtrl(self, -1, self.diarydata.note, style=wx.TE_MULTILINE) gridsizer.Add(noteentry, 1, wx.EXPAND) removedlabel = wx.StaticText(self, -1, self.GetLabel("removedlabel") + ":") gridsizer.Add(removedlabel, 0, wx.ALIGN_RIGHT) removedentry = customwidgets.DateCtrl(self, self.localsettings) if str(self.diarydata.removed) == "": removedentry.Clear() else: removeddate = miscmethods.GetWXDateFromSQLDate( self.diarydata.removed) removedentry.SetValue(removeddate) gridsizer.Add(removedentry, 1, wx.EXPAND) changeloglabel = wx.StaticText(self, -1, self.GetLabel("changelog") + ":") gridsizer.Add(changeloglabel, 0, wx.ALIGN_RIGHT) if self.diarydata.ID == False: changelog = "" else: changelog = miscmethods.FormatChangeLog( self.diarydata.changelog, self.GetLabel("diarynotelabel"), self.localsettings.dbconnection) changelogentry = wx.TextCtrl(self, -1, changelog, style=wx.TE_MULTILINE) changelogentry.Disable() gridsizer.Add(changelogentry, 1, wx.EXPAND) gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) submitbitmap = wx.Bitmap("icons/submit.png") submitbutton = wx.BitmapButton(self, -1, submitbitmap) submitbutton.SetToolTipString(self.GetLabel("submitlabel")) submitbutton.Bind(wx.EVT_BUTTON, self.Submit) gridsizer.Add(submitbutton, 0, wx.ALIGN_CENTER_HORIZONTAL) horizontalsizer.Add(gridsizer, 4, wx.EXPAND) horizontalsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) topsizer.Add(horizontalsizer, 1, wx.EXPAND) self.SetSizer(topsizer) self.dateentry = dateentry self.nameentry = nameentry self.positionentry = positionentry self.subjectentry = subjectentry self.noteentry = noteentry self.removedentry = removedentry self.notebook = notebook
def __init__(self, parent, localsettings): self.localsettings = localsettings wx.Panel.__init__(self, parent) horizontalsizer = wx.BoxSizer(wx.HORIZONTAL) topsizer = wx.BoxSizer(wx.VERTICAL) gridsizer = wx.FlexGridSizer(cols=2) gridsizer.AddGrowableCol(1) gridsizer.AddGrowableRow(4) gridsizer.AddGrowableRow(7) fromdatelabel = wx.StaticText(self, -1, self.GetLabel("fromlabel") + ": ") gridsizer.Add(fromdatelabel, 0, wx.ALIGN_RIGHT) fromdateentry = customwidgets.DateCtrl(self, self.localsettings) gridsizer.Add(fromdateentry, 1, wx.EXPAND) todatelabel = wx.StaticText(self, -1, self.GetLabel("tolabel") + ": ") gridsizer.Add(todatelabel, 0, wx.ALIGN_RIGHT) todateentry = customwidgets.DateCtrl(self, self.localsettings) gridsizer.Add(todateentry, 1, wx.EXPAND) specieslabel = wx.StaticText( self, -1, self.GetLabel("animalspecieslabel") + ": ") gridsizer.Add(specieslabel, 0, wx.ALIGN_RIGHT) action = "SELECT * FROM species ORDER BY SpeciesName" specieslist = db.SendSQL(action, self.localsettings.dbconnection) specieschoicelist = [] for a in specieslist: specieschoicelist.append(a[1]) specieschoicesizer = wx.BoxSizer(wx.HORIZONTAL) specieschoice = wx.Choice(self, -1, choices=specieschoicelist) specieschoice.Disable() specieschoicesizer.Add(specieschoice, 1, wx.EXPAND) speciestickbox = wx.CheckBox(self, -1, self.GetLabel("anyspecies")) speciestickbox.Bind(wx.EVT_CHECKBOX, self.AnySpecies) speciestickbox.SetValue(True) specieschoicesizer.Add(speciestickbox, 0, wx.EXPAND) gridsizer.Add(specieschoicesizer, 1, wx.EXPAND) gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) speciesmovementsizer = wx.BoxSizer(wx.HORIZONTAL) speciesmovementsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) downarrowbitmap = wx.Bitmap("icons/downarrow.png") addspeciesbutton = wx.BitmapButton(self, -1, downarrowbitmap) addspeciesbutton.Disable() addspeciesbutton.Bind(wx.EVT_BUTTON, self.AddSpecies) speciesmovementsizer.Add(addspeciesbutton, 0, wx.EXPAND) speciesmovementsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) uparrowbitmap = wx.Bitmap("icons/uparrow.png") removespeciesbutton = wx.BitmapButton(self, -1, uparrowbitmap) removespeciesbutton.Bind(wx.EVT_BUTTON, self.RemoveSpecies) removespeciesbutton.Disable() speciesmovementsizer.Add(removespeciesbutton, 0, wx.EXPAND) speciesmovementsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) gridsizer.Add(speciesmovementsizer, 0, wx.EXPAND) gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) specieslistbox = wx.ListBox(self, -1) specieslistbox.Bind(wx.EVT_LISTBOX, self.SpeciesSelected) gridsizer.Add(specieslistbox, 1, wx.EXPAND) if len(specieslist) == 0: addspeciesbutton.Disable() removespeciesbutton.Disable() #gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) #gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) vaccinelabel = wx.StaticText( self, -1, self.GetLabel("animalvaccinelabel") + ": ") gridsizer.Add(vaccinelabel, 0, wx.ALIGN_RIGHT) action = "SELECT * FROM medication WHERE Type = 1 ORDER BY Name" vaccinationslist = db.SendSQL(action, self.localsettings.dbconnection) vaccinationschoicelist = [] for a in vaccinationslist: vaccinationschoicelist.append(a[1]) vaccinechoicesizer = wx.BoxSizer(wx.HORIZONTAL) vaccinechoice = wx.Choice(self, -1, choices=vaccinationschoicelist) vaccinechoice.Disable() vaccinechoicesizer.Add(vaccinechoice, 1, wx.EXPAND) vaccinetickbox = wx.CheckBox(self, -1, self.GetLabel("anyvaccine")) vaccinetickbox.Bind(wx.EVT_CHECKBOX, self.AnyVaccine) vaccinetickbox.SetValue(True) vaccinechoicesizer.Add(vaccinetickbox, 0, wx.EXPAND) gridsizer.Add(vaccinechoicesizer, 1, wx.EXPAND) gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) vaccinemovementsizer = wx.BoxSizer(wx.HORIZONTAL) vaccinemovementsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) downarrowbitmap = wx.Bitmap("icons/downarrow.png") addvaccinebutton = wx.BitmapButton(self, -1, downarrowbitmap) addvaccinebutton.Disable() addvaccinebutton.Bind(wx.EVT_BUTTON, self.AddVaccine) vaccinemovementsizer.Add(addvaccinebutton, 0, wx.EXPAND) vaccinemovementsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) uparrowbitmap = wx.Bitmap("icons/uparrow.png") removevaccinebutton = wx.BitmapButton(self, -1, uparrowbitmap) removevaccinebutton.Bind(wx.EVT_BUTTON, self.RemoveVaccine) removevaccinebutton.Disable() vaccinemovementsizer.Add(removevaccinebutton, 0, wx.EXPAND) vaccinemovementsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) gridsizer.Add(vaccinemovementsizer, 0, wx.EXPAND) gridsizer.Add(wx.StaticText(self, -1, ""), 0, wx.EXPAND) vaccineslistbox = wx.ListBox(self, -1) vaccineslistbox.Bind(wx.EVT_LISTBOX, self.VaccineSelected) gridsizer.Add(vaccineslistbox, 1, wx.EXPAND) if len(vaccinationslist) == 0: addvaccinebutton.Disable() removevaccinebutton.Disable() topsizer.Add(gridsizer, 1, wx.EXPAND) #topsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) gobutton = wx.Button(self, -1, self.GetLabel("searchlabel")) gobutton.Bind(wx.EVT_BUTTON, self.Go) topsizer.Add(gobutton, 0, wx.ALIGN_CENTER_HORIZONTAL) #topsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) #gauge = wx.Gauge(self) #topsizer.Add(gauge, 0, wx.EXPAND) #topsizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) horizontalsizer.Add(topsizer, 1, wx.EXPAND) horizontalsizer.Add(wx.StaticText(self, -1, "", size=(50, -1)), 0, wx.EXPAND) rightsizer = wx.BoxSizer(wx.VERTICAL) buttonssizer = wx.BoxSizer(wx.HORIZONTAL) editanimalbutton = wx.Button( self, -1, self.GetButtonLabel("appointmenteditanimalbutton", 0)) editanimalbutton.SetToolTipString( self.GetButtonLabel("appointmenteditanimalbutton", 1)) editanimalbutton.Bind(wx.EVT_BUTTON, self.EditAnimal) editanimalbutton.SetForegroundColour("blue") editanimalbutton.Disable() buttonssizer.Add(editanimalbutton, 0, wx.EXPAND) editownerbutton = wx.Button( self, -1, self.GetButtonLabel("appointmenteditownerbutton", 0)) editownerbutton.SetToolTipString( self.GetButtonLabel("appointmenteditownerbutton", 1)) editownerbutton.Bind(wx.EVT_BUTTON, self.EditOwner) editownerbutton.SetForegroundColour("blue") editownerbutton.Disable() buttonssizer.Add(editownerbutton, 0, wx.EXPAND) createappointmentbutton = wx.Button( self, -1, self.GetButtonLabel("createvaccinationappointmentbutton", 0)) createappointmentbutton.SetToolTipString( self.GetButtonLabel("createvaccinationappointmentbutton", 1)) createappointmentbutton.Bind(wx.EVT_BUTTON, self.CreateAppointment) createappointmentbutton.SetForegroundColour("blue") createappointmentbutton.Disable() buttonssizer.Add(createappointmentbutton, 0, wx.EXPAND) buttonssizer.Add(wx.StaticText(self, -1, ""), 1, wx.EXPAND) generatecvsbutton = wx.Button( self, -1, self.GetButtonLabel("generatevaccinationcsvbutton", 0)) generatecvsbutton.SetToolTipString( self.GetButtonLabel("generatevaccinationcsvbutton", 1)) generatecvsbutton.Bind(wx.EVT_BUTTON, self.GenerateCVSFile) generatecvsbutton.SetForegroundColour("red") generatecvsbutton.Disable() buttonssizer.Add(generatecvsbutton, 0, wx.EXPAND) rightsizer.Add(buttonssizer, 0, wx.EXPAND) listbox = VaccineMailShotListbox(self, localsettings) listbox.Bind(wx.EVT_LISTBOX, self.VaccinationSelected) rightsizer.Add(listbox, 1, wx.EXPAND) totallabel = wx.StaticText(self, -1, self.GetLabel("totallabel") + ": 0 ") rightsizer.Add(totallabel, 0, wx.ALIGN_RIGHT) horizontalsizer.Add(rightsizer, 2, wx.EXPAND) self.SetSizer(horizontalsizer) self.specieschoice = specieschoice self.specieslistbox = specieslistbox self.specieschoicelist = specieschoicelist self.removespeciesbutton = removespeciesbutton self.addspeciesbutton = addspeciesbutton self.vaccinechoice = vaccinechoice self.vaccineslistbox = vaccineslistbox self.vaccinationschoicelist = vaccinationschoicelist self.removevaccinebutton = removevaccinebutton self.addvaccinebutton = addvaccinebutton self.fromdateentry = fromdateentry self.todateentry = todateentry self.vaccinetickbox = vaccinetickbox self.speciestickbox = speciestickbox self.listbox = listbox self.totallabel = totallabel self.rightsizer = rightsizer self.editanimalbutton = editanimalbutton self.editownerbutton = editownerbutton self.createappointmentbutton = createappointmentbutton self.generatecvsbutton = generatecvsbutton self.includedspecieslist = [] self.includedvaccinationslist = []
def __init__(self, notebook, localsettings): busy = wx.BusyCursor() self.notebook = notebook self.localsettings = localsettings self.pagetitle = self.GetLabel("editdiarypagetitle") self.pagetitle = miscmethods.GetPageTitle(notebook, self.pagetitle) self.pageimage = "icons/diary.png" users = [] positions = [] action = "SELECT Name, Position FROM user" results = db.SendSQL(action, self.localsettings.dbconnection) for a in results: users.append(a[0]) if positions.__contains__(a[1]) == False: positions.append(a[1]) users.sort() positions.sort() wx.Panel.__init__(self, notebook) topsizer = wx.BoxSizer(wx.VERTICAL) topsizer.Add(wx.StaticText(self, -1, "", size=(-1, 10)), 0, wx.EXPAND) filtersizer1 = wx.BoxSizer(wx.HORIZONTAL) fromcheckbox = wx.CheckBox(self, -1, "") fromcheckbox.Bind(wx.EVT_CHECKBOX, self.FromDateChecked) filtersizer1.Add(fromcheckbox, 0, wx.ALIGN_BOTTOM) fromsizer = wx.BoxSizer(wx.VERTICAL) fromlabel = wx.StaticText(self, -1, self.GetLabel("fromlabel") + ":") font = fromlabel.GetFont() font.SetPointSize(font.GetPointSize() - 2) fromlabel.SetFont(font) fromsizer.Add(fromlabel, 0, wx.ALIGN_LEFT) fromdateentry = customwidgets.DateCtrl(self, self.localsettings) fromdateentry.SetSize((-1, -1)) fromdateentry.Disable() fromsizer.Add(fromdateentry, 0, wx.EXPAND) filtersizer1.Add(fromsizer, 1, wx.EXPAND) filtersizer1.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) tosizer = wx.BoxSizer(wx.VERTICAL) todatelabel = wx.StaticText(self, -1, self.GetLabel("tolabel") + ":") todatelabel.SetFont(font) tosizer.Add(todatelabel, 0, wx.ALIGN_LEFT) todateentry = customwidgets.DateCtrl(self, self.localsettings) todateentry.SetSize((-1, -1)) tosizer.Add(todateentry, 0, wx.EXPAND) filtersizer1.Add(tosizer, 1, wx.EXPAND) filtersizer1.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) usersizer = wx.BoxSizer(wx.VERTICAL) userlabel = wx.StaticText(self, -1, self.GetLabel("usernamelabel") + ":") userlabel.SetFont(font) usersizer.Add(userlabel, 0, wx.ALIGN_LEFT) userentry = wx.ComboBox(self, -1, self.localsettings.username, choices=users) usersizer.Add(userentry, 0, wx.EXPAND) filtersizer1.Add(usersizer, 2, wx.EXPAND) filtersizer1.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) positionsizer = wx.BoxSizer(wx.VERTICAL) positionlabel = wx.StaticText(self, -1, self.GetLabel("positionlabel") + ":") positionlabel.SetFont(font) positionsizer.Add(positionlabel, 0, wx.ALIGN_LEFT) positionentry = wx.ComboBox(self, -1, self.localsettings.userposition, choices=positions) positionsizer.Add(positionentry, 0, wx.EXPAND) filtersizer1.Add(positionsizer, 2, wx.EXPAND) topsizer.Add(filtersizer1, 0, wx.EXPAND) topsizer.Add(wx.StaticText(self, -1, "", size=(-1, 10)), 0, wx.EXPAND) filtersizer2 = wx.BoxSizer(wx.HORIZONTAL) clearbitmap = wx.Bitmap("icons/reset.png") clearbutton = wx.BitmapButton(self, -1, clearbitmap) clearbutton.SetToolTipString(self.GetLabel("cleardiarytooltip")) clearbutton.Bind(wx.EVT_BUTTON, self.ClearEntries) filtersizer2.Add(clearbutton, 0, wx.ALIGN_BOTTOM) filtersizer2.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) subjectsizer = wx.BoxSizer(wx.VERTICAL) subjectlabel = wx.StaticText( self, -1, self.GetLabel("subjectcontainslabel") + ":") subjectlabel.SetFont(font) subjectsizer.Add(subjectlabel, 0, wx.ALIGN_LEFT) subjectentry = wx.TextCtrl(self, -1, "") subjectsizer.Add(subjectentry, 0, wx.EXPAND) filtersizer2.Add(subjectsizer, 1, wx.EXPAND) filtersizer2.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) notesizer = wx.BoxSizer(wx.VERTICAL) notelabel = wx.StaticText(self, -1, self.GetLabel("notecontainslabel") + ":") notelabel.SetFont(font) notesizer.Add(notelabel, 0, wx.ALIGN_LEFT) noteentry = wx.TextCtrl(self, -1, "") notesizer.Add(noteentry, 0, wx.EXPAND) filtersizer2.Add(notesizer, 1, wx.EXPAND) filtersizer2.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) removedcheckbox = wx.CheckBox(self, -1, self.GetLabel("showremovedlabel")) removedcheckbox.SetFont(font) filtersizer2.Add(removedcheckbox, 0, wx.ALIGN_BOTTOM) filtersizer2.Add(wx.StaticText(self, -1, "", size=(10, -1)), 0, wx.EXPAND) refreshbitmap = wx.Bitmap("icons/refresh.png") refreshbutton = wx.BitmapButton(self, -1, refreshbitmap) refreshbutton.SetToolTipString(self.GetLabel("refreshdiarytooltip")) filtersizer2.Add(refreshbutton, 0, wx.ALIGN_BOTTOM) topsizer.Add(filtersizer2, 0, wx.EXPAND) topsizer.Add(wx.StaticText(self, -1, "", size=(-1, 10)), 0, wx.EXPAND) diarylistbox = DiaryNotesListbox(self) diarylistbox.listctrl.Bind(wx.EVT_RIGHT_DOWN, self.DiaryPopup) if self.localsettings.editdiary == 1: diarylistbox.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.EditNote) topsizer.Add(diarylistbox, 1, wx.EXPAND) self.SetSizer(topsizer) self.fromdateentry = fromdateentry self.todateentry = todateentry self.userentry = userentry self.positionentry = positionentry self.subjectentry = subjectentry self.noteentry = noteentry self.removedcheckbox = removedcheckbox self.fromcheckbox = fromcheckbox self.diarylistbox = diarylistbox refreshbutton.Bind(wx.EVT_BUTTON, self.diarylistbox.RefreshList) self.diarylistbox.RefreshList() del busy