commit-gnue
[Top][All Lists]
Advanced

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

gnue/designer src/LayoutEditor.py src/TemplateB...


From: Jason Cater
Subject: gnue/designer src/LayoutEditor.py src/TemplateB...
Date: Wed, 27 Jun 2001 19:26:19 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/06/27 19:26:19

Modified files:
        designer/src   : LayoutEditor.py TemplateBase.py 
                         TemplateParser.py 
        designer/templates/forms: Simple.py 

Log message:
        Misc. changes; committing prior to changing focus system

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/LayoutEditor.py.diff?cvsroot=OldCVS&tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/TemplateBase.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/TemplateParser.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/forms/Simple.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnue/designer/src/LayoutEditor.py
diff -u gnue/designer/src/LayoutEditor.py:1.10 
gnue/designer/src/LayoutEditor.py:1.11
--- gnue/designer/src/LayoutEditor.py:1.10      Mon Jun 25 21:49:19 2001
+++ gnue/designer/src/LayoutEditor.py   Wed Jun 27 19:26:19 2001
@@ -330,8 +330,10 @@
 
     for widget in self.mainWidget.widgets:
       widget.SetCursor (wxNullCursor)
-      if hasattr(widget, 'SetEditable'): 
-        widget.SetEditable(0)
+#      if hasattr(widget, 'SetEditable'): 
+#        widget.SetEditable(0)
+      if isinstance(widget, wxControl):
+        widget.Enable(0)
       self.setAllChildren(EVT_KEY_UP, widget, self.instance.keyTrap)
       self.setAllChildren(EVT_SET_FOCUS, widget, self.focusGainedTrap)
       self.setAllChildren(EVT_KILL_FOCUS, widget, self.focusLostTrap)
Index: gnue/designer/src/TemplateBase.py
diff -u gnue/designer/src/TemplateBase.py:1.3 
gnue/designer/src/TemplateBase.py:1.4
--- gnue/designer/src/TemplateBase.py:1.3       Tue Jun 26 21:28:00 2001
+++ gnue/designer/src/TemplateBase.py   Wed Jun 27 19:26:19 2001
@@ -47,6 +47,7 @@
 
 from gnue.common import GParser
 from gnue.forms import GFParser
+import Incubator
 
 #
 # These Identify the types of templates. A template
@@ -112,9 +113,21 @@
   #  The following methods are convenience  
   #  methods.
   
-
   def AddElement(self, tag, parent, attributes={}): 
-    pass
+    o = self.parser.elements[tag]['BaseClass'](parent)
+    for attr in attributes.keys(): 
+      o.__dict__[attr] = attributes[attr]
+    return o
+
+  def GetAvailableConnections(self): 
+    rv = []
+    p = self._connections.getAllConnectionParameters()
+    for conn in p.keys(): 
+      if p[conn].has_key('comment'):
+        rv.append(conn, '%s [%s]' % (p[conn]['comment'], conn))
+      else: 
+        rv.append(conn, '%s [%s]' % (conn, p[conn]['provider']))
+    return rv
 
 
   ##########################################
@@ -123,7 +136,9 @@
   #  to the wizard/template developer and 
   #  may/will be changed later on.
 
-  # Um, well eventually there might be...    
+  def __init__(self, parser): 
+    self.parser = parser
+    self._connections = parser.instance._app.connections
 
 
 ###########################################################
Index: gnue/designer/src/TemplateParser.py
diff -u gnue/designer/src/TemplateParser.py:1.2 
gnue/designer/src/TemplateParser.py:1.3
--- gnue/designer/src/TemplateParser.py:1.2     Tue Jun 26 21:28:00 2001
+++ gnue/designer/src/TemplateParser.py Wed Jun 27 19:26:19 2001
@@ -38,7 +38,7 @@
 
   def run(self): 
 
-    self.template = self.templateInformation['BaseClass']()
+    self.template = self.templateInformation['BaseClass'](self)
 
     self.template.Start(self.form)
 
@@ -142,6 +142,11 @@
     self.buildPage()
 
   def OnNextStep(self, event): 
