[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Tue Jun 28 14:11:44 PDT 2011


 wizards/com/sun/star/wizards/common/ConfigGroup.py        |    1 
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py   |   54 ++++-----
 wizards/com/sun/star/wizards/ui/event/DataAwareFields.py  |    6 -
 wizards/com/sun/star/wizards/ui/event/RadioDataAware.java |    1 
 wizards/com/sun/star/wizards/ui/event/RadioDataAware.py   |   13 --
 wizards/com/sun/star/wizards/ui/event/UnoDataAware.py     |   78 ++------------
 6 files changed, 52 insertions(+), 101 deletions(-)

New commits:
commit 8aa177e48129b7f2f0a706eaf6eaa65d0802e8e1
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue Jun 28 23:11:17 2011 +0200

    we won't need it

diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py
index b7715ac..89e6c83 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.py
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py
@@ -20,6 +20,7 @@ class ConfigGroup(ConfigNode):
             child.writeConfiguration(configView.getByName(propertyName),
                 prefix)
         else:
+            print getattr(self,field)
             configView.setHierarchicalPropertyValue(propertyName,getattr(self,field))
 
 
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 0ba6064..6af7026 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -344,70 +344,70 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             self.myConfig.readConfiguration(root, "cp_")
             self.mainDA.append(RadioDataAware.attachRadioButtons(
                 self.myConfig, "cp_FaxType",
-                (self.optBusinessFax, self.optPrivateFax), None, True))
+                (self.optBusinessFax, self.optPrivateFax), True))
             self.mainDA.append(UnoDataAware.attachListBox(
                 self.myConfig.cp_BusinessFax, "cp_Style",
-                self.lstBusinessStyle, None, True))
+                self.lstBusinessStyle, True))
             self.mainDA.append(UnoDataAware.attachListBox(
                 self.myConfig.cp_PrivateFax, "cp_Style", self.lstPrivateStyle,
-                None, True))
+                True))
             cgl = self.myConfig.cp_BusinessFax
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
-                "cp_PrintCompanyLogo", self.chkUseLogo, None, True))
+                "cp_PrintCompanyLogo", self.chkUseLogo, True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
-                "cp_PrintSubjectLine", self.chkUseSubject, None, True))
+                "cp_PrintSubjectLine", self.chkUseSubject, True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
-                "cp_PrintSalutation", self.chkUseSalutation, None, True))
+                "cp_PrintSalutation", self.chkUseSalutation, True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
-                "cp_PrintDate", self.chkUseDate, None, True))
+                "cp_PrintDate", self.chkUseDate, True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
                 "cp_PrintCommunicationType", self.chkUseCommunicationType,
-                None, True))
+                True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
-                "cp_PrintGreeting", self.chkUseGreeting, None, True))
+                "cp_PrintGreeting", self.chkUseGreeting, True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
-                "cp_PrintFooter", self.chkUseFooter, None, True))
+                "cp_PrintFooter", self.chkUseFooter, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_Salutation", self.lstSalutation, None, True))
+                "cp_Salutation", self.lstSalutation, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_Greeting", self.lstGreeting, None, True))
+                "cp_Greeting", self.lstGreeting, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
                 "cp_CommunicationType", self.lstCommunicationType,
-                None, True))
+                True))
             self.faxDA.append(RadioDataAware.attachRadioButtons(cgl,
                 "cp_SenderAddressType", (self.optSenderDefine, \
-                self.optSenderPlaceholder), None, True))
+                self.optSenderPlaceholder), True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_SenderCompanyName", self.txtSenderName, None, True))
+                "cp_SenderCompanyName", self.txtSenderName, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_SenderStreet", self.txtSenderStreet, None, True))
+                "cp_SenderStreet", self.txtSenderStreet, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_SenderPostCode", self.txtSenderPostCode, None, True))
+                "cp_SenderPostCode", self.txtSenderPostCode, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_SenderState", self.txtSenderState, None, True))
+                "cp_SenderState", self.txtSenderState, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_SenderCity", self.txtSenderCity, None, True))
+                "cp_SenderCity", self.txtSenderCity, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_SenderFax", self.txtSenderFax, None, True))
+                "cp_SenderFax", self.txtSenderFax, True))
             self.faxDA.append(RadioDataAware.attachRadioButtons(cgl,
                 "cp_ReceiverAddressType", (self.optReceiverDatabase,
-                self.optReceiverPlaceholder), None, True))
+                self.optReceiverPlaceholder), True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_Footer", self.txtFooter, None, True))
+                "cp_Footer", self.txtFooter, True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
                 "cp_FooterOnlySecondPage", self.chkFooterNextPages,
