[Libreoffice-commits] .: 8 commits - wizards/com

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 15 14:58:53 PDT 2012


 wizards/com/sun/star/wizards/README                                |   19 +
 wizards/com/sun/star/wizards/common/Configuration.py               |   11 
 wizards/com/sun/star/wizards/common/Resource.py                    |   10 
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py            |    8 
 wizards/com/sun/star/wizards/letter/LetterWizardDialog.py          |   15 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py      |  185 ++--------
 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py |   61 ++-
 wizards/com/sun/star/wizards/letter/LocaleCodes.py                 |  171 ---------
 8 files changed, 118 insertions(+), 362 deletions(-)

New commits:
commit ae92b2730cac8a1953c36c1f6a24a495ad7c2edd
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 23:57:16 2012 +0200

    pyfax: remove duplicate code
    
    Change-Id: I79230db9b393f4548be6aee753fed80a4416f270

diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 584eaa2..b33ded0 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -150,9 +150,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
 
     def finishWizard(self):
         self.switchToStep(self.getCurrentStep(), self.nMaxStep)
-        self.myFaxDoc.setWizardTemplateDocInfo( \
-            self.resources.resFaxWizardDialog_title,
-            self.resources.resTemplateDescription)
         endWizard = True
         try:
             fileAccess = FileAccess(self.xMSF)
@@ -299,7 +296,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             self.sWorkPath = FileAccess.getOfficePath2(xMSF, "Work", "", "")
             self.BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus",
                 self.sFaxPath, self.resources.dictBusinessTemplate)
-            print self.BusinessFiles
             self.PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri",
                 self.sFaxPath, self.resources.dictPrivateTemplate)
             
commit a7181f0d5fa0fef89b9f73ee1b2c27dbae161f51
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 23:44:49 2012 +0200

    pyletter: Fix statement
    
    Change-Id: I11f2b9be6c1a63719a20d08680d8f576090ce935

diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 905fe98..f977132 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -163,7 +163,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         try:
             fileAccess = FileAccess(self.xMSF)
             self.sPath = self.myPathSelection.getSelectedPath()
-            if self.sPath:
+            if not self.sPath:
                 self.myPathSelection.triggerPathPicker()
                 self.sPath = self.myPathSelection.getSelectedPath()
 
commit 1b6b8bbd3a04f82a468c9bf798cfa69b0e46c1f2
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 23:38:24 2012 +0200

    pyletter: localise listboxes at runtime
    
    Change-Id: I5bb73b63572fa165e33b84e309b430ede6070c85

diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 9ed3ad9..905fe98 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -376,8 +376,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             LetterWizardDialogImpl.lstBusinessStylePos = selectedItemPos
             TextDocument.xTextDocument = \
                 self.myLetterDoc.loadAsPreview(
-                    self.BusinessFiles[1][selectedItemPos],
-                    False)
+                    self.BusinessFiles.values()[selectedItemPos], False)
             self.myLetterDoc.xTextDocument.lockControllers()
             self.initializeElements()
             self.chkBusinessPaperItemChanged()
@@ -390,8 +389,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             LetterWizardDialogImpl.lstPrivOfficialStylePos = selectedItemPos
             TextDocument.xTextDocument = \
                 self.myLetterDoc.loadAsPreview(
-                    self.OfficialFiles[1][selectedItemPos],
-                    False)
+                    self.OfficialFiles.values()[selectedItemPos], False)
             self.myLetterDoc.xTextDocument.lockControllers()
             self.initializeElements()
             self.setPossibleSenderData(True)
@@ -404,8 +402,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             LetterWizardDialogImpl.lstPrivateStylePos = selectedItemPos
             TextDocument.xTextDocument = \
                 self.myLetterDoc.loadAsPreview(
-                    self.PrivateFiles[1][selectedItemPos],
-                    False)
+                    self.PrivateFiles.values()[selectedItemPos], False)
             self.myLetterDoc.xTextDocument.lockControllers()
             self.initializeElements()
             self.setElements(True)
@@ -906,20 +903,23 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         sLetterPath = FileAccess.combinePaths(
             xMSF, self.sTemplatePath, "/../common/wizard/letter")
         self.BusinessFiles = \
-            FileAccess.getFolderTitles(xMSF, "bus", sLetterPath)
+            FileAccess.getFolderTitles(
+                xMSF, "bus", sLetterPath, self.resources.dictBusinessTemplate)
         self.OfficialFiles = \
-            FileAccess.getFolderTitles(xMSF, "off", sLetterPath)
+            FileAccess.getFolderTitles(
+                xMSF, "off", sLetterPath, self.resources.dictOfficialTemplate)
         self.PrivateFiles = \
-            FileAccess.getFolderTitles(xMSF, "pri", sLetterPath)
+            FileAccess.getFolderTitles(
+                xMSF, "pri", sLetterPath, self.resources.dictPrivateTemplate)
         self.setControlProperty(
             "lstBusinessStyle", "StringItemList",
-            tuple(self.BusinessFiles[0]))
+            tuple(self.BusinessFiles.keys()))
         self.setControlProperty(
             "lstPrivOfficialStyle", "StringItemList",
-            tuple(self.OfficialFiles[0]))
+            tuple(self.OfficialFiles.keys()))
         self.setControlProperty(
             "lstPrivateStyle", "StringItemList",
-            tuple(self.PrivateFiles[0]))
+            tuple(self.PrivateFiles.keys()))
         self.setControlProperty(
             "lstBusinessStyle", "SelectedItems", (0,))
         self.setControlProperty(
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
index a80c0fe..58bef59 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
@@ -33,7 +33,6 @@ class LetterWizardDialogResources(Resource):
         self.RoadmapLabels = []
         self.SalutationLabels = []
         self.GreetingLabels = []
-        self.LanguageLabels = []
 
         self.resLetterWizardDialog_title = \
             self.getResText(
@@ -210,6 +209,35 @@ class LetterWizardDialogResources(Resource):
             self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 58)
 
+        #Create a dictionary for localising the bussiness templates
+        self.dictBusinessTemplate = {
+        "Elegant" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 60),
+        "Modern" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 61),
+        "Office" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 62)}
+                
+        #Create a dictionary for localising the official templates
+        self.dictOfficialTemplate = {
+        "Elegant" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 60),
+        "Modern" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 61),
+        "Office" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 62)}
+
+        #Create a dictionary for localising the private templates
+        self.dictPrivateTemplate = {                
+        "Bottle" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 63),
+        "Mail" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 64),
+        "Marine" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 65),
+        "RedLine" : self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 66)}
+
         #Common Resources
         self.resOverwriteWarning = \
             self.getResText(
@@ -221,7 +249,6 @@ class LetterWizardDialogResources(Resource):
         self.loadRoadmapResources()
         self.loadSalutationResources()
         self.loadGreetingResources()
-        self.loadCommonResources()
 
     def loadRoadmapResources(self):       
         for i in xrange(6):
commit c5a829e570dda24aca7a67112ac8632b9307ef53
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 21:32:49 2012 +0200

    pyletter: Clean up resources
    
    Change-Id: Ia387ef2a7166374a1f7770609f9e7b25217ab4fc

diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 0f68929..9ed3ad9 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -109,31 +109,31 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             #from the registry and apply listeners to the controls:
             self.initConfiguration()
 
-            if self.myConfig.cp_BusinessLetter.cp_Greeting == "":
+            if self.myConfig.cp_BusinessLetter.cp_Greeting :
                 self.myConfig.cp_BusinessLetter.cp_Greeting = \
                     self.resources.GreetingLabels[0]
 
-            if self.myConfig.cp_BusinessLetter.cp_Salutation == "":
+            if self.myConfig.cp_BusinessLetter.cp_Salutation:
                 self.myConfig.cp_BusinessLetter.cp_Salutation = \
                     self.resources.SalutationLabels[0]
 
-            if self.myConfig.cp_PrivateOfficialLetter.cp_Greeting == "":
+            if self.myConfig.cp_PrivateOfficialLetter.cp_Greeting:
                 self.myConfig.cp_PrivateOfficialLetter.cp_Greeting = \
                     self.resources.GreetingLabels[1]
 
-            if self.myConfig.cp_PrivateOfficialLetter.cp_Salutation == "":
+            if self.myConfig.cp_PrivateOfficialLetter.cp_Salutation:
                 self.myConfig.cp_PrivateOfficialLetter.cp_Salutation = \
                     self.resources.SalutationLabels[1]
 
-            if self.myConfig.cp_PrivateLetter.cp_Greeting == "":
+            if self.myConfig.cp_PrivateLetter.cp_Greeting:
                 self.myConfig.cp_PrivateLetter.cp_Greeting = \
                     self.resources.GreetingLabels[2]
 
-            if self.myConfig.cp_PrivateLetter.cp_Salutation == "":
+            if self.myConfig.cp_PrivateLetter.cp_Salutation:
                 self.myConfig.cp_PrivateLetter.cp_Salutation = \
                     self.resources.SalutationLabels[2]
 
-            if self.myPathSelection.xSaveTextBox.Text.lower() == "":
+            if self.myPathSelection.xSaveTextBox.Text.lower():
                 self.myPathSelection.initializePath()
 
             xContainerWindow = self.myLetterDoc.xFrame.ContainerWindow
@@ -163,7 +163,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         try:
             fileAccess = FileAccess(self.xMSF)
             self.sPath = self.myPathSelection.getSelectedPath()
-            if self.sPath == "":
+            if self.sPath:
                 self.myPathSelection.triggerPathPicker()
                 self.sPath = self.myPathSelection.getSelectedPath()
 
@@ -277,7 +277,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.lstBusinessStyleItemChanged()
         self.enableSenderReceiver()
         self.setPossibleFooter(True)
-        if self.myPathSelection.xSaveTextBox.Text.lower() == "":
+        if self.myPathSelection.xSaveTextBox.Text.lower():
             self.myPathSelection.initializePath()
 
     def optPrivOfficialLetterItemChanged(self):
@@ -301,7 +301,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.disableBusinessPaper()
         self.enableSenderReceiver()
         self.setPossibleFooter(True)
-        if self.myPathSelection.xSaveTextBox.Text.lower() == "":
+        if self.myPathSelection.xSaveTextBox.Text.lower():
             self.myPathSelection.initializePath()
 
     def optPrivateLetterItemChanged(self):
@@ -325,7 +325,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.disableBusinessPaper()
         self.disableSenderReceiver()
         self.setPossibleFooter(False)
-        if self.myPathSelection.xSaveTextBox.Text.lower() == "":
+        if self.myPathSelection.xSaveTextBox.Text.lower():
             self.myPathSelection.initializePath()
 
     def optSenderPlaceholderItemChanged(self):
@@ -776,10 +776,10 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             self.chkUseGreeting.State != 0)
 
     def setDefaultForGreetingAndSalutation(self):
-        if self.lstSalutation.Text == "":
+        if self.lstSalutation.Text:
             self.lstSalutation.Text = self.resources.SalutationLabels[0]
 
-        if self.lstGreeting.Text == "":
+        if self.lstGreeting.Text:
             self.lstGreeting.Text = self.resources.GreetingLabels[0]
 
     def lstGreetingItemChanged(self):
@@ -875,11 +875,12 @@ class LetterWizardDialogImpl(LetterWizardDialog):
     def initializeSalutation(self):
         self.setControlProperty(
             "lstSalutation", "StringItemList",
-            self.resources.SalutationLabels)
+            tuple(self.resources.SalutationLabels))
 
     def initializeGreeting(self):
         self.setControlProperty(
-            "lstGreeting", "StringItemList", self.resources.GreetingLabels)
+            "lstGreeting", "StringItemList",
+            tuple(self.resources.GreetingLabels))
 
     def getCurrentLetter(self):
         if self.myConfig.cp_LetterType == 0:
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
index 299472e..a80c0fe 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
@@ -30,11 +30,11 @@ class LetterWizardDialogResources(Resource):
     def __init__(self, xmsf):
         super(LetterWizardDialogResources,self).__init__(
             xmsf, LetterWizardDialogResources.MODULE_NAME)
+        self.RoadmapLabels = []
+        self.SalutationLabels = []
+        self.GreetingLabels = []
+        self.LanguageLabels = []
 
-        self.RoadmapLabels = ()
-        self.SalutationLabels = ()
-        self.GreetingLabels = ()
-        self.LanguageLabels = ()
         self.resLetterWizardDialog_title = \
             self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 1)
@@ -209,28 +209,34 @@ class LetterWizardDialogResources(Resource):
         self.reslblTitle6_value = \
             self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 58)
-        self.loadRoadmapResources()
-        self.loadSalutationResources()
-        self.loadGreetingResources()
-        self.loadCommonResources()
 
-    def loadCommonResources(self):
+        #Common Resources
         self.resOverwriteWarning = \
             self.getResText(
                 LetterWizardDialogResources.RID_RID_COMMON_START + 19)
         self.resTemplateDescription = \
             self.getResText(
                 LetterWizardDialogResources.RID_RID_COMMON_START + 20)
+        
+        self.loadRoadmapResources()
+        self.loadSalutationResources()
+        self.loadGreetingResources()
+        self.loadCommonResources()
 
-    def loadRoadmapResources(self):
-        i = 1
+    def loadRoadmapResources(self):       
         for i in xrange(6):
-            self.RoadmapLabels = self.RoadmapLabels + (self.getResText(LetterWizardDialogResources.RID_LETTERWIZARDROADMAP_START + i + 1),)
+            self.RoadmapLabels.append(self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDROADMAP_START + \
+                i + 1))
 
     def loadSalutationResources(self):
         for i in xrange(3):
