diff options
author | Xisco Fauli <anistenis@gmail.com> | 2011-07-08 15:56:49 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-18 02:52:07 +0200 |
commit | 69ed76f89105c23089bad7cbe8227eed2afb3704 (patch) | |
tree | b45f24a50d51bf840adfb2a6026756f0154d6967 /wizards | |
parent | 4cd9b66430a49092eceb9d004e03813862c8b05b (diff) |
Duplicate code
Diffstat (limited to 'wizards')
4 files changed, 21 insertions, 31 deletions
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py index 9323215e1983..e040f247b13b 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py @@ -4,12 +4,6 @@ from FaxWizardDialogConst import * from com.sun.star.awt.FontUnderline import SINGLE class FaxWizardDialog(WizardDialog): - #Image Control - #Fixed Line - #File Control - #Image Control - #Font Descriptors as Class members. - #Resources Object def __init__(self, xmsf): super(FaxWizardDialog,self).__init__(xmsf, HIDMAIN ) @@ -42,8 +36,9 @@ class FaxWizardDialog(WizardDialog): self.fontDescriptor4.Weight = 100 self.fontDescriptor5.Weight = 150 - #build components - + ''' + build components + ''' def buildStep1(self): self.optBusinessFax = self.insertRadioButton("optBusinessFax", OPTBUSINESSFAX_ITEM_CHANGED, diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index 94ffa54f8e47..c04758923fd8 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -5,7 +5,6 @@ from ui.PathSelection import * from common.FileAccess import * from ui.event.UnoDataAware import * from ui.event.RadioDataAware import * -from ui.XPathSelectionListener import XPathSelectionListener from common.Configuration import * from document.OfficeDocument import OfficeDocument from text.TextFieldHandler import TextFieldHandler @@ -39,7 +38,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.mainDA = [] self.faxDA = [] self.bSaveSuccess = False - self.__filenameChanged = False + self.filenameChanged = False self.UserTemplatePath = "" self.sTemplatePath = "" @@ -146,7 +145,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): #first, if the filename was not changed, thus #it is coming from a saved session, check if the # file exists and warn the user. - if not self.__filenameChanged: + if not self.filenameChanged: if fileAccess.exists(self.sPath, True): answer = SystemDialog.showMessageBox( self.xMSF, "MessBox", YES_NO + DEF_NO, @@ -241,14 +240,6 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.setRoadmapComplete(True) self.setCurrentRoadmapItemID(1) - class __myPathSelectionListener(XPathSelectionListener): - - def validatePath(self): - if self.myPathSelection.usedPathPicker: - self.__filenameChanged = True - - self.myPathSelection.usedPathPicker = False - def insertPathSelectionControl(self): self.myPathSelection = PathSelection(self.xMSF, self, PathSelection.TransferMode.SAVE, @@ -261,7 +252,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.myPathSelection.sDefaultName = "myFaxTemplate.ott" self.myPathSelection.sDefaultFilter = "writer8_template" self.myPathSelection.addSelectionListener( \ - self.__myPathSelectionListener()) + self.myPathSelectionListener()) def __updateUI(self): UnoDataAware.updateUIs(self.mainDA) diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py index de9e175ee7c1..33e9abc87583 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py @@ -10,7 +10,6 @@ from CGLetterWizard import CGLetterWizard from ui.event.UnoDataAware import * from ui.event.RadioDataAware import * from document.OfficeDocument import OfficeDocument -from ui.XPathSelectionListener import XPathSelectionListener from text.TextFieldHandler import TextFieldHandler from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO @@ -145,6 +144,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): def finishWizard(self): self.switchToStep(self.getCurrentStep(), self.nMaxStep) + endWizard = True try: fileAccess = FileAccess(self.xMSF) self.sPath = self.myPathSelection.getSelectedPath() @@ -160,6 +160,8 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.resources.resOverwriteWarning, self.xUnoDialog.Peer) if answer == 3: + # user said: no, do not overwrite... + endWizard = False return False self.myLetterDoc.setWizardTemplateDocInfo( @@ -227,8 +229,9 @@ class LetterWizardDialogImpl(LetterWizardDialog): except Exception, e: traceback.print_exc() finally: - self.xUnoDialog.endExecute() - self.running = False + if endWizard: + self.xUnoDialog.endExecute() + self.running = False return True; @@ -1086,14 +1089,6 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.setRoadmapComplete(True) self.setCurrentRoadmapItemID(1) - class myPathSelectionListener(XPathSelectionListener): - - def validatePath(self): - if self.myPathSelection.usedPathPicker: - self.filenameChanged = True - - self.myPathSelection.usedPathPicker = False - def insertPathSelectionControl(self): self.myPathSelection = \ PathSelection(self.xMSF, self, PathSelection.TransferMode.SAVE, diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py index 30e55da694f7..ee0f7c62608a 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.py +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py @@ -6,6 +6,7 @@ from com.sun.star.lang import IllegalArgumentException from com.sun.star.frame import TerminationVetoException from common.HelpIds import * from com.sun.star.awt.PushButtonType import HELP, STANDARD +from ui.XPathSelectionListener import XPathSelectionListener class WizardDialog(UnoDialog2): @@ -488,3 +489,11 @@ class WizardDialog(UnoDialog2): def queryTermination(self): self.activate() raise TerminationVetoException() + + class myPathSelectionListener(XPathSelectionListener): + + def validatePath(self): + if self.myPathSelection.usedPathPicker: + self.filenameChanged = True + + self.myPathSelection.usedPathPicker = False |