Kaydet (Commit) c1330b9c authored tarafından Javier Fernandez's avatar Javier Fernandez

PyWebWizard: Fixing bugs and implementation of mising features.

Formating, python style coding and debug output removal.

Change-Id: If5811473695f23b8b11dcd5a7d6e6775ca41ae88
üst 9532335d
......@@ -33,6 +33,6 @@ class ExtensionVerifier(UCB.Verifier):
# a String which does not end with the
# given extension.
def verify(self, obj):
if (isinstance(obj, str())):
return not obj.endsWith(extension)
if (isinstance(obj, str)):
return not obj.endswith(self.extension)
return False
......@@ -52,7 +52,7 @@ class ProcessErrorHandler(AbstractErrorHandler, ProcessErrors):
elif ix == ProcessErrors.ERROR_GENERATE_COPY:
return self.resources.resErrTOCMedia
elif ix == ProcessErrors.ERROR_PUBLISH:
return self.resources.resErrPublish.replace(self.URL, obj.URL)
return self.resources.resErrPublish.replace(self.URL, obj.cp_URL)
elif (ix == ProcessErrors.ERROR_EXPORT or ix == ProcessErrors.ERROR_PUBLISH_MEDIA):
return self.resources.resErrPublishMedia
elif ix == ProcessErrors.ERROR_CLEANUP:
......
......@@ -49,7 +49,6 @@ class StylePreview(object):
self.tempDir, "images/background.gif")
self.wwRoot = wwRoot_
print ("WARNING !!! StylePreview init (review) - source, target: ", self.wwRoot, self.htmlFilename)
self.fileAccess.copy(FileAccess.connectURLs(
self.wwRoot, "preview.html"), self.htmlFilename)
......@@ -71,11 +70,9 @@ class StylePreview(object):
# a solaris bug workaround
# TODO
#copy the background image to the temp directory.
print ("WARNING !!! refresh (background) - source, target: ", background, self.backgroundFilename)
self.fileAccess.copy(background, self.backgroundFilename)
#copy the actual css to the temp directory
print ("WARNING !!! refresh (css) - source, target: ", css, self.tempDir)
self.fileAccess.copy(css, self.cssFilename)
def cleanup(self):
......
......@@ -40,16 +40,16 @@ This class implements general methods, used by different sub-classes
class WWD_General(WebWizardDialog):
settings = None
folderDialog = None
ftpDialog = None
zipDialog = None
docAddDialog = None
fileAccess = None
def __init__(self, xmsf):
super(WWD_General, self).__init__(xmsf)
self.xStringSubstitution = SystemDialog.createStringSubstitution(xmsf)
self.settings = None
self.folderDialog = None
self.ftpDialog = None
self.zipDialog = None
self.docAddDialog = None
self.fileAccess = None
self.proxies = None
def getStatusDialog(self):
statusDialog = StatusDialog(
......@@ -70,8 +70,8 @@ class WWD_General(WebWizardDialog):
def getDocAddDialog(self):
self.docAddDialog = SystemDialog.createOpenDialog(self.xMSF)
for i in range(WWD_General.settings.cp_Filters.getSize()):
f = WWD_General.settings.cp_Filters.getElementAt(i)
for i in range(self.settings.cp_Filters.getSize()):
f = self.settings.cp_Filters.getElementAt(i)
if f is not None:
self.docAddDialog.addFilter(
f.cp_Name.replace("%PRODNAME", self.resources.prodName),
......@@ -115,13 +115,12 @@ class WWD_General(WebWizardDialog):
'''
def getDoc(self, s):
print ("DEBUG !!! getDoc -- ", s)
if (len(s) == 0):
return None
elif (WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0]):
elif (self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0]):
return None
else:
return WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0])
return self.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0])
'''
how many documents are in the list?
......@@ -129,7 +128,7 @@ class WWD_General(WebWizardDialog):
'''
def getDocsCount(self):
return WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize()
return self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize()
'''
fills the export listbox.
......@@ -146,7 +145,7 @@ class WWD_General(WebWizardDialog):
'''
def getPublisher(self, name):
return WWD_General.settings.cp_DefaultSession.cp_Publishing.getElement(name)
return self.settings.cp_DefaultSession.cp_Publishing.getElement(name)
'''
@return true if the checkbox "save session" is checked.
......@@ -205,7 +204,7 @@ class WWD_General(WebWizardDialog):
'''
def checkDocList(self):
if WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() \
if self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() \
== 0:
self.enableSteps(False)
return False
......@@ -229,12 +228,9 @@ class WWD_General(WebWizardDialog):
'''
def checkPublish2(self, s, text, _property):
print ("DEBUG !!! checkPublish2")
p = self.getPublisher(s)
if p.cp_Publish:
print ("DEBUG !!! Property: ", _property)
url = getattr(text.Model, _property)
print ("DEBUG !!! URL: ", url)
if url is None or url == "":
raise IllegalArgumentException ()
else:
......@@ -253,7 +249,6 @@ class WWD_General(WebWizardDialog):
def checkPublish_(self):
try:
print ("DEBUG !!! checkPublish_")
return \
self.checkPublish2(LOCAL_PUBLISHER, self.txtLocalDir, "Text") \
or (not self.proxies and self.checkPublish2(
......@@ -272,7 +267,6 @@ class WWD_General(WebWizardDialog):
'''
def checkPublish(self):
print ("DEBUG !!! checkPublish")
self.enableFinishButton(self.checkPublish_())
'''
......
......@@ -36,7 +36,6 @@ class AbstractExporter(Exporter):
fileAccess = None
def __init__(self, exporter_):
print ("DEBUG !!! AbstractExporter.init - exporter: ", exporter_)
self.exporter = exporter_
def storeToURL(self, officeDocument, props, targetUrl, filterName, filterData):
......@@ -65,7 +64,6 @@ class AbstractExporter(Exporter):
props[0] = Properties.createProperty("Hidden", True)
props[1] = Properties.createProperty("MacroExecutionMode", NEVER_EXECUTE)
props[2] = Properties.createProperty("UpdateDocMode", NO_UPDATE)
print ("DEBUG !!! openDocument -- URL: ", doc.cp_URL)
document = desktop.loadComponentFromURL(doc.cp_URL, "_blank", 0, tuple(props))
except IllegalArgumentException:
traceback.print_exc()
......
......@@ -34,12 +34,9 @@ class CopyExporter(AbstractExporter):
task.advance(True)
print ("WARNING !!! CopyExporter (creating newtarget) - source.urlFilename: ", source.urlFilename)
newTarget = FileAccess.connectURLs(
FileAccess.getParentDir(target), source.urlFilename)
print ("WARNING !!! CopyExporter (export) - source, target: ", source.cp_URL, newTarget)
b = self.getFileAccess(xmsf).copy(source.cp_URL, newTarget)
task.advance(True)
......
......@@ -30,14 +30,12 @@ class FilterExporter(AbstractExporter):
props = Properties()
def __init__(self, exporter_):
print ("DEBUG !!! FilterExporter.init - exporter: ", exporter_)
super(FilterExporter, self).__init__(exporter_)
self.filterName = self.getArgument("Filter", exporter_)
# (non-Javadoc)
# @see com.sun.star.wizards.web.export.Exporter#export(java.lang.Object, java.io.File, com.sun.star.wizards.web.data.CGSettings, com.sun.star.lang.XMultiServiceFactory)
def export(self, source, target, xmsf, task):
print ("DEBUG !!! FilterExporter.export")
result = True
document = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment