commit-gnue
[Top][All Lists]
Advanced

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

gnue/designer src/Incubator.py src/PropertyEdit...


From: Jason Cater
Subject: gnue/designer src/Incubator.py src/PropertyEdit...
Date: Tue, 26 Jun 2001 21:28:00 -0700

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

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

Log message:
        Switched to new parser format; implemented more of the wizard/template; 
fixed various bugs w/layout and property editor; fixed some win32 specific 
problems

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/Incubator.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/PropertyEditor.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/TemplateBase.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/TemplateParser.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/forms/Simple.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue/designer/src/Incubator.py
diff -u gnue/designer/src/Incubator.py:1.5 gnue/designer/src/Incubator.py:1.6
--- gnue/designer/src/Incubator.py:1.5  Sat Jun 23 14:20:00 2001
+++ gnue/designer/src/Incubator.py      Tue Jun 26 21:28:00 2001
@@ -123,10 +123,19 @@
   elements = GFParser.getXMLelements()
   for tag in elements.keys(): 
     t = elements[tag]
-    if len(t) > 3: 
-      cascade, parents = t[3]
+
+    print t
+    print tag
+
+    if t.has_key('UsableBySiblings'): 
+      cascade = t['UsableBySiblings']
     else: 
-      cascade, parents = (0,None)
+      cascade = 0
+
+    if t.has_key('ParentTags'):
+      parents = t['ParentTags']
+    else: 
+      parents = None
 
     if parents != None: 
       for parent in parents:
Index: gnue/designer/src/PropertyEditor.py
diff -u gnue/designer/src/PropertyEditor.py:1.6 
gnue/designer/src/PropertyEditor.py:1.7
--- gnue/designer/src/PropertyEditor.py:1.6     Sun Jun 24 19:59:30 2001
+++ gnue/designer/src/PropertyEditor.py Tue Jun 26 21:28:00 2001
@@ -55,7 +55,12 @@
       return
     if handler != __name__:
       self.object = object
-      self.attributes = elements[string.lower(object.getObjectType()[2:])][1]
+
+      try:       
+        self.attributes = 
elements[string.lower(object.getObjectType()[2:])]['Attributes']
+      except KeyError: 
+        self.attributes = {}
+
       self.elements = elements[string.lower(object.getObjectType()[2:])]
 
       # This is a nasty temporary way of refreshing grid
@@ -133,7 +138,12 @@
       return
     if handler != __name__:
       self.object = object
-      self.attributes = elements[string.lower(object.getObjectType()[2:])][1]
+
+      try:       
+        self.attributes = 
elements[string.lower(object.getObjectType()[2:])]['Attributes']
+      except KeyError: 
+        self.attributes = {}
+
       self.elements = elements[string.lower(object.getObjectType()[2:])]
 
       # This is a nasty temporary way of refreshing grid
@@ -239,6 +249,7 @@
     i = 0
 
     self.objectList = []
+    self.objectCombo.Clear()
     for key in keys: 
       self.objectList.append(nameMap[key])
       self.objectMap[nameMap[key]] = i
Index: gnue/designer/src/TemplateBase.py
diff -u gnue/designer/src/TemplateBase.py:1.2 
gnue/designer/src/TemplateBase.py:1.3
--- gnue/designer/src/TemplateBase.py:1.2       Mon Jun 25 21:49:19 2001
+++ gnue/designer/src/TemplateBase.py   Tue Jun 26 21:28:00 2001
@@ -83,6 +83,10 @@
   # The first step in our wizard
   FIRST_STEP = '0'
 
+  # Stores all the variables
+  # entered by the wizard user.
+  variables = {}
+
   def Start(self, object): 
     return 0
   
@@ -159,16 +163,17 @@
     self.text = text
 
 class WizardInput (WizardItem): 
