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