Kaydet (Commit) c5a829e5 authored tarafından Xisco Fauli's avatar Xisco Fauli

pyletter: Clean up resources

Change-Id: Ia387ef2a7166374a1f7770609f9e7b25217ab4fc
üst 5f695a7d
......@@ -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:
......
......@@ -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))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment