[Libreoffice-commits] core.git: 23 commits - officecfg/registry postprocess/Rdb_services.mk scp2/source wizards/com wizards/Module_wizards.mk wizards/Pyuno_commonwizards.mk wizards/Pyuno_web.mk
Javier Fernandez
jfernandez at igalia.com
Wed May 8 02:42:05 PDT 2013
officecfg/registry/data/org/openoffice/Office/WebWizard.xcu | 2
postprocess/Rdb_services.mk | 1
scp2/source/ooo/file_ooo.scp | 7
wizards/Module_wizards.mk | 1
wizards/Pyuno_commonwizards.mk | 12
wizards/Pyuno_web.mk | 3
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py | 4
wizards/com/sun/star/wizards/common/ConfigGroup.py | 9
wizards/com/sun/star/wizards/common/Configuration.py | 64 ++
wizards/com/sun/star/wizards/common/Desktop.py | 21
wizards/com/sun/star/wizards/common/FileAccess.py | 221 +++++++++
wizards/com/sun/star/wizards/common/ListModel.py | 39 +
wizards/com/sun/star/wizards/common/Properties.py | 3
wizards/com/sun/star/wizards/common/SystemDialog.py | 3
wizards/com/sun/star/wizards/common/UCB.py | 41 -
wizards/com/sun/star/wizards/common/XMLHelper.py | 4
wizards/com/sun/star/wizards/document/OfficeDocument.py | 5
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 4
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py | 4
wizards/com/sun/star/wizards/ui/DocumentPreview.py | 4
wizards/com/sun/star/wizards/ui/ImageList.py | 213 +++++---
wizards/com/sun/star/wizards/ui/PeerConfig.py | 10
wizards/com/sun/star/wizards/ui/UnoDialog.py | 78 +++
wizards/com/sun/star/wizards/ui/WizardDialog.py | 17
wizards/com/sun/star/wizards/ui/event/CommonListener.py | 82 +++
wizards/com/sun/star/wizards/ui/event/DataAware.py | 26 -
wizards/com/sun/star/wizards/ui/event/EventListenerList.py | 30 +
wizards/com/sun/star/wizards/ui/event/ListDataEvent.py | 38 +
wizards/com/sun/star/wizards/ui/event/ListDataListener.py | 33 +
wizards/com/sun/star/wizards/ui/event/ListModelBinder.py | 36 +
wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py | 33 +
wizards/com/sun/star/wizards/ui/event/UnoDataAware.py | 34 +
wizards/com/sun/star/wizards/web/BackgroundsDialog.py | 60 +-
wizards/com/sun/star/wizards/web/ExtensionVerifier.py | 4
wizards/com/sun/star/wizards/web/FTPDialog.py | 112 +---
wizards/com/sun/star/wizards/web/FTPDialogResources.py | 70 --
wizards/com/sun/star/wizards/web/IconsDialog.py | 33 -
wizards/com/sun/star/wizards/web/ImageListDialog.py | 5
wizards/com/sun/star/wizards/web/Process.py | 131 +++--
wizards/com/sun/star/wizards/web/ProcessErrorHandler.py | 2
wizards/com/sun/star/wizards/web/StylePreview.py | 3
wizards/com/sun/star/wizards/web/WWD_Events.py | 239 ++++------
wizards/com/sun/star/wizards/web/WWD_General.py | 34 -
wizards/com/sun/star/wizards/web/WWD_Startup.py | 158 ++----
wizards/com/sun/star/wizards/web/WebConfigSet.py | 108 +++-
wizards/com/sun/star/wizards/web/WebWizardDialog.py | 2
wizards/com/sun/star/wizards/web/WebWizardDialogResources.py | 4
wizards/com/sun/star/wizards/web/data/CGArgument.py | 4
wizards/com/sun/star/wizards/web/data/CGContent.py | 14
wizards/com/sun/star/wizards/web/data/CGDesign.py | 47 +
wizards/com/sun/star/wizards/web/data/CGDocument.py | 145 +++---
wizards/com/sun/star/wizards/web/data/CGExporter.py | 37 -
wizards/com/sun/star/wizards/web/data/CGGeneralInfo.py | 15
wizards/com/sun/star/wizards/web/data/CGIconSet.py | 10
wizards/com/sun/star/wizards/web/data/CGLayout.py | 27 -
wizards/com/sun/star/wizards/web/data/CGPublish.py | 22
wizards/com/sun/star/wizards/web/data/CGSession.py | 45 +
wizards/com/sun/star/wizards/web/data/CGSessionName.py | 9
wizards/com/sun/star/wizards/web/data/CGSettings.py | 92 +--
wizards/com/sun/star/wizards/web/data/CGStyle.py | 3
wizards/com/sun/star/wizards/web/export/AbstractExporter.py | 2
wizards/com/sun/star/wizards/web/export/ConfiguredExporter.py | 51 ++
wizards/com/sun/star/wizards/web/export/CopyExporter.py | 3
wizards/com/sun/star/wizards/web/export/FilterExporter.py | 55 ++
wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.py | 70 ++
wizards/com/sun/star/wizards/web/web.component | 7
66 files changed, 1826 insertions(+), 879 deletions(-)
New commits:
commit e07a65f92d788b702e687d8886ed5a78081f1b46
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Wed Mar 6 10:04:59 2013 +0000
PyWebWizard: Pack and register the Web wizard.
Change-Id: I8e43d228e842f24b054afc6bf59040667a6703d5
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index 2035446..375a7c4 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -173,6 +173,7 @@ $(eval $(call gb_Rdb_add_components,services,\
wizards/com/sun/star/wizards/fax/fax \
wizards/com/sun/star/wizards/letter/letter \
wizards/com/sun/star/wizards/agenda/agenda \
+ wizards/com/sun/star/wizards/web/web \
scripting/source/stringresource/stringresource \
scripting/source/vbaevents/vbaevents \
scripting/util/scriptframe \
diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
index 0579cff..dffee3e 100644
--- a/scp2/source/ooo/file_ooo.scp
+++ b/scp2/source/ooo/file_ooo.scp
@@ -387,6 +387,13 @@ File gid_File_Wizards_Agenda
Name = "Pyuno/agenda.filelist";
End
+File gid_File_Wizards_Web
+ Dir = FILELIST_DIR;
+ TXT_FILE_BODY;
+ Styles = (FILELIST);
+ Name = "Pyuno/web.filelist";
+End
+
File gid_File_Pymailmerge
Dir = FILELIST_DIR;
TXT_FILE_BODY;
diff --git a/wizards/Module_wizards.mk b/wizards/Module_wizards.mk
index 2d6e36f..5d6c594 100644
--- a/wizards/Module_wizards.mk
+++ b/wizards/Module_wizards.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Module_add_targets,wizards,\
Pyuno_fax \
Pyuno_letter \
Pyuno_agenda \
+ Pyuno_web \
Pyuno_commonwizards \
))
diff --git a/wizards/com/sun/star/wizards/web/web.component b/wizards/com/sun/star/wizards/web/web.component
index 27bde3a..64e325f 100644
--- a/wizards/com/sun/star/wizards/web/web.component
+++ b/wizards/com/sun/star/wizards/web/web.component
@@ -17,10 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
-<component loader="com.sun.star.loader.Java2"
+<component loader="com.sun.star.loader.Python"
xmlns="http://openoffice.org/2010/uno-components">
- <implementation
- name="com.sun.star.wizards.web.CallWizard$WizardImplementation">
- <service name="com.sun.star.wizards.web.CallWizard"/>
+ <implementation name="com.sun.star.wizards.web.CallWizard">
+ <service name="com.sun.star.task.Job"/>
</implementation>
</component>
commit 5069ab9f4715fc4ed21194b31e3c5d04f309fc5b
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Sat May 4 12:02:35 2013 +0000
PyWebWizard: Fixing bugs and implementation of mising features.
The default iconset value must be an "iconsetX" kind string.
Change-Id: I2f25f30e16c698d13202d1e6ad2711dfafff802c
diff --git a/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu b/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu
index a3717d3..9484f0a 100644
--- a/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu
@@ -1395,7 +1395,7 @@
<value/>
</prop>
<prop oor:name="IconSet">
- <value>0</value>
+ <value>iconset0</value>
</prop>
<prop oor:name="OptimizeDisplaySize">
<value>1</value>
commit c1330b9c8373c96c7677a2ac1928c976815bcff9
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Sat May 4 12:01:19 2013 +0000
PyWebWizard: Fixing bugs and implementation of mising features.
Formating, python style coding and debug output removal.
Change-Id: If5811473695f23b8b11dcd5a7d6e6775ca41ae88
diff --git a/wizards/com/sun/star/wizards/web/ExtensionVerifier.py b/wizards/com/sun/star/wizards/web/ExtensionVerifier.py
index 6f5fee0..524027b 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 bfe4286..e0044d9 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 6b6c8bb..84201d3 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 d131037..cefd608 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 c378b13..ded7466 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 58a4c4c..4a06ce6 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 6c5ccdf..f76ffc4 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 2dd45c2..32936f3 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 862c045..73503aa 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 86266ab..6f4f7e7 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
commit 9532335dd2c3f2bb9c3761bf8c4c879107f1538d
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Sat May 4 11:59:14 2013 +0000
PyWebWizard: Fixing bugs and implementation of mising features.
Properly terminate and dispose the Wizard dialogs.
Change-Id: Ia10419d3a7bbeb5ffd7dc1f6a5452eb9df906f63
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index 4dea434..243365a 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -26,6 +26,7 @@ from .CGAgenda import CGAgenda
from ..ui.PathSelection import PathSelection
from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware
+from ..ui.event.CommonListener import TerminateListenerProcAdapter
from ..common.NoValidPathException import NoValidPathException
from ..common.SystemDialog import SystemDialog
from ..common.Desktop import Desktop
@@ -84,9 +85,10 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.initializePaths()
# initialize the agenda template
+ self.terminateListener = TerminateListenerProcAdapter(self)
self.myAgendaDoc = AgendaDocument(
self.xMSF, self.agenda, self.resources,
- self.templateConsts, self)
+ self.templateConsts, self.terminateListener)
self.initializeTemplates()
self.myAgendaDoc.load(
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index 97197ab..eb6fb0a 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -123,7 +123,7 @@ class OfficeDocument(object):
if listener is not None:
xFF = xF.getFrames()
xFF.remove(xFrame)
- xF.addTerminateListener(TerminateListenerProcAdapter(listener))
+ xF.addTerminateListener(listener)
return xFrame
@@ -174,8 +174,7 @@ class OfficeDocument(object):
#and not part of the desktop tree.
#You are alone with him .-)
if listener is not None:
- Desktop.getDesktop(xMSF).addTerminateListener(
- TerminateListenerProcAdapter(listener))
+ Desktop.getDesktop(xMSF).addTerminateListener(listener)
return xFrame
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index ead90e1..9328757 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -23,6 +23,7 @@ from .FaxDocument import FaxDocument
from ..ui.PathSelection import PathSelection
from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware
+from ..ui.event.CommonListener import TerminateListenerProcAdapter
from ..text.TextFieldHandler import TextFieldHandler
from ..text.TextElement import TextElement
from ..common.Configuration import Configuration
@@ -81,7 +82,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.nMaxStep = 5
#instatiate The Document Frame for the Preview
- self.myFaxDoc = FaxDocument(xMSF, self)
+ self.terminateListener = TerminateListenerProcAdapter(self)
+ self.myFaxDoc = FaxDocument(xMSF, self.terminateListener)
#create the dialog:
self.drawNaviBar()
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 8cf7c59..1ff5f1c 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -28,6 +28,7 @@ from ..common.Desktop import Desktop
from ..ui.PathSelection import PathSelection
from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware
+from ..ui.event.CommonListener import TerminateListenerProcAdapter
from ..text.TextElement import TextElement
from ..text.TextFieldHandler import TextFieldHandler
from ..document.OfficeDocument import OfficeDocument
@@ -89,7 +90,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.nMaxStep = 6
#instatiate The Document Frame for the Preview
- self.myLetterDoc = LetterDocument(xMSF, self)
+ self.terminateListener = TerminateListenerProcAdapter(self)
+ self.myLetterDoc = LetterDocument(xMSF, self.terminateListener)
#create the dialog
self.drawNaviBar()
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 534122a..fc1ce41 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -65,6 +65,14 @@ class WizardDialog(UnoDialog2):
self.sMsgEndAutopilot = self.__oWizardResource.getResText(
UIConsts.RID_DB_COMMON + 33)
self.oRoadmap = None
+ self.terminateListener = None
+
+ def activate(self):
+ try:
+ self.xUnoDialog.toFront()
+ except Exception:
+ pass
+ # do nothing;
def itemStateChanged(self, itemEvent):
try:
@@ -445,8 +453,7 @@ class WizardDialog(UnoDialog2):
def removeTerminateListener(self):
if self.__bTerminateListenermustberemoved:
- Desktop.getDesktop(self.xMSF).removeTerminateListener( \
- TerminateListenerProcAdapter(self))
+ Desktop.getDesktop(self.xMSF).removeTerminateListener(self.terminateListener)
self.__bTerminateListenermustberemoved = False
'''
@@ -463,10 +470,16 @@ class WizardDialog(UnoDialog2):
except Exception:
traceback.print_exc()
+ def windowHidden():
+ self.cancelWizard_1()
+
def queryTermination(self):
self.activate()
raise TerminationVetoException()
+ def disposing(arg0):
+ self.cancelWizard_1()
+
def optCreateFromTemplateItemChanged(self):
self.bEditTemplate = False
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index 82959d1..6c5ccdf 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -31,6 +31,7 @@ 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.CommonListener import TerminateListenerProcAdapter
from ..ui.DocumentPreview import DocumentPreview
from ..ui.event.DataAware import DataAware
from ..ui.event.Task import Task
@@ -127,7 +128,8 @@ class WWD_Startup(WWD_General):
self.buildStepX()
self.xMSF = xmsf
xDesktop = Desktop.getDesktop(xmsf)
- self.myFrame = OfficeDocument.createNewFrame(xmsf, self)
+ self.terminateListener = TerminateListenerProcAdapter(self)
+ self.myFrame = OfficeDocument.createNewFrame(xmsf, self.terminateListener)
doc = OfficeDocument.createNewDocument(
self.myFrame, "swriter", False, True)
self.loadSettings(doc)
commit 9c54d77fffc9b6fda1af3020c5d1d2212b8e96c2
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Sat May 4 11:53:36 2013 +0000
PyWebWizard: Fixing bugs and implementation of mising features.
Using the com.sun.star.xml.dom.DocumentBuilder service to create the DOM.
Change-Id: I71232dda112f7049b901c3495d024334503e078d
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.py b/wizards/com/sun/star/wizards/common/XMLHelper.py
index 7ea3de3..0af198c 100644
--- a/wizards/com/sun/star/wizards/common/XMLHelper.py
+++ b/wizards/com/sun/star/wizards/common/XMLHelper.py
@@ -19,8 +19,8 @@ class XMLHelper:
@classmethod
def addElement(self, parent, name, attNames, attValues):
- doc = parent.ownerDocument
- if (doc == None):
+ doc = parent.getOwnerDocument()
+ if (doc is None):
doc = parent
e = doc.createElement(name)
for i in range(len(attNames)):
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.py b/wizards/com/sun/star/wizards/web/data/CGDocument.py
index 4221188..c359faf 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.py
@@ -23,6 +23,7 @@ from ...document.OfficeDocument import OfficeDocument
from ...common.Properties import Properties
from ...common.PropertyNames import PropertyNames
from ...common.FileAccess import FileAccess
+from ...common.XMLHelper import XMLHelper
from ..TypeDetection import *
from ...common.Desktop import Desktop
@@ -209,9 +210,21 @@ class CGDocument(ConfigGroup):
def createDOM(self, parent):
d = self.getSettings().cp_DefaultSession.cp_Design
exp = self.getSettings().cp_Exporters.getElement(self.cp_Exporter)
- '''return XMLHelper.addElement(parent, "document", ["title", "description", "author", "format", "filename", "create-date", "update-date", "pages", "size", "icon", "dir", "fn"], [d.cp_DisplayTitle ? self.cp_Title : "", d.cp_DisplayDescription ? self.cp_Description : "", d.cp_DisplayAuthor ? self.cp_Author : "", d.cp_DisplayFileFormat ? getTargetTypeName(exp) : "", d.cp_DisplayFilename ? self.localFilename : "", d.cp_DisplayCreateDate ? self.createDate() : "", d.cp_DisplayUpdateDate ? self.updateDate() : "", d.cp_DisplayPages and (self.pages > -1) ? "" + self.pages() : "", #TODO when do i calculate pages?
- d.cp_DisplaySize ? sizeKB() : "", #TODO when do i calculate size?
- d.cp_DisplayFormatIcon ? getIcon(exp) : "", self.dirName, self.urlFilename])'''
+ return XMLHelper.addElement(parent, "document",
+ ["title", "description", "author", "format", "filename",
+ "create-date", "update-date", "pages", "size", "icon",
+ "dir", "fn"],
+ [self.cp_Title if (d.cp_DisplayTitle) else "",
+ self.cp_Description if (d.cp_DisplayDescription) else "",
+ self.cp_Author if (d.cp_DisplayAuthor) else "",
+ self.getTargetTypeName(exp) if (d.cp_DisplayFileFormat) else "",
+ self.localFilename if (d.cp_DisplayFilename) else "",
+ self.createDate() if (d.cp_DisplayCreateDate) else "",
+ self.updateDate() if (d.cp_DisplayUpdateDate) else "",
+ "" + self.getPages() if (d.cp_DisplayPages and (self.pages > -1)) else "", #TODO when do i calculate pages?
+ self.sizeKB() if (d.cp_DisplaySize) else "", #TODO when do i calculate size?
+ self.getIcon(exp) if (d.cp_DisplayFormatIcon) else "",
+ self.dirName, self.urlFilename])
def updateDate(self):
if self.updatedDate is None:
diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.py b/wizards/com/sun/star/wizards/web/data/CGSession.py
index c0fdf00..bc1c984 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSession.py
+++ b/wizards/com/sun/star/wizards/web/data/CGSession.py
@@ -25,7 +25,7 @@ from .CGDesign import CGDesign
from .CGGeneralInfo import CGGeneralInfo
from .CGPublish import CGPublish
-from xml.dom.minidom import Document
+from com.sun.star.beans import StringPair
class CGSession(ConfigGroup):
@@ -40,14 +40,27 @@ class CGSession(ConfigGroup):
self.cp_Publishing = WebConfigSet(CGPublish)
self.valid = False
- def createDOM(self, parent):
- root = XMLHelper.addElement(
- parent, "session", ["name", "screen-size"],
- [self.cp_Name, self.getScreenSize()])
+ def createDOM(self, doc):
+ root = XMLHelper.addElement(doc, "session",
+ ["name", "screen-size"],
+ [self.cp_Name, self.getScreenSize()])
self.cp_GeneralInfo.createDOM(root)
self.cp_Content.createDOM(root)
return root
+ def serializeNode(self, node):
+ xBuffer = self.root.xmsf.createInstance("com.sun.star.io.Pipe")
+ xTextInputStream = self.root.xmsf.createInstance("com.sun.star.io.TextInputStream")
+ xSaxWriter = self.root.xmsf.createInstance( "com.sun.star.xml.sax.Writer" )
+ xSaxWriter.setOutputStream(xBuffer)
+ xTextInputStream.setInputStream(xBuffer)
+ node.serialize(xSaxWriter, tuple([StringPair()]))
+ result = ""
+ while (not xTextInputStream.isEOF()):
+ sLine = xTextInputStream.readLine()
+ if (not sLine == "") and (not sLine.startswith("<?xml")):
+ result = result + sLine + "\n"
+
def getScreenSize(self):
tmp_switch_var1 = self.cp_Design.cp_OptimizeDisplaySize
if tmp_switch_var1 == 0:
@@ -66,6 +79,7 @@ class CGSession(ConfigGroup):
return self.root.cp_Styles.getElement(self.cp_Design.cp_Style)
def createDOM1(self):
- doc = Document()
+ factory = self.root.xmsf.createInstance("com.sun.star.xml.dom.DocumentBuilder")
+ doc = factory.newDocument()
self.createDOM(doc)
return doc
commit ccd34249719614146e2f581e6c3826524745b425
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Sat May 4 11:43:28 2013 +0000
PyWebWizard: Fixing bugs and implementation of mising features.
CGXX classes must use instance attributes, instead of static.
Change-Id: Ic76a37b6530e19f6ffcd5ccd995880b3a8741363
diff --git a/wizards/com/sun/star/wizards/web/data/CGArgument.py b/wizards/com/sun/star/wizards/web/data/CGArgument.py
index ee532de..9a66144 100644
--- a/wizards/com/sun/star/wizards/web/data/CGArgument.py
+++ b/wizards/com/sun/star/wizards/web/data/CGArgument.py
@@ -18,4 +18,6 @@
from ...common.ConfigGroup import ConfigGroup
class CGArgument(ConfigGroup):
- cp_Value = str()
+
+ def __init__(self):
+ self.cp_Value = str()
diff --git a/wizards/com/sun/star/wizards/web/data/CGContent.py b/wizards/com/sun/star/wizards/web/data/CGContent.py
index 49e3aba..94a668a 100644
--- a/wizards/com/sun/star/wizards/web/data/CGContent.py
+++ b/wizards/com/sun/star/wizards/web/data/CGContent.py
@@ -22,13 +22,13 @@ from .CGDocument import CGDocument
class CGContent(ConfigGroup):
- cp_Index = -1
- dirName = str()
- cp_Name = str()
- cp_Description = str()
- #COMMENTED
- #cp_Contents = WebConfigSet(CGContent)
- cp_Documents = WebConfigSet(CGDocument())
+ def __init__(self):
+ self.cp_Index = -1
+ self.dirName = str()
+ self.cp_Name = str()
+ self.cp_Description = str()
+ self.cp_Documents = WebConfigSet(CGDocument)
+ self.cp_Contents = WebConfigSet(CGContent)
def createDOM(self, parent):
myElement = XMLHelper.addElement(
diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.py b/wizards/com/sun/star/wizards/web/data/CGDesign.py
index 4887bf7..7e0dff0 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDesign.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDesign.py
@@ -19,21 +19,22 @@ from ...common.ConfigGroup import ConfigGroup
class CGDesign(ConfigGroup):
- cp_Layout = str()
- cp_Style = str()
- cp_BackgroundImage = str()
- cp_IconSet = str()
- cp_DisplayTitle = bool()
- cp_DisplayDescription = bool()
- cp_DisplayAuthor = bool()
- cp_DisplayCreateDate = bool()
- cp_DisplayUpdateDate = bool()
- cp_DisplayFilename = bool()
- cp_DisplayFileFormat = bool()
- cp_DisplayFormatIcon = bool()
- cp_DisplayPages = bool()
- cp_DisplaySize = bool()
- cp_OptimizeDisplaySize = int()
+ def __init__(self):
+ self.cp_Layout = str()
+ self.cp_Style = str()
+ self.cp_BackgroundImage = str()
+ self.cp_IconSet = str()
+ self.cp_DisplayTitle = bool()
+ self.cp_DisplayDescription = bool()
+ self.cp_DisplayAuthor = bool()
+ self.cp_DisplayCreateDate = bool()
+ self.cp_DisplayUpdateDate = bool()
+ self.cp_DisplayFilename = bool()
+ self.cp_DisplayFileFormat = bool()
+ self.cp_DisplayFormatIcon = bool()
+ self.cp_DisplayPages = bool()
+ self.cp_DisplaySize = bool()
+ self.cp_OptimizeDisplaySize = int()
def createDOM(self, parent):
return XMLHelper.addElement(parent, "design", (0,), (0,))
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.py b/wizards/com/sun/star/wizards/web/data/CGDocument.py
index 9215b70..4221188 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.py
@@ -45,34 +45,38 @@ The same is valid for *description* and *author*.
'''
class CGDocument(ConfigGroup):
- cp_Exporter = None
- cp_Index = -1
+
PAGE_TYPE_PAGE = 1
PAGE_TYPE_SLIDE = 2
- cp_Title = ""
- cp_Description = ""
- cp_URL = ""
- cp_Author = ""
- localFilename = ""
- urlFilename = ""
- title = ""
- description = ""
- author = ""
- sizeBytes = -1
- pages = -1
- valid = False
- appType = None
-
- def __init__(self, url = "", xmsf = None, Task = None):
+
+ def __init__(self, url = "", xmsf = None, task = None):
+ self.cp_URL = ""
+ self.cp_Exporter = None
+ self.cp_Index = -1
+ self.cp_Title = ""
+ self.cp_Description = ""
+ self.cp_Author = ""
+ self.localFilename = ""
+ self.urlFilename = ""
+ self.title = ""
+ self.description = ""
+ self.author = ""
+ self.dirName = ""
+ self.createdDate = None
+ self.updatedDate = None
+ self.sizeBytes = -1
+ self.pages = -1
+ self.valid = False
+ self.appType = ""
if (xmsf is None):
return
- cp_URL = self.getSettings().getFileAccess(xmsf).getURL(url);
+ self.cp_URL = self.getSettings().getFileAccess(xmsf).getURL(url)
if (task is None):
task = Task("", "", 5)
- self.validate(xmsf, task);
+ self.validate(xmsf, task)
def getSettings(self):
- return ConfigGroup.root
+ return self.root
'''
the task will advance 5 times during validate.
@@ -82,15 +86,12 @@ class CGDocument(ConfigGroup):
'''
def validate(self, xmsf, task):
- print ("WARNING !!! VALIDATING DOCUMENT ....")
- if not self.root.getFileAccess(xmsf).exists(self.cp_URL, False):
+ if not self.getSettings().getFileAccess(xmsf).exists(self.cp_URL, False):
raise FileNotFoundException (
- "The given URL does not point to a file");
+ "The given URL does not point to a file")
- if self.root.getFileAccess(xmsf).isDirectory(self.cp_URL):
- raise IllegalArgumentException (
- "The given URL points to a directory");
- #create a TypeDetection service
+ if self.getSettings().getFileAccess(xmsf).isDirectory(self.cp_URL):
+ raise IllegalArgumentException ("The given URL points to a directory") #create a TypeDetection service
self.mediaDescriptor = OfficeDocument.getFileMediaDecriptor(
xmsf, self.cp_URL)
@@ -99,7 +100,7 @@ class CGDocument(ConfigGroup):
self.analyzeFileType(self.mediaDescriptor)
task.advance(True)
#2
- path = self.root.getFileAccess(xmsf).getPath(self.cp_URL, "")
+ path = self.getSettings().getFileAccess(xmsf).getPath(self.cp_URL, "")
self.localFilename = FileAccess.getFilename(path, separator)
'''
if the type is a star office convertible document
@@ -118,7 +119,6 @@ class CGDocument(ConfigGroup):
"MacroExecutionMode", NEVER_EXECUTE))
props.append(Properties.createProperty(
"UpdateDocMode", NO_UPDATE))
- print ("DEBUG !!! validate -- URL: ", self.cp_URL)
component = desktop.loadComponentFromURL(
self.cp_URL, "_default", 0, tuple(props))
xProps = component.DocumentProperties
@@ -127,41 +127,37 @@ class CGDocument(ConfigGroup):
#4
#now use the object to read some document properties.
if xProps is not None:
- title = xProps.Title
- description = xProps.Description
- author = xProps.Author
- createDate = xProps.CreationDate
- updateDate = xProps.ModificationDate
+ self.title = xProps.Title
+ self.description = xProps.Description
+ self.author = xProps.Author
+ self.createdDate = xProps.CreationDate
+ self.updatedDate = xProps.ModificationDate
else:
#get some information from OS.
- title = self.localFilename
- updateDate = \
+ self.title = self.localFilename
+ self.updatedDate = \
self.getSettings().getFileAccess(xmsf).getLastModified(self.cp_URL)
task.advance(True)
#5
valid = True
if self.cp_Title == "":
- cp_Title = self.title
+ self.cp_Title = self.title
if self.cp_Title == "":
- cp_Title = self.localFilename
+ self.cp_Title = self.localFilename
if self.cp_Description == "":
- cp_Description = self.description
+ self.cp_Description = self.description
if self.cp_Author == "":
- cp_Author = self.author
+ self.cp_Author = self.author
if self.cp_Exporter is None or self.cp_Exporter == "":
- print ("WARNING !!! settign exporter for key:", CGDocument.appType)
- exp = self.root.getExporters(CGDocument.appType)
- print ("WARNING !!! got N exporters:", len(exp))
- print ("WARNING !!! got exporter:", exp[0])
+ exp = self.getSettings().getExporters(self.appType)
self.cp_Exporter = \
- self.root.cp_Exporters.getKey(exp[0])
- print ("WARNING !!! exporter: ", self.cp_Exporter)
+ self.getSettings().cp_Exporters.getKey(exp[0])
'''
Analyzes a type-detection string, returned from the TypeDetection service,
@@ -169,28 +165,18 @@ class CGDocument(ConfigGroup):
'''
def analyzeFileType(self, mediaDesc):
- print ("DEBUG !!! analyzeFileType -- mediaDesc : ", mediaDesc)
if mediaDesc is None:
media = ""
else:
media = Properties.getPropertyValue(
self.mediaDescriptor, PropertyNames.PROPERTY_NAME)
- CGDocument.appType = self.getDocType(media)
- print ("DEBUG !!! analyzeFileType -- appType: ", CGDocument.appType)
- self.isSOOpenable = (CGDocument.appType == WRITER_DOC or CGDocument.appType == CALC_DOC or CGDocument.appType == IMPRESS_DOC or CGDocument.appType == DRAW_DOC) or CGDocument.appType == HTML_DOC
- if (self.isSOOpenable):
- print ("DEBUG !!! analyzeFileType -- isSOOpenable .")
- else:
- print ("DEBUG !!! analyzeFileType -- NOT isSOOpenable .")
+ self.appType = self.getDocType(media)
+ self.isSOOpenable = (self.appType == WRITER_DOC or self.appType == CALC_DOC or self.appType == IMPRESS_DOC or self.appType == DRAW_DOC) or self.appType == HTML_DOC
parts = media.split("_")
if len(parts) < 2:
self.isSODocument = False
else:
self.isSODocument = self.isSOOpenable and (parts[1].startswith("Star"))
- if (self.isSODocument):
- print ("DEBUG !!! analyzeFileType -- isSODocument .")
- else:
- print ("DEBUG !!! analyzeFileType -- NOT isSODocument .")
'''
@param media is the media description string returned by an UNO TypeDetection object.
@@ -199,7 +185,6 @@ class CGDocument(ConfigGroup):
'''
def getDocType(self, media):
- print ("DEBUG !!! getDocType -- media: ", media)
if media == "":
return NO_TYPE
elif media.startswith("generic_HTML"):
@@ -229,16 +214,16 @@ class CGDocument(ConfigGroup):
d.cp_DisplayFormatIcon ? getIcon(exp) : "", self.dirName, self.urlFilename])'''
def updateDate(self):
- if self.updateDate is None:
+ if self.updatedDate is None:
return ""
- return self.getSettings().formatter.formatCreated(self.updateDate)
+ return self.getSettings().formatter.formatCreated(self.updatedDate)
def createDate(self):
- if self.createDate is None:
+ if self.createdDate is None:
return ""
- return self.getSettings().formatter.formatCreated(self.createDate)
+ return self.getSettings().formatter.formatCreated(self.createdDate)
def sizeKB(self):
if self.sizeBytes == -1:
@@ -246,11 +231,11 @@ class CGDocument(ConfigGroup):
else:
return self.getSettings().formatter.formatFileSize(self.sizeBytes)
- def pages(self):
+ def getPages(self):
if self.pages == -1:
return ""
else:
- return pagesTemplate().replace("%NUMBER", "" + self.pages)
+ return self.pagesTemplate().replace("%NUMBER", "" + self.pages)
def pagesTemplate(self):
pagesType = \
@@ -272,11 +257,11 @@ class CGDocument(ConfigGroup):
def getIcon(self, exporter):
if exporter.cp_Icon == "":
- return getIcon(CGDocument.appType)
+ return self.getIcon1(self.appType)
else:
return exporter.cp_Icon
- def getIcon(self, appType):
+ def getIcon1(self, appType):
return appType + ".gif"
'''
@@ -295,7 +280,7 @@ class CGDocument(ConfigGroup):
'''
def setExporter(self, exporter_):
- exp = self.getSettings().getExporters(CGDocument.appType)[exporter_[0]]
+ exp = self.getSettings().getExporters(self.appType)[exporter_[0]]
self.cp_Exporter = self.getSettings().cp_Exporters.getKey(exp)
'''
@@ -308,7 +293,7 @@ class CGDocument(ConfigGroup):
return 0
exporter = self.getSettings().cp_Exporters.getElement(self.cp_Exporter)
- exporters = self.getSettings().getExporters(CGDocument.appType)
+ exporters = self.getSettings().getExporters(self.appType)
i = 0
while i < len(exporters):
if exporters[i] == exporter:
@@ -316,3 +301,6 @@ class CGDocument(ConfigGroup):
i += 1
return -1
+
+ def toString(self):
+ return self.localFilename
diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.py b/wizards/com/sun/star/wizards/web/data/CGExporter.py
index 0368d0e..daddbcb 100644
--- a/wizards/com/sun/star/wizards/web/data/CGExporter.py
+++ b/wizards/com/sun/star/wizards/web/data/CGExporter.py
@@ -20,21 +20,26 @@ from ...common.ConfigGroup import ConfigGroup
from .CGArgument import CGArgument
class CGExporter(ConfigGroup):
- cp_Index = -1
- cp_Name = str()
- cp_ExporterClass = str()
- cp_OwnDirectory = bool()
- cp_SupportsFilename = bool()
- cp_DefaultFilename = str()
- cp_Extension = str()
- cp_SupportedMimeTypes = str()
- cp_Icon = str()
- cp_TargetType = str()
- cp_Binary = bool()
- cp_PageType = int()
- targetTypeName = ""
- cp_Arguments = WebConfigSet(CGArgument)
+
+ def __init__(self):
+ self.cp_Index = -1
+ self.cp_Name = str()
+ self.cp_ExporterClass = str()
+ self.cp_OwnDirectory = bool()
+ self.cp_SupportsFilename = bool()
+ self.cp_DefaultFilename = str()
+ self.cp_Extension = str()
+ self.cp_SupportedMimeTypes = str()
+ self.cp_Icon = str()
+ self.cp_TargetType = str()
+ self.cp_Binary = bool()
+ self.cp_PageType = int()
+ self.targetTypeName = ""
+ self.cp_Arguments = WebConfigSet(CGArgument)
+
+ def toString(self):
+ return self.cp_Name
def supports(self, mime):
- return CGExporter.cp_SupportedMimeTypes == "" or \
- CGExporter.cp_SupportedMimeTypes.find(mime) > -1
+ return self.cp_SupportedMimeTypes == "" or \
+ self.cp_SupportedMimeTypes.find(mime) > -1
diff --git a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.py b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.py
index bdfdae6..4fcbd60 100644
--- a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.py
+++ b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.py
@@ -20,13 +20,14 @@ from ...common.XMLHelper import XMLHelper
class CGGeneralInfo(ConfigGroup):
- cp_Title = str()
- cp_Description = str()
- cp_Author = str()
- cp_CreationDate = int()
- cp_UpdateDate = int()
- cp_Email = str()
- cp_Copyright = str()
+ def __init__(self):
+ self.cp_Title = str()
+ self.cp_Description = str()
+ self.cp_Author = str()
+ self.cp_CreationDate = int()
+ self.cp_UpdateDate = int()
+ self.cp_Email = str()
+ self.cp_Copyright = str()
def createDOM(self, parent):
return XMLHelper.addElement(
diff --git a/wizards/com/sun/star/wizards/web/data/CGIconSet.py b/wizards/com/sun/star/wizards/web/data/CGIconSet.py
index 6f8c88f..c63f427 100644
--- a/wizards/com/sun/star/wizards/web/data/CGIconSet.py
+++ b/wizards/com/sun/star/wizards/web/data/CGIconSet.py
@@ -18,7 +18,9 @@
from ...common.ConfigGroup import ConfigGroup
class CGIconSet(ConfigGroup):
- cp_Index = -1
- cp_FNPrefix = str()
- cp_FNPostfix = str()
- cp_Name = str()
+
+ def __init__(self):
+ self.cp_Index = -1
+ self.cp_FNPrefix = str()
+ self.cp_FNPostfix = str()
+ self.cp_Name = str()
diff --git a/wizards/com/sun/star/wizards/web/data/CGLayout.py b/wizards/com/sun/star/wizards/web/data/CGLayout.py
index 5bc919b..99396a2 100644
--- a/wizards/com/sun/star/wizards/web/data/CGLayout.py
+++ b/wizards/com/sun/star/wizards/web/data/CGLayout.py
@@ -21,9 +21,10 @@ from ...ui.UIConsts import UIConsts
class CGLayout(ConfigGroup):
- cp_Index = -1
- cp_Name = str()
- cp_FSName = str()
+ def __init__(self):
+ self.cp_Index = -1
+ self.cp_Name = str()
+ self.cp_FSName = str()
def getSettings(self):
return self.root
diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.py b/wizards/com/sun/star/wizards/web/data/CGPublish.py
index 6a5c92f..47bd6e5 100644
--- a/wizards/com/sun/star/wizards/web/data/CGPublish.py
+++ b/wizards/com/sun/star/wizards/web/data/CGPublish.py
@@ -26,28 +26,24 @@ through such a CGPublish object.
class CGPublish(ConfigGroup):
- cp_Publish = bool()
- cp_URL = str()
- cp_Username = str()
- password = str()
- overwriteApproved = bool()
- url = str()
+ def __init__(self):
+ self.cp_Publish = bool()
+ self.cp_URL = str()
+ self.cp_Username = str()
+ self.password = str()
+ self.overwriteApproved = bool()
+ self.url = str()
def setURL(self, path):
try:
- self.cp_URL = (self.root).getFileAccess().getURL(path)
+ self.cp_URL = self.root.getFileAccess().getURL(path)
self.overwriteApproved = False
except Exception as ex:
ex.printStackTrace()
def getURL(self):
try:
- return (self.root).getFileAccess().getPath(self.cp_URL, None)
+ return self.root.getFileAccess().getPath(self.cp_URL, None)
except Exception as e:
e.printStackTrace()
return ""
-
- def ftpURL(self):
- pass
- #COMMENTED
- #return "ftp://" + self.cp_Username + ((self.password != None and self.password.length() > 0) ? ":" + self.password : "") + "@" + self.cp_URL.substring(7)
diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.py b/wizards/com/sun/star/wizards/web/data/CGSession.py
index a2c32d1..c0fdf00 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSession.py
+++ b/wizards/com/sun/star/wizards/web/data/CGSession.py
@@ -29,15 +29,16 @@ from xml.dom.minidom import Document
class CGSession(ConfigGroup):
- cp_Index = -1
- cp_InDirectory = str()
- cp_OutDirectory = str()
- cp_Name = str()
- cp_Content = CGContent()
- cp_Design = CGDesign()
- cp_GeneralInfo = CGGeneralInfo()
- cp_Publishing = WebConfigSet(CGPublish)
- valid = False
+ def __init__(self):
+ self.cp_Index = -1
+ self.cp_InDirectory = str()
+ self.cp_OutDirectory = str()
+ self.cp_Name = str()
+ self.cp_Content = CGContent()
+ self.cp_Design = CGDesign()
+ self.cp_GeneralInfo = CGGeneralInfo()
+ self.cp_Publishing = WebConfigSet(CGPublish)
+ self.valid = False
def createDOM(self, parent):
root = XMLHelper.addElement(
diff --git a/wizards/com/sun/star/wizards/web/data/CGSessionName.py b/wizards/com/sun/star/wizards/web/data/CGSessionName.py
index 283eaac..13a5267 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSessionName.py
+++ b/wizards/com/sun/star/wizards/web/data/CGSessionName.py
@@ -18,5 +18,10 @@
from ...common.ConfigGroup import ConfigGroup
class CGSessionName(ConfigGroup):
- cp_Index = -1
- cp_Name = str()
+
+ def __init__(self):
+ self.cp_Index = -1
+ self.cp_Name = str()
+
+ def toString(self):
+ return self.cp_Name
diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.py b/wizards/com/sun/star/wizards/web/data/CGSettings.py
index 5a8a85f..19e5e0e 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSettings.py
+++ b/wizards/com/sun/star/wizards/web/data/CGSettings.py
@@ -35,6 +35,7 @@ from .CGSession import CGSession
from com.sun.star.i18n.NumberFormatIndex import DATE_SYS_DMMMYYYY
from com.sun.star.i18n.NumberFormatIndex import NUMBER_1000DEC2
+from com.sun.star.util import DateTime
class CGSettings(ConfigGroup):
@@ -44,28 +45,27 @@ class CGSettings(ConfigGroup):
RESOURCE_UPDATED_TEMPLATE = 3
RESOURCE_SIZE_TEMPLATE = 4
- cp_WorkDir = str()
- cp_Exporters = WebConfigSet(CGExporter)
- cp_Layouts = WebConfigSet(CGLayout)
- cp_Styles = WebConfigSet(CGStyle)
- cp_IconSets = WebConfigSet(CGIconSet)
- cp_BackgroundImages = WebConfigSet(CGImage)
- cp_SavedSessions = WebConfigSet(CGSessionName)
- cp_Filters = WebConfigSet(CGFilter)
- savedSessions = WebConfigSet(CGSessionName)
- cp_DefaultSession = CGSession()
- cp_LastSavedSession = str()
- fileAccess = None
-
def __init__(self, xmsf_, resources_, document):
+ self.cp_WorkDir = str()
+ self.cp_Exporters = WebConfigSet(CGExporter)
+ self.cp_Layouts = WebConfigSet(CGLayout)
+ self.cp_Styles = WebConfigSet(CGStyle)
+ self.cp_IconSets = WebConfigSet(CGIconSet)
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list