Пример #1
0
 def get_value(self):
     if self.time_picker.IsShown():
         hour, minute, second = self.time_picker.get_value()
     else:
         hour, minute, second = (0, 0, 0)
     year, month, day = self.date_picker.get_value()
     return BosparanianDateTime(year, month, day, hour, minute,
                                second).to_time()
Пример #2
0
 def parse_time(self, time_string):
     match = re.search(r"^(-?\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)$",
                       time_string)
     if match:
         year = int(match.group(1))
         month = int(match.group(2))
         day = int(match.group(3))
         hour = int(match.group(4))
         minute = int(match.group(5))
         second = int(match.group(6))
         try:
             return BosparanianDateTime(year, month, day, hour, minute,
                                        second).to_time()
         except ValueError:
             raise ValueError("Invalid time, time string = '%s'" %
                              time_string)
     else:
         raise ValueError("Time not on correct format = '%s'" % time_string)
Пример #3
0
 def _ensure_within_allowed_period(self, date):
     year, month, day = date
     time = BosparanianDateTime(year, month, day, 0, 0, 0).to_time()
     if (time >= BosparanianTimeType().get_max_time()
             or time < BosparanianTimeType().get_min_time()):
         raise ValueError()
Пример #4
0
 def now(self):
     if self.saved_now is None:
         return BosparanianDateTime(1000, 1, 1, 12, 0, 0).to_time()
     return self.saved_now