1 from rox import applet
2 from rox.applet import Applet
3
4 from traylib import *
5 from traylib.tray_container import TrayContainer
6
7
9 """
10 An applet showing a L{Tray}.
11 """
12
13 - def __init__(self,
14 xid,
15 min_size,
16 max_size,
17 tray_class,
18 icon_config,
19 tray_config,
20 *tray_args):
21 """
22 Creates a new TrayApplet.
23
24 @param xid: The XID of a gtk.Socket widget.
25 """
26 Applet.__init__(self, xid)
27 orientation = self.get_panel_orientation()
28 if orientation == 'Top':
29 edge = TOP
30 elif orientation == 'Bottom':
31 edge = BOTTOM
32 elif orientation == 'Left':
33 edge = LEFT
34 elif orientation == 'Right':
35 edge = RIGHT
36 icon_config.edge = edge
37 icon_config.pos_func = self.position_menu
38 vertical = orientation in ('Left', 'Right')
39 if vertical:
40 self.set_size_request(8, -1)
41 else:
42 self.set_size_request(-1, 8)
43 TrayContainer.__init__(self,
44 min_size,
45 max_size,
46 vertical,
47 tray_class,
48 icon_config,
49 tray_config,
50 *tray_args)
51
60
62 """
63 @return: The panel orientation ('Top', 'Bottom', 'Left', 'Right')
64 """
65 pos = self.socket.property_get('_ROX_PANEL_MENU_POS', 'STRING', False)
66 if pos: pos = pos[2]
67 if pos:
68 side = pos.split(',')[0]
69 else:
70 side = None
71 return side
72