-  def __init__(self, label, typecast=char, 
+  def __init__(self, variable, label, typecast=char, 
                set=None, size=10, lowerbound=None, upperbound=None, 
                forceupper=0, forcelower=0, required=0):
 
+    self.variable = variable
     self.label = label
     self.typecast = typecast
     self.set = set
     self.size = size
     self.lowerbound = lowerbound
     self.upperbound = upperbound
-    self.forceupper = forceuppper
+    self.forceupper = forceupper
     self.forcelower = forcelower
     required = required
Index: gnue/designer/src/TemplateParser.py
diff -u gnue/designer/src/TemplateParser.py:1.1 
gnue/designer/src/TemplateParser.py:1.2
--- gnue/designer/src/TemplateParser.py:1.1     Mon Jun 25 21:49:19 2001
+++ gnue/designer/src/TemplateParser.py Tue Jun 26 21:28:00 2001
@@ -27,7 +27,7 @@
 # NOTES:
 
 from wxPython.wx import *
-from TemplateBase import *
+from gnue.designer import TemplateBase 
 
 class TemplateParser: 
   def __init__(self, instance, form, parent, templateInformation): 
@@ -44,7 +44,7 @@
 
     # If this is simply a template and not a wizard, 
     # generate the results and get out of Dodge. 
-    if self.templateInformation['Behavior'] == TEMPLATE: 
+    if self.templateInformation['Behavior'] == TemplateBase.TEMPLATE: 
       self.template.GetFinal()
       return 1
 
@@ -74,16 +74,37 @@
     self.prevButton.SetPosition( (x - dx*2, y) )
 
 
-    self.wizardPage.setStep(self.template.FIRST_STEP)
-
 
     EVT_BUTTON(self.wizard,self.prevButton.GetId(), self.wizardPage.OnPrevStep)
     EVT_BUTTON(self.wizard,self.nextButton.GetId(), self.wizardPage.OnNextStep)
     EVT_BUTTON(self.wizard,self.cancelButton.GetId(), self.wizardPage.OnCancel)
 
 
+    self.title = wxStaticText(self.panel, -1, "Wizard Header", 
pos=wxPoint(10,10))
+    font = self.title.GetFont()
+    font.SetPointSize(int(self.title.GetFont().GetPointSize()*1.5))
+    font.SetStyle(wxITALIC)
+#    font.SetWeight(wxBOLD)
+    self.title.SetForegroundColour(wxColour(255,255,255))
+    self.title.SetFont(font)
+    self.title2 = wxStaticText(self.panel, -1, "Wizard Header", 
pos=wxPoint(11,11))    
+    self.title2.SetForegroundColour(wxColour(0,0,102))
+    self.title2.SetFont(font)
+
     self.wizard.Fit()
 
+    self.wizardPage.SetPosition((20, 20 + self.title.GetSize().y))
+    w,h = self.wizard.GetClientSizeTuple()
+    w = w - 50
+    h = h - 56 - self.title.GetSize().y - self.nextButton.GetSize().y
+    self.wizardPage.SetSize((w,h))
+    self.wizardPage.SetBackgroundColour(
+        wxColour(
+          self.panel.GetBackgroundColour().Red() + 32, 
+          self.panel.GetBackgroundColour().Green() + 32,
+          self.panel.GetBackgroundColour().Blue() + 32) )
+
+    self.wizardPage.setStep(self.template.FIRST_STEP)
     completed = self.wizard.ShowModal()
     if completed: 
       completed = self.template.GetFinal() 
@@ -95,7 +116,7 @@
 
 class WizardPage(wxPanel): 
   def __init__(self, parser, parent): 
-    wxPanel.__init__(self, parent, -1, pos=wxPoint(0,0), size=wxSize(400,250))
+    wxPanel.__init__(self, parent, -1, pos=wxPoint(0,0), size=wxSize(400,250), 
style=wxSIMPLE_BORDER)
     self.parser = parser 
     self.parent = parent
     self.panel = None
@@ -145,10 +166,11 @@
     for child in self.GetChildren():
       child.Destroy()
 
-    xMargin = 10
-    yMargin = 10
+    xMargin = 6
+    xMarginInput = xMargin * 3
+    yMargin = 6
 
-    xSpacing = 6
+    xSpacing = 10
     ySpacing = 6
     nextY = yMargin
 
@@ -157,19 +179,47 @@
     else: 
       self.parser.nextButton.SetLabel('Continue >')
 
-    title = wxStaticText(self, -1, self.stepInfo['title'], 
pos=wxPoint(xMargin, yMargin))
+    if self.prevStep == None: 
+      self.parser.prevButton.Enable(0)
+    else: 
+      self.parser.prevButton.Enable(1)
 
-    font = title.GetFont()
+    self.parser.title.SetLabel(self.stepInfo['title'])
+    self.parser.title2.SetLabel(self.stepInfo['title'])
 
-    font.SetPointSize(int(title.GetFont().GetPointSize()*1.5))
-    font.SetStyle(wxITALIC)
-#    font.SetWeight(wxBOLD)
+    xMargin = xMargin
+    nextY = yMargin   
+
+    self.editorMappings = {}
+
+    for object in self.stepInfo['content']: 
+
+      if isinstance(object, TemplateBase.WizardText): 
+
+        # TODO: WizardText should automagically be wrapped. 
+        # TODO: Currently, we must embed \n in the text to 
+        # TODO: perform our own wrapping. Of course, this is 
+        # TODO: not at all portable!
+
+        o = wxStaticText(self, -1, object.text, pos=wxPoint(xMargin, nextY))
+        nextY = nextY + ySpacing + o.GetSize().y
+
+
+      elif isinstance(object, TemplateBase.WizardInput): 
+        
+        x = xMarginInput
+        if object.label != None: 
+          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))          
+        else:
+          o = wxTextCtrl(self, -1, pos=wxPoint(x, nextY))
 
