[Libreoffice-commits] .: 4 commits - wizards/com
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 27 17:08:05 PST 2012
wizards/com/sun/star/wizards/agenda/AgendaTemplate.py | 135 ++++---
wizards/com/sun/star/wizards/agenda/TopicsControl.py | 1
wizards/com/sun/star/wizards/common/Configuration.py | 1
wizards/com/sun/star/wizards/common/Helper.py | 177 ----------
wizards/com/sun/star/wizards/common/SystemDialog.py | 3
wizards/com/sun/star/wizards/fax/FaxDocument.py | 24 -
wizards/com/sun/star/wizards/fax/FaxWizardDialog.py | 9
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 11
wizards/com/sun/star/wizards/letter/LetterDocument.py | 23 -
wizards/com/sun/star/wizards/letter/LetterWizardDialog.py | 10
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py | 28 -
wizards/com/sun/star/wizards/text/TextDocument.py | 43 +-
wizards/com/sun/star/wizards/text/TextSectionHandler.py | 10
wizards/com/sun/star/wizards/ui/UnoDialog.py | 61 ---
wizards/com/sun/star/wizards/ui/UnoDialog2.py | 3
wizards/com/sun/star/wizards/ui/WizardDialog.py | 57 +--
wizards/com/sun/star/wizards/ui/event/UnoDataAware.py | 8
17 files changed, 199 insertions(+), 405 deletions(-)
New commits:
commit 47e7436d61539a77aa4e97de952262d858483cb7
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Nov 28 02:05:43 2012 +0100
pywizards: remove helper class
Change-Id: I899cab320edb3712b17e339b0931a0deed4425e8
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py
index 69e150c..f467c22 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.py
+++ b/wizards/com/sun/star/wizards/common/Configuration.py
@@ -18,7 +18,6 @@
import uno
import traceback
from .PropertyNames import PropertyNames
-from .Helper import Helper
class Configuration(object):
'''This class gives access to the OO configuration api.'''
diff --git a/wizards/com/sun/star/wizards/common/Helper.py b/wizards/com/sun/star/wizards/common/Helper.py
deleted file mode 100644
index 3a19e64..0000000
--- a/wizards/com/sun/star/wizards/common/Helper.py
+++ /dev/null
@@ -1,177 +0,0 @@
-#
-# 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
-import traceback
-from datetime import date as DateTime
-from .NumberFormatter import NumberFormatter
-
-from com.sun.star.uno import RuntimeException
-
-class Helper(object):
-
- @classmethod
- def setUnoPropertyValue(self, xPSet, PropertyName, PropertyValue):
- try:
- if PropertyValue is not None:
- setattr(xPSet, PropertyName, PropertyValue)
-
- except AttributeError:
- raise AttributeError( "No Such Property: '%s'" % PropertyName)
- except Exception:
- traceback.print_exc()
-
- @classmethod
- def getUnoObjectbyName(self, xName, ElementName):
- try:
- if xName.hasByName(ElementName):
- return xName.getByName(ElementName)
- else:
- raise RuntimeException()
-
- except Exception:
- traceback.print_exc()
- return None
-
- @classmethod
- def getPropertyValue(self, CurPropertyValue, PropertyName):
- for i in CurPropertyValue:
- if i is not None:
- if i.Name == PropertyName:
- return i.Value
-
- raise RuntimeException()
-
- @classmethod
- def getUnoPropertyValue(self, xPSet, PropertyName):
- try:
- if xPSet is not None:
- oObject = xPSet.getPropertyValue(PropertyName)
- return oObject
- return None
-
- except Exception:
- traceback.print_exc()
- return None
-
- @classmethod
- def getUnoArrayPropertyValue(self, xPSet, PropertyName):
- try:
- if xPSet is not None:
- oObject = xPSet.getPropertyValue(PropertyName)
- if isinstance(oObject,list):
- return getArrayValue(oObject)
-
- except Exception:
- traceback.print_exc()
-
- return None
-
- @classmethod
- def getUnoStructValue(self, xPSet, PropertyName):
- try:
- if xPSet is not None:
- if xPSet.getPropertySetInfo().hasPropertyByName(PropertyName):
- oObject = xPSet.getPropertyValue(PropertyName)
- return oObject
-
- return None
- except Exception:
- traceback.print_exc()
- return None
-
- @classmethod
- def setUnoPropertyValues(self, xMultiPSetLst, PropertyNames,
- PropertyValues):
- try:
- if xMultiPSetLst is not None:
- uno.invoke(xMultiPSetLst, "setPropertyValues",
- (PropertyNames, PropertyValues))
- else:
- for index, workwith in enumerate(PropertyNames):
- self.setUnoPropertyValue(
- xMultiPSetLst, PropertyNames[index], workwith)
-
- except Exception:
- traceback.print_exc()
-
- '''
- checks if the value of an object that represents an array is null.
- check beforehand if the Object is really an array with
- "AnyConverter.IsArray(oObject)
- @param oValue the paramter that has to represent an object
- @return a null reference if the array is empty
- '''
-
- @classmethod
- def getArrayValue(self, oValue):
- try:
- #VetoableChangeSupport Object
- oPropList = list(oValue)
- nlen = len(oPropList)
- if nlen == 0:
- return None
- else:
- return oPropList
-
- except Exception:
- traceback.print_exc()
- return None
-
- def getComponentContext(_xMSF):
- #Get the path to the extension and
- #try to add the path to the class loader
- aHelper = PropertySetHelper(_xMSF);
- aDefaultContext = aHelper.getPropertyValueAsObject("DefaultContext")
- return aDefaultContext
-
- def getMacroExpander(_xMSF):
- xComponentContext = self.getComponentContext(_xMSF);
- aSingleton = xComponentContext.getValueByName(
- "/singletons/com.sun.star.util.theMacroExpander")
- return aSingleton
-
- class DateUtils(object):
-
- def __init__(self, xmsf, document):
- defaults = xmsf.createInstance("com.sun.star.text.Defaults")
- l = Helper.getUnoStructValue(defaults, "CharLocale")
- self.formatSupplier = document
- formatSettings = self.formatSupplier.getNumberFormatSettings()
- date = Helper.getUnoPropertyValue(formatSettings, "NullDate")
- self.calendar = DateTime(date.Year, date.Month, date.Day)
- self.formatter = NumberFormatter.createNumberFormatter(xmsf,
- self.formatSupplier)
-
- '''
- @param format a constant of the enumeration NumberFormatIndex
- @return
- '''
-
- def getFormat(self, format):
- return NumberFormatter.getNumberFormatterKey(
- self.formatSupplier, format)
-
- '''
- @param date a VCL date in form of 20041231
- @return a document relative date
- '''
-
- def format(self, formatIndex, date):
- difference = date - self.calendar
- return self.formatter.convertNumberToString(formatIndex,
- difference.days)
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index 9d7e84b..ab9b463 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -17,7 +17,6 @@
#
import traceback
from .Desktop import Desktop
-from .Helper import Helper
from com.sun.star.ui.dialogs.TemplateDescription import \
FILESAVE_AUTOEXTENSION, FILEOPEN_SIMPLE
@@ -149,7 +148,7 @@ class SystemDialog(object):
try:
oFactory = self.xMSF.createInstance(
"com.sun.star.document.FilterFactory")
- oObject = Helper.getUnoObjectbyName(oFactory, filterName)
+ oObject = oFactory.getByName(filterName)
xPropertyValue = list(oObject)
for i in xPropertyValue:
if i is not None and i.Name == "UIName":
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py
index 215b355..a483343 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.py
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py
@@ -15,7 +15,7 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-from ..text.TextDocument import TextDocument, traceback, Helper, \
+from ..text.TextDocument import TextDocument, traceback, \
TextFieldHandler, Configuration
from ..text.TextSectionHandler import TextSectionHandler
from ..common.PropertyNames import PropertyNames
@@ -39,7 +39,7 @@ class FaxDocument(TextDocument):
self.xTextDocument)
oSection = \
mySectionHandler.xTextDocument.TextSections.getByName(sElement)
- Helper.setUnoPropertyValue(oSection,"IsVisible",bState)
+ oSection.IsVisible = bState
except Exception:
traceback.print_exc()
@@ -58,8 +58,7 @@ class FaxDocument(TextDocument):
if bState:
xPageStyle.setPropertyValue("FooterIsOn", True)
- xFooterText = \
- Helper.getUnoPropertyValue(xPageStyle, "FooterText")
+ xFooterText = xPageStyle.FooterText
xFooterText.String = sText
if bPageNumber:
@@ -78,8 +77,7 @@ class FaxDocument(TextDocument):
xFooterText.insertTextContent(xFooterText.End,
xPageNumberField, False)
else:
- Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn",
- False)
+ xPageStyle.FooterIsOn = False
self.xTextDocument.unlockControllers()
except Exception:
@@ -108,19 +106,17 @@ class FaxDocument(TextDocument):
oUserDataAccess = Configuration.getConfigurationRoot(
self.xMSF, "org.openoffice.UserProfile/Data", False)
myFieldHandler.changeUserFieldContent("Company",
- Helper.getUnoObjectbyName(oUserDataAccess, "o"))
+ oUserDataAccess.hasByName("o"))
myFieldHandler.changeUserFieldContent("Street",
- Helper.getUnoObjectbyName(oUserDataAccess, "street"))
+ oUserDataAccess.hasByName("street"))
myFieldHandler.changeUserFieldContent("PostCode",
- Helper.getUnoObjectbyName(oUserDataAccess, "postalcode"))
+ oUserDataAccess.hasByName("postalcode"))
myFieldHandler.changeUserFieldContent(
- PropertyNames.PROPERTY_STATE,
- Helper.getUnoObjectbyName(oUserDataAccess, "st"))
+ PropertyNames.PROPERTY_STATE, oUserDataAccess.hasByName("st"))
myFieldHandler.changeUserFieldContent("City",
- Helper.getUnoObjectbyName(oUserDataAccess, "l"))
+ oUserDataAccess.hasByName("l"))
myFieldHandler.changeUserFieldContent("Fax",
- Helper.getUnoObjectbyName(oUserDataAccess,
- "facsimiletelephonenumber"))
+ oUserDataAccess.hasByName("facsimiletelephonenumber"))
except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
index 9f033d7..308238b 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
@@ -17,8 +17,7 @@
#
from .FaxWizardDialogResources import FaxWizardDialogResources
from .FaxWizardDialogConst import FaxWizardDialogConst, HIDMAIN, HID
-from ..ui.WizardDialog import WizardDialog, uno, Helper, UIConsts, \
- PropertyNames
+from ..ui.WizardDialog import WizardDialog, uno, UIConsts, PropertyNames
from com.sun.star.awt.FontUnderline import SINGLE
@@ -31,14 +30,14 @@ class FaxWizardDialog(WizardDialog):
self.resources = FaxWizardDialogResources(xmsf)
#set dialog properties...
- Helper.setUnoPropertyValues(self.xDialogModel,
- ("Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable",
+ uno.invoke(self.xDialogModel, "setPropertyValues",
+ (("Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable",
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX,
"Title", PropertyNames.PROPERTY_WIDTH),
(True, 210, True, 104, 52, 1, 1,
- self.resources.resFaxWizardDialog_title, 310))
+ self.resources.resFaxWizardDialog_title, 310)))
self.fontDescriptor1 = \
uno.createUnoStruct('com.sun.star.awt.FontDescriptor')
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 4f7352c..1074f14 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -17,7 +17,7 @@
#
import traceback
import os.path
-from .FaxWizardDialog import FaxWizardDialog, Helper, PropertyNames, uno, HID
+from .FaxWizardDialog import FaxWizardDialog, PropertyNames, uno, HID
from .CGFaxWizard import CGFaxWizard
from .FaxDocument import FaxDocument
from ..ui.PathSelection import PathSelection
@@ -613,8 +613,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
#enable/disable roadmap item for footer page
BPaperItem = self.getRoadmapItemByID( \
FaxWizardDialogImpl.RM_FOOTER)
- Helper.setUnoPropertyValue(BPaperItem,
- PropertyNames.PROPERTY_ENABLED, bFooterPossible)
+ BPaperItem.Enabled = bFooterPossible
except Exception:
traceback.print_exc()
@@ -685,14 +684,12 @@ class FaxWizardDialogImpl(FaxWizardDialog):
def __enableSenderReceiver(self):
BPaperItem = self.getRoadmapItemByID( \
FaxWizardDialogImpl.RM_SENDERRECEIVER)
- Helper.setUnoPropertyValue(BPaperItem,
- PropertyNames.PROPERTY_ENABLED, True)
+ BPaperItem.Enabled = True
def __disableSenderReceiver(self):
BPaperItem = self.getRoadmapItemByID( \
FaxWizardDialogImpl.RM_SENDERRECEIVER)
- Helper.setUnoPropertyValue(BPaperItem,
- PropertyNames.PROPERTY_ENABLED, False)
+ BPaperItem.Enabled = False
def validatePath(self):
if self.myPathSelection.usedPathPicker:
diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.py b/wizards/com/sun/star/wizards/letter/LetterDocument.py
index f8c1ced..60fecc3 100644
--- a/wizards/com/sun/star/wizards/letter/LetterDocument.py
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.py
@@ -15,7 +15,7 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-from ..text.TextDocument import TextDocument, traceback, Helper, \
+from ..text.TextDocument import TextDocument, traceback, \
TextFieldHandler, Configuration
from ..text.TextSectionHandler import TextSectionHandler
from ..common.PropertyNames import PropertyNames
@@ -51,7 +51,7 @@ class LetterDocument(TextDocument):
self.xMSF, self.xTextDocument)
oSection = \
mySectionHandler.xTextDocument.TextSections.getByName(sElement)
- Helper.setUnoPropertyValue(oSection, "IsVisible", bState)
+ oSection.IsVisible = bState
except Exception:
traceback.print_exc()
@@ -68,9 +68,8 @@ class LetterDocument(TextDocument):
xPageStyleCollection = xNameAccess.getByName("PageStyles")
xPageStyle = xPageStyleCollection.getByName(sPageStyle)
if bState:
- Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", True)
- xFooterText = \
- Helper.getUnoPropertyValue(xPageStyle, "FooterText")
+ xPageStyle.FooterIsOn = True
+ xFooterText = xPageStyle.FooterText
xFooterText.String = sText
if bPageNumber:
#Adding the Page Number
@@ -89,8 +88,7 @@ class LetterDocument(TextDocument):
xPageNumberField, False)
else:
- Helper.setUnoPropertyValue(
- xPageStyle, "FooterIsOn", False)
+ xPageStyle.FooterIsOn = False
self.xTextDocument.unlockControllers()
except Exception:
@@ -118,17 +116,16 @@ class LetterDocument(TextDocument):
oUserDataAccess = Configuration.getConfigurationRoot(
self.xMSF, "org.openoffice.UserProfile/Data", False)
myFieldHandler.changeUserFieldContent(
- "Company", Helper.getUnoObjectbyName(oUserDataAccess, "o"))
+ "Company", oUserDataAccess.getByName("o"))
myFieldHandler.changeUserFieldContent(
- "Street", Helper.getUnoObjectbyName(oUserDataAccess, "street"))
+ "Street", oUserDataAccess.getByName("street"))
myFieldHandler.changeUserFieldContent(
- "PostCode",
- Helper.getUnoObjectbyName(oUserDataAccess, "postalcode"))
+ "PostCode", oUserDataAccess.getByName("postalcode"))
myFieldHandler.changeUserFieldContent(
- "City", Helper.getUnoObjectbyName(oUserDataAccess, "l"))
+ "City", oUserDataAccess.getByName("l"))
myFieldHandler.changeUserFieldContent(
PropertyNames.PROPERTY_STATE,
- Helper.getUnoObjectbyName(oUserDataAccess, "st"))
+ oUserDataAccess.getByName("st"))
except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
index 76c74a4..e73142a 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
@@ -18,7 +18,7 @@
from .LetterWizardDialogConst import LetterWizardDialogConst, HIDMAIN, HID
from .LetterWizardDialogResources import LetterWizardDialogResources
from ..common.HelpIds import HelpIds
-from ..ui.WizardDialog import WizardDialog, uno, Helper, PropertyNames
+from ..ui.WizardDialog import WizardDialog, uno, PropertyNames
from com.sun.star.awt.FontUnderline import SINGLE
@@ -28,9 +28,8 @@ class LetterWizardDialog(WizardDialog):
super(LetterWizardDialog, self).__init__(xmsf, HIDMAIN )
self.resources = LetterWizardDialogResources(xmsf)
- Helper.setUnoPropertyValues(
- self.xDialogModel,
- ("Closeable",
+ uno.invoke(self.xDialogModel, "setPropertyValues",
+ (("Closeable",
PropertyNames.PROPERTY_HEIGHT,
"Moveable",
PropertyNames.PROPERTY_NAME,
@@ -42,7 +41,8 @@ class LetterWizardDialog(WizardDialog):
PropertyNames.PROPERTY_WIDTH),
(True, 210, True,
"LetterWizardDialog", 104, 52, 1, 1,
- self.resources.resLetterWizardDialog_title, 310))
+ self.resources.resLetterWizardDialog_title, 310)))
+
self.fontDescriptor1 = \
uno.createUnoStruct('com.sun.star.awt.FontDescriptor')
self.fontDescriptor2 = \
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index c109b65..2c45133 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -17,8 +17,8 @@
#
import traceback
import os.path
-from .LetterWizardDialog import LetterWizardDialog, Helper, \
- PropertyNames, uno, HelpIds, HID
+from .LetterWizardDialog import LetterWizardDialog, PropertyNames, uno, \
+ HelpIds, HID
from .LetterDocument import LetterDocument, BusinessPaperObject
from .CGLetterWizard import CGLetterWizard
from ..common.NoValidPathException import NoValidPathException
@@ -570,12 +570,9 @@ class LetterWizardDialogImpl(LetterWizardDialog):
try:
xReceiverFrame = self.myLetterDoc.getFrameByName(
"Receiver Address", self.myLetterDoc.xTextDocument)
- iFrameWidth = int(Helper.getUnoPropertyValue(
- xReceiverFrame, PropertyNames.PROPERTY_WIDTH))
- iFrameX = int(Helper.getUnoPropertyValue(
- xReceiverFrame, "HoriOrientPosition"))
- iFrameY = int(Helper.getUnoPropertyValue(
- xReceiverFrame, "VertOrientPosition"))
+ iFrameWidth = int(xReceiverFrame.Width)
+ iFrameX = int(xReceiverFrame.HoriOrientPosition)
+ iFrameY = int(xReceiverFrame.VertOrientPosition)
iReceiverHeight = int(0.5 * 1000)
self.BusCompanyAddressReceiver = BusinessPaperObject(
self.myLetterDoc.xTextDocument, " ", iFrameWidth, iReceiverHeight,
@@ -689,8 +686,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
BPaperItem = \
self.getRoadmapItemByID(LetterWizardDialogImpl.RM_FOOTER)
- Helper.setUnoPropertyValue(
- BPaperItem, PropertyNames.PROPERTY_ENABLED, bFooterPossible)
+ BPaperItem.Enabled = bFooterPossible
except Exception:
traceback.print_exc()
@@ -823,21 +819,18 @@ class LetterWizardDialogImpl(LetterWizardDialog):
def enableSenderReceiver(self):
BPaperItem = self.getRoadmapItemByID(
LetterWizardDialogImpl.RM_SENDERRECEIVER)
- Helper.setUnoPropertyValue(
- BPaperItem, PropertyNames.PROPERTY_ENABLED, True)
+ BPaperItem.Enabled = True
def disableSenderReceiver(self):
BPaperItem = self.getRoadmapItemByID(
LetterWizardDialogImpl.RM_SENDERRECEIVER)
- Helper.setUnoPropertyValue(
- BPaperItem, PropertyNames.PROPERTY_ENABLED, False)
+ BPaperItem.Enabled = False
def enableBusinessPaper(self):
try:
BPaperItem = self.getRoadmapItemByID(
LetterWizardDialogImpl.RM_BUSINESSPAPER)
- Helper.setUnoPropertyValue(
- BPaperItem, PropertyNames.PROPERTY_ENABLED, True)
+ BPaperItem.Enabled = True
self.chkPaperCompanyLogoItemChanged()
self.chkPaperCompanyAddressItemChanged()
self.chkPaperFooterItemChanged()
@@ -849,8 +842,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
try:
BPaperItem = self.getRoadmapItemByID(
LetterWizardDialogImpl.RM_BUSINESSPAPER)
- Helper.setUnoPropertyValue(
- BPaperItem, PropertyNames.PROPERTY_ENABLED, False)
+ BPaperItem.Enabled = False
if self.BusCompanyLogo != None:
self.BusCompanyLogo.removeFrame()
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index da9761d..150b0bf 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -21,10 +21,10 @@ import time
from datetime import date as dateTimeObject
from .ViewHandler import ViewHandler
from .TextFieldHandler import TextFieldHandler
-from ..common.Desktop import Desktop
-from ..common.Helper import Helper
from ..document.OfficeDocument import OfficeDocument
+from ..common.Desktop import Desktop
from ..common.Configuration import Configuration
+from ..common.NumberFormatter import NumberFormatter
from com.sun.star.container import NoSuchElementException
from com.sun.star.lang import WrappedTargetException
@@ -65,8 +65,7 @@ class TextDocument(object):
xFrame, URL, "_self", xArgs);
self.xWindowPeer = xFrame.getComponentWindow()
self.m_xDocProps = self.xTextDocument.DocumentProperties
- CharLocale = Helper.getUnoStructValue(
- self.xTextDocument, "CharLocale");
+ CharLocale = self.xTextDocument.CharLocale
return
else:
@@ -110,8 +109,7 @@ class TextDocument(object):
def init(self):
self.xWindowPeer = self.xFrame.getComponentWindow()
self.m_xDocProps = self.xTextDocument.DocumentProperties
- self.CharLocale = Helper.getUnoStructValue(
- self.xTextDocument, "CharLocale")
+ self.CharLocale = self.xTextDocument.CharLocale
self.xText = self.xTextDocument.Text
def showStatusIndicator(self):
@@ -159,7 +157,7 @@ class TextDocument(object):
xNameAccess = self.xTextDocument.StyleFamilies
xPageStyleCollection = xNameAccess.getByName("PageStyles")
xPageStyle = xPageStyleCollection.getByName("First Page")
- return Helper.getUnoPropertyValue(xPageStyle, "Size")
+ return xPageStyle.Size
except Exception:
traceback.print_exc()
return None
@@ -196,7 +194,7 @@ class TextDocument(object):
day = time.strftime("%d", now)
dateObject = dateTimeObject(int(year), int(month), int(day))
- du = Helper.DateUtils(self.xMSF, self.xTextDocument)
+ du = self.DateUtils(self.xMSF, self.xTextDocument)
ff = du.getFormat(DATE_SYS_DDMMYY)
myDate = du.format(ff, dateObject)
xDocProps2 = self.xTextDocument.DocumentProperties
@@ -248,3 +246,32 @@ class TextDocument(object):
auxList.append(allItems.getByIndex(i))
return auxList
+
+ class DateUtils(object):
+
+ def __init__(self, xmsf, document):
+ self.formatSupplier = document
+ formatSettings = self.formatSupplier.getNumberFormatSettings()
+ date = formatSettings.NullDate
+ self.calendar = dateTimeObject(date.Year, date.Month, date.Day)
+ self.formatter = NumberFormatter.createNumberFormatter(xmsf,
+ self.formatSupplier)
+
+ '''
+ @param format a constant of the enumeration NumberFormatIndex
+ @return
+ '''
+
+ def getFormat(self, format):
+ return NumberFormatter.getNumberFormatterKey(
+ self.formatSupplier, format)
+
+ '''
+ @param date a VCL date in form of 20041231
+ @return a document relative date
+ '''
+
+ def format(self, formatIndex, date):
+ difference = date - self.calendar
+ return self.formatter.convertNumberToString(formatIndex,
+ difference.days)
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.py b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
index 7e3c6e6..4a35fb4 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
@@ -17,7 +17,6 @@
#
import uno
import traceback
-from ..common.Helper import Helper
class TextSectionHandler(object):
'''Creates a new instance of TextSectionHandler'''
@@ -86,8 +85,8 @@ class TextSectionHandler(object):
oSectionLink = \
uno.createUnoStruct('com.sun.star.text.SectionFileLink')
oSectionLink.FileURL = ""
- Helper.setUnoPropertyValues(
- oTextSection, ("FileLink", "LinkRegion"),(oSectionLink, ""))
+ oTextSection.FileLink = oSectionLink
+ oTextSection.LinkRegion = ""
except Exception:
traceback.print_exc()
@@ -100,9 +99,8 @@ class TextSectionHandler(object):
oSectionLink = \
uno.createUnoStruct('com.sun.star.text.SectionFileLink')
oSectionLink.FileURL = TemplateName
- Helper.setUnoPropertyValues(
- oTextSection, ("FileLink", "LinkRegion"),
- (oSectionLink, SectionName))
+ oTextSection.FileLink = oSectionLink
+ oTextSection.LinkRegion = SectionName
NewSectionName = oTextSection.Name
if NewSectionName is not SectionName:
oTextSection.Name = SectionName
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index 7cbeb2a..e20c1ff 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -15,11 +15,11 @@
# 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
import traceback
from .PeerConfig import PeerConfig
from .UIConsts import UIConsts
from ..common.PropertyNames import PropertyNames
-from ..common.Helper import Helper
from com.sun.star.awt import Rectangle
from com.sun.star.awt.PosSize import POS
@@ -72,23 +72,10 @@ class UnoDialog(object):
traceback.print_exc()
return None
-
- def printControlProperties(self, ControlName):
- try:
- xControlModel = self.xDialogModel().getByName(ControlName)
- allProps = xControlModel.PropertySetInfo.Properties
- i = 0
- while i < allProps.length:
- sName = allProps[i].Name
- i += 1
- except Exception:
- traceback.print_exc()
-
def getMAPConversionFactor(self, ControlName):
xControl2 = self.xUnoDialog.getControl(ControlName)
aSize = xControl2.Size
- dblMAPWidth = Helper.getUnoPropertyValue(xControl2.Model,
- int(PropertyNames.PROPERTY_WIDTH))
+ dblMAPWidth = xControl2.Model.Width
return (aSize.Width / dblMAPWidth)
def getpreferredLabelSize(self, LabelName, sLabel):
@@ -111,25 +98,17 @@ class UnoDialog(object):
# This function may look ugly, but this is the only way to check
# the count of values in the model,which is always right.
# the control is only a view and could be right or not.
- fieldnames = Helper.getUnoPropertyValue(getModel(_xListBox),
- "StringItemList")
+ fieldnames = getModel(_xListBox).StringItemList
return fieldnames.length
def getSelectedItemPos(self, _xListBox):
- ipos = Helper.getUnoPropertyValue(getModel(_xListBox),
- "SelectedItems")
+ ipos = getModel(_xListBox).SelectedItems
return ipos[0]
def isListBoxSelected(self, _xListBox):
- ipos = Helper.getUnoPropertyValue(getModel(_xListBox),
- "SelectedItems")
+ ipos = getModel(_xListBox).SelectedItems
return ipos.length > 0
- def addSingleItemtoListbox(self, xListBox, ListItem, iSelIndex):
- xListBox.addItem(ListItem, xListBox.getItemCount())
- if iSelIndex != -1:
- xListBox.selectItemPos(iSelIndex, True)
-
'''
The problem with setting the visibility of controls is that
changing the current step of a dialog will automatically make
@@ -147,8 +126,7 @@ class UnoDialog(object):
try:
iCurControlStep = int(getControlProperty(
controlname, PropertyNames.PROPERTY_STEP))
- iCurDialogStep = int(Helper.getUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP))
+ iCurDialogStep = int(self.xDialogModel.Step)
if bIsVisible:
setControlProperty(
controlname, PropertyNames.PROPERTY_STEP, iCurDialogStep)
@@ -164,12 +142,9 @@ class UnoDialog(object):
def repaintDialogStep(self):
try:
- ncurstep = int(Helper.getUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP))
- Helper.setUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP, 99)
- Helper.setUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_STEP, ncurstep)
+ ncurstep = int(self.xDialogModel.Step)
+ self.xDialogModel.Step = 99
+ self.xDialogModel.Step = ncurstep
except Exception:
traceback.print_exc()
@@ -177,11 +152,10 @@ class UnoDialog(object):
self, serviceName, componentName, sPropNames, oPropValues):
try:
xControlModel = self.xDialogModel.createInstance(serviceName)
- Helper.setUnoPropertyValues(
- xControlModel, sPropNames, oPropValues)
+ uno.invoke(xControlModel, "setPropertyValues",
+ (sPropNames, oPropValues))
self.xDialogModel.insertByName(componentName, xControlModel)
- Helper.setUnoPropertyValue(xControlModel,
- PropertyNames.PROPERTY_NAME, componentName)
+ xControlModel.Name = componentName
except Exception:
traceback.print_exc()
@@ -202,12 +176,11 @@ class UnoDialog(object):
xListBox.selectItemPos((short)(iFieldsSelIndex - 1), True)
# deselects a Listbox. MultipleMode is not supported
-
def deselectListBox(self, _xBasisListBox):
oListBoxModel = getModel(_xBasisListBox)
- sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList")
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", [[],[]])
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", sList)
+ sList = oListBoxModel.StringItemList
+ oListBoxModel.StringItemList = [[],[]]
+ oListBoxModel.StringItemList = sList
def calculateDialogPosition(self, FramePosSize):
# Todo:check if it would be useful or possible to create a dialog peer
@@ -309,8 +282,7 @@ class UnoDialog(object):
@classmethod
def setEnabled(self, control, enabled):
- Helper.setUnoPropertyValue(
- control.Model, PropertyNames.PROPERTY_ENABLED, enabled)
+ control.Model.Enabled = enabled
@classmethod
def getControlModelType(self, xServiceInfo):
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 7ccd2ce..eef5627 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -21,7 +21,6 @@ from abc import ABCMeta, abstractmethod
from .UnoDialog2 import UnoDialog2, Desktop, PropertyNames, UIConsts, \
ItemListenerProcAdapter
from .event.CommonListener import TerminateListenerProcAdapter
-from ..common.Helper import Helper
from ..common.Resource import Resource
from ..common.HelpIds import HelpIds
from ..document.OfficeDocument import OfficeDocument
@@ -70,9 +69,7 @@ class WizardDialog(UnoDialog2):
def itemStateChanged(self, itemEvent):
try:
self.nNewStep = itemEvent.ItemId
- self.nOldStep = int(Helper.getUnoPropertyValue(
- self.xDialogModel,
- PropertyNames.PROPERTY_STEP))
+ self.nOldStep = int(self.xDialogModel.Step)
if self.nNewStep != self.nOldStep:
self.switchToStep()
@@ -80,14 +77,14 @@ class WizardDialog(UnoDialog2):
traceback.print_exc()
def setRoadmapInteractive(self, _bInteractive):
- Helper.setUnoPropertyValue(self.oRoadmap, "Activated", _bInteractive)
+ self.oRoadmap.Activated = _bInteractive
def setRoadmapComplete(self, bComplete):
- Helper.setUnoPropertyValue(self.oRoadmap, "Complete", bComplete)
+ self.oRoadmap.Complete = bComplete
def isRoadmapComplete(self):
try:
- return bool(Helper.getUnoPropertyValue(self.oRoadmap, "Complete"))
+ return bool(self.oRoadmap.Complete)
except Exception:
traceback.print_exc()
return False
@@ -96,21 +93,18 @@ class WizardDialog(UnoDialog2):
if self.oRoadmap is not None:
nCurItemID = self.getCurrentRoadmapItemID()
if nCurItemID != ID:
- Helper.setUnoPropertyValue(self.oRoadmap, "CurrentItemID",ID)
+ self.oRoadmap.CurrentItemID = ID
def getCurrentRoadmapItemID(self):
try:
- return int(Helper.getUnoPropertyValue(
- self.oRoadmap, "CurrentItemID"))
+ return int(self.oRoadmap.CurrentItemID)
except Exception:
traceback.print_exc()
return -1
def addRoadmap(self):
try:
- iDialogHeight = Helper.getUnoPropertyValue(
- self.xDialogModel,
- PropertyNames.PROPERTY_HEIGHT)
+ iDialogHeight = self.xDialogModel.Height
# the roadmap control has got no real TabIndex ever
# that is not correct, but changing this would need time,
# so it is used without TabIndex as before
@@ -131,9 +125,8 @@ class WizardDialog(UnoDialog2):
xRoadmapControl.addItemListener(
ItemListenerProcAdapter(method))
- Helper.setUnoPropertyValue(
- self.oRoadmap, "Text",
- self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16))
+ self.oRoadmap.Text = \
+ self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16)
except NoSuchMethodException:
Resource.showCommonResourceError(xMSF)
except Exception:
@@ -148,11 +141,9 @@ class WizardDialog(UnoDialog2):
if isinstance(_sLabel, int):
_sLabel = self.sRMItemLabels(_sLabel)
oRoadmapItem = self.oRoadmap.createInstance()
- Helper.setUnoPropertyValue(oRoadmapItem,
- PropertyNames.PROPERTY_LABEL, _sLabel)
- Helper.setUnoPropertyValue(oRoadmapItem,
- PropertyNames.PROPERTY_ENABLED, _bEnabled)
- Helper.setUnoPropertyValue(oRoadmapItem, "ID", _CurItemID)
+ oRoadmapItem.Label = _sLabel
+ oRoadmapItem.Enabled = _bEnabled
+ oRoadmapItem.ID = _CurItemID
self.oRoadmap.insertByIndex(Index, oRoadmapItem)
except Exception:
traceback.print_exc()
@@ -162,7 +153,7 @@ class WizardDialog(UnoDialog2):
getByIndex = self.oRoadmap.getByIndex
for i in list(range(self.oRoadmap.Count)):
CurRoadmapItem = getByIndex(i)
- CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"))
+ CurID = int(CurRoadmapItem.ID)
if CurID == _ID:
return CurRoadmapItem
@@ -204,8 +195,7 @@ class WizardDialog(UnoDialog2):
pass
def changeToStep(self, nNewStep):
- Helper.setUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_STEP, nNewStep)
+ self.xDialogModel.Step = nNewStep
self.setCurrentRoadmapItemID(nNewStep)
self.enableNextButton(self.getNextAvailableStep() > 0)
self.enableBackButton(nNewStep != 1)
@@ -216,10 +206,8 @@ class WizardDialog(UnoDialog2):
iButtonWidth = self.__iButtonWidth
iButtonHeight = 14
iCurStep = 0
- iDialogHeight = Helper.getUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_HEIGHT)
- iDialogWidth = Helper.getUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_WIDTH)
+ iDialogHeight = self.xDialogModel.Height
+ iDialogWidth = self.xDialogModel.Width
iHelpPosX = 8
iBtnPosY = iDialogHeight - iButtonHeight - 6
iCancelPosX = iDialogWidth - self.__iButtonWidth - 6
@@ -255,9 +243,7 @@ class WizardDialog(UnoDialog2):
PropertyNames.PROPERTY_STEP,
PropertyNames.PROPERTY_TABINDEX,
PropertyNames.PROPERTY_WIDTH)
- Helper.setUnoPropertyValue(
- self.xDialogModel, PropertyNames.PROPERTY_HELPURL,
- HelpIds.getHelpIdString(self.__hid))
+ self.xDialogModel.HelpURL = HelpIds.getHelpIdString(self.__hid)
self.insertButton("btnWizardHelp",
WizardDialog.__HELP_ACTION_PERFORMED,
(PropertyNames.PROPERTY_ENABLED,
@@ -312,8 +298,7 @@ class WizardDialog(UnoDialog2):
def setStepEnabled(self, _nStep, bEnabled, enableNextButton=None):
xRoadmapItem = self.getRoadmapItemByID(_nStep)
if xRoadmapItem is not None:
- Helper.setUnoPropertyValue(xRoadmapItem,
- PropertyNames.PROPERTY_ENABLED, bEnabled)
+ xRoadmapItem.Enabled = bEnabled
if enableNextButton is not None:
if self.getNextAvailableStep() > 0:
self.enableNextButton(bEnabled)
@@ -352,8 +337,7 @@ class WizardDialog(UnoDialog2):
# Todo: In this case an exception should be thrown
if xRoadmapItem is None:
return False
- bIsEnabled = bool(Helper.getUnoPropertyValue(xRoadmapItem,
- PropertyNames.PROPERTY_ENABLED))
+ bIsEnabled = bool(xRoadmapItem.Enabled)
return bIsEnabled
except Exception:
traceback.print_exc()
@@ -422,8 +406,7 @@ class WizardDialog(UnoDialog2):
def getCurrentStep(self):
try:
- return int(Helper.getUnoPropertyValue(self.xDialogModel,
- PropertyNames.PROPERTY_STEP))
+ return int(self.xDialogModel.Step)
except Exception:
traceback.print_exc()
return -1
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index c753a9b..6f1e9b2 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -18,7 +18,6 @@
import uno
from .CommonListener import ItemListenerProcAdapter, TextListenerProcAdapter
from .DataAware import DataAware, PropertyNames
-from ...common.Helper import Helper
'''
@author rpiterman
@@ -44,16 +43,15 @@ class UnoDataAware(DataAware):
def enableControls(self, value):
for i in self.disableObjects:
- Helper.setUnoPropertyValue(
- i.Model, PropertyNames.PROPERTY_ENABLED, bool(value))
+ i.Model.Enabled = bool(value)
def setToUI(self, value):
if self.isShort:
value = uno.Any("[]short", (value,))
- Helper.setUnoPropertyValue(self.unoModel, self.unoPropName, value)
+ setattr(self.unoModel, self.unoPropName, value)
def getFromUI(self):
- return Helper.getUnoPropertyValue(self.unoModel, self.unoPropName)
+ return getattr(self.unoModel, self.unoPropName)
@classmethod
def __attachTextControl(
commit 03a0ea88e94205bf14feffccf981e4aac82a28ae
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Nov 28 00:39:39 2012 +0100
pyagenda: make buttons work in Agenda Items
Change-Id: Iadc5088b1e95fec0ae34c35cf650e9d53ceb6bf4
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index b944bd4..e6643e0 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -795,6 +795,15 @@ class Topics(object):
self.topicItems = {}
self.firstRowFormat = []
self.agenda = agenda
+ '''
+ this is a list which traces which topics were written to the document
+ and which not. When a cell needs to be actualized, it is checked that the
+ whole topic is already present in the document, using this vector.
+ The vector contains nulls for topics which were not written, and
+ empty strings for topics which were written (though any other
+ object would also do - i check only if it is a null or not...);
+ '''
+ self.writtenTopics = []
try:
Topics.table = self.agenda.getTable(
self.agenda.templateConsts.SECTION_TOPICS)
@@ -875,12 +884,11 @@ class Topics(object):
to the table. 0 or a negative number: no rows added.
'''
- @classmethod
def write2(self, topic, data):
- if topic >= len(self.agenda.writtenTopics):
- size = topic - len(self.agenda.writtenTopics)
- self.agenda.writtenTopics += [None] * size
- self.agenda.writtenTopics.insert(topic, "")
+ if topic >= len(self.writtenTopics):
+ size = topic - len(self.writtenTopics)
+ self.writtenTopics += [None] * size
+ self.writtenTopics.insert(topic, "")
# make sure threr are enough rows for me...
rows = self.agenda.getRowCount(Topics.table)
reqRows = 1 + (topic + 1) * Topics.rowsPerTopic
@@ -911,8 +919,8 @@ class Topics(object):
'''
def isWritten(self, topic):
- return (len(self.agenda.writtenTopics) > topic \
- and self.agenda.writtenTopics[topic] is not None)
+ return (len(self.writtenTopics) > topic \
+ and self.writtenTopics[topic] is not None)
'''rewrites a single cell containing.
This is used in order to refresh the topic/responsible/duration data
@@ -1013,8 +1021,8 @@ class Topics(object):
targetNumOfRows, tableRows.Count - targetNumOfRows)'''
self.formatLastRow()
- while len(self.agenda.writtenTopics) > topics:
- del self.agenda.writtenTopics[topics]
+ while len(self.writtenTopics) > topics:
+ del self.writtenTopics[topics]
'''reapply the format of the first (header) row.
'''
@@ -1044,7 +1052,7 @@ class Topics(object):
if cell >= 0:
te = Topics.topicCells[cell]
if te is not None:
- te.text = str(value)
+ te.Text = str(value)
return te
return None
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index e28fe6e..00262ee 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -15,6 +15,7 @@
# 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 .CGTopic import CGTopic
from ..ui.ControlScroller import *
from .AgendaWizardDialogConst import HID
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index c33cbb1..7cbeb2a 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -17,6 +17,7 @@
#
import traceback
from .PeerConfig import PeerConfig
+from .UIConsts import UIConsts
from ..common.PropertyNames import PropertyNames
from ..common.Helper import Helper
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
index aae0414..2ca855d 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
@@ -15,8 +15,7 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-from .UnoDialog import UnoDialog
-from .UIConsts import UIConsts
+from .UnoDialog import UnoDialog, UIConsts
from ..common.Desktop import Desktop
from ..common.PropertyNames import PropertyNames
from .event.CommonListener import ItemListenerProcAdapter, \
commit e87d8747cf526af4cbb90502854c3b705aa52caa
Author: Xisco Fauli <anistenis at gmail.com>
Date: Tue Nov 27 23:56:14 2012 +0100
pyagenda: fix Topics in python3.3
Change-Id: Iea0036eef5d978aa227ba5ff297969f7a44ed3ab
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 01db554..b944bd4 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -294,7 +294,7 @@ class AgendaTemplate(TextDocument):
self.initializeItemsSections()
self.textSectionHandler = TextSectionHandler(
self.xTextDocument, self.xTextDocument)
- #self.topics = Topics(self)
+ self.topics = Topics(self)
'''
locates the titles (name, location, date, time)
@@ -812,57 +812,62 @@ class Topics(object):
cell by cell, I check in this map to know
if a cell contains a <*> or not.
'''
- items = {}
- for i in self.agenda.allItems:
- t = Helper.getUnoPropertyValue(i, "TextTable")
- if t == Topics.table:
- cell = Helper.getUnoPropertyValue(i, "Cell")
- iText = cell.CellName
- items[iText] = i
+ try:
+ items = {}
+ for i in self.agenda.allItems:
+ t = Helper.getUnoPropertyValue(i, "TextTable")
+ if t == Topics.table:
+ cell = Helper.getUnoPropertyValue(i, "Cell")
+ iText = cell.CellName
+ items[iText] = i
- '''
- in the topics table, there are always one
- title row and three topics defined.
- So no mutter how many rows a topic takes - we
- can restore its structure and format.
- '''
- rows = self.agenda.getRowCount(Topics.table)
- Topics.rowsPerTopic = (rows - 1) / 3
- firstCell = "A" + str(1 + Topics.rowsPerTopic + 1)
- afterLastCell = "A" + str(1 + (Topics.rowsPerTopic * 2) + 1)
- # go to the first row of the 2. topic
- cursor = Topics.table.createCursorByCellName(firstCell)
- # analyze the structure of the topic rows.
- while not cursor.RangeName == afterLastCell:
- cell = Topics.table.getCellByName(cursor.RangeName)
- # if the cell contains a relevant <...>
- # i add the text element to the hash,
- # so it's text can be updated later.
- try:
- if items[cell.CellName] is not None:
- self.topicItems[cell.String.lower().lstrip()] = cell
- except KeyError:
- pass
+ '''
+ in the topics table, there are always one
+ title row and three topics defined.
+ So no mutter how many rows a topic takes - we
+ can restore its structure and format.
+ '''
+ rows = self.agenda.getRowCount(Topics.table)
+ Topics.rowsPerTopic = int((rows - 1) / 3)
+
+ firstCell = "A" + str(1 + Topics.rowsPerTopic + 1)
+ afterLastCell = "A" + str(1 + (Topics.rowsPerTopic * 2) + 1)
+ # go to the first row of the 2. topic
+
+ cursor = Topics.table.createCursorByCellName(firstCell)
+ # analyze the structure of the topic rows.
+ while not cursor.RangeName == afterLastCell:
+ cell = Topics.table.getCellByName(cursor.RangeName)
+ # if the cell contains a relevant <...>
+ # i add the text element to the hash,
+ # so it's text can be updated later.
+ try:
+ if items[cell.CellName] is not None:
+ self.topicItems[cell.String.lower().lstrip()] = cell
+ except KeyError:
+ pass
- Topics.topicCells.append(cell)
- # goto next cell.
- cursor.goRight(1, False)
- '''
- now - in which cell is every fillin?
- '''
+ Topics.topicCells.append(cell)
+ # goto next cell.
+ cursor.goRight(1, False)
+ '''
+ now - in which cell is every fillin?
+ '''
- Topics.numCell = Topics.topicCells.index(
- self.topicItems[
- self.agenda.templateConsts.FILLIN_TOPIC_NUMBER])
- Topics.topicCell = Topics.topicCells.index(
- self.topicItems[
- self.agenda.templateConsts.FILLIN_TOPIC_TOPIC])
- Topics.responsibleCell = Topics.topicCells.index(
- self.topicItems[
- self.agenda.templateConsts.FILLIN_TOPIC_RESPONSIBLE])
- Topics.timeCell = Topics.topicCells.index(
- self.topicItems[
- self.agenda.templateConsts.FILLIN_TOPIC_TIME])
+ Topics.numCell = Topics.topicCells.index(
+ self.topicItems[
+ self.agenda.templateConsts.FILLIN_TOPIC_NUMBER])
+ Topics.topicCell = Topics.topicCells.index(
+ self.topicItems[
+ self.agenda.templateConsts.FILLIN_TOPIC_TOPIC])
+ Topics.responsibleCell = Topics.topicCells.index(
+ self.topicItems[
+ self.agenda.templateConsts.FILLIN_TOPIC_RESPONSIBLE])
+ Topics.timeCell = Topics.topicCells.index(
+ self.topicItems[
+ self.agenda.templateConsts.FILLIN_TOPIC_TIME])
+ except Exception:
+ traceback.print_exc()
'''@param topic the topic number to write
@param data the data of the topic.
commit ee1df64d6cc0c2b8684063e2ae33676fd50440a7
Author: Xisco Fauli <anistenis at gmail.com>
Date: Tue Nov 27 23:13:48 2012 +0100
pyagenda: fix date field
Change-Id: I7952deeae094ae6d7c44fe4351225434d70e5c52
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 3dbcf63..01db554 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -294,7 +294,7 @@ class AgendaTemplate(TextDocument):
self.initializeItemsSections()
self.textSectionHandler = TextSectionHandler(
self.xTextDocument, self.xTextDocument)
- self.topics = Topics(self)
+ #self.topics = Topics(self)
'''
locates the titles (name, location, date, time)
@@ -400,9 +400,9 @@ class AgendaTemplate(TextDocument):
if d is None or d == "":
return ""
date = int(d)
- year = date / 10000
- month = (date % 10000) / 100
- day = date % 100
+ year = int(date / 10000)
+ month = int((date % 10000) / 100)
+ day = int(date % 100)
dateObject = dateTimeObject(year, month, day)
return AgendaTemplate.dateUtils.format(
AgendaTemplate.dateFormat, dateObject)
More information about the Libreoffice-commits
mailing list