diff options
author | Javier Fernandez <jfernandez@igalia.com> | 2013-05-04 12:01:19 +0000 |
---|---|---|
committer | Javier Fernandez <jfernandez@igalia.com> | 2013-05-08 09:36:41 +0000 |
commit | c1330b9c8373c96c7677a2ac1928c976815bcff9 (patch) | |
tree | bb0eb938cb60ffcffda48d68087c95a14992802c /wizards/com | |
parent | 9532335dd2c3f2bb9c3761bf8c4c879107f1538d (diff) |
PyWebWizard: Fixing bugs and implementation of mising features.
Formating, python style coding and debug output removal.
Change-Id: If5811473695f23b8b11dcd5a7d6e6775ca41ae88
Diffstat (limited to 'wizards/com')
10 files changed, 168 insertions, 249 deletions
diff --git a/wizards/com/sun/star/wizards/web/ExtensionVerifier.py b/wizards/com/sun/star/wizards/web/ExtensionVerifier.py index 6f5fee0c88a8..524027be52b8 100644 --- a/wizards/com/sun/star/wizards/web/ExtensionVerifier.py +++ b/wizards/com/sun/star/wizards/web/ExtensionVerifier.py @@ -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 diff --git a/wizards/com/sun/star/wizards/web/Process.py b/wizards/com/sun/star/wizards/web/Process.py index bfe4286447ff..e0044d992429 100644 --- a/wizards/com/sun/star/wizards/web/Process.py +++ b/wizards/com/sun/star/wizards/web/Process.py @@ -31,9 +31,6 @@ from .data.CGExporter import CGExporter from .data.CGLayout import CGLayout from .data.CGPublish import CGPublish 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.uno import SecurityException @@ -141,15 +138,12 @@ class Process(ProcessErrors): # methods returns false, the next # 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) - print ("runProcess -- result: ", self.result) finally: # cleanup must be called. self.result = self.result and self.cleanup(self.myTask) - print ("runProcess (cleanup) -- result: ", self.result) except Exception: traceback.print_exc() self.result = False - print ("runProcess (Exception) -- result: ", self.result) if not self.result: # this is a bug protection. @@ -167,8 +161,7 @@ class Process(ProcessErrors): except Exception: traceback.print_exc() 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 else: task.advance(True) @@ -188,11 +181,9 @@ class Process(ProcessErrors): # delete the temporary directory # @return true should continue def cleanup(self, task): - print ("WARNING !!! cleanup") task.setSubtaskName(TASK_FINISH) b = self.fileAccess.delete(self.tempDir) if not b: - print ("WARNING !!! cleanup -- error") self.error(None, None, ProcessErrors.ERROR_CLEANUP, ErrorHandler.ERROR_WARNING) task.advance(b) return b @@ -205,7 +196,6 @@ class Process(ProcessErrors): # 1. .css sourceDir = FileAccess.connectURLs(settings.workPath, "styles") 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") task.advance(True) @@ -215,7 +205,6 @@ class Process(ProcessErrors): if (background is not None and background is not ""): sourceDir = FileAccess.getParentDir(background) 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") task.advance(True) @@ -232,7 +221,6 @@ class Process(ProcessErrors): def copyStaticImages(self, copy, settings, targetDir): source = FileAccess.connectURLs(settings.workPath, "images") target = targetDir + "/images" - print ("WARNING !!! copyStaticImages - source, target: ", source, target) copy.copy(source, target) # publish the given directory. @@ -249,7 +237,6 @@ class Process(ProcessErrors): except Exception as ex: # error in copying media traceback.print_exc() - print ("WARNING !!! publish -- error") self.error(ex, "", ProcessErrors.ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL) return False for p in configSet.childrenList: @@ -273,14 +260,12 @@ class Process(ProcessErrors): try: task.advance(True) url = publish.url - print ("WARNING !!! publish1 - source, target: ", folder, url) copy.copy(folder, url) task.advance(True) return True except Exception as e: task.advance(False) traceback.print_exc() - print ("WARNING !!! publish1 -- error") return self.error(e, publish, ProcessErrors.ERROR_PUBLISH, ErrorHandler.ERROR_NORMAL_IGNORE) # Generates the TOC pages for the current session. @@ -297,9 +282,7 @@ class Process(ProcessErrors): doc = self.settings.cp_DefaultSession.createDOM1() self.generate1(self.xmsf, layout, doc, self.fileAccess, targetDir, task) except Exception as ex: - print ("WARNING !!! generate (calling generate1 -- error") traceback.print_exc() - print ("WARNING !!! publish1 -- error") self.error(ex, "", ProcessErrors.ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL) return False @@ -315,7 +298,6 @@ class Process(ProcessErrors): result = True except Exception as ex: task.advance(False) - print ("WARNING !!! generate (copying layouts) -- error") traceback.print_exc() return self.error(ex, None, ProcessErrors.ERROR_GENERATE_COPY, ErrorHandler.ERROR_NORMAL_ABORT) return result @@ -331,7 +313,6 @@ class Process(ProcessErrors): @classmethod def copyLayoutFiles(self, ucb, fileAccess, settings, layout, targetDir): filesPath = fileAccess.getURL(FileAccess.connectURLs(settings.workPath, "layouts/"), layout.cp_FSName) - print ("WARNING !!! copyLayoutFiles - source, target: ", filesPath, targetDir) ucb.copy1(filesPath, targetDir, ExtensionVerifier("xsl")) # generates the TOC page for the given layout. @@ -454,7 +435,6 @@ class Process(ProcessErrors): # each content (at the moment there is only one :-( ) # is created in its own directory. # faileure here is fatal. - print ("export1 - folder and cp_Name: ", folder, content.cp_Name) contentDir = self.fileAccess.createNewDir(folder, content.cp_Name); if (contentDir is None or contentDir is ""): raise IOException("Directory " + folder + " could not be created.") @@ -482,19 +462,16 @@ class Process(ProcessErrors): except SecurityException as sx: # nonfatal traceback.print_exc() - print ("WARNING !!! export1 (SecurityException -- error") if (not self.error(sx, item, ProcessErrors.ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE)): return False self.result = False except IOException as iox: # nonfatal traceback.print_exc() - print ("WARNING !!! export1 (IOException -- error") return self.error(iox, content, ProcessErrors.ERROR_EXPORT_IO, ErrorHandler.ERROR_NORMAL_IGNORE) except SecurityException as se: # nonfatal traceback.print_exc() - print ("WARNING !!! export1 (SecurityException -- error") return self.error(se, content, ProcessErrors.ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE) self.failTask(task, toPerform) @@ -509,17 +486,14 @@ class Process(ProcessErrors): # first I check if the document was already validated... if (not doc.valid): try: - print ("WARNING !!! export2 -- new validation: ") doc.validate(self.xmsf, task) except Exception as ex: # fatal traceback.print_exc() - print ("WARNING !!! export2 (validation) -- error") self.error(ex, doc, ProcessErrors.ERROR_DOC_VALIDATE, ErrorHandler.ERROR_PROCESS_FATAL) return False # get the exporter specified for this document exp = doc.cp_Exporter - print ("WARNING !!! export2 -- exporter: ", exp) exporter = self.settings.cp_Exporters.getElement(exp) try: @@ -527,24 +501,18 @@ class Process(ProcessErrors): # I take the original filename (docFilename), substract the extension, (docExt) -> (fn) # and find an available filename which starts with # 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) - print ("WARNING !!! export2 - docFilename: ", docFilename) docExt = FileAccess.getExtension(docFilename) - print ("WARNING !!! export2 - docExt: ", docExt) # filename without extension #fn = doc.localFilename.substring(0, doc.localFilename.length() - docExt.length() - 1) fn = doc.localFilename[:len(doc.localFilename) - len(docExt) - 1] - print ("WARNING !!! export2 - fn: ", fn) # the copyExporter does not change # the extension of the target... destExt = FileAccess.getExtension(docFilename) \ if (exporter.cp_Extension is "") \ else exporter.cp_Extension - print ("WARNING !!! export2 - destExt: ", destExt) # if this filter needs to export to its own directory... # this is the case in, for example, impress html export @@ -558,14 +526,12 @@ class Process(ProcessErrors): # i get a new filename, so I do not # overwrite files... f = self.fileAccess.getNewFile(folder, fn, destExt) - print ("WARNING !!! export2 - f: ", f) # set filename with extension. # this will be used by the exporter, # and to generate the TOC. doc.urlFilename = FileAccess.getFilename(f) - print ("WARNING !!! export2 - : doc.urlFilename", doc.urlFilename) task.advance(True) @@ -579,13 +545,11 @@ class Process(ProcessErrors): except Exception as ex: # nonfatal traceback.print_exc() - print ("WARNING !!! export2 (getting exporters) -- error") if (not self.error(ex, doc, ProcessErrors.ERROR_EXPORT, ErrorHandler.ERROR_NORMAL_IGNORE)): return False except Exception as ex: # nonfatal traceback.print_exc() - print ("WARNING !!! export2 (general) -- error") if (not self.error(ex, doc, ProcessErrors.ERROR_EXPORT_MKDIR, ErrorHandler.ERROR_NORMAL_ABORT)): return False @@ -599,7 +563,6 @@ class Process(ProcessErrors): # @return the interaction result def error(self, ex, arg1, arg2, errType): self.result = False - print ("error -- result: ", self.result) return self.errorHandler.error(ex, arg1, arg2, errType) @@ -621,7 +584,6 @@ class Process(ProcessErrors): # @throws IllegalAccessException # @throws InstantiationException def createExporter(self, export): - print ("WANRING !!!! Creating exporter -- class: ", export.cp_ExporterClass) pkgname = ".".join(export.cp_ExporterClass.split(".")[3:]) className = export.cp_ExporterClass.split(".")[-1] mod = importlib.import_module(pkgname) @@ -646,6 +608,4 @@ class Process(ProcessErrors): # @return tru if everything went smooth, false # if error(s) accured. def getResult(self): - print ("Process -- getFailed: ", self.myTask.getFailed()) - print ("Process -- result: ", self.result) return (self.myTask.getFailed() == 0) and self.result diff --git a/wizards/com/sun/star/wizards/web/ProcessErrorHandler.py b/wizards/com/sun/star/wizards/web/ProcessErrorHandler.py index 6b6c8bb442ac..84201d323f4f 100644 --- a/wizards/com/sun/star/wizards/web/ProcessErrorHandler.py +++ b/wizards/com/sun/star/wizards/web/ProcessErrorHandler.py @@ -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: diff --git a/wizards/com/sun/star/wizards/web/StylePreview.py b/wizards/com/sun/star/wizards/web/StylePreview.py index d131037c7ce8..cefd608120a2 100644 --- a/wizards/com/sun/star/wizards/web/StylePreview.py +++ b/wizards/com/sun/star/wizards/web/StylePreview.py @@ -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): diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py index c378b137dbae..ded74665ed1e 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.py +++ b/wizards/com/sun/star/wizards/web/WWD_Events.py @@ -17,6 +17,8 @@ # import traceback import uno +import time + #from common.Desktop import Desktop from .WWD_Startup import WWD_Startup from .WWD_General import WWD_General @@ -24,6 +26,7 @@ from .WebWizardConst import * from ..common.FileAccess import FileAccess from ..common.Configuration import Configuration from ..ui.event.ListModelBinder import ListModelBinder +from ..ui.event.CommonListener import KeyListenerProcAdapter from ..ui.event.Task import Task from .data.CGDocument import CGDocument from .data.CGSession import CGSession @@ -59,9 +62,10 @@ class WWD_Events(WWD_Startup): def __init__(self, xmsf): super(WWD_Events, self).__init__(xmsf) - self.chkFTP.addKeyListener(None) - self.chkLocalDir.addKeyListener(None) - self.chkZip.addKeyListener(None) + c = KeyListenerProcAdapter(self.keyPressed) + self.chkFTP.addKeyListener(c) + self.chkLocalDir.addKeyListener(c) + self.chkZip.addKeyListener(c) self.currentSession = "" self.exitOnCreate = True self.time = 0 @@ -93,11 +97,20 @@ class WWD_Events(WWD_Startup): sessionToLoad = "" else: 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: 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 @@ -117,7 +130,6 @@ class WWD_Events(WWD_Startup): ''' def loadSession(self, sessionToLoad): - print ("DEBUG !!! loadSession -- sessionToLoad: ", sessionToLoad) try: sd = self.getStatusDialog() task = Task("LoadDocs", "", 10) @@ -135,11 +147,9 @@ class WWD_Events(WWD_Startup): view = Configuration.getNode(sessionToLoad, view) session = CGSession() - session.root = WWD_Startup.settings - print ("DEBUG !!! loadSession -- reading configuration ...") + session.setRoot(self.settings) session.readConfiguration(view, CONFIG_READ_PARAM) numDocs = session.cp_Content.cp_Documents.getSize() - print ("DEBUG !!! loadSession -- numDocs: ", numDocs) task.setMax(numDocs * 5 + 7) task.advance(True) if sessionToLoad == "": @@ -177,16 +187,16 @@ class WWD_Events(WWD_Startup): ErrorHandler.ERROR_QUESTION_NO) if confirm: 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. Configuration.removeNode( self.xMSF, CONFIG_PATH + "/SavedSessions", name) # then delete WWD_Startup.settings.cp_SavedSessions - WWD_Startup.settings.cp_SavedSessions.remove(selected[0]) - WWD_Startup.settings.savedSessions.remove(selected[0] - 1) + self.settings.cp_SavedSessions.remove(selected[0]) + self.settings.savedSessions.remove(selected[0] - 1) nextSelected = [0] # 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] else: # this will always be available because @@ -211,6 +221,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 in the listbox, this method is called, and couses the display in @@ -219,21 +238,19 @@ class WWD_Events(WWD_Startup): ''' def setSelectedDoc(self, s): - print ("DEBUG !!! setSelectedDoc -- s: ", s) - oldDoc = self.getDoc(WWD_Startup.selectedDoc) + oldDoc = self.getDoc(self.selectedDoc) doc = self.getDoc(s) if doc is None: - print ("DEBUG !!! setSelectedDoc -- doc is None.") self.fillExportList([]) #I try to avoid refreshing the export list if #the same type of document is chosen. elif oldDoc is None or oldDoc.appType != doc.appType: - print ("DEBUG !!! setSelectedDoc -- oddDoc is None.") - self.fillExportList(WWD_Startup.settings.getExporters(doc.appType)) + self.fillExportList(self.settings.getExporters(doc.appType)) - WWD_Startup.selectedDoc = s - self.mountList(doc, self.docAware) - self.disableDocUpDown() + self.selectedDoc = list(s) + if (doc is not None): + self.mountList(doc, self.docAware) + self.disableDocUpDown() ''' The user clicks the "Add" button. @@ -245,11 +262,9 @@ class WWD_Events(WWD_Startup): def addDocument(self): try: files = self.getDocAddDialog().callOpenDialog( - True, WWD_Startup.settings.cp_DefaultSession.cp_InDirectory) + True, self.settings.cp_DefaultSession.cp_InDirectory) if files is None: - print ("DEBUG !!! addDocument -- files is None") return - print ("DEBUG !!! addDocument -- number of files: ", len(files)) task = Task("", "", len(files) * 5) ''' @@ -279,20 +294,20 @@ class WWD_Events(WWD_Startup): ''' def removeDocument(self): - if len(WWD_Startup.selectedDoc) == 0: + if len(self.selectedDoc) == 0: return - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( - WWD_Startup.selectedDoc[0]) + self.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( + self.selectedDoc[0]) # update the selected document - while WWD_Startup.selectedDoc[0] >= self.getDocsCount(): - WWD_Startup.selectedDoc[0] -= 1 + while self.selectedDoc[0] >= self.getDocsCount(): + self.selectedDoc[0] -= 1 # if there are no documents... - if WWD_Startup.selectedDoc[0] == -1: - WWD_Startup.selectedDoc = [] + if self.selectedDoc[0] == -1: + self.selectedDoc = [] # update the list to show the right selection. - docListDA.updateUI() + self.docListDA.updateUI() # disables all the next steps, if the list of docuemnts # is empty. self.checkSteps() @@ -302,14 +317,13 @@ class WWD_Events(WWD_Startup): ''' def docUp(self): - print ("DEBUG !!! docUp --") - doc = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add( - WWD_Startup.selectedDoc[0] - 1, doc) - docListDA.updateUI() + doc = self.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( + self.selectedDoc[0]) + self.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( + self.selectedDoc[0]) + self.settings.cp_DefaultSession.cp_Content.cp_Documents.add( + self.selectedDoc[0] - 1, doc) + self.docListDA.updateUI() self.disableDocUpDown() ''' @@ -317,14 +331,13 @@ class WWD_Events(WWD_Startup): ''' def docDown(self): - print ("DEBUG !!! docDown --") - doc = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( - WWD_Startup.selectedDoc[0]) - WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add( - (WWD_Startup.selectedDoc[0] + 1), doc) - docListDA.updateUI() + doc = self.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt( + self.selectedDoc[0]) + self.settings.cp_DefaultSession.cp_Content.cp_Documents.remove( + self.selectedDoc[0]) + self.settings.cp_DefaultSession.cp_Content.cp_Documents.add( + (self.selectedDoc[0] + 1), doc) + self.docListDA.updateUI() self.disableDocUpDown() ''' @@ -415,8 +428,6 @@ class WWD_Events(WWD_Startup): if url is None: return None - print ("DEBUG !!! setPublishUrl - publisher: " + publisher + " url: " + url) - p = self.getPublisher(publisher) p.cp_URL = url p.cp_Publish = True @@ -442,7 +453,7 @@ class WWD_Events(WWD_Startup): def setPublishLocalDir(self): folder = self.showFolderDialog( "Local destination directory", "", - WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory) + self.settings.cp_DefaultSession.cp_OutDirectory) #if ok was pressed... self.setPublishUrl(LOCAL_PUBLISHER, folder, 0) @@ -476,7 +487,7 @@ class WWD_Events(WWD_Startup): def setZipFilename(self): sd = self.getZipDialog() zipFile = sd.callStoreDialog( - WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory, + self.settings.cp_DefaultSession.cp_OutDirectory, self.resources.resDefaultArchiveFilename) self.setPublishUrl(ZIP_PUBLISHER, zipFile, 4) self.getPublisher(ZIP_PUBLISHER).overwriteApproved = True @@ -514,9 +525,9 @@ class WWD_Events(WWD_Startup): result = True # 1. check local publish target p = self.getPublisher(LOCAL_PUBLISHER) + fileAccess = self.getFileAccess() # should publish ? if (p.cp_Publish): - fileAccess = self.getFileAccess() path = fileAccess.getPath(p.url, None) # target exists? if fileAccess.exists(p.url, False): @@ -566,7 +577,6 @@ class WWD_Events(WWD_Startup): # try to create the directory... try: - print ("WARNING !!! publishTargetApproved -- URL: ", p.cp_URL) fileAccess.xInterface.createFolder(p.cp_URL) except Exception as ex: message = self.resources.resLocalTargetCouldNotCreate.replace( @@ -665,12 +675,11 @@ class WWD_Events(WWD_Startup): ''' def saveSession(self): - print ("DEBUG !!! saveSession") try: node = None name = self.getSessionSaveName() #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 while i < docs.getSize(): (docs.getElementAt(i)).cp_Index = i @@ -679,8 +688,6 @@ class WWD_Events(WWD_Startup): self.xMSF, CONFIG_PATH + "/SavedSessions", True) # first I check if a session with the given name exists try: - print ("DEBUG !!! saveSession -- check if a session with the given name exists") - print ("DEBUG !!! saveSession -- name: ", name) node = Configuration.getNode(name, conf) if node is not None: if not AbstractErrorHandler.showMessage1( @@ -690,35 +697,34 @@ class WWD_Events(WWD_Startup): return False #remove the old session Configuration.removeNode(conf, name) except NoSuchElementException as nsex: - print ("DEBUG !!! saveSession -- node not found in Configuration - name: ", name) pass - WWD_Startup.settings.cp_DefaultSession.cp_Index = 0 + self.settings.cp_DefaultSession.cp_Index = 0 node = Configuration.addConfigNode(conf, name) - WWD_Startup.settings.cp_DefaultSession.cp_Name = name - WWD_Startup.settings.cp_DefaultSession.writeConfiguration( + self.settings.cp_DefaultSession.cp_Name = name + self.settings.cp_DefaultSession.writeConfiguration( 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) # now I reload the sessions to actualize the list/combo # boxes load/save sessions. - WWD_Startup.settings.cp_SavedSessions.clear() + self.settings.cp_SavedSessions.clear() confView = Configuration.getConfigurationRoot( self.xMSF, CONFIG_PATH + "/SavedSessions", False) - WWD_Startup.settings.cp_SavedSessions.readConfiguration( + self.settings.cp_SavedSessions.readConfiguration( confView, CONFIG_READ_PARAM) - WWD_Startup.settings.cp_LastSavedSession = name + self.settings.cp_LastSavedSession = name self.currentSession = name # 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... self.prepareSessionLists() ListModelBinder.fillList( - self.lstLoadSettings, WWD_Startup.settings.cp_SavedSessions.childrenList, None) + self.lstLoadSettings, self.settings.cp_SavedSessions.childrenList, None) ListModelBinder.fillComboBox( - self.cbSaveSettings, WWD_Startup.settings.savedSessions.childrenList, None) + self.cbSaveSettings, self.settings.savedSessions.childrenList, None) self.selectSession() - self.currentSession = WWD_Startup.settings.cp_LastSavedSession + self.currentSession = self.settings.cp_LastSavedSession return True except Exception: traceback.print_exc() @@ -834,19 +840,17 @@ class WWD_Events(WWD_Startup): p.cp_Publish = self.ftp #if the "save settings" checkbox is on... - if self.isSaveSession(): # if canceled by user if not self.saveSession(): - print ("DEBUG !!! finishWizard2 - saveSession canceled !!!") return else: - WWD_Startup.settings.cp_LastSavedSession = "" + self.settings.cp_LastSavedSession = "" try: conf = Configuration.getConfigurationRoot(self.xMSF, CONFIG_PATH, True) Configuration.set( - WWD_Startup.settings.cp_LastSavedSession, "LastSavedSession", conf) + self.settings.cp_LastSavedSession, "LastSavedSession", conf) Configuration.commit(conf) except Exception: traceback.print_exc() @@ -899,7 +903,8 @@ class WWD_Events(WWD_Startup): if self.ftpDialog is not None: self.ftpDialog.xUnoDialog.dispose() - #self.dispose() + self.xUnoDialog.dispose() + self.myFrame.close(False); #if ProcessStatusRenderer is not None: # ProcessStatusRenderer.close(False) @@ -917,8 +922,7 @@ class WWD_Events(WWD_Startup): self.task = task_ def loadDocuments(self): - offset = WWD_Startup.selectedDoc[0] + 1 if (len(WWD_Startup.selectedDoc) > 0) else self.parent.getDocsCount() - print ("DEBUG !!! loadDocuments -- offset: ", offset) + offset = self.parent.selectedDoc[0] + 1 if (len(self.parent.selectedDoc) > 0) else self.parent.getDocsCount() ''' if the user chose one file, the list starts at 0, @@ -929,17 +933,15 @@ class WWD_Events(WWD_Startup): start = 1 else: start = 0 - print ("DEBUG !!! loadDocuments -- start: ", start) #Number of documents failed to validate. failed = 0 # store the directory - print ("DEBUG !!! loadDocuments (Store the directory) -- dir: ", self.files[0]) if start == 1: - WWD_General.settings.cp_DefaultSession.cp_InDirectory = self.files[0] + self.parent.settings.cp_DefaultSession.cp_InDirectory = self.files[0] else: - WWD_General.settings.cp_DefaultSession.cp_InDirectory = \ + self.parent.settings.cp_DefaultSession.cp_InDirectory = \ FileAccess.getParentDir(self.files[0]) ''' @@ -949,12 +951,12 @@ class WWD_Events(WWD_Startup): for i in range(start, len(self.files)): doc = CGDocument() + doc.setRoot(self.parent.settings) if start == 0: doc.cp_URL = self.files[i] else: 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. @@ -962,21 +964,16 @@ class WWD_Events(WWD_Startup): Error reporting to the user is (or should (-: ) 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 - print ("DEBUG !!! loadDocuments (checkDocument) -- index: ", index) - WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.add(index, doc) + self.parent.settings.cp_DefaultSession.cp_Content.cp_Documents.add(index, doc) else: - print ("DEBUG !!! loadDocuments (checkDocument) -- failed validation.") failed += 1 # if any documents where added, # set the first one to be the current-selected document. if len(self.files) > start + failed: - print ("DEBUG !!! loadDocuments (setSelectedDoc) -- offset: ", offset) self.parent.setSelectedDoc([offset]) - else: - print ("DEBUG !!! loadDocuments (setSelectedDoc) -- no documents were added") # update the ui... self.parent.docListDA.updateUI() diff --git a/wizards/com/sun/star/wizards/web/WWD_General.py b/wizards/com/sun/star/wizards/web/WWD_General.py index 58a4c4c5f415..4a06ce67e80d 100644 --- a/wizards/com/sun/star/wizards/web/WWD_General.py +++ b/wizards/com/sun/star/wizards/web/WWD_General.py @@ -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_()) ''' diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py index 6c5ccdfe7f60..f76ffc4f327d 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.py +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py @@ -24,6 +24,7 @@ from .StylePreview import StylePreview from ..common.Configuration import Configuration from ..common.FileAccess import FileAccess from ..common.Desktop import Desktop +from ..common.Properties import Properties from ..document.OfficeDocument import OfficeDocument from .data.CGSettings import CGSettings from .data.CGDocument import CGDocument @@ -31,6 +32,8 @@ from .data.CGSessionName import CGSessionName from ..ui.event.ListModelBinder import ListModelBinder from ..ui.event.UnoDataAware import UnoDataAware 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.DocumentPreview import DocumentPreview from ..ui.event.DataAware import DataAware @@ -81,9 +84,6 @@ are the controller inbetween. class WWD_Startup(WWD_General): - selectedDoc = [] - ftp = False - ''' He - my constructor ! I call/do here in this order: <br/> @@ -107,6 +107,8 @@ class WWD_Startup(WWD_General): def __init__(self, xmsf): super(WWD_Startup, self).__init__(xmsf) + self.selectedDoc = [] + self.ftp = True self.sda = None self.docAware = [] self.designAware = [] @@ -133,11 +135,11 @@ class WWD_Startup(WWD_General): doc = OfficeDocument.createNewDocument( self.myFrame, "swriter", False, True) self.loadSettings(doc) - self.setSaveSessionName(WWD_General.settings.cp_DefaultSession) - self.ilLayouts.listModel = WWD_General.settings.cp_Layouts + self.setSaveSessionName(self.settings.cp_DefaultSession) + self.ilLayouts.listModel = self.settings.cp_Layouts self.ilLayouts.create(self) #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. # also set the chosen saved session... self.fillLists() @@ -184,9 +186,9 @@ class WWD_Startup(WWD_General): length = self.resources.resSessionName # traverse between the sessions and find the one that # has the biggest number. - for i in range(WWD_General.settings.cp_SavedSessions.getSize()): + for i in range(self.settings.cp_SavedSessions.getSize()): sessionName = \ - WWD_General.settings.cp_SavedSessions.getElementAt(i).cp_Name + self.settings.cp_SavedSessions.getElementAt(i).cp_Name if sessionName.startswith(self.resources.resSessionName): maxValue = max(maxValue, int(sessionName[length:])) @@ -238,7 +240,6 @@ class WWD_Startup(WWD_General): self.addRoadMapItems() self.addStylePreview() self.checkSteps() - print ("WARNING !!! show() : executeDialogFromComponent") self.executeDialogFromComponent(self.myFrame) self.removeTerminateListener() except Exception: @@ -252,9 +253,9 @@ class WWD_Startup(WWD_General): try: self.dpStylePreview = DocumentPreview(self.xMSF, self.imgPreview) self.stylePreview = StylePreview( - self.xMSF, WWD_General.settings.workPath) - style = WWD_General.settings.cp_DefaultSession.getStyle() - bg = WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage + self.xMSF, self.settings.workPath) + style = self.settings.cp_DefaultSession.getStyle() + bg = self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage self.stylePreview.refresh(style, bg) self.dpStylePreview.setDocument( self.stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE) @@ -268,21 +269,21 @@ class WWD_Startup(WWD_General): def loadSettings(self, document): try: # instanciate - WWD_General.settingsResources = \ + self.settingsResources = \ [self.resources.resPages, self.resources.resSlides, self.resources.resCreatedTemplate, self.resources.resUpdatedTemplate, self.resources.resSizeTemplate] - WWD_General.settings = CGSettings( - self.xMSF, WWD_General.settingsResources, document) + self.settings = CGSettings( + self.xMSF, self.settingsResources, document) # get configuration view confRoot = Configuration.getConfigurationRoot( self.xMSF, CONFIG_PATH, True) # read - WWD_General.settings.readConfiguration( + self.settings.readConfiguration( 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 # are getting replaced here... for i in range(configSet.getSize()): @@ -291,12 +292,13 @@ class WWD_Startup(WWD_General): p.cp_URL = self.substitute(p.cp_URL) except Exception: traceback.print_exc() + # initialize the WWD_General.settings. - WWD_General.settings.configure(self.xMSF) + self.settings.configure(self.xMSF) # set resource needed for web page. # sort the styles alphabetically #COMMENTED - FIXME: to be impemented - #WWD_General.settings.cp_Styles.sort(None) + #self.settings.cp_Styles.sort(None) self.prepareSessionLists() if self.proxies: self.ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish @@ -307,16 +309,16 @@ class WWD_Startup(WWD_General): def prepareSessionLists(self): # 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): - WWD_General.settings.savedSessions.add(index, item) + self.settings.savedSessions.add(index, item) # add an empty session to the saved session # list which apears in step 1 sn = CGSessionName() 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, @@ -328,35 +330,32 @@ class WWD_Startup(WWD_General): def fillLists(self): # fill the saved session list. - print ("Filling lstLoadSettings with cp_SavedSessions ...") ListModelBinder.fillList(self.lstLoadSettings, - WWD_General.settings.cp_SavedSessions.childrenList, None) - print ("lstLoadSettings filled !!!") + self.settings.cp_SavedSessions.childrenList, None) # set the selected session to load. (step 1) self.selectSession() # fill the styles list. - print ("Filling lstStyles with cp_Styles ...") ListModelBinder.fillList(self.lstStyles, - WWD_General.settings.cp_Styles.childrenList, None) - print ("lstStyles filled !!!") + self.settings.cp_Styles.childrenList, None) # fill the save session combobox (step 7) - print ("Filling cbSaveSettings with savedSessions ...") ListModelBinder.fillComboBox(self.cbSaveSettings, - WWD_General.settings.savedSessions.childrenList, None) - print ("cbSaveSettings filled !!!") + self.settings.savedSessions.childrenList, None) def selectSession(self): selectedSession = 0 - if WWD_General.settings.cp_LastSavedSession is not None \ - and not WWD_General.settings.cp_LastSavedSession == "": - ses = WWD_General.settings.cp_SavedSessions.getElement( - WWD_General.settings.cp_LastSavedSession) + if self.settings.cp_LastSavedSession is not None \ + and not self.settings.cp_LastSavedSession == "": + ses = self.settings.cp_SavedSessions.getElement( + self.settings.cp_LastSavedSession) if ses is not None: selectedSession = \ - WWD_General.settings.cp_SavedSessions.getIndexOf(ses) + self.settings.cp_SavedSessions.getIndexOf(ses) self.lstLoadSettings.Model.SelectedItems = (selectedSession,) + def designItemChanged(self, itemEvent): + self.sda.updateData() + ''' attaches to each ui-data-control (like checkbox, groupbox or textbox, no buttons though), a DataObject's JavaBean Property, @@ -365,11 +364,11 @@ class WWD_Startup(WWD_General): def makeDataAware(self): #page 1 - ListModelBinder( - self.lstLoadSettings, WWD_General.settings.cp_SavedSessions) + ListModelBinder(self.lstLoadSettings, self.settings.cp_SavedSessions) + #page 2 : document properties self.docListDA = UnoDataAware.attachListBox( - self, "selectedDoc", self.lstDocuments, False) + self, "SelectedDoc", self.lstDocuments, False) self.docListDA.disableObjects = \ [self.lnDocsInfo, self.btnRemoveDoc, self.lblDocTitle, self.txtDocTitle, self.lblDocInfo, self.txtDocInfo, @@ -378,7 +377,7 @@ class WWD_Startup(WWD_General): self.docListDA.updateUI() doc = CGDocument #dummy 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( doc, "cp_Title", self.txtDocTitle, True)) self.docAware.append(UnoDataAware.attachEditControl( @@ -387,13 +386,13 @@ class WWD_Startup(WWD_General): doc, "cp_Author", self.txtDocAuthor, True)) self.docAware.append(UnoDataAware.attachListBox( doc, "Exporter", self.lstDocTargetType, False)) - #page 3 : Layout - design = WWD_General.settings.cp_DefaultSession.cp_Design - #COMMENTED - #self.sda = SimpleDataAware.SimpleDataAware_unknown(design, DataAware.PropertyValue ("Layout", design), ilLayouts, DataAware.PropertyValue ("Selected", ilLayouts)) + #page 3 : Layout + 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 self.designAware.append(UnoDataAware.attachCheckBox( design, "cp_DisplayDescription", self.chbDocDesc, True)) @@ -414,7 +413,7 @@ class WWD_Startup(WWD_General): self.designAware.append(UnoDataAware.attachCheckBox( design, "cp_DisplaySize", self.chkDocSize, True)) self.designAware.append(RadioDataAware.attachRadioButtons( - WWD_General.settings.cp_DefaultSession.cp_Design, + self.settings.cp_DefaultSession.cp_Design, "cp_OptimizeDisplaySize", (self.optOptimize640x480, self.optOptimize800x600, self.optOptimize1024x768), True)) @@ -424,26 +423,26 @@ class WWD_Startup(WWD_General): a special method which will perform some display, background and Iconsets changes. ''' self.designAware.append(UnoDataAware.attachListBox( - WWD_General.settings.cp_DefaultSession.cp_Design, - "cp_Style", self.lstStyles, False)) + self.settings.cp_DefaultSession.cp_Design, + "Style", self.lstStyles, False)) #page 6 : site general props self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, + self.settings.cp_DefaultSession.cp_GeneralInfo, "cp_Title", self.txtSiteTitle, True)) self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, + self.settings.cp_DefaultSession.cp_GeneralInfo, "cp_Description", self.txtSiteDesc, True)) self.genAware.append(UnoDataAware.attachDateControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, + self.settings.cp_DefaultSession.cp_GeneralInfo, "cp_CreationDate", self.dateSiteCreated, False)) self.genAware.append(UnoDataAware.attachDateControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, + self.settings.cp_DefaultSession.cp_GeneralInfo, "cp_UpdateDate", self.dateSiteUpdate, False)) self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, + self.settings.cp_DefaultSession.cp_GeneralInfo, "cp_Email", self.txtEmail, True)) self.genAware.append(UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession.cp_GeneralInfo, + self.settings.cp_DefaultSession.cp_GeneralInfo, "cp_Copyright", self.txtCopyright, True)) #page 7 : publishing self.pubAware_( @@ -453,7 +452,7 @@ class WWD_Startup(WWD_General): self.pubAware_( ZIP_PUBLISHER, self.chkZip, self.txtZip, False) self.sessionNameDA = UnoDataAware.attachEditControl( - WWD_General.settings.cp_DefaultSession, "cp_Name", + self.settings.cp_DefaultSession, "cp_Name", self.cbSaveSettings, True) ''' @@ -465,7 +464,7 @@ class WWD_Startup(WWD_General): ''' 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.Inverse = True uda.disableObjects = [textbox] @@ -497,7 +496,7 @@ class WWD_Startup(WWD_General): chooses to cancel, the session is not loaded. ''' self.checkContent(session.cp_Content, task, xC) - WWD_General.settings.cp_DefaultSession = session + self.settings.cp_DefaultSession = session self.fillDocumentList(session.cp_Content) task.advance(True) self.mountList(session.cp_Design, self.designAware) @@ -538,8 +537,7 @@ class WWD_Startup(WWD_General): def fillDocumentList(self, root): ListModelBinder.fillList(self.lstDocuments, root.cp_Documents.childrenList, None) - #COMMENTED - #self.docsBinder.setListModel(root.cp_Documents) + self.docsBinder.setListModel(root.cp_Documents) self.disableDocUpDown() ''' @@ -550,7 +548,6 @@ class WWD_Startup(WWD_General): ''' def mountList(self, data, _list): - print ("DEBUG !!! mountList -- data: ", data) for i in _list: i.setDataObject(data, True) @@ -566,11 +563,6 @@ class WWD_Startup(WWD_General): @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): doc.validate(self.xMSF, task) return True @@ -636,27 +628,14 @@ class WWD_Startup(WWD_General): def disableDocUpDown(self): try: - if len(WWD_Startup.selectedDoc) == 0: - aux = 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 + self.btnDocUp.Model.Enabled = False if (len(self.selectedDoc) == 0) else (False if (self.selectedDoc[0] == 0) else True) + 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) except Exception: traceback.print_exc() def updateBackgroundText(self): bg = \ - WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage + self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage if bg is None or bg == "": bg = self.resources.resBackgroundNone else: @@ -665,11 +644,11 @@ class WWD_Startup(WWD_General): self.txtBackground.Model.Label = bg 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 == "": iconsetName = self.resources.resIconsetNone else: - IconSet = WWD_General.settings.cp_IconSets.getElement(iconset) + IconSet = self.settings.cp_IconSets.getElement(iconset) if IconSet is None: iconsetName = self.resources.resIconsetNone else: @@ -686,10 +665,9 @@ class WWD_Startup(WWD_General): def refreshStylePreview(self): try: - print ("WARNING !!! refreshStylePreview") self.updateBackgroundText() - self.stylePreview.refresh(WWD_General.settings.cp_DefaultSession.getStyle(), - WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage) + self.stylePreview.refresh(self.settings.cp_DefaultSession.getStyle(), + self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage) self.dpStylePreview.reload(self.xMSF) except Exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.py b/wizards/com/sun/star/wizards/web/export/AbstractExporter.py index 2dd45c2f7bce..32936f309577 100644 --- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.py +++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.py @@ -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() diff --git a/wizards/com/sun/star/wizards/web/export/CopyExporter.py b/wizards/com/sun/star/wizards/web/export/CopyExporter.py index 862c0455977a..73503aa3a75e 100644 --- a/wizards/com/sun/star/wizards/web/export/CopyExporter.py +++ b/wizards/com/sun/star/wizards/web/export/CopyExporter.py @@ -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) diff --git a/wizards/com/sun/star/wizards/web/export/FilterExporter.py b/wizards/com/sun/star/wizards/web/export/FilterExporter.py index 86266ab7a28c..6f4f7e79ed17 100644 --- a/wizards/com/sun/star/wizards/web/export/FilterExporter.py +++ b/wizards/com/sun/star/wizards/web/export/FilterExporter.py @@ -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 |