-    title.SetForegroundColour(wxBLUE)
-    
-    title.SetFont(font)
-    title.Refresh()
-    
 
+        self.editorMappings[o] = object
+        nextY = nextY + ySpacing + o.GetSize().y
 
+        
 
Index: gnue/designer/templates/forms/Simple.py
diff -u gnue/designer/templates/forms/Simple.py:1.2 
gnue/designer/templates/forms/Simple.py:1.3
--- gnue/designer/templates/forms/Simple.py:1.2 Mon Jun 25 21:49:19 2001
+++ gnue/designer/templates/forms/Simple.py     Tue Jun 26 21:28:00 2001
@@ -63,18 +63,28 @@
 
   pages = { '0':  # Step #1 / Get Title, et al
                { 'title': 'Basic Form Information', 
-                 'content': (), #formTemplateGetBasicInfo(variables),
+                 'content': (WizardText('Welcome to the sample form wizard.'),
+                             WizardText('To create your form, I need to know 
some basic information. \n'
+                                        'First, what shall I call your form? 
This name will appear in \n'
+                                        'the title bar.'), 
+                             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, 
+                                         set=(('gnue','GNUe Test Connection 
[gnue]'),('gnue','Production Database [op]'))),
+ 
+                 ), #formTemplateGetSource(variables,multple=0), 
                  'prev': None, 
                  'next': '1' },
             '1':  # Step #2 / Get Base Table
                { 'title': 'Select Base Table/Source', 
-                 'content': (), #formTemplateGetSource(variables,multple=0), 
+                 'content': (WizardText('This is a really, really, really, 
really, really, really, really, really, really, really, long piece of Text'),), 
#formTemplateGetSource(variables,multple=0), 
                  'prev': '0', 
                  'next': '2' }, 
             '2':  # Step #3 / Get Columns to Include
                { 'title': 'Basic Form Information', 
                  'prev': '1', 
-                 'content': (), 
+                 'content': (WizardText('This is\nText'),), 
                  'next': None } }
   
 



reply via email to

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