+
+    # Save the variables from current step
+    for o in self.editorMappings.keys(): 
+      self.parser.template.variables[self.editorMappings[o].variable] = o.get()
+
     validation = self.parser.template.ValidateStep(self.step)
     if validation != None: 
       # TODO: This should display a dialog box listing problems...
@@ -157,6 +162,10 @@
         event.Skip()
 
   def OnPrevStep(self, event): 
+    # Save the variables from current step
+    for o in self.editorMappings.keys(): 
+      self.parser.template.variables[self.editorMappings[o].variable] = o.get()
+
     self.setStep(self.prevStep)
 
   def OnCancel(self, event): 
@@ -212,14 +221,45 @@
           o = wxStaticText(self, -1, object.label, pos=wxPoint(x, nextY+3))
           x = x + xSpacing + o.GetSize().x
 
-        if o.set != None and len(o.set): 
-          o = wxTextCtrl(self, -1, pos=wxPoint(x, nextY))          
+        if object.set != None and len(object.set): 
+          o = TextField(object, self, pos=wxPoint(x, nextY))          
         else:
-          o = wxTextCtrl(self, -1, pos=wxPoint(x, nextY))
+          o = TextField(object, self, pos=wxPoint(x, nextY))
 
 
         self.editorMappings[o] = object
         nextY = nextY + ySpacing + o.GetSize().y
 
-        
+        if self.parser.template.variables.has_key(object.variable): 
+          o.set(self.parser.template.variables[object.variable])
+
+
+class TextField(wxTextCtrl): 
+  def __init__(self, source, parent, pos=wxDefaultPosition, 
size=wxDefaultSize): 
+    wxTextCtrl.__init__(self, parent, -1, pos=pos, size=size)
+    self.source = source
+    self.parent = parent
+    
+    self.forceupper = self.source.forceupper
+    self.forcelower = self.source.forcelower
+
+    if self.forceupper: 
+      EVT_CHAR(wxTextCtrl, self.OnCharUpper)
+    if self.forcelower: 
+      EVT_CHAR(wxTextCtrl, self.OnCharUpper)
+
+
+  def get(self): 
+    return self.GetValue()
+
+  def set(self, value): 
+    self.SetValue(value)
+
+  # TODO: This EVT_CHAR should convert the text to uppercase
+  def OnCharUpper(self, event): 
+    event.Skip()
+
+  # TODO: This EVT_CHAR should convert the text to lowercase
+  def OnCharLower(self, event): 
+    event.Skip()
 
Index: gnue/designer/templates/forms/Simple.py
diff -u gnue/designer/templates/forms/Simple.py:1.3 
gnue/designer/templates/forms/Simple.py:1.4
--- gnue/designer/templates/forms/Simple.py:1.3 Tue Jun 26 21:28:00 2001
+++ gnue/designer/templates/forms/Simple.py     Wed Jun 27 19:26:19 2001
@@ -58,6 +58,8 @@
   # We have all the data, so generate our form
   # This is called 
   def GetFinal(self): 
+
+    self.
     return 1
     
 
@@ -70,7 +72,7 @@
                              WizardInput('title', label='Form Title:', 
required=1, 
                                          size=40), 
                              WizardText('What connection should this form use 
to connect to the \ndatabase?'), 
-                             WizardInput(label='Connection:', required=1, 
+                             WizardInput('connection',label='Connection:', 
required=1, 
                                          set=(('gnue','GNUe Test Connection 
[gnue]'),('gnue','Production Database [op]'))),
  
                  ), #formTemplateGetSource(variables,multple=0), 
@@ -78,7 +80,9 @@
                  'next': '1' },
             '1':  # Step #2 / Get Base Table
                { 'title': 'Select Base Table/Source', 
-                 'content': (WizardText('This is a really, really, really, 
really, really, really, really, really, really, really, long piece of Text'),), 
#formTemplateGetSource(variables,multple=0), 
+                 'content': (WizardText('Now, please select the base table for 
your form.'),
+                             WizardInput('table', label='Base Table:', 
required=1, 
+                                         size=40), ), 
                  'prev': '0', 
                  'next': '2' }, 
             '2':  # Step #3 / Get Columns to Include



reply via email to

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