From 7514eb31a914a777c8ea9317e20625ca45471300 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Fri, 2 Sep 2011 09:59:49 +0200 Subject: [PATCH] appy.pod: bugfix in html2odt: in some situations, while using stylesMappings, some empty tags were present in the result, producing a superflous empty paragraph; bugfix while importing PNG files under Windows; appy.gen: began to implement a new global Appy-specific page template and styles. --- gen/__init__.py | 2 + gen/plone25/generator.py | 7 ++- gen/plone25/skin/appy.css | 21 +++++++ gen/plone25/skin/logo.jpg | Bin 0 -> 5359 bytes gen/plone25/skin/template.pt | 78 +++++++++++++++++++++++++ gen/plone25/templates/frontPageAppy.pt | 5 ++ gen/utils.py | 17 ------ pod/doc_importers.py | 2 +- pod/xhtml2odt.py | 3 + 9 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 gen/plone25/skin/appy.css create mode 100644 gen/plone25/skin/logo.jpg create mode 100644 gen/plone25/skin/template.pt create mode 100644 gen/plone25/templates/frontPageAppy.pt diff --git a/gen/__init__.py b/gen/__init__.py index 71b421b..aa79818 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -2605,6 +2605,8 @@ class Config: # frontPage = True will replace the Plone front page with a page # whose content will come fron i18n label "front_page_text". self.frontPage = False + # You can choose the Plone or Appy main template + self.frontPageTemplate = 'plone' # or "appy" # If you don't need the portlet that appy.gen has generated for your # application, set the following parameter to False. self.showPortlet = True diff --git a/gen/plone25/generator.py b/gen/plone25/generator.py index 19b80c8..18539ba 100644 --- a/gen/plone25/generator.py +++ b/gen/plone25/generator.py @@ -159,8 +159,7 @@ class Generator(AbstractGenerator): self.generateTool() self.generateInit() self.generateTests() - if self.config.frontPage: - self.generateFrontPage() + if self.config.frontPage: self.generateFrontPage() self.copyFile('Install.py', self.repls, destFolder='Extensions') self.generateConfigureZcml() self.copyFile('import_steps.xml', self.repls, @@ -566,6 +565,8 @@ class Generator(AbstractGenerator): def generateFrontPage(self): fp = self.config.frontPage repls = self.repls.copy() + template = 'frontPage.pt' + if self.config.frontPageTemplate== 'appy': template = 'frontPageAppy.pt' if fp == True: # We need a front page, but no specific one has been given. # So we will create a basic one that will simply display @@ -582,7 +583,7 @@ class Generator(AbstractGenerator): page, macro = fp.split('/') repls['pageContent'] = '' % (page, macro) - self.copyFile('frontPage.pt', repls, destFolder=self.skinsFolder, + self.copyFile(template, repls, destFolder=self.skinsFolder, destName='%sFrontPage.pt' % self.applicationName) def generateTool(self): diff --git a/gen/plone25/skin/appy.css b/gen/plone25/skin/appy.css new file mode 100644 index 0000000..c575df5 --- /dev/null +++ b/gen/plone25/skin/appy.css @@ -0,0 +1,21 @@ +body { + font: 75% Lucida,Helvetica,Arial,sans-serif; + background-color: #EAEAEA; +} + +a {text-decoration: none; color: #747171;} +a:visited {color: #840107;} +table { font-size: 100%; border-spacing: 0px; } + +.main { + width: 900px; + background-color: white; + border-style: solid; + border-width: 1px; + border-color: grey; + box-shadow: 3px 3px 3px #A9A9A9; +} + +.top { height: 80px; margin-left: 3em; vertical-align: top;} +.lang { margin-right: 3px; } +.auth { background-color: grey;} diff --git a/gen/plone25/skin/logo.jpg b/gen/plone25/skin/logo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5cf038f229b8bf578009ccfbfdcc313ca863cc34 GIT binary patch literal 5359 zcmbVOc{r49+rMW9V`m11jBOOz8e@sEW#6)94++_qkdQ5el5L12kt{KG*~t=Fi-hdi z%AV|@;=Rf9Jpt%}&%@!vDS%d8Sxp&$Kp=oB_yG>5 z$-gN1IM@P!ni?-a3IG5(Km&mS)F286jTXctpnn7!5&{Dtpg%HZ2=TE`0r8m=`~t*0 zCmbkC1MU?e7l zaX3oznDducQPb36#|nxGih*%4LP9u!-6U+|Ahh+WXgWCY~9~gFmkJ2Z~`lFE% zM~A_6#65bhETEBthQ(kca2R167RxSl5r@U#gt7l|52PORkGu_NP%sko z_{Q`k#6k48x+4Z0fSo+~qiXq2m68nR`B$Yp2k}2E1p@tZC%NE0^aP6>B@M2>p88+@ z@SjzDBo7pLI0h&Hq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9YD4QQWKeQdzxqw4V07_?G-=U=Nu;>LtLk9Np!(Yx z0+%&9sm%DT(?olG6=Fp@W$5rj;ys!4&z|k-5|=KFxxJSx!>=Phb$^a^4<{!*1ZXC4 zd7^ZmH>R$P%Mu*&@}AHQyAqdI5nhy2B-?q3J6m@biOf#DUeai!A_%BSzP&a2gUHcj zU^+9zn}*IBC2zn}iJ;BQogKAJQU~Cc`X@pLLT>v@;(hNwLYxZ4HPRMP|G^Uwmc9a2hkvUU_f` zd{$bTD1V7?@=9`g`DQu2Ur!!{ z(vpYC)Rx_IlxP*mu$eq#k?*=nt}A_3e(S~}m!OOZ+HLx#f9&t5Xvdv#KKjkCbOAA8 zx}RmPa5VIdyR%?>wP%94d?oKTa^3h@p>;#=G)0``tD&5VF?3|zQ>PEju3xGq3I{g4 z%Lj&d4W2oSdr=`|c=or~(xtIJ2`xq3&aX>lMpN#)NhhFG3E__R5pVl9=JNrG!ID;F zeV3f9pnDc-(7~#}{W5pV1yS|HuXyR?fLlra9ocnq6j|5ZvWm01;wqYMdRLA6-gznA zUjaut;tdmal*oEa;vc7`yCHC?D=~tTMMC}G70{OkDiD3Eyd)%fw`sC%hK5t;W25usR36Xwzfp#oM`&vhMYd*{uDx#8(nmzaE{k#a>&U zdGIOnS!D9hYjoO7Z{DgR3eF*3M8-d zsj|ygep=z)miL!QyC~@EYw$;-J66<|-VedJVIB4Zi}I7pblY*@pPFcd)&0|EG^xvZ z2F{iGjefeWnJJg&Q&bsZ0>9Yz6)>;9vVQT6mrIu@+5n*vrf*5pR&xm;Cjq2^zD$L% a;?)fkqi!?%zQT~<3x&)g_Uw&^BmV--ACsH_ literal 0 HcmV?d00001 diff --git a/gen/plone25/skin/template.pt b/gen/plone25/skin/template.pt new file mode 100644 index 0000000..c0b8c10 --- /dev/null +++ b/gen/plone25/skin/template.pt @@ -0,0 +1,78 @@ + + + + + + + + + + Top banner + + + + The login strip + + + + + + +
+ + + Logo + + Language selector (links or listbox) + + +
+ + + + +
+ +
+ +
+
+ + + + +
a
+
+ +
+

