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): ...@@ -33,6 +33,6 @@ class ExtensionVerifier(UCB.Verifier):
# a String which does not end with the # a String which does not end with the
# given extension. # given extension.
def verify(self, obj): def verify(self, obj):
if (isinstance(obj, str())): if (isinstance(obj, str)):
return not obj.endsWith(extension) return not obj.endswith(self.extension)
return False return False
...@@ -31,9 +31,6 @@ from .data.CGExporter import CGExporter ...@@ -31,9 +31,6 @@ from .data.CGExporter import CGExporter
from .data.CGLayout import CGLayout from .data.CGLayout import CGLayout
from .data.CGPublish import CGPublish from .data.CGPublish import CGPublish
from .data.CGSettings import CGSettings from .data.CGSettings import CGSettings
#from .export.Exporter import Exporter
#from .export.AbstractExporter import AbstractExporter
#from .export.CopyExporter import CopyExporter
from com.sun.star.io import IOException from com.sun.star.io import IOException
from com.sun.star.uno import SecurityException from com.sun.star.uno import SecurityException
...@@ -141,15 +138,12 @@ class Process(ProcessErrors): ...@@ -141,15 +138,12 @@ class Process(ProcessErrors):
# methods returns false, the next # methods returns false, the next
# will not be called. # will not be called.
self.result = self.createTempDir(self.myTask) and self.export(self.myTask) and self.generate(self.tempDir, self.myTask) and self.publish(self.tempDir, self.myTask) self.result = self.createTempDir(self.myTask) and self.export(self.myTask) and self.generate(self.tempDir, self.myTask) and self.publish(self.tempDir, self.myTask)
print ("runProcess -- result: ", self.result)
finally: finally:
# cleanup must be called. # cleanup must be called.
self.result = self.result and self.cleanup(self.myTask) self.result = self.result and self.cleanup(self.myTask)
print ("runProcess (cleanup) -- result: ", self.result)
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
self.result = False self.result = False
print ("runProcess (Exception) -- result: ", self.result)
if not self.result: if not self.result:
# this is a bug protection. # this is a bug protection.
...@@ -167,8 +161,7 @@ class Process(ProcessErrors): ...@@ -167,8 +161,7 @@ class Process(ProcessErrors):
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
if self.tempDir is None: if self.tempDir is None:
print ("WARNING !!! createTempDir -- error") self.error(None, None, ProcessErrors.ERROR_MKDIR, ErrorHandler.ERROR_PROCESS_FATAL)
#self.error(None, None, ProcessErrors.ERROR_MKDIR, ErrorHandler.ERROR_PROCESS_FATAL)
return False return False
else: else:
task.advance(True) task.advance(True)
...@@ -188,11 +181,9 @@ class Process(ProcessErrors): ...@@ -188,11 +181,9 @@ class Process(ProcessErrors):
# delete the temporary directory # delete the temporary directory
# @return true should continue # @return true should continue
def cleanup(self, task): def cleanup(self, task):
print ("WARNING !!! cleanup")
task.setSubtaskName(TASK_FINISH) task.setSubtaskName(TASK_FINISH)
b = self.fileAccess.delete(self.tempDir) b = self.fileAccess.delete(self.tempDir)
if not b: if not b:
print ("WARNING !!! cleanup -- error")
self.error(None, None, ProcessErrors.ERROR_CLEANUP, ErrorHandler.ERROR_WARNING) self.error(None, None, ProcessErrors.ERROR_CLEANUP, ErrorHandler.ERROR_WARNING)
task.advance(b) task.advance(b)
return b return b
...@@ -205,7 +196,6 @@ class Process(ProcessErrors): ...@@ -205,7 +196,6 @@ class Process(ProcessErrors):
# 1. .css # 1. .css
sourceDir = FileAccess.connectURLs(settings.workPath, "styles") sourceDir = FileAccess.connectURLs(settings.workPath, "styles")
filename = settings.cp_DefaultSession.getStyle().cp_CssHref filename = settings.cp_DefaultSession.getStyle().cp_CssHref
print ("WARNING !!! copyMedia (css) - source, filenamem, target, targetName: ", sourceDir, filename, targetDir, "style.css")
copy.copy2(sourceDir, filename, targetDir, "style.css") copy.copy2(sourceDir, filename, targetDir, "style.css")
task.advance(True) task.advance(True)
...@@ -215,7 +205,6 @@ class Process(ProcessErrors): ...@@ -215,7 +205,6 @@ class Process(ProcessErrors):
if (background is not None and background is not ""): if (background is not None and background is not ""):
sourceDir = FileAccess.getParentDir(background) sourceDir = FileAccess.getParentDir(background)
filename = background[len(sourceDir):] filename = background[len(sourceDir):]
print ("WARNING !!! copyMedia (background) - source, filenamem, target, targetName: ", sourceDir, filename, targetDir + "/images", "background.gif")
copy.copy2(sourceDir, filename, targetDir + "/images", "background.gif") copy.copy2(sourceDir, filename, targetDir + "/images", "background.gif")
task.advance(True) task.advance(True)
...@@ -232,7 +221,6 @@ class Process(ProcessErrors): ...@@ -232,7 +221,6 @@ class Process(ProcessErrors):
def copyStaticImages(self, copy, settings, targetDir): def copyStaticImages(self, copy, settings, targetDir):
source = FileAccess.connectURLs(settings.workPath, "images") source = FileAccess.connectURLs(settings.workPath, "images")
target = targetDir + "/images" target = targetDir + "/images"
print ("WARNING !!! copyStaticImages - source, target: ", source, target)
copy.copy(source, target) copy.copy(source, target)
# publish the given directory. # publish the given directory.
...@@ -249,7 +237,6 @@ class Process(ProcessErrors): ...@@ -249,7 +237,6 @@ class Process(ProcessErrors):
except Exception as ex: except Exception as ex:
# error in copying media # error in copying media
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! publish -- error")
self.error(ex, "", ProcessErrors.ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL) self.error(ex, "", ProcessErrors.ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL)
return False return False
for p in configSet.childrenList: for p in configSet.childrenList:
...@@ -273,14 +260,12 @@ class Process(ProcessErrors): ...@@ -273,14 +260,12 @@ class Process(ProcessErrors):
try: try:
task.advance(True) task.advance(True)
url = publish.url url = publish.url
print ("WARNING !!! publish1 - source, target: ", folder, url)
copy.copy(folder, url) copy.copy(folder, url)
task.advance(True) task.advance(True)
return True return True
except Exception as e: except Exception as e:
task.advance(False) task.advance(False)
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! publish1 -- error")
return self.error(e, publish, ProcessErrors.ERROR_PUBLISH, ErrorHandler.ERROR_NORMAL_IGNORE) return self.error(e, publish, ProcessErrors.ERROR_PUBLISH, ErrorHandler.ERROR_NORMAL_IGNORE)
# Generates the TOC pages for the current session. # Generates the TOC pages for the current session.
...@@ -297,9 +282,7 @@ class Process(ProcessErrors): ...@@ -297,9 +282,7 @@ class Process(ProcessErrors):
doc = self.settings.cp_DefaultSession.createDOM1() doc = self.settings.cp_DefaultSession.createDOM1()
self.generate1(self.xmsf, layout, doc, self.fileAccess, targetDir, task) self.generate1(self.xmsf, layout, doc, self.fileAccess, targetDir, task)
except Exception as ex: except Exception as ex:
print ("WARNING !!! generate (calling generate1 -- error")
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! publish1 -- error")
self.error(ex, "", ProcessErrors.ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL) self.error(ex, "", ProcessErrors.ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL)
return False return False
...@@ -315,7 +298,6 @@ class Process(ProcessErrors): ...@@ -315,7 +298,6 @@ class Process(ProcessErrors):
result = True result = True
except Exception as ex: except Exception as ex:
task.advance(False) task.advance(False)
print ("WARNING !!! generate (copying layouts) -- error")
traceback.print_exc() traceback.print_exc()
return self.error(ex, None, ProcessErrors.ERROR_GENERATE_COPY, ErrorHandler.ERROR_NORMAL_ABORT) return self.error(ex, None, ProcessErrors.ERROR_GENERATE_COPY, ErrorHandler.ERROR_NORMAL_ABORT)
return result return result
...@@ -331,7 +313,6 @@ class Process(ProcessErrors): ...@@ -331,7 +313,6 @@ class Process(ProcessErrors):
@classmethod @classmethod
def copyLayoutFiles(self, ucb, fileAccess, settings, layout, targetDir): def copyLayoutFiles(self, ucb, fileAccess, settings, layout, targetDir):
filesPath = fileAccess.getURL(FileAccess.connectURLs(settings.workPath, "layouts/"), layout.cp_FSName) filesPath = fileAccess.getURL(FileAccess.connectURLs(settings.workPath, "layouts/"), layout.cp_FSName)
print ("WARNING !!! copyLayoutFiles - source, target: ", filesPath, targetDir)
ucb.copy1(filesPath, targetDir, ExtensionVerifier("xsl")) ucb.copy1(filesPath, targetDir, ExtensionVerifier("xsl"))
# generates the TOC page for the given layout. # generates the TOC page for the given layout.
...@@ -454,7 +435,6 @@ class Process(ProcessErrors): ...@@ -454,7 +435,6 @@ class Process(ProcessErrors):
# each content (at the moment there is only one :-( ) # each content (at the moment there is only one :-( )
# is created in its own directory. # is created in its own directory.
# faileure here is fatal. # faileure here is fatal.
print ("export1 - folder and cp_Name: ", folder, content.cp_Name)
contentDir = self.fileAccess.createNewDir(folder, content.cp_Name); contentDir = self.fileAccess.createNewDir(folder, content.cp_Name);
if (contentDir is None or contentDir is ""): if (contentDir is None or contentDir is ""):
raise IOException("Directory " + folder + " could not be created.") raise IOException("Directory " + folder + " could not be created.")
...@@ -482,19 +462,16 @@ class Process(ProcessErrors): ...@@ -482,19 +462,16 @@ class Process(ProcessErrors):
except SecurityException as sx: except SecurityException as sx:
# nonfatal # nonfatal
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! export1 (SecurityException -- error")
if (not self.error(sx, item, ProcessErrors.ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE)): if (not self.error(sx, item, ProcessErrors.ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE)):
return False return False
self.result = False self.result = False
except IOException as iox: except IOException as iox:
# nonfatal # nonfatal
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! export1 (IOException -- error")
return self.error(iox, content, ProcessErrors.ERROR_EXPORT_IO, ErrorHandler.ERROR_NORMAL_IGNORE) return self.error(iox, content, ProcessErrors.ERROR_EXPORT_IO, ErrorHandler.ERROR_NORMAL_IGNORE)
except SecurityException as se: except SecurityException as se:
# nonfatal # nonfatal
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! export1 (SecurityException -- error")
return self.error(se, content, ProcessErrors.ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE) return self.error(se, content, ProcessErrors.ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE)
self.failTask(task, toPerform) self.failTask(task, toPerform)
...@@ -509,17 +486,14 @@ class Process(ProcessErrors): ...@@ -509,17 +486,14 @@ class Process(ProcessErrors):
# first I check if the document was already validated... # first I check if the document was already validated...
if (not doc.valid): if (not doc.valid):
try: try:
print ("WARNING !!! export2 -- new validation: ")
doc.validate(self.xmsf, task) doc.validate(self.xmsf, task)
except Exception as ex: except Exception as ex:
# fatal # fatal
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! export2 (validation) -- error")
self.error(ex, doc, ProcessErrors.ERROR_DOC_VALIDATE, ErrorHandler.ERROR_PROCESS_FATAL) self.error(ex, doc, ProcessErrors.ERROR_DOC_VALIDATE, ErrorHandler.ERROR_PROCESS_FATAL)
return False return False
# get the exporter specified for this document # get the exporter specified for this document
exp = doc.cp_Exporter exp = doc.cp_Exporter
print ("WARNING !!! export2 -- exporter: ", exp)
exporter = self.settings.cp_Exporters.getElement(exp) exporter = self.settings.cp_Exporters.getElement(exp)
try: try:
...@@ -527,24 +501,18 @@ class Process(ProcessErrors): ...@@ -527,24 +501,18 @@ class Process(ProcessErrors):
# I take the original filename (docFilename), substract the extension, (docExt) -> (fn) # I take the original filename (docFilename), substract the extension, (docExt) -> (fn)
# and find an available filename which starts with # and find an available filename which starts with
# this filename, but with the new extension. (destExt) # this filename, but with the new extension. (destExt)
print ("WARNING !!! export2 - doc.cp_URL: ", doc.cp_URL)
print ("WARNING !!! export2 - doc.localFilename: ", doc.localFilename)
docFilename = FileAccess.getFilename(doc.cp_URL) docFilename = FileAccess.getFilename(doc.cp_URL)
print ("WARNING !!! export2 - docFilename: ", docFilename)
docExt = FileAccess.getExtension(docFilename) docExt = FileAccess.getExtension(docFilename)
print ("WARNING !!! export2 - docExt: ", docExt)
# filename without extension # filename without extension
#fn = doc.localFilename.substring(0, doc.localFilename.length() - docExt.length() - 1) #fn = doc.localFilename.substring(0, doc.localFilename.length() - docExt.length() - 1)
fn = doc.localFilename[:len(doc.localFilename) - len(docExt) - 1] fn = doc.localFilename[:len(doc.localFilename) - len(docExt) - 1]
print ("WARNING !!! export2 - fn: ", fn)
# the copyExporter does not change # the copyExporter does not change
# the extension of the target... # the extension of the target...
destExt = FileAccess.getExtension(docFilename) \ destExt = FileAccess.getExtension(docFilename) \
if (exporter.cp_Extension is "") \ if (exporter.cp_Extension is "") \
else exporter.cp_Extension else exporter.cp_Extension
print ("WARNING !!! export2 - destExt: ", destExt)
# if this filter needs to export to its own directory... # if this filter needs to export to its own directory...
# this is the case in, for example, impress html export # this is the case in, for example, impress html export
...@@ -558,14 +526,12 @@ class Process(ProcessErrors): ...@@ -558,14 +526,12 @@ class Process(ProcessErrors):
# i get a new filename, so I do not # i get a new filename, so I do not
# overwrite files... # overwrite files...
f = self.fileAccess.getNewFile(folder, fn, destExt) f = self.fileAccess.getNewFile(folder, fn, destExt)
print ("WARNING !!! export2 - f: ", f)
# set filename with extension. # set filename with extension.
# this will be used by the exporter, # this will be used by the exporter,
# and to generate the TOC. # and to generate the TOC.
doc.urlFilename = FileAccess.getFilename(f) doc.urlFilename = FileAccess.getFilename(f)
print ("WARNING !!! export2 - : doc.urlFilename", doc.urlFilename)
task.advance(True) task.advance(True)
...@@ -579,13 +545,11 @@ class Process(ProcessErrors): ...@@ -579,13 +545,11 @@ class Process(ProcessErrors):
except Exception as ex: except Exception as ex:
# nonfatal # nonfatal
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! export2 (getting exporters) -- error")
if (not self.error(ex, doc, ProcessErrors.ERROR_EXPORT, ErrorHandler.ERROR_NORMAL_IGNORE)): if (not self.error(ex, doc, ProcessErrors.ERROR_EXPORT, ErrorHandler.ERROR_NORMAL_IGNORE)):
return False return False
except Exception as ex: except Exception as ex:
# nonfatal # nonfatal
traceback.print_exc() traceback.print_exc()
print ("WARNING !!! export2 (general) -- error")
if (not self.error(ex, doc, ProcessErrors.ERROR_EXPORT_MKDIR, ErrorHandler.ERROR_NORMAL_ABORT)): if (not self.error(ex, doc, ProcessErrors.ERROR_EXPORT_MKDIR, ErrorHandler.ERROR_NORMAL_ABORT)):
return False return False
...@@ -599,7 +563,6 @@ class Process(ProcessErrors): ...@@ -599,7 +563,6 @@ class Process(ProcessErrors):
# @return the interaction result # @return the interaction result
def error(self, ex, arg1, arg2, errType): def error(self, ex, arg1, arg2, errType):
self.result = False self.result = False
print ("error -- result: ", self.result)
return self.errorHandler.error(ex, arg1, arg2, errType) return self.errorHandler.error(ex, arg1, arg2, errType)
...@@ -621,7 +584,6 @@ class Process(ProcessErrors): ...@@ -621,7 +584,6 @@ class Process(ProcessErrors):
# @throws IllegalAccessException # @throws IllegalAccessException
# @throws InstantiationException # @throws InstantiationException
def createExporter(self, export): def createExporter(self, export):
print ("WANRING !!!! Creating exporter -- class: ", export.cp_ExporterClass)
pkgname = ".".join(export.cp_ExporterClass.split(".")[3:]) pkgname = ".".join(export.cp_ExporterClass.split(".")[3:])
className = export.cp_ExporterClass.split(".")[-1] className = export.cp_ExporterClass.split(".")[-1]
mod = importlib.import_module(pkgname) mod = importlib.import_module(pkgname)
...@@ -646,6 +608,4 @@ class Process(ProcessErrors): ...@@ -646,6 +608,4 @@ class Process(ProcessErrors):
# @return tru if everything went smooth, false # @return tru if everything went smooth, false
# if error(s) accured. # if error(s) accured.
def getResult(self): def getResult(self):
print ("Process -- getFailed: ", self.myTask.getFailed())
print ("Process -- result: ", self.result)
return (self.myTask.getFailed() == 0) and self.result return (self.myTask.getFailed() == 0) and self.result
...@@ -52,7 +52,7 @@ class ProcessErrorHandler(AbstractErrorHandler, ProcessErrors): ...@@ -52,7 +52,7 @@ class ProcessErrorHandler(AbstractErrorHandler, ProcessErrors):
elif ix == ProcessErrors.ERROR_GENERATE_COPY: elif ix == ProcessErrors.ERROR_GENERATE_COPY:
return self.resources.resErrTOCMedia return self.resources.resErrTOCMedia
elif ix == ProcessErrors.ERROR_PUBLISH: 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): elif (ix == ProcessErrors.ERROR_EXPORT or ix == ProcessErrors.ERROR_PUBLISH_MEDIA):
return self.resources.resErrPublishMedia return self.resources.resErrPublishMedia
elif ix == ProcessErrors.ERROR_CLEANUP: elif ix == ProcessErrors.ERROR_CLEANUP:
......
...@@ -49,7 +49,6 @@ class StylePreview(object): ...@@ -49,7 +49,6 @@ class StylePreview(object):
self.tempDir, "images/background.gif") self.tempDir, "images/background.gif")
self.wwRoot = wwRoot_ self.wwRoot = wwRoot_
print ("WARNING !!! StylePreview init (review) - source, target: ", self.wwRoot, self.htmlFilename)
self.fileAccess.copy(FileAccess.connectURLs( self.fileAccess.copy(FileAccess.connectURLs(
self.wwRoot, "preview.html"), self.htmlFilename) self.wwRoot, "preview.html"), self.htmlFilename)
...@@ -71,11 +70,9 @@ class StylePreview(object): ...@@ -71,11 +70,9 @@ class StylePreview(object):
# a solaris bug workaround # a solaris bug workaround
# TODO # TODO
#copy the background image to the temp directory. #copy the background image to the temp directory.
print ("WARNING !!! refresh (background) - source, target: ", background, self.backgroundFilename)
self.fileAccess.copy(background, self.backgroundFilename) self.fileAccess.copy(background, self.backgroundFilename)
#copy the actual css to the temp directory #copy the actual css to the temp directory
print ("WARNING !!! refresh (css) - source, target: ", css, self.tempDir)
self.fileAccess.copy(css, self.cssFilename) self.fileAccess.copy(css, self.cssFilename)
def cleanup(self): def cleanup(self):
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
# #
import traceback import traceback
import uno import uno
import time
#from common.Desktop import Desktop #from common.Desktop import Desktop
from .WWD_Startup import WWD_Startup from .WWD_Startup import WWD_Startup
from .WWD_General import WWD_General from .WWD_General import WWD_General
...@@ -24,6 +26,7 @@ from .WebWizardConst import * ...@@ -24,6 +26,7 @@ from .WebWizardConst import *
from ..common.FileAccess import FileAccess from ..common.FileAccess import FileAccess
from ..common.Configuration import Configuration from ..common.Configuration import Configuration
from ..ui.event.ListModelBinder import ListModelBinder from ..ui.event.ListModelBinder import ListModelBinder
from ..ui.event.CommonListener import KeyListenerProcAdapter
from ..ui.event.Task import Task from ..ui.event.Task import Task
from .data.CGDocument import CGDocument from .data.CGDocument import CGDocument
from .data.CGSession import CGSession from .data.CGSession import CGSession
...@@ -59,9 +62,10 @@ class WWD_Events(WWD_Startup): ...@@ -59,9 +62,10 @@ class WWD_Events(WWD_Startup):
def __init__(self, xmsf): def __init__(self, xmsf):
super(WWD_Events, self).__init__(xmsf) super(WWD_Events, self).__init__(xmsf)
self.chkFTP.addKeyListener(None) c = KeyListenerProcAdapter(self.keyPressed)
self.chkLocalDir.addKeyListener(None) self.chkFTP.addKeyListener(c)
self.chkZip.addKeyListener(None) self.chkLocalDir.addKeyListener(c)
self.chkZip.addKeyListener(c)
self.currentSession = "" self.currentSession = ""
self.exitOnCreate = True self.exitOnCreate = True
self.time = 0 self.time = 0
...@@ -93,11 +97,20 @@ class WWD_Events(WWD_Startup): ...@@ -93,11 +97,20 @@ class WWD_Events(WWD_Startup):
sessionToLoad = "" sessionToLoad = ""
else: else:
sessionToLoad = \ sessionToLoad = \
WWD_Startup.settings.cp_SavedSessions.getElementAt(s[0]).cp_Name self.settings.cp_SavedSessions.getElementAt(s[0]).cp_Name
if sessionToLoad is not self.currentSession: if sessionToLoad is not self.currentSession:
self.loadSession(sessionToLoad) self.loadSession(sessionToLoad)
def keyPressed(self, ke):
if (ke.KeyChar == '&'):
self.time = time.time()
elif (ke.KeyChar == '%' and ((time.time() - self.time) < 300)):
b = self.xDialogModel.btnWizardFinish.Enabled
if (b):
self.finishWizard1(False)
''' '''
************** **************
STEP 1 STEP 1
...@@ -117,7 +130,6 @@ class WWD_Events(WWD_Startup): ...@@ -117,7 +130,6 @@ class WWD_Events(WWD_Startup):
''' '''
def loadSession(self, sessionToLoad): def loadSession(self, sessionToLoad):
print ("DEBUG !!! loadSession -- sessionToLoad: ", sessionToLoad)
try: try:
sd = self.getStatusDialog() sd = self.getStatusDialog()
task = Task("LoadDocs", "", 10) task = Task("LoadDocs", "", 10)
...@@ -135,11 +147,9 @@ class WWD_Events(WWD_Startup): ...@@ -135,11 +147,9 @@ class WWD_Events(WWD_Startup):
view = Configuration.getNode(sessionToLoad, view) view = Configuration.getNode(sessionToLoad, view)
session = CGSession() session = CGSession()
session.root = WWD_Startup.settings session.setRoot(self.settings)
print ("DEBUG !!! loadSession -- reading configuration ...")
session.readConfiguration(view, CONFIG_READ_PARAM) session.readConfiguration(view, CONFIG_READ_PARAM)
numDocs = session.cp_Content.cp_Documents.getSize() numDocs = session.cp_Content.cp_Documents.getSize()
print ("DEBUG !!! loadSession -- numDocs: ", numDocs)
task.setMax(numDocs * 5 + 7) task.setMax(numDocs * 5 + 7)
task.advance(True) task.advance(True)
if sessionToLoad == "": if sessionToLoad == "":
...@@ -177,16 +187,16 @@ class WWD_Events(WWD_Startup): ...@@ -177,16 +187,16 @@ class WWD_Events(WWD_Startup):
ErrorHandler.ERROR_QUESTION_NO) ErrorHandler.ERROR_QUESTION_NO)
if confirm: if confirm:
try: try:
name = WWD_Startup.settings.cp_SavedSessions.getKey(selected[0]) name = self.settings.cp_SavedSessions.getKey(selected[0])
# first delete the session from the registry/configuration. # first delete the session from the registry/configuration.
Configuration.removeNode( Configuration.removeNode(
self.xMSF, CONFIG_PATH + "/SavedSessions", name) self.xMSF, CONFIG_PATH + "/SavedSessions", name)
# then delete WWD_Startup.settings.cp_SavedSessions # then delete WWD_Startup.settings.cp_SavedSessions
WWD_Startup.settings.cp_SavedSessions.remove(selected[0]) self.settings.cp_SavedSessions.remove(selected[0])
WWD_Startup.settings.savedSessions.remove(selected[0] - 1) self.settings.savedSessions.remove(selected[0] - 1)
nextSelected = [0] nextSelected = [0]
# We try to select the same item index again, if possible # We try to select the same item index again, if possible
if WWD_Startup.settings.cp_SavedSessions.getSize() > selected[0]: if self.settings.cp_SavedSessions.getSize() > selected[0]:
nextSelected[0] = selected[0] nextSelected[0] = selected[0]
else: else:
# this will always be available because # this will always be available because
...@@ -210,6 +220,15 @@ class WWD_Events(WWD_Startup): ...@@ -210,6 +220,15 @@ class WWD_Events(WWD_Startup):
************** **************
''' '''
'''
A method used by the UnoDataAware attached
to the Documents listbox.
See the concept of the DataAware objects to undestand
why it is there...
'''
def getSelectedDoc(self):
return self.selectedDoc
''' '''
when the user clicks another document when the user clicks another document
in the listbox, this method is called, in the listbox, this method is called,
...@@ -219,21 +238,19 @@ class WWD_Events(WWD_Startup): ...@@ -219,21 +238,19 @@ class WWD_Events(WWD_Startup):
''' '''
def setSelectedDoc(self, s): def setSelectedDoc(self, s):
print ("DEBUG !!! setSelectedDoc -- s: ", s) oldDoc = self.getDoc(self.selectedDoc)
oldDoc = self.getDoc(WWD_Startup.selectedDoc)
doc = self.getDoc(s) doc = self.getDoc(s)
if doc is None: if doc is None:
print ("DEBUG !!! setSelectedDoc -- doc is None.")
self.fillExportList([]) self.fillExportList([])
#I try to avoid refreshing the export list if #I try to avoid refreshing the export list if
#the same type of document is chosen. #the same type of document is chosen.
elif oldDoc is None or oldDoc.appType != doc.appType: elif oldDoc is None or oldDoc.appType != doc.appType:
print ("DEBUG !!! setSelectedDoc -- oddDoc is None.") self.fillExportList(self.settings.getExporters(doc.appType))
self.fillExportList(WWD_Startup.settings.getExporters(doc.appType))
WWD_Startup.selectedDoc = s self.selectedDoc = list(s)
self.mountList(doc, self.docAware) if (doc is not None):
self.disableDocUpDown() self.mountList(doc, self.docAware)
self.disableDocUpDown()
''' '''
The user clicks the "Add" button. The user clicks the "Add" button.
...@@ -245,11 +262,9 @@ class WWD_Events(WWD_Startup): ...@@ -245,11 +262,9 @@ class WWD_Events(WWD_Startup):
def addDocument(self): def addDocument(self):
try: try:
files = self.getDocAddDialog().callOpenDialog( files = self.getDocAddDialog().callOpenDialog(
True, WWD_Startup.settings.cp_DefaultSession.cp_InDirectory) True, self.settings.cp_DefaultSession.cp_InDirectory)
if files is None: if files is None:
print ("DEBUG !!! addDocument -- files is None")
return return
print ("DEBUG !!! addDocument -- number of files: ", len(files))
task = Task("", "", len(files) * 5) task = Task("", "", len(files) * 5)
''' '''
...@@ -279,20 +294,20 @@ class WWD_Events(WWD_Startup): ...@@ -279,20 +294,20 @@ class WWD_Events(WWD_Startup):
''' '''
def removeDocument(self): def removeDocument(self):
if len(WWD_Startup.selectedDoc) == 0: if len(self.selectedDoc) == 0:
return return
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( self.settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
WWD_Startup.selectedDoc[0]) self.selectedDoc[0])
# update the selected document # update the selected document
while WWD_Startup.selectedDoc[0] >= self.getDocsCount(): while self.selectedDoc[0] >= self.getDocsCount():
WWD_Startup.selectedDoc[0] -= 1 self.selectedDoc[0] -= 1
# if there are no documents... # if there are no documents...
if WWD_Startup.selectedDoc[0] == -1: if self.selectedDoc[0] == -1:
WWD_Startup.selectedDoc = [] self.selectedDoc = []
# update the list to show the right selection. # update the list to show the right selection.
docListDA.updateUI() self.docListDA.updateUI()
# disables all the next steps, if the list of docuemnts # disables all the next steps, if the list of docuemnts
# is empty. # is empty.
self.checkSteps() self.checkSteps()
...@@ -302,14 +317,13 @@ class WWD_Events(WWD_Startup): ...@@ -302,14 +317,13 @@ class WWD_Events(WWD_Startup):
''' '''
def docUp(self): def docUp(self):
print ("DEBUG !!! docUp --") doc = self.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(
doc = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( self.selectedDoc[0])
WWD_Startup.selectedDoc[0]) self.settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( self.selectedDoc[0])
WWD_Startup.selectedDoc[0]) self.settings.cp_DefaultSession.cp_Content.cp_Documents.add(
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add( self.selectedDoc[0] - 1, doc)
WWD_Startup.selectedDoc[0] - 1, doc) self.docListDA.updateUI()
docListDA.updateUI()
self.disableDocUpDown() self.disableDocUpDown()
''' '''
...@@ -317,14 +331,13 @@ class WWD_Events(WWD_Startup): ...@@ -317,14 +331,13 @@ class WWD_Events(WWD_Startup):
''' '''
def docDown(self): def docDown(self):
print ("DEBUG !!! docDown --") doc = self.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(
doc = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( self.selectedDoc[0])
WWD_Startup.selectedDoc[0]) self.settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( self.selectedDoc[0])
WWD_Startup.selectedDoc[0]) self.settings.cp_DefaultSession.cp_Content.cp_Documents.add(
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add( (self.selectedDoc[0] + 1), doc)
(WWD_Startup.selectedDoc[0] + 1), doc) self.docListDA.updateUI()
docListDA.updateUI()
self.disableDocUpDown() self.disableDocUpDown()
''' '''
...@@ -415,8 +428,6 @@ class WWD_Events(WWD_Startup): ...@@ -415,8 +428,6 @@ class WWD_Events(WWD_Startup):
if url is None: if url is None:
return None return None
print ("DEBUG !!! setPublishUrl - publisher: " + publisher + " url: " + url)
p = self.getPublisher(publisher) p = self.getPublisher(publisher)
p.cp_URL = url p.cp_URL = url
p.cp_Publish = True p.cp_Publish = True
...@@ -442,7 +453,7 @@ class WWD_Events(WWD_Startup): ...@@ -442,7 +453,7 @@ class WWD_Events(WWD_Startup):
def setPublishLocalDir(self): def setPublishLocalDir(self):
folder = self.showFolderDialog( folder = self.showFolderDialog(
"Local destination directory", "", "Local destination directory", "",
WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory) self.settings.cp_DefaultSession.cp_OutDirectory)
#if ok was pressed... #if ok was pressed...
self.setPublishUrl(LOCAL_PUBLISHER, folder, 0) self.setPublishUrl(LOCAL_PUBLISHER, folder, 0)
...@@ -476,7 +487,7 @@ class WWD_Events(WWD_Startup): ...@@ -476,7 +487,7 @@ class WWD_Events(WWD_Startup):
def setZipFilename(self): def setZipFilename(self):
sd = self.getZipDialog() sd = self.getZipDialog()
zipFile = sd.callStoreDialog( zipFile = sd.callStoreDialog(
WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory, self.settings.cp_DefaultSession.cp_OutDirectory,
self.resources.resDefaultArchiveFilename) self.resources.resDefaultArchiveFilename)
self.setPublishUrl(ZIP_PUBLISHER, zipFile, 4) self.setPublishUrl(ZIP_PUBLISHER, zipFile, 4)
self.getPublisher(ZIP_PUBLISHER).overwriteApproved = True self.getPublisher(ZIP_PUBLISHER).overwriteApproved = True
...@@ -514,9 +525,9 @@ class WWD_Events(WWD_Startup): ...@@ -514,9 +525,9 @@ class WWD_Events(WWD_Startup):
result = True result = True
# 1. check local publish target # 1. check local publish target
p = self.getPublisher(LOCAL_PUBLISHER) p = self.getPublisher(LOCAL_PUBLISHER)
fileAccess = self.getFileAccess()
# should publish ? # should publish ?
if (p.cp_Publish): if (p.cp_Publish):
fileAccess = self.getFileAccess()
path = fileAccess.getPath(p.url, None) path = fileAccess.getPath(p.url, None)
# target exists? # target exists?
if fileAccess.exists(p.url, False): if fileAccess.exists(p.url, False):
...@@ -566,7 +577,6 @@ class WWD_Events(WWD_Startup): ...@@ -566,7 +577,6 @@ class WWD_Events(WWD_Startup):
# try to create the directory... # try to create the directory...
try: try:
print ("WARNING !!! publishTargetApproved -- URL: ", p.cp_URL)
fileAccess.xInterface.createFolder(p.cp_URL) fileAccess.xInterface.createFolder(p.cp_URL)
except Exception as ex: except Exception as ex:
message = self.resources.resLocalTargetCouldNotCreate.replace( message = self.resources.resLocalTargetCouldNotCreate.replace(
...@@ -665,12 +675,11 @@ class WWD_Events(WWD_Startup): ...@@ -665,12 +675,11 @@ class WWD_Events(WWD_Startup):
''' '''
def saveSession(self): def saveSession(self):
print ("DEBUG !!! saveSession")
try: try:
node = None node = None
name = self.getSessionSaveName() name = self.getSessionSaveName()
#set documents index field. #set documents index field.
docs = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents docs = self.settings.cp_DefaultSession.cp_Content.cp_Documents
i = 0 i = 0
while i < docs.getSize(): while i < docs.getSize():
(docs.getElementAt(i)).cp_Index = i (docs.getElementAt(i)).cp_Index = i
...@@ -679,8 +688,6 @@ class WWD_Events(WWD_Startup): ...@@ -679,8 +688,6 @@ class WWD_Events(WWD_Startup):
self.xMSF, CONFIG_PATH + "/SavedSessions", True) self.xMSF, CONFIG_PATH + "/SavedSessions", True)
# first I check if a session with the given name exists # first I check if a session with the given name exists
try: try:
print ("DEBUG !!! saveSession -- check if a session with the given name exists")
print ("DEBUG !!! saveSession -- name: ", name)
node = Configuration.getNode(name, conf) node = Configuration.getNode(name, conf)
if node is not None: if node is not None:
if not AbstractErrorHandler.showMessage1( if not AbstractErrorHandler.showMessage1(
...@@ -690,35 +697,34 @@ class WWD_Events(WWD_Startup): ...@@ -690,35 +697,34 @@ class WWD_Events(WWD_Startup):
return False #remove the old session return False #remove the old session
Configuration.removeNode(conf, name) Configuration.removeNode(conf, name)
except NoSuchElementException as nsex: except NoSuchElementException as nsex:
print ("DEBUG !!! saveSession -- node not found in Configuration - name: ", name)
pass pass
WWD_Startup.settings.cp_DefaultSession.cp_Index = 0 self.settings.cp_DefaultSession.cp_Index = 0
node = Configuration.addConfigNode(conf, name) node = Configuration.addConfigNode(conf, name)
WWD_Startup.settings.cp_DefaultSession.cp_Name = name self.settings.cp_DefaultSession.cp_Name = name
WWD_Startup.settings.cp_DefaultSession.writeConfiguration( self.settings.cp_DefaultSession.writeConfiguration(
node, CONFIG_READ_PARAM) node, CONFIG_READ_PARAM)
WWD_Startup.settings.cp_SavedSessions.reindexSet(conf, name, "cp_Index") self.settings.cp_SavedSessions.reindexSet(conf, name, "cp_Index")
Configuration.commit(conf) Configuration.commit(conf)
# now I reload the sessions to actualize the list/combo # now I reload the sessions to actualize the list/combo
# boxes load/save sessions. # boxes load/save sessions.
WWD_Startup.settings.cp_SavedSessions.clear() self.settings.cp_SavedSessions.clear()
confView = Configuration.getConfigurationRoot( confView = Configuration.getConfigurationRoot(
self.xMSF, CONFIG_PATH + "/SavedSessions", False) self.xMSF, CONFIG_PATH + "/SavedSessions", False)
WWD_Startup.settings.cp_SavedSessions.readConfiguration( self.settings.cp_SavedSessions.readConfiguration(
confView, CONFIG_READ_PARAM) confView, CONFIG_READ_PARAM)
WWD_Startup.settings.cp_LastSavedSession = name self.settings.cp_LastSavedSession = name
self.currentSession = name self.currentSession = name
# now save the name of the last saved session... # now save the name of the last saved session...
WWD_Startup.settings.cp_LastSavedSession = name self.settings.cp_LastSavedSession = name
# TODO add the <none> session... # TODO add the <none> session...
self.prepareSessionLists() self.prepareSessionLists()
ListModelBinder.fillList( ListModelBinder.fillList(
self.lstLoadSettings, WWD_Startup.settings.cp_SavedSessions.childrenList, None) self.lstLoadSettings, self.settings.cp_SavedSessions.childrenList, None)
ListModelBinder.fillComboBox( ListModelBinder.fillComboBox(
self.cbSaveSettings, WWD_Startup.settings.savedSessions.childrenList, None) self.cbSaveSettings, self.settings.savedSessions.childrenList, None)
self.selectSession() self.selectSession()
self.currentSession = WWD_Startup.settings.cp_LastSavedSession self.currentSession = self.settings.cp_LastSavedSession
return True return True
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
...@@ -834,19 +840,17 @@ class WWD_Events(WWD_Startup): ...@@ -834,19 +840,17 @@ class WWD_Events(WWD_Startup):
p.cp_Publish = self.ftp p.cp_Publish = self.ftp
#if the "save settings" checkbox is on... #if the "save settings" checkbox is on...
if self.isSaveSession(): if self.isSaveSession():
# if canceled by user # if canceled by user
if not self.saveSession(): if not self.saveSession():
print ("DEBUG !!! finishWizard2 - saveSession canceled !!!")
return return
else: else:
WWD_Startup.settings.cp_LastSavedSession = "" self.settings.cp_LastSavedSession = ""
try: try:
conf = Configuration.getConfigurationRoot(self.xMSF, CONFIG_PATH, True) conf = Configuration.getConfigurationRoot(self.xMSF, CONFIG_PATH, True)
Configuration.set( Configuration.set(
WWD_Startup.settings.cp_LastSavedSession, "LastSavedSession", conf) self.settings.cp_LastSavedSession, "LastSavedSession", conf)
Configuration.commit(conf) Configuration.commit(conf)
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
...@@ -899,7 +903,8 @@ class WWD_Events(WWD_Startup): ...@@ -899,7 +903,8 @@ class WWD_Events(WWD_Startup):
if self.ftpDialog is not None: if self.ftpDialog is not None:
self.ftpDialog.xUnoDialog.dispose() self.ftpDialog.xUnoDialog.dispose()
#self.dispose() self.xUnoDialog.dispose()
self.myFrame.close(False);
#if ProcessStatusRenderer is not None: #if ProcessStatusRenderer is not None:
# ProcessStatusRenderer.close(False) # ProcessStatusRenderer.close(False)
...@@ -917,8 +922,7 @@ class WWD_Events(WWD_Startup): ...@@ -917,8 +922,7 @@ class WWD_Events(WWD_Startup):
self.task = task_ self.task = task_
def loadDocuments(self): def loadDocuments(self):
offset = WWD_Startup.selectedDoc[0] + 1 if (len(WWD_Startup.selectedDoc) > 0) else self.parent.getDocsCount() offset = self.parent.selectedDoc[0] + 1 if (len(self.parent.selectedDoc) > 0) else self.parent.getDocsCount()
print ("DEBUG !!! loadDocuments -- offset: ", offset)
''' '''
if the user chose one file, the list starts at 0, if the user chose one file, the list starts at 0,
...@@ -929,17 +933,15 @@ class WWD_Events(WWD_Startup): ...@@ -929,17 +933,15 @@ class WWD_Events(WWD_Startup):
start = 1 start = 1
else: else:
start = 0 start = 0
print ("DEBUG !!! loadDocuments -- start: ", start)
#Number of documents failed to validate. #Number of documents failed to validate.
failed = 0 failed = 0
# store the directory # store the directory
print ("DEBUG !!! loadDocuments (Store the directory) -- dir: ", self.files[0])
if start == 1: if start == 1:
WWD_General.settings.cp_DefaultSession.cp_InDirectory = self.files[0] self.parent.settings.cp_DefaultSession.cp_InDirectory = self.files[0]
else: else:
WWD_General.settings.cp_DefaultSession.cp_InDirectory = \ self.parent.settings.cp_DefaultSession.cp_InDirectory = \
FileAccess.getParentDir(self.files[0]) FileAccess.getParentDir(self.files[0])
''' '''
...@@ -949,12 +951,12 @@ class WWD_Events(WWD_Startup): ...@@ -949,12 +951,12 @@ class WWD_Events(WWD_Startup):
for i in range(start, len(self.files)): for i in range(start, len(self.files)):
doc = CGDocument() doc = CGDocument()
doc.setRoot(self.parent.settings)
if start == 0: if start == 0:
doc.cp_URL = self.files[i] doc.cp_URL = self.files[i]
else: else:
doc.cp_URL = FileAccess.connectURLs(files[0], self.files[i]) doc.cp_URL = FileAccess.connectURLs(files[0], self.files[i])
print ("DEBUG !!! loadDocuments (new Document) -- cp_URL: ", doc.cp_URL)
''' '''
so - i check each document and if it is ok I add it. so - i check each document and if it is ok I add it.
...@@ -962,21 +964,16 @@ class WWD_Events(WWD_Startup): ...@@ -962,21 +964,16 @@ class WWD_Events(WWD_Startup):
Error reporting to the user is (or should (-: ) Error reporting to the user is (or should (-: )
done in the checkDocument(...) method done in the checkDocument(...) method
''' '''
if WWD_Startup.checkDocument1(self.xMSF, doc, self.task, self.xC): if self.parent.checkDocument(doc, self.task, self.xC):
index = offset + i - failed - start index = offset + i - failed - start
print ("DEBUG !!! loadDocuments (checkDocument) -- index: ", index) self.parent.settings.cp_DefaultSession.cp_Content.cp_Documents.add(index, doc)
WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.add(index, doc)
else: else:
print ("DEBUG !!! loadDocuments (checkDocument) -- failed validation.")
failed += 1 failed += 1
# if any documents where added, # if any documents where added,
# set the first one to be the current-selected document. # set the first one to be the current-selected document.
if len(self.files) > start + failed: if len(self.files) > start + failed:
print ("DEBUG !!! loadDocuments (setSelectedDoc) -- offset: ", offset)
self.parent.setSelectedDoc([offset]) self.parent.setSelectedDoc([offset])
else:
print ("DEBUG !!! loadDocuments (setSelectedDoc) -- no documents were added")
# update the ui... # update the ui...
self.parent.docListDA.updateUI() self.parent.docListDA.updateUI()
......
...@@ -40,16 +40,16 @@ This class implements general methods, used by different sub-classes ...@@ -40,16 +40,16 @@ This class implements general methods, used by different sub-classes
class WWD_General(WebWizardDialog): class WWD_General(WebWizardDialog):
settings = None
folderDialog = None
ftpDialog = None
zipDialog = None
docAddDialog = None
fileAccess = None
def __init__(self, xmsf): def __init__(self, xmsf):
super(WWD_General, self).__init__(xmsf) super(WWD_General, self).__init__(xmsf)
self.xStringSubstitution = SystemDialog.createStringSubstitution(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): def getStatusDialog(self):
statusDialog = StatusDialog( statusDialog = StatusDialog(
...@@ -70,8 +70,8 @@ class WWD_General(WebWizardDialog): ...@@ -70,8 +70,8 @@ class WWD_General(WebWizardDialog):
def getDocAddDialog(self): def getDocAddDialog(self):
self.docAddDialog = SystemDialog.createOpenDialog(self.xMSF) self.docAddDialog = SystemDialog.createOpenDialog(self.xMSF)
for i in range(WWD_General.settings.cp_Filters.getSize()): for i in range(self.settings.cp_Filters.getSize()):
f = WWD_General.settings.cp_Filters.getElementAt(i) f = self.settings.cp_Filters.getElementAt(i)
if f is not None: if f is not None:
self.docAddDialog.addFilter( self.docAddDialog.addFilter(
f.cp_Name.replace("%PRODNAME", self.resources.prodName), f.cp_Name.replace("%PRODNAME", self.resources.prodName),
...@@ -115,13 +115,12 @@ class WWD_General(WebWizardDialog): ...@@ -115,13 +115,12 @@ class WWD_General(WebWizardDialog):
''' '''
def getDoc(self, s): def getDoc(self, s):
print ("DEBUG !!! getDoc -- ", s)
if (len(s) == 0): if (len(s) == 0):
return None 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 return None
else: 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? how many documents are in the list?
...@@ -129,7 +128,7 @@ class WWD_General(WebWizardDialog): ...@@ -129,7 +128,7 @@ class WWD_General(WebWizardDialog):
''' '''
def getDocsCount(self): 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. fills the export listbox.
...@@ -146,7 +145,7 @@ class WWD_General(WebWizardDialog): ...@@ -146,7 +145,7 @@ class WWD_General(WebWizardDialog):
''' '''
def getPublisher(self, name): 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. @return true if the checkbox "save session" is checked.
...@@ -205,7 +204,7 @@ class WWD_General(WebWizardDialog): ...@@ -205,7 +204,7 @@ class WWD_General(WebWizardDialog):
''' '''
def checkDocList(self): 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: == 0:
self.enableSteps(False) self.enableSteps(False)
return False return False
...@@ -229,12 +228,9 @@ class WWD_General(WebWizardDialog): ...@@ -229,12 +228,9 @@ class WWD_General(WebWizardDialog):
''' '''
def checkPublish2(self, s, text, _property): def checkPublish2(self, s, text, _property):
print ("DEBUG !!! checkPublish2")
p = self.getPublisher(s) p = self.getPublisher(s)
if p.cp_Publish: if p.cp_Publish:
print ("DEBUG !!! Property: ", _property)
url = getattr(text.Model, _property) url = getattr(text.Model, _property)
print ("DEBUG !!! URL: ", url)
if url is None or url == "": if url is None or url == "":
raise IllegalArgumentException () raise IllegalArgumentException ()
else: else:
...@@ -253,7 +249,6 @@ class WWD_General(WebWizardDialog): ...@@ -253,7 +249,6 @@ class WWD_General(WebWizardDialog):
def checkPublish_(self): def checkPublish_(self):
try: try:
print ("DEBUG !!! checkPublish_")
return \ return \
self.checkPublish2(LOCAL_PUBLISHER, self.txtLocalDir, "Text") \ self.checkPublish2(LOCAL_PUBLISHER, self.txtLocalDir, "Text") \
or (not self.proxies and self.checkPublish2( or (not self.proxies and self.checkPublish2(
...@@ -272,7 +267,6 @@ class WWD_General(WebWizardDialog): ...@@ -272,7 +267,6 @@ class WWD_General(WebWizardDialog):
''' '''
def checkPublish(self): def checkPublish(self):
print ("DEBUG !!! checkPublish")
self.enableFinishButton(self.checkPublish_()) self.enableFinishButton(self.checkPublish_())
''' '''
......
...@@ -24,6 +24,7 @@ from .StylePreview import StylePreview ...@@ -24,6 +24,7 @@ from .StylePreview import StylePreview
from ..common.Configuration import Configuration from ..common.Configuration import Configuration
from ..common.FileAccess import FileAccess from ..common.FileAccess import FileAccess
from ..common.Desktop import Desktop from ..common.Desktop import Desktop
from ..common.Properties import Properties
from ..document.OfficeDocument import OfficeDocument from ..document.OfficeDocument import OfficeDocument
from .data.CGSettings import CGSettings from .data.CGSettings import CGSettings
from .data.CGDocument import CGDocument from .data.CGDocument import CGDocument
...@@ -31,6 +32,8 @@ from .data.CGSessionName import CGSessionName ...@@ -31,6 +32,8 @@ from .data.CGSessionName import CGSessionName
from ..ui.event.ListModelBinder import ListModelBinder from ..ui.event.ListModelBinder import ListModelBinder
from ..ui.event.UnoDataAware import UnoDataAware from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware from ..ui.event.RadioDataAware import RadioDataAware
from ..ui.event.SimpleDataAware import SimpleDataAware
from ..ui.event.CommonListener import ItemListenerProcAdapter
from ..ui.event.CommonListener import TerminateListenerProcAdapter from ..ui.event.CommonListener import TerminateListenerProcAdapter
from ..ui.DocumentPreview import DocumentPreview from ..ui.DocumentPreview import DocumentPreview
from ..ui.event.DataAware import DataAware from ..ui.event.DataAware import DataAware
...@@ -81,9 +84,6 @@ are the controller inbetween. ...@@ -81,9 +84,6 @@ are the controller inbetween.
class WWD_Startup(WWD_General): class WWD_Startup(WWD_General):
selectedDoc = []
ftp = False
''' '''
He - my constructor ! He - my constructor !
I call/do here in this order: <br/> I call/do here in this order: <br/>
...@@ -107,6 +107,8 @@ class WWD_Startup(WWD_General): ...@@ -107,6 +107,8 @@ class WWD_Startup(WWD_General):
def __init__(self, xmsf): def __init__(self, xmsf):
super(WWD_Startup, self).__init__(xmsf) super(WWD_Startup, self).__init__(xmsf)
self.selectedDoc = []
self.ftp = True
self.sda = None self.sda = None
self.docAware = [] self.docAware = []
self.designAware = [] self.designAware = []
...@@ -133,11 +135,11 @@ class WWD_Startup(WWD_General): ...@@ -133,11 +135,11 @@ class WWD_Startup(WWD_General):
doc = OfficeDocument.createNewDocument( doc = OfficeDocument.createNewDocument(
self.myFrame, "swriter", False, True) self.myFrame, "swriter", False, True)
self.loadSettings(doc) self.loadSettings(doc)
self.setSaveSessionName(WWD_General.settings.cp_DefaultSession) self.setSaveSessionName(self.settings.cp_DefaultSession)
self.ilLayouts.listModel = WWD_General.settings.cp_Layouts self.ilLayouts.listModel = self.settings.cp_Layouts
self.ilLayouts.create(self) self.ilLayouts.create(self)
#COMMENTED #COMMENTED
self.checkContent(WWD_General.settings.cp_DefaultSession.cp_Content, Task("", "", 99999), self.xUnoDialog) self.checkContent(self.settings.cp_DefaultSession.cp_Content, Task("", "", 99999), self.xUnoDialog)
#saved sessions, styles, combobox save session. #saved sessions, styles, combobox save session.
# also set the chosen saved session... # also set the chosen saved session...
self.fillLists() self.fillLists()
...@@ -184,9 +186,9 @@ class WWD_Startup(WWD_General): ...@@ -184,9 +186,9 @@ class WWD_Startup(WWD_General):
length = self.resources.resSessionName length = self.resources.resSessionName
# traverse between the sessions and find the one that # traverse between the sessions and find the one that
# has the biggest number. # has the biggest number.
for i in range(WWD_General.settings.cp_SavedSessions.getSize()): for i in range(self.settings.cp_SavedSessions.getSize()):
sessionName = \ sessionName = \
WWD_General.settings.cp_SavedSessions.getElementAt(i).cp_Name self.settings.cp_SavedSessions.getElementAt(i).cp_Name
if sessionName.startswith(self.resources.resSessionName): if sessionName.startswith(self.resources.resSessionName):
maxValue = max(maxValue, int(sessionName[length:])) maxValue = max(maxValue, int(sessionName[length:]))
...@@ -238,7 +240,6 @@ class WWD_Startup(WWD_General): ...@@ -238,7 +240,6 @@ class WWD_Startup(WWD_General):
self.addRoadMapItems() self.addRoadMapItems()
self.addStylePreview() self.addStylePreview()
self.checkSteps() self.checkSteps()
print ("WARNING !!! show() : executeDialogFromComponent")
self.executeDialogFromComponent(self.myFrame) self.executeDialogFromComponent(self.myFrame)
self.removeTerminateListener() self.removeTerminateListener()
except Exception: except Exception:
...@@ -252,9 +253,9 @@ class WWD_Startup(WWD_General): ...@@ -252,9 +253,9 @@ class WWD_Startup(WWD_General):
try: try:
self.dpStylePreview = DocumentPreview(self.xMSF, self.imgPreview) self.dpStylePreview = DocumentPreview(self.xMSF, self.imgPreview)
self.stylePreview = StylePreview( self.stylePreview = StylePreview(
self.xMSF, WWD_General.settings.workPath) self.xMSF, self.settings.workPath)
style = WWD_General.settings.cp_DefaultSession.getStyle() style = self.settings.cp_DefaultSession.getStyle()
bg = WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage bg = self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage
self.stylePreview.refresh(style, bg) self.stylePreview.refresh(style, bg)
self.dpStylePreview.setDocument( self.dpStylePreview.setDocument(
self.stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE) self.stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE)
...@@ -268,21 +269,21 @@ class WWD_Startup(WWD_General): ...@@ -268,21 +269,21 @@ class WWD_Startup(WWD_General):
def loadSettings(self, document): def loadSettings(self, document):
try: try:
# instanciate # instanciate
WWD_General.settingsResources = \ self.settingsResources = \
[self.resources.resPages, self.resources.resSlides, [self.resources.resPages, self.resources.resSlides,
self.resources.resCreatedTemplate, self.resources.resCreatedTemplate,
self.resources.resUpdatedTemplate, self.resources.resUpdatedTemplate,
self.resources.resSizeTemplate] self.resources.resSizeTemplate]
WWD_General.settings = CGSettings( self.settings = CGSettings(
self.xMSF, WWD_General.settingsResources, document) self.xMSF, self.settingsResources, document)
# get configuration view # get configuration view
confRoot = Configuration.getConfigurationRoot( confRoot = Configuration.getConfigurationRoot(
self.xMSF, CONFIG_PATH, True) self.xMSF, CONFIG_PATH, True)
# read # read
WWD_General.settings.readConfiguration( self.settings.readConfiguration(
confRoot, CONFIG_READ_PARAM) confRoot, CONFIG_READ_PARAM)
configSet = WWD_General.settings.cp_DefaultSession.cp_Publishing configSet = self.settings.cp_DefaultSession.cp_Publishing
# now if path variables are used in publisher paths, they # now if path variables are used in publisher paths, they
# are getting replaced here... # are getting replaced here...
for i in range(configSet.getSize()): for i in range(configSet.getSize()):
...@@ -291,12 +292,13 @@ class WWD_Startup(WWD_General): ...@@ -291,12 +292,13 @@ class WWD_Startup(WWD_General):
p.cp_URL = self.substitute(p.cp_URL) p.cp_URL = self.substitute(p.cp_URL)
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
# initialize the WWD_General.settings. # initialize the WWD_General.settings.
WWD_General.settings.configure(self.xMSF) self.settings.configure(self.xMSF)
# set resource needed for web page. # set resource needed for web page.
# sort the styles alphabetically # sort the styles alphabetically
#COMMENTED - FIXME: to be impemented #COMMENTED - FIXME: to be impemented
#WWD_General.settings.cp_Styles.sort(None) #self.settings.cp_Styles.sort(None)
self.prepareSessionLists() self.prepareSessionLists()
if self.proxies: if self.proxies:
self.ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish self.ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish
...@@ -307,16 +309,16 @@ class WWD_Startup(WWD_General): ...@@ -307,16 +309,16 @@ class WWD_Startup(WWD_General):
def prepareSessionLists(self): def prepareSessionLists(self):
# now copy the sessions list... # now copy the sessions list...
sessions = WWD_General.settings.cp_SavedSessions.childrenList sessions = self.settings.cp_SavedSessions.childrenList
WWD_General.settings.savedSessions.clear() self.settings.savedSessions.clear()
for index,item in enumerate(sessions): for index,item in enumerate(sessions):
WWD_General.settings.savedSessions.add(index, item) self.settings.savedSessions.add(index, item)
# add an empty session to the saved session # add an empty session to the saved session
# list which apears in step 1 # list which apears in step 1
sn = CGSessionName() sn = CGSessionName()
sn.cp_Name = self.resources.resSessionNameNone sn.cp_Name = self.resources.resSessionNameNone
WWD_General.settings.cp_SavedSessions.add(0, sn) self.settings.cp_SavedSessions.add(0, sn)
''' '''
fills the saved session list, the styles list, fills the saved session list, the styles list,
...@@ -328,35 +330,32 @@ class WWD_Startup(WWD_General): ...@@ -328,35 +330,32 @@ class WWD_Startup(WWD_General):
def fillLists(self): def fillLists(self):
# fill the saved session list. # fill the saved session list.
print ("Filling lstLoadSettings with cp_SavedSessions ...")
ListModelBinder.fillList(self.lstLoadSettings, ListModelBinder.fillList(self.lstLoadSettings,
WWD_General.settings.cp_SavedSessions.childrenList, None) self.settings.cp_SavedSessions.childrenList, None)
print ("lstLoadSettings filled !!!")
# set the selected session to load. (step 1) # set the selected session to load. (step 1)
self.selectSession() self.selectSession()
# fill the styles list. # fill the styles list.
print ("Filling lstStyles with cp_Styles ...")
ListModelBinder.fillList(self.lstStyles, ListModelBinder.fillList(self.lstStyles,
WWD_General.settings.cp_Styles.childrenList, None) self.settings.cp_Styles.childrenList, None)
print ("lstStyles filled !!!")
# fill the save session combobox (step 7) # fill the save session combobox (step 7)
print ("Filling cbSaveSettings with savedSessions ...")
ListModelBinder.fillComboBox(self.cbSaveSettings, ListModelBinder.fillComboBox(self.cbSaveSettings,
WWD_General.settings.savedSessions.childrenList, None) self.settings.savedSessions.childrenList, None)
print ("cbSaveSettings filled !!!")
def selectSession(self): def selectSession(self):
selectedSession = 0 selectedSession = 0
if WWD_General.settings.cp_LastSavedSession is not None \ if self.settings.cp_LastSavedSession is not None \
and not WWD_General.settings.cp_LastSavedSession == "": and not self.settings.cp_LastSavedSession == "":
ses = WWD_General.settings.cp_SavedSessions.getElement( ses = self.settings.cp_SavedSessions.getElement(
WWD_General.settings.cp_LastSavedSession) self.settings.cp_LastSavedSession)
if ses is not None: if ses is not None:
selectedSession = \ selectedSession = \
WWD_General.settings.cp_SavedSessions.getIndexOf(ses) self.settings.cp_SavedSessions.getIndexOf(ses)
self.lstLoadSettings.Model.SelectedItems = (selectedSession,) self.lstLoadSettings.Model.SelectedItems = (selectedSession,)
def designItemChanged(self, itemEvent):
self.sda.updateData()
''' '''
attaches to each ui-data-control (like checkbox, groupbox or attaches to each ui-data-control (like checkbox, groupbox or
textbox, no buttons though), a DataObject's JavaBean Property, textbox, no buttons though), a DataObject's JavaBean Property,
...@@ -365,11 +364,11 @@ class WWD_Startup(WWD_General): ...@@ -365,11 +364,11 @@ class WWD_Startup(WWD_General):
def makeDataAware(self): def makeDataAware(self):
#page 1 #page 1
ListModelBinder( ListModelBinder(self.lstLoadSettings, self.settings.cp_SavedSessions)
self.lstLoadSettings, WWD_General.settings.cp_SavedSessions)
#page 2 : document properties #page 2 : document properties
self.docListDA = UnoDataAware.attachListBox( self.docListDA = UnoDataAware.attachListBox(
self, "selectedDoc", self.lstDocuments, False) self, "SelectedDoc", self.lstDocuments, False)
self.docListDA.disableObjects = \ self.docListDA.disableObjects = \
[self.lnDocsInfo, self.btnRemoveDoc, self.lblDocTitle, [self.lnDocsInfo, self.btnRemoveDoc, self.lblDocTitle,
self.txtDocTitle, self.lblDocInfo, self.txtDocInfo, self.txtDocTitle, self.lblDocInfo, self.txtDocInfo,
...@@ -378,7 +377,7 @@ class WWD_Startup(WWD_General): ...@@ -378,7 +377,7 @@ class WWD_Startup(WWD_General):
self.docListDA.updateUI() self.docListDA.updateUI()
doc = CGDocument #dummy doc = CGDocument #dummy
self.docsBinder = ListModelBinder(self.lstDocuments, self.docsBinder = ListModelBinder(self.lstDocuments,
WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents) self.settings.cp_DefaultSession.cp_Content.cp_Documents)
self.docAware.append(UnoDataAware.attachEditControl( self.docAware.append(UnoDataAware.attachEditControl(
doc, "cp_Title", self.txtDocTitle, True)) doc, "cp_Title", self.txtDocTitle, True))
self.docAware.append(UnoDataAware.attachEditControl( self.docAware.append(UnoDataAware.attachEditControl(
...@@ -387,13 +386,13 @@ class WWD_Startup(WWD_General): ...@@ -387,13 +386,13 @@ class WWD_Startup(WWD_General):
doc, "cp_Author", self.txtDocAuthor, True)) doc, "cp_Author", self.txtDocAuthor, True))
self.docAware.append(UnoDataAware.attachListBox( self.docAware.append(UnoDataAware.attachListBox(
doc, "Exporter", self.lstDocTargetType, False)) doc, "Exporter", self.lstDocTargetType, False))
#page 3 : Layout
design = WWD_General.settings.cp_DefaultSession.cp_Design
#COMMENTED #page 3 : Layout
#self.sda = SimpleDataAware.SimpleDataAware_unknown(design, DataAware.PropertyValue ("Layout", design), ilLayouts, DataAware.PropertyValue ("Selected", ilLayouts)) design = self.settings.cp_DefaultSession.cp_Design
self.sda = SimpleDataAware(design, "Layout", self.ilLayouts, "Selected")
self.ilLayouts.addItemListener(ItemListenerProcAdapter(self.designItemChanged))
self.designAware.append(self.sda);
#self.ilLayouts.addItemListener(None)
#page 4 : layout 2 #page 4 : layout 2
self.designAware.append(UnoDataAware.attachCheckBox( self.designAware.append(UnoDataAware.attachCheckBox(
design, "cp_DisplayDescription", self.chbDocDesc, True)) design, "cp_DisplayDescription", self.chbDocDesc, True))
...@@ -414,7 +413,7 @@ class WWD_Startup(WWD_General): ...@@ -414,7 +413,7 @@ class WWD_Startup(WWD_General):
self.designAware.append(UnoDataAware.attachCheckBox( self.designAware.append(UnoDataAware.attachCheckBox(
design, "cp_DisplaySize", self.chkDocSize, True)) design, "cp_DisplaySize", self.chkDocSize, True))
self.designAware.append(RadioDataAware.attachRadioButtons( self.designAware.append(RadioDataAware.attachRadioButtons(
WWD_General.settings.cp_DefaultSession.cp_Design, self.settings.cp_DefaultSession.cp_Design,
"cp_OptimizeDisplaySize", "cp_OptimizeDisplaySize",
(self.optOptimize640x480, self.optOptimize800x600, (self.optOptimize640x480, self.optOptimize800x600,
self.optOptimize1024x768), True)) self.optOptimize1024x768), True))
...@@ -424,26 +423,26 @@ class WWD_Startup(WWD_General): ...@@ -424,26 +423,26 @@ class WWD_Startup(WWD_General):
a special method which will perform some display, background and Iconsets changes. a special method which will perform some display, background and Iconsets changes.
''' '''
self.designAware.append(UnoDataAware.attachListBox( self.designAware.append(UnoDataAware.attachListBox(
WWD_General.settings.cp_DefaultSession.cp_Design, self.settings.cp_DefaultSession.cp_Design,
"cp_Style", self.lstStyles, False)) "Style", self.lstStyles, False))
#page 6 : site general props #page 6 : site general props
self.genAware.append(UnoDataAware.attachEditControl( self.genAware.append(UnoDataAware.attachEditControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, self.settings.cp_DefaultSession.cp_GeneralInfo,
"cp_Title", self.txtSiteTitle, True)) "cp_Title", self.txtSiteTitle, True))
self.genAware.append(UnoDataAware.attachEditControl( self.genAware.append(UnoDataAware.attachEditControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, self.settings.cp_DefaultSession.cp_GeneralInfo,
"cp_Description", self.txtSiteDesc, True)) "cp_Description", self.txtSiteDesc, True))
self.genAware.append(UnoDataAware.attachDateControl( self.genAware.append(UnoDataAware.attachDateControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, self.settings.cp_DefaultSession.cp_GeneralInfo,
"cp_CreationDate", self.dateSiteCreated, False)) "cp_CreationDate", self.dateSiteCreated, False))
self.genAware.append(UnoDataAware.attachDateControl( self.genAware.append(UnoDataAware.attachDateControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, self.settings.cp_DefaultSession.cp_GeneralInfo,
"cp_UpdateDate", self.dateSiteUpdate, False)) "cp_UpdateDate", self.dateSiteUpdate, False))
self.genAware.append(UnoDataAware.attachEditControl( self.genAware.append(UnoDataAware.attachEditControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, self.settings.cp_DefaultSession.cp_GeneralInfo,
"cp_Email", self.txtEmail, True)) "cp_Email", self.txtEmail, True))
self.genAware.append(UnoDataAware.attachEditControl( self.genAware.append(UnoDataAware.attachEditControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, self.settings.cp_DefaultSession.cp_GeneralInfo,
"cp_Copyright", self.txtCopyright, True)) "cp_Copyright", self.txtCopyright, True))
#page 7 : publishing #page 7 : publishing
self.pubAware_( self.pubAware_(
...@@ -453,7 +452,7 @@ class WWD_Startup(WWD_General): ...@@ -453,7 +452,7 @@ class WWD_Startup(WWD_General):
self.pubAware_( self.pubAware_(
ZIP_PUBLISHER, self.chkZip, self.txtZip, False) ZIP_PUBLISHER, self.chkZip, self.txtZip, False)
self.sessionNameDA = UnoDataAware.attachEditControl( self.sessionNameDA = UnoDataAware.attachEditControl(
WWD_General.settings.cp_DefaultSession, "cp_Name", self.settings.cp_DefaultSession, "cp_Name",
self.cbSaveSettings, True) self.cbSaveSettings, True)
''' '''
...@@ -465,7 +464,7 @@ class WWD_Startup(WWD_General): ...@@ -465,7 +464,7 @@ class WWD_Startup(WWD_General):
''' '''
def pubAware_(self, publish, checkbox, textbox, isLabel): def pubAware_(self, publish, checkbox, textbox, isLabel):
p = WWD_General.settings.cp_DefaultSession.cp_Publishing.getElement(publish) p = self.settings.cp_DefaultSession.cp_Publishing.getElement(publish)
uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, True) uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, True)
uda.Inverse = True uda.Inverse = True
uda.disableObjects = [textbox] uda.disableObjects = [textbox]
...@@ -497,7 +496,7 @@ class WWD_Startup(WWD_General): ...@@ -497,7 +496,7 @@ class WWD_Startup(WWD_General):
chooses to cancel, the session is not loaded. chooses to cancel, the session is not loaded.
''' '''
self.checkContent(session.cp_Content, task, xC) self.checkContent(session.cp_Content, task, xC)
WWD_General.settings.cp_DefaultSession = session self.settings.cp_DefaultSession = session
self.fillDocumentList(session.cp_Content) self.fillDocumentList(session.cp_Content)
task.advance(True) task.advance(True)
self.mountList(session.cp_Design, self.designAware) self.mountList(session.cp_Design, self.designAware)
...@@ -538,8 +537,7 @@ class WWD_Startup(WWD_General): ...@@ -538,8 +537,7 @@ class WWD_Startup(WWD_General):
def fillDocumentList(self, root): def fillDocumentList(self, root):
ListModelBinder.fillList(self.lstDocuments, root.cp_Documents.childrenList, None) ListModelBinder.fillList(self.lstDocuments, root.cp_Documents.childrenList, None)
#COMMENTED self.docsBinder.setListModel(root.cp_Documents)
#self.docsBinder.setListModel(root.cp_Documents)
self.disableDocUpDown() self.disableDocUpDown()
''' '''
...@@ -550,7 +548,6 @@ class WWD_Startup(WWD_General): ...@@ -550,7 +548,6 @@ class WWD_Startup(WWD_General):
''' '''
def mountList(self, data, _list): def mountList(self, data, _list):
print ("DEBUG !!! mountList -- data: ", data)
for i in _list: for i in _list:
i.setDataObject(data, True) i.setDataObject(data, True)
...@@ -566,11 +563,6 @@ class WWD_Startup(WWD_General): ...@@ -566,11 +563,6 @@ class WWD_Startup(WWD_General):
@return true if the document is ok (a file exists in the given url). @return true if the document is ok (a file exists in the given url).
''' '''
@classmethod
def checkDocument1(self, xmsf, doc, task, xC):
doc.validate(xmsf, task)
return True
def checkDocument(self, doc, task, xC): def checkDocument(self, doc, task, xC):
doc.validate(self.xMSF, task) doc.validate(self.xMSF, task)
return True return True
...@@ -636,27 +628,14 @@ class WWD_Startup(WWD_General): ...@@ -636,27 +628,14 @@ class WWD_Startup(WWD_General):
def disableDocUpDown(self): def disableDocUpDown(self):
try: try:
if len(WWD_Startup.selectedDoc) == 0: self.btnDocUp.Model.Enabled = False if (len(self.selectedDoc) == 0) else (False if (self.selectedDoc[0] == 0) else True)
aux = False self.btnDocDown.Model.Enabled = False if (len(self.selectedDoc) == 0) else (True if (self.selectedDoc[0] + 1 < self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize()) else False)
aux2 = False
else:
if WWD_Startup.selectedDoc[0] == 0:
aux = False
else:
aux = True
if WWD_Startup.selectedDoc[0] + 1 < \
WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize():
aux2 = True
else:
aux2 = False
self.btnDocUp.Model.Enabled = aux
self.btnDocDown.Model.Enabled = aux2
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
def updateBackgroundText(self): def updateBackgroundText(self):
bg = \ bg = \
WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage
if bg is None or bg == "": if bg is None or bg == "":
bg = self.resources.resBackgroundNone bg = self.resources.resBackgroundNone
else: else:
...@@ -665,11 +644,11 @@ class WWD_Startup(WWD_General): ...@@ -665,11 +644,11 @@ class WWD_Startup(WWD_General):
self.txtBackground.Model.Label = bg self.txtBackground.Model.Label = bg
def updateIconsetText(self): def updateIconsetText(self):
iconset = WWD_General.settings.cp_DefaultSession.cp_Design.cp_IconSet iconset = self.settings.cp_DefaultSession.cp_Design.cp_IconSet
if iconset is None or iconset == "": if iconset is None or iconset == "":
iconsetName = self.resources.resIconsetNone iconsetName = self.resources.resIconsetNone
else: else:
IconSet = WWD_General.settings.cp_IconSets.getElement(iconset) IconSet = self.settings.cp_IconSets.getElement(iconset)
if IconSet is None: if IconSet is None:
iconsetName = self.resources.resIconsetNone iconsetName = self.resources.resIconsetNone
else: else:
...@@ -686,10 +665,9 @@ class WWD_Startup(WWD_General): ...@@ -686,10 +665,9 @@ class WWD_Startup(WWD_General):
def refreshStylePreview(self): def refreshStylePreview(self):
try: try:
print ("WARNING !!! refreshStylePreview")
self.updateBackgroundText() self.updateBackgroundText()
self.stylePreview.refresh(WWD_General.settings.cp_DefaultSession.getStyle(), self.stylePreview.refresh(self.settings.cp_DefaultSession.getStyle(),
WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage) self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
self.dpStylePreview.reload(self.xMSF) self.dpStylePreview.reload(self.xMSF)
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
...@@ -36,7 +36,6 @@ class AbstractExporter(Exporter): ...@@ -36,7 +36,6 @@ class AbstractExporter(Exporter):
fileAccess = None fileAccess = None
def __init__(self, exporter_): def __init__(self, exporter_):
print ("DEBUG !!! AbstractExporter.init - exporter: ", exporter_)
self.exporter = exporter_ self.exporter = exporter_
def storeToURL(self, officeDocument, props, targetUrl, filterName, filterData): def storeToURL(self, officeDocument, props, targetUrl, filterName, filterData):
...@@ -65,7 +64,6 @@ class AbstractExporter(Exporter): ...@@ -65,7 +64,6 @@ class AbstractExporter(Exporter):
props[0] = Properties.createProperty("Hidden", True) props[0] = Properties.createProperty("Hidden", True)
props[1] = Properties.createProperty("MacroExecutionMode", NEVER_EXECUTE) props[1] = Properties.createProperty("MacroExecutionMode", NEVER_EXECUTE)
props[2] = Properties.createProperty("UpdateDocMode", NO_UPDATE) props[2] = Properties.createProperty("UpdateDocMode", NO_UPDATE)
print ("DEBUG !!! openDocument -- URL: ", doc.cp_URL)
document = desktop.loadComponentFromURL(doc.cp_URL, "_blank", 0, tuple(props)) document = desktop.loadComponentFromURL(doc.cp_URL, "_blank", 0, tuple(props))
except IllegalArgumentException: except IllegalArgumentException:
traceback.print_exc() traceback.print_exc()
......
...@@ -34,12 +34,9 @@ class CopyExporter(AbstractExporter): ...@@ -34,12 +34,9 @@ class CopyExporter(AbstractExporter):
task.advance(True) task.advance(True)
print ("WARNING !!! CopyExporter (creating newtarget) - source.urlFilename: ", source.urlFilename)
newTarget = FileAccess.connectURLs( newTarget = FileAccess.connectURLs(
FileAccess.getParentDir(target), source.urlFilename) FileAccess.getParentDir(target), source.urlFilename)
print ("WARNING !!! CopyExporter (export) - source, target: ", source.cp_URL, newTarget)
b = self.getFileAccess(xmsf).copy(source.cp_URL, newTarget) b = self.getFileAccess(xmsf).copy(source.cp_URL, newTarget)
task.advance(True) task.advance(True)
......
...@@ -30,14 +30,12 @@ class FilterExporter(AbstractExporter): ...@@ -30,14 +30,12 @@ class FilterExporter(AbstractExporter):
props = Properties() props = Properties()
def __init__(self, exporter_): def __init__(self, exporter_):
print ("DEBUG !!! FilterExporter.init - exporter: ", exporter_)
super(FilterExporter, self).__init__(exporter_) super(FilterExporter, self).__init__(exporter_)
self.filterName = self.getArgument("Filter", exporter_) self.filterName = self.getArgument("Filter", exporter_)
# (non-Javadoc) # (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) # @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): def export(self, source, target, xmsf, task):
print ("DEBUG !!! FilterExporter.export")
result = True result = True
document = None 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