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

Xisco Fauli xfauli at kemper.freedesktop.org
Thu Jun 16 10:47:40 PDT 2011


 wizards/com/sun/star/wizards/common/FileAccess.py         |   12 ++--
 wizards/com/sun/star/wizards/fax/CallWizard.py            |    6 +-
 wizards/com/sun/star/wizards/fax/FaxDocument.py           |   13 ++---
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py   |   20 ++++----
 wizards/com/sun/star/wizards/text/TextDocument.py         |   10 ++--
 wizards/com/sun/star/wizards/ui/PeerConfig.py             |    2 
 wizards/com/sun/star/wizards/ui/WizardDialog.py           |    4 -
 wizards/com/sun/star/wizards/ui/event/DataAware.py        |   13 ++---
 wizards/com/sun/star/wizards/ui/event/MethodInvocation.py |   35 --------------
 9 files changed, 40 insertions(+), 75 deletions(-)

New commits:
commit 3bb9d47fa675ae9e16f0452af04ad0c9191f62b2
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Thu Jun 16 19:47:04 2011 +0200

    Remove unused class

diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index c129b6b..83a4472 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -391,8 +391,6 @@ class FileAccess(object):
     def getFolderTitles(self, xMSF, FilterName, FolderName):
         LocLayoutFiles = [[2],[]]
         try:
-            TitleVector = None
-            NameVector = None
             xDocInterface = xMSF.createInstance(
                 "com.sun.star.document.DocumentProperties")
             xInterface = xMSF.createInstance(
@@ -400,17 +398,19 @@ class FileAccess(object):
             nameList = xInterface.getFolderContents(FolderName, False)
             TitleVector = []
             NameVector = []
-            if FilterName == None or FilterName == "":
+            if FilterName is None or FilterName == "":
                 FilterName = None
             else:
                 FilterName = FilterName + "-"
             fileName = ""
+            NameVectorAppend = NameVector.append
+            TitleVectoAppend = TitleVector.append
             for i in nameList:
                 fileName = self.getFilename(i)
-                if FilterName == None or fileName.startswith(FilterName):
+                if FilterName is None or fileName.startswith(FilterName):
                     xDocInterface.loadFromMedium(i, tuple())
-                    NameVector.append(i)
-                    TitleVector.append(xDocInterface.Title)
+                    NameVectorAppend(i)
+                    TitleVectoAppend(xDocInterface.Title)
 
             LocLayoutFiles[1] = NameVector
             LocLayoutFiles[0] = TitleVector
diff --git a/wizards/com/sun/star/wizards/fax/CallWizard.py b/wizards/com/sun/star/wizards/fax/CallWizard.py
index 6faa349..2141450 100644
--- a/wizards/com/sun/star/wizards/fax/CallWizard.py
+++ b/wizards/com/sun/star/wizards/fax/CallWizard.py
@@ -20,7 +20,7 @@ class CallWizard(object):
         xregistrykey):
 
         xsingleservicefactory = None
-        if stringImplementationName.equals(WizardImplementation.getName()):
+        if stringImplementationName.equals(WizardImplementation.Name):
             xsingleservicefactory = FactoryHelper.getServiceFactory( \
                 WizardImplementation, WizardImplementation.__serviceName,
                 xMSF, xregistrykey)
@@ -123,7 +123,7 @@ class CallWizard(object):
         def getImplementationId(self):
             byteReturn = []
             try:
-                byteReturn = ("" + self.hashCode()).getBytes()
+                byteReturn = ("" + self.hashCode()).Bytes
             except Exception, exception:
                 traceback.print_exc()
 
@@ -135,7 +135,7 @@ class CallWizard(object):
         '''
 
         def getImplementationName(self):
-            return (WizardImplementation.getName())
+            return (WizardImplementation.Name)
 
         '''
         Provides a sequence of all types (usually interface types) provided
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py
index 8c0f0c4..f07917d 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.py
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py
@@ -34,7 +34,7 @@ class FaxDocument(TextDocument):
         FH.updateDateFields()
 
     def switchFooter(self, sPageStyle, bState, bPageNumber, sText):
-        if self.xTextDocument != None:
+        if self.xTextDocument is not None:
             self.xTextDocument.lockControllers()
             try:
 
@@ -45,7 +45,7 @@ class FaxDocument(TextDocument):
                 if bState:
                     xPageStyle.setPropertyValue("FooterIsOn", True)
                     xFooterText = propertySet.getPropertyValue("FooterText")
-                    xFooterText.setString(sText)
+                    xFooterText.String = sText
 
                     if bPageNumber:
                         #Adding the Page Number
@@ -60,9 +60,8 @@ class FaxDocument(TextDocument):
                         xPageNumberField.setPropertyValue(
                             "NumberingType", uno.Any("short",ARABIC))
                         xPageNumberField.setPropertyValue("SubType", CURRENT)