Appy

+

Sub appy

+

Sub sub appy

+

Hello

+ + diff --git a/gen/plone25/templates/frontPageAppy.pt b/gen/plone25/templates/frontPageAppy.pt new file mode 100644 index 0000000..b543829 --- /dev/null +++ b/gen/plone25/templates/frontPageAppy.pt @@ -0,0 +1,5 @@ + + +
+ +
diff --git a/gen/utils.py b/gen/utils.py index 1340091..62fd2ee 100644 --- a/gen/utils.py +++ b/gen/utils.py @@ -213,23 +213,6 @@ class Keywords: return op.join(self.keywords)+'*' return '' -# ------------------------------------------------------------------------------ -class FakeBrain: - '''This class behaves like a brain retrieved from a query to a ZCatalog. It - is used for representing a fake brain that was generated from a search in - a distant portal_catalog.''' - Creator = None - created = None - modified = None - review_state = None - def has_key(self, key): return hasattr(self, key) - def getPath(self): return self.path - def getURL(self, relative=0): return self.url - def _unrestrictedGetObject(self): return self - def pretty_title_or_id(self): return self.Title - def getObject(self, REQUEST=None): return self - def getRID(self): return self.url - # ------------------------------------------------------------------------------ CONVERSION_ERROR = 'An error occurred while executing command "%s". %s' class FileWrapper: diff --git a/pod/doc_importers.py b/pod/doc_importers.py index 50807ec..4e366ab 100644 --- a/pod/doc_importers.py +++ b/pod/doc_importers.py @@ -145,7 +145,7 @@ pxToCm = 44.173513561 def getSize(filePath, fileType): '''Gets the size of an image by reading first bytes.''' x, y = (None, None) - f = file(filePath) + f = file(filePath, 'rb') if fileType in jpgTypes: # Dummy read to skip header ID f.read(2) diff --git a/pod/xhtml2odt.py b/pod/xhtml2odt.py index 202ade7..aa636c6 100644 --- a/pod/xhtml2odt.py +++ b/pod/xhtml2odt.py @@ -454,6 +454,9 @@ class XhtmlParser(XmlParser): currentElem, elemsToReopen = e.onElementEnd(elem) # Determine the tag to dump startTag, endTag = currentElem.getOdfTags(e) + if currentElem.isConflictual: + # Compute the start tag, with potential styles applied + startTag = e.getTags((currentElem,), start=True) if currentElem.isConflictual and e.res.endswith(startTag): # We will not dump it, it would constitute a silly empty tag. e.res = e.res[:-len(startTag)]