summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2012-11-24 22:19:29 +0100
committerXisco Fauli <anistenis@gmail.com>2012-11-24 22:20:52 +0100
commitbe3b55d5ec59e87edf93215fea91df312fa82dfb (patch)
treebdb7bd53f40e059be46d02c40f503bfe606547e3 /wizards
parenta615abcd121bb0d6fd27a7ac883798d45b290970 (diff)
pywizards: fix textfields
Change-Id: I6609c554ef161a0abafbdfa65f8076a42eec93b2
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxDocument.py3
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.py42
2 files changed, 23 insertions, 22 deletions
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py
index c99eb7d92752..215b355562e0 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.py
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py
@@ -95,8 +95,7 @@ class FaxDocument(TextDocument):
return False
def switchUserField(self, sFieldName, sNewContent, bState):
- myFieldHandler = TextFieldHandler(
- self.xMSF, self.xTextDocument)
+ myFieldHandler = TextFieldHandler( self.xMSF, self.xTextDocument)
if bState:
myFieldHandler.changeUserFieldContent(sFieldName, sNewContent)
else:
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index 67324835b689..f6f251e3a125 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -21,21 +21,17 @@ import unicodedata
from ..common.PropertyNames import PropertyNames
from com.sun.star.util import DateTime
+from com.sun.star.uno import RuntimeException
class TextFieldHandler(object):
- '''
- Creates a new instance of TextFieldHandler
- @param xMSF
- @param xTextDocument
- '''
xTextFieldsSupplierAux = None
+ arrayTextFields = []
+ dictTextFields = {}
def __init__(self, xMSF, xTextDocument):
self.xMSFDoc = xMSF
self.xTextFieldsSupplier = xTextDocument
- self.arrayTextFields = []
- self.dictTextFields = {}
if TextFieldHandler.xTextFieldsSupplierAux is not \
self.xTextFieldsSupplier:
self.__getTextFields()
@@ -93,10 +89,10 @@ class TextFieldHandler(object):
self.xTextFieldsSupplier.TextFields.createEnumeration()
while xEnum.hasMoreElements():
oTextField = xEnum.nextElement()
- self.arrayTextFields.append(oTextField)
+ TextFieldHandler.arrayTextFields.append(oTextField)
xPropertySet = oTextField.TextFieldMaster
if xPropertySet.Name:
- self.dictTextFields[xPropertySet.Name] = \
+ TextFieldHandler.dictTextFields[xPropertySet.Name] = \
oTextField
except Exception:
traceback.print_exc()
@@ -104,7 +100,7 @@ class TextFieldHandler(object):
def __getTextFieldsByProperty(
self, _PropertyName, _aPropertyValue):
try:
- xProperty = self.dictTextFields[_aPropertyValue]
+ xProperty = TextFieldHandler.dictTextFields[_aPropertyValue]
xPropertySet = xProperty.TextFieldMaster
if xPropertySet.PropertySetInfo.hasPropertyByName(
_PropertyName):
@@ -118,15 +114,18 @@ class TextFieldHandler(object):
return None
def changeUserFieldContent(self, _FieldName, _FieldContent):
- DependentTextFields = self.__getTextFieldsByProperty(
- PropertyNames.PROPERTY_NAME, _FieldName)
- if DependentTextFields is not None:
- DependentTextFields.TextFieldMaster.setPropertyValue("Content", _FieldContent)
- self.refreshTextFields()
+ try:
+ DependentTextFields = self.__getTextFieldsByProperty(
+ PropertyNames.PROPERTY_NAME, _FieldName)
+ if DependentTextFields is not None:
+ DependentTextFields.TextFieldMaster.setPropertyValue("Content", _FieldContent)
+ self.refreshTextFields()
+ except Exception:
+ traceback.print_exc()
def updateDocInfoFields(self):
try:
- for i in self.arrayTextFields:
+ for i in TextFieldHandler.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.ExtendedUser"):
i.update()
@@ -146,18 +145,21 @@ class TextFieldHandler(object):
dt.Year = time.strftime("%Y", now)
dt.Month = time.strftime("%m", now)
dt.Month += 1
- for i in self.arrayTextFields:
+ for i in TextFieldHandler.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.DateTime"):
- i.setPropertyValue("IsFixed", False)
- i.setPropertyValue("DateTimeValue", dt)
+ try:
+ i.setPropertyValue("IsFixed", False)
+ i.setPropertyValue("DateTimeValue", dt)
+ except RuntimeException:
+ pass
except Exception:
traceback.print_exc()
def fixDateFields(self, _bSetFixed):
try:
- for i in self.arrayTextFields:
+ for i in TextFieldHandler.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.DateTime"):
i.setPropertyValue("IsFixed", _bSetFixed)