Changeset 44

Show
Ignore:
Timestamp:
02/08/04 11:37:08 (5 years ago)
Author:
ug
Message:

Exception handling for webbrowser.open

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 05/bugfix/kombilo.py

    r43 r44  
    13431343    def doCommand(self, i): 
    13441344        if self.customMenuCommands[i][0]: 
    1345             webbrowser.open(self.customMenuCommands[i][0], new=1) 
     1345            try: 
     1346                webbrowser.open(self.customMenuCommands[i][0], new=1) 
     1347            except: 
     1348                showwarning('Error', 'Failed to open the web browser.') 
    13461349        if self.customMenuCommands[i][3]:   # reset game list 
    13471350            self.master.reset() 
     
    60516054                               command=self.customizeApp) 
    60526055 
    6053         self.helpmenu.insert_command(2, label='Tutorial', underline=0, command= 
    6054                                      lambda s='file:'+os.path.abspath(os.path.join(self.basepath,'doc', 
    6055                                                                                        'tutorial.html')) : 
    6056                                      webbrowser.open(s, new=1)) 
     6056        self.helpmenu.insert_command(2, label='Tutorial', underline=0, command=self.showTutorial) 
     6057 
     6058 
     6059    def showTutorial(self): 
     6060        try: 
     6061            webbrowser.open('file:'+os.path.abspath(os.path.join(self.basepath,'doc','tutorial.html')),new=1) 
     6062        except: 
     6063            showwarning('Error', 'Failed to open the web browser.\nYou can find the tutorial as\n'+\ 
     6064                        'file:'+os.path.abspath(os.path.join(self.basepath,'doc','tutorial.html'))) 
    60576065         
    60586066