summaryrefslogtreecommitdiffstats
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2013-01-20 16:37:18 +0100
committerXisco Fauli <anistenis@gmail.com>2013-01-20 21:07:54 +0100
commitbe0dad06ddf15dc56163a07fa6b3f6a4fa44b6e4 (patch)
tree08e467a2a7715eed4445d124f292a7419cf29119 /wizards
parentpyagenda: Fix a problem with template's sections (diff)
downloadcore-be0dad06ddf15dc56163a07fa6b3f6a4fa44b6e4.tar.gz
core-be0dad06ddf15dc56163a07fa6b3f6a4fa44b6e4.zip
pyagenda: simplify UIDialog code
Change-Id: I869d13c8b40f4c52e30a0a40c148fd2a5ef9d31c
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.py1
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.py1
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.py25
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.py69
4 files changed, 18 insertions, 78 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index b934a6ab9570..4a7231725e6f 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -123,7 +123,6 @@ class TopicsControl(ControlScroller):
'''
initializes the data of the control.
- @param agenda
'''
def initializeScrollFields(self, agenda):
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.py b/wizards/com/sun/star/wizards/ui/ControlScroller.py
index 85325cd501b8..44c19576bc42 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.py
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.py
@@ -209,6 +209,7 @@ class ControlScroller(object):
controlname).Model
propertyname = UnoDialog.getDisplayProperty(oControlModel)
if propertyname:
+ print(type(controlname))
setattr(controlname, propertyname, newvalue)
@classmethod
diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.py b/wizards/com/sun/star/wizards/ui/UIConsts.py
index 64c4dee42638..edffd168a137 100644
--- a/wizards/com/sun/star/wizards/ui/UIConsts.py
+++ b/wizards/com/sun/star/wizards/ui/UIConsts.py
@@ -45,28 +45,3 @@ class UIConsts():
SOGROUPFILTERPAGE = 6
SOTITLESPAGE = 7
SOSUMMARYPAGE = 8
-
- class CONTROLTYPE():
-
- BUTTON = 1
- IMAGECONTROL = 2
- LISTBOX = 3
- COMBOBOX = 4
- CHECKBOX = 5
- RADIOBUTTON = 6
- DATEFIELD = 7
- EDITCONTROL = 8
- FILECONTROL = 9
- FIXEDLINE = 10
- FIXEDTEXT = 11
- FORMATTEDFIELD = 12
- GROUPBOX = 13
- HYPERTEXT = 14
- NUMERICFIELD = 15
- PATTERNFIELD = 16
- PROGRESSBAR = 17
- ROADMAP = 18
- SCROLLBAR = 19
- TIMEFIELD = 20
- CURRENCYFIELD = 21
- UNKNOWN = -1
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index a5b1d180e4e4..ca93e72ed624 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -262,91 +262,56 @@ class UnoDialog(object):
control.Model.Enabled = enabled
@classmethod
- def getControlModelType(self, xServiceInfo):
+ def getDisplayProperty(self, xServiceInfo):
if xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlFixedTextModel"):
- return UIConsts.CONTROLTYPE.FIXEDTEXT
+ return PropertyNames.PROPERTY_LABEL
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlButtonModel"):
- return UIConsts.CONTROLTYPE.BUTTON
+ return PropertyNames.PROPERTY_LABEL
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlCurrencyFieldModel"):
- return UIConsts.CONTROLTYPE.CURRENCYFIELD
+ return "Value"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlDateFieldModel"):
- return UIConsts.CONTROLTYPE.DATEFIELD
+ return "Date"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlFixedLineModel"):
- return UIConsts.CONTROLTYPE.FIXEDLINE
+ return PropertyNames.PROPERTY_LABEL
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlFormattedFieldModel"):
- return UIConsts.CONTROLTYPE.FORMATTEDFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlRoadmapModel"):
- return UIConsts.CONTROLTYPE.ROADMAP
+ return "EffectiveValue"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlNumericFieldModel"):
- return UIConsts.CONTROLTYPE.NUMERICFIELD
+ return "Value"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlPatternFieldModel"):
- return UIConsts.CONTROLTYPE.PATTERNFIELD
- elif xServiceInfo.supportsService(
- "com.sun.star.awt.UnoControlHyperTextModel"):
- return UIConsts.CONTROLTYPE.HYPERTEXT
+ return "Text"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlProgressBarModel"):
- return UIConsts.CONTROLTYPE.PROGRESSBAR
+ return "ProgressValue"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlTimeFieldModel"):
- return UIConsts.CONTROLTYPE.TIMEFIELD
+ return "Time"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlImageControlModel"):
- return UIConsts.CONTROLTYPE.IMAGECONTROL
+ return PropertyNames.PROPERTY_IMAGEURL
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlRadioButtonModel"):
- return UIConsts.CONTROLTYPE.RADIOBUTTON
+ return PropertyNames.PROPERTY_STATE
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlCheckBoxModel"):
- return UIConsts.CONTROLTYPE.CHECKBOX
+ return PropertyNames.PROPERTY_STATE
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlEditModel"):
- return UIConsts.CONTROLTYPE.EDITCONTROL
+ return "Text"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlComboBoxModel"):
- return UIConsts.CONTROLTYPE.COMBOBOX
+ return "Text"
elif xServiceInfo.supportsService(
"com.sun.star.awt.UnoControlListBoxModel"):
- return UIConsts.CONTROLTYPE.LISTBOX
+ return "SelectedItems"
else:
- return UIConsts.CONTROLTYPE.UNKNOWN
-
- @classmethod
- def getDisplayProperty(self, oControlModel):
- itype = self.getControlModelType(oControlModel)
- if not UnoDialog.createDict:
- UnoDialog.createDict = True
- UnoDialog.dictProperties = {
- UIConsts.CONTROLTYPE.FIXEDTEXT:PropertyNames.PROPERTY_LABEL,
- UIConsts.CONTROLTYPE.BUTTON:PropertyNames.PROPERTY_LABEL,
- UIConsts.CONTROLTYPE.FIXEDLINE:PropertyNames.PROPERTY_LABEL,
- UIConsts.CONTROLTYPE.NUMERICFIELD:"Value",
- UIConsts.CONTROLTYPE.CURRENCYFIELD:"Value",
- UIConsts.CONTROLTYPE.FORMATTEDFIELD:"EffectiveValue",
- UIConsts.CONTROLTYPE.DATEFIELD:"Date",
- UIConsts.CONTROLTYPE.TIMEFIELD:"Time",
- UIConsts.CONTROLTYPE.SCROLLBAR:"ScrollValue",
- UIConsts.CONTROLTYPE.PROGRESSBAR:"ProgressValue",
- UIConsts.CONTROLTYPE.IMAGECONTROL:PropertyNames.PROPERTY_IMAGEURL,
- UIConsts.CONTROLTYPE.RADIOBUTTON:PropertyNames.PROPERTY_STATE,
- UIConsts.CONTROLTYPE.CHECKBOX:PropertyNames.PROPERTY_STATE,
- UIConsts.CONTROLTYPE.EDITCONTROL:"Text",
- UIConsts.CONTROLTYPE.COMBOBOX:"Text",
- UIConsts.CONTROLTYPE.PATTERNFIELD:"Text",
- UIConsts.CONTROLTYPE.LISTBOX:"SelectedItems"
- }
- try:
- return UnoDialog.dictProperties[itype]
- except KeyError:
return ""
def addResourceHandler(self, _Unit, _Module):