[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com
Xisco Fauli
xfauli at kemper.freedesktop.org
Tue Aug 9 17:23:47 PDT 2011
wizards/com/sun/star/wizards/common/ConfigGroup.py | 1
wizards/com/sun/star/wizards/common/ConfigNode.py | 2
wizards/com/sun/star/wizards/common/ConfigSet.py | 26 -
wizards/com/sun/star/wizards/common/FileAccess.py | 2
wizards/com/sun/star/wizards/common/SystemDialog.py | 4
wizards/com/sun/star/wizards/document/OfficeDocument.py | 13
wizards/com/sun/star/wizards/ui/WizardDialog.py | 26 -
wizards/com/sun/star/wizards/ui/event/DataAware.py | 28 +
wizards/com/sun/star/wizards/ui/event/UnoDataAware.py | 2
wizards/com/sun/star/wizards/web/WWD_Events.py | 273 +++++++++-----
wizards/com/sun/star/wizards/web/WWD_General.py | 63 +--
wizards/com/sun/star/wizards/web/WWD_Startup.py | 299 ++++++++--------
wizards/com/sun/star/wizards/web/data/CGDocument.py | 124 +++---
wizards/com/sun/star/wizards/web/data/CGExporter.py | 4
wizards/com/sun/star/wizards/web/data/CGSettings.py | 35 -
15 files changed, 511 insertions(+), 391 deletions(-)
New commits:
commit cb87971556fd133b66e83fe7521d4afedea1e8bd
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Aug 10 02:23:02 2011 +0200
Implement add button
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py
index d7a24ad..2e0fd94 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.py
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py
@@ -28,6 +28,7 @@ class ConfigGroup(ConfigNode):
propertyName = field[len(prefix):]
child = getattr(self, field)
if isinstance(child, ConfigNode):
+ child.root = self.root
child.readConfiguration(configView.getByName(propertyName),
prefix)
else:
diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.py b/wizards/com/sun/star/wizards/common/ConfigNode.py
index 0dc38c0..892e6e3 100644
--- a/wizards/com/sun/star/wizards/common/ConfigNode.py
+++ b/wizards/com/sun/star/wizards/common/ConfigNode.py
@@ -2,6 +2,8 @@ from abc import ABCMeta, abstractmethod
class ConfigNode(object):
+ root = None
+
@abstractmethod
def readConfiguration(self, configurationView, param):
pass
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py
index 7851fea..26b051a 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.py
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.py
@@ -70,6 +70,7 @@ class ConfigSet(ConfigNode):
for i in names:
try:
child = type(self.childClass)()
+ child.root = self.root
child.readConfiguration(
configurationView.getByName(i), param)
self.add(i, child)
@@ -118,27 +119,13 @@ class ConfigSet(ConfigNode):
i += 1
return parent
- def getKey(self, object):
- i = self.childrenMap.entrySet().iterator()
- while i.hasNext():
- me = i.next()
- if me.getValue() == object:
- return me.getKey()
+ def getKey(self, _object):
+ for k,v in self.childrenMap.items():
+ if v == _object:
+ return k
return None
- def getKey(self, i):
- c = 0
- while i > -1:
- if getElementAt(c) != None:
- i -= 1
-
- c += 1
- if c == 0:
- return None
- else:
- return getKey(getElementAt(c - 1))
-
def getElementAt(self, i):
return self.childrenList[i]
@@ -148,9 +135,6 @@ class ConfigSet(ConfigNode):
def getSize(self):
return len(self.childrenList)
- def keys(self):
- return self.childrenMap.keySet()
-
def getIndexOf(self, item):
return self.childrenList.index(item)
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 5c288a7..64c78ca 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -468,7 +468,7 @@ class FileAccess(object):
except Exception:
traceback.print_exc()
- #return defe
+ return defe
'''
@author rpiterman
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index 54febcb..a04c027 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -25,8 +25,6 @@ class SystemDialog(object):
self.xMSF = xMSF
self.systemDialog = xMSF.createInstance(ServiceName)
self.xStringSubstitution = self.createStringSubstitution(xMSF)
- if self.systemDialog != None:
- self.systemDialog.initialize(Type)
except Exception, exception:
traceback.print_exc()
@@ -105,7 +103,7 @@ class SystemDialog(object):
def callOpenDialog(self, multiSelect, displayDirectory):
try:
self.systemDialog.setMultiSelectionMode(multiSelect)
- self.systemDialog.setDisplayDirectory(subst(displayDirectory))
+ self.systemDialog.setDisplayDirectory(self.subst(displayDirectory))
if self.execute(self.systemDialog):
return self.systemDialog.getFiles()
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index 887ff4a..92adaf7 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -242,19 +242,20 @@ class OfficeDocument(object):
except Exception, e:
traceback.print_exc()
+ @classmethod
def getFileMediaDecriptor(self, xmsf, url):
typeDetect = xmsf.createInstance(
"com.sun.star.document.TypeDetection")
mediaDescr = range(1)
- mediaDescr[0][0] = uno.createUnoStruct(
+ mediaDescr[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue')
- mediaDescr[0][0].Name = "URL"
- mediaDescr[0][0].Value = url
- Type = typeDetect.queryTypeByDescriptor(mediaDescr, True)
- if Type.equals(""):
+ mediaDescr[0].Name = "URL"
+ mediaDescr[0].Value = url
+ Type = typeDetect.queryTypeByDescriptor(tuple(mediaDescr), True)[0]
+ if Type == "":
return None
else:
- return typeDetect.getByName(type)
+ return typeDetect.getByName(Type)
@classmethod
def getTypeMediaDescriptor(self, xmsf, type):
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 8d5907d..b2a687d 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -289,10 +289,14 @@ class WizardDialog(UnoDialog2):
for index, item in enumerate(items):
self.insertRoadmapItem(index, enabled[index], item, index + 1)
- def setStepEnabled(self, _nStep, bEnabled, enableNextButton):
- setStepEnabled(_nStep, bEnabled)
- if self.getNextAvailableStep() > 0:
- self.enableNextButton(bEnabled)
+ def setStepEnabled(self, _nStep, bEnabled, enableNextButton=None):
+ xRoadmapItem = self.getRoadmapItemByID(_nStep)
+ if xRoadmapItem is not None:
+ Helper.setUnoPropertyValue(xRoadmapItem,
+ PropertyNames.PROPERTY_ENABLED, bEnabled)
+ if enableNextButton is not None:
+ if self.getNextAvailableStep() > 0:
+ self.enableNextButton(bEnabled)
def enableNavigationButtons(
self, _bEnableBack, _bEnableNext, _bEnableFinish):
@@ -312,18 +316,10 @@ class WizardDialog(UnoDialog2):
self.setControlProperty("btnWizardFinish",
PropertyNames.PROPERTY_ENABLED, enabled)
- def setStepEnabled(self, _nStep, bEnabled):
- xRoadmapItem = getRoadmapItemByID(_nStep)
- if xRoadmapItem != None:
- Helper.setUnoPropertyValue(xRoadmapItem,
- PropertyNames.PROPERTY_ENABLED, bEnabled)
-
def enablefromStep(self, _iStep, _bDoEnable):
if _iStep <= self.nMaxStep:
- i = _iStep
- while i <= self.nMaxStep:
- setStepEnabled(i, _bDoEnable)
- i += 1
+ for i in xrange(_iStep, self.nMaxStep):
+ self.setStepEnabled(i, _bDoEnable)
enableFinishButton(_bDoEnable)
if not _bDoEnable:
enableNextButton(_iStep > getCurrentStep() + 1)
@@ -334,7 +330,7 @@ class WizardDialog(UnoDialog2):
try:
xRoadmapItem = self.getRoadmapItemByID(_nStep)
# Todo: In this case an exception should be thrown
- if (xRoadmapItem == None):
+ if xRoadmapItem is None:
return False
bIsEnabled = bool(Helper.getUnoPropertyValue(xRoadmapItem,
PropertyNames.PROPERTY_ENABLED))
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index d2e4046..5975dca 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -30,7 +30,7 @@ class DataAware(object):
def __init__(self, dataObject_, field_):
self._dataObject = dataObject_
- self._field = field_
+ self._field = field_
def enableControls(self, value):
pass
@@ -69,6 +69,22 @@ class DataAware(object):
self.enableControls(data)
'''
+ sets a new data object. Optionally
+ update the UI.
+ @param obj the new data object.
+ @param updateUI if true updateUI() will be called.
+ '''
+
+ def setDataObject(self, obj, updateUI):
+ if obj is not None and not isinstance(obj, type(self._field)):
+ return
+
+ self._dataObject = obj
+
+ if updateUI:
+ self.updateUI()
+
+ '''
updates the DataObject according to
the current state of the UI control.
'''
@@ -85,3 +101,13 @@ class DataAware(object):
self.enableControls(ui)
except Exception:
traceback.print_exc()
+ '''
+ given a collection containing DataAware objects,
+ calls updateUI() on each memebr of the collection.
+ @param dataAwares a collection containing DataAware objects.
+ '''
+
+ @classmethod
+ def updateUIs(self, dataAwares):
+ for i in dataAwares:
+ i.updateUI()
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index b0b9c07..972f738 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -26,7 +26,7 @@ class UnoDataAware(DataAware):
def enableControls(self, value):
for i in self.disableObjects:
Helper.setUnoPropertyValue(
- i.Model, PropertyNames.PROPERTY_ENABLED, value)
+ i.Model, PropertyNames.PROPERTY_ENABLED, bool(value))
def setToUI(self, value):
if self.isShort:
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index 447a0b6..9623d9a 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -1,6 +1,6 @@
import traceback
from common.Desktop import Desktop
-from WWD_Startup import WWD_Startup
+from WWD_Startup import *
'''
This class implements the ui-events of the
@@ -13,8 +13,6 @@ session methods.
'''
class WWD_Events(WWD_Startup):
- EMPTY_SHORT_ARRAY = range(0)
- EMPTY_STRING_ARRAY = range(0)
'''
He - my constructor !
@@ -50,12 +48,12 @@ class WWD_Events(WWD_Startup):
def enterStep(self, old, newStep):
if (old == 1):
sessionToLoad = ""
- s = Helper.getUnoPropertyValue(lstLoadSettings.Model, "SelectedItems")
+ s = Helper.getUnoPropertyValue(lstLoadWWD_Startup.settings.Model, "SelectedItems")
if s.length == 0 or s[0] == 0:
sessionToLoad = ""
else:
sessionToLoad = \
- settings.cp_SavedSessions.getElementAt(s[0]).cp_Name
+ WWD_Startup.settings.cp_SavedSessions.getElementAt(s[0]).cp_Name
if not sessionToLoad.equals(self.currentSession):
loadSession(sessionToLoad)
@@ -81,10 +79,10 @@ class WWD_Events(WWD_Startup):
def loadSession(self, sessionToLoad):
try:
sd = self.getStatusDialog()
- task = Task("LoadDocs", "", 10)
+ #task = Task("LoadDocs", "", 10)
sd.execute(this, task, resources.resLoadingSession)
- task.start()
- setSelectedDoc(WWD_Events.EMPTY_SHORT_ARRAY)
+ #task.start()
+ self.setSelectedDoc(WWD_Events.EMPTY_SHORT_ARRAY)
Helper.setUnoPropertyValue(
lstDocuments.Model, "SelectedItems", WWD_Events.EMPTY_SHORT_ARRAY)
Helper.setUnoPropertyValue(
@@ -97,20 +95,20 @@ class WWD_Events(WWD_Startup):
xMSF, CONFIG_PATH + "/SavedSessions", False)
view = Configuration.getNode(sessionToLoad, view)
- session = CGSession.CGSession()
- session.setRoot(settings)
+ session = CGSession()
+ session.root = settings
session.readConfiguration(view, CONFIG_READ_PARAM)
- task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7)
- task.advance(True)
- if sessionToLoad.equals(""):
+ #task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7)
+ #task.advance(True)
+ if sessionToLoad == "":
setSaveSessionName(session)
mount(session, task, False, sd.xControl)
checkSteps()
self.currentSession = sessionToLoad
- while task.getStatus() <= task.getMax():
+ '''while task.getStatus() <= task.getMax():
task.advance(False)
- task.removeTaskListener(sd)
+ task.removeTaskListener(sd)'''
except Exception, ex:
unexpectedError(ex)
@@ -127,7 +125,7 @@ class WWD_Events(WWD_Startup):
def delSession(self):
selected = Helper.getUnoPropertyValue(
- lstLoadSettings.Model, "SelectedItems")
+ lstLoadWWD_Startup.settings.Model, "SelectedItems")
if selected.length == 0:
return
@@ -139,16 +137,16 @@ class WWD_Events(WWD_Startup):
ErrorHandler.ERROR_QUESTION_NO)
if confirm:
try:
- name = settings.cp_SavedSessions.getKey(selected[0])
+ name = WWD_Startup.settings.cp_SavedSessions.getKey(selected[0])
# first delete the session from the registry/configuration.
Configuration.removeNode(
self.xMSF, CONFIG_PATH + "/SavedSessions", name)
- # then delete settings.cp_SavedSessions
- settings.cp_SavedSessions.remove(selected[0])
- settings.savedSessions.remove(selected[0] - 1)
+ # then delete WWD_Startup.settings.cp_SavedSessions
+ WWD_Startup.settings.cp_SavedSessions.remove(selected[0])
+ WWD_Startup.settings.savedSessions.remove(selected[0] - 1)
nextSelected = [0]
# We try to select the same item index again, if possible
- if settings.cp_SavedSessions.getSize() > selected[0]:
+ if WWD_Startup.settings.cp_SavedSessions.getSize() > selected[0]:
nextSelected[0] = selected[0]
else:
# this will always be available because
@@ -163,7 +161,7 @@ class WWD_Events(WWD_Startup):
# select...
Helper.setUnoPropertyValue(
- lstLoadSettings.Model, "SelectedItems", nextSelected)
+ lstLoadWWD_Startup.settings.Model, "SelectedItems", nextSelected)
except Exception, ex:
ex.printStackTrace()
@@ -184,20 +182,18 @@ class WWD_Events(WWD_Startup):
'''
def setSelectedDoc(self, s):
- oldDoc = getDoc(selectedDoc)
- doc = getDoc(s)
- if doc == None:
- fillExportList(WWD_Events.EMPTY_STRING_ARRAY)
+ oldDoc = self.getDoc([WWD_Startup.selectedDoc])
+ doc = self.getDoc(s)
+ if doc is None:
+ self.fillExportList([])
#I try to avoid refreshing the export list if
#the same type of document is chosen.
- elif oldDoc == None or (not oldDoc.appType.equals(doc.appType)):
- fillExportList(settings.getExporters(doc.appType))
- else:
-
- # do nothing
- selectedDoc = s
- mount(doc, docAware)
- disableDocUpDown()
+ elif oldDoc is None or oldDoc.appType != doc.appType:
+ self.fillExportList(WWD_Startup.settings.getExporters(doc.appType))
+ # do nothing
+ WWD_Startup.selectedDoc = s
+ self.mountList(doc, self.docAware)
+ self.disableDocUpDown()
'''
The user clicks the "Add" button.
@@ -207,49 +203,51 @@ class WWD_Events(WWD_Startup):
'''
def addDocument(self):
- files = getDocAddDialog().callOpenDialog(
- True, settings.cp_DefaultSession.cp_InDirectory)
- if files is None:
- return
+ try:
+ files = self.getDocAddDialog().callOpenDialog(
+ True, WWD_Startup.settings.cp_DefaultSession.cp_InDirectory)
+ if files is None:
+ return
- task = Task.Task_unknown("", "", files.length * 5)
- '''
- If more than a certain number
- of documents have been added,
- open the status dialog.
- '''
- if (files.length > MIN_ADD_FILES_FOR_DIALOG):
- sd = getStatusDialog()
- sd.setLabel(resources.resValidatingDocuments)
- sd.execute(this, task, resources.prodName)
- # new LoadDocs( sd.xControl, files, task )
- oLoadDocs = LoadDocs.LoadDocs_unknown(self.xControl, files, task)
- oLoadDocs.loadDocuments()
- task.removeTaskListener(sd)
- else:
+ task = None #Task("", "", len(files) * 5)
'''
- When adding a single document, do not use a
- status dialog...
+ If more than a certain number
+ of documents have been added,
+ open the status dialog.
'''
- oLoadDocs = LoadDocs.LoadDocs_unknown(self.xControl, files, task)
- oLoadDocs.loadDocuments()
+ if (len(files) > MIN_ADD_FILES_FOR_DIALOG):
+ sd = self.getStatusDialog()
+ sd.setLabel(resources.resValidatingDocuments)
+ sd.execute(this, task, resources.prodName)
+ oLoadDocs = self.LoadDocs(self.xMSF, self.xUnoDialog, files, self)
+ oLoadDocs.loadDocuments()
+ #task.removeTaskListener(sd)
+ else:
+ '''
+ When adding a single document, do not use a
+ status dialog...
+ '''
+ oLoadDocs = self.LoadDocs(self.xMSF, self.xUnoDialog, files, self)
+ oLoadDocs.loadDocuments()
+ except Exception:
+ traceback.print_exc()
'''
The user clicked delete.
'''
def removeDocument(self):
- if selectedDoc.length == 0:
+ if WWD_Startup.selectedDoc.length == 0:
return
- settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
- selectedDoc[0])
+ WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
+ WWD_Startup.selectedDoc[0])
# update the selected document
- while selectedDoc[0] >= getDocsCount():
- selectedDoc[0] -= 1
+ while WWD_Startup.selectedDoc[0] >= getDocsCount():
+ WWD_Startup.selectedDoc[0] -= 1
# if there are no documents...
- if selectedDoc[0] == -1:
- selectedDoc = WWD_Events.EMPTY_SHORT_ARRAY
+ if WWD_Startup.selectedDoc[0] == -1:
+ WWD_Startup.selectedDoc = WWD_Events.EMPTY_SHORT_ARRAY
# update the list to show the right selection.
docListDA.updateUI()
@@ -262,28 +260,28 @@ class WWD_Events(WWD_Startup):
'''
def docUp(self):
- doc = settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(
- selectedDoc[0])
- settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
- selectedDoc[0])
- settings.cp_DefaultSession.cp_Content.cp_Documents.add(
- selectedDoc[0] - 1, doc)
+ 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()
- disableDocUpDown()
+ self.disableDocUpDown()
'''
doc down
'''
def docDown(self):
- doc = settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(
- selectedDoc[0])
- settings.cp_DefaultSession.cp_Content.cp_Documents.remove(
- selectedDoc[0])
- settings.cp_DefaultSession.cp_Content.cp_Documents.add(
- (selectedDoc[0] + 1), doc)
+ 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()
- disableDocUpDown()
+ self.disableDocUpDown()
'''
**************
@@ -300,11 +298,11 @@ class WWD_Events(WWD_Startup):
setEnabled(btnBackgrounds, False)
if self.bgDialog == None:
self.bgDialog = BackgroundsDialog(
- self.xMSF, settings.cp_BackgroundImages, resources)
+ self.xMSF, WWD_Startup.settings.cp_BackgroundImages, resources)
self.bgDialog.createWindowPeer(xControl.Peer)
self.bgDialog.setSelected(
- settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
+ WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
i = self.bgDialog.executeDialog(WWD_Events.this)
if i == 1:
#ok
@@ -322,7 +320,7 @@ class WWD_Events(WWD_Startup):
if background == None:
background = ""
- settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = background
+ WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = background
refreshStylePreview()
'''
@@ -334,11 +332,11 @@ class WWD_Events(WWD_Startup):
setEnabled(btnIconSets, False)
if self.iconsDialog == None:
self.iconsDialog = IconsDialog(
- self.xMSF, settings.cp_IconSets, resources)
+ self.xMSF, WWD_Startup.settings.cp_IconSets, resources)
self.iconsDialog.createWindowPeer(xControl.Peer)
self.iconsDialog.setIconset(
- settings.cp_DefaultSession.cp_Design.cp_IconSet)
+ WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet)
i = self.iconsDialog.executeDialog(WWD_Events.this)
if i == 1:
#ok
@@ -353,7 +351,7 @@ class WWD_Events(WWD_Startup):
'''
def setIconset(self, icon):
- settings.cp_DefaultSession.cp_Design.cp_IconSet = icon
+ WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet = icon
updateIconsetText()
'''
@@ -395,7 +393,7 @@ class WWD_Events(WWD_Startup):
def setPublishLocalDir(self):
dir = showFolderDialog(
"Local destination directory", "",
- settings.cp_DefaultSession.cp_OutDirectory)
+ WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory)
#if ok was pressed...
setPublishUrl(LOCAL_PUBLISHER, dir, 0)
@@ -430,7 +428,7 @@ class WWD_Events(WWD_Startup):
def setZipFilename(self):
sd = getZipDialog()
zipFile = sd.callStoreDialog(
- settings.cp_DefaultSession.cp_OutDirectory,
+ WWD_Startup.settings.cp_DefaultSession.cp_OutDirectory,
resources.resDefaultArchiveFilename)
setPublishUrl(ZIP_PUBLISHER, zipFile, 4)
getPublisher
@@ -620,7 +618,7 @@ class WWD_Events(WWD_Startup):
node = None
name = getSessionSaveName()
#set documents index field.
- docs = settings.cp_DefaultSession.cp_Content.cp_Documents
+ docs = WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents
i = 0
while i < docs.getSize():
(docs.getElementAt(i)).cp_Index = i
@@ -642,32 +640,32 @@ class WWD_Events(WWD_Startup):
except NoSuchElementException, nsex:
traceb
- settings.cp_DefaultSession.cp_Index = 0;
+ WWD_Startup.settings.cp_DefaultSession.cp_Index = 0;
node = Configuration.addConfigNode(conf, name)
- settings.cp_DefaultSession.cp_Name = name;
- settings.cp_DefaultSession.writeConfiguration(
+ WWD_Startup.settings.cp_DefaultSession.cp_Name = name;
+ WWD_Startup.settings.cp_DefaultSession.writeConfiguration(
node, CONFIG_READ_PARAM)
- settings.cp_SavedSessions.reindexSet(conf, name, "Index")
+ WWD_Startup.settings.cp_SavedSessions.reindexSet(conf, name, "Index")
Configuration.commit(conf)
# now I reload the sessions to actualize the list/combo
# boxes load/save sessions.
- settings.cp_SavedSessions.clear()
+ WWD_Startup.settings.cp_SavedSessions.clear()
confView = Configuration.getConfigurationRoot(
self.xMSF, CONFIG_PATH + "/SavedSessions", False)
- settings.cp_SavedSessions.readConfiguration(
+ WWD_Startup.settings.cp_SavedSessions.readConfiguration(
confView, CONFIG_READ_PARAM)
- settings.cp_LastSavedSession = name;
+ WWD_Startup.settings.cp_LastSavedSession = name;
self.currentSession = name
# now save the name of the last saved session...
- settings.cp_LastSavedSession = name;
+ WWD_Startup.settings.cp_LastSavedSession = name;
# TODO add the <none> session...
prepareSessionLists()
ListModelBinder.fillList(
- lstLoadSettings, settings.cp_SavedSessions.items(), None)
+ lstLoadSettings, WWD_Startup.settings.cp_SavedSessions.items(), None)
ListModelBinder.fillComboBox(
- cbSaveSettings, settings.savedSessions.items(), None)
+ cbSaveSettings, WWD_Startup.settings.savedSessions.items(), None)
selectSession()
- self.currentSession = settings.cp_LastSavedSession
+ self.currentSession = WWD_Startup.settings.cp_LastSavedSession
return True
except Exception, ex:
ex.printStackTrace()
@@ -787,12 +785,12 @@ class WWD_Events(WWD_Startup):
return
else:
- settings.cp_LastSavedSession = ""
+ WWD_Startup.settings.cp_LastSavedSession = ""
try:
conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, True)
Configuration.set(
- settings.cp_LastSavedSession, "LastSavedSession", conf)
+ WWD_Startup.settings.cp_LastSavedSession, "LastSavedSession", conf)
Configuration.commit(conf)
except Exception, ex:
ex.printStackTrace()
@@ -852,3 +850,78 @@ class WWD_Events(WWD_Startup):
except Exception, ex:
traceback.print_exc()
+
+ class LoadDocs(object):
+
+ def __init__(self,xmsf, xC_, files_, parent_):
+ self.xMSF = xmsf
+ self.xC = xC_
+ self.files = files_
+ self.parent = parent_
+
+ def loadDocuments(self):
+ if len(WWD_Startup.selectedDoc) > 0:
+ offset = WWD_Startup.selectedDoc[0] + 1
+ else:
+ offset = WWD_General.getDocsCount()
+
+ '''
+ if the user chose one file, the list starts at 0,
+ if he chose more than one, the first entry is a directory name,
+ all the others are filenames.
+ '''
+ if len(self.files) > 1:
+ start = 1
+ else:
+ start = 0
+
+ #Number of documents failed to validate.
+ failed = 0
+
+ # store the directory
+ if start == 1:
+ WWD_General.settings.cp_DefaultSession.cp_InDirectory = files[0]
+ else:
+ WWD_General.settings.cp_DefaultSession.cp_InDirectory = \
+ FileAccess.getParentDir(self.files[0])
+
+ '''
+ Here i go through each file, and validate it.
+ If its ok, I add it to the ListModel/ConfigSet
+ '''
+
+ for i in xrange(start, len(self.files)):
+ doc = CGDocument()
+
+ if start == 0:
+ doc.cp_URL = self.files[i]
+ else:
+ doc.cp_URL = FileAccess.connectURLs(files[0], files[i])
+
+ '''
+ so - i check each document and if it is ok I add it.
+ The failed variable is used only to calculate the place to add -
+ Error reporting to the user is (or should (-: )done in the checkDocument(...) method
+ '''
+ if WWD_Startup.checkDocument(self.xMSF, doc, None, self.xC):
+ WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.add(offset + i - failed - start, doc)
+ else:
+ failed += 1
+
+ # if any documents where added,
+ # set the first one to be the current-selected document.
+ if len(self.files) > start + failed:
+ self.parent.setSelectedDoc([offset])
+
+ # update the ui...
+ self.parent.docListDA.updateUI();
+ # this enables/disables the next steps.
+ # when no documents in the list, all next steps are disabled
+ self.parent.checkSteps()
+ '''
+ a small insurance that the status dialog will
+ really close...
+ '''
+
+ #while (self.task.getStatus() < self.task.getMax()):
+ # self.task.advance(false)
diff --git a/wizards/com/sun/star/wizards/web/WWD_General.py b/wizards/com/sun/star/wizards/web/WWD_General.py
index f5bb8e5..c3df658 100644
--- a/wizards/com/sun/star/wizards/web/WWD_General.py
+++ b/wizards/com/sun/star/wizards/web/WWD_General.py
@@ -1,5 +1,6 @@
from WebWizardDialog import *
from common.SystemDialog import SystemDialog
+from ui.event.ListModelBinder import ListModelBinder
'''
@author rpiterman
@@ -9,9 +10,7 @@ This class implements general methods, used by different sub-classes
class WWD_General(WebWizardDialog):
- '''
- @param xmsf
- '''
+ settings = None
def __init__(self, xmsf):
super(WWD_General, self).__init__(xmsf)
@@ -20,13 +19,13 @@ class WWD_General(WebWizardDialog):
def getStatusDialog(self):
statusDialog = StatusDialog(
self.xMSF, StatusDialog.STANDARD_WIDTH,
- resources.resLoadingSession, False,
- [resources.prodName, "", "", "", "", ""],
+ self.resources.resLoadingSession, False,
+ [self.resources.prodName, "", "", "", "", ""],
HelpIds.getHelpIdString(HID0_STATUS_DIALOG))
try:
statusDialog.createWindowPeer(xControl.Peer)
- except Exception, e:
- e.printStackTrace()
+ except Exception:
+ traceback.print_exc()
return statusDialog
@@ -35,20 +34,19 @@ class WWD_General(WebWizardDialog):
'''
def getDocAddDialog(self):
- self.docAddDialog = SystemDialog.createOpenDialog(xMSF)
- i = 0
- while i < self.settings.cp_Filters.getSize():
- f = (self.settings.cp_Filters.getElementAt(i))
- self.docAddDialog.addFilter(
- f.cp_Name.replace("%PRODNAME", resources.prodName),
- f.cp_Filter, i == 0)
- i += 1
+ self.docAddDialog = SystemDialog.createOpenDialog(self.xMSF)
+ for i in xrange(WWD_General.settings.cp_Filters.getSize()):
+ f = WWD_General.settings.cp_Filters.getElementAt(i)
+ if f is not None:
+ self.docAddDialog.addFilter(
+ f.cp_Name.replace("%PRODNAME", self.resources.prodName),
+ f.cp_Filter, i == 0)
return self.docAddDialog
def getZipDialog(self):
if self.zipDialog is None:
self.zipDialog = SystemDialog.createStoreDialog(xMSF)
- self.zipDialog.addFilter(resources.resZipFiles, "*.zip", True)
+ self.zipDialog.addFilter(self.resources.resZipFiles, "*.zip", True)
return self.zipDialog
@@ -57,8 +55,8 @@ class WWD_General(WebWizardDialog):
try:
self.ftpDialog = FTPDialog.FTPDialog_unknown(xMSF, pub)
self.ftpDialog.createWindowPeer(xControl.getPeer())
- except Exception, ex:
- ex.printStackTrace()
+ except Exception:
+ traceback.print_exc()
return self.ftpDialog
@@ -68,15 +66,6 @@ class WWD_General(WebWizardDialog):
return self.folderDialog.callFolderDialog(title, description, dir)
- def getFileAccess(self):
- if self.fileAccess is None:
- try:
- self.fileAccess = FileAccess(xMSF)
- except Exception, ex:
- ex.printStackTrace()
-
- return self.fileAccess
-
'''
returns the document specified
by the given short array.
@@ -84,21 +73,24 @@ class WWD_General(WebWizardDialog):
@return
'''
+ @classmethod
def getDoc(self, s):
- if s.length == 0:
+ if len(s) == 0:
return None
- elif self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0]:
+ elif WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0]:
return None
else:
- return self.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0])
+ return \
+ WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0])
'''
how many documents are in the list?
@return the number of documents in the docs list.
'''
+ @classmethod
def getDocsCount(self):
- return self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize()
+ return WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize()
'''
fills the export listbox.
@@ -106,7 +98,7 @@ class WWD_General(WebWizardDialog):
'''
def fillExportList(self, listContent):
- ListModelBinder.fillList(lstDocTargetType, listContent, None)
+ ListModelBinder.fillList(self.lstDocTargetType, listContent, None)
'''
returns a publisher object for the given name
@@ -115,7 +107,7 @@ class WWD_General(WebWizardDialog):
'''
def getPublisher(self, name):
- return self.settings.cp_DefaultSession.cp_Publishing.getElement(name)
+ return WWD_General.settings.cp_DefaultSession.cp_Publishing.getElement(name)
'''
@return true if the checkbox "save session" is checked.
@@ -175,7 +167,7 @@ class WWD_General(WebWizardDialog):
'''
def checkDocList(self):
- if self.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() \
+ if WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() \
== 0:
self.enableSteps(False)
return False
@@ -250,7 +242,7 @@ class WWD_General(WebWizardDialog):
ex.printStackTrace()
peer = xControl.getPeer()
AbstractErrorHandler.showMessage(
- self.xMSF, peer, resources.resErrUnexpected,
+ self.xMSF, peer, self.resources.resErrUnexpected,
ErrorHandler.ERROR_PROCESS_FATAL)
'''
@@ -264,4 +256,3 @@ class WWD_General(WebWizardDialog):
return self.xStringSubstitution.substituteVariables(path, False)
except Exception, ex:
return path
-
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index 5709de9..ccb1050 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -9,6 +9,9 @@ from ui.event.RadioDataAware import RadioDataAware
from data.CGDocument import CGDocument
from ui.DocumentPreview import DocumentPreview
from StylePreview import StylePreview
+from ui.event.DataAware import DataAware
+
+from com.sun.star.lang import IllegalArgumentException
'''
Web Wizard Dialog implementation : Startup.
@@ -23,10 +26,10 @@ A Value is either a JavaBean property with
a Getter and a Setter or a public class Memeber.
</P>
When the UI Control changes, the Value changes correspondingly.
-This depends on WWD_Startup.settings a Listener which calls the updateData()
+This depends on WWD_General.settings a Listener which calls the updateData()
method od the DataAware object.
When the Value changes, the UI Control changes respopndingly.
-This also depends on WWD_Startup.settings a Listener which calls the updateUI
+This also depends on WWD_General.settings a Listener which calls the updateUI
method of the DataAware object.
</P>
<P>
@@ -53,7 +56,7 @@ are the controller inbetween.
class WWD_Startup(WWD_General):
- settings = None
+ selectedDoc = ()
'''
He - my constructor !
@@ -62,7 +65,7 @@ class WWD_Startup(WWD_General):
ftp if it is.<br/>
draw NaviBar and steps 1 to 7, incl. Step X,
which is the Layouts ImageList on step 3.<br/>
- load the WWD_Startup.settings from the configuration. <br/>
+ load the WWD_General.settings from the configuration. <br/>
set the default save session name to the first
available one (sessionX or something like that). <br/>
set the Layouts ImageList ListModel, and call
@@ -79,7 +82,10 @@ class WWD_Startup(WWD_General):
def __init__(self, xmsf):
super(WWD_Startup, self).__init__(xmsf)
self.sda = None
- self.selectedDoc = 0
+ self.docAware = []
+ self.designAware = []
+ self.genAware = []
+ self.pubAware = []
self.proxies = self.getOOProxies()
soTemplateDir = FileAccess.getOfficePath2(
xmsf, "Template", "share", "/wizard")
@@ -100,21 +106,21 @@ class WWD_Startup(WWD_General):
doc = OfficeDocument.createNewDocument(
self.myFrame, "swriter", False, True)
self.loadSettings(doc)
- self.setSaveSessionName(WWD_Startup.settings.cp_DefaultSession)
- self.ilLayouts.listModel = WWD_Startup.settings.cp_Layouts
+ self.setSaveSessionName(WWD_General.settings.cp_DefaultSession)
+ self.ilLayouts.listModel = WWD_General.settings.cp_Layouts
self.ilLayouts.create(self)
#COMMENTED
- #self.checkContent(WWD_Startup.settings.cp_DefaultSession.cp_Content, Task ("", "", 99999), self.xControl)
+ #self.checkContent(WWD_General.settings.cp_DefaultSession.cp_Content, Task("", "", 99999), self.xUnoDialog)
#saved sessions, styles, combobox save session.
# also set the chosen saved session...
self.fillLists()
self.makeDataAware()
- self.checkPublish()
+ #self.updateUI()
# fill the documents listbox.
- #COMMENTED
- #self.mount(self.settings.cp_DefaultSession.cp_Content)
+ self.fillDocumentList(self.settings.cp_DefaultSession.cp_Content)
+
if self.proxies:
self.setEnabled(btnFTP, False)
self.setEnabled(chkFTP, False)
@@ -151,9 +157,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 xrange(WWD_Startup.settings.cp_SavedSessions.getSize()):
+ for i in xrange(WWD_General.settings.cp_SavedSessions.getSize()):
sessionName = \
- WWD_Startup.settings.cp_SavedSessions.getElementAt(i).cp_Name
+ WWD_General.settings.cp_SavedSessions.getElementAt(i).cp_Name
if sessionName.startswith(self.resources.resSessionName):
maxValue = max(maxValue, int(sessionName[length:]))
@@ -177,6 +183,20 @@ class WWD_Startup(WWD_General):
self.enableFinishButton(False)
'''
+ This method goes through all
+ the DataAware vectors and objects and
+ calls their updateUI() method.
+ In response, the UI is synchronized to
+ the state of the corresponding data objects.
+ '''
+ def updateUI(self):
+ DataAware.updateUIs(self.designAware)
+ DataAware.updateUIs(self.genAware)
+ DataAware.updateUIs(self.pubAware)
+ self.sessionNameDA.updateUI()
+ checkPublish()
+
+ '''
create the peer, add roadmap,
add roadmap items, add style-preview,
disable the steps 3 to 7 if no documents are
@@ -204,49 +224,49 @@ class WWD_Startup(WWD_General):
try:
self.dpStylePreview = DocumentPreview(self.xMSF, self.imgPreview)
self.stylePreview = StylePreview(
- self.xMSF, WWD_Startup.settings.workPath)
+ self.xMSF, WWD_General.settings.workPath)
self.stylePreview.refresh(
- WWD_Startup.settings.cp_DefaultSession.getStyle(
- WWD_Startup.settings.cp_Styles),
- WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
+ WWD_General.settings.cp_DefaultSession.getStyle(
+ WWD_General.settings.cp_Styles),
+ WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
self.dpStylePreview.setDocument(
self.stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE)
except Exception:
traceback.print_exc()
'''
- Loads the web wizard WWD_Startup.settings from the registry.
+ Loads the web wizard WWD_General.settings from the registry.
'''
def loadSettings(self, document):
try:
# instanciate
- WWD_Startup.settingsResources = \
+ WWD_General.settingsResources = \
[self.resources.resPages, self.resources.resSlides,
self.resources.resCreatedTemplate,
self.resources.resUpdatedTemplate,
self.resources.resSizeTemplate]
- WWD_Startup.settings = CGSettings(
- self.xMSF, WWD_Startup.settingsResources, document)
+ WWD_General.settings = CGSettings(
+ self.xMSF, WWD_General.settingsResources, document)
# get configuration view
confRoot = Configuration.getConfigurationRoot(
self.xMSF, CONFIG_PATH, False)
# read
- WWD_Startup.settings.readConfiguration(
+ WWD_General.settings.readConfiguration(
confRoot, CONFIG_READ_PARAM)
- configSet = WWD_Startup.settings.cp_DefaultSession.cp_Publishing
+ configSet = WWD_General.settings.cp_DefaultSession.cp_Publishing
# now if path variables are used in publisher pathes, they
# are getting replaced here...
for i in xrange(configSet.getSize()):
p = configSet.getElementAt(i)
p.cp_URL = self.substitute(p.cp_URL)
- # initialize the WWD_Startup.settings.
- WWD_Startup.settings.configure(self.xMSF)
+ # initialize the WWD_General.settings.
+ WWD_General.settings.configure(self.xMSF)
# set resource needed for web page.
# sort the styles alphabetically
#COMMENTED
- WWD_Startup.settings.cp_Styles.sort(None)
+ WWD_General.settings.cp_Styles.sort(None)
self.prepareSessionLists()
if self.proxies:
self.__ftp = self.getPublisher(FTP_PUBLISHER).cp_Publish
@@ -257,16 +277,16 @@ class WWD_Startup(WWD_General):
def prepareSessionLists(self):
# now copy the sessions list...
- sessions = WWD_Startup.settings.cp_SavedSessions.childrenList
+ sessions = WWD_General.settings.cp_SavedSessions.childrenList
- WWD_Startup.settings.savedSessions.clear()
+ WWD_General.settings.savedSessions.clear()
for index,item in enumerate(sessions):
- WWD_Startup.settings.savedSessions.add(index, item)
+ WWD_General.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_Startup.settings.cp_SavedSessions.add(0, sn)
+ WWD_General.settings.cp_SavedSessions.add(0, sn)
'''
fills the saved session list, the styles list,
@@ -279,25 +299,25 @@ class WWD_Startup(WWD_General):
# fill the saved session list.
ListModelBinder.fillList(self.lstLoadSettings,
- WWD_Startup.settings.cp_SavedSessions.childrenList, None)
+ WWD_General.settings.cp_SavedSessions.childrenList, None)
# set the selected session to load. (step 1)
self.selectSession()
# fill the styles list.
ListModelBinder.fillList(self.lstStyles,
- WWD_Startup.settings.cp_Styles.childrenList, None)
+ WWD_General.settings.cp_Styles.childrenList, None)
# fill the save session combobox (step 7)
ListModelBinder.fillComboBox(self.cbSaveSettings,
- WWD_Startup.settings.savedSessions.childrenList, None)
+ WWD_General.settings.savedSessions.childrenList, None)
def selectSession(self):
selectedSession = 0
- if WWD_Startup.settings.cp_LastSavedSession is not None \
- and not WWD_Startup.settings.cp_LastSavedSession == "":
- ses = WWD_Startup.settings.cp_SavedSessions.getElement(
+ if WWD_General.settings.cp_LastSavedSession is not None \
+ and not WWD_General.settings.cp_LastSavedSession == "":
+ ses = WWD_General.settings.cp_SavedSessions.getElement(
settings.cp_LastSavedSession)
if ses is not None:
selectedSession = \
- WWD_Startup.settings.cp_SavedSessions.getIndexOf(ses)
+ WWD_General.settings.cp_SavedSessions.getIndexOf(ses)
Helper.setUnoPropertyValue(
self.lstLoadSettings.Model, "SelectedItems", (selectedSession,))
@@ -311,7 +331,7 @@ class WWD_Startup(WWD_General):
def makeDataAware(self):
#page 1
ListModelBinder(
- self.lstLoadSettings, WWD_Startup.settings.cp_SavedSessions)
+ self.lstLoadSettings, WWD_General.settings.cp_SavedSessions)
#page 2 : document properties
self.docListDA = UnoDataAware.attachListBox(
self, "selectedDoc", self.lstDocuments, False)
@@ -324,82 +344,82 @@ class WWD_Startup(WWD_General):
doc = CGDocument
#dummy
self.docsBinder = ListModelBinder(self.lstDocuments,
- WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents)
- UnoDataAware.attachEditControl(
- doc, "cp_Title", self.txtDocTitle, True)
- UnoDataAware.attachEditControl(
- doc, "cp_Description", self.txtDocInfo, True)
- UnoDataAware.attachEditControl(
- doc, "cp_Author", self.txtDocAuthor, True)
- UnoDataAware.attachListBox(
- doc, "Exporter", self.lstDocTargetType, False)
+ WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents)
+ self.docAware.append(UnoDataAware.attachEditControl(
+ doc, "cp_Title", self.txtDocTitle, True))
+ self.docAware.append(UnoDataAware.attachEditControl(
+ doc, "cp_Description", self.txtDocInfo, True))
+ self.docAware.append(UnoDataAware.attachEditControl(
+ doc, "cp_Author", self.txtDocAuthor, True))
+ self.docAware.append(UnoDataAware.attachListBox(
+ doc, "Exporter", self.lstDocTargetType, False))
#page 3 : Layout
- design = WWD_Startup.settings.cp_DefaultSession.cp_Design
+ design = WWD_General.settings.cp_DefaultSession.cp_Design
#COMMENTED
#self.sda = SimpleDataAware.SimpleDataAware_unknown(design, DataAware.PropertyValue ("Layout", design), ilLayouts, DataAware.PropertyValue ("Selected", ilLayouts))
#self.ilLayouts.addItemListener(None)
#page 4 : layout 2
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayDescription", self.chbDocDesc, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayAuthor", self.chbDocAuthor, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayCreateDate", self.chkDocCreated, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayUpdateDate", self.chkDocChanged, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayFilename", self.chkDocFilename, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayFileFormat", self.chkDocFormat, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayFormatIcon", self.chkDocFormatIcon, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplayPages", self.chkDocPages, True)
- UnoDataAware.attachCheckBox(
- design, "cp_DisplaySize", self.chkDocSize, True)
- RadioDataAware.attachRadioButtons(
- WWD_Startup.settings.cp_DefaultSession.cp_Design,
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayDescription", self.chbDocDesc, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayAuthor", self.chbDocAuthor, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayCreateDate", self.chkDocCreated, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayUpdateDate", self.chkDocChanged, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayFilename", self.chkDocFilename, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayFileFormat", self.chkDocFormat, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayFormatIcon", self.chkDocFormatIcon, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplayPages", self.chkDocPages, True))
+ self.designAware.append(UnoDataAware.attachCheckBox(
+ design, "cp_DisplaySize", self.chkDocSize, True))
+ self.designAware.append(RadioDataAware.attachRadioButtons(
+ WWD_General.settings.cp_DefaultSession.cp_Design,
"cp_OptimizeDisplaySize",
(self.optOptimize640x480, self.optOptimize800x600,
- self.optOptimize1024x768), True)
+ self.optOptimize1024x768), True))
#page 5 : Style
'''
note : on style change, i do not call here refresh ,but rather on
a special method which will perform some display, background and Iconsets changes.
'''
- UnoDataAware.attachListBox(
- WWD_Startup.settings.cp_DefaultSession.cp_Design,
- "Style", self.lstStyles, False)
+ self.designAware.append(UnoDataAware.attachListBox(
+ WWD_General.settings.cp_DefaultSession.cp_Design,
+ "Style", self.lstStyles, False))
#page 6 : site general props
- UnoDataAware.attachEditControl(
- WWD_Startup.settings.cp_DefaultSession.cp_GeneralInfo,
- "cp_Title", self.txtSiteTitle, True)
- UnoDataAware.attachEditControl(
- WWD_Startup.settings.cp_DefaultSession.cp_GeneralInfo,
- "cp_Description", self.txtSiteDesc, True)
- UnoDataAware.attachDateControl(
- WWD_Startup.settings.cp_DefaultSession.cp_GeneralInfo,
- "CreationDate", self.dateSiteCreated, False)
- UnoDataAware.attachDateControl(
- WWD_Startup.settings.cp_DefaultSession.cp_GeneralInfo,
- "UpdateDate", self.dateSiteUpdate, False)
- UnoDataAware.attachEditControl(
- WWD_Startup.settings.cp_DefaultSession.cp_GeneralInfo,
- "cp_Email", self.txtEmail, True)
- UnoDataAware.attachEditControl(
- WWD_Startup.settings.cp_DefaultSession.cp_GeneralInfo,
- "cp_Copyright", self.txtCopyright, True)
+ self.genAware.append(UnoDataAware.attachEditControl(
+ WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
+ "cp_Title", self.txtSiteTitle, True))
+ self.genAware.append(UnoDataAware.attachEditControl(
+ WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
+ "cp_Description", self.txtSiteDesc, True))
+ self.genAware.append(UnoDataAware.attachDateControl(
+ WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
+ "CreationDate", self.dateSiteCreated, False))
+ self.genAware.append(UnoDataAware.attachDateControl(
+ WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
+ "UpdateDate", self.dateSiteUpdate, False))
+ self.genAware.append(UnoDataAware.attachEditControl(
+ WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
+ "cp_Email", self.txtEmail, True))
+ self.genAware.append(UnoDataAware.attachEditControl(
+ WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
+ "cp_Copyright", self.txtCopyright, True))
#page 7 : publishing
- self.pubAware(
- LOCAL_PUBLISHER, self.chkLocalDir, self.txtLocalDir, False)
- self.pubAware(
- FTP_PUBLISHER, self.chkFTP, self.lblFTP, True)
- self.pubAware(
- ZIP_PUBLISHER, self.chkZip, self.txtZip, False)
+ self.pubAware.append(self.pubAware_(
+ LOCAL_PUBLISHER, self.chkLocalDir, self.txtLocalDir, False))
+ self.pubAware.append(self.pubAware_(
+ FTP_PUBLISHER, self.chkFTP, self.lblFTP, True))
+ self.pubAware.append(self.pubAware_(
+ ZIP_PUBLISHER, self.chkZip, self.txtZip, False))
self.sessionNameDA = UnoDataAware.attachEditControl(
- WWD_Startup.settings.cp_DefaultSession, "cp_Name",
+ WWD_General.settings.cp_DefaultSession, "cp_Name",
self.cbSaveSettings, True)
'''
@@ -410,8 +430,8 @@ class WWD_Startup(WWD_General):
@param textbox
'''
- def pubAware(self, publish, checkbox, textbox, isLabel):
- p = WWD_Startup.settings.cp_DefaultSession.cp_Publishing.getElement(publish)
+ def pubAware_(self, publish, checkbox, textbox, isLabel):
+ p = WWD_General.settings.cp_DefaultSession.cp_Publishing.getElement(publish)
uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, True)
uda.Inverse = True
uda.disableObjects = [textbox]
@@ -472,9 +492,9 @@ class WWD_Startup(WWD_General):
@param i the number of the object (0 = local, 1 = ftp, 2 = zip)
'''
- def mount(self, data, i):
- (self.pubAware.get(i * 2)).setDataObject(data, True)
- (self.pubAware.get(i * 2 + 1)).setDataObject(data, True)
+ def mountDataAware(self, data, i):
+ self.pubAware.get(i * 2).setDataObject(data, True)
+ self.pubAware.get(i * 2 + 1).setDataObject(data, True)
'''
Fills the documents listbox.
@@ -482,10 +502,11 @@ class WWD_Startup(WWD_General):
that contains the documents (a ListModel)
'''
- def mount(self, root):
- ListModelBinder.fillList(lstDocuments, root.cp_Documents.items(), None)
- self.docsBinder.setListModel(root.cp_Documents)
- disableDocUpDown()
+ def fillDocumentList(self, root):
+ ListModelBinder.fillList(self.lstDocuments, root.cp_Documents.childrenList, None)
+ #COMMENTED
+ #self.docsBinder.setListModel(root.cp_Documents)
+ self.disableDocUpDown()
'''
changes the DataAwares Objects' (in
@@ -494,11 +515,9 @@ class WWD_Startup(WWD_General):
@param list
'''
- def mount(self, data, list):
- i = 0
- while i < list.size():
- (list.get(i)).setDataObject(data, True)
- i += 1
+ def mountList(self, data, _list):
+ for i in _list:
+ i.setDataObject(data, True)
'''
Checks if the document specified by the given CGDocument
@@ -512,23 +531,23 @@ class WWD_Startup(WWD_General):
@return true if the document is ok (a file exists in the given url).
'''
- def checkDocument(self, doc, task, xC):
- try:
- doc.validate(xMSF, task)
- return True
- except FileNotFoundException, ex:
+ @classmethod
+ def checkDocument(self,xmsf, doc, task, xC):
+ doc.validate(xmsf, task)
+ return True
+ '''except IOError:
relocate = SystemDialog.showMessageBox(
self.xMSF, xC.Peer, "WarningBox",
VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO,
getFileAccess().getPath(doc.cp_URL, "") + "\n\n" + \
self.resources.resSpecifyNewFileLocation)
if relocate == 2:
- file = getDocAddDialog().callOpenDialog(
+ _file = getDocAddDialog().callOpenDialog(
False, FileAccess.getParentDir(doc.cp_URL))
- if file is None:
+ if _file is None:
return False
else:
- doc.cp_URL = file[0]
+ doc.cp_URL = _file[0]
return checkDocument(doc, task, xC)
else:
@@ -536,21 +555,22 @@ class WWD_Startup(WWD_General):
except IllegalArgumentException, iaex:
#file is a directory
- AbstractErrorHandler.showMessage(
+ SystemDialog.showMessage(
self.xMSF, xControl.Peer,
self.resources.resErrIsDirectory.replace(
"%FILENAME", getFileAccess().getPath(doc.cp_URL, "")),
ErrorHandler.ERROR_PROCESS_FATAL)
return False
- except Exceptionp:
+ except Exception:
#something went wrong.
- exp.printStackTrace()
- AbstractErrorHandler.showMessage(
+ traceback.print_exc()
+ SystemDialog.showMessage(
self.xMSF, xControl.Peer,
self.resources.resErrDocValidate.replace(
"%FILENAME", getFileAccess().getPath(doc.cp_URL, "")),
ErrorHandler.ERROR_PROCESS_FATAL)
return False
+ '''
'''
Checks the documents contained in this content.
@@ -577,14 +597,29 @@ class WWD_Startup(WWD_General):
def disableDocUpDown(self):
try:
- '''setEnabled(btnDocUp, self.selectedDoc.length == 0 ? Boolean.FALSE : (self.selectedDoc[0] == 0 ? Boolean.FALSE : Boolean.TRUE))
- setEnabled(btnDocDown, self.selectedDoc.length == 0 ? Boolean.FALSE : (self.selectedDoc[0] + 1 < WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() ? Boolean.TRUE : Boolean.FALSE))'''
- except Exception, e:
- e.printStackTrace()
+ 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.setEnabled(self.btnDocUp, aux)
+ self.setEnabled(self.btnDocDown, aux2)
+ except Exception:
+ traceback.print_exc()
def updateBackgroundText(self):
bg = \
- WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage
+ WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage
if bg is None or bg.equals(""):
bg = self.resources.resBackgroundNone
else:
@@ -594,11 +629,11 @@ class WWD_Startup(WWD_General):
txtBackground.Model, PropertyNames.PROPERTY_LABEL, bg)
def updateIconsetText(self):
- iconset = WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet
+ iconset = WWD_General.settings.cp_DefaultSession.cp_Design.cp_IconSet
if iconset is None or iconset.equals(""):
iconsetName = self.resources.resIconsetNone
else:
- IconSet = WWD_Startup.settings.cp_IconSets.getElement(iconset)
+ IconSet = WWD_General.settings.cp_IconSets.getElement(iconset)
if IconSet is None:
iconsetName = self.resources.resIconsetNone
else:
@@ -617,7 +652,7 @@ class WWD_Startup(WWD_General):
def refreshStylePreview(self):
try:
updateBackgroundText()
- self.stylePreview.refresh(settings.cp_DefaultSession.getStyle(), WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
+ self.stylePreview.refresh(settings.cp_DefaultSession.getStyle(), WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
self.dpStylePreview.reload(xMSF)
except Exception:
- ex.printStackTrace()
+ traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.py b/wizards/com/sun/star/wizards/web/data/CGDocument.py
index cc8ff98..11f6dae 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.py
@@ -1,4 +1,14 @@
+from os import sep as separator
from common.ConfigGroup import ConfigGroup
+from document.OfficeDocument import OfficeDocument
+from common.Properties import Properties
+from common.PropertyNames import PropertyNames
+from common.FileAccess import FileAccess
+from TypeDetection import *
+from common.Desktop import Desktop
+
+from com.sun.star.document.MacroExecMode import NEVER_EXECUTE
+from com.sun.star.document.UpdateDocMode import NO_UPDATE
'''
About the member fields Title, Decription and Author:
@@ -16,6 +26,7 @@ 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
@@ -30,6 +41,7 @@ class CGDocument(ConfigGroup):
sizeBytes = -1
pages = -1
valid = False
+ appType = None
'''
the task will advance 5 times during validate.
@@ -39,30 +51,30 @@ class CGDocument(ConfigGroup):
'''
def validate(self, xmsf, task):
- if not getSettings().getFileAccess(xmsf).exists(self.cp_URL, False):
+ if not self.root.getFileAccess(xmsf).exists(self.cp_URL, False):
raise FileNotFoundException (
"The given URL does not point to a file");
- if getSettings().getFileAccess(xmsf).isDirectory(self.cp_URL):
+ if self.root.getFileAccess(xmsf).isDirectory(self.cp_URL):
raise IllegalArgumentException (
"The given URL points to a directory");
#create a TypeDetection service
- mediaDescriptor = OfficeDocument.getFileMediaDecriptor(
+ self.mediaDescriptor = OfficeDocument.getFileMediaDecriptor(
xmsf, self.cp_URL)
- task.advance(True)
+ #task.advance(True)
#1
- analyzeFileType(self.mediaDescriptor)
- task.advance(True)
+ self.analyzeFileType(self.mediaDescriptor)
+ #task.advance(True)
#2
- path = getSettings().getFileAccess(xmsf).getPath(self.cp_URL, "")
- localFilename = FileAccess.getFilename(path, File.separator)
+ path = self.root.getFileAccess(xmsf).getPath(self.cp_URL, "")
+ localFilename = FileAccess.getFilename(path, separator)
'''
if the type is a star office convertable document
We try to open the document to get some properties
'''
xProps = None
- task.advance(True)
+ #task.advance(True)
#3
if self.isSOOpenable:
# for documents which are openable through SO,
@@ -71,22 +83,22 @@ class CGDocument(ConfigGroup):
props = range(3)
props[0] = Properties.createProperty("Hidden", True)
props[1] = Properties.createProperty(
- "MacroExecutionMode", MacroExecMode.NEVER_EXECUTE)
+ "MacroExecutionMode", NEVER_EXECUTE)
props[2] = Properties.createProperty(
- "UpdateDocMode", UpdateDocMode.NO_UPDATE)
+ "UpdateDocMode", NO_UPDATE)
component = desktop.loadComponentFromURL(
- self.cp_URL, "_default", 0, props)
- xProps = component.getDocumentProperties()
+ self.cp_URL, "_default", 0, tuple(props))
+ xProps = component.DocumentProperties
- task.advance(True)
+ #task.advance(True)
#4
#now use the object to read some document properties.
if xProps != None:
- title = xProps.getTitle()
- description = xProps.getDescription()
- author = xProps.getAuthor()
- createDate = xProps.getCreationDate()
- updateDate = xProps.getModificationDate()
+ title = xProps.Title
+ description = xProps.Description
+ author = xProps.Author
+ createDate = xProps.CreationDate
+ updateDate = xProps.ModificationDate
else:
#get some information from OS.
@@ -94,24 +106,24 @@ class CGDocument(ConfigGroup):
updateDate = \
getSettings().getFileAccess(xmsf).getLastModified(self.cp_URL)
- task.advance(True)
+ #task.advance(True)
#5
valid = True
- if self.cp_Title.equals(""):
+ if self.cp_Title == "":
cp_Title = self.title
- if self.cp_Title.equals(""):
+ if self.cp_Title == "":
cp_Title = self.localFilename
- if self.cp_Description.equals(""):
+ if self.cp_Description == "":
cp_Description = self.description
- if self.cp_Author.equals(""):
+ if self.cp_Author == "":
cp_Author = self.author
if self.cp_Exporter == None or self.cp_Exporter == "":
cp_Exporter = \
- getSettings().cp_Exporters.getKey(getSettings().getExporters(self.appType)[0])
+ self.root.cp_Exporters.getKey(self.root.getExporters(CGDocument.appType))
'''
Analyzes a type-detection string, returned from the TypeDetection service,
@@ -122,46 +134,46 @@ class CGDocument(ConfigGroup):
if mediaDesc is None:
media = ""
else:
- mediaProperties.getPropertyValue(
+ media = Properties.getPropertyValue(
self.mediaDescriptor, PropertyNames.PROPERTY_NAME)
- appType = getDocType(media)
- isSOOpenable = (self.appType == TypeDetection.WRITER_DOC or self.appType == TypeDetection.CALC_DOC or self.appType == TypeDetection.IMPRESS_DOC or self.appType == TypeDetection.DRAW_DOC) or self.appType == TypeDetection.HTML_DOC
- parts = JavaTools.ArrayoutofString(media, "_")
- if parts.length < 2:
- isSODocument = False
+ CGDocument.appType = self.getDocType(media)
+ 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
+ parts = media.split("_")
+ if len(parts) < 2:
+ self.isSODocument = False
else:
- isSODocument = self.isSOOpenable and (parts[1].startsWith("Star"))
+ self.isSODocument = self.isSOOpenable and (parts[1].startswith("Star"))
'''
@param media is the media description string returned by an UNO TypeDetection object.
- @return one of the constants in the interface TypeDetection.
+ @return one of the constants in the interface
'''
def getDocType(self, media):
- if media.equals(""):
- return TypeDetection.NO_TYPE
+ if media == "":
+ return NO_TYPE
- if media.startsWith("writer"):
- if media.startsWith("writer_web_HTML"):
- return TypeDetection.HTML_DOC
+ if media.startswith("writer"):
+ if media.startswith("writer_web_HTML"):
+ return HTML_DOC
else:
- return TypeDetection.WRITER_DOC
-
- elif media.startsWith("calc"):
- return TypeDetection.CALC_DOC
- elif media.startsWith("draw"):
- return TypeDetection.DRAW_DOC
- elif media.startsWith("impress"):
- return TypeDetection.IMPRESS_DOC
- elif media.startsWith("pdf"):
- return TypeDetection.PDF_DOC
- elif media.startsWith("gif") or media.startsWith("jpg"):
- return TypeDetection.WEB_GRAPHICS
- elif media.startsWith("wav"):
- return TypeDetection.SOUND_FILE
+ return WRITER_DOC
+
+ elif media.startswith("calc"):
+ return CALC_DOC
+ elif media.startswith("draw"):
+ return DRAW_DOC
+ elif media.startswith("impress"):
+ return IMPRESS_DOC
+ elif media.startswith("pdf"):
+ return PDF_DOC
+ elif media.startswith("gif") or media.startswith("jpg"):
+ return WEB_GRAPHICS
+ elif media.startswith("wav"):
+ return SOUND_FILE
else:
- return TypeDetection.NO_TYPE
+ return NO_TYPE
def createDOM(self, parent):
d = getSettings().cp_DefaultSession.cp_Design
@@ -214,7 +226,7 @@ class CGDocument(ConfigGroup):
def getIcon(self, exporter):
if exporter.cp_Icon == "":
- return getIcon(self.appType)
+ return getIcon(CGDocument.appType)
else:
return exporter.cp_Icon
@@ -237,7 +249,7 @@ class CGDocument(ConfigGroup):
'''
def setExporter(self, exporter_):
- exp = getSettings().getExporters(self.appType)[exporter_[0]]
+ exp = getSettings().getExporters(CGDocument.appType)[exporter_[0]]
cp_Exporter = getSettings().cp_Exporters.getKey(exp)
'''
@@ -250,7 +262,7 @@ class CGDocument(ConfigGroup):
return 0
exporter = getSettings().cp_Exporters.getElement(self.cp_Exporter)
- exporters = getSettings().getExporters(self.appType)
+ exporters = getSettings().getExporters(CGDocument.appType)
i = 0
while i < exporters.length:
if exporters[i] == exporter:
diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.py b/wizards/com/sun/star/wizards/web/data/CGExporter.py
index dee2165..882091a 100644
--- a/wizards/com/sun/star/wizards/web/data/CGExporter.py
+++ b/wizards/com/sun/star/wizards/web/data/CGExporter.py
@@ -19,5 +19,5 @@ class CGExporter(ConfigGroup):
cp_Arguments = ConfigSet(CGArgument())
def supports(self, mime):
- return cp_SupportedMimeTypes == "" or \
- cp_SupportedMimeTypes.index(mime) > -1
+ return CGExporter.cp_SupportedMimeTypes == "" or \
+ CGExporter.cp_SupportedMimeTypes.index(mime) > -1
diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.py b/wizards/com/sun/star/wizards/web/data/CGSettings.py
index 919145a..d79fa1e 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 @@ class CGSettings(ConfigGroup):
savedSessions = ConfigSet(CGSessionName())
cp_DefaultSession = CGSession()
cp_LastSavedSession = str()
+ fileAccess = None
def __init__(self, xmsf_, resources_, document):
self.xmsf = xmsf_
@@ -43,7 +44,7 @@ class CGSettings(ConfigGroup):
self.xmsf, "Config", "", "")
self.soGalleryDir = FileAccess.getOfficePath2(
self.xmsf, "Gallery", "share", "")
- root = self
+ ConfigGroup.root = self
self.formatter = self.Formatter(self.xmsf, document)
self.resources = resources_
self.workPath = None
@@ -54,23 +55,23 @@ class CGSettings(ConfigGroup):
def getExporters(self, mime):
exps = self.exportersMap.get(mime)
if exps is None:
- self.exportersMap.put(mime, exps = createExporters(mime))
+ exps = self.createExporters(mime)
+ self.exportersMap[mime] = exps
return exps
def createExporters(self, mime):
- exporters = self.cp_Exporters.items()
- v = Vector.Vector()
- i = 0
- while i < exporters.length:
- if (exporters[i]).supports(mime):
- try:
- v.add(exporters[i])
- except Exception, ex:
- ex.printStackTrace()
-
- i += 1
- return v.toArray(self.__class__.EMPTY_ARRAY_1)
+ exporters = self.cp_Exporters.childrenList
+ v = []
+ for i in exporters:
+ if i is not None:
+ if i.supports(mime):
+ try:
+ v.append(i)
+ except Exception, ex:
+ traceback.print_exc()
+
+ return v
'''
call after read.
@@ -100,10 +101,10 @@ class CGSettings(ConfigGroup):
def getFileAccess(self, xmsf = None):
if xmsf is None:
xmsf = self.xmsf
- if self.fileAccess is None:
- self.fileAccess = FileAccess.FileAccess_unknown(xmsf)
+ if CGSettings.fileAccess is None:
+ CGSettings.fileAccess = FileAccess(xmsf)
- return self.fileAccess
+ return CGSettings.fileAccess
class Formatter(object):
def __init__(self, xmsf, document):
More information about the Libreoffice-commits
mailing list