Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Rickard Lindberg, Roger Lindberg 2 # 3 # This file is part of Timeline. 4 # 5 # Timeline is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # Timeline is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with Timeline. If not, see <http://www.gnu.org/licenses/>. 17 18 19 from timelinelib.calendar.pharaonic.pharaonic import is_valid_time 20 from timelinelib.wxgui.components import TextPatternControl 21 2224 25 HOUR_GROUP = 0 26 MINUTE_GROUP = 1 2762 63 70 7129 TextPatternControl.__init__(self, parent, fit_text="00:00") 30 self.SetSeparators([":"]) 31 self.SetValidator(self._is_time_valid) 32 self.SetUpHandler(self.HOUR_GROUP, self._increment_hour) 33 self.SetUpHandler(self.MINUTE_GROUP, self._increment_minute) 34 self.SetDownHandler(self.HOUR_GROUP, self._decrement_hour) 35 self.SetDownHandler(self.MINUTE_GROUP, self._decrement_minute)36 39 42 50 53 56 5973 [hour_str, minute_str] = parts 74 hour = int(hour_str) 75 minute = int(minute_str) 76 if not is_valid_time(hour, minute, 0): 77 raise ValueError() 78 return (hour, minute, 0)79 8082 hour, minute, second = time 83 new_hour = hour + 1 84 if new_hour > 23: 85 new_hour = 0 86 return (new_hour, minute, second)87 8890 hour, minute, second = time 91 new_hour = hour 92 new_minute = minute + 1 93 if new_minute > 59: 94 new_minute = 0 95 new_hour = hour + 1 96 if new_hour > 23: 97 new_hour = 0 98 return (new_hour, new_minute, second)99 100102 hour, minute, second = time 103 new_hour = hour - 1 104 if new_hour < 0: 105 new_hour = 23 106 return (new_hour, minute, second)107 108110 hour, minute, second = time 111 new_hour = hour 112 new_minute = minute - 1 113 if new_minute < 0: 114 new_minute = 59 115 new_hour = hour - 1 116 if new_hour < 0: 117 new_hour = 23 118 return (new_hour, new_minute, second)119
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Mar 25 02:55:27 2020 | http://epydoc.sourceforge.net |