Changeset 138 for pykoticon

Show
Ignore:
Timestamp:
06/06/06 22:05:36 (18 years ago)
Author:
jerome
Message:

Removed the traceback when client disconnects while server
is waiting for a dialog box to close.
Displays an error message when the user wants to quit in spite
of the administrator forbidding this.

Location:
pykoticon/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykoticon/trunk/bin/pykoticon

    r137 r138  
    44"""PyKotIcon is a generic, networked, cross-platform dialog box manager.""" 
    55 
    6 # PyKotIcon - Client side helper for PyKota 
     6# PyKotIcon - Client side helper for PyKota and other applications 
    77# 
    88# (c) 2003, 2004, 2005, 2006 Jerome Alet <alet@librelogiciel.com> 
     
    2323# 
    2424 
    25 __version__ = "1.01" 
     25__version__ = "1.02" 
    2626__author__ = "Jerome Alet" 
    2727__author_email__ = "alet@librelogiciel.com" 
     
    148148        return True 
    149149         
     150    def _dispatch(self, method, params) :     
     151        """Ensure that only export_* methods are available.""" 
     152        return getattr(self, "export_%s" % method)(*params) 
     153         
     154    def handle_error(self, request, client_address) :     
     155        """Doesn't display an ugly traceback in case an error occurs.""" 
     156        self.logDebug("An exception occured while handling an incoming request from %s:%s" % (client_address[0], client_address[1])) 
     157         
    150158    def verify_request(self, request, client_address) : 
    151159        """Ensures that requests which don't come from the print server are rejected.""" 
     
    158166            self.logDebug("%s rejected." % client) 
    159167            return False 
    160          
    161     def _dispatch(self, method, params) :     
    162         """Ensure that only export_* methods are available.""" 
    163         return getattr(self, "export_%s" % method)(*params) 
    164168         
    165169    def mainloop(self) : 
     
    248252         
    249253        wx.EVT_ICONIZE(self, self.OnIconify) 
    250         wx.EVT_CLOSE(self, self.FakeOnClose) 
     254        wx.EVT_CLOSE(self, self.OnClose) 
    251255        self.Show(True) 
    252256         
     
    277281    def OnClose(self, event) : 
    278282        """Cleanly quit the application.""" 
    279         self.closeServer() 
    280         self.menu.Destroy() 
    281         self.tbicon.Destroy() 
    282         self.Destroy() 
     283        if (event is None) or self.options.allowquit : 
     284            self.closeServer() 
     285            self.menu.Destroy() 
     286            self.tbicon.Destroy() 
     287            self.Destroy() 
     288        else :     
     289            self.quitIsForbidden() 
    283290 
    284291    def OnTaskBarMenu(self, event) : 
     
    286293        self.tbicon.PopupMenu(self.menu) 
    287294 
    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              
    295295    def OnTaskBarClose(self, event) : 
    296296        """React to close from the taskbar.""" 
     
    302302    def quitIsForbidden(self) :         
    303303        """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() 
    310         pass 
     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() 
    311310         
    312311    def OnAbout(self, event) :     
     
    473472     
    474473     
    475 def crashed() :     
    476     """Minimal crash method.""" 
    477     import traceback 
    478     lines = [] 
    479     for line in traceback.format_exception(*sys.exc_info()) : 
    480         lines.extend([l for l in line.split("\n") if l]) 
    481     msg = "ERROR: ".join(["%s\n" % l for l in (["ERROR: PyKotIcon"] + lines)]) 
    482     sys.stderr.write(msg) 
    483     sys.stderr.flush() 
    484      
    485      
    486474if __name__ == '__main__': 
    487475    main() 
  • pykoticon/trunk/NEWS

    r126 r138  
    2222PyKotIcon NEWS : 
    2323 
     24  - 1.02 (2006-06-06) : 
     25     
     26    - Now displays an error message when the end user wants to quit 
     27      and it is forbidden. 
     28       
     29    - Doesn't display the ugly traceback anymore when the client   
     30      disconnects before the server has sent the answer back 
     31      (pknotify --timeout). 
     32       
    2433  - 1.01 (2006-05-01) : 
    2534