|
From: Kevin A. <ka...@us...> - 2006-08-09 02:47:06
|
Update of /cvsroot/pythoncard/PythonCard/samples/pictureViewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17730 Modified Files: pictureViewer.py Log Message: added drag and drop fixed orientation with try/except on Horizontal Index: pictureViewer.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/pictureViewer/pictureViewer.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pictureViewer.py 13 Dec 2005 11:13:24 -0000 1.25 --- pictureViewer.py 9 Aug 2006 02:47:03 -0000 1.26 *************** *** 11,14 **** --- 11,34 ---- from PythonCard import EXIF + + class MyFileDropTarget(wx.FileDropTarget): + def __init__(self, window): + wx.FileDropTarget.__init__(self) + self.window = window + + def OnDropFiles(self, x, y, filenames): + print "\n%d file(s) dropped at %d,%d:\n" % (len(filenames), x, y) + for f in filenames: + print f + # KEA 2006-08-04 + # first pass support of drag and drop of files on editor + # just open the first one + # could do other stuff like insert the text of the file dropped + # at the cursor which requires converting the x, y coordinates to + # a cursor location + # in the tabcodeEditor could open tabs for each file dropped + self.window.openFile(filenames[0]) + + class PictureViewer(model.Background): *************** *** 50,53 **** --- 70,75 ---- self.visible = True + dt = MyFileDropTarget(self) + self.components.bufOff.SetDropTarget(dt) def on_idle(self, event): *************** *** 167,171 **** # (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 --- 189,198 ---- # (0x0112) Short=8 @ 54 # but the str() is just 1, 8, etc. ! try: ! orientation = int(str(tags['Image Orientation'])) ! except ValueError: ! # Horizontal (normal) ! print "Exception on orientation:", tags['Image Orientation'] ! orientation = 1 #print path #print 'Image Orientation: %d' % orientation |