[Libreoffice-commits] core.git: Branch 'feature/pyweb-wizard' - 39 commits - officecfg/registry wizards/com wizards/Pyuno_commonwizards.mk wizards/Pyuno_web.mk
Javier Fernandez
jfernandez at igalia.com
Thu Mar 28 05:17:59 PDT 2013
officecfg/registry/data/org/openoffice/Office/WebWizard.xcu | 2
wizards/Pyuno_commonwizards.mk | 5
wizards/Pyuno_web.mk | 1
wizards/com/sun/star/wizards/common/Configuration.py | 68 +++
wizards/com/sun/star/wizards/common/Desktop.py | 21 +
wizards/com/sun/star/wizards/common/FileAccess.py | 222 +++++++++++
wizards/com/sun/star/wizards/common/ListModel.py | 39 +
wizards/com/sun/star/wizards/common/Properties.py | 6
wizards/com/sun/star/wizards/common/SystemDialog.py | 4
wizards/com/sun/star/wizards/ui/DocumentPreview.py | 5
wizards/com/sun/star/wizards/ui/ImageList.py | 237 +++++++-----
wizards/com/sun/star/wizards/ui/PeerConfig.py | 12
wizards/com/sun/star/wizards/ui/UnoDialog.py | 78 +++
wizards/com/sun/star/wizards/ui/event/CommonListener.py | 9
wizards/com/sun/star/wizards/ui/event/DataAware.py | 28 +
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 | 20 -
wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py | 33 +
wizards/com/sun/star/wizards/ui/event/UnoDataAware.py | 14
wizards/com/sun/star/wizards/web/BackgroundsDialog.py | 60 +--
wizards/com/sun/star/wizards/web/FTPDialog.py | 6
wizards/com/sun/star/wizards/web/IconsDialog.py | 46 +-
wizards/com/sun/star/wizards/web/ImageListDialog.py | 4
wizards/com/sun/star/wizards/web/Process.py | 3
wizards/com/sun/star/wizards/web/WWD_Events.py | 168 ++++----
wizards/com/sun/star/wizards/web/WWD_General.py | 14
wizards/com/sun/star/wizards/web/WWD_Startup.py | 148 +++----
wizards/com/sun/star/wizards/web/WebConfigSet.py | 70 +++
wizards/com/sun/star/wizards/web/data/CGContent.py | 8
wizards/com/sun/star/wizards/web/data/CGDesign.py | 16
wizards/com/sun/star/wizards/web/data/CGDocument.py | 3
wizards/com/sun/star/wizards/web/data/CGExporter.py | 3
wizards/com/sun/star/wizards/web/data/CGLayout.py | 6
wizards/com/sun/star/wizards/web/data/CGSessionName.py | 3
wizards/com/sun/star/wizards/web/data/CGSettings.py | 1
wizards/com/sun/star/wizards/web/data/CGStyle.py | 3
wizards/com/sun/star/wizards/web/export/FilterExporter.py | 57 ++
39 files changed, 1193 insertions(+), 331 deletions(-)
New commits:
commit eaafbe665b2eca09b1e51bf20167b774ea15f201
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Thu Mar 28 12:13:36 2013 +0000
Implementing the Design DataAware features and ItemListeners.
Change-Id: I22ac7c16110a9f92a575dc23f2d3477d163ddb07
diff --git a/wizards/Pyuno_commonwizards.mk b/wizards/Pyuno_commonwizards.mk
index a62b356..82d867f 100644
--- a/wizards/Pyuno_commonwizards.mk
+++ b/wizards/Pyuno_commonwizards.mk
@@ -71,6 +71,7 @@ $(eval $(call gb_Pyuno_add_files,wizards,\
ui/event/ListModelBinder.py \
ui/event/RadioDataAware.py \
ui/event/UnoDataAware.py \
+ ui/event/SimpleDataAware.py \
ui/event/Task.py \
ui/event/TaskEvent.py \
ui/event/TaskListener.py \
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.py b/wizards/com/sun/star/wizards/ui/ImageList.py
index 6e46908..38a0ea5 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.py
+++ b/wizards/com/sun/star/wizards/ui/ImageList.py
@@ -82,6 +82,7 @@ class ImageList(ListDataListener):
self.renderer = None
self.counterRenderer = self.SimpleCounterRenderer()
self.MOVE_SELECTION_VALS = list(range(3))
+ self.itemListenerList = None
def onMousePressed(self, event):
print ("DEBUG !!! onMousePressed -- Mouse pressed.")
@@ -219,6 +220,7 @@ class ImageList(ListDataListener):
(self.imageSize.Height + self.gap.Height) + self.gap.Height
def refreshImages(self):
+ print ("DEBUG !!! refreshImages -- ")
if self.showButtons:
self.refreshCounterText()
@@ -261,6 +263,10 @@ class ImageList(ListDataListener):
return i
def refreshSelection(self):
+ print ("DEBUG !!! refreshSelection -- selected: ", self.selected)
+ print ("DEBUG !!! refreshSelection -- pageStart: ", self.pageStart)
+ print ("DEBUG !!! refreshSelection -- rows: ", self.rows)
+ print ("DEBUG !!! refreshSelection -- cols: ", self.cols)
if self.selected < self.pageStart or \
self.selected >= (self.pageStart + self.rows * self.cols):
self.hideSelection()
@@ -268,6 +274,7 @@ class ImageList(ListDataListener):
self.moveSelection(self.getImageIndexFor(self.selected))
def hideSelection(self):
+ print ("DEBUG !!! -- hideSelection")
self.grbxSelectedImage.Model.Step = ImageList.HIDE_PAGE
self.grbxSelectedImage.Visible = False
@@ -292,7 +299,7 @@ class ImageList(ListDataListener):
uno.invoke(self.grbxSelectedImage.Model, "setPropertyValues",
((ImageList.MOVE_SELECTION),
(tuple(self.MOVE_SELECTION_VALS))))
- if (self.grbxSelectedImage.Model.Step == self.step):
+ if (self.dialogModel.Step == self.step):
self.grbxSelectedImage.Visible = True
#now focus...
@@ -336,8 +343,8 @@ class ImageList(ListDataListener):
self.selected += event.getIndex1() - event.getIndex0() + 1
if event.getIndex0() < self.pageStart or \
- event.getIndex1() < (self.pageStart + getRows() + getCols()):
- refreshImages()
+ event.getIndex1() < (self.pageStart + self.rows + self.cols):
+ self.refreshImages()
'''
Registers ItemListener to receive events.
@@ -346,9 +353,9 @@ class ImageList(ListDataListener):
@synchronized(lock)
def addItemListener(self, listener):
+ print ("DEBUG !!!! ImageList.addItemListener -")
if self.itemListenerList is None:
- self.itemListenerList = java.util.ArrayList.ArrayList()
-
+ self.itemListenerList = []
self.itemListenerList.append(listener)
'''
@@ -358,6 +365,7 @@ class ImageList(ListDataListener):
@synchronized(lock)
def removeItemListener(self, listener):
+ print ("DEBUG !!!! ImageList.addItemListener -")
if self.itemListenerList is not None:
self.itemListenerList.remove(listener)
@@ -367,15 +375,17 @@ class ImageList(ListDataListener):
'''
def fireItemSelected(self):
- with ImageList.lock:
- if self.itemListenerList is None:
- return
-
- auxlist = self.itemListenerList.clone()
-
+ print ("DEBUG !!!! ImageList.fireItemSelected -")
+ if self.itemListenerList is None:
+ return
+ auxlist = list(self.itemListenerList)
for i in auxlist:
i.itemStateChanged(None)
+ def getSelected(self):
+ print ("DEBUG !!!! ImageList.getSelected - selected: ", self.selected)
+ return self.selected
+
def setSelected(self, _object):
print ("DEBUG !!!! ImageList.setSelected - _object: ", _object)
if (isinstance (_object, int)):
@@ -393,9 +403,11 @@ class ImageList(ListDataListener):
i += 1
def setSelected1(self, index):
- print ("DEBUG !!!! ImageList.setSelected - _index: ", index)
+ print ("DEBUG !!!! ImageList.setSelected1 - _index: ", index)
+ print ("DEBUG !!!! ImageList.setSelected1 - selected: ", self.selected)
if self.rowSelect and (index >= 0):
- index = int((index / self.cols) * self.cols)
+ index = int(index / self.cols) * self.cols
+ print ("DEBUG !!!! ImageList.setSelected1 - index: ", index)
if self.selected == index:
return
@@ -403,8 +415,7 @@ class ImageList(ListDataListener):
self.selected = index
self.refreshImageText()
self.refreshSelection()
- #COMMENTED
- #self.fireItemSelected()
+ self.fireItemSelected()
def refreshImageText(self):
@@ -500,6 +511,7 @@ class ImageList(ListDataListener):
return None
def showSelected(self):
+ print ("DEBUG !!! showSelected -- ")
oldPageStart = self.pageStart
if self.selected != -1:
self.pageStart = \
@@ -510,34 +522,40 @@ class ImageList(ListDataListener):
self.refreshImages()
def keyPressed(self, ke):
- image = getImageFromEvent(ke)
- r = image / getCols()
- c = image - (r * getCols())
- d = getKeyMove(ke, r, c)
+ print ("DEBUG !!! keyPressed -- ")
+ image = self.getImageFromEvent(ke)
+ r = image / self.cols
+ c = image - (r * self.cols)
+ d = self.getKeyMove(ke, r, c)
newImage = image + d
if newImage == image:
return
- if isFocusable(newImage):
- changeFocus(image, newImage)
+ if self.isFocusable(newImage):
+ self.changeFocus(image, newImage)
def isFocusable(self, image):
+ print ("DEBUG !!! isFocusable -- ")
return (image >= 0) and \
- (getIndexFor(image) < self.listModel.getSize())
+ (self.getIndexFor(image) < self.listModel.getSize())
def changeFocus(self, oldFocusImage, newFocusImage):
- focus(newFocusImage)
- defocus(oldFocusImage)
+ print ("DEBUG !!! changeFocus -- ")
+ self.focus(newFocusImage)
+ self.defocus(oldFocusImage)
def select(self, ke):
- setSelected(getIndexFor(getImageFromEvent(ke)))
+ print ("DEBUG !!! select -- ")
+ self.setSelected(self.getIndexFor(self.getImageFromEvent(ke)))
def focus(self, image):
+ print ("DEBUG !!! focus -- ")
self.m_aImages[image].Model.Tabstop = True
xWindow = self.m_aImages[image]
xWindow.setFocus()
def defocus(self, image):
+ print ("DEBUG !!! defocus -- ")
self.m_aImages[image].Model.Tabstop = False
'''jump to the given item (display the screen
@@ -546,11 +564,13 @@ class ImageList(ListDataListener):
'''
def display(self, i):
- isAux = (getCols() * getRows())
+ print ("DEBUG !!! display -- ")
+ isAux = (self.cols * self.rows)
ps = (self.listModel.getSize() / isAux) * isAux
self.setPageStart(ps)
def setenabled(self, b):
+ print ("DEBUG !!! setenabled -- ")
i = 0
while i < len(self.m_aImages):
UnoDialog2.setEnabled(self.m_aImages[i], b)
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index aa794b8..c3b3760 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -78,7 +78,7 @@ class DataAware(object):
try:
data = getattr(self._dataObject, self._field)
except Exception:
- print ("DEBUG !!! dataObject hasn't the attribute, su using the 'getter' method.")
+ print ("DEBUG !!! DataAware.updateUI -- dataObject hasn't the attribute, su using the 'getter' method.")
data = uno.invoke(self._dataObject, "get" + self._field, ())
ui = self.getFromUI()
if data is not ui:
@@ -111,18 +111,26 @@ class DataAware(object):
'''
def updateData(self):
+ print ("DEBUG !!! DataAware.updateData -- field: ", self._field)
+ useUno = False
try:
try:
data = getattr(self._dataObject, self._field)
except Exception:
- print ("DEBUG !!! dataObject hasn't the attribute, su using the 'getter' method.")
+ print ("DEBUG !!! DataAware.updateData -- dataObject hasn't the attribute, su using the 'getter' method.")
+ useUno = True
data = uno.invoke(self._dataObject, "get" + self._field, ())
+ print ("DEBUG !!! DataAware.updateData -- data: ", data)
ui = self.getFromUI()
+ print ("DEBUG !!! DataAware.updateData -- ui: ", ui)
if data is not ui:
if isinstance(ui,tuple):
#Selected Element listbox
ui = ui[0]
- setattr(self._dataObject, self._field, ui)
+ if useUno:
+ uno.invoke(self._dataObject, "set" + self._field, (ui,))
+ else:
+ setattr(self._dataObject, self._field, ui)
self.enableControls(ui)
except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py
new file mode 100644
index 0000000..cb1cdc3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.py
@@ -0,0 +1,33 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+import uno
+
+from .DataAware import DataAware
+
+class SimpleDataAware(DataAware):
+
+ def __init__(self, dataObject, field, control_, controlField_):
+ super(SimpleDataAware, self).__init__(dataObject, field)
+ self.control = control_
+ self.controlField = controlField_
+
+ def setToUI(self, value):
+ uno.invoke(self.control, "set" + self.controlField, (value,))
+
+ def getFromUI(self):
+ return uno.invoke(self.control, "get" + self.controlField, ())
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index 13d5f08..b739dd4 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -53,7 +53,12 @@ class UnoDataAware(DataAware):
elif self.isShort:
print ("DEBUG !!! value is sort: ", value)
value = uno.Any("[]short", (value,))
- setattr(self.unoModel, self.unoPropName, value)
+ if (hasattr(self.unoModel, self.unoPropName)):
+ setattr(self.unoModel, self.unoPropName, value)
+ else:
+ print ("DEBUG !!! UnoDataAware.setToUI -- dataObject hasn't the attribute, su using the 'setter' method.")
+ uno.invoke(self.unoModel, "set" + self.unoPropName, (ui,))
+
def getFromUI(self):
return getattr(self.unoModel, self.unoPropName)
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index 5a1b477..3ca83d99 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.DocumentPreview import DocumentPreview
from ..ui.event.DataAware import DataAware
from ..ui.event.Task import Task
@@ -360,6 +363,10 @@ class WWD_Startup(WWD_General):
self.lstLoadSettings.Model.SelectedItems = (selectedSession,)
+ def designItemChanged(self, itemEvent):
+ print ("DEBUG !!! designItemChanged --")
+ self.sda.updateData()
+
'''
attaches to each ui-data-control (like checkbox, groupbox or
textbox, no buttons though), a DataObject's JavaBean Property,
@@ -368,8 +375,8 @@ class WWD_Startup(WWD_General):
def makeDataAware(self):
#page 1
- ListModelBinder(
- self.lstLoadSettings, self.settings.cp_SavedSessions)
+ ListModelBinder(self.lstLoadSettings, self.settings.cp_SavedSessions)
+
#page 2 : document properties
self.docListDA = UnoDataAware.attachListBox(
self, "selectedDoc", self.lstDocuments, False)
@@ -390,13 +397,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 = 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);
- #COMMENTED
- #self.sda = SimpleDataAware.SimpleDataAware_unknown(design, DataAware.PropertyValue ("Layout", design), ilLayouts, DataAware.PropertyValue ("Selected", ilLayouts))
-
- #self.ilLayouts.addItemListener(None)
#page 4 : layout 2
self.designAware.append(UnoDataAware.attachCheckBox(
design, "cp_DisplayDescription", self.chbDocDesc, True))
commit 9c844eba0bd8095e1bee40d1d0bf3f95cf46bb5b
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Tue Mar 26 12:46:25 2013 +0000
WWD_Events: Asigning the settings to the new added document.
Change-Id: Ideaac40f49a78ecaa72648d2f64ffe7747a6ede1
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index 8db0093..309c11e 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -956,6 +956,7 @@ class WWD_Events(WWD_Startup):
for i in range(start, len(self.files)):
doc = CGDocument()
+ doc.root = self.parent.settings
if start == 0:
doc.cp_URL = self.files[i]
commit 98b33e3303b87816b356f3f3acbf017162cf8a24
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Mon Mar 25 10:29:03 2013 +0000
Avoid using static attributes, using instance ones instead.
Change-Id: I1584ec795fd62740d4e1a25e8dbffb49eec9c3f5
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index 6b5dc43..8db0093 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -51,10 +51,6 @@ session methods.
class WWD_Events(WWD_Startup):
- iconsDialog = None
- bgDialog = None
- docPreview = None
-
'''
He - my constructor !
I add a window listener, which, when
@@ -70,6 +66,8 @@ class WWD_Events(WWD_Startup):
self.exitOnCreate = True
self.time = 0
self.count = 0
+ self.bgDialog = None
+ self.iconsDialog = None
@classmethod
def main(self, args):
@@ -94,7 +92,7 @@ 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)
@@ -136,7 +134,7 @@ class WWD_Events(WWD_Startup):
view = Configuration.getNode(sessionToLoad, view)
session = CGSession()
- session.root = WWD_Startup.settings
+ session.root = self.settings
print ("DEBUG !!! loadSession -- reading configuration ...")
session.readConfiguration(view, CONFIG_READ_PARAM)
numDocs = session.cp_Content.cp_Documents.getSize()
@@ -178,16 +176,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
@@ -221,7 +219,7 @@ 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.")
@@ -230,9 +228,9 @@ class WWD_Events(WWD_Startup):
#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.selectedDoc = s
if (doc is not None):
self.mountList(doc, self.docAware)
self.disableDocUpDown()
@@ -247,7 +245,7 @@ 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
@@ -281,17 +279,17 @@ 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.
self.docListDA.updateUI()
@@ -305,12 +303,12 @@ 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)
+ 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()
@@ -320,12 +318,12 @@ 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)
+ 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()
@@ -343,18 +341,18 @@ class WWD_Events(WWD_Startup):
print ("DEBUG !!! chooseBackground --")
try:
self.setEnabled(self.btnBackgrounds, False)
- if WWD_Events.bgDialog is None:
- WWD_Events.bgDialog = BackgroundsDialog(
- self.xMSF, WWD_Startup.settings.cp_BackgroundImages,
+ if self.bgDialog is None:
+ self.bgDialog = BackgroundsDialog(
+ self.xMSF, self.settings.cp_BackgroundImages,
self.resources)
- WWD_Events.bgDialog.createWindowPeer(self.xUnoDialog.Peer)
+ self.bgDialog.createWindowPeer(self.xUnoDialog.Peer)
- WWD_Events.bgDialog.setSelected(
- WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
- i = WWD_Events.bgDialog.executeDialogFromParent(self)
+ self.bgDialog.setSelected(
+ self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
+ i = self.bgDialog.executeDialogFromParent(self)
if i == 1:
#ok
- self.setBackground(WWD_Events.bgDialog.getSelected())
+ self.setBackground(self.bgDialog.getSelected())
except Exception:
traceback.print_exc()
finally:
@@ -369,7 +367,7 @@ class WWD_Events(WWD_Startup):
if background is None:
background = ""
- WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage \
+ self.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage \
= background
self.refreshStylePreview()
@@ -381,18 +379,20 @@ class WWD_Events(WWD_Startup):
print ("DEBUG !!! chooseIconset --")
try:
self.setEnabled(self.btnIconSets, False)
- if WWD_Events.iconsDialog is None:
- WWD_Events.iconsDialog = IconsDialog(
- self.xMSF, WWD_Startup.settings.cp_IconSets,
+ if self.iconsDialog is None:
+ self.iconsDialog = IconsDialog(
+ self.xMSF, self.settings.cp_IconSets,
self.resources)
- WWD_Events.iconsDialog.createWindowPeer(self.xUnoDialog.Peer)
+ self.iconsDialog.createWindowPeer(self.xUnoDialog.Peer)
- WWD_Events.iconsDialog.setIconset(
- WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet)
- i = WWD_Events.iconsDialog.executeDialogFromParent(self)
+ print ("DEBUG !!! chooseIconset -- cp_IconSet: ", self.settings.cp_DefaultSession.cp_Design.cp_IconSet)
+ self.iconsDialog.setIconset(
+ self.settings.cp_DefaultSession.cp_Design.cp_IconSet)
+ i = self.iconsDialog.executeDialogFromParent(self)
+ print ("DEBUG !!! chooseIconset -- i: ", i)
if i == 1:
#ok
- self.setIconset(WWD_Events.iconsDialog.getIconset())
+ self.setIconset(self.iconsDialog.getIconset())
except Exception:
traceback.print_exc()
finally:
@@ -404,7 +404,7 @@ class WWD_Events(WWD_Startup):
def setIconset(self, icon):
print ("DEBUG !!! setIconset -- icon: ", icon)
- WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet = icon
+ self.settings.cp_DefaultSession.cp_Design.cp_IconSet = icon
self.updateIconsetText()
'''
@@ -448,7 +448,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)
@@ -482,7 +482,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
@@ -676,7 +676,7 @@ class WWD_Events(WWD_Startup):
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
@@ -699,32 +699,32 @@ class WWD_Events(WWD_Startup):
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()
@@ -848,12 +848,12 @@ class WWD_Events(WWD_Startup):
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()
@@ -897,11 +897,11 @@ class WWD_Events(WWD_Startup):
self.dpStylePreview.dispose()
self.stylePreview.cleanup()
- if WWD_Events.bgDialog is not None:
- WWD_Events.bgDialog.xUnoDialog.dispose()
+ if self.bgDialog is not None:
+ self.bgDialog.xUnoDialog.dispose()
- if WWD_Events.iconsDialog is not None:
- WWD_Events.iconsDialog.xUnoDialog.dispose()
+ if self.iconsDialog is not None:
+ self.iconsDialog.xUnoDialog.dispose()
if self.ftpDialog is not None:
self.ftpDialog.xUnoDialog.dispose()
@@ -924,7 +924,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()
+ offset = self.parent.selectedDoc[0] + 1 if (len(self.parent.selectedDoc) > 0) else self.parent.getDocsCount()
print ("DEBUG !!! loadDocuments -- offset: ", offset)
'''
@@ -944,9 +944,9 @@ class WWD_Events(WWD_Startup):
# 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])
'''
@@ -969,10 +969,10 @@ 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
diff --git a/wizards/com/sun/star/wizards/web/WWD_General.py b/wizards/com/sun/star/wizards/web/WWD_General.py
index 58a4c4c..7dd6cf6c 100644
--- a/wizards/com/sun/star/wizards/web/WWD_General.py
+++ b/wizards/com/sun/star/wizards/web/WWD_General.py
@@ -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),
@@ -118,10 +118,10 @@ class WWD_General(WebWizardDialog):
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 +129,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 +146,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 +205,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
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index da98963..5a1b477 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -80,9 +80,6 @@ are the controller inbetween.
class WWD_Startup(WWD_General):
- selectedDoc = []
- ftp = False
-
'''
He - my constructor !
I call/do here in this order: <br/>
@@ -106,6 +103,8 @@ class WWD_Startup(WWD_General):
def __init__(self, xmsf):
super(WWD_Startup, self).__init__(xmsf)
+ self.selectedDoc = []
+ self.ftp = False
self.sda = None
self.docAware = []
self.designAware = []
@@ -131,11 +130,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()
@@ -182,9 +181,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:]))
@@ -250,9 +249,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)
@@ -264,23 +263,24 @@ class WWD_Startup(WWD_General):
'''
def loadSettings(self, document):
+ print ("DEBUG !!! loadSettings -- ")
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()):
@@ -289,12 +289,17 @@ class WWD_Startup(WWD_General):
p.cp_URL = self.substitute(p.cp_URL)
except Exception:
traceback.print_exc()
+
+ print ("DEBUG !!! loadSettings -- cp_IconSet: ", self.settings.cp_DefaultSession.cp_Design.cp_IconSet)
+ print ("DEBUG !!! loadSettings -- cp_Layout: ", self.settings.cp_DefaultSession.cp_Design.cp_Layout)
+ print ("DEBUG !!! loadSettings -- cp_Style: ", self.settings.cp_DefaultSession.cp_Design.cp_Style)
+
# 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
@@ -305,16 +310,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,30 +333,30 @@ class WWD_Startup(WWD_General):
print ("Filling lstLoadSettings with cp_SavedSessions ...")
ListModelBinder.fillList(self.lstLoadSettings,
- WWD_General.settings.cp_SavedSessions.childrenList, None)
+ self.settings.cp_SavedSessions.childrenList, None)
print ("lstLoadSettings filled !!!")
# set the selected session to load. (step 1)
self.selectSession()
# fill the styles list.
print ("Filling lstStyles with cp_Styles ...")
ListModelBinder.fillList(self.lstStyles,
- WWD_General.settings.cp_Styles.childrenList, None)
+ self.settings.cp_Styles.childrenList, None)
print ("lstStyles filled !!!")
# fill the save session combobox (step 7)
print ("Filling cbSaveSettings with savedSessions ...")
ListModelBinder.fillComboBox(self.cbSaveSettings,
- WWD_General.settings.savedSessions.childrenList, None)
+ self.settings.savedSessions.childrenList, None)
print ("cbSaveSettings filled !!!")
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,)
@@ -364,7 +369,7 @@ class WWD_Startup(WWD_General):
def makeDataAware(self):
#page 1
ListModelBinder(
- self.lstLoadSettings, WWD_General.settings.cp_SavedSessions)
+ self.lstLoadSettings, self.settings.cp_SavedSessions)
#page 2 : document properties
self.docListDA = UnoDataAware.attachListBox(
self, "selectedDoc", self.lstDocuments, False)
@@ -376,7 +381,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(
@@ -386,7 +391,7 @@ class WWD_Startup(WWD_General):
self.docAware.append(UnoDataAware.attachListBox(
doc, "Exporter", self.lstDocTargetType, False))
#page 3 : Layout
- design = WWD_General.settings.cp_DefaultSession.cp_Design
+ design = self.settings.cp_DefaultSession.cp_Design
#COMMENTED
#self.sda = SimpleDataAware.SimpleDataAware_unknown(design, DataAware.PropertyValue ("Layout", design), ilLayouts, DataAware.PropertyValue ("Selected", ilLayouts))
@@ -412,7 +417,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))
@@ -422,26 +427,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,
+ 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_(
@@ -451,7 +456,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)
'''
@@ -463,7 +468,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]
@@ -495,7 +500,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)
@@ -564,11 +569,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,28 +636,12 @@ class WWD_Startup(WWD_General):
try:
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)
-
- #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
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:
@@ -666,11 +650,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:
@@ -689,8 +673,8 @@ class WWD_Startup(WWD_General):
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()
commit 8f30512462da5629554260877a91490b2c9fcf5c
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Tue Mar 26 11:40:26 2013 +0000
Implementing the docUp/docDown functionality when importing docs.
Change-Id: I3188e2aa2794354907f69b964e730dfe724870b9
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index 040edb9..6b5dc43 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -294,7 +294,7 @@ class WWD_Events(WWD_Startup):
WWD_Startup.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()
@@ -311,7 +311,7 @@ class WWD_Events(WWD_Startup):
WWD_Startup.selectedDoc[0])
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add(
WWD_Startup.selectedDoc[0] - 1, doc)
- docListDA.updateUI()
+ self.docListDA.updateUI()
self.disableDocUpDown()
'''
@@ -326,7 +326,7 @@ class WWD_Events(WWD_Startup):
WWD_Startup.selectedDoc[0])
WWD_Startup.settings.cp_DefaultSession.cp_Content.cp_Documents.add(
(WWD_Startup.selectedDoc[0] + 1), doc)
- docListDA.updateUI()
+ self.docListDA.updateUI()
self.disableDocUpDown()
'''
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index dacedc3..da98963 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -634,21 +634,24 @@ 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)
+
+ #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
except Exception:
traceback.print_exc()
commit ec44b63340a8327d5b05fba5ed58280bb92af4ba
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Tue Mar 26 11:38:40 2013 +0000
Implementing the ListDataListener functionality.
Change-Id: I9ba4e3032b918ea55b53f7963ccf86f859d59f50
diff --git a/wizards/Pyuno_commonwizards.mk b/wizards/Pyuno_commonwizards.mk
index 52da446..a62b356 100644
--- a/wizards/Pyuno_commonwizards.mk
+++ b/wizards/Pyuno_commonwizards.mk
@@ -74,6 +74,9 @@ $(eval $(call gb_Pyuno_add_files,wizards,\
ui/event/Task.py \
ui/event/TaskEvent.py \
ui/event/TaskListener.py \
+ ui/event/ListDataEvent.py \
+ ui/event/ListDataListener.py \
+ ui/event/EventListenerList.py \
))
# vim:set noet sw=4 ts=4:
diff --git a/wizards/com/sun/star/wizards/common/ListModel.py b/wizards/com/sun/star/wizards/common/ListModel.py
index 30cbde9..7a14f14 100644
--- a/wizards/com/sun/star/wizards/common/ListModel.py
+++ b/wizards/com/sun/star/wizards/common/ListModel.py
@@ -31,3 +31,9 @@ class ListModel(object):
@abstractmethod
def elements(self):
pass
+
+ def addListDataListener(self, listener):
+ pass
+
+ def removeListDataListener(self, listener):
+ pass
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.py b/wizards/com/sun/star/wizards/ui/ImageList.py
index ff596f3..6e46908 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.py
+++ b/wizards/com/sun/star/wizards/ui/ImageList.py
@@ -25,6 +25,7 @@ from .event.CommonListener import OMouseListenerProcAdapter
from ..common.PropertyNames import PropertyNames
from ..common.HelpIds import HelpIds
from ..common.IRenderer import IRenderer
+from .event.ListDataListener import ListDataListener
from com.sun.star.awt import Size
@@ -40,7 +41,7 @@ def synchronized(lock):
return newFunction
return wrap
-class ImageList(object):
+class ImageList(ListDataListener):
NO_BORDER = 0
BACKGROUND_COLOR = 16777216
HIDE_PAGE = 99
@@ -186,8 +187,7 @@ class ImageList(object):
self.m_aImages[r * self.cols + c] = self.createImage(dialog, r, c)
self.refreshImages()
- #COMMENTED
- #ImageList.listModel.addListDataListener(None)
+ self.listModel.addListDataListener(self)
#used for optimization
diff --git a/wizards/com/sun/star/wizards/ui/event/EventListenerList.py b/wizards/com/sun/star/wizards/ui/event/EventListenerList.py
new file mode 100644
index 0000000..9b475a7
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/EventListenerList.py
@@ -0,0 +1,30 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+class EventListenerList(object):
+
+ def __init__(self):
+ self.list = []
+
+ def add(self, listener):
+ self.list.append(listener)
+
+ def remove(self, listener):
+ self.list.remove(listener)
+
+ def getListenerList(self):
+ return self.list
diff --git a/wizards/com/sun/star/wizards/ui/event/ListDataEvent.py b/wizards/com/sun/star/wizards/ui/event/ListDataEvent.py
new file mode 100644
index 0000000..0aeb914
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/ListDataEvent.py
@@ -0,0 +1,38 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+from com.sun.star.document import EventObject
+
+#class ListDataEvent(EventObject):
+class ListDataEvent:
+
+ INTERVAL_ADDED = 1
+ INTERVAL_REMOVED = 2
+ CONTENTS_CHANGED = 3
+
+ # general constructor -
+ # @param source
+ # @param type_
+ def __init__(self, source_, type_, i0, i1):
+ #super(TaskEvent, self).__init__(source)
+ self.index0 = i0
+ self.index1 = i1
+
+ def getIndex0(self):
+ return self.index0
+
+ def getIndex1(self):
+ return self.index1
diff --git a/wizards/com/sun/star/wizards/ui/event/ListDataListener.py b/wizards/com/sun/star/wizards/ui/event/ListDataListener.py
new file mode 100644
index 0000000..56b4c6f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/ListDataListener.py
@@ -0,0 +1,33 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+from abc import abstractmethod
+from com.sun.star.script import EventListener
+
+class ListDataListener():
+
+ @abstractmethod
+ def intervalAdded(self, lde):
+ pass
+
+ @abstractmethod
+ def intervalRemoved(self, lde):
+ pass
+
+ @abstractmethod
+ def contentsChanged(self, lde):
+ pass
diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py
index b882273..1f6f001 100644
--- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py
+++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.py
@@ -16,22 +16,25 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-class ListModelBinder(object):
+from .ListDataListener import ListDataListener
+
+class ListModelBinder(ListDataListener):
def __init__(self, unoListBox, listModel_):
self.unoList = unoListBox
self.unoListModel = unoListBox.Model
- #COMMENTED
- #self.setListModel(listModel_)
+ self.listModel = None
+ self.setListModel(listModel_)
def setListModel(self, newListModel):
if self.listModel is not None:
self.listModel.removeListDataListener(self)
self.listModel = newListModel
- self.listModel.addListDataListener(this)
+ self.listModel.addListDataListener(self)
def contentsChanged(self, lde):
+ print ("DEBUG !!! contentsChanged -- lde: ", lde)
selected = self.getSelectedItems()
i = lde.getIndex0()
while i <= lde.getIndex1():
@@ -62,11 +65,13 @@ class ListModelBinder(object):
self.unoListModel.SelectedItems = selected;
def intervalAdded(self, lde):
- for i in xrange(lde.Index0, lde.Index1):
+ print ("DEBUG !!! intervalAdded -- lde: ", lde)
+ for i in range(lde.getIndex0(), lde.getIndex1()):
self.insert(i)
def intervalRemoved(self, lde):
- self.remove(lde.Index0, lde.Index1)
+ print ("DEBUG !!! intervalRemoved -- lde: ", lde)
+ self.remove(lde.getIndex0(), lde.getIndex1())
@classmethod
def fillList(self, xlist, items, renderer):
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.py b/wizards/com/sun/star/wizards/web/IconsDialog.py
index 210d4c6..53973f0 100644
--- a/wizards/com/sun/star/wizards/web/IconsDialog.py
+++ b/wizards/com/sun/star/wizards/web/IconsDialog.py
@@ -86,6 +86,12 @@ class IconsDialog(ImageListDialog, ImageList.IImageRenderer, ListModel):
aux = self.objects[icon]
self.setSelected(aux)
+ def addListDataListener(self, listener):
+ pass
+
+ def removeListDataListener(self, listener):
+ pass
+
def getSize(self):
return self.set.getSize() * len(self.icons)
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index e9f0ec0..dacedc3 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -535,9 +535,9 @@ class WWD_Startup(WWD_General):
'''
def fillDocumentList(self, root):
+ print ("DEBUG !!! fillDocumentList -- ")
ListModelBinder.fillList(self.lstDocuments, root.cp_Documents.childrenList, None)
- #COMMENTED
- #self.docsBinder.setListModel(root.cp_Documents)
+ self.docsBinder.setListModel(root.cp_Documents)
self.disableDocUpDown()
'''
diff --git a/wizards/com/sun/star/wizards/web/WebConfigSet.py b/wizards/com/sun/star/wizards/web/WebConfigSet.py
index 88b49f2..5439b72 100644
--- a/wizards/com/sun/star/wizards/web/WebConfigSet.py
+++ b/wizards/com/sun/star/wizards/web/WebConfigSet.py
@@ -19,6 +19,9 @@ import traceback
from ..common.ConfigGroup import ConfigGroup
from ..common.Configuration import Configuration
from ..common.XMLProvider import XMLProvider
+from ..ui.event.EventListenerList import EventListenerList
+from ..ui.event.ListDataEvent import ListDataEvent
+from ..ui.event.ListDataListener import ListDataListener
class WebConfigSet(ConfigGroup):
'''
@@ -36,6 +39,7 @@ class WebConfigSet(ConfigGroup):
self.childrenMap = {}
self.childrenList = []
self.noNulls = False
+ self.listenerList = None
def add(self, name, o):
print ("DEBUG !!! WebConfigSet.add -- name: ", name)
@@ -49,6 +53,7 @@ class WebConfigSet(ConfigGroup):
i = int(name)
print ("DEBUG !!! WebConfigSet.add -- name IS an integer.")
self.childrenList.insert(i, o)
+ self.fireListDataListenerIntervalAdded(i, i);
except Exception:
print ("DEBUG !!! WebConfigSet.add -- name IS NOT an integer.")
try:
@@ -66,6 +71,7 @@ class WebConfigSet(ConfigGroup):
self.childrenList.insert(i, o)
if oldSize > i:
oldSize = i
+ self.fireListDataListenerIntervalAdded(oldSize, i);
except Exception:
if (oldO is not None):
print ("DEBUG !!! WebConfigSet.add -- No cp_Index attribute, but element already present, so replace it.")
@@ -74,6 +80,7 @@ class WebConfigSet(ConfigGroup):
else:
print ("DEBUG !!! WebConfigSet.add -- No cp_Index attribute, so just append it.")
self.childrenList.append(o)
+ self.fireListDataListenerIntervalAdded(self.getSize() - 1, self.getSize() - 1);
def writeConfiguration(self, configView, param):
@@ -121,21 +128,24 @@ class WebConfigSet(ConfigGroup):
i -= 1
i += 1
- def remove(self, obj):
- key = getKey(obj)
- self.childrenMap.remove(key)
- i = self.childrenList.indexOf(obj)
+ def remove1(self, obj):
+ key = self.getKey(obj)
+ del self.childrenMap[key]
+ i = self.childrenList.index(obj)
self.childrenList.remove(obj)
- #fireListDataListenerIntervalRemoved(i, i)
+ self.fireListDataListenerIntervalRemoved(i, i)
def remove(self, i):
- o = getElementAt(i)
- remove(o)
+ o = self.getElementAt(i)
+ self.remove1(o)
def clear(self):
self.childrenMap.clear()
del self.childrenList[:]
+ def update(i):
+ self.fireListDataListenerContentsChanged(i, i)
+
def createDOM(self, parent):
items = self.childrenList
i = 0
@@ -207,3 +217,49 @@ class WebConfigSet(ConfigGroup):
def sort(self, comparator):
self.childrenList.sort(comparator)
+
+
+ # Registers ListDataListener to receive events.
+ # @param listener The listener to register.
+ def addListDataListener(self, listener):
+ if (self.listenerList is None):
+ self.listenerList = EventListenerList()
+ self.listenerList.add(listener)
+
+ # Removes ListDataListener from the list of listeners.
+ # @param listener The listener to remove.
+ def removeListDataListener(self, listener):
+ self.listenerList.remove(listener)
+
+ # Notifies all registered listeners about the event.
+ #
+ # @param event The event to be fired
+ def fireListDataListenerIntervalAdded(self, i0, i1):
+ event = ListDataEvent(self, ListDataEvent.INTERVAL_ADDED, i0, i1)
+ if (self.listenerList is None):
+ return
+ for listener in self.listenerList.getListenerList():
+ if isinstance(listener, ListDataListener):
+ listener.intervalAdded(event)
+
+ # Notifies all registered listeners about the event.
+ #
+ # @param event The event to be fired
+ def fireListDataListenerIntervalRemoved(self, i0, i1):
+ event = ListDataEvent(self, ListDataEvent.INTERVAL_REMOVED, i0, i1)
+ if (self.listenerList is None):
+ return
+ for listener in self.listenerList.getListenerList():
+ if isinstance(listener, ListDataListener):
+ listener.intervalRemoved(event)
+
+ # Notifies all registered listeners about the event.
+ #
+ # @param event The event to be fired
+ def fireListDataListenerContentsChanged(self, i0, i1):
+ event = ListDataEvent(self, ListDataEvent.CONTENTS_CHANGED, i0, i1)
+ if (self.listenerList is None):
+ return
+ for listener in self.listenerList.getListenerList():
+ if isinstance(listener, ListDataListener):
+ listener.contentsChanged(event)
commit c9ca75779a38021dec0859b3bb5e6d31f2498e17
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Mon Mar 25 23:47:36 2013 +0000
ImageList: Fixed bug in focus and item selection.
Change-Id: I278b9e40904a780f6dd3972f7d2abb1ba05f029f
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.py b/wizards/com/sun/star/wizards/ui/ImageList.py
index 92663de..ff596f3 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.py
+++ b/wizards/com/sun/star/wizards/ui/ImageList.py
@@ -278,7 +278,7 @@ class ImageList(object):
def moveSelection(self, image):
print ("DEBUG !!! moveSelection - image: ", image)
self.grbxSelectedImage.Visible = False
- row = image / self.cols
+ row = int(image / self.cols)
if self.rowSelect:
col = 0
else:
@@ -455,7 +455,7 @@ class ImageList(object):
def getImageFromEvent(self, event):
image = (event).Source
controlName = image.Model.Name
- return int(controlName[6 + len(self.name)])
+ return int(controlName[6 + len(self.name):])
def mousePressed(self, event):
print ("DEBUG !!! mousePressed -- Mouse pressed.")
commit 810065329378cddfac929248883516fca98543eb
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Mon Mar 11 11:47:08 2013 +0000
WWD_Events: check out whether doc is None (shouldn't happen) before "mount".
Change-Id: Iaab6d49cda532fd9434a997263860a4622da0815
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index f68359e..040edb9 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -233,8 +233,9 @@ class WWD_Events(WWD_Startup):
self.fillExportList(WWD_Startup.settings.getExporters(doc.appType))
WWD_Startup.selectedDoc = s
- self.mountList(doc, self.docAware)
- self.disableDocUpDown()
+ if (doc is not None):
+ self.mountList(doc, self.docAware)
+ self.disableDocUpDown()
'''
The user clicks the "Add" button.
commit 11b9fba97e4df48dcd114fd9eb5b0bf687f456ce
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Wed Mar 6 17:12:16 2013 +0000
SystemDialog: "initialize" raises an exception. It seems win32 only.
Change-Id: I866f8424a8a01eb6860ce4e3d8050d872b46e638
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index cf640ff..307c370 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -36,8 +36,8 @@ class SystemDialog(object):
self.xStringSubstitution = self.createStringSubstitution(xMSF)
# Add a name textbox to the filepicker
- if self.systemDialog is not None:
- self.systemDialog.initialize((Type,))
+ #if self.systemDialog is not None:
+ # self.systemDialog.initialize((Type,))
except Exception:
traceback.print_exc()
commit 7fbe96d1c2000ae8613fd4538002cbc3e8670b1a
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Wed Mar 20 21:02:59 2013 +0000
CGDesign: Added getter/setter methods for style and layout attributes.
Change-Id: I9c8368cdbfad55fbf71b0e5e7d6a2baf4dce5824
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index a31806e..e9f0ec0 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -423,7 +423,7 @@ class WWD_Startup(WWD_General):
'''
self.designAware.append(UnoDataAware.attachListBox(
WWD_General.settings.cp_DefaultSession.cp_Design,
- "cp_Style", self.lstStyles, False))
+ "Style", self.lstStyles, False))
#page 6 : site general props
self.genAware.append(UnoDataAware.attachEditControl(
WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.py b/wizards/com/sun/star/wizards/web/data/CGDesign.py
index a53e40a..4887bf7 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDesign.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDesign.py
@@ -37,3 +37,19 @@ class CGDesign(ConfigGroup):
def createDOM(self, parent):
return XMLHelper.addElement(parent, "design", (0,), (0,))
+
+ def getStyle(self):
+ style = self.root.cp_Styles.getElement(self.cp_Style)
+ return [self.root.cp_Styles.getIndexOf(style)]
+
+ def setStyle(self, newStyle):
+ o = self.root.cp_Styles.getElementAt(newStyle[0])
+ self.cp_Style = self.root.cp_Styles.getKey(o)
+
+ def getLayout(self):
+ layout = self.root.cp_Layouts.getElement(self.cp_Layout)
+ return layout.cp_Index
+
+ def setLayout(self, layoutIndex):
+ layout = self.root.cp_Layouts.getElementAt(layoutIndex)
+ self.cp_Layout = self.root.cp_Layouts.getKey(layout)
commit ffbf1e2f084c518c32da773cdbf33e0410674f9c
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Wed Mar 20 21:04:24 2013 +0000
DataAware: use the getter/setter methods as alternative access.
Change-Id: I1d5e027db324098ccf88be83565f0cfb15e69c53
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index cc9cd4a..aa794b8 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -16,6 +16,7 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
+import uno
from abc import ABCMeta, abstractmethod
from ...common.PropertyNames import PropertyNames
@@ -74,7 +75,11 @@ class DataAware(object):
'''
def updateUI(self):
- data = getattr(self._dataObject, self._field)
+ try:
+ data = getattr(self._dataObject, self._field)
+ except Exception:
+ print ("DEBUG !!! dataObject hasn't the attribute, su using the 'getter' method.")
+ data = uno.invoke(self._dataObject, "get" + self._field, ())
ui = self.getFromUI()
if data is not ui:
try:
@@ -107,7 +112,11 @@ class DataAware(object):
def updateData(self):
try:
- data = getattr(self._dataObject, self._field)
+ try:
+ data = getattr(self._dataObject, self._field)
+ except Exception:
+ print ("DEBUG !!! dataObject hasn't the attribute, su using the 'getter' method.")
+ data = uno.invoke(self._dataObject, "get" + self._field, ())
ui = self.getFromUI()
if data is not ui:
if isinstance(ui,tuple):
commit d3b9ee6e20a054c717645a45cafa196c35005d4c
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Wed Mar 6 11:31:53 2013 +0000
UnoDialog: Added the "getModel" method.
Change-Id: I5b3efc56a2b2b6619426e9293192df9bb735f331
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index 8b1ffc9..40804b4 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -262,6 +262,14 @@ class UnoDialog(object):
xListBox.selectItemPos((short)(SelPos - 1), True)
@classmethod
+ def setEnabled(self, control, enabled):
+ control.Model.Enabled = enabled
+
+ @classmethod
+ def getModel(self, control):
+ return control.getModel()
+
+ @classmethod
def getDisplayProperty(self, xServiceInfo):
if xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlFixedTextModel"):
commit 42dee5e278c347de79d949d08a37eea473b29f35
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Wed Mar 6 11:30:36 2013 +0000
UnoDialog: using the "xUnoDialog" attibute instead of "xWindow".
Change-Id: I134864e4d75e26fdb1733927a8c701939d0ccbfd
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index 64542c6..8b1ffc9 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -195,8 +195,8 @@ class UnoDialog(object):
return self.xUnoDialog.execute()
def setVisible(self, parent):
- self.calculateDialogPosition(parent.xWindow.getPosSize())
- if self.xWindowPeer is None:
+ self.calculateDialogPosition(parent.xUnoDialog.getPosSize())
+ if self.xWindowPeer == None:
self.createWindowPeer()
self.xUnoDialog.setVisible(True)
commit 8fb349384b2ec4d7cc22a8c9f514fcea7c330ca1
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Thu Mar 7 09:06:15 2013 +0000
PeerConfig: fixed typos.
Change-Id: I7aa6aa58ba7b5a9523698ee604ce6df9134ce59d
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.py b/wizards/com/sun/star/wizards/ui/PeerConfig.py
index d22d54b..3a8d09f 100644
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.py
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.py
@@ -15,6 +15,8 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
+import traceback
+
from .event.CommonListener import WindowListenerProcAdapter
'''
@@ -53,14 +55,14 @@ class PeerConfig(object):
xVclWindowPeer = i.xControl.Peer
xVclWindowPeer.setProperty(i.propnames, i.propvalues)
- for i in self.aImageUrlTasks:
+ for aImageUrlTask in self.aImageUrlTasks:
if isinstance(aImageUrlTask.oResource, int):
- sImageUrl = oUnoDialog.getWizardImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
+ sImageUrl = self.oUnoDialog.getWizardImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
elif isinstance(aImageUrlTask.oResource, str):
sImageUrl = self.oUnoDialog.getImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
print ("DEBUG !!! PeerConfig.windowShow -- sImageUrl: ", sImageUrl)
if sImageUrl != "":
- Helper.setUnoPropertyValue(aImageUrlTask.oModel, PropertyNames.PROPERTY_IMAGEURL, sImageUrl)
+ aImageUrlTask.oModel.ImageURL = sImageUrl
except Exception:
traceback.print_exc()
commit c6eb87354e8d10369407dfaf5dd46890dd740282
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Sun Mar 10 13:47:53 2013 +0000
Desktop: added methods for generating the preview.
Change-Id: I10dae8cf5d6a4c9f92ac16bcd75fdfbcf4e9b606
diff --git a/wizards/com/sun/star/wizards/common/Desktop.py b/wizards/com/sun/star/wizards/common/Desktop.py
index 6dfe1ee..1bfc414 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.py
+++ b/wizards/com/sun/star/wizards/common/Desktop.py
@@ -22,6 +22,8 @@ from com.sun.star.frame.FrameSearchFlag import ALL, PARENT
from com.sun.star.util import URL
from com.sun.star.i18n.KParseTokens import ANY_LETTER_OR_NUMBER, ASC_UNDERSCORE
+from com.sun.star.util import URL
+
class Desktop(object):
@@ -51,9 +53,11 @@ class Desktop(object):
@classmethod
def getDispatcher(self, xMSF, xFrame, _stargetframe, oURL):
try:
+ print ("DEBUG !!! getDispatcher -- oURL: ", oURL)
oURLArray = list(range(1))
oURLArray[0] = oURL
- xDispatch = xFrame.queryDispatch(oURLArray[0], _stargetframe, ALL)
+ xDispatch = xFrame.queryDispatch(oURL, _stargetframe, ALL)
+ print ("DEBUG !!! getDispatcher -- xDispatch : ", xDispatch)
return xDispatch
except Exception:
traceback.print_exc()
@@ -129,3 +133,18 @@ class Desktop(object):
def getUniqueName(self, xElementContainer, sElementName):
sIncSuffix = self.getIncrementSuffix(xElementContainer, sElementName)
return sElementName + sIncSuffix
+
+ @classmethod
+ def getDispatchURL(self, xMSF, _sURL):
+ try:
+ print ("DEBUG !!! getDispatchURL -- s_URL: ", _sURL)
+ oTransformer = xMSF.createInstance("com.sun.star.util.URLTransformer")
+ oURL = list(range(1))
+ oURL[0] = URL()
+ oURL[0].Complete = _sURL
+ oTransformer.parseStrict(oURL[0])
+ print ("DEBUG !!! getDispatchURL -- oURL: ", oURL)
+ return oURL[0];
+ except Exception:
+ traceback.print_exc()
+ return None
commit 4727bcbbb659a8329b2637ff35a25f88e907129f
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Fri Mar 8 22:40:01 2013 +0000
Added templates creation code, but implementation is still pending.
Change-Id: Ic74cf67d40ef86e4f609495f00d4cd7e69ac777d
diff --git a/wizards/com/sun/star/wizards/web/Process.py b/wizards/com/sun/star/wizards/web/Process.py
index 1516cad..8ebbb8d 100644
--- a/wizards/com/sun/star/wizards/web/Process.py
+++ b/wizards/com/sun/star/wizards/web/Process.py
@@ -345,8 +345,7 @@ class Process(ProcessErrors):
@classmethod
def generate1(self, xmsf, layout, doc, fileAccess, targetPath, task):
# a map that contains xsl templates. the keys are the xsl file names.
- #templates = layout.getTemplates(xmsf)
- templates = {}
+ templates = layout.getTemplates(xmsf)
task.advance1(True, TASK_GENERATE_XSL)
diff --git a/wizards/com/sun/star/wizards/web/data/CGLayout.py b/wizards/com/sun/star/wizards/web/data/CGLayout.py
index 9830664..e05e9a7 100644
--- a/wizards/com/sun/star/wizards/web/data/CGLayout.py
+++ b/wizards/com/sun/star/wizards/web/data/CGLayout.py
@@ -46,5 +46,7 @@ class CGLayout(ConfigGroup):
return [ResId, ResId + 1]
def getTemplates(self, xmsf):
- self.createTemplates(xmsf)
- return self.templates
+ # COMMENT - TODO
+ #self.createTemplates(xmsf)
+ #return self.templates
+ return {}
commit 201c0ecac46679b2b423d77fd15641901dd0d9e7
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Fri Mar 8 22:40:51 2013 +0000
FilterExporter: added new exporter class.
Change-Id: I767e0fedc0b685f87a49c1e0e13d6da238746406
diff --git a/wizards/Pyuno_web.mk b/wizards/Pyuno_web.mk
index 93b312f..c62c737 100644
--- a/wizards/Pyuno_web.mk
+++ b/wizards/Pyuno_web.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_Pyuno_add_files,web,\
export/Exporter.py \
export/AbstractExporter.py \
export/CopyExporter.py \
+ export/FilterExporter.py \
export/__init__.py \
))
$(eval $(call gb_Pyuno_set_componentfile_full,web,wizards/com/sun/star/wizards/web/web,vnd.openoffice.pymodule:wizards.web,.CallWizard))
diff --git a/wizards/com/sun/star/wizards/web/export/FilterExporter.py b/wizards/com/sun/star/wizards/web/export/FilterExporter.py
new file mode 100644
index 0000000..86266ab
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/FilterExporter.py
@@ -0,0 +1,57 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+from .AbstractExporter import AbstractExporter
+from ...common.Properties import Properties
+from ...ui.event.Task import Task
+
+from com.sun.star.io import IOException
+
+# An exporter which is configured with a filter name, and
+# uses the specified filter to export documents.
+class FilterExporter(AbstractExporter):
+
+ filterName = ""
+ 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
+
+ try:
+ document = self.openDocument(source, xmsf)
+ task.advance(True)
+ self.storeToURL1(document, target, self.filterName, self.props.getProperties1())
+ task.advance(True)
+ except IOException as iox:
+ iox.printStackTrace(System.err)
+ result = False
+ raise iox
+ finally:
+ self.closeDocument(document, xmsf)
+ self.calcFileSize(source, target, xmsf)
+ task.advance(True);
+ return result
commit 98b50f3423317e57390491fcf71e8dc7d919b18c
Author: Javier Fernandez <jfernandez at igalia.com>
Date: Mon Mar 18 11:55:40 2013 +0000
IconsDialog must implement the ListModel iface. isHighContrastModeActivated.
Change-Id: Ic60ee2c805ab7fe63ced84306ad20e29450c54bd
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.py b/wizards/com/sun/star/wizards/ui/PeerConfig.py
index 442e421..d22d54b 100644
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.py
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.py
@@ -47,6 +47,7 @@ class PeerConfig(object):
self.oHCResource = _oHCResource
def windowShown(self):
+ print ("DEBUG !!! PeerConfig.windowShow --")
try:
for i in self.m_aPeerTasks:
xVclWindowPeer = i.xControl.Peer
@@ -56,7 +57,8 @@ class PeerConfig(object):
if isinstance(aImageUrlTask.oResource, int):
sImageUrl = oUnoDialog.getWizardImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
elif isinstance(aImageUrlTask.oResource, str):
- sImageUrl = oUnoDialog.getImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
+ sImageUrl = self.oUnoDialog.getImageUrl(aImageUrlTask.oResource, aImageUrlTask.oHCResource)
+ print ("DEBUG !!! PeerConfig.windowShow -- sImageUrl: ", sImageUrl)
if sImageUrl != "":
Helper.setUnoPropertyValue(aImageUrlTask.oModel, PropertyNames.PROPERTY_IMAGEURL, sImageUrl)
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index f2b36a1..64542c6 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -28,6 +28,8 @@ class UnoDialog(object):
createDict = False
dictProperties = None
+ BisHighContrastModeActivated = None
+ xVclWindowPeer = None
def __init__(self, xMSF, PropertyNames, PropertyValues):
try:
@@ -125,8 +127,7 @@ class UnoDialog(object):
except Exception:
traceback.print_exc()
- def insertControlModel(
- self, serviceName, componentName, sPropNames, oPropValues):
+ def insertControlModel(self, serviceName, componentName, sPropNames, oPropValues):
try:
xControlModel = self.xDialogModel.createInstance(serviceName)
uno.invoke(xControlModel, "setPropertyValues",
@@ -188,6 +189,9 @@ class UnoDialog(object):
if self.xWindowPeer is None:
self.createWindowPeer()
+
+ self.xVclWindowPeer = self.xWindowPeer
+ self.BisHighContrastModeActivated = self.isHighContrastModeActivated()
return self.xUnoDialog.execute()
def setVisible(self, parent):
@@ -312,3 +316,61 @@ class UnoDialog(object):
def addResourceHandler(self, _Unit, _Module):
self.m_oResource = Resource(self.xMSF, _Unit, _Module)
+
+ def isHighContrastModeActivated(self):
+ if (self.xVclWindowPeer is not None):
+ if (self.BisHighContrastModeActivated is None):
+ nUIColor = 0
+ try:
+ nUIColor = self.xVclWindowPeer.getProperty("DisplayBackgroundColor")
+ except IllegalArgumentException:
+ traceback.print_exc()
+ return False
+
+ # TODO: The following methods could be wrapped in an own class implementation
+ nRed = self.getRedColorShare(nUIColor)
+ nGreen = self.getGreenColorShare(nUIColor)
+ nBlue = self.getBlueColorShare(nUIColor)
+ nLuminance = ((nBlue * 28 + nGreen * 151 + nRed * 77) / 256)
+ bisactivated = (nLuminance <= 25)
+ self.BisHighContrastModeActivated = bool(bisactivated)
+ return bisactivated;
+ else:
+ return self.BisHighContrastModeActivated
+ else:
+ return False
+
+
+ def getRedColorShare(self, _nColor):
+ nRed = _nColor / 65536
+ nRedModulo = _nColor % 65536
+ nGreen = nRedModulo / 256
+ nGreenModulo = (nRedModulo % 256)
+ nBlue = nGreenModulo
+ return nRed
+
+ def getGreenColorShare(self, _nColor):
+ nRed = _nColor / 65536
+ nRedModulo = _nColor % 65536
+ nGreen = nRedModulo / 256
+ return nGreen
+
+ def getBlueColorShare(self, _nColor):
+ nRed = _nColor / 65536
+ nRedModulo = _nColor % 65536
+ nGreen = nRedModulo / 256
+ nGreenModulo = (nRedModulo % 256)
+ nBlue = nGreenModulo
+ return nBlue
+
+ def getWizardImageUrl(self, _nResId, _nHCResId):
+ if (self.isHighContrastModeActivated()):
+ return "private:resource/wzi/image/" + str(_nHCResId)
+ else:
+ return "private:resource/wzi/image/" + str(_nResId)
+
+ def getImageUrl(self, _surl, _shcurl):
+ if (self.isHighContrastModeActivated()):
+ return _shcurl
+ else:
+ return _surl
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.py b/wizards/com/sun/star/wizards/web/IconsDialog.py
index d1f1ef6..210d4c6 100644
--- a/wizards/com/sun/star/wizards/web/IconsDialog.py
+++ b/wizards/com/sun/star/wizards/web/IconsDialog.py
@@ -19,6 +19,7 @@
from .ImageListDialog import ImageListDialog
from .WWHID import HID_IS
from ..common.FileAccess import FileAccess
+from ..common.ListModel import ListModel
from ..ui.ImageList import ImageList
from com.sun.star.awt import Size
@@ -32,7 +33,7 @@ It also implements the ImageList.ImageRenderer interface, to handle
its own objects.
'''
-class IconsDialog(ImageListDialog, ImageList.IImageRenderer):
+class IconsDialog(ImageListDialog, ImageList.IImageRenderer, ListModel):
def __init__(self, xmsf, set_, resources):
super(IconsDialog, self).__init__(xmsf, HID_IS,
@@ -49,7 +50,7 @@ class IconsDialog(ImageListDialog, ImageList.IImageRenderer):
self.icons = \
["firs", "prev", "next", "last", "nav", "text", "up", "down"]
self.set = set_
- self.objects = (self.set.getSize() * len(self.icons),)
+ self.objects = range(self.set.getSize() * len(self.icons))
self.il.listModel = self
self.il.renderer = self
@@ -64,14 +65,22 @@ class IconsDialog(ImageListDialog, ImageList.IImageRenderer):
self.build()
def getIconset(self):
+ print ("DEBUG !!! getIconset -- ")
if self.getSelected() is None:
+ print ("DEBUG !!! getIconset -- selected is None")
return None
else:
- return self.set.getKey((self.getSelected()) / len(self.icons))
+ selected = self.getSelected()
+ print ("DEBUG !!! getIconset -- selected: ", selected)
+ value = int(selected / len(self.icons))
+ print ("DEBUG !!! getIconset -- value: ", value)
+ return "iconset" + str(value)
+ #return self.set.getKey(value)
def setIconset(self, iconset):
- #COMMENTED
- icon = 0 #self.set.getIndexOf(self.set.getElement(iconset)) * len(self.icons)
+ print ("DEBUG !!! setIconset -- iconset: ", iconset)
+ print ("DEBUG !!! setIconset -- elements: ", self.set.childrenMap)
+ icon = self.set.getIndexOf(self.set.getElement(iconset)) * len(self.icons)
aux = None
if icon >=0:
aux = self.objects[icon]
@@ -81,13 +90,18 @@ class IconsDialog(ImageListDialog, ImageList.IImageRenderer):
return self.set.getSize() * len(self.icons)
def getElementAt(self, arg0):
+ print ("DEBUG !!! getElementAt -- arg0: ", arg0)
+ print ("DEBUG !!! getElementAt -- size: ", len(self.objects))
return self.objects[arg0]
def getImageUrls(self, listItem):
- i = (listItem).intValue()
- iset = getIconsetNum(i)
- icon = getIconNum(i)
- sRetUrls = range(2)
+ print ("DEBUG !!! getImageUrls -- listItem: ", listItem)
+ i = listItem
+ iset = self.getIconsetNum(i)
+ icon = self.getIconNum(i)
+ print ("DEBUG !!! getImageUrls -- iset: ", iset)
+ print ("DEBUG !!! getImageUrls -- icon: ", icon)
+ sRetUrls = list(range(2))
sRetUrls[0] = self.htmlexpDirectory + "/htmlexpo/" \
+ self.getIconsetPref(iset) + self.icons[icon] + self.getIconsetPostfix(iset)
sRetUrls[1] = sRetUrls[0]
@@ -96,7 +110,8 @@ class IconsDialog(ImageListDialog, ImageList.IImageRenderer):
def render(self, object):
if object is None:
return ""
- i = (object).intValue()
+
+ i = object
iset = self.getIconsetNum(i)
return self.getIconset1(iset).cp_Name
@@ -113,4 +128,6 @@ class IconsDialog(ImageListDialog, ImageList.IImageRenderer):
return self.getIconset1(iconset).cp_FNPostfix
def getIconset1(self, i):
+ print ("DEBUG !!! getIconset1 -- : i", i)
+ print ("DEBUG !!! getIconset1 -- : size", len(self.set.childrenList))
return self.set.getElementAt(i)
diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.py b/wizards/com/sun/star/wizards/web/ImageListDialog.py
index 66f3fa9..47e7080 100644
--- a/wizards/com/sun/star/wizards/web/ImageListDialog.py
+++ b/wizards/com/sun/star/wizards/web/ImageListDialog.py
@@ -205,6 +205,7 @@ class ImageListDialog(UnoDialog2):
'''
def setSelected(self, obj):
+ print ("DEBUG !!! ImageListDialog.setSelected -- obj: ", obj)
self.il.setSelected(obj)
self.il.showSelected()
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index 6b86594..f68359e 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -339,6 +339,7 @@ class WWD_Events(WWD_Startup):
'''
def chooseBackground(self):
+ print ("DEBUG !!! chooseBackground --")
try:
self.setEnabled(self.btnBackgrounds, False)
if WWD_Events.bgDialog is None:
@@ -363,6 +364,7 @@ class WWD_Events(WWD_Startup):
'''
def setBackground(self, background):
+ print ("DEBUG !!! setBackground -- background: ", background)
if background is None:
background = ""
@@ -375,6 +377,7 @@ class WWD_Events(WWD_Startup):
'''
def chooseIconset(self):
+ print ("DEBUG !!! chooseIconset --")
try:
self.setEnabled(self.btnIconSets, False)
if WWD_Events.iconsDialog is None:
@@ -399,6 +402,7 @@ class WWD_Events(WWD_Startup):
'''
def setIconset(self, icon):
+ print ("DEBUG !!! setIconset -- icon: ", icon)
WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet = icon
self.updateIconsetText()
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list