1 from traylib import *
2 from traylib.config import Config
3
4
6 """
7 Icon configuration object.
8 """
9
10 - def __init__(self, size, edge, effects, pos_func, hidden):
11 """
12 Creates a new C{IconConfig}.
13
14 @param size: The size of the icons.
15 @param edge: The edge of the screen where the icon is. Must be one of
16 0, TOP, BOTTOM, LEFT, RIGHT.
17 @param pos_func: The function to call for positioning an icon's menu.
18 """
19 assert size > 0
20 assert edge in (0, TOP, BOTTOM, LEFT, RIGHT)
21
22 Config.__init__(self)
23 self.__arrow = None
24
25 self.add_attribute('size', size, 'update_option_size')
26 self.add_attribute('edge', edge, 'update_option_edge', 'update_arrow')
27 self.add_attribute('effects', effects, 'update_option_effects')
28 self.add_attribute('hidden', hidden, 'update_option_hidden')
29 self.add_attribute('pos_func', pos_func)
30
41
42 arrow = property(lambda self : self.__arrow)
43 """
44 The arrow pixmap.
45 """
46
47 edge = property(lambda self : self.get_attribute('edge'),
48 lambda self, edge : self.set_attribute('edge', edge))
49 """
50 The edge of the screen where the icons are put. One of C{0}, C{TOP}, C{BOTTOM},
51 C{LEFT}, C{RIGHT}.
52 """
53
54 effects = property(lambda self : self.get_attribute('effects'),
55 lambda self, effects : self.set_attribute('effects', effects))
56 """
57 C{True} if effects such as smooth zooming should be shown.
58 """
59
60 pos_func = property(lambda self : self.get_attribute('pos_func'),
61 lambda self, pos_func : self.set_attribute('pos_func', pos_func))
62 """
63 The function for positioning the menu (may be None).
64 """
65
66 size = property(lambda self : self.get_attribute('size'),
67 lambda self, size : self.set_attribute('size', size))
68 """
69 The size of the icons.
70 """
71
72 vertical = property(lambda self : self.edge in (LEFT, RIGHT))
73 """
74 C{True} if the icons are on a vertical panel, that is: the edge is either LEFT or RIGHT.
75 """
76
77 hidden = property(lambda self : self.get_attribute('hidden'),
78 lambda self, hidden : self.set_attribute('hidden', hidden))
79 """
80 C{True} if all icons except the main icon should be hidden.
81 """
82