commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/designer/src GFDesigner.py Instance.py Men...


From: Jason Cater
Subject: gnue/designer/src GFDesigner.py Instance.py Men...
Date: Mon, 26 Nov 2001 12:40:33 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/11/26 12:40:32

Modified files:
        designer/src   : GFDesigner.py Instance.py MenuBar.py 
                         RuntimeSettings.py 
Added files:
        designer/src   : MRUManager.py 

Log message:
        Merges patches from 0.1.0-patches release

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/MRUManager.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/GFDesigner.py.diff?cvsroot=OldCVS&tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/Instance.py.diff?cvsroot=OldCVS&tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/MenuBar.py.diff?cvsroot=OldCVS&tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/RuntimeSettings.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gnue/designer/src/GFDesigner.py
diff -u gnue/designer/src/GFDesigner.py:1.24 
gnue/designer/src/GFDesigner.py:1.25
--- gnue/designer/src/GFDesigner.py:1.24        Mon Nov 19 22:37:55 2001
+++ gnue/designer/src/GFDesigner.py     Mon Nov 26 12:40:32 2001
@@ -31,7 +31,7 @@
 from gnue.common import GDebug, GConfig
 from gnue.designer.Instance import GFDInstance
 from gnue.designer import VERSION, PACKAGE
-from gnue.designer import TemplateParser, TemplateChooser
+import TemplateParser, TemplateChooser, MRUManager
 from gnue.common.GClientApp import GClientApp
 from gnue.forms import UIwxpython, GFForm
 
@@ -45,8 +45,9 @@
   USAGE = "gfdesign [options] [files]"
 
   def __init__(self):
-    GClientApp.__init__(self, application="forms")
+    self.mru = MRUManager.MRUManager(self)
     self._instances = []
+    GClientApp.__init__(self, application="forms")
     self.getConnectionManager().setLoginHandler(UIwxpython.UILoginHandler())
     wxApp.__init__(self,0)
 
@@ -115,6 +116,9 @@
 
     instance.Close()
 
+  def isFileOpened(self, location): 
+    # TODO: Check to see if a file is already opened
+    return 0
 
   def OnOpen(self, event):
 
@@ -124,10 +128,21 @@
                                       "All Files (*.*)|*.*",
                            style=wxOPEN)
     if dlg.ShowModal() == wxID_OK:
-      GFDInstance(self, dlg.GetPath())
+      if self.isFileOpened(dlg.GetPath()): 
+        # TODO: Um, something better than this!!!
+        print "File is already opened!" 
+      else:
+        GFDInstance(self, dlg.GetPath())
     dlg.Destroy()
 
 
+  def OnOpenRecent(self, event):
+
+    location = self.mru.mruMenuMap[event.GetId()]
+    if not self.isFileOpened(location): 
+      GFDInstance( self, location )
+
+
   def OnExit(self, event):
     if self.isDirty():
       dlg = wxMessageDialog(NULL,
@@ -157,6 +172,7 @@
                                 "About " + self.NAME, 
style=wxOK|wxICON_INFORMATION)
     dlg.ShowModal()
     dlg.Destroy()
+
 
 
 #
Index: gnue/designer/src/Instance.py
diff -u gnue/designer/src/Instance.py:1.32 gnue/designer/src/Instance.py:1.33
--- gnue/designer/src/Instance.py:1.32  Mon Nov 19 22:37:55 2001
+++ gnue/designer/src/Instance.py       Mon Nov 26 12:40:32 2001
@@ -55,6 +55,9 @@
     self.runtime_section = 'FormLayout'
     RuntimeSettings.registerRuntimeSettingHandler(self, self)
 
+    # And the MRU
+    RuntimeSettings.registerRuntimeSettingHandler(self, app.mru)
+
     self._isdirty = 0
     self._makeBackup = 1
     self._isNew = 1
@@ -183,6 +186,7 @@
     except IOError, msg:
       print "\n%s %s\n\nUnable to open file '%s'. \nUnexpected read error:\n  
%s.\n" % (TITLE, VERSION, location, msg)
       sys.exit()
+    self._app.mru.addLocation(location)
 
   def __loadFormFromBuffer(self, fileHandle):
     self._form = GFParser.loadForm (fileHandle, self, initialize=0)
Index: gnue/designer/src/MenuBar.py
diff -u gnue/designer/src/MenuBar.py:1.13 gnue/designer/src/MenuBar.py:1.14
--- gnue/designer/src/MenuBar.py:1.13   Mon Nov 19 21:00:16 2001
+++ gnue/designer/src/MenuBar.py        Mon Nov 26 12:40:32 2001
@@ -28,7 +28,7 @@
 import sys, os, string
 from wxPython.wx import *
 from gnue.common import GDebug, GConfig
-import Incubator
+import Incubator, MRUManager
 
 # File menu
 ID_NEW = wxNewId()
@@ -97,6 +97,11 @@
      EVT_MENU (frame, ID_SAVE_ALL, frame._app.OnSaveAll)
      EVT_MENU (frame, ID_CLOSE, frame.OnClose)
      EVT_MENU (frame, ID_EXIT, frame._app.OnExit)
+
+    
+     # Set up out MRU list
+     frame._app.mru.addMenu(self._fileRecent, frame)
+
 
      self._fileNew.Append(ID_NEW_FORM,'&Form', "Create a new form")
      self._fileNew.Append(ID_NEW_REPORT,'&Report', "Create a new report")
Index: gnue/designer/src/RuntimeSettings.py
diff -u gnue/designer/src/RuntimeSettings.py:1.5 
gnue/designer/src/RuntimeSettings.py:1.6
--- gnue/designer/src/RuntimeSettings.py:1.5    Thu Nov 15 19:01:22 2001
+++ gnue/designer/src/RuntimeSettings.py        Mon Nov 26 12:40:32 2001
@@ -29,6 +29,7 @@
 
 import sys, os, ConfigParser
 
+
 if os.environ.has_key('HOME'):
   try: 
     os.makedirs(os.environ['HOME']+'/.gnue')
@@ -75,10 +76,12 @@
       try:
         for h in instance._runtimes: 
           section, hash = h.saveRuntimeSettings()
+
+          if len(hash.keys()): 
+            fh.write ("\n[%s]\n" % section)
+            for key in hash.keys(): 
+              fh.write ("%s=%s\n" % (key, hash[key]))
 
-          fh.write ("\n[%s]\n" % section)
-          for key in hash.keys(): 
-            fh.write ("%s=%s\n" % (key, hash[key]))
         fh.write("\n") 
       except: 
         print "\nWarning: Unable to save session data to %s\n" % location
@@ -92,5 +95,6 @@
 #
 def registerRuntimeSettingHandler(instance, object):
   instance._runtimes.append(object)
+
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]