commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms samples/intro/intro.gfd samples/zipc...


From: James Thompson
Subject: gnue/forms samples/intro/intro.gfd samples/zipc...
Date: Mon, 25 Nov 2002 23:14:41 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/11/25 23:14:40

Modified files:
        forms/samples/intro: intro.gfd 
        forms/samples/zipcode: zipcode.gfd 
        forms/src/GFObjects: GFBlock.py 

Log message:
        sloppyQuery support reintroduced
        converted two gfds for testing

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/intro/intro.gfd.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/zipcode/zipcode.gfd.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFBlock.py.diff?tr1=1.66&tr2=1.67&r1=text&r2=text

Patches:
Index: gnue/forms/samples/intro/intro.gfd
diff -c gnue/forms/samples/intro/intro.gfd:1.9 
gnue/forms/samples/intro/intro.gfd:1.10
*** gnue/forms/samples/intro/intro.gfd:1.9      Tue Oct 22 20:50:18 2002
--- gnue/forms/samples/intro/intro.gfd  Mon Nov 25 23:14:40 2002
***************
*** 1,10 ****
  <?xml version="1.0"?>
  
! <!--  GNUe Designer (0.1.0)
!       Form saved on: 2001-11-20 17:14:37  -->
  
  <form tabbed="top" title="Welcome to GNUe Forms">
!   <trigger type="NAMED" name="PigLatin">#
  # from Joe Strout's Python Tidbits (http://www.strout.net/python/)
  #
  
--- 1,10 ----
  <?xml version="1.0"?>
  
! <!--  GNUe Forms 0.5.0 Migration Tool
!       Saved on: 2002-11-22 00:01:37  -->
  
  <form tabbed="top" title="Welcome to GNUe Forms">
