commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r9290 - in trunk: gnue-forms/src gnue-forms/src/uidrivers/wx26/wi


From: reinhard
Subject: [gnue] r9290 - in trunk: gnue-forms/src gnue-forms/src/uidrivers/wx26/widgets gnue-navigator/src
Date: Fri, 12 Jan 2007 10:08:53 -0600 (CST)

Author: reinhard
Date: 2007-01-12 10:08:51 -0600 (Fri, 12 Jan 2007)
New Revision: 9290

Modified:
   trunk/gnue-forms/src/GFInstance.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
   trunk/gnue-navigator/src/GNClient.py
   trunk/gnue-navigator/src/UIgtk2.py
   trunk/gnue-navigator/src/UIqt3.py
   trunk/gnue-navigator/src/UItext.py
   trunk/gnue-navigator/src/UIweb.py
   trunk/gnue-navigator/src/UIwin32.py
   trunk/gnue-navigator/src/UIwx.py
   trunk/gnue-navigator/src/UIwx26.py
Log:
More work on embedded forms.


Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-forms/src/GFInstance.py  2007-01-12 16:08:51 UTC (rev 9290)
@@ -224,6 +224,7 @@
 
         form = self.__load_buffer(buffer)
         self.__run(form, parameters)
+        return form
 
     # -------------------------------------------------------------------------
 
@@ -237,6 +238,7 @@
 
         form = self.__load_file(filename)
         self.__run(form, parameters)
+        return form
 
 
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2007-01-12 15:39:26 UTC 
(rev 9289)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2007-01-12 16:08:51 UTC 
(rev 9290)
@@ -139,7 +139,9 @@
 
         self.main_window.SetTitle(self._form.title)
         self.main_window.SetIcons(self.__load_icons())
-        self.main_window.Bind(wx.EVT_CLOSE, self.__on_close, self.main_window)
+        if not self.__embedded:
+            self.main_window.Bind(wx.EVT_CLOSE, self.__on_close,
+                    self.main_window)
 
         self.__master_sizer = wx.BoxSizer(wx.VERTICAL)
 

Modified: trunk/gnue-navigator/src/GNClient.py
===================================================================
--- trunk/gnue-navigator/src/GNClient.py        2007-01-12 15:39:26 UTC (rev 
9289)
+++ trunk/gnue-navigator/src/GNClient.py        2007-01-12 16:08:51 UTC (rev 
9290)
@@ -103,7 +103,6 @@
     self.configurationManager.registerAlias ('gConfigNav'  , 'navigator')
     self.configurationManager.registerAlias ('gConfigForms', 'forms')
 
-    self._formInstances    = {}
     self._lastSerialNumber = 0
 
 
@@ -153,6 +152,8 @@
       loginHandler = self._ui.ui.UILoginHandler ()
       loginHandler.uiDriver = instance._uiinstance
       self.connections.setLoginHandler (loginHandler)
+    else:
+      instance = None
 
     #
     # assign menu file from 1st free argument
@@ -196,7 +197,7 @@
       sys.exit ()
 
 
-    self._ui.Instance (nav).run (self.connections)
+    self._ui.Instance(nav).run(self.connections, instance)
 
 
 # =============================================================================

Modified: trunk/gnue-navigator/src/UIgtk2.py
===================================================================
--- trunk/gnue-navigator/src/UIgtk2.py  2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UIgtk2.py  2007-01-12 16:08:51 UTC (rev 9290)
@@ -62,7 +62,6 @@
     """
 
     self.processes         = processes
-    self._formInstances    = {}
     self._lastSerialNumber = 0
     self._treeModel        = None
 
@@ -76,12 +75,13 @@
   # Build the UI and start the navigator client
   # ---------------------------------------------------------------------------
 
-  def run (self, connections):
+  def run (self, connections, instance):
     """
     This function creates the user interface and starts the main loop
     """
 
     self.connections = connections
+    self.__instance = instance
 
     self.__buildInterface ()
 
@@ -635,8 +635,6 @@
     """
 
     instance = GFInstance (self, self.connections, ui, True)
-    self._formInstances [id (self)] = instance
-         
     instance.run_from_file(formfile, parameters)
 
 

Modified: trunk/gnue-navigator/src/UIqt3.py
===================================================================
--- trunk/gnue-navigator/src/UIqt3.py   2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UIqt3.py   2007-01-12 16:08:51 UTC (rev 9290)
@@ -59,7 +59,6 @@
     """
 
     self.processes         = processes
-    self._formInstances    = {}
     self._lastSerialNumber = 0
 
     self.__lastItem        = ""
@@ -71,12 +70,13 @@
   # Build the UI and start the navigator client
   # ---------------------------------------------------------------------------
 
-  def run (self, connections):
+  def run (self, connections, instance):
     """
     This function creates the user interface and starts the main loop
     """
 
     self.connections = connections
+    self.__instance = instance
 
     self.__buildInterface ()
     
@@ -428,8 +428,6 @@
     """
 
     instance = GFInstance (self, self.connections, ui, True)
-    self._formInstances [id (self)] = instance
-         
     instance.run_from_file(formfile, parameters)
 
 

Modified: trunk/gnue-navigator/src/UItext.py
===================================================================
--- trunk/gnue-navigator/src/UItext.py  2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UItext.py  2007-01-12 16:08:51 UTC (rev 9290)
@@ -36,7 +36,7 @@
   def __init__(self, processes):
     self.processes = processes
 
-  def run(self, connections):
+  def run(self, connections, instance):
     print "Login Handler set"
     
     connections.setLoginHandler (BasicLoginHandler ())

