You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(45) |
May
(185) |
Jun
|
Jul
(36) |
Aug
(205) |
Sep
(98) |
Oct
(107) |
Nov
(6) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(1) |
Feb
(2) |
Mar
(19) |
Apr
(26) |
May
(18) |
Jun
|
Jul
(12) |
Aug
(16) |
Sep
(22) |
Oct
(7) |
Nov
(11) |
Dec
(74) |
2006 |
Jan
(14) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(14) |
Jun
(5) |
Jul
(20) |
Aug
(10) |
Sep
(1) |
Oct
|
Nov
(4) |
Dec
(1) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(14) |
Aug
|
Sep
|
Oct
(6) |
Nov
(1) |
Dec
|
From: Alex T. <ale...@us...> - 2005-12-14 01:24:33
|
Update of /cvsroot/pythoncard/PythonCard/samples/flock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25888 Modified Files: flock.py Log Message: Fix annoying typo - "sampe" -> "sample" Index: flock.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/flock/flock.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** flock.py 13 Dec 2005 11:13:23 -0000 1.3 --- flock.py 14 Dec 2005 01:24:24 -0000 1.4 *************** *** 4,8 **** Builds on the "gravity" sample to show a simple animation of "boids"; shows simple emergent behaviour for a 2-D flock of "boids". ! This sampe uses two images to animate the movement of bird-like objects. """ __version__ = "$Revision$" --- 4,8 ---- Builds on the "gravity" sample to show a simple animation of "boids"; shows simple emergent behaviour for a 2-D flock of "boids". ! This sample uses two images to animate the movement of bird-like objects. """ __version__ = "$Revision$" |
From: Andy T. <an...@us...> - 2005-12-13 11:14:11
|
Update of /cvsroot/pythoncard/PythonCard/samples/flock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/flock Modified Files: flock.py readme.txt Log Message: Removed all of the plain except: clauses I could Index: flock.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/flock/flock.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** flock.py 11 Oct 2004 02:09:12 -0000 1.2 --- flock.py 13 Dec 2005 11:13:23 -0000 1.3 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ # KEA 2004-09-25 --- 2,11 ---- """ + Builds on the "gravity" sample to show a simple animation of "boids"; shows simple emergent behaviour for a 2-D flock of "boids". + + This sampe uses two images to animate the movement of bird-like objects. + """ __version__ = "$Revision$" __date__ = "$Date$" # KEA 2004-09-25 *************** *** 18,22 **** import psyco psyco.full() ! except: pass --- 21,25 ---- import psyco psyco.full() ! except ImportError: pass Index: readme.txt =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/flock/readme.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** readme.txt 1 Aug 2005 18:09:30 -0000 1.2 --- readme.txt 13 Dec 2005 11:13:23 -0000 1.3 *************** *** 2,5 **** This sampe uses two images to animate the movement of bird-like objects. - - --- 2,3 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:14:10
|
Update of /cvsroot/pythoncard/PythonCard/samples/doodle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/doodle Modified Files: doodle.py Log Message: Removed all of the plain except: clauses I could Index: doodle.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/doodle/doodle.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** doodle.py 12 Aug 2004 19:18:51 -0000 1.27 --- doodle.py 13 Dec 2005 11:13:22 -0000 1.28 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import clipboard, dialog, graphic, model --- 2,9 ---- """ + A simple bitmap drawing test. Select a color using the Color button. Click and drag the mouse to draw on the canvas. + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import clipboard, dialog, graphic, model *************** *** 77,81 **** bmp.SaveFile(path, fileType) return 1 ! except: return 0 else: --- 78,82 ---- bmp.SaveFile(path, fileType) return 1 ! except IOError: return 0 else: *************** *** 93,97 **** self.components.bufOff.clear() - if __name__ == '__main__': app = model.Application(Doodle) --- 94,97 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/custdb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/custdb Modified Files: custdb.py Log Message: Removed all of the plain except: clauses I could Index: custdb.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/custdb/custdb.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** custdb.py 12 Aug 2004 19:18:50 -0000 1.9 --- custdb.py 13 Dec 2005 11:13:22 -0000 1.10 *************** *** 151,155 **** try: self.selected = int(event.target.text) ! except: self.selected = 0 self.showSelected() --- 151,155 ---- try: self.selected = int(event.target.text) ! except ValueError: self.selected = 0 self.showSelected() |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/addresses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/addresses Modified Files: addresses.py outlook.py Log Message: Removed all of the plain except: clauses I could Index: outlook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/addresses/outlook.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** outlook.py 6 Jan 2003 21:13:25 -0000 1.5 --- outlook.py 13 Dec 2005 11:13:21 -0000 1.6 *************** *** 1,12 **** ! """ - __version__ = "$Revision$" - __date__ = "$Date$" - I need a more generic way of dealing with these modules that may not be available. Also, if the MSOutlook __init__ can't be completed, what's an appropriate failure mechanism? - """ try: --- 1,10 ---- ! #!/usr/bin/python """ I need a more generic way of dealing with these modules that may not be available. Also, if the MSOutlook __init__ can't be completed, what's an appropriate failure mechanism? """ + __version__ = "$Revision$" + __date__ = "$Date$" try: *************** *** 18,22 **** WIN32_FOUND = 1 ! except: WIN32_FOUND = 0 --- 16,20 ---- WIN32_FOUND = 1 ! except ImportError: WIN32_FOUND = 0 *************** *** 27,31 **** def __init__(self): self.outlookFound = 0 ! try: #oOutlookApp = win32com.client.Dispatch("Outlook.Application.9") #self.oOutlookApp = win32com.client.Dispatch("Outlook.Application") --- 25,29 ---- def __init__(self): self.outlookFound = 0 ! if WIN32_FOUND: #oOutlookApp = win32com.client.Dispatch("Outlook.Application.9") #self.oOutlookApp = win32com.client.Dispatch("Outlook.Application") *************** *** 34,41 **** self.oOutlookApp = win32com.client.gencache.EnsureDispatch("Outlook.Application") self.outlookFound = 1 ! except: #print "unable to load Outlook" pass - self.olFolderInbox = 6 self.olContactItem = 2 --- 32,38 ---- self.oOutlookApp = win32com.client.gencache.EnsureDispatch("Outlook.Application") self.outlookFound = 1 ! else: #print "unable to load Outlook" pass self.olFolderInbox = 6 self.olContactItem = 2 *************** *** 45,62 **** self.olMinimized = 1 self.olNormalWindow = 2 - self.records = [] - def loadRecords(self): if not self.outlookFound: return - # this should use more try/except blocks or nested blocks onMAPI = self.oOutlookApp.GetNamespace("MAPI") ofContacts = onMAPI.GetDefaultFolder(self.olFolderContacts) - #print "number of contacts:", len(ofContacts.Items) - for oc in range(len(ofContacts.Items)): contact = ofContacts.Items.Item(oc + 1) --- 42,54 ---- *************** *** 74,80 **** record['Email1Address'] = contact.Email1Address record['Body'] = contact.Body - self.records.append(record) - #print "InterfaceCount/GatewayCount %d/%d" % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount()) --- 66,70 ---- Index: addresses.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/addresses/addresses.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** addresses.py 12 Aug 2004 19:18:47 -0000 1.35 --- addresses.py 13 Dec 2005 11:13:21 -0000 1.36 *************** *** 2,8 **** """ - __version__ = "$Revision$" - __date__ = "$Date$" - A lot of the record structure and logic mirrors Winkler's approach used in the textIndexer, but I coded this from scratch to see what kind of differences --- 2,5 ---- *************** *** 12,17 **** addresses sample to test different approaches to storage formats: ZODB, mySQL, plain text files using lists and dictionaries, CSV text files, etc. - """ from PythonCard import configuration, dialog, model, util --- 9,15 ---- addresses sample to test different approaches to storage formats: ZODB, mySQL, plain text files using lists and dictionaries, CSV text files, etc. """ + __version__ = "$Revision$" + __date__ = "$Date$" from PythonCard import configuration, dialog, model, util *************** *** 47,51 **** self.openFile(filename) - """ This should probably be a list supplied as part of initialization. --- 45,48 ---- *************** *** 137,142 **** return - - def newRecord(self): self.saveRecord(self.current) --- 134,137 ---- *************** *** 192,196 **** if self.current == -1 and len(self.records) > 0: self.displayRecord(0) ! except: pass --- 187,191 ---- if self.current == -1 and len(self.records) > 0: self.displayRecord(0) ! except IOError: pass *************** *** 203,211 **** pprint.pprint(self.records, f) f.close() ! except: pass - - class Addresses(model.Background): --- 198,204 ---- pprint.pprint(self.records, f) f.close() ! except IOError: pass class Addresses(model.Background): *************** *** 233,237 **** event.skip() - def on_fileImportOutlook_command(self, event): addressesToOutlookMap = {'Name':'FullName', --- 226,229 ---- *************** *** 328,335 **** else: ins = widget.getInsertionPoint() ! try: ! widget.replace(ins, ins + 1, '') ! except: ! pass def on_editSelectAll_command(self, event): --- 320,324 ---- else: ins = widget.getInsertionPoint() ! widget.replace(ins, ins + 1, '') def on_editSelectAll_command(self, event): *************** *** 353,358 **** target.label = 'Show Notes' - - if __name__ == '__main__': app = model.Application(Addresses) --- 342,345 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/addressesZODB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/addressesZODB Modified Files: addresses.py outlook.py Log Message: Removed all of the plain except: clauses I could Index: outlook.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/addressesZODB/outlook.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** outlook.py 6 Jan 2003 21:13:41 -0000 1.3 --- outlook.py 13 Dec 2005 11:13:22 -0000 1.4 *************** *** 18,22 **** WIN32_FOUND = 1 ! except: WIN32_FOUND = 0 --- 18,22 ---- WIN32_FOUND = 1 ! except ImportError: WIN32_FOUND = 0 Index: addresses.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/addressesZODB/addresses.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** addresses.py 12 Aug 2004 19:18:48 -0000 1.32 --- addresses.py 13 Dec 2005 11:13:22 -0000 1.33 *************** *** 153,160 **** def doExit(self): ! try: ! self.document.close() ! except: ! pass def on_close(self, event): --- 153,157 ---- def doExit(self): ! self.document.close() def on_close(self, event): *************** *** 272,276 **** try: widget.replace(ins, ins + 1, '') ! except: pass --- 269,273 ---- try: widget.replace(ins, ins + 1, '') ! except ValueError: pass |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/financial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/financial Modified Files: mortgage.py Log Message: Removed all of the plain except: clauses I could Index: mortgage.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/financial/mortgage.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mortgage.py 20 Jul 2004 18:22:35 -0000 1.1 --- mortgage.py 13 Dec 2005 11:13:22 -0000 1.2 *************** *** 2,13 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import dialog, model import pyfi ! class MyBackground(model.Background): def on_initialize(self, event): --- 2,16 ---- """ + A mortgage repayment calculator. Used in the presentation at VanPy 2005 and PyCon 2005. + + Subsequently borrowed for the presentation at OSDC 2005 + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import dialog, model import pyfi ! class MyBackground(model.Background) def on_initialize(self, event): *************** *** 26,33 **** payment30 = pyfi.amortization(principal, interestRate, 12, 30 * 12) comp.Result.text = "15 year monthly payment: %.2f\n30 year monthly payment: %.2f" % (payment15, payment30) ! except: dialog.alertDialog(self, 'Please enter valid values', 'Input Value(s) Error') - if __name__ == '__main__': app = model.Application(MyBackground) --- 29,35 ---- payment30 = pyfi.amortization(principal, interestRate, 12, 30 * 12) comp.Result.text = "15 year monthly payment: %.2f\n30 year monthly payment: %.2f" % (payment15, payment30) ! except ValueError: dialog.alertDialog(self, 'Please enter valid values', 'Input Value(s) Error') if __name__ == '__main__': app = model.Application(MyBackground) |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/dbBrowser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/dbBrowser Modified Files: csvBrowse.py dbBrowser.py dbBrowser2.py dbLogin.py gadflyBrowse.py metakitBrowse.py mySQLBrowse.py oracleBrowse.py postgreBrowse.py pysqlite2Browse.py pysqliteBrowse.py Log Message: Removed all of the plain except: clauses I could Index: pysqlite2Browse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/pysqlite2Browse.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pysqlite2Browse.py 17 May 2005 20:33:53 -0000 1.1 --- pysqlite2Browse.py 13 Dec 2005 11:13:22 -0000 1.2 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: pysqlite2Browse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" # AGT 2005-05-17 *************** *** 80,89 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result = self._cursor.fetchone() ! except: ! print "AGT argh" ! result=[] ! return result --- 79,83 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result = self._cursor.fetchone() return result *************** *** 93,100 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result=self._cursor.fetchall() ! except: ! result=[] return result --- 87,91 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result=self._cursor.fetchall() return result Index: oracleBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/oracleBrowse.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** oracleBrowse.py 19 Jun 2003 12:34:18 -0000 1.8 --- oracleBrowse.py 13 Dec 2005 11:13:22 -0000 1.9 *************** *** 2,9 **** """ - __version__='$Revision$'[11:-2] - __date__='9th November 2001' - __author__='Andy Todd <an...@ha...>' - Module Name: oracleBrowse Description: Plug in for PythonCard application dbBrowse to provide Oracle specific functionality --- 2,5 ---- *************** *** 20,29 **** 04-Apr-2002 Changed the format of columnDefs that is passed from the db handler modules back to dbBrowser in the getColumns method. This actually makes the code in this module simpler, which must be a good thing """ try: ! import DCOracle2 ! oracle = DCOracle2 ! except: ! import cx_Oracle ! oracle = cx_Oracle class browse: --- 16,29 ---- 04-Apr-2002 Changed the format of columnDefs that is passed from the db handler modules back to dbBrowser in the getColumns method. This actually makes the code in this module simpler, which must be a good thing """ + __version__='$Revision$'[11:-2] + __date__='9th November 2001' + __author__='Andy Todd <an...@ha...>' + try: ! import cx_Oracle ! oracle = cx_Oracle ! except ImportError: ! import DCOracle2 ! oracle = DCOracle2 class browse: *************** *** 33,51 **** "Setup the database connection" # self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user'] ! try: ! # Not providing some values is guaranteed to ruin our connection ! if ('username' not in connection) and ('password' not in connection): ! raise ValueError ! connectString = connection['username']+'/'+connection['password'] ! if 'database' in connection: ! if connection['database']: ! connectString += '@' + connection['database'] ! self._db = oracle.connect( connectString ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 33,47 ---- "Setup the database connection" # self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user'] ! # Not providing some values is guaranteed to ruin our connection ! if ('username' not in connection) and ('password' not in connection): ! raise ValueError ! connectString = connection['username']+'/'+connection['password'] ! if 'database' in connection: ! if connection['database']: ! connectString += '@' + connection['database'] ! self._db = oracle.connect( connectString ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): Index: gadflyBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/gadflyBrowse.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gadflyBrowse.py 19 Jun 2003 12:34:18 -0000 1.5 --- gadflyBrowse.py 13 Dec 2005 11:13:22 -0000 1.6 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: gadflyBrowse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" import gadfly *************** *** 23,38 **** "Setup the database connection" self._system_tables=['__TABLE_NAMES__', '__INDEXCOLS__', '__COLUMNS__', '__INDICES__', '__DATADEFS__', 'DUAL'] ! try: ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['databasename']: ! raise ValueError ! self._db = gadfly.gadfly( databasename=connection['databasename'] ! ,directory=connection['directory'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 22,33 ---- "Setup the database connection" self._system_tables=['__TABLE_NAMES__', '__INDEXCOLS__', '__COLUMNS__', '__INDICES__', '__DATADEFS__', 'DUAL'] ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['databasename']: ! raise ValueError ! self._db = gadfly.gadfly( databasename=connection['databasename'] ! ,directory=connection['directory'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): Index: mySQLBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/mySQLBrowse.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mySQLBrowse.py 19 Jun 2003 12:34:18 -0000 1.10 --- mySQLBrowse.py 13 Dec 2005 11:13:22 -0000 1.11 *************** *** 2,9 **** """ - __version__="0.3" - __date__="30th March, 2002" - __author__="Andy Todd <an...@ha...>" - Module Name: mySQLBrowse Description: Plug in for PythonCard application dbBrowse to provide MySQL specific functionality --- 2,5 ---- *************** *** 15,23 **** The only manipulation to data is to format date values as DD-Mon-YYYY ! Class named changed to 'browse' for version 0.2.1, this allows us to use the ! same class name in each database handler module. ! Data returned from getColumns has been changed for version 0.3. This enables dbBrowser.DbBrowser to be a lot more generic and removes a lot of data manipulationin the on_btnBrowse_mouseClick method. Also added 'func' to the list of system tables (it was added after version 3.23.37 """ import MySQLdb --- 11,23 ---- The only manipulation to data is to format date values as DD-Mon-YYYY ! The class name was changed to 'browse' for version 0.2.1, this allows us to use ! the same class name in each database handler module. ! Data returned from getColumns has been changed for version 0.3. This enables dbBrowser.DbBrowser to be a lot more generic and removes a lot of data manipulationin the on_btnBrowse_mouseClick method. Also added 'func' to the list of system tables (it was added after version 3.23.37) """ + __version__="0.3" + __date__="30th March, 2002" + __author__="Andy Todd <an...@ha...>" + import MySQLdb *************** *** 29,45 **** "Setup the database connection" self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user', 'func'] ! try: ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = MySQLdb.connect( user=connection['username'] ! ,passwd=connection['password'] ! ,db=connection['database'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 29,41 ---- "Setup the database connection" self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user', 'func'] ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = MySQLdb.connect( user=connection['username'] ! ,passwd=connection['password'] ! ,db=connection['database'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): Index: csvBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/csvBrowse.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csvBrowse.py 4 Sep 2004 11:46:39 -0000 1.1 --- csvBrowse.py 13 Dec 2005 11:13:22 -0000 1.2 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: csvBrowse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" import csv, os *************** *** 29,33 **** self._db = "ok" self._cursor="ok" ! except: self._db = None self._cursor = None --- 28,32 ---- self._db = "ok" self._cursor="ok" ! except IOError: self._db = None self._cursor = None *************** *** 61,68 **** if tableName!=self._tableName: self._tableName=tableName ! try: ! result = self.reader.next() ! except: ! result = None return result --- 60,64 ---- if tableName!=self._tableName: self._tableName=tableName ! result = self.reader.next() return result Index: dbLogin.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/dbLogin.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dbLogin.py 18 Sep 2005 03:59:22 -0000 1.13 --- dbLogin.py 13 Dec 2005 11:13:22 -0000 1.14 *************** *** 2,12 **** """ - __version__ = '$Revision$'[11:-2] - __date__ = "16th September, 2002" - __author__ = "Andy Todd <an...@ha...>" - App Name: dbBrowser Description: Provide a login dialog for the dbBrowser application """ import os --- 2,11 ---- """ App Name: dbBrowser Description: Provide a login dialog for the dbBrowser application """ + __version__ = '$Revision$'[11:-2] + __date__ = "16th September, 2002" + __author__ = "Andy Todd <an...@ha...>" import os Index: pysqliteBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/pysqliteBrowse.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pysqliteBrowse.py 19 Jun 2003 12:34:18 -0000 1.4 --- pysqliteBrowse.py 13 Dec 2005 11:13:22 -0000 1.5 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: gadflyBrowse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" # KEA 2003-01-19 *************** *** 26,37 **** def __init__(self, connection): "Setup the database connection" - ##self._system_tables=['__TABLE_NAMES__', '__INDEXCOLS__', '__COLUMNS__', '__INDICES__', '__DATADEFS__', 'DUAL'] self._system_tables=[] - ##try: - # Not providing a db name is guaranteed to ruin our connection if not connection['databasename']: raise ValueError - ##db = gadfly.gadfly( databasename=connection['databasename'] - ## ,directory=connection['directory'] ) filename = os.path.join(connection['directory'], connection['databasename']) # not sure about the mode to use, I assume we just want read-only --- 25,31 ---- *************** *** 40,46 **** # This one is used in getRow self._tableName='' - ##except: - ## self._cursor=None - ## self._tableName=None def getTables(self): --- 34,37 ---- *************** *** 65,81 **** precision = 255 columnDefs.append((columnName, dataType, precision, nullable, key, default)) - """ - # format of Gadfly definitions is; - # column name - # format of dbBrowser column definitions is - # column name, data type, length (for display), nullable, key, default - columnDefs = [] - for column in self._cursor.fetchall(): - columnName = column[0] - dataType, nullable, key, default = "varchar", "", "", "" - # Dodgy default, but if works for me - precision = 255 - columnDefs.append((columnName, dataType, precision, nullable, key, default)) - """ return columnDefs --- 56,59 ---- *************** *** 98,108 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result = self._cursor.fetchone() ! ##except gadfly.database.error: ! ## result = None ! except: ! print "KEA argh" ! result=[] return result --- 76,80 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result = self._cursor.fetchone() return result *************** *** 112,119 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result=self._cursor.fetchall() ! except: ! result=[] return result --- 84,88 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result=self._cursor.fetchall() return result Index: dbBrowser2.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/dbBrowser2.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbBrowser2.py 18 Sep 2005 03:59:22 -0000 1.9 --- dbBrowser2.py 13 Dec 2005 11:13:22 -0000 1.10 *************** *** 37,41 **** try: self.readme=open('readme.txt').read() ! except: self.readme='' --- 37,41 ---- try: self.readme=open('readme.txt').read() ! except IOError: self.readme='' Index: metakitBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/metakitBrowse.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** metakitBrowse.py 10 May 2003 17:31:32 -0000 1.3 --- metakitBrowse.py 13 Dec 2005 11:13:22 -0000 1.4 *************** *** 1,10 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - - #jm - marked changes 030218 - """ Module Name: metakitBrowse --- 1,4 ---- *************** *** 18,21 **** --- 12,19 ---- Because metakit isn't a relational database we probably don't need to support the getQueryString method in this class. Its only really an internal utility method for the other, public, classes anyway. """ + #jm - marked changes 030218 + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" import metakit *************** *** 95,99 **** try: result.append(getattr(row, c)) ! except: result.append('') #print result --- 93,97 ---- try: result.append(getattr(row, c)) ! except AttributeError: result.append('') #print result Index: postgreBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/postgreBrowse.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** postgreBrowse.py 25 Jun 2003 20:03:08 -0000 1.2 --- postgreBrowse.py 13 Dec 2005 11:13:22 -0000 1.3 *************** *** 2,9 **** """ - __version__="$Release $" - __date__="Sat Jun 7 13:39:12 BST 2003" - __author__="Jon Dyte <jo...@to...>" - Module Name: psyopg Description: Plug in for PythonCard application dbBrowse to provide Psycopg specific functionality --- 2,5 ---- *************** *** 11,14 **** --- 7,13 ---- Psycopg version of the mysqlBrowse class """ + __version__="$Release $" + __date__="Sat Jun 7 13:39:12 BST 2003" + __author__="Jon Dyte <jo...@to...>" import psycopg *************** *** 23,39 **** "Setup the database connection" self._system_tables = [] ! try: ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = psycopg.connect( "user=%s password=%s dbname=%s" % (connection['username'], ! connection['password'], ! connection['database']) ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 22,34 ---- "Setup the database connection" self._system_tables = [] ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = psycopg.connect( "user=%s password=%s dbname=%s" % (connection['username'], ! connection['password'], ! connection['database']) ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): *************** *** 51,55 **** try: self._cursor.execute(stmt) ! except: return () desc = self._cursor.description --- 46,50 ---- try: self._cursor.execute(stmt) ! except psycopg.Error: return () desc = self._cursor.description Index: dbBrowser.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/dbBrowser.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dbBrowser.py 24 Apr 2004 21:09:18 -0000 1.32 --- dbBrowser.py 13 Dec 2005 11:13:22 -0000 1.33 *************** *** 2,9 **** """ - __version__ = '$Revision$'[11:-2] - __date__ = "20th November, 2001" - __author__ = "Andy Todd <an...@ha...>" - App Name: dbBrowser Description: A PythonCard sample application to browse data from external data --- 2,5 ---- *************** *** 30,33 **** --- 26,33 ---- When switching between different databases the dynamically created widgets should be cleared up, they currently do not get changed until a table from the new database is selected. """ + __version__ = '$Revision$'[11:-2] + __date__ = "20th November, 2001" + __author__ = "Andy Todd <an...@ha...>" + from PythonCard import configuration, model, dialog #import wx *************** *** 45,50 **** try: self.readme=open('readme.txt').read() ! except: ! self.readme='' def _enableButton(self, enabled): --- 45,50 ---- try: self.readme=open('readme.txt').read() ! except IOError: ! self.readme=__doc__ def _enableButton(self, enabled): |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/conversions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/conversions Modified Files: conversions.py Log Message: Removed all of the plain except: clauses I could Index: conversions.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/conversions/conversions.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** conversions.py 14 Nov 2005 22:33:13 -0000 1.16 --- conversions.py 13 Dec 2005 11:13:22 -0000 1.17 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import model --- 2,9 ---- """ + conversions provides conversion between english <-> morse code and celsius + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import model *************** *** 80,84 **** try: converted += self.morseAlphabet[self.alphabet.index(ordC)] + ' ' ! except: return converted + "\n\ncharacter out of bounds, unable to complete conversion" return converted[:-1] --- 81,85 ---- try: converted += self.morseAlphabet[self.alphabet.index(ordC)] + ' ' ! except ValueError: return converted + "\n\ncharacter out of bounds, unable to complete conversion" return converted[:-1] *************** *** 94,98 **** try: ordC = self.alphabet[self.morseAlphabet.index(c)] ! except: return converted + "\n\nmorse out of bounds error, unable to complete conversion" converted += ordC --- 95,99 ---- try: ordC = self.alphabet[self.morseAlphabet.index(c)] ! except ValueError: return converted + "\n\nmorse out of bounds error, unable to complete conversion" converted += ordC *************** *** 107,115 **** try: dummy = float(txt) ! except: return "Cannot convert anything but numbers" try: rate = server.getRate(fromCur, toCur) ! except: return "Error getting exchange rate" return str(float(txt) * rate) --- 108,116 ---- try: dummy = float(txt) ! except ValueError: return "Cannot convert anything but numbers" try: rate = server.getRate(fromCur, toCur) ! except ValueError: return "Error getting exchange rate" return str(float(txt) * rate) |
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 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/companies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/companies Modified Files: parse_companies.py Log Message: Removed all of the plain except: clauses I could Index: parse_companies.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/companies/parse_companies.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** parse_companies.py 8 Aug 2004 18:31:53 -0000 1.9 --- parse_companies.py 13 Dec 2005 11:13:22 -0000 1.10 *************** *** 92,96 **** try: offset = lines.index('') ! except: offset = -1 --- 92,96 ---- try: offset = lines.index('') ! except ValueError: offset = -1 *************** *** 243,245 **** if __name__ == '__main__': ! buildTextAndPickleFiles() \ No newline at end of file --- 243,245 ---- if __name__ == '__main__': ! buildTextAndPickleFiles() |
From: Andy T. <an...@us...> - 2005-12-13 11:14:08
|
Update of /cvsroot/pythoncard/PythonCard/samples/SourceForgeTracker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/SourceForgeTracker Modified Files: SourceForgeTracker.py Log Message: Removed all of the plain except: clauses I could Index: SourceForgeTracker.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/SourceForgeTracker/SourceForgeTracker.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** SourceForgeTracker.py 5 May 2004 16:53:24 -0000 1.22 --- SourceForgeTracker.py 13 Dec 2005 11:13:21 -0000 1.23 *************** *** 2,8 **** """ - __version__ = "$Revision$" - __date__ = "$Date$" - Currently only displays Open topic items. Providing more options and displaying the full info set from the tracker database is left --- 2,5 ---- *************** *** 14,19 **** with XML and UNICODE issues. http://aspn.activestate.com/ASPN/Mail/Message/xml-sig/967244 - """ from PythonCard import configuration, model --- 11,17 ---- with XML and UNICODE issues. http://aspn.activestate.com/ASPN/Mail/Message/xml-sig/967244 """ + __version__ = "$Revision$" + __date__ = "$Date$" from PythonCard import configuration, model *************** *** 49,53 **** 'Sender: ' + getText(f.getElementsByTagName("sender")[0]) + '\n' + \ getText(f.getElementsByTagName("text")[0]) ! except: pass return trackerDict --- 47,51 ---- 'Sender: ' + getText(f.getElementsByTagName("sender")[0]) + '\n' + \ getText(f.getElementsByTagName("text")[0]) ! except IndexError: pass return trackerDict *************** *** 107,136 **** fp.close() return xml ! except: return '' def displayTopics(self, group, category): filename = self.buildFilename(group, category) ! try: ! if not os.path.exists(filename): ! url = self.buildUrl(group, category) ! #print "downloading", filename, url ! self.downloadFile(url, filename) ! xml = self.loadXML(group, category) ! self.status('Parsing XML...') ! self.trackerDict = doParse(xml) ! self.status('Display Topics...') ! topics = [] ! for artifact in self.trackerDict: ! # handling other variations is left as an exercise for the reader ! if self.trackerDict[artifact]['status'] == 'Open': ! topics.append(artifact + TOPIC_SEPARATOR + self.trackerDict[artifact]['summary']) ! topics.sort() ! self.components.topicList.clear() ! for t in topics: ! self.components.topicList.append(t) ! except: ! self.components.topicList.clear() self.status('') --- 105,132 ---- fp.close() return xml ! except IOError: return '' def displayTopics(self, group, category): + self.components.topicList.clear() filename = self.buildFilename(group, category) ! if not os.path.exists(filename): ! url = self.buildUrl(group, category) ! #print "downloading", filename, url ! self.downloadFile(url, filename) ! xml = self.loadXML(group, category) ! self.status('Parsing XML...') ! self.trackerDict = doParse(xml) ! self.status('Display Topics...') ! topics = [] ! for artifact in self.trackerDict: ! # handling other variations is left as an exercise for the reader ! if self.trackerDict[artifact]['status'] == 'Open': ! topics.append(artifact + TOPIC_SEPARATOR + self.trackerDict[artifact]['summary']) ! topics.sort() ! self.components.topicList.clear() ! for t in topics: ! self.components.topicList.append(t) self.status('') *************** *** 152,156 **** op.close() #print "wrote", filename ! except: pass # show a warning dialog one of these days --- 148,152 ---- op.close() #print "wrote", filename ! except IOError: pass # show a warning dialog one of these days |
From: Andy T. <an...@us...> - 2005-12-13 11:13:51
|
Update of /cvsroot/pythoncard/PythonCard/samples/mp3player In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/mp3player Modified Files: mp3player.py Log Message: Removed all of the plain except: clauses I could Index: mp3player.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/mp3player/mp3player.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mp3player.py 12 Aug 2004 19:18:54 -0000 1.3 --- mp3player.py 13 Dec 2005 11:13:23 -0000 1.4 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import dialog, model --- 2,9 ---- """ + We should try and make this work on platforms other than the Mac. + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import dialog, model *************** *** 15,23 **** # this is only going to work on the Mac # so it will need to be generalized later ! try: ! home = os.environ['HOME'] ! self.buildList(os.path.join(home, 'Music/iTunes/iTunes Music')) ! except: ! pass # http://www.pygame.org/docs/ref/Movie.html --- 16,21 ---- # this is only going to work on the Mac # so it will need to be generalized later ! home = os.environ['HOME'] ! self.buildList(os.path.join(home, 'Music/iTunes/iTunes Music')) # http://www.pygame.org/docs/ref/Movie.html *************** *** 31,39 **** path = result.paths[0] self.components.filename.text = path - def on_play_mouseClick(self, event): filename = self.components.filename.text - ## NOTE WE DON'T IMPORT PYGAME UNTIL NOW. Don't put "import pygame" at the top of the file. import pygame --- 29,35 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:13:51
|
Update of /cvsroot/pythoncard/PythonCard/samples/saveClipboardBitmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/saveClipboardBitmap Modified Files: saveClipboardBitmap.py Log Message: Removed all of the plain except: clauses I could Index: saveClipboardBitmap.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/saveClipboardBitmap/saveClipboardBitmap.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** saveClipboardBitmap.py 12 Aug 2004 19:18:58 -0000 1.17 --- saveClipboardBitmap.py 13 Dec 2005 11:13:24 -0000 1.18 *************** *** 56,60 **** if not isinstance(self.bmp, wx.Bitmap): return - if self.filename is None: path = '' --- 56,59 ---- *************** *** 62,66 **** else: path, filename = os.path.split(self.filename) - # wxPython can't save GIF due to the license issues # but we can save most other formats, so this list can be expanded --- 61,64 ---- *************** *** 75,83 **** #print fileType, path self.filename = path ! try: ! self.bmp.SaveFile(path, fileType) ! return True ! except: ! return False else: return False --- 73,78 ---- #print fileType, path self.filename = path ! self.bmp.SaveFile(path, fileType) ! return True else: return False |
From: Andy T. <an...@us...> - 2005-12-13 11:13:51
|
Update of /cvsroot/pythoncard/PythonCard/samples/lsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/lsystem Modified Files: lsystem.py lsystemInteractive.py Log Message: Removed all of the plain except: clauses I could Index: lsystem.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/lsystem/lsystem.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lsystem.py 12 Aug 2004 19:18:54 -0000 1.5 --- lsystem.py 13 Dec 2005 11:13:23 -0000 1.6 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import clipboard, dialog, graphic, model --- 2,9 ---- """ + A fractal display program using the Lindenmayer rule system to describe the fractal. + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import clipboard, dialog, graphic, model *************** *** 144,152 **** fileType = graphic.bitmapType(path) print fileType, path try: - bmp = self.components.bufOff.getBitmap() bmp.SaveFile(path, fileType) return True ! except: return False else: --- 145,153 ---- fileType = graphic.bitmapType(path) print fileType, path + bmp = self.components.bufOff.getBitmap() try: bmp.SaveFile(path, fileType) return True ! except IOError: return False else: *************** *** 204,222 **** class LSystemTests(pyunit.TestCase): ! def setUp(self): ! pass ! ! def tearDown(self): ! pass ! ! def testBoundsCheckBackwardMoves(self): ! bounds = drawAbstractFractal('BB+B', 1, 90, (10.0,20.0)) ! # remember that down is positive in this coordinate system ! self.assertEqual([9.0, 20.0, 10.0, 22.0], bounds) ! ! def testBoundsCheckForwardMoves(self): ! bounds = drawAbstractFractal('FF-F', 1, 90, (10.0,20.0)) ! # remember that down is positive in this coordinate system ! self.assertEqual([9.0, 18.0, 10.0, 20.0], bounds) if __name__ == '__main__': --- 205,220 ---- class LSystemTests(pyunit.TestCase): ! def setUp(self): ! pass ! def tearDown(self): ! pass ! def testBoundsCheckBackwardMoves(self): ! bounds = drawAbstractFractal('BB+B', 1, 90, (10.0,20.0)) ! # remember that down is positive in this coordinate system ! self.assertEqual([9.0, 20.0, 10.0, 22.0], bounds) ! def testBoundsCheckForwardMoves(self): ! bounds = drawAbstractFractal('FF-F', 1, 90, (10.0,20.0)) ! # remember that down is positive in this coordinate system ! self.assertEqual([9.0, 18.0, 10.0, 20.0], bounds) if __name__ == '__main__': Index: lsystemInteractive.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/lsystem/lsystemInteractive.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lsystemInteractive.py 22 May 2004 01:05:29 -0000 1.2 --- lsystemInteractive.py 13 Dec 2005 11:13:23 -0000 1.3 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import clipboard, dialog, graphic, model --- 2,9 ---- """ + A fractal display program using the Lindenmayer rule system to describe the fractal. + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import clipboard, dialog, graphic, model *************** *** 47,51 **** int(self.components.angleDisplay.text) self.on_Render_command(None) ! except: pass --- 48,52 ---- int(self.components.angleDisplay.text) self.on_Render_command(None) ! except ValueError: pass |
From: Andy T. <an...@us...> - 2005-12-13 11:13:51
|
Update of /cvsroot/pythoncard/PythonCard/samples/pictureViewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/pictureViewer Modified Files: pictureViewer.py Log Message: Removed all of the plain except: clauses I could Index: pictureViewer.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/pictureViewer/pictureViewer.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** pictureViewer.py 15 Aug 2004 17:34:57 -0000 1.24 --- pictureViewer.py 13 Dec 2005 11:13:24 -0000 1.25 *************** *** 146,150 **** scale = float(result.text) / 100.0 self.displayFileScaled(scale, scale) ! except: pass --- 146,150 ---- scale = float(result.text) / 100.0 self.displayFileScaled(scale, scale) ! except ValueError: pass *************** *** 163,167 **** tags=EXIF.process_file(f) f.close() ! try: # the repr() is something like # (0x0112) Short=8 @ 54 --- 163,167 ---- tags=EXIF.process_file(f) f.close() ! if tags.has_key('Image Orientation'): # the repr() is something like # (0x0112) Short=8 @ 54 *************** *** 171,175 **** #print 'Image Orientation: %d' % orientation #print 'Thumbnail Orientation: %s' % tags['Thumbnail Orientation'] ! except: orientation = 1 --- 171,175 ---- #print 'Image Orientation: %d' % orientation #print 'Thumbnail Orientation: %s' % tags['Thumbnail Orientation'] ! else: orientation = 1 *************** *** 217,221 **** bmp.SaveFile(path, fileType) return True ! except: return False else: --- 217,221 ---- bmp.SaveFile(path, fileType) return True ! except IOError: return False else: |
From: Andy T. <an...@us...> - 2005-12-13 11:13:49
|
Update of /cvsroot/pythoncard/PythonCard/samples/life In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/life Modified Files: lexicon.py life.py patterns.py util.py Log Message: Removed all of the plain except: clauses I could Index: lexicon.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/life/lexicon.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** lexicon.py 28 Sep 2004 05:08:54 -0000 1.18 --- lexicon.py 13 Dec 2005 11:13:23 -0000 1.19 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import model, util --- 2,9 ---- """ + A fairly simple implementation of Conway's Game of Life. + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import model, util *************** *** 37,95 **** data = fp.readlines() fp.close() ! ! lexicon = {} ! # first collect the header ! # up to the first row of ! # ------ ! # then collect the definitions and patterns ! # and finally the bibliography after ! # the second row of ! # ----- ! inIntroduction = 1 ! inBibliography = 0 ! bibliography = '' ! introduction = '' ! term = '' ! for line in data: ! stripped = line.strip() ! if inIntroduction: ! if line.startswith('-----'): ! inIntroduction = 0 ! else: ! introduction += line ! elif inBibliography: ! bibliography += line else: ! if line.startswith('-----'): ! inBibliography = 1 else: ! # collecting an entry ! if stripped == '': ! continue ! elif stripped.startswith(':'): ! # start of new term ! if term != '': ! lexicon[term] = (description, pattern) ! offset = stripped.find(':', 1) ! term = stripped[1:offset] ! description = stripped[offset + 1:].lstrip() ! #crud, term, description = stripped.split(':') ! pattern = '' ! elif stripped.startswith('.') or stripped.startswith('*'): ! pattern += stripped + '\n' else: ! if line.startswith(' '): ! description += '\n\n' + stripped ! else: ! description += '\n' + stripped ! ! if term != '': ! lexicon[term] = (description, pattern) ! lexicon['INTRODUCTION'] = (introduction, '') ! lexicon['BIBLIOGRAPHY'] = (bibliography, '') ! #print len(lexicon) ! return lexicon ! except: ! return None class Lexicon(model.Background): --- 38,94 ---- data = fp.readlines() fp.close() ! except IOError: ! return None ! lexicon = {} ! # first collect the header ! # up to the first row of ! # ------ ! # then collect the definitions and patterns ! # and finally the bibliography after ! # the second row of ! # ----- ! inIntroduction = 1 ! inBibliography = 0 ! bibliography = '' ! introduction = '' ! term = '' ! for line in data: ! stripped = line.strip() ! if inIntroduction: ! if line.startswith('-----'): ! inIntroduction = 0 else: ! introduction += line ! elif inBibliography: ! bibliography += line ! else: ! if line.startswith('-----'): ! inBibliography = 1 ! else: ! # collecting an entry ! if stripped == '': ! continue ! elif stripped.startswith(':'): ! # start of new term ! if term != '': ! lexicon[term] = (description, pattern) ! offset = stripped.find(':', 1) ! term = stripped[1:offset] ! description = stripped[offset + 1:].lstrip() ! #crud, term, description = stripped.split(':') ! pattern = '' ! elif stripped.startswith('.') or stripped.startswith('*'): ! pattern += stripped + '\n' else: ! if line.startswith(' '): ! description += '\n\n' + stripped else: ! description += '\n' + stripped ! if term != '': ! lexicon[term] = (description, pattern) ! lexicon['INTRODUCTION'] = (introduction, '') ! lexicon['BIBLIOGRAPHY'] = (bibliography, '') ! #print len(lexicon) ! return lexicon class Lexicon(model.Background): *************** *** 120,145 **** #filename = name + '.lif' #path = os.path.join(self.application.applicationDirectory, 'patterns', filename) ! try: ! description, patternString = self.lexicon[name] ! if patternString != '': ! crud, patterns, topLeft, size = translateClipboardPattern(patternString) ! #print "topLeft:", topLeft, "size", size ! self.getParent().initAndPlacePatterns(patterns, topLeft, size) ! except: ! pass def on_lstPatterns_select(self, event): name = self.components.lstPatterns.stringSelection ! try: ! description, patternString = self.lexicon[name] ! if patternString == '': ! self.components.fldDescription.text = description ! self.components.stcSize.text = "" ! else: ! crud, patterns, topLeft, size = translateClipboardPattern(patternString) ! self.components.fldDescription.text = description + "\n\n" + patternString ! self.components.stcSize.text = "Size: (%d, %d)" % size ! except: ! pass def on_btnLoad_mouseClick(self, event): --- 119,138 ---- #filename = name + '.lif' #path = os.path.join(self.application.applicationDirectory, 'patterns', filename) ! description, patternString = self.lexicon[name] ! if patternString != '': ! crud, patterns, topLeft, size = translateClipboardPattern(patternString) ! #print "topLeft:", topLeft, "size", size ! self.getParent().initAndPlacePatterns(patterns, topLeft, size) def on_lstPatterns_select(self, event): name = self.components.lstPatterns.stringSelection ! description, patternString = self.lexicon[name] ! if patternString == '': ! self.components.fldDescription.text = description ! self.components.stcSize.text = "" ! else: ! crud, patterns, topLeft, size = translateClipboardPattern(patternString) ! self.components.fldDescription.text = description + "\n\n" + patternString ! self.components.stcSize.text = "Size: (%d, %d)" % size def on_btnLoad_mouseClick(self, event): Index: life.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/life/life.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** life.py 10 Oct 2004 01:20:21 -0000 1.47 --- life.py 13 Dec 2005 11:13:23 -0000 1.48 *************** *** 9,13 **** import psyco psyco.full() ! except: pass --- 9,13 ---- import psyco psyco.full() ! except ImportError: pass *************** *** 67,74 **** basePath = self.application.applicationDirectory self.lexiconPath = os.path.join(self.configPath, 'lexicon.txt') ! try: ! if not os.path.exists(self.lexiconPath): ! shutil.copy2(os.path.join(basePath, 'lexicon.txt'), self.lexiconPath) ! except: # currently lexicon.txt is not part of the distribution # but it might be in the future --- 67,73 ---- basePath = self.application.applicationDirectory self.lexiconPath = os.path.join(self.configPath, 'lexicon.txt') ! if not os.path.exists(self.lexiconPath) and os.path.exists(os.path.join(basePath, 'lexicon.txt')): ! shutil.copy2(os.path.join(basePath, 'lexicon.txt'), self.lexiconPath) ! else: # currently lexicon.txt is not part of the distribution # but it might be in the future *************** *** 364,368 **** bmp.SaveFile(path, fileType) return True ! except: return False else: --- 363,367 ---- bmp.SaveFile(path, fileType) return True ! except IOError: return False else: Index: util.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/life/util.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** util.py 28 Sep 2004 05:00:26 -0000 1.10 --- util.py 13 Dec 2005 11:13:23 -0000 1.11 *************** *** 56,101 **** data = fp.readlines() fp.close() ! ! if data[0].strip() != '#Life 1.05': ! return None ! ! for line in data[1:]: ! s = line.strip() ! if s == '': ! pass ! elif s.startswith('#N') or s.startswith('#R'): ! # assume Conway (Normal) rules for now ! pass ! elif s.startswith('#D'): ! if description == '': ! description = s[3:].strip() ! else: ! description += "\n" + s[3:].strip() ! elif s.startswith('#P'): ! # beginning of a cell block ! if pattern != {}: ! pattern['size'] = (width, height) ! patterns.append(pattern.copy()) ! x, y = s[3:].split(' ') ! width = 0 ! height = 0 ! pattern = {} ! pattern['position'] = (int(x), int(y)) ! pattern['rows'] = [] ! else: ! pattern['rows'].append(s) ! if len(s) > width: ! width = len(s) ! height += 1 ! if pattern != {}: ! pattern['size'] = (width, height) ! patterns.append(pattern.copy()) ! ! left, top, right, bottom = patternDimensions(patterns) ! #print "bounds", left, top, right, bottom ! #print "size", abs(right - left), abs(bottom - top) ! return description, patterns, (left, top), (abs(right - left), abs(bottom - top)) ! except: return None """ --- 56,98 ---- data = fp.readlines() fp.close() ! except IOError: ! return None ! if data[0].strip() != '#Life 1.05': return None + for line in data[1:]: + s = line.strip() + if s == '': + pass + elif s.startswith('#N') or s.startswith('#R'): + # assume Conway (Normal) rules for now + pass + elif s.startswith('#D'): + if description == '': + description = s[3:].strip() + else: + description += "\n" + s[3:].strip() + elif s.startswith('#P'): + # beginning of a cell block + if pattern != {}: + pattern['size'] = (width, height) + patterns.append(pattern.copy()) + x, y = s[3:].split(' ') + width = 0 + height = 0 + pattern = {} + pattern['position'] = (int(x), int(y)) + pattern['rows'] = [] + else: + pattern['rows'].append(s) + if len(s) > width: + width = len(s) + height += 1 + if pattern != {}: + pattern['size'] = (width, height) + patterns.append(pattern.copy()) + left, top, right, bottom = patternDimensions(patterns) + #print "bounds", left, top, right, bottom + #print "size", abs(right - left), abs(bottom - top) + return description, patterns, (left, top), (abs(right - left), abs(bottom - top)) """ *************** *** 144,152 **** description += "\n" + s else: ! try: ! s, desc = s.split(' ') ! description += "\n" + desc ! except: ! pass # beginning of a cell block if pattern == {}: --- 141,146 ---- description += "\n" + s else: ! s, desc = s.split(' ') ! description += "\n" + desc # beginning of a cell block if pattern == {}: Index: patterns.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/life/patterns.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** patterns.py 28 Sep 2004 05:08:54 -0000 1.17 --- patterns.py 13 Dec 2005 11:13:23 -0000 1.18 *************** *** 2,8 **** """ ! __version__ = "$Revision$" ! __date__ = "$Date$" """ from PythonCard import model --- 2,9 ---- """ ! _A fairly simple implementation of Conway's Game of Life. """ + _version__ = "$Revision$" + __date__ = "$Date$" from PythonCard import model *************** *** 55,78 **** def loadPattern(self, name): ! try: ! path = self.files[name] ! #print num, path ! description, patterns, topLeft, size = readLifeFile(path) ! #print "topLeft:", topLeft, "size", size ! self.GetParent().initAndPlacePatterns(patterns, topLeft, size) ! except: ! pass def on_lstPatterns_select(self, event): path = self.files[self.components.lstPatterns.stringSelection] ! try: ! description, patterns, topLeft, size = readLifeFile(path) ! self.description = description ! self.patterns = patterns ! self.patternSize = size ! self.components.fldDescription.text = description ! self.components.stcSize.text = "Size: (%d, %d)" % size ! except: ! pass def on_btnLoad_mouseClick(self, event): --- 56,73 ---- def loadPattern(self, name): ! path = self.files[name] ! #print num, path ! description, patterns, topLeft, size = readLifeFile(path) ! #print "topLeft:", topLeft, "size", size ! self.GetParent().initAndPlacePatterns(patterns, topLeft, size) def on_lstPatterns_select(self, event): path = self.files[self.components.lstPatterns.stringSelection] ! description, patterns, topLeft, size = readLifeFile(path) ! self.description = description ! self.patterns = patterns ! self.patternSize = size ! self.components.fldDescription.text = description ! self.components.stcSize.text = "Size: (%d, %d)" % size def on_btnLoad_mouseClick(self, event): |
From: Andy T. <an...@us...> - 2005-12-13 11:13:49
|
Update of /cvsroot/pythoncard/PythonCard/samples/searchexplorer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/searchexplorer Modified Files: searchexplorer.py Log Message: Removed all of the plain except: clauses I could Index: searchexplorer.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/searchexplorer/searchexplorer.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** searchexplorer.py 10 May 2004 00:45:21 -0000 1.34 --- searchexplorer.py 13 Dec 2005 11:13:25 -0000 1.35 *************** *** 2,22 **** """ - KEA notes to myself - - __version__ = "$Revision$" - __date__ = "$Date$" - __author__ = "Kevin Altis <al...@se...>" - App Name: SearchExplorer Created: 2001-07-21 Description: The first useful application using the PythonCard prototype. - I really need to learn to do doc strings correctly! Are there additional - standard doc string identifiers for the creation date, how about strings - for all the different @ names you can do in javadoc? - - use of __init__ will go away as soon as there is a doMeFirst, openStack, - openBackground message fired when the application starts up - List widget needs to support selections by number rather than just by string List widget needs to support more methods for inserting, appending, clearing, etc. --- 2,9 ---- *************** *** 72,75 **** --- 59,65 ---- """ + __version__ = "$Revision$" + __date__ = "$Date$" + __author__ = "Kevin Altis <al...@se...>" import urllib *************** *** 77,81 **** import pprint ! from PythonCard import configuration, dialog, model, util import os, sys import shutil --- 67,71 ---- import pprint ! from PythonCard import configuration, dialog, model, util, log import os, sys import shutil *************** *** 86,89 **** --- 76,80 ---- def on_initialize(self, event): + self.changed = 0 wFldSearch = self.components.fldSearch # copy the clipboard to fldSearch when the app starts *************** *** 101,115 **** basePath = self.application.applicationDirectory self.sfFilename = os.path.join(self.configPath, FAVORITES_FILE) if not os.path.exists(self.sfFilename): ! shutil.copy2(os.path.join(basePath, FAVORITES_FILE), self.sfFilename) ! ! try: ! #self.sitesDict = eval(open(self.sfFilename).read()) self.sitesDict = util.readAndEvalFile(self.sfFilename) - except: - dialog.messageDialog(self, 'Unable to load ' + self.sfFilename, 'SearchExplorer exiting') - sys.exit() - - self.changed = 0 defaultSite = 'Google' --- 92,103 ---- basePath = self.application.applicationDirectory self.sfFilename = os.path.join(self.configPath, FAVORITES_FILE) + log.debug('Favourites are in %s' % self.sfFilename) if not os.path.exists(self.sfFilename): ! try: ! shutil.copy2(os.path.join(basePath, FAVORITES_FILE), self.sfFilename) ! except IOError: ! dialog.messageDialog(self, 'Unable to load ' + self.sfFilename, 'SearchExplorer exiting') ! sys.exit() self.sitesDict = util.readAndEvalFile(self.sfFilename) defaultSite = 'Google' *************** *** 143,154 **** # to simulate transparent saves if self.changed: ! try: ! f = open(self.sfFilename, "w") ! #s = repr(self.sitesDict) ! #f.write(s) ! pprint.pprint(self.sitesDict, f) ! f.close() ! except: ! pass # argh def doLaunch(self): --- 131,139 ---- # to simulate transparent saves if self.changed: ! f = open(self.sfFilename, "w") ! #s = repr(self.sitesDict) ! #f.write(s) ! pprint.pprint(self.sitesDict, f) ! f.close() def doLaunch(self): *************** *** 206,214 **** site = self.components.listSites.stringSelection pastSearches = self.sitesDict[site]['pastSearches'] ! try: ! pastSearches.remove(doomed) # update self.sitesDict[site]['pastSearches'] ! self.changed = 1 ! except: ! pass wListPastSearches.items = pastSearches --- 191,196 ---- site = self.components.listSites.stringSelection pastSearches = self.sitesDict[site]['pastSearches'] ! pastSearches.remove(doomed) # update self.sitesDict[site]['pastSearches'] ! self.changed = 1 wListPastSearches.items = pastSearches *************** *** 249,256 **** else: ins = widget.getInsertionPoint() ! try: ! widget.replace(ins, ins + 1, '') ! except: ! pass def on_menuEditSelectAll_select(self, event): --- 231,235 ---- else: ins = widget.getInsertionPoint() ! widget.replace(ins, ins + 1, '') def on_menuEditSelectAll_select(self, event): |
From: Andy T. <an...@us...> - 2005-12-13 11:13:47
|
Update of /cvsroot/pythoncard/PythonCard/samples/slideshow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/slideshow Modified Files: slideshow.py Log Message: Removed all of the plain except: clauses I could Index: slideshow.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/slideshow/slideshow.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** slideshow.py 15 Aug 2004 17:34:58 -0000 1.42 --- slideshow.py 13 Dec 2005 11:13:25 -0000 1.43 *************** *** 6,13 **** """ ! from PythonCard import dialog, graphic, log, model, timer, util import wx import os, sys - from PythonCard import EXIF import zipfile from cStringIO import StringIO --- 6,12 ---- """ ! from PythonCard import dialog, graphic, log, model, timer, util, EXIF import wx import os, sys import zipfile from cStringIO import StringIO *************** *** 63,67 **** self.components.htmlView.enabled = 0 - # this is the code from pictureViewer # instead of a file argument, slideshow --- 62,65 ---- *************** *** 101,108 **** self.displayNextFile() - # need to enable keyPresses - # for backgrounds without a component that accepts - # keyPresses def on_keyPress(self, event): keyCode = event.GetKeyCode() #print keyCode --- 99,105 ---- self.displayNextFile() def on_keyPress(self, event): + # need to enable keyPresses + # for backgrounds without a component that accepts keyPresses keyCode = event.GetKeyCode() #print keyCode *************** *** 123,128 **** self.displayFile() - # always display the file limited to the current size of buffer def displayFile(self): if self.filename is not None: if htmlFile(self.filename): --- 120,125 ---- self.displayFile() def displayFile(self): + # always display the file limited to the current size of buffer if self.filename is not None: if htmlFile(self.filename): *************** *** 177,257 **** def openFile(self, path, slideNumber=None): - if self.zip: - self.openFileInZip(path, slideNumber) - return - - if not os.path.exists(path): - return - - self.filename = path - if htmlFile(path): - title = os.path.split(self.filename)[-1] - else: - f = open(path, 'rb') - tags = EXIF.process_file(f) - f.close() - try: - # the repr() is something like - # (0x0112) Short=8 @ 54 - # but the str() is just 1, 8, etc. - orientation = int(str(tags['Image Orientation'])) - #print path - #print 'Image Orientation: %d' % orientation - #print 'Thumbnail Orientation: %s' % tags['Thumbnail Orientation'] - except: - orientation = 1 - - self.bmp = graphic.Bitmap(self.filename) - if orientation == 8: - # need to rotate the image - # defaults to clockwise, 0 means counter-clockwise - #print "rotating" - self.bmp.rotate90(0) - elif orientation == 6: - self.bmp.rotate90(1) - - size = self.bmp.getSize() - title = os.path.split(self.filename)[-1] + " %d x %d" % size - - if slideNumber is not None: - title = title + " Slide: %d of %d" % (slideNumber + 1, len(self.fileList)) - self.title = title - self.displayFile() - - def openFileInZip(self, path, slideNumber=None): self.filename = path ! if htmlFile(path): title = os.path.split(self.filename)[-1] else: ! ##info = self.zip.NameToInfo[path] ! data = self.zip.read(path) ! tags = EXIF.process_file(StringIO(data)) ! #f = open(path, 'rb') ! #tags=EXIF.process_file(f) ! #f.close() ! try: # the repr() is something like # (0x0112) Short=8 @ 54 # but the str() is just 1, 8, etc. orientation = int(str(tags['Image Orientation'])) ! #print path ! #print 'Image Orientation: %d' % orientation ! #print 'Thumbnail Orientation: %s' % tags['Thumbnail Orientation'] ! except: orientation = 1 ! ! self.bmp = graphic.Bitmap() ! self.bmp.setImageBits(wx.ImageFromStream(StringIO(data))) if orientation == 8: # need to rotate the image # defaults to clockwise, 0 means counter-clockwise - #print "rotating" self.bmp.rotate90(0) elif orientation == 6: self.bmp.rotate90(1) - size = self.bmp.getSize() title = os.path.split(self.filename)[-1] + " %d x %d" % size - if slideNumber is not None: title = title + " Slide: %d of %d" % (slideNumber + 1, len(self.fileList)) --- 174,213 ---- def openFile(self, path, slideNumber=None): self.filename = path ! if htmlFile(self.filename): title = os.path.split(self.filename)[-1] else: ! if self.zip: ! data = self.zip.read(self.filename) ! tags = EXIF.process_file(StringIO(data)) ! log.debug("Getting %s from zip file" % self.filename) ! self.bmp = graphic.Bitmap() ! self.bmp.setImageBits(wx.ImageFromStream(StringIO(data))) ! else: ! if not os.path.exists(self.filename): ! return ! f = open(self.filename, 'rb') ! tags = EXIF.process_file(f) ! f.close() ! log.debug("Getting %s from file" % self.filename) ! self.bmp = graphic.Bitmap(self.filename) ! if tags.has_key('Image Orientation'): # the repr() is something like # (0x0112) Short=8 @ 54 # but the str() is just 1, 8, etc. orientation = int(str(tags['Image Orientation'])) ! else: orientation = 1 ! log.debug('Image Orientation: %d' % orientation) ! if tags.has_key('Thumbnail Orientation'): ! log.debug('Thumbnail Orientation: %s' % tags['Thumbnail Orientation']) if orientation == 8: # need to rotate the image # defaults to clockwise, 0 means counter-clockwise self.bmp.rotate90(0) elif orientation == 6: self.bmp.rotate90(1) size = self.bmp.getSize() title = os.path.split(self.filename)[-1] + " %d x %d" % size if slideNumber is not None: title = title + " Slide: %d of %d" % (slideNumber + 1, len(self.fileList)) *************** *** 262,266 **** if self.fileList is None: return - index = self.fileIndex + 1 if self.loop and index == len(self.fileList): --- 218,221 ---- *************** *** 297,301 **** interval = int(result.text) * 1000 self.interval = interval ! except: pass --- 252,256 ---- interval = int(result.text) * 1000 self.interval = interval ! except ValueError: pass *************** *** 306,310 **** f.close() self.fileList = txt.splitlines() ! except: pass --- 261,265 ---- f.close() self.fileList = txt.splitlines() ! except IOError: pass *************** *** 313,316 **** --- 268,272 ---- self.directory = path fileList = util.dirwalk(path, ['*'], recurse) + log.debug('Directory file list: %s' % fileList) # self.fileList should be filtered here self.fileList = [] *************** *** 318,331 **** for path in fileList: if imageFile(path) or htmlFile(path): - #print "path", path self.fileList.append(path) self.fileList = util.caseinsensitive_sort(self.fileList) def buildFileListFromZip(self, path): - #print path self.zip = zipfile.ZipFile(path) - #print self.zip.namelist() self.directory = None fileList = self.zip.namelist() # self.fileList should be filtered here self.fileList = [] --- 274,285 ---- for path in fileList: if imageFile(path) or htmlFile(path): self.fileList.append(path) self.fileList = util.caseinsensitive_sort(self.fileList) def buildFileListFromZip(self, path): self.zip = zipfile.ZipFile(path) self.directory = None fileList = self.zip.namelist() + log.debug('Zip file list: %s' % fileList) # self.fileList should be filtered here self.fileList = [] *************** *** 337,344 **** if ext in ['bmp', 'gif', 'jpeg', 'jpg', 'pcx', 'png', 'pnm', 'tif', 'tiff', 'xbm', 'xpm']: - #if imageFile(f) or htmlFile(f): - #print "path", path self.fileList.append(f) - #print self.fileList def on_menuSlideshowChooseZip_select(self, event): --- 291,295 ---- *************** *** 418,422 **** self.fileIndex = n self.openFile(self.fileList[self.fileIndex], self.fileIndex) ! except: pass --- 369,373 ---- self.fileIndex = n self.openFile(self.fileList[self.fileIndex], self.fileIndex) ! except ValueError: pass *************** *** 440,453 **** path = self.fileList[self.fileIndex] if imageFile(path): ! #print "image", path try: - viewer = os.path.abspath(os.path.join('..', 'pictureViewer', 'pictureViewer.py')) - if " " in path: - path = '"' + path + '"' util.runScript(viewer, path) ! except: pass elif htmlFile(path): ! #print "html", path import webbrowser webbrowser.open(path, 1, 1) --- 391,404 ---- path = self.fileList[self.fileIndex] if imageFile(path): ! log.debug("image: %s" % path) ! viewer = os.path.abspath(os.path.join('..', 'pictureViewer', 'pictureViewer.py')) ! if " " in path: ! path = '"' + path + '"' try: util.runScript(viewer, path) ! except: # Fail gracefully if displaying fails pass elif htmlFile(path): ! log.debug("html: %s" % path) import webbrowser webbrowser.open(path, 1, 1) *************** *** 458,462 **** event.skip() - if __name__ == '__main__': app = model.Application(SlideShow) --- 409,412 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:13:47
|
Update of /cvsroot/pythoncard/PythonCard/samples/moderator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/moderator Modified Files: moderator.py Log Message: Removed all of the plain except: clauses I could Index: moderator.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/moderator/moderator.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** moderator.py 30 Aug 2004 14:49:51 -0000 1.8 --- moderator.py 13 Dec 2005 11:13:23 -0000 1.9 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ import sys --- 2,13 ---- """ + Moderator, as you may have guessed, is a moderation tool. + + As someone raises their hand to speak, the moderator clicks their name and it goes on the list of people waiting to speak, in order. When someone is speaking, they have a certain number of minutes to speak. It works best when there's a projector, so everyone can see they're on the list and the speaker can see how much time they have left. + + Contributed to the PythonCard community 4/23/2004 by Bruce Eckel + """ __version__ = "$Revision$" __date__ = "$Date$" import sys *************** *** 18,22 **** self.clockTimer = timer.Timer(self.components.txtTime, -1) self.clockModel = CountdownClockModel(MAX_TIME) - self.delegates = ModeratorModel() if len(sys.argv) > 1: --- 23,26 ---- *************** *** 26,37 **** try: lines = open(fname).readlines() ! except: lines = [] - - for delegate in lines: if delegate.strip(): self.delegates.add(delegate.strip()) - self.update() --- 30,38 ---- try: lines = open(fname).readlines() ! except IOError: lines = [] for delegate in lines: if delegate.strip(): self.delegates.add(delegate.strip()) self.update() *************** *** 95,99 **** self.update() - class CountdownClockModel: def __init__(self, max): --- 96,99 ---- |
From: Andy T. <an...@us...> - 2005-12-13 11:13:45
|
Update of /cvsroot/pythoncard/PythonCard/samples/rpn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/rpn Modified Files: rpn.py Log Message: Removed all of the plain except: clauses I could Index: rpn.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/rpn/rpn.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** rpn.py 9 May 2004 19:46:24 -0000 1.9 --- rpn.py 13 Dec 2005 11:13:24 -0000 1.10 *************** *** 135,139 **** try: self.readme = open('RPN.about.txt').read() ! except: self.readme = 'RPN.about.txt not found' dlg = dialog.ScrolledMessageDialog(self, self.readme, 'About RPN Calc ...') --- 135,139 ---- try: self.readme = open('RPN.about.txt').read() ! except IOError: self.readme = 'RPN.about.txt not found' dlg = dialog.ScrolledMessageDialog(self, self.readme, 'About RPN Calc ...') *************** *** 142,146 **** try: self.readme = open('RPN.help.txt').read() ! except: self.readme = 'RPN.help.txt not found' dlg = dialog.ScrolledMessageDialog(self, self.readme, 'RPN Calc Help ...') --- 142,146 ---- try: self.readme = open('RPN.help.txt').read() ! except IOError: self.readme = 'RPN.help.txt not found' dlg = dialog.ScrolledMessageDialog(self, self.readme, 'RPN Calc Help ...') |
From: Andy T. <an...@us...> - 2005-12-13 11:13:45
|
Update of /cvsroot/pythoncard/PythonCard/samples/fpop In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/fpop Modified Files: emailfilter.py fpop.py fpoputil.py message.py preview.py Log Message: Removed all of the plain except: clauses I could Index: preview.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/fpop/preview.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** preview.py 12 Aug 2004 19:18:52 -0000 1.22 --- preview.py 13 Dec 2005 11:13:23 -0000 1.23 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ from PythonCard import dialog, log, model --- 2,11 ---- """ + This is intended as a sample for the MultiColumnList some day, though it's heavy on straight wxPython right now + + Goal: imitate the Windows utility "nPOP" (hence the temporary code name), with the following differences : + """ __version__ = "$Revision$" __date__ = "$Date$" from PythonCard import dialog, log, model *************** *** 155,163 **** print self.attachments[n] ## get_payload isn't working for some reason ! try: ! payload = self.msg.get_payload(partNumber, decode=1) ! print len(payload) ! except: ! print "ugh, get_payload partNumber didn't work" # but walking manually does?! --- 158,163 ---- print self.attachments[n] ## get_payload isn't working for some reason ! payload = self.msg.get_payload(partNumber, decode=1) ! print len(payload) # but walking manually does?! *************** *** 200,208 **** text = fpoputil.getBody(msg) ! try: ! comp.fldBody.text = text ! except: ! print "something went wrong with getting the text" ! print text self.attachments = fpoputil.getAttachments(msg) --- 200,204 ---- text = fpoputil.getBody(msg) ! comp.fldBody.text = text self.attachments = fpoputil.getAttachments(msg) Index: message.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/fpop/message.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** message.py 12 Aug 2004 19:18:52 -0000 1.17 --- message.py 13 Dec 2005 11:13:23 -0000 1.18 *************** *** 62,69 **** text = fpoputil.getBody(msg) ! try: ! comp.fldBody.text = text ! except: ! print text def on_menuFileClose_select(self, event): --- 62,66 ---- text = fpoputil.getBody(msg) ! comp.fldBody.text = text def on_menuFileClose_select(self, event): *************** *** 76,86 **** def on_send_command(self, event): comp = self.components ! try: references = self.msg['references'] ! except: references = None ! try: inReplyTo = self.msg['in-reply-to'] ! except: inReplyTo = None --- 73,83 ---- def on_send_command(self, event): comp = self.components ! if self.msg.has_key('references'): references = self.msg['references'] ! else: references = None ! if self.msg.has_key('in-reply-to'): inReplyTo = self.msg['in-reply-to'] ! else: inReplyTo = None Index: fpop.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/fpop/fpop.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** fpop.py 30 Aug 2004 14:42:47 -0000 1.48 --- fpop.py 13 Dec 2005 11:13:23 -0000 1.49 *************** *** 287,291 **** # Nothing to resize return - listWidth = listX.GetSize().width if listX.GetItemCount() > listX.GetCountPerPage(): --- 287,290 ---- *************** *** 293,301 **** scrollWidth = wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X) listWidth = listWidth - scrollWidth - totColWidth = 0 # Sum width of columns index, date & size (after auto-sizing) for col in (0, 3,4): totColWidth = totColWidth + listX.GetColumnWidth(col) - # allow for platform-dependant number of extra pixels for correct sizing. Highly empirical. if wx.Platform == '__WXMSW__': --- 292,298 ---- *************** *** 305,309 **** else: margin = 0 - # Resize the subject & sender columns to take up the remaining available space (60/40 ratio) leftover = listWidth - totColWidth - margin --- 302,305 ---- *************** *** 311,321 **** listX.SetColumnWidth(2, int(leftover * .4)) - def on_btnExit_mouseClick(self, event): self.close() - # this doesn't really process the blacklist - # just dumps the msgs so we can debug what we have def doProcessBlacklist(self): for key, value in self.msgs.iteritems(): print "key", key --- 307,316 ---- listX.SetColumnWidth(2, int(leftover * .4)) def on_btnExit_mouseClick(self, event): self.close() def doProcessBlacklist(self): + # this doesn't really process the blacklist + # just dumps the msgs so we can debug what we have for key, value in self.msgs.iteritems(): print "key", key *************** *** 379,383 **** try: headers = headers[:headers.index('')] ! except: print "can't find blank line in", i headers = '\n'.join(headers) --- 374,378 ---- try: headers = headers[:headers.index('')] ! except ValueError: print "can't find blank line in", i headers = '\n'.join(headers) *************** *** 710,714 **** msg = email.message_from_string(text) self.previewWindow.displayMessage(msg, index - 1, self.msgs[index - 1][HEADERS_INDEX]) ! except: print "\n\n *** conversion failed, here's the message ***\n" + \ " *** it will also be written to badmessage.txt ***" --- 705,709 ---- msg = email.message_from_string(text) self.previewWindow.displayMessage(msg, index - 1, self.msgs[index - 1][HEADERS_INDEX]) ! except TypeError: print "\n\n *** conversion failed, here's the message ***\n" + \ " *** it will also be written to badmessage.txt ***" *************** *** 718,722 **** f.write(text) f.close() - self.statusBar.text = '' --- 713,716 ---- Index: emailfilter.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/fpop/emailfilter.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** emailfilter.py 8 Aug 2004 18:31:53 -0000 1.6 --- emailfilter.py 13 Dec 2005 11:13:23 -0000 1.7 *************** *** 51,88 **** def getAttachments(msg): attachments = [] ! try: ! # try MIME ! counter = 0 ! for part in msg.walk(): ! # multipart/* are just containers ! partType = part.get_type() ! if part.get_main_type() == 'multipart': ! continue ! filename = part.get_filename() ! ### this part is new ! ### contributed by Andrew Dalke ! ### for MS Update virus ! if filename is None: ! if partType in ["application/x-msdownload", ! "audio/x-wav", "audio/x-midi"]: ! # Kill with extreme prejudice ! filename = "virus.exe" ! ! #### end of new part ! if filename is not None: ! if not filename: ! ext = mimetypes.guess_extension(part.get_type()) ! if not ext: ! # Use a generic bag-of-bits extension ! ext = '.bin' ! filename = 'part-%03d%s' % (counter, ext) ! #print counter, partType, filename ! attachments.append({'part':counter, 'type':partType, 'filename':filename}) ! counter += 1 ! except: ! pass return attachments - # delete "failure notice" messages too? # these are returned messages where the virus --- 51,84 ---- def getAttachments(msg): attachments = [] ! # try MIME ! counter = 0 ! for part in msg.walk(): ! # multipart/* are just containers ! partType = part.get_type() ! if part.get_main_type() == 'multipart': ! continue ! filename = part.get_filename() ! ### this part is new ! ### contributed by Andrew Dalke ! ### for MS Update virus ! if filename is None: ! if partType in ["application/x-msdownload", ! "audio/x-wav", "audio/x-midi"]: ! # Kill with extreme prejudice ! filename = "virus.exe" ! ! #### end of new part ! if filename is not None: ! if not filename: ! ext = mimetypes.guess_extension(part.get_type()) ! if not ext: ! # Use a generic bag-of-bits extension ! ext = '.bin' ! filename = 'part-%03d%s' % (counter, ext) ! #print counter, partType, filename ! attachments.append({'part':counter, 'type':partType, 'filename':filename}) ! counter += 1 return attachments # delete "failure notice" messages too? # these are returned messages where the virus *************** *** 183,203 **** if __name__ == '__main__': ! try: ! if len(sys.argv) == 4: ! server = sys.argv[1] ! username = sys.argv[2] ! password = sys.argv[3] else: ! if len(sys.argv) == 2: ! path = sys.argv[1] ! else: ! path = DEFAULTINI ! parser = ConfigParser.ConfigParser() ! parser.read(path) ! server = parser.get('Account', 'server') ! username = parser.get('Account', 'username') ! password = parser.get('Account', 'password') ! processMailbox(server, username, password) ! except: ! print USAGE ! --- 179,195 ---- if __name__ == '__main__': ! if len(sys.argv) == 4: ! server = sys.argv[1] ! username = sys.argv[2] ! password = sys.argv[3] ! else: ! if len(sys.argv) == 2: ! path = sys.argv[1] else: ! path = DEFAULTINI ! parser = ConfigParser.ConfigParser() ! parser.read(path) ! server = parser.get('Account', 'server') ! username = parser.get('Account', 'username') ! password = parser.get('Account', 'password') ! processMailbox(server, username, password) Index: fpoputil.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/fpop/fpoputil.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** fpoputil.py 13 Jan 2003 17:50:33 -0000 1.12 --- fpoputil.py 13 Dec 2005 11:13:23 -0000 1.13 *************** *** 5,9 **** """ ! import rfc822 ORIGINAL_MESSAGE_HEADER = '-----Original Message-----' --- 5,9 ---- """ ! import rfc822, datetime ORIGINAL_MESSAGE_HEADER = '-----Original Message-----' *************** *** 18,45 **** return tztuple else: ! # numsec isn't used for anything?! ! try: ! #numsec = time.mktime(tztuple) ! return "%02d/%02d/%d %02d:%02d" % (tztuple[1],tztuple[2],tztuple[0],tztuple[3],tztuple[4]) ! except: ! #numsec = 0 ! return '' ! def joinList(listX): ! try: ! text = ", ".join(listX) ! return text.replace('\n', '') ! except: ! return "" def filteredSubject(subject): # chop out spam identifier by getting rid of spaces # and id after main subject ! try: ! listX = subject.split(' ') ! return listX[0] ! except: ! return subject # the blacklist is stored in a blacklist.txt --- 18,32 ---- return tztuple else: ! return datetime.datetime(tztuple[0], tztuple[1], tztuple[2], tztuple[3], tztuple[4]).strftime('%m/%d/%y %H:%M') def joinList(listX): ! text = ", ".join(listX) ! return text.replace('\n', '') def filteredSubject(subject): # chop out spam identifier by getting rid of spaces # and id after main subject ! listX = subject.split(' ') ! return listX[0] # the blacklist is stored in a blacklist.txt *************** *** 56,60 **** for i in listX: dictX[i] = None ! except: dictX = {} return dictX --- 43,47 ---- for i in listX: dictX[i] = None ! except IOError: dictX = {} return dictX *************** *** 68,72 **** f.write(temp) f.close() ! except: print "argh, couldn't write the file, what do we do?" --- 55,59 ---- f.write(temp) f.close() ! except IOError: print "argh, couldn't write the file, what do we do?" *************** *** 96,146 **** text = msg.get_payload(decode=1) else: - try: - # try MIME - counter = 0 - text = None - for part in msg.walk(): - # multipart/* are just containers - partType = part.get_type() - print counter, partType - if part.get_main_type() == 'multipart': - continue - if partType in ['text/plain', 'text/html']: - if text is None: - # only display the first payload - # but there might be attachments... - text = part.get_payload(decode=1) - counter += 1 - # I'm not sure when this case would occur - # so it might be pointless - if text is None and msg.get_main_type in ['text/plain', 'text/html']: - text = msg.get_payload(decode=1) - except: - text = msg.get_payload(decode=1) - return text - - def getAttachments(msg): - attachments = [] - try: # try MIME counter = 0 for part in msg.walk(): # multipart/* are just containers partType = part.get_type() if part.get_main_type() == 'multipart': continue ! filename = part.get_filename() ! if filename is not None: ! if not filename: ! ext = mimetypes.guess_extension(part.get_type()) ! if not ext: ! # Use a generic bag-of-bits extension ! ext = '.bin' ! filename = 'part-%03d%s' % (counter, ext) ! print counter, partType, filename ! attachments.append({'part':counter, 'type':partType, 'filename':filename}) counter += 1 ! except: ! pass return attachments --- 83,127 ---- text = msg.get_payload(decode=1) else: # try MIME counter = 0 + text = None for part in msg.walk(): # multipart/* are just containers partType = part.get_type() + print counter, partType if part.get_main_type() == 'multipart': continue ! if partType in ['text/plain', 'text/html']: ! if text is None: ! # only display the first payload ! # but there might be attachments... ! text = part.get_payload(decode=1) counter += 1 ! # I'm not sure when this case would occur ! # so it might be pointless ! if text is None and msg.get_main_type in ['text/plain', 'text/html']: ! text = msg.get_payload(decode=1) ! return text ! ! def getAttachments(msg): ! attachments = [] ! # try MIME ! counter = 0 ! for part in msg.walk(): ! # multipart/* are just containers ! partType = part.get_type() ! if part.get_main_type() == 'multipart': ! continue ! filename = part.get_filename() ! if filename is not None: ! if not filename: ! ext = mimetypes.guess_extension(part.get_type()) ! if not ext: ! # Use a generic bag-of-bits extension ! ext = '.bin' ! filename = 'part-%03d%s' % (counter, ext) ! print counter, partType, filename ! attachments.append({'part':counter, 'type':partType, 'filename':filename}) ! counter += 1 return attachments |
From: Andy T. <an...@us...> - 2005-12-13 11:13:44
|
Update of /cvsroot/pythoncard/PythonCard/samples/pysshed In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/pysshed Modified Files: customDialogs.py Log Message: Removed all of the plain except: clauses I could Index: customDialogs.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/pysshed/customDialogs.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** customDialogs.py 12 Aug 2004 19:18:56 -0000 1.11 --- customDialogs.py 13 Dec 2005 11:13:24 -0000 1.12 *************** *** 119,123 **** try: bull = socket.gethostbyname(self.components.hostName.text) ! except: msgtxt = '"%s" may not be a valid DNS hostname. ' % self.components.hostName.text msgtxt += 'This may be because you do not currently have a connection to the internet, ' --- 119,123 ---- try: bull = socket.gethostbyname(self.components.hostName.text) ! except socket.gaierror: msgtxt = '"%s" may not be a valid DNS hostname. ' % self.components.hostName.text msgtxt += 'This may be because you do not currently have a connection to the internet, ' |
From: Andy T. <an...@us...> - 2005-12-13 11:13:38
|
Update of /cvsroot/pythoncard/PythonCard/samples/gravity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/gravity Modified Files: floatgravity.py gravity.py Log Message: Removed all of the plain except: clauses I could Index: floatgravity.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/gravity/floatgravity.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** floatgravity.py 18 Oct 2004 17:55:57 -0000 1.2 --- floatgravity.py 13 Dec 2005 11:13:23 -0000 1.3 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ # KEA 2004-09-25 --- 2,9 ---- """ + Conversion of Flash animation to PythonCard. + """ __version__ = "$Revision$" __date__ = "$Date$" # KEA 2004-09-25 *************** *** 309,313 **** bmp.SaveFile(path, fileType) return 1 ! except: return 0 else: --- 310,314 ---- bmp.SaveFile(path, fileType) return 1 ! except IOError: return 0 else: Index: gravity.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/gravity/gravity.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gravity.py 28 Mar 2005 05:47:00 -0000 1.7 --- gravity.py 13 Dec 2005 11:13:23 -0000 1.8 *************** *** 2,8 **** """ __version__ = "$Revision$" __date__ = "$Date$" - """ # KEA 2004-09-25 --- 2,9 ---- """ + Conversion of Flash animation to PythonCard. + """ __version__ = "$Revision$" __date__ = "$Date$" # KEA 2004-09-25 *************** *** 290,294 **** bmp.SaveFile(path, fileType) return 1 ! except: return 0 else: --- 291,295 ---- bmp.SaveFile(path, fileType) return 1 ! except IOError: return 0 else: |
From: Kevin A. <ka...@us...> - 2005-11-14 22:33:21
|
Update of /cvsroot/pythoncard/PythonCard/samples/conversions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16791 Modified Files: conversions.py Log Message: added numbers and changed conversion algorithm for morse code Index: conversions.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/conversions/conversions.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** conversions.py 28 Mar 2005 05:49:14 -0000 1.15 --- conversions.py 14 Nov 2005 22:33:13 -0000 1.16 *************** *** 45,58 **** class MorseCodeConversion(Conversion): def __init__(self, components): ! """ ! A B C D E F G ! H I J K L M N ! O P Q R S T U ! V W X Y Z ! """ self.morseAlphabet = ['.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', ! '...-', '.--', '-..-', '-.--', '--..'] components.labelUp.text = 'English' --- 45,60 ---- class MorseCodeConversion(Conversion): def __init__(self, components): ! self.alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', ! 'H', 'I', 'J', 'K', 'L', 'M', 'N', ! 'O', 'P', 'Q', 'R', 'S', 'T', 'U', ! 'V', 'W', 'X', 'Y', 'Z', '0', '1', ! '2', '3', '4', '5', '6', '7', '8', ! '9'] self.morseAlphabet = ['.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', ! '...-', '.--', '-..-', '-.--', '--..', ! '-----', '.----', '..---', '...--', '....-', '.....', ! '-....', '--...', '---..', '----.'] components.labelUp.text = 'English' *************** *** 68,88 **** def convertToMorse(self, txt): - a = ord('A') - z = ord('Z') converted = '' for c in txt[:]: ! ordC = ord(c.upper()) if c == ' ': # three spaces between words # when you include the space after each character converted = converted + ' ' - elif ordC < a or ordC > z: - return converted + "\n\ncharacter out of bounds, unable to complete conversion" else: ! converted += self.morseAlphabet[ordC - a] + ' ' return converted[:-1] def convertFromMorse(self, txt): - a = ord('A') converted = '' words = txt.split(' ') --- 70,88 ---- def convertToMorse(self, txt): converted = '' for c in txt[:]: ! ordC = c.upper() if c == ' ': # three spaces between words # when you include the space after each character converted = converted + ' ' else: ! try: ! converted += self.morseAlphabet[self.alphabet.index(ordC)] + ' ' ! except: ! return converted + "\n\ncharacter out of bounds, unable to complete conversion" return converted[:-1] def convertFromMorse(self, txt): converted = '' words = txt.split(' ') *************** *** 93,100 **** continue try: ! ordC = self.morseAlphabet.index(c) except: return converted + "\n\nmorse out of bounds error, unable to complete conversion" ! converted += chr(ordC + a) converted += ' ' return converted --- 93,100 ---- continue try: ! ordC = self.alphabet[self.morseAlphabet.index(c)] except: return converted + "\n\nmorse out of bounds error, unable to complete conversion" ! converted += ordC converted += ' ' return converted |