From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/jabberChat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/jabberChat Modified Files: connection.py jabberChat.py Log Message: Removed all of the plain except: clauses I could Index: jabberChat.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/jabberChat/jabberChat.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** jabberChat.py 30 Aug 2004 14:49:51 -0000 1.33 --- jabberChat.py 13 Dec 2005 11:13:23 -0000 1.34 *************** *** 94,107 **** # this needs to be made safe instead of using eval try: ! self.config['font'] = eval(parser.get('ChatWindow', 'font')) ! except: self.config['font'] = None try: self.config['playsound'] = eval(parser.get('Options', 'playsound')) ! except: self.config['playsound'] = 0 try: self.config['idletime'] = eval(parser.get('Options', 'idletime')) * 60 ! except: self.config['idletime'] = 0 --- 94,107 ---- # this needs to be made safe instead of using eval try: ! self.config['font'] = eval(parser.get('ChatWindow', 'font', None)) ! except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): self.config['font'] = None try: self.config['playsound'] = eval(parser.get('Options', 'playsound')) ! except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): self.config['playsound'] = 0 try: self.config['idletime'] = eval(parser.get('Options', 'idletime')) * 60 ! except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): self.config['idletime'] = 0 *************** *** 114,118 **** jid, name = line.rstrip().split(',') self.displayNames[jid] = name ! except: pass --- 114,118 ---- jid, name = line.rstrip().split(',') self.displayNames[jid] = name ! except IOError: pass *************** *** 251,255 **** snd = sound.Sound(filename) snd.play(1, 0) ! except: pass --- 251,255 ---- snd = sound.Sound(filename) snd.play(1, 0) ! except IOError: pass *************** *** 260,264 **** try: jid, resource = jid.split('/') ! except: resource = "default" if jid not in self.chatWindows: --- 260,264 ---- try: jid, resource = jid.split('/') ! except ValueError: resource = "default" if jid not in self.chatWindows: *************** *** 277,306 **** # outside the list def on_listRoster_mouseDoubleClick(self, event): - ##txt = event.target.stringSelection jid = self.displayedRosterList[event.target.selection] ! try: ! ##txt = txt[2:] ! ##try: ! ## jid = txt.split(' ')[0] ! ##except: ! ## jid = txt ! if jid not in self.chatWindows: ! self.createChatWindow(jid) ! else: ! self.chatWindows[jid].visible = True ! # make sure the chat window is in front ! # and isn't minimized (iconized) ! if self.chatWindows[jid].IsIconized(): ! self.chatWindows[jid].Iconize(0) ! wx.CallAfter(self.chatWindows[jid].Raise) ! except: ! pass def on_close(self, event): ! try: ! self.jabberConnection.keepRunning = 0 ! self.jabberConnection.disconnect() ! except: ! pass self.idleTimer.stop() event.skip() --- 277,294 ---- # outside the list def on_listRoster_mouseDoubleClick(self, event): jid = self.displayedRosterList[event.target.selection] ! if jid not in self.chatWindows: ! self.createChatWindow(jid) ! else: ! self.chatWindows[jid].visible = True ! # make sure the chat window is in front ! # and isn't minimized (iconized) ! if self.chatWindows[jid].IsIconized(): ! self.chatWindows[jid].Iconize(0) ! wx.CallAfter(self.chatWindows[jid].Raise) def on_close(self, event): ! self.jabberConnection.keepRunning = 0 ! self.jabberConnection.disconnect() self.idleTimer.stop() event.skip() Index: connection.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/jabberChat/connection.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** connection.py 14 Apr 2004 02:38:48 -0000 1.9 --- connection.py 13 Dec 2005 11:13:23 -0000 1.10 *************** *** 16,25 **** self._parent = parent self.con = None - self.server = account['server'] self.username = account['username'] self.password = account['password'] self.resource = account['resource'] - self.createNewConnection() --- 16,23 ---- *************** *** 27,38 **** # should make debug level settable in configuration con = jabber.Client(host=self.server, debug=DEBUG_LEVEL, log=sys.stderr) - self.con = con - con.setMessageHandler(self.messageCB) con.setPresenceHandler(self.presenceCB) con.setIqHandler(self.iqCB) con.setDisconnectHandler(self.disconnectedCB) - try: con.connect() --- 25,33 ---- *************** *** 43,47 **** else: print "Connected" - if con.auth(self.username, self.password, self.resource): print "Logged in as %s to server %s" % (self.username, self.server) --- 38,41 ---- |