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

pyweb: some pyflakes love

Change-Id: I317656ca26eec5946959ac21e7da335196dd8548
üst 59e09804
...@@ -66,7 +66,7 @@ class AbstractErrorHandler(ErrorHandler): ...@@ -66,7 +66,7 @@ class AbstractErrorHandler(ErrorHandler):
return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType) return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType)
elif (errorType == ErrorHandler.ERROR_MESSAGE): elif (errorType == ErrorHandler.ERROR_MESSAGE):
return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType) return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType)
raise IllegalArgumentException("unknown error type") raise ValueError("unknown error type")
# @deprecated # @deprecated
# @param message # @param message
...@@ -109,7 +109,7 @@ class AbstractErrorHandler(ErrorHandler): ...@@ -109,7 +109,7 @@ class AbstractErrorHandler(ErrorHandler):
return 2 return 2
elif (errorType in (ErrorHandler.ERROR_WARNING, ErrorHandler.ERROR_MESSAGE)): elif (errorType in (ErrorHandler.ERROR_WARNING, ErrorHandler.ERROR_MESSAGE)):
return 1 return 1
raise IllegalArgumentException("unkonown error type") raise ValueError("unkonown error type")
# @param errorType # @param errorType
...@@ -136,7 +136,7 @@ class AbstractErrorHandler(ErrorHandler): ...@@ -136,7 +136,7 @@ class AbstractErrorHandler(ErrorHandler):
return OK return OK
elif (errorType == ErrorHandler.ERROR_MESSAGE): elif (errorType == ErrorHandler.ERROR_MESSAGE):
return OK return OK
raise IllegalArgumentException("unkonown error type") raise ValueError("unkonown error type")
# @deprecated # @deprecated
# @param errorType # @param errorType
...@@ -163,7 +163,7 @@ class AbstractErrorHandler(ErrorHandler): ...@@ -163,7 +163,7 @@ class AbstractErrorHandler(ErrorHandler):
return "warningbox" return "warningbox"
elif (errorType == ErrorHandler.ERROR_MESSAGE): elif (errorType == ErrorHandler.ERROR_MESSAGE):
return "infobox" return "infobox"
raise IllegalArgumentException("unkonown error type") raise ValueError("unkonown error type")
# renders the error # renders the error
# @param ex the exception # @param ex the exception
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
# except in compliance with the License. You may obtain a copy of # except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import uno
import traceback import traceback
from .ImageListDialog import ImageListDialog from .ImageListDialog import ImageListDialog
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # 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 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: class ErrorHandler:
......
...@@ -28,8 +28,6 @@ from ..common.SystemDialog import SystemDialog ...@@ -28,8 +28,6 @@ from ..common.SystemDialog import SystemDialog
from ..common.FileAccess import FileAccess from ..common.FileAccess import FileAccess
from ..common.HelpIds import HelpIds from ..common.HelpIds import HelpIds
from ..common.UCB import UCB 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 AuthenticationRequest
from com.sun.star.ucb import InteractiveAugmentedIOException from com.sun.star.ucb import InteractiveAugmentedIOException
...@@ -305,18 +303,18 @@ class FTPDialog(UnoDialog2, UIConsts): ...@@ -305,18 +303,18 @@ class FTPDialog(UnoDialog2, UIConsts):
try: try:
self.connect1(self.getFullUrl()) self.connect1(self.getFullUrl())
success = True success = True
except InteractiveAugmentedIOException as iaioex: except InteractiveAugmentedIOException:
try: try:
self.connect1(self.getAccountUrl()) self.connect1(self.getAccountUrl())
self.setDir("/") self.setDir("/")
success = True success = True
except Exception: except Exception:
self.setLabel(self.STATUS_NO_RIGHTS) self.setLabel(self.STATUS_NO_RIGHTS)
except InteractiveNetworkResolveNameException as inrne: except InteractiveNetworkResolveNameException:
self.setLabel(self.STATUS_SERVER_NOT_FOUND) self.setLabel(self.STATUS_SERVER_NOT_FOUND)
except AuthenticationRequest as ar: except AuthenticationRequest:
self.setLabel(self.STATUS_USER_PWD_WRONG) self.setLabel(self.STATUS_USER_PWD_WRONG)
except InteractiveNetworkConnectException as incx: except InteractiveNetworkConnectException:
self.setLabel(self.STATUS_HOST_UNREACHABLE) self.setLabel(self.STATUS_HOST_UNREACHABLE)
except Exception: except Exception:
self.setLabel(-1) self.setLabel(-1)
...@@ -341,9 +339,6 @@ class FTPDialog(UnoDialog2, UIConsts): ...@@ -341,9 +339,6 @@ class FTPDialog(UnoDialog2, UIConsts):
def connect1(self, acountUrl): def connect1(self, acountUrl):
content = self.ucb.getContent(self.getAccountUrl()) content = self.ucb.getContent(self.getAccountUrl())
# list files in the content.
l = self.ucb.listFiles(self.getAccountUrl(), None)
# open the content # open the content
aArg = OpenCommandArgument2() aArg = OpenCommandArgument2()
aArg.Mode = FOLDERS # FOLDER, DOCUMENTS -> simple filter aArg.Mode = FOLDERS # FOLDER, DOCUMENTS -> simple filter
...@@ -351,9 +346,6 @@ class FTPDialog(UnoDialog2, UIConsts): ...@@ -351,9 +346,6 @@ class FTPDialog(UnoDialog2, UIConsts):
self.ucb.executeCommand(content, "open", aArg) 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 # changes the ftp subdirectory, in both
# the UI and the data. # the UI and the data.
# @param s the directory. # @param s the directory.
......
#
# 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;
...@@ -25,12 +25,7 @@ from ..ui.event.CommonListener import StreamListenerProcAdapter ...@@ -25,12 +25,7 @@ from ..ui.event.CommonListener import StreamListenerProcAdapter
from .ProcessErrors import ProcessErrors from .ProcessErrors import ProcessErrors
from .ExtensionVerifier import ExtensionVerifier from .ExtensionVerifier import ExtensionVerifier
from .ErrorHandler import ErrorHandler from .ErrorHandler import ErrorHandler
from .data.CGContent import CGContent
from .data.CGDocument import CGDocument 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.io import IOException
from com.sun.star.uno import SecurityException from com.sun.star.uno import SecurityException
......
...@@ -18,8 +18,6 @@ import uno ...@@ -18,8 +18,6 @@ import uno
import traceback import traceback
from ..ui.UnoDialog2 import UnoDialog2 from ..ui.UnoDialog2 import UnoDialog2
from ..ui.UnoDialog import UnoDialog
from ..ui.event.TaskListener import TaskListener
from ..common.PropertyNames import PropertyNames from ..common.PropertyNames import PropertyNames
# Note on the argument resource: # Note on the argument resource:
...@@ -45,7 +43,7 @@ class StatusDialog(UnoDialog2): ...@@ -45,7 +43,7 @@ class StatusDialog(UnoDialog2):
self.res = resources self.res = resources
if not (len(self.res) == 6): if not (len(self.res) == 6):
# display a close button? # 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) b = not (self.enableBreak or self.closeOnFinish)
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of # except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import traceback
from .Process import Process from .Process import Process
from ..ui.event.Task import Task from ..ui.event.Task import Task
from ..common.FileAccess import FileAccess from ..common.FileAccess import FileAccess
......
...@@ -16,10 +16,9 @@ ...@@ -16,10 +16,9 @@
# 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
import uno
from .WWD_Startup import WWD_Startup from .WWD_Startup import WWD_Startup
from .WWD_General import WWD_General
from .WebWizardConst import * from .WebWizardConst import *
from ..common.FileAccess import FileAccess from ..common.FileAccess import FileAccess
from ..common.Configuration import Configuration from ..common.Configuration import Configuration
...@@ -561,7 +560,7 @@ class WWD_Events(WWD_Startup): ...@@ -561,7 +560,7 @@ class WWD_Events(WWD_Startup):
try: try:
fileAccess.xInterface.createFolder(p.cp_URL) fileAccess.xInterface.createFolder(p.cp_URL)
except Exception as ex: except Exception:
message = self.resources.resLocalTargetCouldNotCreate.replace( message = self.resources.resLocalTargetCouldNotCreate.replace(
"%FILENAME", path) "%FILENAME", path)
AbstractErrorHandler.showMessage1( AbstractErrorHandler.showMessage1(
...@@ -643,7 +642,7 @@ class WWD_Events(WWD_Startup): ...@@ -643,7 +642,7 @@ class WWD_Events(WWD_Startup):
try: try:
fileAccess.mkdir(p.url) fileAccess.mkdir(p.url)
except Exception as ex: except Exception:
message = self.resources.resFTPTargetCouldNotCreate.replace( message = self.resources.resFTPTargetCouldNotCreate.replace(
"%FILENAME", path) "%FILENAME", path)
AbstractErrorHandler.showMessage1( AbstractErrorHandler.showMessage1(
...@@ -679,7 +678,7 @@ class WWD_Events(WWD_Startup): ...@@ -679,7 +678,7 @@ class WWD_Events(WWD_Startup):
ErrorHandler.ERROR_NORMAL_IGNORE): ErrorHandler.ERROR_NORMAL_IGNORE):
return False #remove the old session return False #remove the old session
Configuration.removeNode(conf, name) Configuration.removeNode(conf, name)
except NoSuchElementException as nsex: except NoSuchElementException:
pass pass
self.settings.cp_DefaultSession.cp_Index = 0 self.settings.cp_DefaultSession.cp_Index = 0
...@@ -892,7 +891,7 @@ class WWD_Events(WWD_Startup): ...@@ -892,7 +891,7 @@ class WWD_Events(WWD_Startup):
#if ProcessStatusRenderer is not None: #if ProcessStatusRenderer is not None:
# ProcessStatusRenderer.close(False) # ProcessStatusRenderer.close(False)
except Exception as ex: except Exception:
traceback.print_exc() traceback.print_exc()
class LoadDocs(object): class LoadDocs(object):
......
...@@ -300,6 +300,6 @@ class WWD_General(WebWizardDialog): ...@@ -300,6 +300,6 @@ class WWD_General(WebWizardDialog):
def substitute(self, path): def substitute(self, path):
try: try:
return self.xStringSubstitution.substituteVariables(path, False) return self.xStringSubstitution.substituteVariables(path, False)
except Exception as ex: except Exception:
traceback.print_exc() traceback.print_exc()
return path return path
...@@ -16,15 +16,12 @@ ...@@ -16,15 +16,12 @@
# 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
import uno
from .WWD_General import WWD_General from .WWD_General import WWD_General
from .WebWizardConst import * from .WebWizardConst import *
from .StylePreview import StylePreview from .StylePreview import StylePreview
from ..common.Configuration import Configuration from ..common.Configuration import Configuration
from ..common.FileAccess import FileAccess from ..common.FileAccess import FileAccess
from ..common.Desktop import Desktop
from ..common.Properties import Properties
from ..document.OfficeDocument import OfficeDocument from ..document.OfficeDocument import OfficeDocument
from .data.CGSettings import CGSettings from .data.CGSettings import CGSettings
from .data.CGDocument import CGDocument from .data.CGDocument import CGDocument
...@@ -39,8 +36,6 @@ from ..ui.DocumentPreview import DocumentPreview ...@@ -39,8 +36,6 @@ from ..ui.DocumentPreview import DocumentPreview
from ..ui.event.DataAware import DataAware from ..ui.event.DataAware import DataAware
from ..ui.event.Task import Task from ..ui.event.Task import Task
from com.sun.star.lang import IllegalArgumentException
''' '''
Web Wizard Dialog implementation : Startup. Web Wizard Dialog implementation : Startup.
This class contains the startup implementation and session mounting methods. This class contains the startup implementation and session mounting methods.
...@@ -131,7 +126,6 @@ class WWD_Startup(WWD_General): ...@@ -131,7 +126,6 @@ class WWD_Startup(WWD_General):
self.txtZip.Model.Enabled = False self.txtZip.Model.Enabled = False
self.buildStepX() self.buildStepX()
self.xMSF = xmsf self.xMSF = xmsf
xDesktop = Desktop.getDesktop(xmsf)
self.terminateListener = TerminateListenerProcAdapter(self) self.terminateListener = TerminateListenerProcAdapter(self)
self.myFrame = OfficeDocument.createNewFrame(xmsf, self.terminateListener) self.myFrame = OfficeDocument.createNewFrame(xmsf, self.terminateListener)
doc = OfficeDocument.createNewDocument( doc = OfficeDocument.createNewDocument(
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
import traceback import traceback
from ..common.ConfigGroup import ConfigGroup from ..common.ConfigGroup import ConfigGroup
from ..common.Configuration import Configuration from ..common.Configuration import Configuration
from ..common.XMLProvider import XMLProvider
from ..ui.event.EventListenerList import EventListenerList from ..ui.event.EventListenerList import EventListenerList
from ..ui.event.ListDataEvent import ListDataEvent from ..ui.event.ListDataEvent import ListDataEvent
from ..ui.event.ListDataListener import ListDataListener from ..ui.event.ListDataListener import ListDataListener
...@@ -124,7 +123,7 @@ class WebConfigSet(ConfigGroup): ...@@ -124,7 +123,7 @@ class WebConfigSet(ConfigGroup):
self.childrenMap.clear() self.childrenMap.clear()
del self.childrenList[:] del self.childrenList[:]
def update(i): def update(self, i):
self.fireListDataListenerContentsChanged(i, i) self.fireListDataListenerContentsChanged(i, i)
def createDOM(self, parent): def createDOM(self, parent):
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of # except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import unohelper
from ..ui.WizardDialog import WizardDialog, uno, PropertyNames from ..ui.WizardDialog import WizardDialog, uno, PropertyNames
from .WebWizardDialogResources import WebWizardDialogResources from .WebWizardDialogResources import WebWizardDialogResources
from .WebWizardConst import * from .WebWizardConst import *
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of # except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import uno
from os import sep as separator from os import sep as separator
from ...common.ConfigGroup import ConfigGroup from ...common.ConfigGroup import ConfigGroup
from ...document.OfficeDocument import OfficeDocument from ...document.OfficeDocument import OfficeDocument
...@@ -142,7 +140,6 @@ class CGDocument(ConfigGroup): ...@@ -142,7 +140,6 @@ class CGDocument(ConfigGroup):
task.advance(True) task.advance(True)
#5 #5
valid = True
if self.cp_Title == "": if self.cp_Title == "":
self.cp_Title = self.title self.cp_Title = self.title
......
...@@ -32,7 +32,6 @@ class CGLayout(ConfigGroup): ...@@ -32,7 +32,6 @@ class CGLayout(ConfigGroup):
def createTemplates(self, xmsf): def createTemplates(self, xmsf):
self.templates = {} self.templates = {}
workPath = self.getSettings().workPath
fa = FileAccess(xmsf) fa = FileAccess(xmsf)
stylesheetPath = fa.getURL( stylesheetPath = fa.getURL(
self.getSettings().workPath, "layouts/" + self.cp_FSName) self.getSettings().workPath, "layouts/" + self.cp_FSName)
...@@ -46,7 +45,6 @@ class CGLayout(ConfigGroup): ...@@ -46,7 +45,6 @@ class CGLayout(ConfigGroup):
i += 1 i += 1
def getImageUrls(self): def getImageUrls(self):
sRetUrls = range(1)
ResId = UIConsts.RID_IMG_WEB + (self.cp_Index * 2) ResId = UIConsts.RID_IMG_WEB + (self.cp_Index * 2)
return [ResId, ResId + 1] return [ResId, ResId + 1]
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of # except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import uno
from ...common.ConfigGroup import ConfigGroup from ...common.ConfigGroup import ConfigGroup
from ..WebConfigSet import WebConfigSet from ..WebConfigSet import WebConfigSet
from ...common.XMLHelper import XMLHelper from ...common.XMLHelper import XMLHelper
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
# 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
import uno
from datetime import date as dateTimeObject from datetime import date as dateTimeObject
from ...common.FileAccess import FileAccess from ...common.FileAccess import FileAccess
...@@ -35,7 +34,6 @@ from .CGSession import CGSession ...@@ -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 DATE_SYS_DMMMYYYY
from com.sun.star.i18n.NumberFormatIndex import NUMBER_1000DEC2 from com.sun.star.i18n.NumberFormatIndex import NUMBER_1000DEC2
from com.sun.star.util import DateTime
class CGSettings(ConfigGroup): class CGSettings(ConfigGroup):
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
# 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
import uno
from .Exporter import Exporter from .Exporter import Exporter
from ..TypeDetection import * from ..TypeDetection import *
......
...@@ -48,4 +48,3 @@ class ConfiguredExporter(FilterExporter): ...@@ -48,4 +48,3 @@ class ConfiguredExporter(FilterExporter):
if (s == "true"): if (s == "true"):
return True return True
return None return None
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
from .AbstractExporter import AbstractExporter from .AbstractExporter import AbstractExporter
from ...common.Properties import Properties from ...common.Properties import Properties
from ...ui.event.Task import Task
from com.sun.star.io import IOException from com.sun.star.io import IOException
......
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