def set_new_stvar_value(self,index):
     self.log("Validating and settings for index {}".format(index))
     section,setting,stvar, set_type, widget_list,rown = self.setting_packs[index]
     
     if set_type == "dirloc":
         dirloc = tk.filedialog.askdirectory() 
         dirloc = os.path.relpath(dirloc)
         stvar.set(dirloc)
     elif set_type == "fileloc":
         fileloc = tk.filedialog.askopenfilename()   
         fileloc = os.path.relpath(fileloc)
         stvar.set(fileloc)            
     elif set_type == "date":
         last_dt = stvar.get()
         yr,mo = int(last_dt[0:4]),int(last_dt[4:6])
         date_calendar = cal_dialog.CalendarDialog(self,year=yr, 
                                                   month=mo)
         new_date = date_calendar.result.date()
         stvar.set(str(new_date).replace("-",""))
     elif set_type == "colors":
         string = widget_list[0]["background"]
         for index, color_button in enumerate(widget_list[1:]):
             string = string + "-" + color_button["background"]
         stvar.set(string)        
     return True        
Exemple #2
0
 def _ux_open_end_cal(self):
     self.log("Getting new end date")
     end_calendar = cal_dialog.CalendarDialog(self,
                                              year=self.end_datetime.year,
                                              month=self.end_datetime.month)
     try:
         self.end_datetime = end_calendar.result.date()
     except AttributeError:
         self.log("end_date probably set to None")
         return
     else:
         self.end_date_button_var.set(str(self.end_datetime))
Exemple #3
0
 def _ux_open_start_cal(self):
     self.log("Getting new start date")
     start_calendar = cal_dialog.CalendarDialog(
         self,
         year=self.start_datetime.year,
         month=self.start_datetime.month)
     try:
         self.start_datetime = start_calendar.result.date()
     except AttributeError:
         self.log("Start date probably set to None.")
     else:
         self.start_date_button_var.set(str(self.start_datetime))
 def event_date_change(self,arg):
     eventindex,infotype = arg
     event_tuple = self.events_list[eventindex]
     event_info = event_tuple[infotype]
     year,month =  int(event_info[0:4]), int(event_info[4:6])
     date_calendar = cal_dialog.CalendarDialog(self,year=year, month=month)
     self.log("Getting new start date")
     try:
         result_date = date_calendar.result.date()
     except AttributeError:
         self.bug("Date returned from calendar not functional: {}".format(result_date))
     self.events_list[eventindex][infotype] = result_date.strftime("%Y%m%d")
     self.populate_extra_window_for_events()    
 def _ux_open_order_cal(self, which_cal):
     self.log("Getting new cal date")
     if which_cal == "start":
         the_datetime = self.order_start_datetime
         the_date_var = self.order_start_date_button_var
     else:
         the_datetime = self.order_end_datetime
         the_date_var = self.order_end_date_button_var
     get_calendar = cal_dialog.CalendarDialog(self,
                                              year=the_datetime.year,
                                              month=the_datetime.month)
     try:
         the_datetime = get_calendar.result.date()
     except AttributeError:
         self.log("Start date probably set to None.")
     else:
         if which_cal == "start":
             self.order_start_datetime = the_datetime
         else:
             self.order_end_datetime = the_datetime
         the_date_var.set(str(the_datetime))