summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/ui/event/UnoDataAware.py')
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index ea728b9687f6..1ed80a10dbc6 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -17,7 +17,9 @@
#
import uno
from .CommonListener import ItemListenerProcAdapter, TextListenerProcAdapter
-from .DataAware import DataAware, PropertyNames
+from .DataAware import DataAware, PropertyNames, datetime, Date, Time
+
+from com.sun.star.script import CannotConvertException
'''
@author rpiterman
@@ -47,14 +49,21 @@ class UnoDataAware(DataAware):
def setToUI(self, value):
if (isinstance(value, list)):
- length = len(value)
value = tuple(value)
elif self.isShort:
value = uno.Any("[]short", (value,))
- if (hasattr(self.unoModel, self.unoPropName)):
- setattr(self.unoModel, self.unoPropName, value)
- else:
- uno.invoke(self.unoModel, "set" + self.unoPropName, (value,))
+ if value:
+ if(hasattr(self.unoModel, self.unoPropName)):
+ if self.unoPropName == "Date":
+ d = datetime.strptime(value, '%d/%m/%y')
+ value = Date(d.day, d.month, d.year)
+ elif self.unoPropName == "Time":
+ t = datetime.strptime(value, '%H:%M')
+ value = Time(0, 0, t.minute, t.hour, False)
+
+ setattr(self.unoModel, self.unoPropName, value)
+ else:
+ uno.invoke(self.unoModel, "set" + self.unoPropName, (value,))
# Try to get from an arbitrary object a boolean value.
# Null returns Boolean.FALSE;