-                None, True))
+                True))
             self.faxDA.append(UnoDataAware.attachCheckBox(cgl,
                 "cp_FooterPageNumbers", self.chkFooterPageNumbers,
-                None, True))
+                True))
             self.faxDA.append(RadioDataAware.attachRadioButtons(cgl,
                 "cp_CreationType", (self.optCreateFax, self.optMakeChanges),
-                None, True))
+                True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
-                "cp_TemplateName", self.txtTemplateName, None, True))
+                "cp_TemplateName", self.txtTemplateName, True))
             self.faxDA.append(UnoDataAware.attachEditControl(cgl,
                 "cp_TemplatePath", self.myPathSelection.xSaveTextBox,
-                None, True))
+                True))
         except Exception, exception:
             traceback.print_exc()
 
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py
index 4a8e04b..95f4ea1 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py
@@ -29,15 +29,19 @@ class DataAwareFields(object):
         try:
             f = getattr(owner, fieldname)
             if isinstance(f,bool):
+                pass
                 return self.__BooleanFieldValue(fieldname, value)
             elif isinstance(f,str):
+                pass
                 return self.__ConvertedStringValue(fieldname, value)
             elif isinstance(f,int):
+                pass
                 return self.__IntFieldValue(fieldname, value)
             elif isinstance(f,float):
                 pass
-                #return self.__IntFieldValue(fieldname, value)
+                return self.__IntFieldValue(fieldname, value)
             else:
+                pass
                 return self.__IntFieldValue(fieldname, value)
 
         except AttributeError, ex:
diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
index 3954b2e..ceaeaa0 100644
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
@@ -92,6 +92,7 @@ public class RadioDataAware extends DataAware
                 ? DataAwareFields.getFieldValueFor(data, dataProp, new Integer(0))
                 : new DataAware.PropertyValue(dataProp, data), buttons);
         XItemListener xil = UnoDataAware.itemListener(da, listener);
