Attached is a patch to reload linked datasets. It _seems to_ work. You need to add the icon to the windows/icons directory - it assumes the stock refresh icon from bluecurve. The patch adds a command ReloadData() (Reload should maybe be saved to reload an entire file) There's nothing complex (like a button in the Edit Datasets dialog to reload a linked dataset) - but having to continually open and close windows was getting me down :).

--
"But if science you say still sounds too deep,
Just do what Beaker does, just shrug and 'Meep!'"

-- Dr. Bunsen Honeydew & Beaker of Muppet Labs

? __init__.pyc
? embed.pyc
? veusz.pyc
? dialogs/__init__.pyc
? dialogs/aboutdialog.pyc
? dialogs/dataeditdialog.pyc
? dialogs/exceptiondialog.pyc
? dialogs/importdialog.pyc
? document/__init__.pyc
? document/commandinterface.pyc
? document/commandinterpreter.pyc
? document/doc.pyc
? document/simpleread.pyc
? setting/__init__.pyc
? setting/collections.pyc
? setting/controls.pyc
? setting/setting.pyc
? setting/settingdb.pyc
? setting/settings.pyc
? utils/__init__.pyc
? utils/fitlm.pyc
? utils/points.pyc
? utils/pref.pyc
? utils/preftypes.pyc
? utils/textrender.pyc
? utils/utilfuncs.pyc
? utils/version.pyc
? widgets/__init__.pyc
? widgets/axis.pyc
? widgets/axisticks.pyc
? widgets/containers.pyc
? widgets/fit.pyc
? widgets/graph.pyc
? widgets/key.pyc
? widgets/page.pyc
? widgets/plotters.pyc
? widgets/root.pyc
? widgets/widget.pyc
? widgets/widgetfactory.pyc
? windows/__init__.pyc
? windows/action.pyc
? windows/consolewindow.pyc
? windows/mainwindow.pyc
? windows/plotwindow.pyc
? windows/simplewindow.pyc
? windows/treeeditwindow.pyc
Index: document/commandinterface.py
===================================================================
RCS file: /cvs/veusz/veusz/document/commandinterface.py,v
retrieving revision 1.23
diff -u -r1.23 commandinterface.py
--- document/commandinterface.py	2 May 2005 16:13:37 -0000	1.23
+++ document/commandinterface.py	1 Jun 2005 15:23:44 -0000
@@ -206,6 +206,19 @@
 
         return (datasets, errors)
 
+    def ReloadData(self):
+        """Reload linked datasets in the current file"""
+        links = [item.linked for item in self.document.data.values()
+                 if item.linked]
+        reloadedFiles = []
+        for link in links:
+            #XXX - is this check needed i.e. are LinkedFile instances unique?
+            if not link in reloadedFiles:
+                self.ImportFile(link.filename,
+                                link.descriptor,
+                                linked=True)
+                reloadedFiles.append(link)
+
     def Action(self, action, widget='.'):
         """Performs action on current widget."""
 
Index: document/commandinterpreter.py
===================================================================
RCS file: /cvs/veusz/veusz/document/commandinterpreter.py,v
retrieving revision 1.18
diff -u -r1.18 commandinterpreter.py
--- document/commandinterpreter.py	15 May 2005 15:19:23 -0000	1.18
+++ document/commandinterpreter.py	1 Jun 2005 15:23:44 -0000
@@ -90,6 +90,7 @@
             'Print': i.Print,
             'Rename': i.Rename,
             'Remove': i.Remove,
+            'ReloadData':i.ReloadData,
             'Save': i.Save,
             'Set': i.Set,
             'SetData': i.SetData,
Index: windows/mainwindow.py
===================================================================
RCS file: /cvs/veusz/veusz/windows/mainwindow.py,v
retrieving revision 1.33
diff -u -r1.33 mainwindow.py
--- windows/mainwindow.py	18 May 2005 13:06:01 -0000	1.33
+++ windows/mainwindow.py	1 Jun 2005 15:23:44 -0000
@@ -185,6 +185,8 @@
              self.slotFileQuit, 'stock-quit.png', False, 'Ctrl+Q'),
             ('dataimport', 'Import data into Veusz', '&Import...', 'data',
              self.slotDataImport, 'stock-import.png', False, ''),
+            ('datareload', 'Reload linked datasets', '&Reload', 'data',
+             self.slotDataReload, 'stock-refresh.png', True, 'Ctrl+R'),
             ('dataedit', 'Edit existing datasets', '&Edit...', 'data',
              self.slotDataEdit, None, False, ''),
             ('datacreate', 'Create new datasets', '&Create...', 'data',
@@ -273,6 +275,10 @@
         """Display the import data dialog."""
         d = dialogs.importdialog.ImportDialog(self, self.document)
         d.show()
+
+    def slotDataReload(self):
+        """Reload linked datasets"""
+        self.interpreter.cmds['ReloadData']()
 
     def slotDataEdit(self):
         """Edit existing datasets."""

Répondre à