-                        xFooterText.insertTextContent(xFooterText.getEnd(),
+                        xFooterText.insertTextContent(xFooterText.End,
                             xPageNumberField, False)
-
                 else:
                     Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn",
                         False)
@@ -72,7 +71,7 @@ class FaxDocument(TextDocument):
                 traceback.print_exc()
 
     def hasElement(self, sElement):
-        if self.xTextDocument != None:
+        if self.xTextDocument is not None:
             mySectionHandler = TextSectionHandler(self.xMSF,
                 self.xTextDocument)
             return mySectionHandler.hasTextSectionByName(sElement)
@@ -118,13 +117,13 @@ class FaxDocument(TextDocument):
             if not self.keepLogoFrame:
                 xTF = TextFrameHandler.getFrameByName("Company Logo",
                 self.xTextDocument)
-                if xTF != None:
+                if xTF is not None:
                     xTF.dispose()
 
             if not self.keepTypeFrame:
                 xTF = TextFrameHandler.getFrameByName("Communication Type",
                 self.xTextDocument)
-                if xTF != None:
+                if xTF is not None:
                     xTF.dispose()
 
         except UnoException, e:
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 1905ae6..5cae6d6 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -98,7 +98,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             if self.myPathSelection.xSaveTextBox.Text.lower() == "":
                 self.myPathSelection.initializePath()
 
-            self.xContainerWindow = self.myFaxDoc.xFrame.getContainerWindow()
+            self.xContainerWindow = self.myFaxDoc.xFrame.ContainerWindow
             self.createWindowPeer(self.xContainerWindow)
 
             #add the Roadmap to the dialog:
@@ -116,7 +116,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             self.initializeElements()
 
             #disable the document, so that the user cannot change anything:
-            self.myFaxDoc.xFrame.getComponentWindow().Enable = False
+            self.myFaxDoc.xFrame.ComponentWindow.Enable = False
 
             self.executeDialogFromComponent(self.myFaxDoc.xFrame)
             self.removeTerminateListener()
@@ -133,16 +133,16 @@ class FaxWizardDialogImpl(FaxWizardDialog):
         self.running = False
 
     def finishWizard(self):
-        self.switchToStep(self.getCurrentStep(), self.nMaxStep)
+        self.switchToStep(self.CurrentStep, self.nMaxStep)
         self.myFaxDoc.setWizardTemplateDocInfo( \
             self.resources.resFaxWizardDialog_title,
             self.resources.resTemplateDescription)
         try:
             fileAccess = FileAccess(self.xMSF)
-            self.sPath = self.myPathSelection.getSelectedPath()
+            self.sPath = self.myPathSelection.SelectedPath
             if self.sPath == "":
                 self.myPathSelection.triggerPathPicker()
-                self.sPath = self.myPathSelection.getSelectedPath()
+                self.sPath = self.myPathSelection.SelectedPath
             print self.sPath
 
             self.sPath = fileAccess.getURL(self.sPath)
@@ -152,7 +152,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             if not self.__filenameChanged:
                 if fileAccess.exists(self.sPath, True):
                     answer = SystemDialog.showMessageBox( \
-                        xMSF, xControl.getPeer(), "MessBox",
+                        xMSF, xControl.Peer, "MessBox",
                         VclWindowPeerAttribute.YES_NO + \
                         VclWindowPeerAttribute.DEF_NO,
                         self.resources.resOverwriteWarning)
@@ -198,7 +198,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
 
                 oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF),
                     self.sPath, "_default", loadValues)
-                myViewHandler = oDoc.getCurrentController().getViewSettings()
+                myViewHandler = oDoc.CurrentController.ViewSettings
                 myViewHandler.setPropertyValue("ZoomType",
                     uno.Any("short",OPTIMAL))
             else:
@@ -445,7 +445,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
         self.__setPossibleFooter(True)
     def lstBusinessStyleItemChanged(self):
         self.xTextDocument = self.myFaxDoc.loadAsPreview( \
-            self.BusinessFiles[1][self.lstBusinessStyle.getSelectedItemPos()],
+            self.BusinessFiles[1][self.lstBusinessStyle.SelectedItemPos],
                 False)
         self.initializeElements()
         self.setElements()
@@ -467,13 +467,13 @@ class FaxWizardDialogImpl(FaxWizardDialog):
 
     def lstPrivateStyleItemChanged(self):
         self.xTextDocument = self.myFaxDoc.loadAsPreview( \
-            self.PrivateFiles[1][self.lstPrivateStyle.getSelectedItemPos()],
+            self.PrivateFiles[1][self.lstPrivateStyle.SelectedItemPos],
                 False)
         self.initializeElements()
         self.setElements()
 
     def txtTemplateNameTextChanged(self):
