commit-gnue
[Top][All Lists]
Advanced

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

gnue/designer src/TemplateBase.py src/TemplateP...


From: Jason Cater
Subject: gnue/designer src/TemplateBase.py src/TemplateP...
Date: Fri, 16 Aug 2002 00:51:29 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/08/16 00:51:29

Modified files:
        designer/src   : TemplateBase.py TemplateParser.py 
        designer/src/forms/LayoutEditor: LayoutEditor.py 
                                         LayoutEditorTools.py 
        designer/templates/forms: FormBuilder.py Simple.py 
                                  SimpleDetail.py 
        designer/templates/reports: SimpleReport.py 
        designer/templates/schema: Introspection.py 

Log message:
        fixed the mouse hanging issue with wizards; started wizard validation; 
implemented several new plug-ins for forms; added wrapped-text support to the 
wizard page drawing code; misc wizard fixes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/TemplateBase.py.diff?cvsroot=OldCVS&tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/TemplateParser.py.diff?cvsroot=OldCVS&tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/LayoutEditor/LayoutEditor.py.diff?cvsroot=OldCVS&tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/LayoutEditor/LayoutEditorTools.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/forms/FormBuilder.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/forms/Simple.py.diff?cvsroot=OldCVS&tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/forms/SimpleDetail.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/reports/SimpleReport.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/schema/Introspection.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gnue/designer/src/TemplateBase.py
diff -c gnue/designer/src/TemplateBase.py:1.15 
gnue/designer/src/TemplateBase.py:1.16
*** gnue/designer/src/TemplateBase.py:1.15      Mon Jul 22 19:04:59 2002
--- gnue/designer/src/TemplateBase.py   Fri Aug 16 00:51:28 2002
***************
*** 236,244 ****
      self.lowerbound = lowerbound
      self.upperbound = upperbound
      self.forceupper = forceupper
      self.forcelower = forcelower
      self.lines = lines
-     required = required
  
      # The following only have an effect is set != None
      self.maxSelections = maxSelections
--- 236,244 ----
      self.lowerbound = lowerbound
      self.upperbound = upperbound
      self.forceupper = forceupper
+     self.required = required
      self.forcelower = forcelower
      self.lines = lines
  
      # The following only have an effect is set != None
      self.maxSelections = maxSelections
Index: gnue/designer/src/TemplateParser.py
diff -c gnue/designer/src/TemplateParser.py:1.16 
gnue/designer/src/TemplateParser.py:1.17
*** gnue/designer/src/TemplateParser.py:1.16    Mon Jul 22 19:04:59 2002
--- gnue/designer/src/TemplateParser.py Fri Aug 16 00:51:28 2002
***************
*** 154,169 ****
  
    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...
        for mesg in validation:
          print "(*) %s" % mesg
-       event.Veto()
        return
      else:
        if self.nextStep == None:
--- 154,180 ----
  
    def OnNextStep(self, event):
  
+     validation = []
+ 
      # Save the variables from current step
      for o in self.editorMappings.keys():
!       value = o.get()
!       if o.source.required and (value == None or not o.source.set and
!                o.source.typecast == TemplateBase.text and not len(value)):
!         validation.append('A required value is missing for "%s"' % 
o.source.variable)
! 
!         ## TODO: Add the various other validation checks
! 
!       self.parser.template.variables[self.editorMappings[o].variable] = value
  
! 
!     if not validation:
!       validation = self.parser.template.ValidateStep(self.step)
! 
!     if validation:
        # TODO: This should display a dialog box listing problems...
        for mesg in validation:
          print "(*) %s" % mesg
        return
      else:
        if self.nextStep == None:
***************
*** 221,227 ****
          # 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):
--- 232,242 ----
          # TODO: perform our own wrapping. Of course, this is
          # TODO: not at all portable!
  
!         width = self.GetSize().x - xMargin * 2
! 
!         o = WrappedStaticText(self, -1, object.text, width,
!                                 pos=wxPoint(xMargin, nextY))
! 
          nextY = nextY + ySpacing + o.GetSize().y
  
        elif isinstance(object, TemplateBase.WizardInput):
***************
*** 267,273 ****
      if self.forceupper:
        EVT_CHAR(wxTextCtrl, self.OnCharUpper)
      if self.forcelower:
!       EVT_CHAR(wxTextCtrl, self.OnCharUpper)
  
  
    def get(self):
--- 282,288 ----
      if self.forceupper:
        EVT_CHAR(wxTextCtrl, self.OnCharUpper)
      if self.forcelower:
!       EVT_CHAR(wxTextCtrl, self.OnCharLower)
  
  
    def get(self):
***************
*** 286,293 ****
  
  
  
! class ComboField(wxComboBox): 
!   def __init__(self, source, parent, pos=wxDefaultPosition, 
size=wxDefaultSize): 
      wxComboBox.__init__(self, parent, -1, pos=pos, size=size)
      self.source = source
      self.parent = parent
