summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/ui/UnoDialog2.py
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2011-06-15 19:09:17 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-08-18 02:13:21 +0200
commit0df4a8eff1f0a9f8a8619cdd29df3c3036279587 (patch)
tree99f492d2fd57826945ea0da2e2943fc1a72cb433 /wizards/com/sun/star/wizards/ui/UnoDialog2.py
parent68b50acc4d8672ce74b413076da13a36613efca6 (diff)
Line length <= 80
Diffstat (limited to 'wizards/com/sun/star/wizards/ui/UnoDialog2.py')
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.py202
1 files changed, 144 insertions, 58 deletions
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
index c241a07b50b2..cc9ec652f223 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
@@ -6,10 +6,11 @@ from UIConsts import *
'''
This class contains convenience methods for inserting components to a dialog.
It was created for use with the automatic conversion of Basic XML Dialog
-description files to a Java class which builds the same dialog through the UNO API.<br/>
+description files to a Java class which builds
+the same dialog through the UNO API.<br/>
It uses an Event-Listener method, which calls a method through reflection
wenn an event on a component is trigered.
-see the classes AbstractListener, CommonListener, MethodInvocation for details.
+see the classes AbstractListener, CommonListener, MethodInvocation for details
'''
class UnoDialog2(UnoDialog):
@@ -22,35 +23,51 @@ class UnoDialog2(UnoDialog):
def __init__(self, xmsf):
super(UnoDialog2,self).__init__(xmsf,(), ())
- def insertButton(self, sName, actionPerformed, sPropNames, oPropValues, listener):
- xButton = self.insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues)
+ def insertButton(
+ self, sName, actionPerformed, sPropNames, oPropValues, listener):
+ xButton = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlButtonModel",
+ sName, sPropNames, oPropValues)
if actionPerformed is not None:
actionPerformed = getattr(listener, actionPerformed)
- xButton.addActionListener(ActionListenerProcAdapter(actionPerformed))
+ xButton.addActionListener(
+ ActionListenerProcAdapter(actionPerformed))
return xButton
- def insertImageButton(self, sName, actionPerformed, sPropNames, oPropValues, listener):
- xButton = self.insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues)
+ def insertImageButton(
+ self, sName, actionPerformed, sPropNames, oPropValues, listener):
+ xButton = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlButtonModel",
+ sName, sPropNames, oPropValues)
if actionPerformed is not None:
actionPerformed = getattr(listener, actionPerformed)
- xButton.addActionListener(ActionListenerProcAdapter(actionPerformed))
+ xButton.addActionListener(
+ ActionListenerProcAdapter(actionPerformed))
return xButton
- def insertCheckBox(self, sName, itemChanged, sPropNames, oPropValues, listener):
- xCheckBox = self.insertControlModel2("com.sun.star.awt.UnoControlCheckBoxModel", sName, sPropNames, oPropValues)
+ def insertCheckBox(
+ self, sName, itemChanged, sPropNames, oPropValues, listener):
+ xCheckBox = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlCheckBoxModel",
+ sName, sPropNames, oPropValues)
if itemChanged is not None:
itemChanged = getattr(listener, itemChanged)
xCheckBox.addItemListener(ItemListenerProcAdapter(itemChanged))
return xCheckBox
- def insertComboBox(self, sName, actionPerformed, itemChanged, textChanged, sPropNames, oPropValues, listener):
- xComboBox = self.insertControlModel2("com.sun.star.awt.UnoControlComboBoxModel", sName, sPropNames, oPropValues)
+ def insertComboBox(
+ self, sName, actionPerformed, itemChanged,
+ textChanged, sPropNames, oPropValues, listener):
+ xComboBox = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlComboBoxModel",
+ sName, sPropNames, oPropValues)
if actionPerformed is not None:
actionPerformed = getattr(listener, actionPerformed)
- xComboBox.addActionListener(ActionListenerProcAdapter(actionPerformed))
+ xComboBox.addActionListener(
+ ActionListenerProcAdapter(actionPerformed))
if itemChanged is not None:
itemChanged = getattr(listener, itemChanged)
@@ -62,8 +79,11 @@ class UnoDialog2(UnoDialog):
return xComboBox
- def insertListBox(self, sName, actionPerformed, itemChanged, sPropNames, oPropValues, listener):
- xListBox = self.insertControlModel2("com.sun.star.awt.UnoControlListBoxModel",
+ def insertListBox(
+ self, sName, actionPerformed, itemChanged,
+ sPropNames, oPropValues, listener):
+ xListBox = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlListBoxModel",
sName, sPropNames, oPropValues)
if actionPerformed is not None:
@@ -76,87 +96,150 @@ class UnoDialog2(UnoDialog):
return xListBox
- def insertRadioButton(self, sName, itemChanged, sPropNames, oPropValues, listener):
- xRadioButton = self.insertControlModel2("com.sun.star.awt.UnoControlRadioButtonModel",
+ def insertRadioButton(
+ self, sName, itemChanged, sPropNames, oPropValues, listener):
+ xRadioButton = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlRadioButtonModel",
sName, sPropNames, oPropValues)
if itemChanged is not None:
itemChanged = getattr(listener, itemChanged)
- xRadioButton.addItemListener(ItemListenerProcAdapter(itemChanged))
+ xRadioButton.addItemListener(
+ ItemListenerProcAdapter(itemChanged))
return xRadioButton
def insertTitledBox(self, sName, sPropNames, oPropValues):
- oTitledBox = self.insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues)
+ oTitledBox = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlGroupBoxModel",
+ sName, sPropNames, oPropValues)
return oTitledBox
- def insertTextField(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged,
- "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, listener)
+ def insertTextField(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(
+ sName, sTextChanged, "com.sun.star.awt.UnoControlEditModel",
+ sPropNames, oPropValues, listener)
def insertImage(self, sName, sPropNames, oPropValues):
- return self.insertControlModel2("com.sun.star.awt.UnoControlImageControlModel", sName, sPropNames, oPropValues)
+ return self.insertControlModel2(
+ "com.sun.star.awt.UnoControlImageControlModel",
+ sName, sPropNames, oPropValues)
def insertInfoImage(self, _posx, _posy, _iStep):
- xImgControl = self.insertImage(Desktop.getUniqueName(self.xDialogModel, "imgHint"),("Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH),(uno.Any("short",0), 10, UIConsts.INFOIMAGEURL, _posx, _posy, False, _iStep, 10))
- self.getPeerConfiguration().setImageUrl(self.getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC)
+ xImgControl = self.insertImage(
+ Desktop.getUniqueName(self.xDialogModel, "imgHint"),
+ ("Border",
+ PropertyNames.PROPERTY_HEIGHT,
+ PropertyNames.PROPERTY_IMAGEURL,
+ PropertyNames.PROPERTY_POSITION_X,
+ PropertyNames.PROPERTY_POSITION_Y, "ScaleImage",
+ PropertyNames.PROPERTY_STEP,
+ PropertyNames.PROPERTY_WIDTH),
+ (uno.Any("short",0), 10,
+ UIConsts.INFOIMAGEURL, _posx, _posy, False, _iStep, 10))
+ self.getPeerConfiguration().setImageUrl(
+ self.getModel(xImgControl),
+ UIConsts.INFOIMAGEURL,
+ UIConsts.INFOIMAGEURL_HC)
return xImgControl
'''
- This method is used for creating Edit, Currency, Date, Formatted, Pattern, File
- and Time edit components.
+ This method is used for creating Edit, Currency, Date, Formatted,
+ Pattern, File and Time edit components.
'''
- def insertEditField(self, sName, sTextChanged, sModelClass, sPropNames, oPropValues, listener):
- xField = self.insertControlModel2(sModelClass, sName, sPropNames, oPropValues)
+ def insertEditField(
+ self, sName, sTextChanged, sModelClass,
+ sPropNames, oPropValues, listener):
+ xField = self.insertControlModel2(sModelClass,
+ sName, sPropNames, oPropValues)
if sTextChanged is not None:
sTextChanged = getattr(listener, sTextChanged)
xField.addTextListener(TextListenerProcAdapter(sTextChanged))
return xField
- def insertFileControl(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlFileControlModel", sPropNames, oPropValues, listener)
-
- def insertCurrencyField(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlCurrencyFieldModel", sPropNames, oPropValues, listener)
-
- def insertDateField(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlDateFieldModel", sPropNames, oPropValues, listener)
-
- def insertNumericField(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlNumericFieldModel", sPropNames, oPropValues, listener)
-
- def insertTimeField(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlTimeFieldModel", sPropNames, oPropValues, listener)
-
- def insertPatternField(self, sName, sTextChanged, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlPatternFieldModel", sPropNames, oPropValues, listener)
+ def insertFileControl(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(sName, sTextChanged,
+ "com.sun.star.awt.UnoControlFileControlModel",
+ sPropNames, oPropValues, listener)
+
+ def insertCurrencyField(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(
+ sName, sTextChanged,
+ "com.sun.star.awt.UnoControlCurrencyFieldModel",
+ sPropNames, oPropValues, listener)
+
+ def insertDateField(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(
+ sName, sTextChanged,
+ "com.sun.star.awt.UnoControlDateFieldModel",
+ sPropNames, oPropValues, listener)
+
+ def insertNumericField(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(
+ sName, sTextChanged,
+ "com.sun.star.awt.UnoControlNumericFieldModel",
+ sPropNames, oPropValues, listener)
+
+ def insertTimeField(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(
+ sName, sTextChanged,
+ "com.sun.star.awt.UnoControlTimeFieldModel",
+ sPropNames, oPropValues, listener)
+
+ def insertPatternField(
+ self, sName, sTextChanged, oPropValues, listener):
+ return self.insertEditField(sName, sTextChanged,
+ "com.sun.star.awt.UnoControlPatternFieldModel",
+ sPropNames, oPropValues, listener)
- def insertFormattedField(self, sName, sTextChanged, sPropNames, oPropValues, listener):
- return self.insertEditField(sName, sTextChanged, "com.sun.star.awt.UnoControlFormattedFieldModel", sPropNames, oPropValues, listener)
+ def insertFormattedField(
+ self, sName, sTextChanged, sPropNames, oPropValues, listener):
+ return self.insertEditField(
+ sName, sTextChanged,
+ "com.sun.star.awt.UnoControlFormattedFieldModel",
+ sPropNames, oPropValues, listener)
def insertFixedLine(self, sName, sPropNames, oPropValues):
- oLine = self.insertControlModel2("com.sun.star.awt.UnoControlFixedLineModel", sName, sPropNames, oPropValues)
+ oLine = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlFixedLineModel",
+ sName, sPropNames, oPropValues)
return oLine
def insertScrollBar(self, sName, sPropNames, oPropValues):
- oScrollBar = self.insertControlModel2("com.sun.star.awt.UnoControlScrollBarModel", sName, sPropNames, oPropValues)
+ oScrollBar = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlScrollBarModel",
+ sName, sPropNames, oPropValues)
return oScrollBar
def insertProgressBar(self, sName, sPropNames, oPropValues):
- oProgressBar = self.insertControlModel2("com.sun.star.awt.UnoControlProgressBarModel", sName, sPropNames, oPropValues)
+ oProgressBar = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlProgressBarModel",
+ sName, sPropNames, oPropValues)
return oProgressBar
def insertGroupBox(self, sName, sPropNames, oPropValues):
- oGroupBox = self.insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues)
+ oGroupBox = self.insertControlModel2(
+ "com.sun.star.awt.UnoControlGroupBoxModel",
+ sName, sPropNames, oPropValues)
return oGroupBox
- def insertControlModel2(self, serviceName, componentName, sPropNames, oPropValues):
+ def insertControlModel2(
+ self, serviceName, componentName, sPropNames, oPropValues):
try:
- xControlModel = self.insertControlModel(serviceName, componentName, (), ())
- Helper.setUnoPropertyValues(xControlModel, sPropNames, oPropValues)
- Helper.setUnoPropertyValue(xControlModel, PropertyNames.PROPERTY_NAME, componentName)
+ xControlModel = self.insertControlModel(
+ serviceName, componentName, (), ())
+ Helper.setUnoPropertyValues(
+ xControlModel, sPropNames, oPropValues)
+ Helper.setUnoPropertyValue(xControlModel,
+ PropertyNames.PROPERTY_NAME, componentName)
except Exception, ex:
traceback.print_exc()
@@ -171,8 +254,11 @@ class UnoDialog2(UnoDialog):
i += 1
def getControlModel(self, unoControl):
- obj = unoControl.getModel()
+ obj = unoControl.Model
return obj
def showMessageBox(self, windowServiceName, windowAttribute, MessageText):
- return SystemDialog.showMessageBox(xMSF, self.xControl.getPeer(), windowServiceName, windowAttribute, MessageText)
+ return SystemDialog.showMessageBox(
+ xMSF, self.xControl.Peer,
+ windowServiceName, windowAttribute, MessageText)
+