Update of /cvsroot/pythoncard/PythonCard/samples/iacGrid
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13799
Modified Files:
iacGrid.py iacGrid.rsrc.py
Log Message:
added File->Open
Index: iacGrid.rsrc.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/samples/iacGrid/iacGrid.rsrc.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** iacGrid.rsrc.py 28 Jul 2006 03:01:16 -0000 1.1
--- iacGrid.rsrc.py 28 Jul 2006 15:37:29 -0000 1.2
***************
*** 20,23 ****
--- 20,27 ----
'label':'&File',
'items': [
+ {'type':'MenuItem',
+ 'name':'menuFileOpen',
+ 'label':'&Open\tCtrl+O',
+ },
{ 'type':'MenuItem',
'name':'menuFileExit',
Index: iacGrid.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/samples/iacGrid/iacGrid.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** iacGrid.py 28 Jul 2006 05:04:55 -0000 1.2
--- iacGrid.py 28 Jul 2006 15:37:29 -0000 1.3
***************
*** 30,34 ****
mygrid.CreateGrid(30, 6)
- ##mygrid.EnableEditing(False)
self.populate_cells_from_file()
--- 30,33 ----
***************
*** 42,45 ****
--- 41,50 ----
self.panel.SetAutoLayout(True)
self.panel.Layout()
+
+ # KEA 2006-07-27
+ # apparently there is a bug, probably a race condition when the control
+ # is first created in wxWidgets on the Mac which requires that this call
+ # be done late rather than immediately after the grid creation
+ mygrid.EnableEditing(False)
***************
*** 49,52 ****
--- 54,60 ----
for row, line in enumerate(open(filename)):
fields = line.rstrip().split()
+ ## if row >= mygrid.GetNumberRows():
+ ## print "adding row"
+ ## mygrid.AppendRows()
for col, value in enumerate(fields):
print row, col, value
***************
*** 111,114 ****
--- 119,132 ----
+ def on_menuFileOpen_select(self, event):
+ wildcard = 'Text files (*.txt)|*.txt|All files (*.*)|*.*'
+ result = dialog.openFileDialog(None, 'Open File', '', '', wildcard)
+ if result.accepted:
+ path = result.paths[0]
+ # KEA 2006-07-27
+ # this actually fails right now, units and other module
+ # globals probably need to be cleared
+ self.populate_cells_from_file(path)
+
if __name__ == '__main__':
|