Modified: trunk/gnue-navigator/src/UIweb.py
===================================================================
--- trunk/gnue-navigator/src/UIweb.py   2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UIweb.py   2007-01-12 16:08:51 UTC (rev 9290)
@@ -38,7 +38,7 @@
     self.processes = processes
     wxApp.__init__(self)
 
-  def run(self, connections):
+  def run(self, connections, instance):
     self.connections = connections
     #
     # Assign the proper login handler based upon the user interface choice

Modified: trunk/gnue-navigator/src/UIwin32.py
===================================================================
--- trunk/gnue-navigator/src/UIwin32.py 2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UIwin32.py 2007-01-12 16:08:51 UTC (rev 9290)
@@ -77,7 +77,6 @@
 class Instance:
   def __init__(self, processes):
     self.processes = processes
-    self._formInstances = {}
 
     self.titlePage = """
     <html>
@@ -107,12 +106,13 @@
     self.classAtom = win32gui.RegisterClass(wc)
     self.hTree = 0
 
-  def run(self, connections):
+  def run(self, connections, instance):
     #
     # Assign the proper login handler based upon the user interface choice
     #
     self.connections = connections
     self.connections.setLoginHandler(ui.UILoginHandler())
+    self.__instance = instance
 
     app = get_win32_app()
     self._app = app
@@ -319,8 +319,6 @@
 
     instance = GFInstance(self,connections=self.connections,
                           ui=ui,disableSplash=1)
-    self._formInstances[id(self)] = instance
-
     instance.run_from_file(formfile, parameters)
 
 

Modified: trunk/gnue-navigator/src/UIwx.py
===================================================================
--- trunk/gnue-navigator/src/UIwx.py    2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UIwx.py    2007-01-12 16:08:51 UTC (rev 9290)
@@ -52,7 +52,6 @@
 class Instance:
   def __init__(self, processes):
     self.processes = processes
-    self._formInstances = {}
     self._lastSerialNumber = 0
 
     self.titlePage = """
@@ -67,13 +66,15 @@
     </html>
     """ % (images_dir+"/ship2.png")
 
-  def run(self, connections):
+  def run(self, connections, instance):
     #
     # Assign the proper login handler based upon the user interface choice
     #
     self.connections = connections
     self.connections.setLoginHandler(ui.UILoginHandler())
 
+    self.__instance = instance
+
     app = ui.getWxApp()
     self._app = app
     self.frame = wxFrame(NULL, -1, "GNUe Navigator", size=wxSize(600,400))
@@ -267,8 +268,6 @@
            connections=self.connections,
            ui=ui, disableSplash=1)
 
-      self._formInstances[id(self)] = instance
-
       instance.run_from_file(formfile, parameters)
       instance.activate()
 

Modified: trunk/gnue-navigator/src/UIwx26.py
===================================================================
--- trunk/gnue-navigator/src/UIwx26.py  2007-01-12 15:39:26 UTC (rev 9289)
+++ trunk/gnue-navigator/src/UIwx26.py  2007-01-12 16:08:51 UTC (rev 9290)
@@ -47,8 +47,8 @@
 class Instance:
   def __init__(self, processes):
     self.processes = processes
-    self._formInstances = {}
     self._lastSerialNumber = 0
+    self.__current_form = None
 
     self.titlePage = """
     <html>
@@ -62,13 +62,15 @@
     </html>
     """ % (images_dir+"/ship2.png")
 
-  def run(self, connections):
+  def run(self, connections, instance):
     #
     # Assign the proper login handler based upon the user interface choice
     #
     self.connections = connections
     self.connections.setLoginHandler(ui.UILoginHandler())
 
+    self.__instance = instance
+
     app = wx.GetApp() or wx.App()
     self.frame = wx.Frame(None, -1, "GNUe Navigator", size=wx.Size(600,400))
     self.frame.Bind(wx.EVT_CLOSE, self.__on_close)
@@ -112,6 +114,10 @@
     self.splitter.SplitVertically(self.panel1, self.panel2)
     self.splitter.SetSashPosition(200)
 
+    if gConfigNav('embedForms') == "%s" % True: 
+        self.__instance._uiinstance._parentContainer = {
+                'frame': self.frame, 'panel': self.form_panel}
+
     app.MainLoop()
 
   def __on_resize(self,evt):
@@ -134,7 +140,12 @@
 
 
   def __on_close(self, event):
-    self.frame.Destroy()
+    if event.CanVeto():
+        if self.__current_form is not None:
+            self.__current_form.close()
+        event.Veto()
+    else:
+        self.frame.Destroy()
 
   def __on_about(self, event):
     text = _("GNUE Navigator")+"\n"+      \
@@ -196,31 +207,10 @@
 
 
   def _runForm(self, formfile, parameters):
-
-      #
-      # TODO: The next if looks funny because the code above results in
-      #
-      #  disable splash:  1 <type 'int'>
-      #  embed forms:  0 <type 'str'>
-      #
-      # And I don't have time to dig ATM
-      #
       self.splitter.ReplaceWindow(self.panel2, self.form_panel)
-      if gConfigNav('embedForms') == "%s" % True: 
-        instance = GFInstance(self,
-                connections=self.connections,
-                ui=ui,
-                disableSplash=1,
-                parentContainer={'frame': self.frame, 'panel': 
self.form_panel})
-      else:
-        instance = GFInstance(id(self),
-           connections=self.connections, parentContainer=None,
-           ui=ui, disableSplash=1)
+      self.__current_form = self.__instance.run_from_file(formfile, parameters)
 
-      self._formInstances[id(self)] = instance
-      instance.run_from_file(formfile, parameters)
 
-
   def setTitle(self, title):
     self.frame.SetTitle ("GNUe Navigator: %s (form)" % title )
 





reply via email to

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