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.canvas.data import TimePeriod 20 from timelinelib.canvas.data.milestone import Milestone 21 from timelinelib.wxgui.framework import Controller 22 from timelinelib.wxgui.utils import display_error_message 23 24 27 28308632 self._db = db 33 self._time_type = db.time_type 34 if milestone is None: 35 now = self._time_type.now() 36 self._milestone = Milestone().update(now, now, "") 37 self._milestone.set_description("") 38 else: 39 self._milestone = milestone 40 self._populate_view()41 44 5153 self.view.SetTime(self._milestone.get_time()) 54 self.view.SetColor(self._milestone.get_default_color()) 55 self.view.SetDescription(self._milestone.get_description()) 56 label = self._milestone.get_text() 57 self.view.SetLable(label) 58 self.view.SetCategory(self._milestone.get_category())5961 self._set_milestone_description() 62 self._milestone.set_text(self.view.GetLabel()) 63 self._milestone.set_default_color(self.view.GetColour()[:3]) 64 self._set_milestone_time_period() 65 self._milestone.set_category(self.view.GetCategory()) 66 self._save_milestone_to_db()6769 if self.view.GetDescription() == "": 70 self._milestone.set_description(None) 71 else: 72 self._milestone.set_description(self.view.GetDescription())7375 try: 76 t = self.view.GetTime() 77 if t is None: 78 raise DateTimeError() 79 self._milestone.set_time_period(TimePeriod(t, t)) 80 except: 81 display_error_message(_("You can't save a milestone with an invalid date/time")) 82 raise(DateTimeError())8385 self._db.save_event(self._milestone)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Jul 23 01:55:31 2020 | http://epydoc.sourceforge.net |