From e78cf626944b13bff63d15a2a22e80357e9436ec Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Fri, 9 Dec 2011 08:56:37 +0100 Subject: [PATCH] appy.gen: bugfix in group widget 'tabs'; improved layout of grid widgets in view mode; appy.pod: class OdtTable allows to generate HTML tables as well. --- gen/ui/appy.css | 2 +- gen/ui/gotoSource.png | Bin 225 -> 226 bytes gen/ui/widgets/list.pt | 7 +++-- gen/ui/widgets/show.pt | 4 +-- pod/parts.py | 62 ++++++++++++++++++++++++++++++----------- 5 files changed, 52 insertions(+), 23 deletions(-) diff --git a/gen/ui/appy.css b/gen/ui/appy.css index 9d81cb2..5b1d468 100644 --- a/gen/ui/appy.css +++ b/gen/ui/appy.css @@ -65,7 +65,7 @@ img {border: 0;} .list { border: 1px solid grey; margin-bottom: 3px;} .list td, .list th { border: 1px solid grey; padding-left: 5px; padding-right: 5px; padding-top: 3px;} -.list th { background-color: #cbcbcb; font-style: italic; font-weight: normal;} +.list th { background-color: #D4D4D4; font-style: italic; font-weight: normal;} .grid th { font-style: italic; font-weight: normal; border-bottom: 2px solid grey; padding: 2px 2px;} .grid td { padding-right: 5px; } diff --git a/gen/ui/gotoSource.png b/gen/ui/gotoSource.png index 0c65ca295c9ed254b06ca2813fa09f975bfcb4ae..32cb1efbb705a97f50f71cf63c79d8c7a10473c0 100644 GIT binary patch delta 85 zcmaFJ_=s_W1qb8*$zBt!BZMY8Sa99u;SiLw+I?V6$HXQb6M0V;#}JO|$q7J^l#q~~ n@E|{7g6)BXj|~eKG%)fos6ArNlg{JnV*mnAS3j3^P6gge1xMol$zH2u*9%T`u;9AMEx>7EU7q=V=ENo)V>wS3#}JO|$qzgeCR83s osBBocqw%37a|g?&MkO0ghLpGL6Ksw4x-kHOr>mdKI;Vst0B)ooO#lD@ diff --git a/gen/ui/widgets/list.pt b/gen/ui/widgets/list.pt index 118ed1f..e435f7c 100644 --- a/gen/ui/widgets/list.pt +++ b/gen/ui/widgets/list.pt @@ -18,10 +18,11 @@ The whole table, edit or view. - + tal:attributes="id python: 'list_%s' % name; + class python: isEdit and 'grid' or 'list'"> Header + Rows of data diff --git a/gen/ui/widgets/show.pt b/gen/ui/widgets/show.pt index 5cf53d4..f82bdb2 100644 --- a/gen/ui/widgets/show.pt +++ b/gen/ui/widgets/show.pt @@ -108,8 +108,8 @@ id tagId; name tagId"> First row: the tabs.
-
- - +
+ ' def endRow(self): - self.res += '' % self.tns + if not self.html: + self.res += '' % self.tns + else: + self.res += '' def startTable(self): - self.res += '<%stable %sname="%s">' % (self.tns, self.tns, self.name) - self.res += '<%stable-column %snumber-columns-repeated="%d"/>' % \ - (self.tns, self.tns, self.nbOfCols) + if not self.html: + self.res += '<%stable %sname="%s">' % (self.tns, self.tns, + self.name) + self.res += '<%stable-column %snumber-columns-repeated="%d"/>' % \ + (self.tns, self.tns, self.nbOfCols) + else: + css = '' + if self.name: css = ' class="%s"' % self.name + self.res += '' % css def endTable(self): - self.res += '' % self.tns + if not self.html: + self.res += '' % self.tns + else: + self.res += '
' % \ - (self.tns, self.tns, cellStyle, self.tns, span) - self.res += '<%sp %sstyle-name="%s">%s' % \ - (self.txns, self.txns, paraStyle, cgi.escape(str(content)), - self.txns) - self.res += '' % self.tns + if not self.html: + self.res += '<%stable-cell %sstyle-name="%s" ' \ + '%snumber-columns-spanned="%d">' % \ + (self.tns, self.tns, cellStyle, self.tns, span) + self.res += '<%sp %sstyle-name="%s">%s' % \ + (self.txns, self.txns, paraStyle, + cgi.escape(str(content)), self.txns) + self.res += '' % self.tns + else: + tag = header and 'th' or 'td' + self.res += '<%s colspan="%d">%s' % \ + (tag, span, cgi.escape(str(content)), tag) def startRow(self): - self.res += '<%stable-row>' % self.tns + if not self.html: + self.res += '<%stable-row>' % self.tns + else: + self.res += '
' def dumpFloat(self, number): return str(round(number, 2)) def get(self): '''Returns the whole table.''' - return self.res.decode('utf-8') + if self.html: + return self.res + else: + return self.res.decode('utf-8') # ------------------------------------------------------------------------------