- Timestamp:
- 04/30/06 10:17:47 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykoticon/trunk/bin/pykoticon
r123 r124 100 100 self.debug = options.debug 101 101 self.printServers = [ socket.gethostbyname(arg) for arg in arguments ] 102 if "127.0.0.1" not in self.printServers : 103 self.printServers.append("127.0.0.1") # to allow clean shutdown 102 104 loop = threading.Thread(target=self.mainloop) 103 105 loop.start() … … 218 220 wx.Frame.__init__(self, parent, id, \ 219 221 _("PyKotIcon info for %s") % self.getCurrentUserName(), \ 220 size = ( 1, 1), \222 size = (0, 0), \ 221 223 style = wx.FRAME_NO_TASKBAR | wx.NO_FULL_REPAINT_ON_RESIZE) 222 224 … … 226 228 self.redicon = wx.Icon(os.path.join(iconsdir, "pykoticon-red.ico"), \ 227 229 wx.BITMAP_TYPE_ICO) 228 self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 230 if isWindows : 231 self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 229 232 230 233 wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) … … 245 248 246 249 wx.EVT_ICONIZE(self, self.OnIconify) 247 wx.EVT_CLOSE(self, self. OnClose)250 wx.EVT_CLOSE(self, self.FakeOnClose) 248 251 self.Show(True) 249 252 … … 259 262 260 263 def OnIconify(self, event) : 264 """Iconify/De-iconify the application.""" 261 265 if not self.IsIconized() : 262 266 self.Iconize(True) … … 264 268 265 269 def OnTaskBarActivate(self, event) : 270 """Show the application if it is minimized.""" 266 271 if self.IsIconized() : 267 272 self.Iconize(False) … … 271 276 272 277 def OnClose(self, event) : 278 """Cleanly quit the application.""" 273 279 self.closeServer() 274 280 self.menu.Destroy() … … 277 283 278 284 def OnTaskBarMenu(self, event) : 285 """Open the taskbar menu.""" 279 286 self.tbicon.PopupMenu(self.menu) 280 287 288 def FakeOnClose(self, event) : 289 """React to close from windows corner.""" 290 if self.options.allowquit : 291 self.Close() 292 else : 293 self.quitIsForbidden() 294 281 295 def OnTaskBarClose(self, event) : 282 self.Close() 296 """React to close from the taskbar.""" 297 if self.options.allowquit : 298 self.Close() 299 else : 300 self.quitIsForbidden() 301 302 def quitIsForbidden() : 303 """Displays a message indicating that quitting the application is not allowed.""" 304 message = _("Sorry, this was forbidden by your system administrator.") 305 caption = _("Information") 306 style = wx.OK | wx.ICON_INFORMATION | wx.STAY_ON_TOP 307 dialog = wx.MessageDialog(self, message, caption, style) 308 dialog.ShowModal() 309 dialog.Destroy() 283 310 284 311 def OnAbout(self, event) : … … 323 350 if not self.quitEvent.isSet() : 324 351 self.quitEvent.set() 325 server = xmlrpclib.ServerProxy("http://localhost:%s" % self. port)352 server = xmlrpclib.ServerProxy("http://localhost:%s" % self.options.port) 326 353 try : 327 354 # wake the server with an empty request … … 337 364 self.quitEvent = threading.Event() 338 365 self.charset = charset 339 self. port = options.port366 self.options = options 340 367 self.server = MyXMLRPCServer(self, options, arguments) 341 368