Attached is a simple patch that ought to:
Allow Ctrl+P as a shortcut for Print
Cause "New" to open a new window
Cause "Open" to open a new window
Cause NameError exceptions when loading a file to be dealt with like IOErrors

it was entirely guesswork so it's possible that something will break horribly. If anything does, I haven't noticed in the last few minutes ;)

Other random things whilst I remember (some of which I'll get to eventually no doubt): The Edit Dataset dialog seems to be borked. The rename button stays in the depressed state once pressed. The close button is too wide. The "New Dataset" dialog is fun but it should probably have a menu item and be called "Create Dataset" or something that makes it clear it's not importing a dataset. As well as a link to that, the Edit Dataset dialog needs a button to open the import dialog. New datasets should, by default, be given the number of points that one of the datasets in the document has (in the most common case these will all be equal... otherwise it probably doesn't matter much). There should be a way to unlink a file... although I suppose this happens automagically when all the datasets are deleted? Settings that require the selection of one of the axes should be a dropdown rather than a input box It would be neat to have a little [...] button at the end of text inputs for e.g. functions which opened a (non-modal) dialog to update the text in that input using a textarea - this would allow more space An easy way of converting a fit into a function would be good (maybe the paramaters for the fit should go into some sort of grid with a column for the name and one for the value? This would make entering things easier but the results harder to copy) Is keyboard focus in the settings panels going to the labels a result of the context menus or is it normal? In either case, it seems suboptimal...
Index: windows/mainwindow.py
===================================================================
RCS file: /cvs/veusz/veusz/windows/mainwindow.py,v
retrieving revision 1.28
diff -u -r1.28 mainwindow.py
--- windows/mainwindow.py	7 May 2005 21:45:50 -0000	1.28
+++ windows/mainwindow.py	12 May 2005 21:59:14 -0000
@@ -170,7 +170,7 @@
              False, ''),
             ('file', ),
             ('fileprint', 'Print the document', '&Print...', 'file',
-             self.slotFilePrint, 'stock-print.png', True, ''),
+             self.slotFilePrint, 'stock-print.png', True, 'Ctrl+P'),
             ('fileexport', 'Export the current page', '&Export...', 'file',
              self.slotFileExport, 'stock-export.png', True, ''),
             ('file', ),
@@ -361,19 +361,9 @@
 
     def slotFileNew(self):
         """New file."""
-
-        # does the user want to save first?
-        if self.document.isModified():
-            v = self.queryOverwrite()
-            if v == qt.QMessageBox.Cancel:
-                return
-            elif v == qt.QMessageBox.Yes:
-                self.slotFileSave()
-
-        # destroy the current document
-        self.document.wipe()
-        self.filename = ''
-        self.updateTitlebar()
+        
+        win = MainWindow()
+        win.show()
 
     def slotFileSave(self):
         """Save file."""
@@ -455,13 +445,14 @@
         qt.QApplication.setOverrideCursor( qt.QCursor(qt.Qt.WaitCursor) )
 
         try:
-            # load the document
+            # load the document in a new window
             self.interpreter.Load(filename)
             self.document.setModified(False)
             self.filename = filename
             self.updateTitlebar()
             self.updateStatusbar("Opened %s" % filename)
-        except IOError:
+        except IOError, NameError:
+            #NameError is raised for many parsing problems
             qt.QMessageBox("Veusz",
                            "Cannot open file '%s'" % filename,
                            qt.QMessageBox.Critical,
@@ -486,9 +477,10 @@
         if fd.exec_loop() == qt.QDialog.Accepted:
             # save directory for next time
             MainWindow.dirname = fd.dir()
-
+            win = MainWindow()
             filename = unicode( fd.selectedFile() )
-            self.openFile(filename)
+            win.show()
+            win.openFile(filename)
                 
     def slotFileExport(self):
         """Export the graph."""

Répondre à