[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Wed Aug 10 09:31:34 PDT 2011


 wizards/com/sun/star/wizards/ui/ImageList.py          |  311 +++++++++++-------
 wizards/com/sun/star/wizards/ui/UnoDialog.py          |    2 
 wizards/com/sun/star/wizards/ui/event/UnoDataAware.py |    1 
 wizards/com/sun/star/wizards/web/BackgroundsDialog.py |  194 +++++++++++
 wizards/com/sun/star/wizards/web/IconsDialog.py       |   96 +++++
 wizards/com/sun/star/wizards/web/ImageListDialog.py   |  211 ++++++++++++
 wizards/com/sun/star/wizards/web/WWD_Events.py        |  108 +++---
 wizards/com/sun/star/wizards/web/WWD_General.py       |    2 
 wizards/com/sun/star/wizards/web/WWD_Startup.py       |   51 +-
 wizards/com/sun/star/wizards/web/WebWizardDialog.py   |    2 
 wizards/com/sun/star/wizards/web/data/CGDesign.py     |   16 
 wizards/com/sun/star/wizards/web/data/CGSession.py    |    8 
 12 files changed, 787 insertions(+), 215 deletions(-)

New commits:
commit f24794fc1bcc919d3d71e9325798e6ea31f42449
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Wed Aug 10 18:30:07 2011 +0200

    Implement partly the 5th step

diff --git a/wizards/com/sun/star/wizards/ui/ImageList.py b/wizards/com/sun/star/wizards/ui/ImageList.py
index b9afce0..a8b40dc 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.py
+++ b/wizards/com/sun/star/wizards/ui/ImageList.py
@@ -23,9 +23,21 @@ class ImageList(object):
     HIDE_PAGE = 99
     TRANSPARENT = -1
     LINE_HEIGHT = 8
-    IMAGE_PROPS = ("Border", "BackgroundColor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tabstop", PropertyNames.PROPERTY_WIDTH)
-    MOVE_SELECTION = (PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP)
+    IMAGE_PROPS = ("Border", "BackgroundColor",
+        PropertyNames.PROPERTY_HEIGHT,
+        PropertyNames.PROPERTY_HELPURL,
+        PropertyNames.PROPERTY_POSITION_X,
+        PropertyNames.PROPERTY_POSITION_Y, "ScaleImage",
+        PropertyNames.PROPERTY_STEP,
+        PropertyNames.PROPERTY_TABINDEX, "Tabstop",
+        PropertyNames.PROPERTY_WIDTH)
+    MOVE_SELECTION = (PropertyNames.PROPERTY_POSITION_X,
+        PropertyNames.PROPERTY_POSITION_Y,
+        PropertyNames.PROPERTY_STEP)
     lock = RLock()
+    listModel = []
+    btnNext = None
+    btnBack = None
 
     def __init__(self):
         self.benabled = True
@@ -52,29 +64,88 @@ class ImageList(object):
         imageTextHeight = self.imageTextLines * ImageList.LINE_HEIGHT
         opeerConfig = PeerConfig(dialog)
         self.MOVE_SELECTION_VALS[2] = self.step
-        imgContainer = dialog.insertImage(self.name + "lblContainer",("BackgroundColor", "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH), (ImageList.BACKGROUND_COLOR, 1, (self.imageSize.Height + self.gap.Height) * self.rows + self.gap.Height + imageTextHeight + 1,self.pos.Width,self.pos.Height, self.step, (self.imageSize.Width + self.gap.Width) * self.cols + self.gap.Width))
+        imgContainer = dialog.insertImage(
+            self.name + "lblContainer",
+            ("BackgroundColor", "Border",
+                PropertyNames.PROPERTY_HEIGHT,
+                PropertyNames.PROPERTY_POSITION_X,
+                PropertyNames.PROPERTY_POSITION_Y,
+                PropertyNames.PROPERTY_STEP,
+                PropertyNames.PROPERTY_WIDTH),
+            (ImageList.BACKGROUND_COLOR, 1,
+                (self.imageSize.Height + self.gap.Height) \
+                    * self.rows + self.gap.Height + imageTextHeight + 1,
+                self.pos.Width,self.pos.Height, self.step,
+                (self.imageSize.Width + self.gap.Width) \
+                    * self.cols + self.gap.Width))
         opeerConfig.setPeerProperties(imgContainer,"MouseTransparent", True)
 
         if self.rowSelect:
-            selectionWidth = (self.imageSize.Width + self.gap.Width) * self.cols - self.gap.Width + (self.selectionGap.Width * 2)
+            selectionWidth = (self.imageSize.Width + self.gap.Width) \
+                * self.cols - self.gap.Width + (self.selectionGap.Width * 2)
         else:
             selectionWidth = self.imageSize.Width + (self.selectionGap.Width * 2)
 
-        self.grbxSelectedImage = dialog.insertLabel(self.name + "_grbxSelected", ("BackgroundColor", "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "Tabstop", PropertyNames.PROPERTY_WIDTH), (ImageList.TRANSPARENT, 1, self.imageSize.Height + (self.selectionGap.Height * 2), #height
-        0, #posx
-        0, #posy
-        self.step, True, selectionWidth))
+        self.grbxSelectedImage = dialog.insertLabel(
+            self.name + "_grbxSelected",
+            ("BackgroundColor", "Border",
+                PropertyNames.PROPERTY_HEIGHT,
+                PropertyNames.PROPERTY_POSITION_X,
+                PropertyNames.PROPERTY_POSITION_Y,
+                PropertyNames.PROPERTY_STEP, "Tabstop",
+                PropertyNames.PROPERTY_WIDTH),
+            (ImageList.TRANSPARENT, 1,
+                self.imageSize.Height + (self.selectionGap.Height * 2),
+                0, #height
+                0, #posx
+                0, #posy
+                self.step, True, selectionWidth))
         xWindow = self.grbxSelectedImage
         xWindow.addMouseListener(None)
-        pNames1 = (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tabstop", PropertyNames.PROPERTY_WIDTH)
-        self.lblImageText = dialog.insertLabel(self.name + "_imageText", pNames1, (imageTextHeight, "", self.pos.Width + 1, self.pos.Height + (self.imageSize.Height + self.gap.Height) * self.rows + self.gap.Height, self.step, 0, False, self.cols * (self.imageSize.Width + self.gap.Width) + self.gap.Width - 2))
+        pNames1 = (PropertyNames.PROPERTY_HEIGHT,
+                PropertyNames.PROPERTY_HELPURL,
+                PropertyNames.PROPERTY_POSITION_X,
+                PropertyNames.PROPERTY_POSITION_Y,
+                PropertyNames.PROPERTY_STEP,
+                PropertyNames.PROPERTY_TABINDEX, "Tabstop",
+                PropertyNames.PROPERTY_WIDTH)
+        self.lblImageText = dialog.insertLabel(
+            self.name + "_imageText", pNames1,
+            (imageTextHeight, "", self.pos.Width + 1,
+                self.pos.Height + (self.imageSize.Height + self.gap.Height) \
+                    * self.rows + self.gap.Height, self.step, 0, False,
+                self.cols * (self.imageSize.Width + self.gap.Width) \
+                    + self.gap.Width - 2))
         if self.showButtons:
-            self.btnBack = dialog.insertButton(self.name + "_btnBack", "prevPage", this, pNames1, (14, HelpIds.getHelpIdString((self.helpURL + 1)), self.pos.Width, self.pos.Height + (self.imageSize.Height + self.gap.Height) * self.rows + self.gap.Height + imageTextHeight + 1, self.step, self.tabIndex + 1, True, 14))
-            self.btnNext = dialog.insertButton(self.name + "_btnNext", "nextPage", this, pNames1, (14, HelpIds.getHelpIdString((self.helpURL + 1)), self.pos.Width + (self.imageSize.Width + self.gap.Width) * self.cols + self.gap.Width - 14 + 1, self.pos.Height + (self.imageSize.Height + self.gap.Height) * self.rows + self.gap.Height + imageTextHeight + 1, self.step, self.tabIndex + 2, True, 14))
-            self.lblCounter = dialog.insertLabel(self.name + "_lblCounter", pNames1, (ImageList.LINE_HEIGHT, "", self.pos.Width + 14 + 1, self.pos.Height + (self.imageSize.Height + self.gap.Height) * self.rows + self.gap.Height + imageTextHeight + ((14 - ImageList.LINE_HEIGHT) / 2), self.step, 0, False, self.cols * (self.imageSize.Width + self.gap.Width) + self.gap.Width - 2 * 14 - 1))
+            ImageList.btnBack = dialog.insertButton(
+                self.name + "_btnBack", "prevPage", pNames1,
+                (14, HelpIds.getHelpIdString((self.helpURL + 1)),
+                self.pos.Width, self.pos.Height + \
+                    (self.imageSize.Height + self.gap.Height) * \
+                    self.rows + self.gap.Height + imageTextHeight + 1,
+                self.step, self.tabIndex + 1, True, 14), self)
+            ImageList.btnNext = dialog.insertButton(
+                self.name + "_btnNext", "nextPage", pNames1,
+                (14, HelpIds.getHelpIdString((self.helpURL + 1)),
+                self.pos.Width + (self.imageSize.Width + self.gap.Width) * \
+                    self.cols + self.gap.Width - 14 + 1,
+                self.pos.Height + (self.imageSize.Height + self.gap.Height) \
+                    * self.rows + self.gap.Height + imageTextHeight + 1,
+                self.step, self.tabIndex + 2, True, 14), self)
+            self.lblCounter = dialog.insertLabel(
+                self.name + "_lblCounter", pNames1,
+                (ImageList.LINE_HEIGHT, "", self.pos.Width + 14 + 1,
+                    self.pos.Height + (self.imageSize.Height + self.gap.Height) \
+                        * self.rows + self.gap.Height + imageTextHeight + \
+                        ((14 - ImageList.LINE_HEIGHT) / 2),
+                    self.step, 0, False, self.cols * \
+                        (self.imageSize.Width + self.gap.Width) + \
+                        self.gap.Width - 2 * 14 - 1))
             Helper.setUnoPropertyValue(self.lblCounter.Model, "Align", 1)
-            Helper.setUnoPropertyValue(self.btnBack.Model, PropertyNames.PROPERTY_LABEL, "<")
-            Helper.setUnoPropertyValue(self.btnNext.Model, PropertyNames.PROPERTY_LABEL, ">")
+            Helper.setUnoPropertyValue(ImageList.btnBack.Model,
+                PropertyNames.PROPERTY_LABEL, "<")
+            Helper.setUnoPropertyValue(ImageList.btnNext.Model,
+                PropertyNames.PROPERTY_LABEL, ">")
 
         self.m_aImages = [None] * (self.rows * self.cols)
 
@@ -84,23 +155,32 @@ class ImageList(object):
 
         self.refreshImages()
         #COMMENTED
-        #self.listModel.addListDataListener(None)
+        #ImageList.listModel.addListDataListener(None)
 
     #used for optimization
 
     def createImage(self, dialog, _row, _col):
         imageName = self.name + "_image" + str(_row * self.cols + _col)
-        image = dialog.insertImage(imageName, ImageList.IMAGE_PROPS, (ImageList.NO_BORDER, ImageList.BACKGROUND_COLOR, self.imageSize.Height, HelpIds.getHelpIdString(self.helpURL + 1), self.getImagePosX(_col), self.getImagePosY(_row), self.scaleImages, self.step, self.tabIndex, False, self.imageSize.Width))
+        image = dialog.insertImage(
+            imageName, ImageList.IMAGE_PROPS,
+            (ImageList.NO_BORDER, ImageList.BACKGROUND_COLOR,
+                self.imageSize.Height,
+                HelpIds.getHelpIdString(self.helpURL + 1),
+                self.getImagePosX(_col), self.getImagePosY(_row),
+                self.scaleImages, self.step, self.tabIndex,
+                False, self.imageSize.Width))
         #COMMENTED
         image.addMouseListener(None)
         image.addKeyListener(None)
         return image
 
     def getImagePosX(self, col):
-        return self.pos.Width + col * (self.imageSize.Width + self.gap.Width) + self.gap.Width
+        return self.pos.Width + col * \
+            (self.imageSize.Width + self.gap.Width) + self.gap.Width
 
     def getImagePosY(self, row):
-        return self.pos.Height + row * (self.imageSize.Height + self.gap.Height) + self.gap.Height
+        return self.pos.Height + row * \
+            (self.imageSize.Height + self.gap.Height) + self.gap.Height
 
     def refreshImages(self):
         if self.showButtons:
@@ -114,14 +194,18 @@ class ImageList(object):
 
         focusable = True
         for index, item in enumerate(self.m_aImages):
-            oResources = self.renderer.getImageUrls(self.getObjectFor(index))
+            #COMMENTED
+            oResources = None #self.renderer.getImageUrls(self.getObjectFor(index))
             if oResources is not None:
                 if len(oResources) == 1:
-                    Helper.setUnoPropertyValue(item.Model, PropertyNames.PROPERTY_IMAGEURL, oResources[0])
+                    Helper.setUnoPropertyValue(item.Model,
+                PropertyNames.PROPERTY_IMAGEURL, oResources[0])
                 elif len(oResources) == 2:
-                    self.oUnoDialog.getPeerConfiguration().setImageUrl(item.Model, oResources[0], oResources[1])
+                    self.oUnoDialog.getPeerConfiguration().setImageUrl(
+                        item.Model, oResources[0], oResources[1])
 
-                Helper.setUnoPropertyValue(item.Model, "Tabstop", bool(focusable))
+                Helper.setUnoPropertyValue(
+                    item.Model, "Tabstop", bool(focusable))
                 if self.refreshOverNull:
                     item.Visible =  True
 
@@ -130,23 +214,29 @@ class ImageList(object):
         self.refreshSelection()
 
     def refreshCounterText(self):
-        Helper.setUnoPropertyValue(self.lblCounter.Model, PropertyNames.PROPERTY_LABEL, self.counterRenderer.render(Counter (self.pageStart + 1, pageEnd(), self.listModel.getSize())))
+        Helper.setUnoPropertyValue(
+                self.lblCounter.Model, PropertyNames.PROPERTY_LABEL,
+                self.counterRenderer.render(
+                    self.Counter (self.pageStart + 1,
+                        self.pageEnd, len(ImageList.listModel))))
 
     def pageEnd(self):
         i = self.pageStart + self.cols * self.rows
-        if i > self.listModel.getSize() - 1:
-            return self.listModel.getSize()
+        if i > ImageList.listModel.getSize() - 1:
+            return ImageList.listModel.getSize()
         else:
             return i
 
     def refreshSelection(self):
-        if self.selected < self.pageStart or self.selected >= (self.pageStart + self.rows * self.cols):
+        if self.selected < self.pageStart or \
+                self.selected >= (self.pageStart + self.rows * self.cols):
             self.hideSelection()
         else:
             self.moveSelection(self.getImageIndexFor(self.selected))
 
     def hideSelection(self):
-        Helper.setUnoPropertyValue(self.grbxSelectedImage.Model, PropertyNames.PROPERTY_STEP, ImageList.HIDE_PAGE)
+        Helper.setUnoPropertyValue(self.grbxSelectedImage.Model,
+                PropertyNames.PROPERTY_STEP, ImageList.HIDE_PAGE)
         self.grbxSelectedImage.Visible = False
 
     '''
@@ -161,30 +251,36 @@ class ImageList(object):
         else:
             col = image - (row * self.cols)
 
-        self.MOVE_SELECTION_VALS[0] = Integer.Integer_unknown(getImagePosX(col) - self.selectionGap.Width)
-        self.MOVE_SELECTION_VALS[1] = Integer.Integer_unknown(getImagePosY(row) - self.selectionGap.Height)
-        Helper.setUnoPropertyValues(self.grbxSelectedImage.Model, ImageList.MOVE_SELECTION, self.MOVE_SELECTION_VALS)
-        if (Helper.getUnoPropertyValue(self.dialogModel, PropertyNames.PROPERTY_STEP)).shortValue() == self.step.shortValue():
+        self.MOVE_SELECTION_VALS[0] = \
+            (self.getImagePosX(col) - self.selectionGap.Width)
+        self.MOVE_SELECTION_VALS[1] = \
+            (self.getImagePosY(row) - self.selectionGap.Height)
+        Helper.setUnoPropertyValues(
+            self.grbxSelectedImage.Model, ImageList.MOVE_SELECTION,
+            self.MOVE_SELECTION_VALS)
+        if (Helper.getUnoPropertyValue(self.dialogModel,
+                PropertyNames.PROPERTY_STEP)) == self.step:
             self.grbxSelectedImage.Visible = True
             #now focus...
 
-        for i in enumerate(self.m_aImages):
-            if i != image:
-                self.defocus(i)
+        for index,item in enumerate(self.m_aImages):
+            if index != image:
+                self.defocus(index)
             else:
-                Helper.setUnoPropertyValue(self.m_aImages[image].Model, "Tabstop", True)
+                Helper.setUnoPropertyValue(
+                    self.m_aImages[image].Model, "Tabstop", True)
 
     '''
     @param i
-    @return the Object in the list model corresponding to the given image index.
+    @return the Object in the list model corresponding to the given image index
     '''
 
     def getObjectFor(self, i):
         ii = self.getIndexFor(i)
-        if self.listModel.getSize() <= ii:
+        if ImageList.listModel.getSize() <= ii:
             return None
         else:
-            return self.listModel.getElementAt(ii)
+            return ImageList.listModel.getElementAt(ii)
 
     '''
     @param i
@@ -202,7 +298,8 @@ class ImageList(object):
             if event.getIndex1() <= self.selected:
                 self.selected += event.getIndex1() - event.getIndex0() + 1
 
-        if event.getIndex0() < self.pageStart or event.getIndex1() < (self.pageStart + getRows() + getCols()):
+        if event.getIndex0() < self.pageStart or \
+                event.getIndex1() < (self.pageStart + getRows() + getCols()):
             refreshImages()
 
     '''
@@ -233,8 +330,8 @@ class ImageList(object):
     '''
 
     def fireItemSelected(self):
-        with AgendaTemplate.lock:
-            if self.itemListenerList == None:
+        with ImageList.lock:
+            if self.itemListenerList is None:
                 return
 
             auxlist = self.itemListenerList.clone()
@@ -242,43 +339,41 @@ class ImageList(object):
         for i in auxlist:
             i.itemStateChanged(None)
 
-    def setSelected(self, i):
-        if self.rowSelect and (i >= 0):
-            i = (i / self.cols) * self.cols
+    def setSelected(self, _object):
+        if not isinstance(_object, int):
+            _object = -1
+            if _object is not None:
+                for index, item in enumerate(ImageList.listModel):
+                    if item == _object:
+                        _object = index
+                        return
 
-        if self.selected == i:
-            return
-
-        self.selected = i
-        refreshImageText()
-        refreshSelection()
-        fireItemSelected()
-
-    def setSelected(self, object):
-        if object == None:
-            setSelected(-1)
-        else:
-            i = 0
-            while i < getListModel().getSize():
-                if getListModel().getElementAt(i).equals(object):
-                    setSelected(i)
-                    return
+        if self.rowSelect and (_object >= 0):
+            _object = (_object / self.cols) * self.cols
 
-                i += 1
+        if self.selected == _object:
+            return
 
-        setSelected(-1)
+        self.selected = _object
+        self.refreshImageText()
+        self.refreshSelection()
+        #COMMENTED
+        #self.fireItemSelected()
 
     def refreshImageText(self):
         if self.selected >= 0:
-            item = getListModel().getElementAt(self.selected)
+            #COMMENTED
+            item = None #ImageList.listModel.getElementAt(self.selected)
         else:
             item = None
 
-        Helper.setUnoPropertyValue(self.lblImageText.Model, PropertyNames.PROPERTY_LABEL, " " + self.renderer.render(item))
+        Helper.setUnoPropertyValue(
+                self.lblImageText.Model, PropertyNames.PROPERTY_LABEL,
+                " " + self.renderer.render(item))
 
 
     def nextPage(self):
-        if self.pageStart < getListModel().getSize() - self.rows * self.cols:
+        if self.pageStart < listModel().getSize() - self.rows * self.cols:
             setPageStart(self.pageStart + self.rows * self.cols)
 
     def prevPage(self):
@@ -292,55 +387,62 @@ class ImageList(object):
         setPageStart(i)
 
     def enableButtons(self):
-        enable(self.btnNext, bool(self.pageStart + self.rows * self.cols < self.listModel.getSize()))
-        enable(self.btnBack, bool(self.pageStart > 0))
+        self.enable(
+            ImageList.btnNext,
+            bool(self.pageStart + self.rows * self.cols < len(ImageList.listModel)))
+        self.enable(ImageList.btnBack, bool(self.pageStart > 0))
 
     def enable(self, control, enable):
-        Helper.setUnoPropertyValue(control.Model, PropertyNames.PROPERTY_ENABLED, enable)
+        Helper.setUnoPropertyValue(control.Model,
+                PropertyNames.PROPERTY_ENABLED, enable)
 
     def setBorder(self, control, border):
         Helper.setUnoPropertyValue(control.Model, "Border", border)
 
     def getImageFromEvent(self, event):
         image = (event).Source
-        controlName = Helper.getUnoPropertyValue(image.Model, PropertyNames.PROPERTY_NAME)
+        controlName = Helper.getUnoPropertyValue(image.Model,
+                PropertyNames.PROPERTY_NAME)
         return Integer.valueOf(controlName.substring(6 + self.name.length()))
 
     def mousePressed(self, event):
         image = getImageFromEvent(event)
         index = getIndexFor(image)
-        if index < self.listModel.getSize():
+        if index < ImageList.listModel.getSize():
             focus(image)
             setSelected(index)
 
     def getSelectedObjects(self):
-        return[getListModel().getElementAt(self.selected)]
+        return[listModel().getElementAt(self.selected)]
 
     class SimpleCounterRenderer:
 
         def render(self, counter):
-            return "" + (counter).start + ".." + (counter).end + "/" + (counter).max
+            return \
+                "" + (counter).start + ".." + (counter).end + "/" + (counter).max
 
-    '''class Counter:
+    class Counter(object):
 
-        def __init__self, start_, end_, max_):
+        def __init__(self, start_, end_, max_):
             self.start = start_
             self.end = end_
-            self.max = max_'''
+            self.max = max_
 
     def getSelectedObject(self):
         if self.selected >= 0:
-            return getListModel().getElementAt(self.selected)
+            return listModel().getElementAt(self.selected)
         return None
 
     def showSelected(self):
         oldPageStart = self.pageStart
         if self.selected != -1:
-            self.pageStart = (self.selected / self.m_aImages.length) * self.m_aImages.length
+            self.pageStart = \
+                (self.selected / len(self.m_aImages)) * len(self.m_aImages)
 
         if oldPageStart != self.pageStart:
-            enableButtons()
-            refreshImages()
+            #COMMENTED
+            #self.enableButtons()
+            self.refreshImages()
 
     def keyPressed(self, ke):
         image = getImageFromEvent(ke)
@@ -355,54 +457,25 @@ class ImageList(object):
             changeFocus(image, newImage)
 
     def isFocusable(self, image):
-        return (image >= 0) and (getIndexFor(image) < self.listModel.getSize())
+        return (image >= 0) and \
+            (getIndexFor(image) < ImageList.listModel.getSize())
 
     def changeFocus(self, oldFocusImage, newFocusImage):
         focus(newFocusImage)
         defocus(oldFocusImage)
 
-    def getKeyMove(self, ke, row, col):
-        '''switch (ke.KeyCode)
-            {
-                case Key.UP:
-                    if (row > 0)
-                    {
-                        return 0 - getCols();
-                    }
-                    break;
-                case Key.DOWN:
-                    if (row < getRows() - 1)
-                    {
-                        return getCols();
-                    }
-                    break;
-                case Key.LEFT:
-                    if (col > 0)
-                    {
-                        return -1;
-                    }
-                    break;
-                case Key.RIGHT:
-                    if (col < getCols() - 1)
-                    {
-                        return 1;
-                    }
-                    break;
-                case Key.SPACE:
-                    select(ke);
-            }
-            return 0;'''
-
     def select(self, ke):
         setSelected(getIndexFor(getImageFromEvent(ke)))
 
     def focus(self, image):
-        Helper.setUnoPropertyValue(self.m_aImages[image].Model, "Tabstop", True)
+        Helper.setUnoPropertyValue(
+            self.m_aImages[image].Model, "Tabstop", True)
         xWindow = self.m_aImages[image]
         xWindow.setFocus()
 
     def defocus(self, image):
-        Helper.setUnoPropertyValue(self.m_aImages[image].Model, "Tabstop", False)
+        Helper.setUnoPropertyValue(
+            self.m_aImages[image].Model, "Tabstop", False)
 
     '''jump to the given item (display the screen
     that contains the given item).
@@ -411,7 +484,7 @@ class ImageList(object):
 
     def display(self, i):
         isAux = (getCols() * getRows())
-        ps = (self.listModel.getSize() / isAux) * isAux
+        ps = (ImageList.listModel.getSize() / isAux) * isAux
         setPageStart(ps)
 
     def setenabled(self, b):
@@ -422,8 +495,8 @@ class ImageList(object):
         UnoDialog2.setEnabled(self.grbxSelectedImage, b)
         UnoDialog2.setEnabled(self.lblImageText, b)
         if self.showButtons:
-            UnoDialog2.setEnabled(self.btnBack, b)
-            UnoDialog2.setEnabled(self.btnNext, b)
+            UnoDialog2.setEnabled(ImageList.btnBack, b)
+            UnoDialog2.setEnabled(ImageList.btnNext, b)
             UnoDialog2.setEnabled(self.lblCounter, b)
 
         self.benabled = b
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index 514978a..53519ec 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -262,7 +262,7 @@ class UnoDialog(object):
     '''
 
     def executeDialogFromParent(self, parent):
-        return self.executeDialog(parent.xWindow.PosSize)
+        return self.executeDialog(parent.xUnoDialog.PosSize)
 
     '''
     @param XComponent
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index 972f738..d74d518 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -72,6 +72,7 @@ class UnoDataAware(DataAware):
         checkBox.addItemListener(ItemListenerProcAdapter(method))
         return uda
 
+    @classmethod
     def attachLabel(self, data, prop, label, field):
         return UnoDataAware(data, prop, label, PropertyNames.PROPERTY_LABEL)
 
diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py
new file mode 100644
index 0000000..fad4a7c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py
@@ -0,0 +1,194 @@
+from ImageListDialog import *
+from WWHID import HID_BG
+from common.SystemDialog import SystemDialog
+from common.FileAccess import FileAccess
+
+class BackgroundsDialog(ImageListDialog):
+
+    def __init__(self, xmsf, set_, resources):
+        super(BackgroundsDialog, self).__init__(xmsf, HID_BG,
+            (resources.resBackgroundsDialog,
+                resources.resBackgroundsDialogCaption,
+                resources.resOK,
+                resources.resCancel,
+                resources.resHelp,
+                resources.resDeselect,
+                resources.resOther,
+                resources.resCounter))
+        self.sd = SystemDialog.createOpenDialog(xmsf)
+        self.sd.addFilter(
+            resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", True)
+        self.sd.addFilter(resources.resAllFiles, "*.*", False)
+        self.settings = set_.root
+        self.fileAccess = FileAccess(xmsf)
+        #COMMENTED
+        #self.il.setListModel(Model(set_))
+        self.il.imageSize = Size (40, 40)
+        #self.il.setRenderer(BGRenderer (0))
+        self.build()
+
+    '''
+    trigered when the user clicks the "other" button.
+    opens a "file open" dialog, adds the selected
+    image to the list and to the web wizard configuration,
+    and then jumps to the new image, selecting it in the list.
+    @see add(String)
+    '''
+
+    def other(self):
+        filename = self.sd.callOpenDialog(
+            False, self.settings.cp_DefaultSession.cp_InDirectory)
+        if filename != None and filename.length > 0 and filename[0] != None:
+            self.settings.cp_DefaultSession.cp_InDirectory = \
+                FileAccess.getParentDir(filename[0])
+            i = add(filename[0])
+            il.setSelected(i)
+            il.display(i)
+
+    '''
+    adds the given image to the image list (to the model)
+    and to the web wizard configuration.
+    @param s
+    @return
+    '''
+
+    def add(self, s):
+        #first i check the item does not already exists in the list...
+        i = 0
+        while i < il.getListModel().getSize():
+            if il.getListModel().getElementAt(i).equals(s):
+                return i
+
+            i += 1
+        il.getListModel().addElement(s)
+        try:
+            configView = Configuration.getConfigurationRoot(
+                self.xMSF, FileAccess.connectURLs(
+                    WebWizardConst.CONFIG_PATH, "BackgroundImages"), True)
+            i = Configuration.getChildrenNames(configView).length + 1
+            o = Configuration.addConfigNode(configView, "" + i)
+            Configuration.set(s, "Href", o)
+            Configuration.commit(configView)
+        except Exception, ex:
+            ex.printStackTrace()
+
+        return il.getListModel().getSize() - 1
+
+    '''
+    an ImageList Imagerenderer implemtation.
+    The image URL is the object given from the list model.
+    the image name, got from the "render" method is
+    the filename portion of the url.
+    @author rpiterman
+    '''
+
+    class BGRenderer(object):
+
+        def __init__(self, cut_):
+            ImageListDialog.ImageListDialog_body()
+            self.cut = cut_
+
+        def getImageUrls(self, listItem):
+            if listItem != None:
+                sRetUrls = range(1)
+                sRetUrls[0] = listItem
+                return sRetUrls
+
+            return None
+
+        def render(self, _object):
+            if _object is None:
+                return ""
+            else:
+                return FileAccess.getPathFilename(
+                    self.fileAccess.getPath(_object, None))
+
+    '''
+    This is a list model for the image list of the
+    backgrounds dialog.
+    It takes the Backgrounds config set as an argument,
+    and "parses" it to a list of files:
+    It goes through each image in the set, and checks it:
+    if it is a directory it lists all image files in this directory.
+    if it is a file, it adds the file to the list.
+    @author rpiterman
+    '''
+
+    class Model(object):
+        '''
+        constructor. </br>
+        see class description for a description of
+        the handling of the given model
+        @param model the configuration set of the background images.
+        '''
+
+        def __init__(self, model):
+            try:
+                i = 0
+                while i < model.getSize():
+                    image = model.getElementAt(i)
+                    path = self.sd.xStringSubstitution.substituteVariables(
+                        image.cp_Href, False)
+                    if self.fileAccess.exists(path, False):
+                        addDir(path)
+                    else:
+                        remove(model.getKey(image))
+
+                    i += 1
+            except Exception, ex:
+                ex.printStackTrace()
+
+        '''
+        when instanciating the model, it checks if each image
+        exists. If it doesnot, it will be removed from
+        the configuration.
+        This is what this method does...
+        @param imageName
+        '''
+
+        def remove(self, imageName):
+            try:
+                conf = Configuration.getConfigurationRoot(
+                    self.xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages",
+                    True)
+                Configuration.removeNode(conf, imageName)
+            except Exception, ex:
+                ex.printStackTrace()
+
+        '''
+        if the given url is a directory
+        adds the images in the given directory,
+        otherwise (if it is a file) adds the file to the list.
+        @param url
+        '''
+
+        def addDir(self, url):
+            if self.fileAccess.isDirectory(url):
+                add(self.fileAccess.listFiles(url, False))
+            else:
+                add(url)
+
+        '''
+        adds the given filenames (urls) to
+        the list
+        @param filenames
+        '''
+
+        def add(self, filenames):
+            i = 0
+            while i < filenames.length:
+                add(filenames[i])
+                i += 1
+
+        '''
+        adds the given image url to the list.
+        if and only if it ends with jpg, jpeg or gif
+        (case insensitive)
+        @param filename image url.
+        '''
+
+        def add(self, filename):
+            lcase = filename.toLowerCase()
+            if lcase.endsWith("jpg") or lcase.endsWith("jpeg") or \
+                    lcase.endsWith("gif"):
+                Model.this.addElement(filename)
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.py b/wizards/com/sun/star/wizards/web/IconsDialog.py
new file mode 100644
index 0000000..cc9ef11
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/IconsDialog.py
@@ -0,0 +1,96 @@
+from ImageListDialog import *
+from WWHID import HID_IS
+from common.FileAccess import FileAccess
+
+'''
+ at author rpiterman
+The dialog class for choosing an icon set.
+This class simulates a model, though it does not functions really as one,
+since it does not cast events.
+It also implements the ImageList.ImageRenderer interface, to handle
+its own objects.
+'''
+
+class IconsDialog(ImageListDialog):
+
+    def __init__(self, xmsf, set_, resources):
+        super(IconsDialog, self).__init__(xmsf, HID_IS,
+            (resources.resIconsDialog,
+                resources.resIconsDialogCaption,
+                resources.resOK,
+                resources.resCancel,
+                resources.resHelp,
+                resources.resDeselect,
+                resources.resOther,
+                resources.resCounter))
+        self.htmlexpDirectory = FileAccess.getOfficePath2(
+            xmsf, "Gallery", "share", "")
+        self.icons = \
+            ["firs", "prev", "next", "last", "nav", "text", "up", "down"]
+        self.set = set_
+        self.objects = (self.set.getSize() * len(self.icons),)
+
+        self.il.listModel = self
+        self.il.renderer = self
+        self.il.rows = 4
+        self.il.cols = 8
+        self.il.ImageSize = Size (20, 20)
+        self.il.showButtons = False
+        self.il.rowSelect = True
+        self.il.scaleImages = False
+        self.showDeselectButton = True
+        self.showOtherButton = False
+        self.build()
+
+    def getIconset(self):
+        if getSelected() == None:
+            return None
+        else:
+            return self.set.getKey((getSelected()) / len(self.icons))
+
+    def setIconset(self, iconset):
+        #COMMENTED
+        icon = 0 #self.set.getIndexOf(self.set.getElement(iconset)) * len(self.icons)
+        aux = None
+        if icon >=0:
+            aux = self.objects[icon]
+        self.setSelected(aux)
+
+    def getSize(self):
+        return self.set.getSize() * len(self.icons)
+
+    def getElementAt(self, arg0):
+        return self.objects[arg0]
+
+    def getImageUrls(self, listItem):
+        i = (listItem).intValue()
+        iset = getIconsetNum(i)
+        icon = getIconNum(i)
+        sRetUrls = range(2)
+        sRetUrls[0] = self.htmlexpDirectory + "/htmlexpo/" \
+            + getIconsetPref(iset) + self.icons[icon] + getIconsetPostfix(iset)
+        sRetUrls[1] = sRetUrls[0]
+        return sRetUrls
+
+    def render(self, object):
+        if object == None:
+            return ""
+
+        i = (object).intValue()
+        iset = getIconsetNum(i)
+        return getIconset(iset).cp_Name
+
+    def getIconsetNum(self, i):
+        return i / self.icons.length
+
+    def getIconNum(self, i):
+        return i % self.icons.length
+
+    def getIconsetPref(self, iconset):
+        return getIconset(iconset).cp_FNPrefix
+
+    def getIconsetPostfix(self, iconset):
+        return getIconset(iconset).cp_FNPostfix
+
+    def getIconset(self, i):
+        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
new file mode 100644
index 0000000..d34f690
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ImageListDialog.py
@@ -0,0 +1,211 @@
+from ui.UnoDialog2 import *
+from ui.ImageList import ImageList
+from common.HelpIds import HelpIds
+
+from com.sun.star.awt import FontDescriptor
+from com.sun.star.awt.PushButtonType import OK, CANCEL, HELP, STANDARD
+from com.sun.star.awt import Size
+
+'''
+This class is a general implementation for a
+dialog which displays a choice of images.
+The model and the renderer are
+still abstract in this class.
+To use the class one should extend it,
+in the constructor then set the imageList
+properties (member name il) like image size, grid size,
+model renderer aso, and then call "build".
+This class uses a counter renderer which
+gets an expression which contains %START %END %TOTAL and replaces
+them with the actual numbers.
+<BR/>
+two buttons: "other" and "none" which are there
+to enable choosing images that are not in the list and
+"no image" respectivley, are optional, with default to True,
+so dialogs which do not need those, should set the corresponding
+members showDeselectButton and/or showOtherButton to false.
+<br/>
+the consturctor should recieve, among others, an Array of String resources
+see constructor documentation for details.
+
+ at author rpiterman
+'''
+
+class ImageListDialog(UnoDialog2):
+    RES_TITLE = 0
+    RES_LABEL = 1
+    RES_OK = 2
+    RES_CANCEL = 3
+    RES_HELP = 4
+    RES_DESELECT = 5
+    RES_OTHER = 6
+    RES_COUNTER = 7
+    START = "%START"
+    END = "%END"
+    TOTAL = "%TOTAL"
+
+    '''
+    @param xmsf
+    @param resources_ a string array with the following strings :
+    dialog title, label text, ok, cancel, help, deselect, other.
+    <br/> if "deselect" and "other" are not displayed,
+    the array can also be shorter. but if "other" is displayed
+    and "deselect" not, both must be there :-(
+    '''
+
+    def __init__(self, xmsf, hid_, resources_):
+        super(ImageListDialog, self).__init__(xmsf)
+        self.hid = hid_
+        self.cutFilename = 0
+        self.showDeselectButton = True
+        self.showOtherButton = True
+        self.fontDescriptor1 = FontDescriptor()
+        self.resources = resources_
+        self.il = ImageList()
+        self.il.counterRenderer = self.ARenderer(
+            self.resources[ImageListDialog.RES_COUNTER])
+
+    '''
+    adds the controls to the dialog, depending on
+    the size of the image list.
+    This method should be called by subclasses after setting
+    the il ImageList member properties
+    '''
+
+    def build(self):
+        #set dialog properties...
+        ilWidth = (self.il.imageSize.Width + self.il.gap.Width) \
+            * self.il.cols + self.il.gap.Width
+        ilHeight = (self.il.imageSize.Height + self.il.gap.Height) \
+            * self.il.rows + self.il.gap.Height
+        dialogWidth = 6 + ilWidth + 6 + 50 + 6
+        dialogHeight = 3 + 16 + 3 + (ilHeight + 8 + 14) + 6
+        Helper.setUnoPropertyValues(
+            self.xDialogModel,
+            ("Closeable",
+                PropertyNames.PROPERTY_HEIGHT,
+                PropertyNames.PROPERTY_HELPURL,
+                "Moveable",
+                PropertyNames.PROPERTY_NAME,
+                PropertyNames.PROPERTY_POSITION_X,
+                PropertyNames.PROPERTY_POSITION_Y,
+                PropertyNames.PROPERTY_STEP,
+                "Title",
+                PropertyNames.PROPERTY_WIDTH),
+            (True, dialogHeight, HelpIds.getHelpIdString(self.hid), True,
+                "imgDialog", 59, 24, 1,
+                self.resources[ImageListDialog.RES_TITLE],dialogWidth))
+        #Set member- FontDescriptors...
+        self.fontDescriptor1.Weight = 150
+        PROPNAMES = ("DefaultButton",
+            PropertyNames.PROPERTY_HEIGHT,
+            PropertyNames.PROPERTY_HELPURL,
+            PropertyNames.PROPERTY_LABEL,
+            PropertyNames.PROPERTY_NAME,
+            PropertyNames.PROPERTY_POSITION_X,
+            PropertyNames.PROPERTY_POSITION_Y,
+            "PushButtonType",
+            PropertyNames.PROPERTY_TABINDEX,
+            PropertyNames.PROPERTY_WIDTH)
+        iButtonsX = 6 + ilWidth + 6
+        self.btnOK = self.insertButton(
+            "btnOK", None, PROPNAMES,
+            (True, 14, HelpIds.getHelpIdString(self.hid + 3),
+                self.resources[ImageListDialog.RES_OK], "btnOK",
+                iButtonsX, 22, uno.Any("short", OK), 7, 50), self)
+        self.btnCancel = self.insertButton(
+            "btnCancel", None, PROPNAMES,
+            (False, 14, HelpIds.getHelpIdString(self.hid + 4),
+                self.resources[ImageListDialog.RES_CANCEL], "btnCancel",
+                iButtonsX, 41, uno.Any("short", CANCEL), 8, 50), self)
+        self.btnHelp = self.insertButton(
+            "btnHelp", None, PROPNAMES,
+            (False, 14, "", self.resources[ImageListDialog.RES_HELP],
+                "CommandButton3", iButtonsX, 71,
+                uno.Any("short", HELP), 9, 50), self)
+        if self.showOtherButton:
+            aux = 0
+            if self.showDeselectButton:
+                aux = 19
+            otherY = 22 + ilHeight - 14 - aux
+            self.btnOther = self.insertButton(
+                "btnOther", "other", PROPNAMES,
+                (False, 14, HelpIds.getHelpIdString(self.hid + 1),
+                    self.resources[ImageListDialog.RES_OTHER], "btnOther",
+                    iButtonsX, otherY,
+                    uno.Any("short", STANDARD), 5, 50), self)
+
+        if self.showDeselectButton:
+            deselectY = 22 + ilHeight - 14
+            self.btnDeselect = self.insertButton(
+                "btnNoImage", "deselect", PROPNAMES,
+                (False, 14, HelpIds.getHelpIdString(self.hid + 2),
+                    self.resources[ImageListDialog.RES_DESELECT], "btnNoImage",
+                    iButtonsX, deselectY,
+                    uno.Any("short", STANDARD), 4, 50), self)
+
+        self.il.step = 1
+        self.il.pos = Size(6, 22)
+        self.il.helpURL = self.hid + 5
+        self.il.tabIndex = 1
+        self.il.create(self)
+        self.lblTitle = self.insertLabel("lblTitle",
+            ("FontDescriptor",
+                PropertyNames.PROPERTY_HEIGHT,
+                PropertyNames.PROPERTY_LABEL,
+                PropertyNames.PROPERTY_NAME,
+                PropertyNames.PROPERTY_POSITION_X,
+                PropertyNames.PROPERTY_POSITION_Y,
+                PropertyNames.PROPERTY_STEP,
+                PropertyNames.PROPERTY_TABINDEX,
+                PropertyNames.PROPERTY_WIDTH),
+            (self.fontDescriptor1, 8,
+                self.resources[ImageListDialog.RES_LABEL],
+                "lblTitle", 6, 6, 1, 4, 216))
+
+    '''
+    is called when the user clicks "none"
+    '''
+
+    def deselect(self):
+        self.il.setSelected(-1)
+
+    '''
+    @return the currently elected object.
+    '''
+
+    def getSelected(self):
+        return self.il.getSelectedObject()
+
+    '''
+    sets the currently selected object.
+    @param obj the object (out of the model) to be selected.
+    '''
+
+    def setSelected(self, obj):
+        self.il.setSelected(obj)
+        self.il.showSelected()
+
+    '''
+    The counter renderer, which uses a template.
+    The template replaces the Strings "%START", "%END" and
+    "%TOTAL" with the respective values.
+    @author rpiterman
+    '''
+    class ARenderer(object):
+
+        '''
+        @param aTempalte a template for this renderer.
+        The strings %START, %END ,%TOTAL will be replaced
+        with the actual values.
+        '''
+
+        def __init__(self, aTemplate):
+            self.template = aTemplate
+
+        def render(self, counter):
+            s = self.template.replace(ImageListDialog.START, "" + \
+                str(counter.start))
+            s = s.replace(ImageListDialog.END, "" + str(counter.end))
+            s = s.replace(ImageListDialog.TOTAL, "" + str(counter.max))
+            return s
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index 9623d9a..e15d98a 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -1,6 +1,8 @@
 import traceback
 from common.Desktop import Desktop
 from WWD_Startup import *
+from BackgroundsDialog import BackgroundsDialog
+from IconsDialog import IconsDialog
 
 '''
 This class implements the ui-events of the
@@ -14,6 +16,9 @@ session methods.
 
 class WWD_Events(WWD_Startup):
 
+    iconsDialog = None
+    bgDialog = None
+
     '''
     He - my constructor !
     I add a window listener, which, when
@@ -46,7 +51,7 @@ class WWD_Events(WWD_Startup):
         pass
 
     def enterStep(self, old, newStep):
-        if (old == 1):
+        if old == 1:
             sessionToLoad = ""
             s = Helper.getUnoPropertyValue(lstLoadWWD_Startup.settings.Model, "SelectedItems")
             if s.length == 0 or s[0] == 0:
@@ -103,7 +108,7 @@ class WWD_Events(WWD_Startup):
             if sessionToLoad == "":
                 setSaveSessionName(session)
 
-            mount(session, task, False, sd.xControl)
+            mount(session, task, False, sd.self.xUnoDialog)
             checkSteps()
             self.currentSession = sessionToLoad
             '''while task.getStatus() <= task.getMax():
@@ -133,7 +138,7 @@ class WWD_Events(WWD_Startup):
             return
 
         confirm = AbstractErrorHandler.showMessage(
-            self.xMSF, xControl.Peer, resources.resDelSessionConfirm,
+            self.xMSF, self.xUnoDialog.Peer, resources.resDelSessionConfirm,
             ErrorHandler.ERROR_QUESTION_NO)
         if confirm:
             try:
@@ -190,7 +195,7 @@ class WWD_Events(WWD_Startup):
             #the same type of document is chosen.
         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()
@@ -295,22 +300,23 @@ class WWD_Events(WWD_Startup):
 
     def chooseBackground(self):
         try:
-            setEnabled(btnBackgrounds, False)
-            if self.bgDialog == None:
-                self.bgDialog = BackgroundsDialog(
-                    self.xMSF, WWD_Startup.settings.cp_BackgroundImages, resources)
-                self.bgDialog.createWindowPeer(xControl.Peer)
-
-            self.bgDialog.setSelected(
+            self.setEnabled(self.btnBackgrounds, False)
+            if WWD_Events.bgDialog is None:
+                WWD_Events.bgDialog = BackgroundsDialog(
+                    self.xMSF, WWD_Startup.settings.cp_BackgroundImages,
+                    self.resources)
+                WWD_Events.bgDialog.createWindowPeer(self.xUnoDialog.Peer)
+
+            WWD_Events.bgDialog.setSelected(
                 WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
-            i = self.bgDialog.executeDialog(WWD_Events.this)
+            i = WWD_Events.bgDialog.executeDialogFromParent(self)
             if i == 1:
                 #ok
-                setBackground(self.bgDialog.getSelected())
-        except Exception, ex:
-            ex.printStackTrace()
+                setBackground(WWD_Events.bgDialog.getSelected())
+        except Exception:
+            traceback.print_exc()
         finally:
-            setEnabled(btnBackgrounds, True)
+            self.setEnabled(btnBackgrounds, True)
 
     '''
     invoked when the BackgorundsDialog is "OKed".
@@ -320,7 +326,8 @@ class WWD_Events(WWD_Startup):
         if background == None:
             background = ""
 
-        WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = background
+        WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage \
+            = background
         refreshStylePreview()
 
     '''
@@ -329,22 +336,23 @@ class WWD_Events(WWD_Startup):
 
     def chooseIconset(self):
         try:
-            setEnabled(btnIconSets, False)
-            if self.iconsDialog == None:
-                self.iconsDialog = IconsDialog(
-                    self.xMSF, WWD_Startup.settings.cp_IconSets, resources)
-                self.iconsDialog.createWindowPeer(xControl.Peer)
-
-            self.iconsDialog.setIconset(
+            self.setEnabled(self.btnIconSets, False)
+            if WWD_Events.iconsDialog is None:
+                WWD_Events.iconsDialog = IconsDialog(
+                    self.xMSF, WWD_Startup.settings.cp_IconSets,
+                    self.resources)
+                WWD_Events.iconsDialog.createWindowPeer(self.xUnoDialog.Peer)
+
+            WWD_Events.iconsDialog.setIconset(
                 WWD_Startup.settings.cp_DefaultSession.cp_Design.cp_IconSet)
-            i = self.iconsDialog.executeDialog(WWD_Events.this)
+            i = WWD_Events.iconsDialog.executeDialogFromParent(self)
             if i == 1:
                 #ok
-                setIconset(self.iconsDialog.getIconset())
-        except Exception, ex:
-            ex.printStackTrace()
+                self.setIconset(WWD_Events.iconsDialog.getIconset())
+        except Exception:
+            traceback.print_exc()
         finally:
-            setEnabled(btnIconSets, True)
+            self.setEnabled(btnIconSets, True)
 
     '''
     invoked when the Iconsets Dialog is OKed.
@@ -485,7 +493,7 @@ class WWD_Events(WWD_Startup):
                         message = resources.resLocalTragetNotEmpty.replace(
                             "%FILENAME", path)
                         result = AbstractErrorHandler.showMessage(
-                            self.xMSF, xControl.Peer, message,
+                            self.xMSF, self.xUnoDialog.Peer, message,
                             ErrorHandler.MESSAGE_WARNING,
                             ErrorHandler.BUTTONS_YES_NO, ErrorHandler.DEF_NO,
                             ErrorHandler.RESULT_YES)
@@ -497,7 +505,7 @@ class WWD_Events(WWD_Startup):
                     message = resources.resLocalTargetExistsAsfile.replace(
                         "%FILENAME", path)
                     AbstractErrorHandler.showMessage(
-                        self.xMSF, xControl.Peer, message,
+                        self.xMSF, self.xUnoDialog.Peer, message,
                         ErrorHandler.ERROR_PROCESS_FATAL)
                     return False
 
@@ -508,7 +516,7 @@ class WWD_Events(WWD_Startup):
                     "%FILENAME", path)
                 try:
                     result = AbstractErrorHandler.showMessage(
-                        self.xMSF, xControl.Peer, message,
+                        self.xMSF, self.xUnoDialog.Peer, message,
                         ErrorHandler.ERROR_QUESTION_YES)
                 except Exception, ex:
                     ex.printStackTrace()
@@ -523,7 +531,7 @@ class WWD_Events(WWD_Startup):
                     message = resources.resLocalTargetCouldNotCreate.replace(
                         "%FILENAME", path)
                     AbstractErrorHandler.showMessage(
-                        self.xMSF, xControl.Peer, message,
+                        self.xMSF, self.xUnoDialog.Peer, message,
                         ErrorHandler.ERROR_PROCESS_FATAL)
                     return False
 
@@ -537,7 +545,7 @@ class WWD_Events(WWD_Startup):
                     message = resources.resZipTargetIsDir.replace(
                         "%FILENAME", path)
                     AbstractErrorHandler.showMessage(
-                        self.xMSF, xControl.Peer, message,
+                        self.xMSF, self.xUnoDialog.Peer, message,
                         ErrorHandler.ERROR_PROCESS_FATAL)
                     return False
                 else:
@@ -546,7 +554,7 @@ class WWD_Events(WWD_Startup):
                         message = resources.resZipTargetExists.replace(
                             "%FILENAME", path)
                         result = AbstractErrorHandler.showMessage(
-                            self.xMSF, xControl.Peer, message,
+                            self.xMSF, self.xUnoDialog.Peer, message,
                             ErrorHandler.ERROR_QUESTION_YES)
                         if not result:
                             return False
@@ -571,7 +579,7 @@ class WWD_Events(WWD_Startup):
                         message = resources.resFTPTargetNotEmpty.replace(
                             "%FILENAME", path)
                         result = AbstractErrorHandler.showMessage(
-                            self.xMSF, xControl.Peer, message,
+                            self.xMSF, self.xUnoDialog.Peer, message,
                             ErrorHandler.ERROR_QUESTION_CANCEL)
                         if not result:
                             return result
@@ -581,7 +589,7 @@ class WWD_Events(WWD_Startup):
                     message = resources.resFTPTargetExistsAsfile.replace(
                         "%FILENAME", path)
                     AbstractErrorHandler.showMessage(
-                        self.xMSF, xControl.Peer, message,
+                        self.xMSF, self.xUnoDialog.Peer, message,
                         ErrorHandler.ERROR_PROCESS_FATAL)
                     return False
 
@@ -591,7 +599,7 @@ class WWD_Events(WWD_Startup):
                 message = resources.resFTPTargetCreate.replace(
                     "%FILENAME", path)
                 result = AbstractErrorHandler.showMessage(
-                    self.xMSF, xControl.Peer, message,
+                    self.xMSF, self.xUnoDialog.Peer, message,
                     ErrorHandler.ERROR_QUESTION_YES)
                 if not result:
                     return result
@@ -603,7 +611,7 @@ class WWD_Events(WWD_Startup):
                     message = resources.resFTPTargetCouldNotCreate.replace(
                         "%FILENAME", path)
                     AbstractErrorHandler.showMessage(
-                        self.xMSF, xControl.Peer, message,
+                        self.xMSF, self.xUnoDialog.Peer, message,
                         ErrorHandler.ERROR_PROCESS_FATAL)
                     return False
 
@@ -630,7 +638,7 @@ class WWD_Events(WWD_Startup):
                 node = Configuration.getNode(name, conf)
                 if node != None:
                     if not AbstractErrorHandler.showMessage(
-                            self.xMSF, xControl.Peer,
+                            self.xMSF, self.xUnoDialog.Peer,
                             resources.resSessionExists.replace("${NAME}", name),
                             ErrorHandler.ERROR_NORMAL_IGNORE):
                         return False
@@ -693,13 +701,13 @@ class WWD_Events(WWD_Startup):
             message = resources.resFinishedSuccess.replace(
                 "%FILENAME", targets)
             AbstractErrorHandler.showMessage(
-                self.xMSF, xControl.Peer, message, ErrorHandler.ERROR_MESSAGE)
+                self.xMSF, self.xUnoDialog.Peer, message, ErrorHandler.ERROR_MESSAGE)
             if self.exitOnCreate:
                 self.xDialog.endExecute()
 
         else:
             AbstractErrorHandler.showMessage(
-                self.xMSF, xControl.Peer, resources.resFinishedNoSuccess,
+                self.xMSF, self.xUnoDialog.Peer, resources.resFinishedNoSuccess,
                 ErrorHandler.ERROR_WARNING)
 
     def cancel(self):
@@ -812,7 +820,7 @@ class WWD_Events(WWD_Startup):
             getFileAccess().delete(p.cp_URL)
 
         try:
-            eh = ProcessErrorHandler(xMSF, xControl.Peer, resources)
+            eh = ProcessErrorHandler(xMSF, self.xUnoDialog.Peer, resources)
             self.process = Process(settings, xMSF, eh)
             pd = getStatusDialog()
             pd.setRenderer(ProcessStatusRenderer (resources))
@@ -834,11 +842,11 @@ class WWD_Events(WWD_Startup):
             self.dpStylePreview.dispose()
             self.stylePreview.cleanup()
 
-            if self.bgDialog is not None:
-                self.bgDialog.xComponent.dispose()
+            if WWD_Events.bgDialog is not None:
+                WWD_Events.bgDialog.xComponent.dispose()
 
-            if self.iconsDialog is not None:
-                self.iconsDialog.xComponent.dispose()
+            if WWD_Events.iconsDialog is not None:
+                WWD_Events.iconsDialog.xComponent.dispose()
 
             if ftpDialog is not None:
                 ftpDialog.xComponent.dispose()
@@ -901,10 +909,12 @@ class WWD_Events(WWD_Startup):
                 '''
                 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
+                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)
+                    WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.add(
+                        offset + i - failed - start, doc)
                 else:
                     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 c3df658..6fbb0dc 100644
--- a/wizards/com/sun/star/wizards/web/WWD_General.py
+++ b/wizards/com/sun/star/wizards/web/WWD_General.py
@@ -81,7 +81,7 @@ class WWD_General(WebWizardDialog):
             return None
         else:
             return \
-                WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0])
+                WWD_General.settings.cp_DefaultSession.cp_Content.cp_Documents.childrenList[s[0]]
 
     '''
     how many documents are in the list?
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py
index ccb1050..86d0091 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py
@@ -110,13 +110,13 @@ class WWD_Startup(WWD_General):
         self.ilLayouts.listModel = WWD_General.settings.cp_Layouts
         self.ilLayouts.create(self)
         #COMMENTED
-        #self.checkContent(WWD_General.settings.cp_DefaultSession.cp_Content, Task("", "", 99999), self.xUnoDialog)
+        self.checkContent(WWD_General.settings.cp_DefaultSession.cp_Content, None, self.xUnoDialog)
         #saved sessions, styles, combobox save session.
         # also set the chosen saved session...
         self.fillLists()
         self.makeDataAware()
 
-        #self.updateUI()
+        self.updateUI()
 
         # fill the documents listbox.
         self.fillDocumentList(self.settings.cp_DefaultSession.cp_Content)
@@ -194,7 +194,7 @@ class WWD_Startup(WWD_General):
         DataAware.updateUIs(self.genAware)
         DataAware.updateUIs(self.pubAware)
         self.sessionNameDA.updateUI()
-        checkPublish()
+        self.checkPublish()
 
     '''
     create the peer, add roadmap,
@@ -226,8 +226,7 @@ class WWD_Startup(WWD_General):
             self.stylePreview = StylePreview(
                 self.xMSF, WWD_General.settings.workPath)
             self.stylePreview.refresh(
-                WWD_General.settings.cp_DefaultSession.getStyle(
-                    WWD_General.settings.cp_Styles),
+                WWD_General.settings.cp_DefaultSession.getStyle(),
                 WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
             self.dpStylePreview.setDocument(
                 self.stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE)
@@ -391,7 +390,7 @@ class WWD_Startup(WWD_General):
         '''
         self.designAware.append(UnoDataAware.attachListBox(
             WWD_General.settings.cp_DefaultSession.cp_Design,
-            "Style", self.lstStyles, False))
+            "cp_Style", self.lstStyles, False))
         #page 6 : site general props
         self.genAware.append(UnoDataAware.attachEditControl(
             WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
@@ -401,10 +400,10 @@ class WWD_Startup(WWD_General):
             "cp_Description", self.txtSiteDesc, True))
         self.genAware.append(UnoDataAware.attachDateControl(
             WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
-            "CreationDate", self.dateSiteCreated, False))
+            "cp_CreationDate", self.dateSiteCreated, False))
         self.genAware.append(UnoDataAware.attachDateControl(
             WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
-            "UpdateDate", self.dateSiteUpdate, False))
+            "cp_UpdateDate", self.dateSiteUpdate, False))
         self.genAware.append(UnoDataAware.attachEditControl(
             WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
             "cp_Email", self.txtEmail, True))
@@ -412,12 +411,12 @@ class WWD_Startup(WWD_General):
             WWD_General.settings.cp_DefaultSession.cp_GeneralInfo,
             "cp_Copyright", self.txtCopyright, True))
         #page 7 : publishing
-        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.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.sessionNameDA = UnoDataAware.attachEditControl(
             WWD_General.settings.cp_DefaultSession, "cp_Name",
             self.cbSaveSettings, True)
@@ -435,11 +434,12 @@ class WWD_Startup(WWD_General):
         uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, True)
         uda.Inverse = True
         uda.disableObjects = [textbox]
-        #COMMENTED
-        '''if isLabel:
-            aux = UnoDataAware.attachLabel(p, "URL", textbox, False)
+        self.pubAware.append(uda)
+        if isLabel:
+            aux = UnoDataAware.attachLabel(p, "cp_URL", textbox, False)
         else:
-            aux = UnoDataAware.attachEditControl(p, "URL", textbox, False)'''
+            aux = UnoDataAware.attachEditControl(p, "cp_URL", textbox, False)
+        self.pubAware.append(aux)
 
     '''
     Session load methods
@@ -620,17 +620,17 @@ class WWD_Startup(WWD_General):
     def updateBackgroundText(self):
         bg = \
             WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage
-        if bg is None or bg.equals(""):
+        if bg is None or bg == "":
             bg = self.resources.resBackgroundNone
         else:
             bg = FileAccess.getPathFilename(getFileAccess().getPath(bg, None))
 
         Helper.setUnoPropertyValue(
-            txtBackground.Model, PropertyNames.PROPERTY_LABEL, bg)
+            self.txtBackground.Model, PropertyNames.PROPERTY_LABEL, bg)
 
     def updateIconsetText(self):
         iconset = WWD_General.settings.cp_DefaultSession.cp_Design.cp_IconSet
-        if iconset is None or iconset.equals(""):
+        if iconset is None or iconset == "":
             iconsetName = self.resources.resIconsetNone
         else:
             IconSet = WWD_General.settings.cp_IconSets.getElement(iconset)
@@ -651,8 +651,11 @@ class WWD_Startup(WWD_General):
 
     def refreshStylePreview(self):
         try:
-            updateBackgroundText()
-            self.stylePreview.refresh(settings.cp_DefaultSession.getStyle(), WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
-            self.dpStylePreview.reload(xMSF)
+            WWD_General.settings.cp_DefaultSession.cp_Design.cp_Style = \
+                "style" + \
+                str(WWD_General.settings.cp_DefaultSession.cp_Design.cp_Style)
+            self.updateBackgroundText()
+            self.stylePreview.refresh(WWD_General.settings.cp_DefaultSession.getStyle(), WWD_General.settings.cp_DefaultSession.cp_Design.cp_BackgroundImage)
+            self.dpStylePreview.reload(self.xMSF)
         except Exception:
             traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.py b/wizards/com/sun/star/wizards/web/WebWizardDialog.py
index fde6198..621d1da 100644
--- a/wizards/com/sun/star/wizards/web/WebWizardDialog.py
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.py
@@ -408,7 +408,7 @@ class WebWizardDialog(WizardDialog):
         self.insertLabel("lblBackground", WebWizardDialog.PROPNAMES_LBL,
             (8, self.resources.reslblBackground, "lblBackground",
                 97, 46, 5, 51, 70))
-        self.insertLabel("txtBackground",
+        self.txtBackground = self.insertLabel("txtBackground",
             ("Border",
                 PropertyNames.PROPERTY_HEIGHT,
                 PropertyNames.PROPERTY_LABEL,
diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.py b/wizards/com/sun/star/wizards/web/data/CGDesign.py
index cc873a2..c038812 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDesign.py
+++ b/wizards/com/sun/star/wizards/web/data/CGDesign.py
@@ -20,19 +20,3 @@ class CGDesign(ConfigGroup):
 
     def createDOM(self, parent):
         return XMLHelper.addElement(parent, "design", (0,), (0,))
-
-    def getStyle(self):
-        style = root.cp_Styles.getElement(self.cp_Style)
-        return [root.cp_Styles.getIndexOf(style)]
-
-    def setStyle(self, newStyle):
-        o = root.cp_Styles.getElementAt(newStyle[0])
-        self.cp_Style = root.cp_Styles.getKey(o)
-
-    def getLayout(self):
-        layout = root.cp_Layouts.getElement(self.cp_Layout)
-        return layout.cp_Index
-
-    def setLayout(self, layoutIndex):
-        layout = root.cp_Layouts.getElementAt(layoutIndex)
-        self.cp_Layout = root.cp_Layouts.getKey(layout)
diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.py b/wizards/com/sun/star/wizards/web/data/CGSession.py
index 3d7263f..9e5876c 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSession.py
+++ b/wizards/com/sun/star/wizards/web/data/CGSession.py
@@ -36,11 +36,11 @@ class CGSession(ConfigGroup):
         else:
             return "800"
 
-    def getLayout(self, layouts):
-        return layouts.getElement(self.cp_Design.cp_Layout)
+    def getLayout(self):
+        return self. root.cp_Layouts.getElement(self.cp_Design.cp_Layout)
 
-    def getStyle(self, styles):
-        return styles.getElement(self.cp_Design.cp_Style)
+    def getStyle(self):
+        return self.root.cp_Styles.getElement(self.cp_Design.cp_Style)
 
     def createDOM(self):
         factory = DocumentBuilderFactory.newInstance()


More information about the Libreoffice-commits mailing list