- Timestamp:
- 03/27/06 23:22:09 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykoticon/trunk/bin/pykoticon
r113 r114 211 211 size = (1, 1), \ 212 212 style = wx.FRAME_NO_TASKBAR | wx.NO_FULL_REPAINT_ON_RESIZE) 213 try : 214 self.tbicon = wx.TaskBarIcon() 215 except AttributeError : 216 self.tbicon = None # No taskbar icon facility 217 213 214 self.tbicon = wx.TaskBarIcon() 218 215 self.greenicon = wx.Icon(os.path.join(iconsdir, "pykoticon-green.ico"), \ 219 216 wx.BITMAP_TYPE_ICO) 220 217 self.redicon = wx.Icon(os.path.join(iconsdir, "pykoticon-red.ico"), \ 221 218 wx.BITMAP_TYPE_ICO) 222 223 self.SetIcon(self.greenicon) 224 if self.tbicon is not None : 225 self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 226 wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) 227 wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) 228 229 self.TBMENU_ABOUT = wx.NewId() 230 self.TBMENU_RESTORE = wx.NewId() 231 self.TBMENU_CLOSE = wx.NewId() 232 wx.EVT_MENU(self.tbicon, self.TBMENU_ABOUT, \ 233 self.OnAbout) 234 wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \ 235 self.OnTaskBarActivate) 236 wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \ 237 self.OnTaskBarClose) 238 try : 239 self.menu = wx.Menu() 240 except : 241 pass 242 else : 243 self.menu.Append(self.TBMENU_ABOUT, _("About")) 244 self.menu.Append(self.TBMENU_CLOSE, _("Quit")) 219 self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 220 221 wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) 222 wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) 223 224 self.TBMENU_ABOUT = wx.NewId() 225 self.TBMENU_RESTORE = wx.NewId() 226 self.TBMENU_CLOSE = wx.NewId() 227 wx.EVT_MENU(self.tbicon, self.TBMENU_ABOUT, \ 228 self.OnAbout) 229 wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \ 230 self.OnTaskBarActivate) 231 wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \ 232 self.OnTaskBarClose) 233 self.menu = wx.Menu() 234 self.menu.Append(self.TBMENU_ABOUT, _("About")) 235 self.menu.Append(self.TBMENU_CLOSE, _("Quit")) 245 236 246 237 wx.EVT_ICONIZE(self, self.OnIconify) … … 262 253 def OnClose(self, event) : 263 254 self.closeServer() 264 try : 265 self.menu.Destroy() 266 except AttributeError : 267 pass 268 try : 269 self.tbicon.Destroy() 270 except AttributeError : 271 pass 255 self.menu.Destroy() 256 self.tbicon.Destroy() 272 257 self.Destroy() 273 258 274 259 def OnTaskBarMenu(self, event) : 275 if self.tbicon : 276 try : 277 self.tbicon.PopupMenu(self.menu) 278 except AttributeError : 279 pass 260 self.tbicon.PopupMenu(self.menu) 280 261 281 262 def OnTaskBarClose(self, event) : … … 375 356 def OnInit(self) : 376 357 self.frame = PyKotIcon(None, wx.ID_ANY) 377 self.frame.Center(wx.BOTH)378 358 self.frame.Show(False) 359 self.SetTopWindow(self.frame) 379 360 return True 380 361