--- 301,308 ----
  
  
  
! class ComboField(wxComboBox):
!   def __init__(self, source, parent, pos=wxDefaultPosition, 
size=wxDefaultSize):
      wxComboBox.__init__(self, parent, -1, pos=pos, size=size)
      self.source = source
      self.parent = parent
***************
*** 295,320 ****
      self.lookup = []
  
      i = 0
!     for choice in source.set: 
        key, descr = choice
        self.mapping[key] = i
        self.lookup.append(key)
        self.Append(descr)
        i = i + 1
  
!   def get(self): 
      return self.lookup[self.GetSelection()]
  
!   def set(self, value): 
      self.SetSelection(self.mapping[value])
  
  
  
! class ListField(wxListBox): 
    def __init__(self, source, parent, pos=wxDefaultPosition, 
size=wxDefaultSize):
!     if source.maxSelections != 1: 
        style = wxLB_MULTIPLE
!     else: 
        style = wxLB_SINGLE
  
      wxListBox.__init__(self, parent, -1, pos=pos, size=size, \
--- 310,335 ----
      self.lookup = []
  
      i = 0
!     for choice in source.set:
        key, descr = choice
        self.mapping[key] = i
        self.lookup.append(key)
        self.Append(descr)
        i = i + 1
  
!   def get(self):
      return self.lookup[self.GetSelection()]
  
!   def set(self, value):
      self.SetSelection(self.mapping[value])
  
  
  
! class ListField(wxListBox):
    def __init__(self, source, parent, pos=wxDefaultPosition, 
size=wxDefaultSize):
!     if source.maxSelections != 1:
        style = wxLB_MULTIPLE
!     else:
        style = wxLB_SINGLE
  
      wxListBox.__init__(self, parent, -1, pos=pos, size=size, \
***************
*** 355,363 ****
  
  class SortableListField(wxPanel):
    def __init__(self, source, parent, pos=wxDefaultPosition,
!               size=wxDefaultSize): 
  
!     wxPanel.__init__(self, parent, -1, pos=pos, size=size, 
                style=wxSIMPLE_BORDER)
  
      self.source = source
--- 370,378 ----
  
  class SortableListField(wxPanel):
    def __init__(self, source, parent, pos=wxDefaultPosition,
!               size=wxDefaultSize):
  
!     wxPanel.__init__(self, parent, -1, pos=pos, size=size,
                style=wxSIMPLE_BORDER)
  
      self.source = source
***************
*** 517,523 ****
        appendages2.insert(0,self.included[i])
        self.included.pop(i)
        self.list2.Delete(i)
!       
      for a in appendages1:
        self.list1.Append(a)
  
--- 532,538 ----
        appendages2.insert(0,self.included[i])
        self.included.pop(i)
        self.list2.Delete(i)
! 
      for a in appendages1:
        self.list1.Append(a)
  
***************
*** 578,581 ****
--- 593,621 ----
  
    def finalize(self):
      pass
+ 
+ 
+ class WrappedStaticText(wxStaticText):
+   def __init__(self, parent, id, label, width, *args, **params):
+     wxStaticText.__init__(self, parent, id, "bah!", *args, **params)
+ 
+ 
+     textSoFar = ""
+     thisLine = ""
+     for part in string.split(label,'\n'):
+       for word in string.split(part):
+         self.SetLabel(thisLine + word)
+         if self.GetSize().width > width:
+           textSoFar += thisLine + " \n"
+           thisLine = word + " "
+         else:
+           thisLine += word + " "
+ 
+       textSoFar += thisLine + " \n"
+       thisLine = ""
+ 
+     if len(textSoFar):
+       self.SetLabel(string.replace(textSoFar,' \n','\n')[:-1])
+     else:
+       self.SetLabel("")
  
Index: gnue/designer/src/forms/LayoutEditor/LayoutEditor.py
diff -c gnue/designer/src/forms/LayoutEditor/LayoutEditor.py:1.29 
gnue/designer/src/forms/LayoutEditor/LayoutEditor.py:1.30
*** gnue/designer/src/forms/LayoutEditor/LayoutEditor.py:1.29   Wed Aug  7 
19:29:18 2002
--- gnue/designer/src/forms/LayoutEditor/LayoutEditor.py        Fri Aug 16 
00:51:28 2002
***************
*** 444,450 ****
           width = None
           height = None
  
!        self.endPrePositioningTemplate(x1, y1, width, height)
  
  
  
--- 444,450 ----
           width = None
           height = None
  
!        
PrepositioningTimer(self.endPrePositioningTemplate,x1,y1,width,height).Start(100,1)
  
  
  
***************
*** 534,537 ****
--- 534,550 ----
                                                 width=width,
                                                 height=height)
      self.mode = 'move'
+ 
+ 
+ 
+ class PrepositioningTimer(wxTimer):
+     def __init__(self, method, *args, **params):
+       self.__method = method
+       self.__args = args
+       self.__params = params
+       wxTimer.__init__(self)
+ 
+     def Notify(self):
+       self.__method(*self.__args, **self.__params)
+ 
  
Index: gnue/designer/src/forms/LayoutEditor/LayoutEditorTools.py
diff -c gnue/designer/src/forms/LayoutEditor/LayoutEditorTools.py:1.8 
gnue/designer/src/forms/LayoutEditor/LayoutEditorTools.py:1.9
*** gnue/designer/src/forms/LayoutEditor/LayoutEditorTools.py:1.8       Wed Aug 
 7 19:29:18 2002
--- gnue/designer/src/forms/LayoutEditor/LayoutEditorTools.py   Fri Aug 16 
00:51:28 2002
***************
*** 35,42 ****
  ToolbarMapping = 'File|New|Form,tb_new.png;'   \
                 + 'File|Save,tb_save.png;'   \
                 + ';'   \
                 + 'Tools|Insert|Unbound Entry,deslay_entrytext.png;'   \
!                + 'Tools|Insert|Drop Down Entry,deslay_entrydrop.png'
  
  #               + 'File|Open,tb_open.png;'   \
  
--- 35,44 ----
  ToolbarMapping = 'File|New|Form,tb_new.png;'   \
                 + 'File|Save,tb_save.png;'   \
                 + ';'   \
+                + 'Tools|Insert|Label,deslay_label.png;' \
                 + 'Tools|Insert|Unbound Entry,deslay_entrytext.png;'   \
!                + 'Tools|Insert|Drop Down Entry,deslay_entrydrop.png;' \
!                + 'Tools|Insert|Box,deslay_box.png'
  
  #               + 'File|Open,tb_open.png;'   \
  
Index: gnue/designer/templates/forms/FormBuilder.py
diff -c gnue/designer/templates/forms/FormBuilder.py:1.6 
gnue/designer/templates/forms/FormBuilder.py:1.7
*** gnue/designer/templates/forms/FormBuilder.py:1.6    Fri Jul 19 19:21:14 2002
--- gnue/designer/templates/forms/FormBuilder.py        Fri Aug 16 00:51:28 2002
***************
*** 116,123 ****
  
        return   { 'title': 'Basic Form Information',
                   '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),
--- 116,123 ----
  
        return   { 'title': 'Basic Form Information',
                   'content': (WizardText('Welcome to the sample form wizard.'),
!                              WizardText('To create your form, I need to know 
some basic information. \n\n'
!                                         'First, what shall I call your form? 
This name will appear in '
                                          'the title bar.'),
                               WizardInput('title', label='Form Title:', 
required=1,
                                           size=40),
***************
*** 133,139 ****
        if iteration == 0:
          # first time through ask about reusing same connection
          return   { 'title': 'Connection Information',
!                    'content':  (WizardText('What connection contains the 
table you wish to\nthe form?'),
                                  
WizardInput('connection%s'%iteration,label='Connection:', required=1,
                                              
set=self.GetAvailableConnections()),
                                  WizardInput('singleconnection',
--- 133,139 ----
        if iteration == 0:
          # first time through ask about reusing same connection
          return   { 'title': 'Connection Information',
!                    'content':  (WizardText('What connection contains the 
table you wish to the form?'),
                                  
WizardInput('connection%s'%iteration,label='Connection:', required=1,
                                              
set=self.GetAvailableConnections()),
                                  WizardInput('singleconnection',
***************
*** 149,155 ****
        else:
  
          return   { 'title': 'Connection Information',
!                    'content':  (WizardText('What connection contains the 
table you wish to\nthe form?'),
                                  
WizardInput('connection%s'%iteration,label='Connection:', required=1,
                                              
set=self.GetAvailableConnections()),
                                  WizardText('You may be asked to login to this 
connection.'),
--- 149,155 ----
        else:
  
          return   { 'title': 'Connection Information',
!                    'content':  (WizardText('What connection contains the 
table you wish to the form?'),
                                  
WizardInput('connection%s'%iteration,label='Connection:', required=1,
                                              
set=self.GetAvailableConnections()),
                                  WizardText('You may be asked to login to this 
connection.'),
Index: gnue/designer/templates/forms/Simple.py
diff -c gnue/designer/templates/forms/Simple.py:1.10 
gnue/designer/templates/forms/Simple.py:1.11
*** gnue/designer/templates/forms/Simple.py:1.10        Fri Jul 19 19:21:14 2002
--- gnue/designer/templates/forms/Simple.py     Fri Aug 16 00:51:28 2002
***************
*** 72,83 ****
      if stepCode == '0':
        return   { 'title': 'Basic Form Information',
                   '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('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
--- 72,83 ----
      if stepCode == '0':
        return   { 'title': 'Basic Form Information',
                   'content': (WizardText('Welcome to the sample form wizard.'),
!                              WizardText('To create your form, I need to know 
some basic information.\n\n'
!                                         'First, what shall I call your form? 
This name will appear in '
                                          'the title bar.'),
                               WizardInput('title', label='Form Title:', 
required=1,
                                           size=40),
!                              WizardText('What connection should this form use 
to connect to the database?'),
                               WizardInput('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
Index: gnue/designer/templates/forms/SimpleDetail.py
diff -c gnue/designer/templates/forms/SimpleDetail.py:1.5 
gnue/designer/templates/forms/SimpleDetail.py:1.6
*** gnue/designer/templates/forms/SimpleDetail.py:1.5   Mon Aug  5 02:00:35 2002
--- gnue/designer/templates/forms/SimpleDetail.py       Fri Aug 16 00:51:28 2002
***************
*** 64,75 ****
      if stepCode == '0':
        return   { 'title': 'Basic Form Information',
                   '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('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
--- 64,75 ----
      if stepCode == '0':
        return   { 'title': 'Basic Form Information',
                   'content': (WizardText('Welcome to the sample form wizard.'),
!                              WizardText('To create your form, I need to know 
some basic information.\n\n'
!                                         'First, what shall I call your form? 
This name will appear in '
                                          'the title bar.'),
                               WizardInput('title', label='Form Title:', 
required=1,
                                           size=40),
!                              WizardText('What connection should this form use 
to connect to the database?'),
                               WizardInput('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
Index: gnue/designer/templates/reports/SimpleReport.py
diff -c gnue/designer/templates/reports/SimpleReport.py:1.1 
gnue/designer/templates/reports/SimpleReport.py:1.2
*** gnue/designer/templates/reports/SimpleReport.py:1.1 Tue Jul 23 13:52:52 2002
--- gnue/designer/templates/reports/SimpleReport.py     Fri Aug 16 00:51:28 2002
***************
*** 69,80 ****
      if stepCode == '0':
        return   { 'title': 'Basic Report Information',
                   'content': (WizardText('Welcome to the sample report 
wizard.'),
!                              WizardText('To create your report, I need to 
know some basic information. \n'
!                                         'First, what shall I call your 
report? This name will appear in \n'
                                          'the title bar.'),
                               WizardInput('title', label='Report Title:', 
required=1,
                                           size=40),
!                              WizardText('What connection should this report 
use to connect to the \ndatabase?'),
                               WizardInput('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
--- 69,80 ----
      if stepCode == '0':
        return   { 'title': 'Basic Report Information',
                   'content': (WizardText('Welcome to the sample report 
wizard.'),
!                              WizardText('To create your report, I need to 
know some basic information.\n\n'
!                                         'First, what shall I call your 
report? This name will appear in '
                                          'the title bar.'),
                               WizardInput('title', label='Report Title:', 
required=1,
                                           size=40),
!                              WizardText('What connection should this report 
use to connect to the database?'),
                               WizardInput('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
Index: gnue/designer/templates/schema/Introspection.py
diff -c gnue/designer/templates/schema/Introspection.py:1.5 
gnue/designer/templates/schema/Introspection.py:1.6
*** gnue/designer/templates/schema/Introspection.py:1.5 Tue Aug  6 11:06:29 2002
--- gnue/designer/templates/schema/Introspection.py     Fri Aug 16 00:51:29 2002
***************
*** 69,80 ****
      if stepCode == '0':
        return   { 'title': 'Basic Form Information',
                   'content': (WizardText('Welcome to the introspection schema 
wizard.'),
!                              WizardText('To create your schema, I need to 
know some basic information. \n'
!                                         'First, what shall I call this 
schema? This name is for \n'
                                          'informational use only.'),
                               WizardInput('title', label='Schema Name:', 
required=1,
                                           size=40),
!                              WizardText('What connection should we use to 
connect to the \ndatabase for introspection?'),
                               WizardInput('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),
--- 69,80 ----
      if stepCode == '0':
        return   { 'title': 'Basic Form Information',
                   'content': (WizardText('Welcome to the introspection schema 
wizard.'),
!                              WizardText('To create your schema, I need to 
know some basic information.\n\n'
!                                         'First, what shall I call this 
schema? This name is for '
                                          'informational use only.'),
                               WizardInput('title', label='Schema Name:', 
required=1,
                                           size=40),
!                              WizardText('What connection should we use to 
connect to the database for introspection?'),
                               WizardInput('connection',label='Connection:', 
required=1,
                                           set=self.GetAvailableConnections()),
                               WizardText('You may be asked to login to this 
connection.'),




reply via email to

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