commit-gnue
[Top][All Lists]
Advanced

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

r6569 - in trunk/gnue-forms/src: . uidrivers/gtk2


From: johannes
Subject: r6569 - in trunk/gnue-forms/src: . uidrivers/gtk2
Date: Tue, 26 Oct 2004 12:47:51 -0500 (CDT)

Author: johannes
Date: 2004-10-26 12:47:50 -0500 (Tue, 26 Oct 2004)
New Revision: 6569

Modified:
   trunk/gnue-forms/src/GFInstance.py
   trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py
Log:
Make dialog-main forms work


Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2004-10-26 14:29:09 UTC (rev 6568)
+++ trunk/gnue-forms/src/GFInstance.py  2004-10-26 17:47:50 UTC (rev 6569)
@@ -313,11 +313,21 @@
       self.buildForm (dialog)
 
     # Bring up the main form
-    self.activateForm ('__main__')
-    self._uiinstance.mainLoop ()
+    form = self._formsDictionary ['__main__']
 
+    if form.style == 'dialog':
+      # we assume a dialog to be modal by definition and that program execution
+      # stops here until the dialog get's closed. So do *not* enter another
+      # main loop
+      self.activateForm ('__main__', modal = True)
 
+    else:
+      self.activateForm ('__main__')
+      self._uiinstance.mainLoop ()
 
+
+
+
   # ---------------------------------------------------------------------------
   # Activate a given form
   # ---------------------------------------------------------------------------
@@ -335,12 +345,17 @@
 
     form.processTrigger ('On-Activation')
 
+    # First set the current entry to be focused and up to date before
+    # displaying the real UI form. 
+    self.dispatchEvent ('gotoENTRY', object = form._currentEntry, _form = form)
     self._uiinstance.activateForm (formName, modal)
 
-    self.dispatchEvent ('gotoENTRY', object = form._currentEntry, _form = form)
+    # We need a refresh only for non-dialogs since a dialog form doesn't exist
+    # anymore if we reach the following lines
+    if form.style != 'dialog':
+      form.refreshDisplay (form)
+      self.updateStatus (form)
 
-    form.refreshDisplay (form)
-    self.updateStatus (form)
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py     2004-10-26 14:29:09 UTC 
(rev 6568)
+++ trunk/gnue-forms/src/uidrivers/gtk2/UIdriver.py     2004-10-26 17:47:50 UTC 
(rev 6569)
@@ -148,20 +148,30 @@
 
   def _exit (self, formName):
 
+    _form = None
+
     exitApp = True
     for child in self._children:
       if child._form.name == formName:
         child.mainWindow.hide ()
         child._visible = False
+        _form = child._form
 
       exitApp = exitApp and not child._visible
 
     if exitApp:
       for child in self._children:
-        child.mainWindow.destroy ()
+        if not isinstance (child.mainWindow, gtk.Dialog):
+          child.mainWindow.destroy ()
+        else:
+          child.mainWindow.response (gtk.RESPONSE_CLOSE)
+
+    # if the main form is a dialog we do *not* quit the main loop manually
+    if formName == '__main__' and _form.style != 'dialog':
       self.app.quit ()
 
-  def _beep(self):
+
+  def _beep (self):
     pass
 
   #############################################################################





reply via email to

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