Package Gnumed :: Package timelinelib :: Package canvas :: Module appearance
[frames] | no frames]

Source Code for Module Gnumed.timelinelib.canvas.appearance

 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  import wx 
20   
21  from timelinelib.general.observer import Observable 
22  from timelinelib.wxgui.components.font import Font 
23   
24   
25 -class Appearance(Observable):
26
27 - def __init__(self):
28 Observable.__init__(self) 29 self._build_property("legend_visible", True) 30 self._build_property("balloons_visible", True) 31 self._build_property("hide_events_done", False) 32 self._build_property("minor_strip_divider_line_colour", (200, 200, 200)) 33 self._build_property("major_strip_divider_line_colour", (200, 200, 200)) 34 self._build_property("now_line_colour", (200, 0, 0)) 35 self._build_property("weekend_colour", (255, 255, 255)) 36 self._build_property("bg_colour", (255, 255, 255)) 37 self._build_property("colorize_weekends", False) 38 self._build_property("draw_period_events_to_right", False) 39 self._build_property("text_below_icon", False) 40 self._build_property("minor_strip_font", Font(8).serialize()) 41 self._build_property("major_strip_font", Font(12, weight=wx.FONTWEIGHT_BOLD).serialize()) 42 self._build_property("legend_font", Font(8).serialize()) 43 self._build_property("balloon_font", Font(8).serialize()) 44 self._build_property("center_event_texts", False) 45 self._build_property("never_show_period_events_as_point_events", False) 46 self._build_property("week_start", "monday") 47 self._build_property("use_inertial_scrolling", False) 48 self._build_property("fuzzy_icon", "fuzzy.png") 49 self._build_property("locked_icon", "locked.png") 50 self._build_property("hyperlink_icon", "hyperlink.png") 51 self._build_property("vertical_space_between_events", 5) 52 self._build_property("skip_s_in_decade_text", False) 53 self._build_property("display_checkmark_on_events_done", False) 54 self._build_property("never_use_time", False) 55 self._build_property("legend_pos", 0)
56
57 - def _build_property(self, name, initial_value):
58 59 def getter(): 60 return getattr(self, "_%s" % name)
61 62 def setter(new_value): 63 old_value = getter() 64 if new_value != old_value: 65 setattr(self, "_%s" % name, new_value) 66 self._notify()
67 68 setattr(self, "get_%s" % name, getter) 69 setattr(self, "set_%s" % name, setter) 70 setattr(self, "_%s" % name, initial_value) 71