From 0ca978e9dff389b950d0577cd9120e3149c6ed6f Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Sun, 24 Nov 2013 15:25:14 +0100 Subject: pyweb: some pyflakes love Change-Id: I317656ca26eec5946959ac21e7da335196dd8548 --- .../sun/star/wizards/web/AbstractErrorHandler.py | 8 ++-- .../com/sun/star/wizards/web/BackgroundsDialog.py | 1 - wizards/com/sun/star/wizards/web/ErrorHandler.py | 2 +- wizards/com/sun/star/wizards/web/FTPDialog.py | 16 ++----- .../com/sun/star/wizards/web/LogTaskListener.py | 49 ---------------------- wizards/com/sun/star/wizards/web/Process.py | 5 --- wizards/com/sun/star/wizards/web/StatusDialog.py | 4 +- wizards/com/sun/star/wizards/web/TOCPreview.py | 2 - wizards/com/sun/star/wizards/web/WWD_Events.py | 11 +++-- wizards/com/sun/star/wizards/web/WWD_General.py | 2 +- wizards/com/sun/star/wizards/web/WWD_Startup.py | 6 --- wizards/com/sun/star/wizards/web/WebConfigSet.py | 3 +- .../com/sun/star/wizards/web/WebWizardDialog.py | 2 - .../com/sun/star/wizards/web/data/CGDocument.py | 3 -- wizards/com/sun/star/wizards/web/data/CGLayout.py | 2 - wizards/com/sun/star/wizards/web/data/CGSession.py | 2 - .../com/sun/star/wizards/web/data/CGSettings.py | 2 - .../star/wizards/web/export/AbstractExporter.py | 1 - .../star/wizards/web/export/ConfiguredExporter.py | 1 - .../sun/star/wizards/web/export/FilterExporter.py | 1 - 20 files changed, 17 insertions(+), 106 deletions(-) delete mode 100644 wizards/com/sun/star/wizards/web/LogTaskListener.py (limited to 'wizards/com/sun/star') diff --git a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py index 5f79384ef839..3f9a10263ca4 100644 --- a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py +++ b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.py @@ -66,7 +66,7 @@ class AbstractErrorHandler(ErrorHandler): return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType) elif (errorType == ErrorHandler.ERROR_MESSAGE): return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType) - raise IllegalArgumentException("unknown error type") + raise ValueError("unknown error type") # @deprecated # @param message @@ -109,7 +109,7 @@ class AbstractErrorHandler(ErrorHandler): return 2 elif (errorType in (ErrorHandler.ERROR_WARNING, ErrorHandler.ERROR_MESSAGE)): return 1 - raise IllegalArgumentException("unkonown error type") + raise ValueError("unkonown error type") # @param errorType @@ -136,7 +136,7 @@ class AbstractErrorHandler(ErrorHandler): return OK elif (errorType == ErrorHandler.ERROR_MESSAGE): return OK - raise IllegalArgumentException("unkonown error type") + raise ValueError("unkonown error type") # @deprecated # @param errorType @@ -163,7 +163,7 @@ class AbstractErrorHandler(ErrorHandler): return "warningbox" elif (errorType == ErrorHandler.ERROR_MESSAGE): return "infobox" - raise IllegalArgumentException("unkonown error type") + raise ValueError("unkonown error type") # renders the error # @param ex the exception diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py index 67fa94362510..78285595d534 100644 --- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py +++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py @@ -15,7 +15,6 @@ # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . # -import uno import traceback from .ImageListDialog import ImageListDialog diff --git a/wizards/com/sun/star/wizards/web/ErrorHandler.py b/wizards/com/sun/star/wizards/web/ErrorHandler.py index 093e498139a4..743ecf5e54bd 100644 --- a/wizards/com/sun/star/wizards/web/ErrorHandler.py +++ b/wizards/com/sun/star/wizards/web/ErrorHandler.py @@ -16,7 +16,7 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . from com.sun.star.awt.VclWindowPeerAttribute import OK, DEF_OK, OK_CANCEL, DEF_CANCEL -from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO, DEF_YES +from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO class ErrorHandler: diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.py b/wizards/com/sun/star/wizards/web/FTPDialog.py index c3921eb6eca6..17d869030166 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.py +++ b/wizards/com/sun/star/wizards/web/FTPDialog.py @@ -28,8 +28,6 @@ from ..common.SystemDialog import SystemDialog from ..common.FileAccess import FileAccess from ..common.HelpIds import HelpIds from ..common.UCB import UCB -from .data.CGPublish import CGPublish -from .data.CGSettings import CGSettings from com.sun.star.ucb import AuthenticationRequest from com.sun.star.ucb import InteractiveAugmentedIOException @@ -305,18 +303,18 @@ class FTPDialog(UnoDialog2, UIConsts): try: self.connect1(self.getFullUrl()) success = True - except InteractiveAugmentedIOException as iaioex: + except InteractiveAugmentedIOException: try: self.connect1(self.getAccountUrl()) self.setDir("/") success = True except Exception: self.setLabel(self.STATUS_NO_RIGHTS) - except InteractiveNetworkResolveNameException as inrne: + except InteractiveNetworkResolveNameException: self.setLabel(self.STATUS_SERVER_NOT_FOUND) - except AuthenticationRequest as ar: + except AuthenticationRequest: self.setLabel(self.STATUS_USER_PWD_WRONG) - except InteractiveNetworkConnectException as incx: + except InteractiveNetworkConnectException: self.setLabel(self.STATUS_HOST_UNREACHABLE) except Exception: self.setLabel(-1) @@ -341,9 +339,6 @@ class FTPDialog(UnoDialog2, UIConsts): def connect1(self, acountUrl): content = self.ucb.getContent(self.getAccountUrl()) - # list files in the content. - l = self.ucb.listFiles(self.getAccountUrl(), None) - # open the content aArg = OpenCommandArgument2() aArg.Mode = FOLDERS # FOLDER, DOCUMENTS -> simple filter @@ -351,9 +346,6 @@ class FTPDialog(UnoDialog2, UIConsts): self.ucb.executeCommand(content, "open", aArg) - # get the title property of the content. - obj = self.ucb.getContentProperty(content, "Title", str) - # changes the ftp subdirectory, in both # the UI and the data. # @param s the directory. diff --git a/wizards/com/sun/star/wizards/web/LogTaskListener.py b/wizards/com/sun/star/wizards/web/LogTaskListener.py deleted file mode 100644 index a1fba5f8ee01..000000000000 --- a/wizards/com/sun/star/wizards/web/LogTaskListener.py +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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 . - -# used for debugging. -class LogTaskListener(TaskListener, ErrorHandler): - - out - - def __init__(os): - out = os - - def __init__(): - self.__init__(System.out) - - # @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent) - def taskStarted(te): - out.println("TASK " + te.getTask().getTaskName() + " STARTED.") - - #@see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent) - def taskFinished(te): - out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.") - - #@see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent) - def taskStatusChanged(te): - out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax()) - - #@see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent) - def subtaskNameChanged(te): - out.println("SUBTASK Name:" + te.getTask().getSubtaskName()) - - # @see com.sun.star.wizards.web.status.ErrorReporter#error(java.lang.Exception, java.lang.Object, java.lang.String) - def error(ex, arg, ix, i): - print (PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage()) - ex.printStackTrace() - return True; diff --git a/wizards/com/sun/star/wizards/web/Process.py b/wizards/com/sun/star/wizards/web/Process.py index e0044d992429..b13865177807 100644 --- a/wizards/com/sun/star/wizards/web/Process.py +++ b/wizards/com/sun/star/wizards/web/Process.py @@ -25,12 +25,7 @@ from ..ui.event.CommonListener import StreamListenerProcAdapter from .ProcessErrors import ProcessErrors from .ExtensionVerifier import ExtensionVerifier from .ErrorHandler import ErrorHandler -from .data.CGContent import CGContent from .data.CGDocument import CGDocument -from .data.CGExporter import CGExporter -from .data.CGLayout import CGLayout -from .data.CGPublish import CGPublish -from .data.CGSettings import CGSettings from com.sun.star.io import IOException from com.sun.star.uno import SecurityException diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.py b/wizards/com/sun/star/wizards/web/StatusDialog.py index 5b353cc7c005..caecdd25ef33 100644 --- a/wizards/com/sun/star/wizards/web/StatusDialog.py +++ b/wizards/com/sun/star/wizards/web/StatusDialog.py @@ -18,8 +18,6 @@ import uno import traceback from ..ui.UnoDialog2 import UnoDialog2 -from ..ui.UnoDialog import UnoDialog -from ..ui.event.TaskListener import TaskListener from ..common.PropertyNames import PropertyNames # Note on the argument resource: @@ -45,7 +43,7 @@ class StatusDialog(UnoDialog2): self.res = resources if not (len(self.res) == 6): # display a close button? - raise IllegalArgumentException("The resources argument should contain 6 Strings, see doc on constructor.") + raise ValueError("The resources argument should contain 6 Strings, see doc on constructor.") b = not (self.enableBreak or self.closeOnFinish) diff --git a/wizards/com/sun/star/wizards/web/TOCPreview.py b/wizards/com/sun/star/wizards/web/TOCPreview.py index ad27afd3e1c5..9833984c32e0 100644 --- a/wizards/com/sun/star/wizards/web/TOCPreview.py +++ b/wizards/com/sun/star/wizards/web/TOCPreview.py @@ -15,8 +15,6 @@ # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . # -import traceback - from .Process import Process from ..ui.event.Task import Task from ..common.FileAccess import FileAccess diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py index 50d5bc793f29..d9ceec7e944e 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.py +++ b/wizards/com/sun/star/wizards/web/WWD_Events.py @@ -16,10 +16,9 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback -import uno from .WWD_Startup import WWD_Startup -from .WWD_General import WWD_General + from .WebWizardConst import * from ..common.FileAccess import FileAccess from ..common.Configuration import Configuration @@ -561,7 +560,7 @@ class WWD_Events(WWD_Startup): try: fileAccess.xInterface.createFolder(p.cp_URL) - except Exception as ex: + except Exception: message = self.resources.resLocalTargetCouldNotCreate.replace( "%FILENAME", path) AbstractErrorHandler.showMessage1( @@ -643,7 +642,7 @@ class WWD_Events(WWD_Startup): try: fileAccess.mkdir(p.url) - except Exception as ex: + except Exception: message = self.resources.resFTPTargetCouldNotCreate.replace( "%FILENAME", path) AbstractErrorHandler.showMessage1( @@ -679,7 +678,7 @@ class WWD_Events(WWD_Startup): ErrorHandler.ERROR_NORMAL_IGNORE): return False #remove the old session Configuration.removeNode(conf, name) - except NoSuchElementException as nsex: + except NoSuchElementException: pass self.settings.cp_DefaultSession.cp_Index = 0 @@ -892,7 +891,7 @@ class WWD_Events(WWD_Startup): #if ProcessStatusRenderer is not None: # ProcessStatusRenderer.close(False) - except Exception as ex: + except Exception: traceback.print_exc() class LoadDocs(object): diff --git a/wizards/com/sun/star/wizards/web/WWD_General.py b/wizards/com/sun/star/wizards/web/WWD_General.py index cecd51e66365..58c356391650 100644 --- a/wizards/com/sun/star/wizards/web/WWD_General.py +++ b/wizards/com/sun/star/wizards/web/WWD_General.py @@ -300,6 +300,6 @@ class WWD_General(WebWizardDialog): def substitute(self, path): try: return self.xStringSubstitution.substituteVariables(path, False) - except Exception as ex: + except Exception: traceback.print_exc() return path diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py index b2dfecda0460..63c780d5cac0 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.py +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py @@ -16,15 +16,12 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback -import uno from .WWD_General import WWD_General from .WebWizardConst import * from .StylePreview import StylePreview from ..common.Configuration import Configuration from ..common.FileAccess import FileAccess -from ..common.Desktop import Desktop -from ..common.Properties import Properties from ..document.OfficeDocument import OfficeDocument from .data.CGSettings import CGSettings from .data.CGDocument import CGDocument @@ -39,8 +36,6 @@ from ..ui.DocumentPreview import DocumentPreview from ..ui.event.DataAware import DataAware from ..ui.event.Task import Task -from com.sun.star.lang import IllegalArgumentException - ''' Web Wizard Dialog implementation : Startup. This class contains the startup implementation and session mounting methods. @@ -131,7 +126,6 @@ class WWD_Startup(WWD_General): self.txtZip.Model.Enabled = False self.buildStepX() self.xMSF = xmsf - xDesktop = Desktop.getDesktop(xmsf) self.terminateListener = TerminateListenerProcAdapter(self) self.myFrame = OfficeDocument.createNewFrame(xmsf, self.terminateListener) doc = OfficeDocument.createNewDocument( diff --git a/wizards/com/sun/star/wizards/web/WebConfigSet.py b/wizards/com/sun/star/wizards/web/WebConfigSet.py index 92640dde05c1..4e97abc14101 100644 --- a/wizards/com/sun/star/wizards/web/WebConfigSet.py +++ b/wizards/com/sun/star/wizards/web/WebConfigSet.py @@ -18,7 +18,6 @@ import traceback from ..common.ConfigGroup import ConfigGroup from ..common.Configuration import Configuration -from ..common.XMLProvider import XMLProvider from ..ui.event.EventListenerList import EventListenerList from ..ui.event.ListDataEvent import ListDataEvent from ..ui.event.ListDataListener import ListDataListener @@ -124,7 +123,7 @@ class WebConfigSet(ConfigGroup): self.childrenMap.clear() del self.childrenList[:] - def update(i): + def update(self, i): self.fireListDataListenerContentsChanged(i, i) def createDOM(self, parent): diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.py b/wizards/com/sun/star/wizards/web/WebWizardDialog.py index 80b221c96310..388cf01fcaf8 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.py +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.py @@ -15,8 +15,6 @@ # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . # -import unohelper - from ..ui.WizardDialog import WizardDialog, uno, PropertyNames from .WebWizardDialogResources import WebWizardDialogResources from .WebWizardConst import * diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.py b/wizards/com/sun/star/wizards/web/data/CGDocument.py index c359faf86d66..795fb8f85a88 100644 --- a/wizards/com/sun/star/wizards/web/data/CGDocument.py +++ b/wizards/com/sun/star/wizards/web/data/CGDocument.py @@ -15,8 +15,6 @@ # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . # -import uno - from os import sep as separator from ...common.ConfigGroup import ConfigGroup from ...document.OfficeDocument import OfficeDocument @@ -142,7 +140,6 @@ class CGDocument(ConfigGroup): task.advance(True) #5 - valid = True if self.cp_Title == "": self.cp_Title = self.title diff --git a/wizards/com/sun/star/wizards/web/data/CGLayout.py b/wizards/com/sun/star/wizards/web/data/CGLayout.py index 99396a2e241a..e7bb699895f4 100644 --- a/wizards/com/sun/star/wizards/web/data/CGLayout.py +++ b/wizards/com/sun/star/wizards/web/data/CGLayout.py @@ -32,7 +32,6 @@ class CGLayout(ConfigGroup): def createTemplates(self, xmsf): self.templates = {} - workPath = self.getSettings().workPath fa = FileAccess(xmsf) stylesheetPath = fa.getURL( self.getSettings().workPath, "layouts/" + self.cp_FSName) @@ -46,7 +45,6 @@ class CGLayout(ConfigGroup): i += 1 def getImageUrls(self): - sRetUrls = range(1) ResId = UIConsts.RID_IMG_WEB + (self.cp_Index * 2) return [ResId, ResId + 1] diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.py b/wizards/com/sun/star/wizards/web/data/CGSession.py index bc1c9848d42d..52d660bde5a9 100644 --- a/wizards/com/sun/star/wizards/web/data/CGSession.py +++ b/wizards/com/sun/star/wizards/web/data/CGSession.py @@ -15,8 +15,6 @@ # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . # -import uno - from ...common.ConfigGroup import ConfigGroup from ..WebConfigSet import WebConfigSet from ...common.XMLHelper import XMLHelper diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.py b/wizards/com/sun/star/wizards/web/data/CGSettings.py index 19e5e0ee53c2..308dab71dc7d 100644 --- a/wizards/com/sun/star/wizards/web/data/CGSettings.py +++ b/wizards/com/sun/star/wizards/web/data/CGSettings.py @@ -16,7 +16,6 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback -import uno from datetime import date as dateTimeObject from ...common.FileAccess import FileAccess @@ -35,7 +34,6 @@ from .CGSession import CGSession from com.sun.star.i18n.NumberFormatIndex import DATE_SYS_DMMMYYYY from com.sun.star.i18n.NumberFormatIndex import NUMBER_1000DEC2 -from com.sun.star.util import DateTime class CGSettings(ConfigGroup): diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.py b/wizards/com/sun/star/wizards/web/export/AbstractExporter.py index 32936f309577..575911f31767 100644 --- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.py +++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.py @@ -16,7 +16,6 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback -import uno from .Exporter import Exporter from ..TypeDetection import * diff --git a/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.py b/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.py index 9a0f1eda59d7..8e7906518ede 100644 --- a/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.py +++ b/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.py @@ -48,4 +48,3 @@ class ConfiguredExporter(FilterExporter): if (s == "true"): return True return None - diff --git a/wizards/com/sun/star/wizards/web/export/FilterExporter.py b/wizards/com/sun/star/wizards/web/export/FilterExporter.py index 6f4f7e79ed17..87ed287fc370 100644 --- a/wizards/com/sun/star/wizards/web/export/FilterExporter.py +++ b/wizards/com/sun/star/wizards/web/export/FilterExporter.py @@ -18,7 +18,6 @@ from .AbstractExporter import AbstractExporter from ...common.Properties import Properties -from ...ui.event.Task import Task from com.sun.star.io import IOException -- cgit v1.2.3