1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """All of the icons for relax."""
25
26
27 from os import sep
28 import sys
29 import wx
30
31
32 from status import Status; status = Status()
33
34
36 """The icon bundle class of the main relax icons."""
37
39 """Set up the icons after the main app is created."""
40
41
42 if not 'darwin' in sys.platform:
43 self.AddIconFromFile(status.install_path + sep + 'graphics' + sep + 'ulysses.ico', wx.BITMAP_TYPE_ANY)
44
45
47 """The icon for the Mac OS X task bar."""
48
49
50 TBMENU_RESTORE = wx.NewId()
51 TBMENU_CLOSE = wx.NewId()
52
54 """Set up the task bar icon.
55
56 @param gui: The GUI object.
57 @type gui: wx.Frame instance
58 """
59
60
61 self.gui = gui
62
63
64 wx.TaskBarIcon.__init__(self)
65
66
67 self.SetIcon(wx.Icon(status.install_path + sep + 'graphics' + sep + 'ulysses_shadowless_trans_128x128.png', wx.BITMAP_TYPE_ANY))
68
69
70 self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.restore)
71
72
74 """Create and return the task bar menu.
75
76 @return: The pop up menu.
77 @rtype: wx.Menu instance
78 """
79
80
81 popup = wx.Menu()
82
83
84 popup.Append(self.TBMENU_RESTORE, "Restore relax")
85 popup.Append(self.TBMENU_CLOSE, "Exit relax")
86
87
88 self.Bind(wx.EVT_MENU, self.restore, id=self.TBMENU_RESTORE)
89 self.Bind(wx.EVT_MENU, self.exit, id=self.TBMENU_CLOSE)
90
91
92 return popup
93
94
95 - def exit(self, event):
96 """Exit relax from the task bar.
97
98 @param event: The wx event.
99 @type event: wx event
100 """
101
102
103 wx.CallAfter(self.gui.exit_gui)
104
105
107 """Restore relax from the task bar.
108
109 @param event: The wx event.
110 @type event: wx event
111 """
112
113
114 if status.show_gui and not self.gui.IsShown():
115 self.gui.Show(True)
116
117
118 if self.gui.IsIconized():
119 self.gui.Iconize(False)
120
121
122 self.gui.Raise()
123
124
125
126 relax_icons = Relax_icons()
127