Update of /cvsroot/pythoncard/PythonCard/samples/worldclock
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9735/samples/worldclock
Modified Files:
worldclock.py
Log Message:
Making blanket except clauses more specific
Index: worldclock.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/samples/worldclock/worldclock.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** worldclock.py 30 Aug 2004 14:50:08 -0000 1.27
--- worldclock.py 18 Sep 2005 03:59:22 -0000 1.28
***************
*** 26,30 ****
from PythonCard import graphic, log, model, timer
- #from PythonCard.log import Log
import xearth
--- 26,29 ----
***************
*** 34,44 ****
def on_initialize(self, event):
self.url = ''
-
- # Enable logging
- ###self.log = Log.getInstance()
- # self.log.enable()
- # Normally we enable only ERROR and WARNING messages
- ###self.log.enableLevels( [ Log.ERROR, Log.WARNING, Log.DEBUG, Log.INFO ] )
-
# KEA 2002-05-27
# switched to timer events
--- 33,36 ----
***************
*** 51,55 ****
self.updateImage()
-
def on_staticTextClock_timer(self, event):
self.updateDateAndTime()
--- 43,46 ----
***************
*** 59,63 ****
if t[0] == "0":
t = t[1:]
-
if self.components.staticTextClock.text != t:
self.components.staticTextClock.text = t
--- 50,53 ----
***************
*** 71,89 ****
def updateImage(self):
log.info("interval is up...")
- # try:
- # jScript = "cscript //nologo xearth.js"
- # file = os.popen(jScript)
- # s = file.read()
- # url = "http://www.time.gov/" + s
- # except:
- # url = "http://www.time.gov/images/xearths/night.jpg"
- # #url = "http://www.time.gov/images/xearths/11N/100N.jpg"
url = "http://www.time.gov/" + xearth.getLatLong()
-
if url == self.url:
return
-
self.url = url
- ###self.log.info( "updating image ", url )
log.info("updating image ", url)
--- 61,68 ----
***************
*** 93,109 ****
jpg = fp.read()
fp.close()
! except:
return
wImageButtonWorld = self.components.imageButtonWorld
- # pre wxPython 2.3.3.1 the image data
- # had to be written to disk first
- #f = open('night2.jpg', "wb")
- #f.write(jpg)
- #f.close()
-
- #newBitmap = graphic.Bitmap('night2.jpg')
-
# with wxPython 2.3.3.1 and above it is no longer
# necessary to write the file to disk before displaying it
--- 72,80 ----
jpg = fp.read()
fp.close()
! except Exception, msg:
return
wImageButtonWorld = self.components.imageButtonWorld
# with wxPython 2.3.3.1 and above it is no longer
# necessary to write the file to disk before displaying it
***************
*** 120,124 ****
event.skip()
-
if __name__ == '__main__':
app = model.Application(WorldClock)
--- 91,94 ----
|