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

pyfax: Don't show "the file already exists" when it doesn't do

Change-Id: Iab496836b692d47be75bb617b0b28835acf01713
üst 48b2d6ad
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import traceback import traceback
from .FaxWizardDialog import FaxWizardDialog, Helper, PropertyNames, uno from .FaxWizardDialog import FaxWizardDialog, Helper, PropertyNames, uno, \
WizardDialog
from .CGFaxWizard import CGFaxWizard from .CGFaxWizard import CGFaxWizard
from .FaxDocument import FaxDocument from .FaxDocument import FaxDocument
from .FaxWizardDialogConst import HID from .FaxWizardDialogConst import HID
...@@ -103,7 +104,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -103,7 +104,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.initializeCommunication() self.initializeCommunication()
self.__initializePaths() self.__initializePaths()
#special Control fFrameor setting the save Path: #special Control for setting the save Path:
self.insertPathSelectionControl() self.insertPathSelectionControl()
self.initializeTemplates(xMSF) self.initializeTemplates(xMSF)
...@@ -157,7 +158,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -157,7 +158,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
try: try:
fileAccess = FileAccess(self.xMSF) fileAccess = FileAccess(self.xMSF)
self.sPath = self.myPathSelection.getSelectedPath() self.sPath = self.myPathSelection.getSelectedPath()
if self.sPath == "": if not self.sPath:
self.myPathSelection.triggerPathPicker() self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath() self.sPath = self.myPathSelection.getSelectedPath()
...@@ -279,8 +280,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -279,8 +280,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.myPathSelection.sDefaultDirectory = self.UserTemplatePath self.myPathSelection.sDefaultDirectory = self.UserTemplatePath
self.myPathSelection.sDefaultName = "myFaxTemplate.ott" self.myPathSelection.sDefaultName = "myFaxTemplate.ott"
self.myPathSelection.sDefaultFilter = "writer8_template" self.myPathSelection.sDefaultFilter = "writer8_template"
self.myPathSelection.addSelectionListener( \ self.myPathSelection.addSelectionListener(self)
self.myPathSelectionListener())
def __initializePaths(self): def __initializePaths(self):
try: try:
...@@ -708,3 +708,8 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -708,3 +708,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
Helper.setUnoPropertyValue(BPaperItem, Helper.setUnoPropertyValue(BPaperItem,
PropertyNames.PROPERTY_ENABLED, False) PropertyNames.PROPERTY_ENABLED, False)
def validatePath(self):
if self.myPathSelection.usedPathPicker:
self.filenameChanged = True
self.myPathSelection.usedPathPicker = False
...@@ -117,7 +117,7 @@ class PathSelection(object): ...@@ -117,7 +117,7 @@ class PathSelection(object):
self.sDefaultName, self.sDefaultFilter) self.sDefaultName, self.sDefaultFilter)
sStorePath = myFilePickerDialog.sStorePath sStorePath = myFilePickerDialog.sStorePath
if sStorePath is not None: if sStorePath is not None:
myFA = FileAccess(self.xMSF); myFA = FileAccess(self.xMSF)
self.xSaveTextBox.Text = myFA.getPath(sStorePath, None) self.xSaveTextBox.Text = myFA.getPath(sStorePath, None)
self.sDefaultDirectory = \ self.sDefaultDirectory = \
FileAccess.getParentDir(sStorePath) FileAccess.getParentDir(sStorePath)
...@@ -134,5 +134,5 @@ class PathSelection(object): ...@@ -134,5 +134,5 @@ class PathSelection(object):
traceback.print_exc() traceback.print_exc()
def callXPathSelectionListener(self): def callXPathSelectionListener(self):
if self.xAction != None: if self.xAction is not None:
self.xAction.validatePath() self.xAction.validatePath()
...@@ -20,7 +20,6 @@ import traceback ...@@ -20,7 +20,6 @@ import traceback
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from .UnoDialog2 import UnoDialog2, Desktop, PropertyNames, UIConsts, \ from .UnoDialog2 import UnoDialog2, Desktop, PropertyNames, UIConsts, \
ItemListenerProcAdapter ItemListenerProcAdapter
from .XPathSelectionListener import XPathSelectionListener
from .event.CommonListener import TerminateListenerProcAdapter from .event.CommonListener import TerminateListenerProcAdapter
from ..common.Helper import Helper from ..common.Helper import Helper
from ..common.Resource import Resource from ..common.Resource import Resource
...@@ -501,11 +500,3 @@ class WizardDialog(UnoDialog2): ...@@ -501,11 +500,3 @@ class WizardDialog(UnoDialog2):
OfficeDocument.attachEventCall( OfficeDocument.attachEventCall(
TextDocument.xTextDocument, "OnNew", "StarBasic", TextDocument.xTextDocument, "OnNew", "StarBasic",
"macro:///Template.Correspondence.Database()") "macro:///Template.Correspondence.Database()")
class myPathSelectionListener(XPathSelectionListener):
def validatePath(self):
if self.myPathSelection.usedPathPicker:
self.filenameChanged = True
self.myPathSelection.usedPathPicker = False
#
# 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 abc import ABCMeta, abstractmethod
class XPathSelectionListener(object):
@abstractmethod
def validatePath(self):
pass
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