+        System.out.println(listener);
         for (int i = 0; i < da.radioButtons.length; i++)
         {
             da.radioButtons[i].addItemListener(xil);
diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
index 95df5c7..0eb4678 100644
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
@@ -10,19 +10,19 @@ Window>Preferences>Java>Code Generation>Code and Comments
 
 class RadioDataAware(DataAware):
 
-    def __init__(self, data, value, radioButs):
+    def __init__(self, data, value, radioButtons):
         super(RadioDataAware,self).__init__(data, value)
-        self.radioButtons = radioButs
+        self.radioButtons = radioButtons
 
     def setToUI(self, value):
         selected = int(value)
         if selected == -1:
             i = 0
             while i < self.radioButtons.length:
-                self.radioButtons[i].setState(False)
+                self.radioButtons[i].State = False
                 i += 1
         else:
-            self.radioButtons[selected].setState(True)
+            self.radioButtons[selected].State = True
 
     def getFromUI(self):
         for i in self.radioButtons:
@@ -32,14 +32,11 @@ class RadioDataAware(DataAware):
         return -1
 
     @classmethod
-    def attachRadioButtons(self, data, dataProp, buttons, listener, field):
+    def attachRadioButtons(self, data, dataProp, buttons, field):
         if field:
             aux = DataAwareFields.getFieldValueFor(data, dataProp, 0)
         else:
             aux = DataAware.PropertyValue (dataProp, data)
 
         da = RadioDataAware(data, aux , buttons)
-        xil = UnoDataAware.ItemListener(da, listener)
-        for i in da.radioButtons:
-            i.addItemListener(xil)
         return da
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index 9e4a456..c2ed027 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -1,7 +1,4 @@
 from DataAware import *
-import unohelper
-from com.sun.star.awt import XItemListener
-from com.sun.star.awt import XTextListener
 from DataAwareFields import *
 from common.Helper import *
 
@@ -21,7 +18,7 @@ class UnoDataAware(DataAware):
     def __init__(self, dataObject, value, unoObject_, unoPropName_):
         super(UnoDataAware,self).__init__(dataObject, value)
         self.unoControl = unoObject_
-        self.unoModel = self.getModel(self.unoControl)
+        self.unoModel = self.unoControl.Model
         self.unoPropName = unoPropName_
         self.disableObjects = range(0)
         self.inverse = False
@@ -45,18 +42,6 @@ class UnoDataAware(DataAware):
     def setToUI(self, value):
         Helper.setUnoPropertyValue(self.unoModel, self.unoPropName, value)
 
-    def stringof(self, value):
-        if value.getClass().isArray():
-            sb = StringBuffer.StringBuffer_unknown("[")
-            i = 0
-            while i < (value).length:
-                sb.append((value)[i]).append(" , ")
-                i += 1
-            sb.append("]")
-            return sb.toString()
-        else:
-            return value.toString()
-
     '''
     Try to get from an arbitrary object a boolean value.
     Null returns False;
@@ -97,73 +82,43 @@ class UnoDataAware(DataAware):
 
     @classmethod
     def __attachTextControl(
-        self, data, prop, unoText, listener, unoProperty, field, value):
+        self, data, prop, unoText, unoProperty, field, value):
         if field:
             aux = DataAwareFields.getFieldValueFor(data, prop, value)
         else:
             aux = DataAware.PropertyValue (prop, data)
         uda = UnoDataAware(data, aux, unoText, unoProperty)
-        unoText.addTextListener(self.TextListener(uda,listener))
         return uda
 
-    class TextListener(unohelper.Base, XTextListener):
-
-        def __init__(self, uda,listener):
-            self.uda = uda
-            self.listener = listener
-
-        def textChanged(te):
-            self.uda.updateData()
-            if self.listener:
-                self.listener.eventPerformed(te)
-
-        def disposing(self,eo):
-            pass
-
     @classmethod
-    def attachEditControl(self, data, prop, unoControl, listener, field):
+    def attachEditControl(self, data, prop, unoControl, field):
         return self.__attachTextControl(
-            data, prop, unoControl, listener, "Text", field, "")
+            data, prop, unoControl, "Text", field, "")
 
     @classmethod
-    def attachDateControl(self, data, prop, unoControl, listener, field):
+    def attachDateControl(self, data, prop, unoControl, field):
         return self.__attachTextControl(
-            data, prop, unoControl, listener, "Date", field, 0)
+            data, prop, unoControl, "Date", field, 0)
 
-    def attachTimeControl(self, data, prop, unoControl, listener, field):
+    def attachTimeControl(self, data, prop, unoControl, field):
         return self.__attachTextControl(
-            data, prop, unoControl, listener, "Time", field, 0)
+            data, prop, unoControl, "Time", field, 0)
 
     @classmethod
-    def attachNumericControl(self, data, prop, unoControl, listener, field):
+    def attachNumericControl(self, data, prop, unoControl, field):
         return self.__attachTextControl(
-            data, prop, unoControl, listener, "Value", field, float(0))
+            data, prop, unoControl, "Value", field, float(0))
 
     @classmethod
-    def attachCheckBox(self, data, prop, checkBox, listener, field):
+    def attachCheckBox(self, data, prop, checkBox, field):
         if field:
             aux = DataAwareFields.getFieldValueFor(data, prop, 0)
         else:
             aux = DataAware.PropertyValue (prop, data)
         uda = UnoDataAware(data, aux , checkBox, PropertyNames.PROPERTY_STATE)
-        checkBox.addItemListener(self.ItemListener(uda, listener))
         return uda
 
-    class ItemListener(unohelper.Base, XItemListener):
-
-        def __init__(self, da, listener):
-            self.da = da
-            self.listener = listener
-
-        def itemStateChanged(self, ie):
-            self.da.updateData()
-            if self.listener != None:
-                self.listener.eventPerformed(ie)
-
-        def disposing(self, eo):
-            pass
-
-    def attachLabel(self, data, prop, label, listener, field):
+    def attachLabel(self, data, prop, label, field):
         if field:
             aux = DataAwareFields.getFieldValueFor(data, prop, "")
         else:
@@ -171,22 +126,15 @@ class UnoDataAware(DataAware):
         return UnoDataAware(data, aux, label, PropertyNames.PROPERTY_LABEL)
 
     @classmethod
-    def attachListBox(self, data, prop, listBox, listener, field):
+    def attachListBox(self, data, prop, listBox, field):
         if field:
             aux = DataAwareFields.getFieldValueFor(
                 data, prop, uno.Any("short",0))
         else:
             aux = DataAware.PropertyValue (prop, data)
         uda = UnoDataAware(data, aux, listBox, "SelectedItems")
-        listBox.addItemListener(self.ItemListener(uda,listener))
         return uda
 
-    def getModel(self, control):
-        return control.getModel()
-
-    def setEnabled(self, control, enabled):
-        setEnabled(control, enabled)
-
     def setEnabled(self, control, enabled):
         Helper.setUnoPropertyValue(
             getModel(control), PropertyNames.PROPERTY_ENABLED, enabled)


More information about the Libreoffice-commits mailing list