commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef/samples/intro intro.gfd PigLatinPubl...


From: Jason Cater
Subject: gnue/gnuef/samples/intro intro.gfd PigLatinPubl...
Date: Tue, 20 Nov 2001 18:25:36 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/11/20 18:25:36

Modified files:
        gnuef/samples/intro: intro.gfd 
Added files:
        gnuef/samples/intro: PigLatinPublicDomain.txt 

Log message:
        Created a nifty intro/demo form :)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/samples/intro/PigLatinPublicDomain.txt?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/samples/intro/intro.gfd.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/gnuef/samples/intro/intro.gfd
diff -u gnue/gnuef/samples/intro/intro.gfd:1.1 
gnue/gnuef/samples/intro/intro.gfd:1.2
--- gnue/gnuef/samples/intro/intro.gfd:1.1      Thu Nov 15 16:29:11 2001
+++ gnue/gnuef/samples/intro/intro.gfd  Tue Nov 20 18:25:36 2001
@@ -1,25 +1,119 @@
 <?xml version="1.0"?>
 
 <!--  GNUe Designer (0.1.0)
-      Form saved on: 2001-11-15 15:59:45  -->
+      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/)
+#
+
+def append(w,suffix):
+  from string import uppercase, upper, lower
+  if not w: return suffix
+  elif w[-1] in uppercase: return w + upper(suffix)
+  else: return w + lower(suffix)
+
+import string
+
+s = SampleBlock.fields.NameEntry
+out = ''
+for word in string.splitfields(s,' '):
+  if word:
+    # check for punctuation
+    p = 0
+    while word[p-1] not in string.uppercase+string.lowercase:
+      p = p-1
+    if p:
+      punc = word[p:]
+      word = word[:p]
+    else: punc = ''
+
+    # and pre-punc (e.g., parentheses)
+    p = 0
+    while word[p] not in string.uppercase+string.lowercase:
+      p = p+1
+    prepunc = word[:p]
+    word = word[p:]
+
+    # note capitalization
+    if word[0] in string.uppercase: caps = 1
+    else: caps = 0
+
+    # 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:
+      word = append( word, "yay" )
+    else:
+      word = append( word[p:], word[:p]+"ay")
+
+    # recapitalize, as appropriate
+    if caps: word = string.upper(word[0]) + word[1:]
+
+    # restore any punctuation
+    word = prepunc + word + punc
+
+  out = out + ' ' + word
+
+SampleBlock.fields.CodeNameEntry = 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?', 
+            'You will fall in love with a tall, dark GNUe form.', 
+            'Joy will overcome your new life with GNUe.', 
+            'You will live a free life with GNUe tools', 
+            'Move slowly but surely to success with GNUe.', 
+            'Others are drawn to your GNUe tools.', 
+            'You have a magnetic personality with GNUe forms.',
+            'Use GNUe and you will notice the extraordinary in the ordinary.']
+      
+if len(SampleBlock.fields.YearEntry): 
+
+  try:
+    val = 'Confucius say, 
"%s"'%Fortunes[int(SampleBlock.fields.YearEntry[-1:])]
+  except ValueError: 
+    val = "Please enter a valid birth year first."
+  
+else: 
+  val = "Please enter a valid birth year first."
+
+SampleBlock.fields.FortuneEntry = val
+</trigger>
   <page name="Welcome">
     <block name="Block_1">
-      <entry name="Entry_1" x="10" y="5" width="27"/>
-      <label x="3" y="5" width="8" name="Label_4" text="Name:"/>
+      <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="1" y="11" width="38" name="Label_2"
-           text="(This is an introductory sample form)"/>
-    <label x="1" y="2" width="38" name="Label_3"
-           text="Someone, please do a neat intro form!"/>
-    <box x="1" y="3" width="38" label="Demo" name="Box_1" height="8"/>
+    <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 'gfclient &lt;file&gt;'."/>
   </page>
-  <page name="Samples">
-    <box x="5" y="1" width="29" label="Samples" name="Box_2" height="8"/>
-    <button x="22" y="7" width="10" label="Button_1" name="Button_1"
-            height="1"/>
+  <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>



reply via email to

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