!   <trigger name="PigLatin" type="NAMED"><![CDATA[#
  # from Joe Strout's Python Tidbits (http://www.strout.net/python/)
  #
  
***************
*** 17,23 ****
  import string
  
  s = SampleBlock.NameEntry.get()
! if len(s) &gt; 4:
   out = ''
  
   for word in string.splitfields(s,' '):
--- 17,23 ----
  import string
  
  s = SampleBlock.NameEntry.get()
! if len(s) > 4:
   out = ''
  
   for word in string.splitfields(s,' '):
***************
*** 44,50 ****
  
      # remove up to the first vowel to make suffix
      p = 0
!     while p &lt; len(word) and word[p] not in "aoeuiyAOEUIY":
        p = p+1
  
      if not p:
--- 44,50 ----
  
      # remove up to the first vowel to make suffix
      p = 0
!     while p < len(word) and word[p] not in "aoeuiyAOEUIY":
        p = p+1
  
      if not p:
***************
*** 63,70 ****
  else: 
    out = "Name not long enough."
  SampleBlock.CodeNameEntry.set(string.strip(out))
! </trigger>
!   <trigger type="NAMED" name="MyFortune">
  Fortunes = ['You will have a long and fruitful life with GNUe.',
              'GNUe will solve your next IT problem.',
              'Why you not use GNUe before now?',
--- 63,70 ----
  else: 
    out = "Name not long enough."
  SampleBlock.CodeNameEntry.set(string.strip(out))
! ]]></trigger>
!   <trigger name="MyFortune" type="NAMED"><![CDATA[
  Fortunes = ['You will have a long and fruitful life with GNUe.',
              'GNUe will solve your next IT problem.',
              'Why you not use GNUe before now?',
***************
*** 87,123 ****
    val = "Please enter a valid birth year first."
  
  SampleBlock.FortuneEntry.set(val)
! </trigger>
!   <page name="Welcome">
      <block name="Block_1">
!       <entry name="Entry_1" x="3" y="9" width="34" default="Press 'Page Down' 
for a demo"/>
      </block>
-     <label x="6" y="1" width="26" name="Label_1"
-            text="Welcome to GNU Enterprise!"/>
-     <label x="3" y="4" width="34" name="Label_3"
-            text="This is a placeholder form."/>
-     <box x="1" y="2" width="38" label="Demo" name="Box_1" height="9"/>
-     <label x="3" y="5" width="34" name="Label_8"
-            text="You would normally invoke Forms"/>
-     <label x="3" y="6" width="34" name="Label_9"
-            text="by double-clicking a GFD file"/>
-     <label x="3" y="7" width="34" name="Label_10"
-            text="or by typing 'gnue-forms &lt;file&gt;'."/>
-   </page>
-   <page name="Sample">
-     <box x="1" y="0" width="38" label="Sample" name="Box_2" height="8"/>
-     <label x="3" y="2" width="10" name="Label_5" text="Your Name: "/>
-     <label x="3" y="3" width="20" name="Label_6" text="Year you were born:"/>
-     <label x="3" y="5" width="15" name="Label_7" text="Your Code Name:"/>
      <block name="SampleBlock">
!       <entry x="14" y="2" name="NameEntry" width="23">
!         <trigger type="PRE-FOCUSOUT" name="Trigger_1" src="PigLatin"/>
!       </entry>
!       <entry name="YearEntry" x="22" y="3" width="6"/>
!       <button x="29" y="3" trigger="MyFortune" width="8" label="Fortune"
!               name="btnClear" height="1"/>
!       <entry name="CodeNameEntry" x="3" y="6" width="34"/>
!       <entry name="FortuneEntry" x="2" y="8" width="36" height="4"/>
      </block>
!   </page>
  </form>
--- 87,133 ----
    val = "Please enter a valid birth year first."
  
  SampleBlock.FortuneEntry.set(val)
! ]]></trigger>
!   <logic>
      <block name="Block_1">
!       <field name="Entry_1" default="Press 'Page Down' for a demo"/>
      </block>
      <block name="SampleBlock">
!       <field name="NameEntry">
!         <trigger name="Trigger_1" src="PigLatin" type="PRE-FOCUSOUT"/>
!       </field>
!       <field name="YearEntry"/>
!       <field name="CodeNameEntry"/>
!       <field name="FortuneEntry"/>
      </block>
!   </logic>
!   <layout>
!     <page name="Welcome">
!       <label name="Label_1" text="Welcome to GNU Enterprise!" width="26" x="6"
!              y="1"/>
!       <label name="Label_3" text="This is a placeholder form." width="34"
!              x="3" y="4"/>
!       <box name="Box_1" height="9" label="Demo" width="38" x="1" y="2"/>
!       <label name="Label_8" text="You would normally invoke Forms" width="34"
!              x="3" y="5"/>
!       <label name="Label_9" text="by double-clicking a GFD file" width="34"
!              x="3" y="6"/>
!       <label name="Label_10" text="or by typing 'gnue-forms &lt;file&gt;'."
!              width="34" x="3" y="7"/>
!       <entry block="Block_1" field="Entry_1" width="34" x="3" y="9"/>
!     </page>
!     <page name="Sample">
!       <box name="Box_2" height="8" label="Sample" width="38" x="1" y="0"/>
!       <label name="Label_5" text="Your Name: " width="10" x="3" y="2"/>
!       <label name="Label_6" text="Year you were born:" width="20" x="3" 
y="3"/>
!       <label name="Label_7" text="Your Code Name:" width="15" x="3" y="5"/>
!       <entry block="SampleBlock" field="NameEntry" width="23" x="14" y="2"/>
!       <entry block="SampleBlock" field="YearEntry" width="6" x="22" y="3"/>
!       <button name="btnClear" height="1" label="Fortune" trigger="MyFortune"
!               width="8" x="29" y="3"/>
!       <entry block="SampleBlock" field="CodeNameEntry" width="34" x="3" 
y="6"/>
!       <entry block="SampleBlock" field="FortuneEntry" height="4" width="36"
!              x="2" y="8"/>
!     </page>
!   </layout>
  </form>
Index: gnue/forms/samples/zipcode/zipcode.gfd
diff -c gnue/forms/samples/zipcode/zipcode.gfd:1.22 
gnue/forms/samples/zipcode/zipcode.gfd:1.23
*** gnue/forms/samples/zipcode/zipcode.gfd:1.22 Wed Jun 26 18:31:10 2002
--- gnue/forms/samples/zipcode/zipcode.gfd      Mon Nov 25 23:14:40 2002
***************
*** 1,41 ****
  <?xml version="1.0"?>
  
! <!--  GNUe Designer (0.1.0)
!       Form saved on: 2001-11-04 22:12:53  -->
  
! <form width="42" title="ZIP Code Maintenance" height="17">
    <options>
!     <option value="0.0.1" name="version"/>
    </options>
!   <datasource prequery="" cache="5" database="gnue" name="zips"
!               order_by="state,city" table="zipcode"/>
!   <datasource prequery="" database="gnue" name="validator"
!               order_by="description" table="state"/>
! 
!   <page name="Page_1">
!     <block name="zip" rows="15" datasource="zips">
!       <label x="1" y="1" name="Label_1" text="City"/>
!       <entry name="city" x="1" y="2" width="15" field="city" case="upper" 
required="">
          <options>
            <option name="tip" value="Full name of city"/>
          </options>
!       </entry>
!       <label x="17" y="1" name="Label_2" text="State"/>
!       <entry x="17" y="2" field="state" style="dropdown" name="state" 
width="15"
!               fk_source="validator" fk_key="state"
!              fk_description="description"> 
          <options>
            <option name="tip" value="State"/>
          </options>
!       </entry>
!       <label x="33" y="1" name="Label_3" text="Zip"/>
!       <entry x="33" y="2" field="zip" name="zip" max_length="5" width="5"
!              typecast="number">
          <options>
            <option name="tip" value="US Postal Zip Code"/>
          </options>
!       </entry>
!       <scrollbar x="40" y="2" width="1" height="15"/>
      </block>
!   </page>
  </form>
--- 1,46 ----
  <?xml version="1.0"?>
  
! <!--  GNUe Forms 0.5.0 Migration Tool
!       Saved on: 2002-11-25 22:07:47  -->
  
! <form height="17" title="ZIP Code Maintenance" width="42">
    <options>
!     <option name="version" value="0.0.1"/>
    </options>
!   <datasource name="zips" cache="5" connection="gnue" order_by="state,city"
!               prequery="" table="zipcode"/>
!   <datasource name="validator" connection="gnue" order_by="description"
!               prequery="" table="state"/>
!   <logic>
!     <block name="zip" datasource="zips" rows="15">
!       <field name="city" case="upper" field="city" required="" sloppyQuery="">
          <options>
            <option name="tip" value="Full name of city"/>
          </options>
!       </field>
!       <field name="state" field="state" fk_description="description"
!              fk_key="state" fk_source="validator">
          <options>
            <option name="tip" value="State"/>
          </options>
!       </field>
!       <field name="zip" field="zip" max_length="5" typecast="number">
          <options>
            <option name="tip" value="US Postal Zip Code"/>
          </options>
!       </field>
      </block>
!   </logic>
!   <layout>
!     <page name="Page_1">
!       <label name="Label_1" text="City" x="1" y="1"/>
!       <entry block="zip" field="city" width="15" x="1" y="2"/>
!       <label name="Label_2" text="State" x="17" y="1"/>
!       <entry block="zip" field="state" style="dropdown" width="15" x="17"
!              y="2"/>
!       <label name="Label_3" text="Zip" x="33" y="1"/>
!       <entry block="zip" field="zip" width="5" x="33" y="2"/>
!       <scrollbar height="15" width="1" x="40" y="2"/>
!     </page>
!   </layout>
  </form>
Index: gnue/forms/src/GFObjects/GFBlock.py
diff -c gnue/forms/src/GFObjects/GFBlock.py:1.66 
gnue/forms/src/GFObjects/GFBlock.py:1.67
*** gnue/forms/src/GFObjects/GFBlock.py:1.66    Mon Nov 25 09:59:25 2002
--- gnue/forms/src/GFObjects/GFBlock.py Mon Nov 25 23:14:40 2002
***************
*** 130,136 ****
      if index > cnt:
        raise IndexError
  
-     print "GFBlock", index
      self.jumpRecord(index)
  
      if cnt == index and self.isEmpty():
--- 130,135 ----
***************
*** 391,401 ****
      # the chain that is queried
      for block in self._logic._blockList:
        if block._queryValues.keys():
!         list = [block._dataSourceLink._dataObject]
!         while list[-1]._masterObject:
!           list.append(list[-1]._masterObject)
!         if len(maxList) < len(list): maxList = list
  
      # Build the sql required by the detail blocks
      SQL = ""
      for dataobject in maxList[:-1]:
--- 390,416 ----
      # the chain that is queried
      for block in self._logic._blockList:
        if block._queryValues.keys():
!         templist = [block._dataSourceLink._dataObject]
!         while templist[-1]._masterObject:
!           templist.append(templist[-1]._masterObject)
!         if len(maxList) < len(templist): maxList = templist
  
+     # Store block states
+     for block in self._logic._blockList:
+       block.mode = 'normal'
+       block._lastQueryValues = {}
+       block._lastQueryValues.update(block._queryValues)
+ 
+     # graft in the sloppy query stuff if needed
+     for dataobject in maxList:
+       for block in self._logic._blockList:
+         if dataobject == block._dataSourceLink._dataObject:
+           break
+       for entry in block._entryList:
+         print entry, block._queryValues
+         if hasattr(entry._field,'sloppyQuery') and 
block._queryValues.has_key(entry._field):
+           block._queryValues[entry._field] = "%"+ 
string.join(list(block._queryValues[entry._field]),"%")+"%"
+                                                         
      # Build the sql required by the detail blocks
      SQL = ""
      for dataobject in maxList[:-1]:
***************
*** 405,434 ****
        conditions = _generateConditional(block)
        SQL = self._dataSourceLink.getQueryString(conditions,1,SQL)
  
- ##
- ## TODO: Do we want this anymore? jst
- ##
- ##     # Implement sloppyQuery system
- ##     if self.mode == 'query':
- ##       for entry in self._entryList:
- ##         if hasattr(entry,'sloppyQuery'):
- ##           newValue = '%'
- ##           value = entry._value
- ##           for letter in value:
- ##             if letter != "%":
- ##               newValue += letter+"%"
- ##           entry.setValue(newValue)
  
      for block in self._logic._blockList:
       if maxList[-1] == block._dataSourceLink._dataObject:
        break
      rootBlock = block
- 
-     # Store block states
-     for block in self._logic._blockList:
-       block.mode = 'normal'
-       block._lastQueryValues = {}
-       block._lastQueryValues.update(block._queryValues)
  
      conditions = _generateConditional(rootBlock)
      rootBlock._dataSourceLink.createResultSet(conditions, sql=SQL)     
--- 420,430 ----




reply via email to

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