-            self.SalutationLabels = self.SalutationLabels + (self.getResText(LetterWizardDialogResources.RID_LETTERWIZARDSALUTATION_START + i + 1),)
+            self.SalutationLabels.append(self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDSALUTATION_START + \
+                i + 1))
 
     def loadGreetingResources(self):
         for i in xrange(3):
-            self.GreetingLabels = self.GreetingLabels + (self.getResText(LetterWizardDialogResources.RID_LETTERWIZARDGREETING_START + i + 1),)
+            self.GreetingLabels.append(self.getResText(
+                LetterWizardDialogResources.RID_LETTERWIZARDGREETING_START + \
+                i + 1))
commit 5f695a7d5e71e21ea65f28f5d56101e9a175861d
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 21:13:19 2012 +0200

    pyletter: Remove unused code
    
    Change-Id: I9ca05a152430b3fa61286ba521d37569be5b16a0

diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py
index 8f50558..1b6db1f 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.py
+++ b/wizards/com/sun/star/wizards/common/Configuration.py
@@ -97,17 +97,6 @@ class Configuration(object):
         return aLocLocale
 
     @classmethod
-    def getOfficeLinguistic(self, xMSF):
-        try:
-            oMasterKey = self.getConfigurationRoot(xMSF,
-                "org.openoffice.Setup/L10N/", False)
-            sLinguistic = Helper.getUnoObjectbyName(oMasterKey, "ooLocale")
-            return sLinguistic
-        except Exception, exception:
-            traceback.print_exc()
-            return None
-
-    @classmethod
     def removeNode(self, configView, name, xmsf=None):
         commitChanges = False
         if xmsf is not None:
diff --git a/wizards/com/sun/star/wizards/common/Resource.py b/wizards/com/sun/star/wizards/common/Resource.py
index 68f60a7..2e5b142 100644
--- a/wizards/com/sun/star/wizards/common/Resource.py
+++ b/wizards/com/sun/star/wizards/common/Resource.py
@@ -34,9 +34,6 @@ class Resource(object):
                 raise Exception ("could not initialize ResourceIndexAccess")
 
             self.xStringIndexAccess = xResource.getByName("String")
-            self.xStringListIndexAccess = xResource.getByName("StringList")
-            if self.xStringListIndexAccess is None:
-                raise Exception ("could not initialize xStringListIndexAccess")
 
             if self.xStringIndexAccess is None:
                 raise Exception ("could not initialize xStringIndexAccess")
@@ -52,13 +49,6 @@ class Resource(object):
             traceback.print_exc()
             raise ValueError("Resource with ID not " + str(nID) + " not found")
 
-    def getStringList(self, nID):
-        try:
-            return self.xStringListIndexAccess.getByIndex(nID)
-        except Exception, exception:
-            traceback.print_exc()
-            raise ValueError("Resource with ID not " + str(nID) + " not found")
-
     def getResArray(self, nID, iCount):
         try:
             ResArray = range(iCount)
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index fc1abe8..584eaa2 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -299,6 +299,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             self.sWorkPath = FileAccess.getOfficePath2(xMSF, "Work", "", "")
             self.BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus",
                 self.sFaxPath, self.resources.dictBusinessTemplate)
+            print self.BusinessFiles
             self.PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri",
                 self.sFaxPath, self.resources.dictPrivateTemplate)
             
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
index e4b5bfd..b53a32c 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
@@ -547,21 +547,6 @@ class LetterWizardDialog(WizardDialog):
                 "lblTitle2", 91, 8, 2, 91, 212))
 
     def buildStep3(self):
