From c5a829e570dda24aca7a67112ac8632b9307ef53 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 15 Oct 2012 21:32:49 +0200 Subject: pyletter: Clean up resources Change-Id: Ia387ef2a7166374a1f7770609f9e7b25217ab4fc --- .../star/wizards/letter/LetterWizardDialogImpl.py | 31 ++++++++++---------- .../wizards/letter/LetterWizardDialogResources.py | 34 +++++++++++++--------- 2 files changed, 36 insertions(+), 29 deletions(-) (limited to 'wizards/com') diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py index 0f68929f2a36..9ed3ad92b3aa 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 299472e8844d..a80c0fee317d 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)) -- cgit