[Libreoffice-commits] .: wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Fri Jul 8 06:57:55 PDT 2011


 wizards/com/sun/star/wizards/fax/FaxWizardDialog.py           |   11 +-----
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py       |   15 +-------
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py |   17 +++-------
 wizards/com/sun/star/wizards/ui/WizardDialog.py               |    9 +++++
 4 files changed, 21 insertions(+), 31 deletions(-)

New commits:
commit 376d378c8a78aea5cf5e76b437f3ed49d3755fca
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Fri Jul 8 15:56:49 2011 +0200

    Duplicate code

diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
index 9323215..e040f24 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 94ffa54..c047589 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 ca37b8d..e2bffcd 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 30e55da..ee0f7c6 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


More information about the Libreoffice-commits mailing list