-        self.lstLetterNorm = self.insertListBox(
-            "lstLetterNorm",
-            LSTLETTERNORM_ACTION_PERFORMED,
-            LSTLETTERNORM_ITEM_CHANGED,
-            ("Dropdown",
-                PropertyNames.PROPERTY_HEIGHT,
-                PropertyNames.PROPERTY_HELPURL,
-                PropertyNames.PROPERTY_NAME,
-                PropertyNames.PROPERTY_POSITION_X,
-                PropertyNames.PROPERTY_POSITION_Y,
-                PropertyNames.PROPERTY_STEP,
-                PropertyNames.PROPERTY_TABINDEX,
-                PropertyNames.PROPERTY_WIDTH),
-            (True, 12, HelpIds.getHelpIdString(HID + 21),
-                "lstLetterNorm", 210, 34, 3, 21, 74), self)
         self.chkUseLogo = self.insertCheckBox(
             "chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
             (PropertyNames.PROPERTY_HEIGHT,
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 3070800..0f68929 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -62,8 +62,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.BusCompanyAddress = None
         self.BusCompanyAddressReceiver = None
         self.BusFooter = None
-        self.Norms = []
-        self.NormPaths = []
 
     @classmethod
     def main(self):
@@ -97,7 +95,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             self.buildStep5()
             self.buildStep6()
             self.__initializePaths()
-            self.initializeNorms()
             self.initializeSalutation()
             self.initializeGreeting()
 
@@ -106,10 +103,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
 
             self.myConfig = CGLetterWizard()
 
-            oL = self.getOfficeLinguistic()
-            self.myConfig.cp_BusinessLetter.cp_Norm = oL
-            self.myConfig.cp_PrivateOfficialLetter.cp_Norm = oL
-            self.myConfig.cp_PrivateLetter.cp_Norm = oL
             self.initializeTemplates(xMSF)
 
             #load the last used settings
@@ -800,25 +793,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             self.disableBusinessPaper()
             self.setPossibleSenderData(True)
 
-    def getOfficeLinguistic(self):
-        oL = 0
-        found = False
-        OfficeLinguistic = Configuration.getOfficeLinguistic(self.xMSF)
-        i = 0
-        for index, workwith in enumerate(self.Norms):
-            if workwith.lower() == OfficeLinguistic.lower():
-                oL = index
-                found = True
-                break
-
-        if not found:
-            for index, workwith in enumerate(self.Norms):
-                if workwith.lower() == "en-US".lower():
-                    oL = index
-                    found = True
-                    break
-        return oL
-
     def setPossibleSenderData(self, bState):
         self.setControlProperty(
             "optSenderDefine", PropertyNames.PROPERTY_ENABLED, bState)
@@ -898,18 +872,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         except Exception:
             traceback.print_exc()
 
-    def lstLetterNormItemChanged(self):
-        sCurrentNorm = self.Norms[getCurrentLetter().cp_Norm]
-        initializeTemplates(xMSF)
-        if self.optBusinessLetter.State:
-            self.lstBusinessStyleItemChanged()
-
-        elif optPrivOfficialLetter.State:
-            self.lstPrivOfficialStyleItemChanged()
-
-        elif optPrivateLetter.State:
-            self.lstPrivateStyleItemChanged()
-
     def initializeSalutation(self):
         self.setControlProperty(
             "lstSalutation", "StringItemList",
@@ -919,55 +881,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.setControlProperty(
             "lstGreeting", "StringItemList", self.resources.GreetingLabels)
 
-    def initializeNorms(self):
-        lc = LocaleCodes(self.xmsf)
-        allLocales = lc.getIDs()
-        nameList = []
-        sLetterSubPath = "/wizard/letter/"
-        try:
-            self.sTemplatePath = \
-                FileAccess.deleteLastSlashfromUrl(self.sTemplatePath)
-            nuString = \
-                self.sTemplatePath[:self.sTemplatePath.rfind("/")] + "/"
-            sMainPath = FileAccess.deleteLastSlashfromUrl(nuString)
-            self.sLetterPath = sMainPath + sLetterSubPath
-            xInterface = \
-                self.xmsf.createInstance("com.sun.star.ucb.SimpleFileAccess")
-            nameList = xInterface.getFolderContents(self.sLetterPath, True)
-        except Exception, e:
-            traceback.print_exc()
-
-        found = False
-        cIsoCode = ""
-        MSID = ""
-        LanguageLabels = []
-
-        for i in nameList:
-            found = False
-            cIsoCode = FileAccess.getFilename(i)
-            for j in allLocales:
-                aLang = j.split(";")
-                if cIsoCode.lower() == aLang[1].lower():
-                    MSID = aLang[2]
-                    found = True
-                    break
-
-            if not found:
-                for j in allLocales:
-                    aLang = j.split(";")
-                    if cIsoCode.lower() == aLang[1][:2]:
-                        MSID = aLang[2]
-                        found = True
-                        break
-
-            if found:
-                self.Norms.append(cIsoCode)
-                self.NormPaths.append(i)
-                #LanguageLabels.append(lc.getLanguageString(MSID))
-
-        self.setControlProperty(
-            "lstLetterNorm", "StringItemList", tuple(LanguageLabels))
-
     def getCurrentLetter(self):
         if self.myConfig.cp_LetterType == 0:
             return self.myConfig.cp_BusinessLetter
@@ -985,15 +898,12 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                     self.xMSF, "Template", "share", "/wizard")
             self.sUserTemplatePath = \
                 FileAccess.getOfficePath2(self.xMSF, "Template", "user", "")
-            self.sBitmapPath = \
-                FileAccess.combinePaths(
-                    self.xMSF, self.sTemplatePath, "/../wizard/bitmap")
         except NoValidPathException, e:
             traceback.print_exc()
 
     def initializeTemplates(self, xMSF):
-        self.sCurrentNorm = self.Norms[self.getCurrentLetter().cp_Norm]
-        sLetterPath = self.NormPaths[self.getCurrentLetter().cp_Norm]
+        sLetterPath = FileAccess.combinePaths(
+            xMSF, self.sTemplatePath, "/../common/wizard/letter")
         self.BusinessFiles = \
             FileAccess.getFolderTitles(xMSF, "bus", sLetterPath)
         self.OfficialFiles = \
@@ -1146,8 +1056,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 cgl, "cp_PaperFooter", self.chkPaperFooter, True).updateUI()
             UnoDataAware.attachNumericControl(
                 cgl, "cp_PaperFooterHeight", self.numFooterHeight, True).updateUI()
-            UnoDataAware.attachListBox(
-                cgl, "cp_Norm", self.lstLetterNorm, True).updateUI()
             UnoDataAware.attachCheckBox(
                 cgl, "cp_PrintCompanyLogo", self.chkUseLogo, True).updateUI()
             UnoDataAware.attachCheckBox(
@@ -1207,7 +1115,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
 
     def saveConfiguration(self):
         try:
-            root = Configuration.getConfigurationRoot(self.xMSF, "/org.openoffice.Office.Writer/Wizards/Letter", True)
+            root = Configuration.getConfigurationRoot(self.xMSF,
+                "/org.openoffice.Office.Writer/Wizards/Letter", True)
             self.myConfig.writeConfiguration(root, "cp_")
             root.commitChanges()
         except Exception, e:
diff --git a/wizards/com/sun/star/wizards/letter/LocaleCodes.py b/wizards/com/sun/star/wizards/letter/LocaleCodes.py
deleted file mode 100644
index 850dda1..0000000
--- a/wizards/com/sun/star/wizards/letter/LocaleCodes.py
+++ /dev/null
@@ -1,171 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements. See the NOTICE file distributed
-#   with this work for additional information regarding copyright
-#   ownership. The ASF licenses this file to you under the Apache
-#   License, Version 2.0 (the "License"); you may not use this file
-#   except in compliance with the License. You may obtain a copy of
-#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-from wizards.common.Resource import Resource
-
-class LocaleCodes(Resource):
-    UNIT_NAME = "svtres",
-    MODULE_NAME = "svt",
-
-    def __init__(self, xmsf):
-        super(LocaleCodes, self).__init__(xmsf, LocaleCodes.MODULE_NAME)
-        #self.allLanguageStrings = self.getStringList(16633)
-
-    def getLanguageString(self, MSID):
-        LS = "unknown Language",
-        for i in self.allLanguageStrings:
-            if str(i.Value).lower() == MSID.lower():
-                LS = i.Name
-        return LS
-
-    def getIDs(self):
-        Ids = ("Afrikaans;af;1078",
-        "Albanian;sq;1052",
-        "Arabic - United Arab Emirates;ar-ae;14337",
-        "Arabic - Bahrain;ar-bh;15361",
-        "Arabic - Algeria;ar-dz;5121",
-        "Arabic - Egypt;ar-eg;3073",
-        "Arabic - Iraq;ar-iq;2049",
-        "Arabic - Jordan;ar-jo;11265",
-        "Arabic - Kuwait;ar-kw;13313",
-        "Arabic - Lebanon;ar-lb;12289",
-        "Arabic - Libya;ar-ly;4097",
-        "Arabic - Morocco;ar-ma;6145",
-        "Arabic - Oman;ar-om;8193",
-        "Arabic - Qatar;ar-qa;16385",
-        "Arabic - Saudi Arabia;ar-sa;1025",
-        "Arabic - Syria;ar-sy;10241",
-        "Arabic - Tunisia;ar-tn;7169",
-        "Arabic - Yemen;ar-ye;9217",
-        "Armenian;hy;1067",
-        "Azeri - Latin;az-az;1068",
-        "Azeri - Cyrillic;az-az;2092",
-        "Basque;eu;1069",
-        "Belarusian;be;1059",
-        "Bulgarian;bg;1026",
-        "Catalan;ca;1027",
-        "Chinese - China;zh-cn;2052",
-        "Chinese - Hong Kong SAR;zh-hk;3076",
-        "Chinese - Macau SAR;zh-mo;5124",
-        "Chinese - Singapore;zh-sg;4100",
-        "Chinese - Taiwan;zh-tw;1028",
-        "Croatian;hr;1050",
-        "Czech;cs;1029",
-        "Danish;da;1030",
-        "Dutch - The Netherlands;nl-nl;1043",
-        "Dutch - Belgium;nl-be;2067",
-        "English - Australia;en-au;3081",
-        "English - Belize;en-bz;10249",
-        "English - Canada;en-ca;4105",
-        "English - Caribbean;en-cb;9225",
-        "English - Ireland;en-ie;6153",
-        "English - Jamaica;en-jm;8201",
-        "English - New Zealand;en-nz;5129",
-        "English - Phillippines;en-ph;13321",
-        "English - South Africa;en-za;7177",
-        "English - Trinidad;en-tt;11273",
-        "English - United Kingdom;en-gb;2057",
-        "English - United States;en-us;1033",
-        "Estonian;et;1061",
-        "Farsi;fa;1065",
-        "Finnish;fi;1035",
-        "Faroese;fo;1080",
-        "French - France;fr-fr;1036",
-        "French - Belgium;fr-be;2060",
-        "French - Canada;fr-ca;3084",
-        "French - Luxembourg;fr-lu;5132",
-        "French - Switzerland;fr-ch;4108",
-        "Gaelic - Ireland;gd-ie;2108",
-        "Gaelic - Scotland;gd;1084",
-        "German - Germany;de-de;1031",
-        "German - Austria;de-at;3079",
-        "German - Liechtenstein;de-li;5127",
-        "German - Luxembourg;de-lu;4103",
-        "German - Switzerland;de-ch;2055",
-        "Greek;el;1032",
-        "Hebrew;he;1037",
-        "Hindi;hi;1081",
-        "Hungarian;hu;1038",
-        "Icelandic;is;1039",
-        "Indonesian;id;1057",
-        "Italian - Italy;it-it;1040",
-        "Italian - Switzerland;it-ch;2064",
-        "Japanese;ja;1041",
-        "Korean;ko;1042",
-        "Latvian;lv;1062",
-        "Lithuanian;lt;1063",
-        "FYRO Macedonian;mk;1071",
-        "Malay - Malaysia;ms-my;1086",
-        "Malay - Brunei;ms-bn;2110",
-        "Maltese;mt;1082",
-        "Marathi;mr;1102",
-        "Norwegian - Bokm?l;no-no;1044",
-        "Norwegian - Nynorsk;no-no;2068",
-        "Polish;pl;1045",
-        "Portuguese - Portugal;pt-pt;2070",
-        "Portuguese - Brazil;pt-br;1046",
-        "Raeto-Romance;rm;1047",
-        "Romanian - Romania;ro;1048",
-        "Romanian - Moldova;ro-mo;2072",
-        "Russian;ru;1049",
-        "Russian - Moldova;ru-mo;2073",
-        "Sanskrit;sa;1103",
-        "Serbian - Cyrillic;sr-sp;3098",
-        "Serbian - Latin;sr-sp;2074",
-        "Setsuana;tn;1074",
-        "Slovenian;sl;1060",
-        "Slovak;sk;1051",
-        "Sorbian;sb;1070",
-        "Spanish - Spain;es-es;3082",
-        "Spanish - Argentina;es-ar;11274",
-        "Spanish - Bolivia;es-bo;16394",
-        "Spanish - Chile;es-cl;13322",
-        "Spanish - Colombia;es-co;9226",
-        "Spanish - Costa Rica;es-cr;5130",
-        "Spanish - Dominican Republic;es-do;7178",
-        "Spanish - Ecuador;es-ec;12298",
-        "Spanish - Guatemala;es-gt;4106",
-        "Spanish - Honduras;es-hn;18442",
-        "Spanish - Mexico;es-mx;2058",
-        "Spanish - Nicaragua;es-ni;19466",
-        "Spanish - Panama;es-pa;6154",
-        "Spanish - Peru;es-pe;10250",
-        "Spanish - Puerto Rico;es-pr;20490",
-        "Spanish - Paraguay;es-py;15370",
-        "Spanish - El Salvador;es-sv;17418",
-        "Spanish - Uruguay;es-uy;14346",
-        "Spanish - Venezuela;es-ve;8202",
-        "Sutu;sx;1072",
-        "Swahili;sw;1089",
-        "Swedish - Sweden;sv-se;1053",
-        "Swedish - Finland;sv-fi;2077",
-        "Tamil;ta;1097",
-        "Tatar;tt;1092",
-        "Thai;th;1054",
-        "Turkish;tr;1055",
-        "Tsonga;ts;1073",
-        "Ukrainian;uk;1058",
-        "Urdu;ur;1056",
-        "Uzbek - Cyrillic;uz-uz;2115",
-        "Uzbek - Latin;uz-uz;1091",
-        "Vietnamese;vi;1066",
-        "Xhosa;xh;1076",
-        "Yiddish;yi;1085",
-        "Zulu;zu;1077",
-        "Khmer;km-kh;1107",
-        "Burmese;my-mm;1109")
-        return Ids
commit 299b38e93306f863d24f33aa03bd3af097e216ef
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 20:14:59 2012 +0200

    pyletter: Add missed listener
    
    Change-Id: I10cb982ea00b3cc04dde68d55857577657ebd380

diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index c1a8e48..fc1abe8 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -708,7 +708,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
         Helper.setUnoPropertyValue(BPaperItem,
             PropertyNames.PROPERTY_ENABLED, False)
 
-
     def validatePath(self):
         if self.myPathSelection.usedPathPicker:
                 self.filenameChanged = True
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index a6f0636..3070800 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -1093,8 +1093,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.myPathSelection.sDefaultDirectory = self.sUserTemplatePath
         self.myPathSelection.sDefaultName = "myLetterTemplate.ott"
         self.myPathSelection.sDefaultFilter = "writer8_template"
-        self.myPathSelection.addSelectionListener(
-            self.myPathSelectionListener())
+        self.myPathSelection.addSelectionListener(self)
 
     def initConfiguration(self):
         try:
@@ -1213,3 +1212,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             root.commitChanges()
         except Exception, e:
             traceback.print_exc()
+
+    def validatePath(self):
+        if self.myPathSelection.usedPathPicker:
+                self.filenameChanged = True
+        self.myPathSelection.usedPathPicker = False
commit 201788d30508b7b9e04bdbd82ac10998fa8bd570
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 20:10:45 2012 +0200

    pyletter: Make call the wizard remotely possible
    
    Change-Id: I6cf58bb25cc44118b086fbe1339aae2c4069416b

diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index ba72ea8..a6f0636 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -66,19 +66,20 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.NormPaths = []
 
     @classmethod
-    def main(self, args):
-        ConnectStr = \
-            "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
-        xLocMSF = None
+    def main(self):
+        #Call the wizard remotely(see README)
         try:
+            ConnectStr = \
+                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
             xLocMSF = Desktop.connect(ConnectStr)
-        except Exception, e:
-            traceback.print_exc()
-
-        lw = LetterWizardDialogImpl(xLocMSF)
-        lw.startWizard(xLocMSF, None)
-
-    def startWizard(self, xMSF, CurPropertyValue):
+            lw = LetterWizardDialogImpl(xLocMSF)
+            lw.startWizard(xLocMSF)
+        except Exception as e:
+            print ("Wizard failure exception " + str(type(e)) +
+                   " message " + str(e) + " args " + str(e.args) +
+                   traceback.format_exc())
+
+    def startWizard(self, xMSF):
         self.running = True
         try:
             #Number of steps on WizardDialog
commit b617e84227ca07639f18c4ad53c7f8c3a93a794a
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Oct 15 20:01:49 2012 +0200

    pywizards: Add README explaining how to call a wizard remotely
    
    Change-Id: I5686dfb9fcac1ccc3d04cb260c1a532d13e7c31e

diff --git a/wizards/com/sun/star/wizards/README b/wizards/com/sun/star/wizards/README
new file mode 100644
index 0000000..473282f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/README
@@ -0,0 +1,19 @@
+To call a wizard remotely you need to:
+
+-> For testing on core:
+    export URE_BOOTSTRAP="file:///home/'USER'/git/libo/install/program/fundamentalrc"
+    export PYTHONPATH=/home/'USER'/git/libo/install/program
+    #and run LibreOffice in listening mode:
+    ./soffice --"accept=socket,host=localhost,port=2002;urp;"
+      
+-> For testing on installed LibreOffice:
+    export URE_BOOTSTRAP="file:///usr/lib/libreoffice/program/fundamentalrc"
+    export PYTHONPATH=/usr/lib/libreoffice/basis-link/program
+    #and run LibreOffice in listening mode:
+    soffice --"accept=socket,host=localhost,port=2002;urp;"
+      
+-> Launch the wizard from wizards parent folder:
+    python
+    #Fax wizard
+    from wizards.fax.FaxWizardDialogImpl import FaxWizardDialogImpl
+    FaxWizardDialogImpl.main()
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 9252d0d..c1a8e48 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -67,8 +67,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
         self.sTemplatePath = ""
 
     @classmethod
-    def main(self, args):
-        #Call the wizard remotely
+    def main(self):
+        #Call the wizard remotely(see README)
         try:
             ConnectStr = \
                 "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"


More information about the Libreoffice-commits mailing list