Changeset 79 for pykoticon

Show
Ignore:
Timestamp:
01/20/05 18:59:07 (19 years ago)
Author:
jerome
Message:

Don't create a taskbar icon if the underlying wxPython doesn't feature
such a facility

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykoticon/trunk/bin/pykoticon

    r77 r79  
    287287                     | wxPython.wx.wxICONIZE \ 
    288288                     | wxPython.wx.wxNO_FULL_REPAINT_ON_RESIZE) 
    289         self.tbicon = wxPython.wx.wxTaskBarIcon() 
     289        try :              
     290            self.tbicon = wxPython.wx.wxTaskBarIcon() 
     291        except AttributeError :     
     292            self.tbicon = None # No taskbar icon facility, old wxWidgets maybe 
    290293         
    291294        self.greenicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-green.ico"), \ 
     
    295298         
    296299        self.SetIcon(self.greenicon) 
    297         self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
    298          
    299         wxPython.wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) 
    300         wxPython.wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) 
     300        if self.tbicon is not None : 
     301            self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
     302            wxPython.wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) 
     303            wxPython.wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) 
     304         
     305            self.TBMENU_RESTORE = wx.NewId() 
     306            self.TBMENU_CLOSE = wx.NewId() 
     307            wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \ 
     308                                              self.OnTaskBarActivate) 
     309            wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \ 
     310                                              self.OnTaskBarClose) 
     311            self.menu = wxPython.wx.wxMenu() 
     312            self.menu.Append(self.TBMENU_RESTORE, _("Show Print Quota")) 
     313            self.menu.Append(self.TBMENU_CLOSE, _("Quit")) 
     314         
    301315        wxPython.wx.EVT_ICONIZE(self, self.OnIconify) 
    302          
    303         self.TBMENU_RESTORE = wx.NewId() 
    304         self.TBMENU_CLOSE = wx.NewId() 
    305         wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \ 
    306                                           self.OnTaskBarActivate) 
    307         wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \ 
    308                                           self.OnTaskBarClose) 
    309         self.menu = wxPython.wx.wxMenu() 
    310         self.menu.Append(self.TBMENU_RESTORE, _("Show Print Quota")) 
    311         self.menu.Append(self.TBMENU_CLOSE, _("Quit")) 
    312          
    313316        wxPython.wx.EVT_CLOSE(self, self.OnClose) 
    314317         
     
    333336                if self.User.Balance <= 0.0 : 
    334337                    self.SetIcon(self.redicon) 
    335                     self.tbicon.SetIcon(self.redicon, "PyKotIcon") 
     338                    if self.tbicon is not None : 
     339                        self.tbicon.SetIcon(self.redicon, "PyKotIcon") 
    336340                else :     
    337341                    self.SetIcon(self.greenicon) 
    338                     self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
     342                    if self.tbicon is not None : 
     343                        self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
    339344            else :         
    340345                isRed = False 
     
    351356                if isRed is True : 
    352357                    self.SetIcon(self.redicon) 
    353                     self.tbicon.SetIcon(self.redicon, "PyKotIcon") 
     358                    if self.tbicon is not None : 
     359                        self.tbicon.SetIcon(self.redicon, "PyKotIcon") 
    354360                else :     
    355361                    self.SetIcon(self.greenicon) 
    356                     self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
     362                    if self.tbicon is not None : 
     363                        self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
    357364            if hasattr(self, "quotasgrid") :     
    358365                self.quotasgrid.Close()