-        xDocProps = self.xTextDocument.getDocumentProperties()
+        xDocProps = self.xTextDocument.DocumentProperties
         xDocProps.Title = self.txtTemplateName.Text
 
     def optSenderPlaceholderItemChanged(self):
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index fed93fc..7c564d5 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -169,17 +169,17 @@ class TextDocument(object):
         xTextCursor.gotoStart(False)
         com.sun.star.wizards.common.Helper.setUnoPropertyValue(
             xTextCursor, "PageDescName", "First Page")
-        xTextCursor.setString(ScaleString)
+        xTextCursor.String = ScaleString
         xViewCursor = self.xTextDocument.CurrentController
-        xTextViewCursor = xViewCursor.getViewCursor()
+        xTextViewCursor = xViewCursor.ViewCursor
         xTextViewCursor.gotoStart(False)
-        iFirstPos = xTextViewCursor.getPosition().X
+        iFirstPos = xTextViewCursor.Position.X
         xTextViewCursor.gotoEnd(False)
-        iLastPos = xTextViewCursor.getPosition().X
+        iLastPos = xTextViewCursor.Position.X
         iScale = (iLastPos - iFirstPos) / iScaleLen
         xTextCursor.gotoStart(False)
         xTextCursor.gotoEnd(True)
-        xTextCursor.setString("")
+        xTextCursor.String = ""
         unlockallControllers()
         return iScale
 
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.py b/wizards/com/sun/star/wizards/ui/PeerConfig.py
index 7f0dba4..4647ad1 100644
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.py
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.py
@@ -42,7 +42,7 @@ class PeerConfig(object):
             i = 0
             while i < self.m_aPeerTasks.size():
                 aPeerTask = self.m_aPeerTasks.elementAt(i)
-                xVclWindowPeer = aPeerTask.xControl.getPeer()
+                xVclWindowPeer = aPeerTask.xControl.Peer
                 n = 0
                 while n < aPeerTask.propnames.length:
                     xVclWindowPeer.setProperty(aPeerTask.propnames[n],
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 4ed4fe3..ad46e2d 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -159,12 +159,12 @@ class WizardDialog(UnoDialog2):
             return -1
 
     def getRMItemCount(self):
-        return self.oRoadmap.getCount()
+        return self.oRoadmap.Count
 
     def getRoadmapItemByID(self, _ID):
         try:
             i = 0
-            while i < self.oRoadmap.getCount():
+            while i < self.oRoadmap.Count:
                 CurRoadmapItem = self.oRoadmap.getByIndex(i)
                 CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"))
                 if CurID == _ID:
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index 2e7c3e3..f21b86b 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -77,7 +77,7 @@ class DataAware(object):
     def updateUI(self):
         data = self.getFromData()
         ui = self.getFromUI()
-        if data != ui:
+        if data is not ui:
             try:
                 self.setToUI(data)
             except Exception, ex:
@@ -145,10 +145,11 @@ class DataAware(object):
     '''
 
     def setDataObject(self, dataObject, updateUI):
-        if dataObject != None and not (type(self._value) is not
-            type(dataObject)):
-            raise ClassCastException (
-                "can not cast new DataObject to original Class")
+        if dataObject is not None:
+            if not (type(self._value) is not
+                type(dataObject)):
+                raise ClassCastException (
+                    "can not cast new DataObject to original Class")
         self._dataObject = dataObject
         if updateUI:
             self.updateUI()
@@ -166,7 +167,7 @@ class DataAware(object):
     @classmethod
     def setDataObjects(self, dataAwares, dataObject, updateUI):
         for i in dataAwares:
-            i.setDataObject(dataObject, updateUI);
+            i.setDataObject(dataObject, updateUI)
 
     '''
     Value objects read and write a value from and
diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.py b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.py
deleted file mode 100644
index 2bdbcc6..0000000
--- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.py
+++ /dev/null
@@ -1,35 +0,0 @@
-'''import java.lang.reflect.InvocationTargetException;
-
-import java.lang.reflect.Method;
-
-import com.sun.star.wizards.common.PropertyNames;
-'''
-
-'''Encapsulate a Method invocation.
-In the constructor one defines a method, a target object and an optional
-Parameter.
-Then one calls "invoke", with or without a parameter. <br/>
-Limitations: I do not check anything myself. If the param is not ok, from the
-wrong type, or the mothod doesnot exist on the given object.
-You can trick this class howmuch you want: it will all throw exceptions
-on the java level. i throw no error warnings or my own excceptions...
-'''
-
-class MethodInvocation(object):
-
-    EMPTY_ARRAY = ()
-
-    '''Creates a new instance of MethodInvokation'''
-    def __init__(self, method, obj, paramClass=None):
-        self.mMethod = method
-        self.mObject = obj
-        self.mWithParam = not (paramClass==None)
-
-    '''Returns the result of calling the method on the object, or null,
-    if no result. '''
-
-    def invoke(self, param=None):
-        if self.mWithParam:
-            return self.mMethod.invoke(self.mObject, (param))
-        else:
-            return self.mMethod.invoke(self.mObject, EMPTY_ARRAY)


More information about the Libreoffice-commits mailing list