[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/gnuef/src GFTrigger.py
From: |
Jason Cater |
Subject: |
gnue/gnuef/src GFTrigger.py |
Date: |
Thu, 05 Jul 2001 10:57:21 -0700 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 01/07/05 10:57:21
Modified files:
gnuef/src : GFTrigger.py
Log message:
Added intelligent line wrapping when saving XML elements w/many
attributes; misc other problems w/trigger saving
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFTrigger.py.diff?cvsroot=OldCVS&tr1=1.39&tr2=1.40&r1=text&r2=text
Patches:
Index: gnue/gnuef/src/GFTrigger.py
diff -u gnue/gnuef/src/GFTrigger.py:1.39 gnue/gnuef/src/GFTrigger.py:1.40
--- gnue/gnuef/src/GFTrigger.py:1.39 Wed Jul 4 17:23:55 2001
+++ gnue/gnuef/src/GFTrigger.py Thu Jul 5 10:57:21 2001
@@ -34,6 +34,7 @@
from GFTriggerError import *
from gnue.common.GParser import GContent
from gnue.common.GObjects import GObj
+from gnue.common import GConfig, GTypecast
from xml.sax import saxutils
import string
@@ -195,6 +196,8 @@
xmlEntity = "trigger"
xmlString = "%s<%s" % (gap[:-2],xmlEntity)
+ indent = len(xmlString)
+ pos = indent
for attribute in self.__dict__.keys():
# skip keys beginning with _
if attribute[0] == "_":
@@ -208,12 +211,18 @@
typecast = lookupDict[xmlEntity]['Attributes'][attribute]['Typecast']
if typecast == GTypecast.boolean \
and val == 1:
- xmlString = xmlString + ' %s=""' % (attribute)
- elif typecast == GTypecast.names:
- xmlString = xmlString + ' %s="%s"' % \
+ addl = ' %s=""' % (attribute)
+ elif typecast == GTypecast.names:
+ addl = ' %s="%s"' % \
(attribute, string.join(val,','))
else:
- xmlString = xmlString + ' %s="%s"' % (attribute,
saxutils.escape('%s' % val))
+ addl = ' %s="%s"' % (attribute, saxutils.escape('%s' % val))
+ if len(addl) + pos > 78:
+ xmlString = xmlString + "\n" + " " * indent + addl
+ pos = indent
+ else:
+ xmlString = xmlString + addl
+ pos = pos + len(addl)
if len(self._children):
hasContent = 0
- gnue/gnuef/src GFTrigger.py,
Jason Cater <=