wizards/com/sun/star/wizards/agenda/AgendaDocument.py              |   27 ++---
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py          |    5 
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py |    3 
 wizards/com/sun/star/wizards/agenda/TopicsControl.py               |    2 
 wizards/com/sun/star/wizards/common/ConfigGroup.py                 |    2 
 wizards/com/sun/star/wizards/common/Configuration.py               |   11 +-
 wizards/com/sun/star/wizards/common/NoValidPathException.py        |    3 
 wizards/com/sun/star/wizards/common/SystemDialog.py                |    2 
 wizards/com/sun/star/wizards/fax/FaxWizardDialog.py                |    5 
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py            |   49 
+++++----
 wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py       |    3 
 wizards/com/sun/star/wizards/letter/LetterWizardDialog.py          |   17 +--
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py      |    2 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py |    3 
 wizards/com/sun/star/wizards/text/TextDocument.py                  |   10 +
 wizards/com/sun/star/wizards/text/TextSectionHandler.py            |   51 
++++++----
 wizards/com/sun/star/wizards/ui/UnoDialog.py                       |   27 +----
 wizards/com/sun/star/wizards/ui/UnoDialog2.py                      |   10 +
 wizards/com/sun/star/wizards/ui/WizardDialog.py                    |   23 ++--
 wizards/source/access2base/access2base.py                          |    5 
 20 files changed, 150 insertions(+), 110 deletions(-)

New commits:
commit 6f9f643b6d7929423fc83fc7857ed70e140a96ed
Author:     Leonard Sasse <l.sa...@fz-juelich.de>
AuthorDate: Fri Mar 29 08:59:16 2024 +0100
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Mon Jun 24 19:25:07 2024 +0200

    tdf#158803 F821: fix a number of undefined names and related issues in 
wizards/
    
    make CharLocale a class attribute in TextDocument.py
    similar to line 109
    
    fix import of AnyConverter in Configuration.py
    
    it turns out LetterWizardDialog.py was
    importing HID from LetterWizardDialogConst.py
    but not using that import. But removing it
    broke LetterWizardDialogImply.py because
    this was importing HID from LetterWizardDialog.py
    so now LetterWizardDialogImpl.py is directly
    importing HID from LetterWizardDialogConst.py
    
    Change-Id: I36bf54dcfca084b9cd25cef0f80ae814ef83643a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165507
    Tested-by: Jenkins
    Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py 
b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
index b96fe44cf150..c1f4a8f9016e 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
@@ -15,17 +15,17 @@
 #   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 ..text.TextElement import TextElement
-from ..text.TextDocument import TextDocument
-from ..text.TextSectionHandler import TextSectionHandler
-from ..common.FileAccess import FileAccess
-
 from datetime import datetime
 
+import uno
+from com.sun.star.i18n.NumberFormatIndex import DATE_SYSTEM_LONG, TIME_HHMM
 from com.sun.star.text.PlaceholderType import TEXT
-from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG
+
+from ..common.FileAccess import FileAccess
+from ..text.TextDocument import TextDocument
+from ..text.TextElement import TextElement
+from ..text.TextSectionHandler import TextSectionHandler
 
 '''
 The classes here implement the whole document-functionality of the agenda 
wizard:
@@ -434,7 +434,6 @@ class AgendaDocument(TextDocument):
                 topicStartTime = int(self.agenda.cp_Time)
                 # first I replace the minutes titles...
                 self.items = self.searchFillInItems()
-                itemIndex = 0
                 for item in self.items:
                     itemText = item.String.lstrip().lower()
                     if itemText == \
@@ -450,12 +449,15 @@ class AgendaDocument(TextDocument):
                     elif itemText == \
                             self.templateConsts.FILLIN_MINUTES_DATE:
                         self.fillMinutesItem(
-                            item, getDateString(self.agenda.cp_Date),
+                            item, self.getDateString(self.agenda.cp_Date),
                             self.resources.resPlaceHolderDate)
                     elif itemText == \
                             self.templateConsts.FILLIN_MINUTES_TIME:
-                        self.fillMinutesItem( item, self.agenda.cp_Time,
-                            self.resources.resPlaceHolderTime)
+                        self.fillMinutesItem(
+                            item,
+                            self.agenda.cp_Time,
+                            self.resources.resPlaceHolderTime
+                        )
 
                 self.items.clear()
                 '''
@@ -465,10 +467,9 @@ class AgendaDocument(TextDocument):
                 topics data has *always* an empty topic at the end...
                 '''
 
-                for i in xrange(len(topicsData) - 1):
+                for i in range(len(topicsData) - 1):
                     topic = topicsData[i]
                     items = self.searchFillInItems()
-                    itemIndex = 0
                     for item in items:
                         itemText = item.String.lstrip().lower()
                         if itemText == \
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py 
b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
index 91933191a163..7361dd7cf84d 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
@@ -16,7 +16,8 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
-from ..ui.WizardDialog import WizardDialog, uno, UIConsts, PropertyNames
+from ..ui.WizardDialog import WizardDialog, uno, PropertyNames
+from ..ui.UIConsts import UIConsts
 from .AgendaWizardDialogConst import AgendaWizardDialogConst, HID
 from .AgendaWizardDialogResources import AgendaWizardDialogResources
 
@@ -24,7 +25,7 @@ from .AgendaWizardDialogResources import 
AgendaWizardDialogResources
 class AgendaWizardDialog(WizardDialog):
 
     def __init__(self, xmsf):
-        super(AgendaWizardDialog,self).__init__(xmsf, HID )
+        super(AgendaWizardDialog, self).__init__(xmsf, HID)
 
         #Load Resources
         self.resources = AgendaWizardDialogResources()
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py 
b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
index 9d42e6317f95..8a78fb5ae071 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
@@ -24,7 +24,8 @@ class AgendaWizardDialogResources(object):
     SECTION_MINUTES = "MINUTES"
 
     def __init__(self):
-        import sys, os
+        import sys
+        import os
 
         if sys.version_info < (3,4):
             import imp
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py 
b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index 6e269f6bf242..bb8d8b81ae01 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -643,7 +643,7 @@ class TopicsControl(ControlScroller):
         elif tmp_switch_var1 == 3:
             return cr.timebox
         else:
-            raise Exception("No such column");
+            raise Exception("No such column")
 
     '''getControl
     returns a control out of the given row, which is
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py 
b/wizards/com/sun/star/wizards/common/ConfigGroup.py
index 200d4ef9d1ad..4155e87f63cc 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.py
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py
@@ -47,7 +47,7 @@ class ConfigGroup(object):
         propertyName = field[len(prefix):]
         child = getattr(self, field)
         if isinstance(child, ConfigGroup):
-            child.setRoot(self.root);
+            child.setRoot(self.root)
             child.readConfiguration(configView.getByName(propertyName),
                 prefix)
         else:
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py 
b/wizards/com/sun/star/wizards/common/Configuration.py
index 91274e0b288c..941b7efa0c03 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.py
+++ b/wizards/com/sun/star/wizards/common/Configuration.py
@@ -18,6 +18,7 @@
 import uno
 import traceback
 
+
 class Configuration(object):
     '''This class gives access to the OO configuration api.'''
 
@@ -44,7 +45,7 @@ class Configuration(object):
     @classmethod
     def getProductName(self, xMSF):
         try:
-            oProdNameAccess = self.getConfigurationRoot(xMSF, 
"org.openoffice.Setup/Product", False);
+            oProdNameAccess = self.getConfigurationRoot(xMSF, 
"org.openoffice.Setup/Product", False)
             return oProdNameAccess.getByName("ooName")
         except Exception:
             traceback.print_exc()
@@ -60,7 +61,13 @@ class Configuration(object):
 
     @classmethod
     def getInt(self, name, parent):
-        o = getNode(name, parent)
+        o = self.getNode(name, parent)
+        # com will be undefined as it seems to strem from a java module?
+        # so no need to add an import statement for this.
+        # pyflakes will give an undefined name error but it seems
+        # this can therefore be ignored.
+        # It would be good to use a linter that we can tell to ignore this
+        # type of thing (i.e. flake8 or ruff)
         if (com.sun.star.uno.AnyConverter.isVoid(o)):
             return 0
         return com.sun.star.uno.AnyConverter.toInt(o)
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.py 
b/wizards/com/sun/star/wizards/common/NoValidPathException.py
index 565f67fefcee..d0625dda9cca 100644
--- a/wizards/com/sun/star/wizards/common/NoValidPathException.py
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.py
@@ -22,7 +22,8 @@ class NoValidPathException(Exception):
         # TODO: NEVER open a dialog in an exception
         from .SystemDialog import SystemDialog
         if xMSF:
-            import sys, os
+            import sys
+            import os
 
             if sys.version_info < (3,4):
                 import imp
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py 
b/wizards/com/sun/star/wizards/common/SystemDialog.py
index 35bcdadfac3b..f9c3776b40c1 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -114,7 +114,7 @@ class SystemDialog(object):
                     return str(i.Value).replace("%productname%", "LibreOffice")
 
             raise Exception(
-                "UIName property not found for Filter " + filterName);
+                "UIName property not found for Filter " + filterName)
         except Exception:
             traceback.print_exc()
             return None
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py 
b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
index 0153eb639d30..9624fc4ed9d0 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py
@@ -15,9 +15,10 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
+from ..ui.UIConsts import UIConsts
+from ..ui.WizardDialog import PropertyNames, WizardDialog, uno
+from .FaxWizardDialogConst import HIDMAIN, FaxWizardDialogConst
 from .FaxWizardDialogResources import FaxWizardDialogResources
-from .FaxWizardDialogConst import FaxWizardDialogConst, HIDMAIN, HID
-from ..ui.WizardDialog import WizardDialog, uno, UIConsts, PropertyNames
 
 
 class FaxWizardDialog(WizardDialog):
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py 
b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 72952dce2701..4167cd6de2e5 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -15,30 +15,33 @@
 #   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
 import os.path
-from .FaxWizardDialog import FaxWizardDialog, uno, HID
-from .CGFaxWizard import CGFaxWizard
-from .FaxDocument import FaxDocument
-from ..ui.PathSelection import PathSelection
-from ..ui.event.UnoDataAware import UnoDataAware
-from ..ui.event.RadioDataAware import RadioDataAware
-from ..ui.event.CommonListener import TerminateListenerProcAdapter
-from ..text.TextFieldHandler import TextFieldHandler
-from ..text.TextElement import TextElement
+import traceback
+
+from com.sun.star.awt.VclWindowPeerAttribute import DEF_NO, YES_NO
+from com.sun.star.document.MacroExecMode import ALWAYS_EXECUTE
+from com.sun.star.document.UpdateDocMode import FULL_UPDATE
+from com.sun.star.util import CloseVetoException
+from com.sun.star.view.DocumentZoomType import OPTIMAL
+
 from ..common.Configuration import Configuration
-from ..common.SystemDialog import SystemDialog
-from ..common.NoValidPathException import NoValidPathException
-from ..common.HelpIds import HelpIds
-from ..common.FileAccess import FileAccess
 from ..common.Desktop import Desktop
+from ..common.FileAccess import FileAccess
+from ..common.HelpIds import HelpIds
+from ..common.NoValidPathException import NoValidPathException
+from ..common.SystemDialog import SystemDialog
 from ..document.OfficeDocument import OfficeDocument
+from ..text.TextElement import TextElement
+from ..text.TextFieldHandler import TextFieldHandler
+from ..ui.event.CommonListener import TerminateListenerProcAdapter
+from ..ui.event.RadioDataAware import RadioDataAware
+from ..ui.event.UnoDataAware import UnoDataAware
+from ..ui.PathSelection import PathSelection
+from .CGFaxWizard import CGFaxWizard
+from .FaxDocument import FaxDocument
+from .FaxWizardDialog import FaxWizardDialog, uno
+from .FaxWizardDialogConst import HID
 
-from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO
-from com.sun.star.util import CloseVetoException
-from com.sun.star.view.DocumentZoomType import OPTIMAL
-from com.sun.star.document.UpdateDocMode import FULL_UPDATE
-from com.sun.star.document.MacroExecMode import ALWAYS_EXECUTE
 
 class FaxWizardDialogImpl(FaxWizardDialog):
 
@@ -210,12 +213,12 @@ class FaxWizardDialogImpl(FaxWizardDialog):
     def drawConstants(self):
         '''Localise the template'''
         constRangeList = self.myFaxDoc.searchFillInItems(1)
-        
+
         for i in constRangeList:
             text = i.String.lower()
             aux = TextElement(i, self.resources.dictConstants[text])
             aux.write()
-            
+
     def insertRoadmap(self):
         self.addRoadmap()
         self.insertRoadMapItems(
@@ -245,7 +248,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
                 self.sFaxPath, self.resources.dictBusinessTemplate)
             self.PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri",
                 self.sFaxPath, self.resources.dictPrivateTemplate)
-                
+
             self.xDialogModel.lstBusinessStyle.StringItemList = \
                 tuple(self.BusinessFiles[0])
             self.xDialogModel.lstPrivateStyle.StringItemList = \
@@ -604,7 +607,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
             self.chkUseFooter.State = 0
 
         self.chkUseFooterItemChanged()
-        
+
     def optReceiverPlaceholderItemChanged(self):
         OfficeDocument.attachEventCall(
             self.myFaxDoc.xTextDocument, "OnNew", "StarBasic",
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py 
b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
index fa3254207c2f..cdb03d50a860 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py
@@ -19,7 +19,8 @@
 class FaxWizardDialogResources(object):
 
     def __init__(self):
-        import sys, os
+        import sys
+        import os
 
         if sys.version_info < (3,4):
             import imp
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py 
b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
index 25f8323fac13..565d777332bd 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
@@ -16,10 +16,11 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 
-from .LetterWizardDialogConst import LetterWizardDialogConst, HIDMAIN, HID
-from .LetterWizardDialogResources import LetterWizardDialogResources
 from ..common.HelpIds import HelpIds
-from ..ui.WizardDialog import WizardDialog, uno, UIConsts, PropertyNames
+from ..ui.UIConsts import UIConsts
+from ..ui.WizardDialog import PropertyNames, WizardDialog, uno
+from .LetterWizardDialogConst import HID, HIDMAIN, LetterWizardDialogConst
+from .LetterWizardDialogResources import LetterWizardDialogResources
 
 
 class LetterWizardDialog(WizardDialog):
@@ -29,11 +30,11 @@ class LetterWizardDialog(WizardDialog):
 
         #Load Resources
         self.resources = LetterWizardDialogResources()
-        
-        #set dialog properties...        
-        self.setDialogProperties(True, 210, True, 104, 52, 1, 1, 
+
+        #set dialog properties...
+        self.setDialogProperties(True, 210, True, 104, 52, 1, 1,
             self.resources.resLetterWizardDialog_title, 350)
-                
+
         self.fontDescriptor5 = \
             uno.createUnoStruct('com.sun.star.awt.FontDescriptor')
         self.fontDescriptor6 = \
@@ -43,7 +44,7 @@ class LetterWizardDialog(WizardDialog):
 
     def buildStep1(self):
         self.optBusinessLetter = self.insertRadioButton(
-            "optBusinessLetter", 
+            "optBusinessLetter",
             LetterWizardDialogConst.OPTBUSINESSLETTER_ITEM_CHANGED,
             (PropertyNames.PROPERTY_HEIGHT,
                 PropertyNames.PROPERTY_HELPURL,
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py 
b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 66c0e33457b5..de85eb50c049 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -234,7 +234,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 self.xUnoDialog.endExecute()
                 self.running = False
 
-        return True;
+        return True
 
     def closeDocument(self):
         try:
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py 
b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
index 3a7802f2baa7..c2be2259a014 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
@@ -19,7 +19,8 @@
 class LetterWizardDialogResources(object):
 
     def __init__(self):
-        import sys, os
+        import sys
+        import os
 
         if sys.version_info < (3,4):
             import imp
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py 
b/wizards/com/sun/star/wizards/text/TextDocument.py
index f975dad5718b..5a25c65bf697 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -56,19 +56,21 @@ class TextDocument(object):
             elif xArgs is not None:
                 '''creates an instance of TextDocument
                 and creates a frame and loads a document'''
-                self.xDesktop = Desktop.getDesktop(xMSF);
+                self.xDesktop = Desktop.getDesktop(xMSF)
                 self.xFrame = OfficeDocument.createNewFrame(xMSF, listener)
                 self.xTextDocument = OfficeDocument.load(
-                    self.xFrame, URL, "_self", xArgs);
+                    # TODO: Find out which URL this is supposed to be,
+                    # it is currently not defined
+                    self.xFrame, URL, "_self", xArgs)
                 self.xWindowPeer = self.xFrame.getComponentWindow()
                 self.m_xDocProps = self.xTextDocument.DocumentProperties
-                CharLocale = self.xTextDocument.CharLocale
+                self.CharLocale = self.xTextDocument.CharLocale
                 return
 
             else:
                 '''creates an instance of TextDocument from
                 the desktop's current frame'''
-                self.xDesktop = Desktop.getDesktop(xMSF);
+                self.xDesktop = Desktop.getDesktop(xMSF)
                 self.xFrame = self.xDesktop.getActiveFrame()
                 self.xTextDocument = self.xFrame.getController().Model
 
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.py 
b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
index e8d649a31462..4f9c0c8a700a 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
@@ -18,6 +18,7 @@
 import uno
 import traceback
 
+
 class TextSectionHandler(object):
     '''Creates a new instance of TextSectionHandler'''
     def __init__(self, xMSF, xTextDocument):
@@ -33,7 +34,6 @@ class TextSectionHandler(object):
                     SectionName)
                 self.removeTextSection(oTextSection)
 
-
         except Exception:
             traceback.print_exc()
 
@@ -62,8 +62,11 @@ class TextSectionHandler(object):
             oSectionLink = \
                 uno.createUnoStruct('com.sun.star.text.SectionFileLink')
             oSectionLink.FileURL = ""
-            uno.invoke(oTextSection, "setPropertyValues",
-                (("FileLink", "LinkRegion"), (oSectionLink, "")))
+            uno.invoke(
+                oTextSection,
+                "setPropertyValues",
+                (("FileLink", "LinkRegion"), (oSectionLink, ""))
+            )
         except Exception:
             traceback.print_exc()
 
@@ -76,8 +79,11 @@ class TextSectionHandler(object):
             oSectionLink = \
                 uno.createUnoStruct('com.sun.star.text.SectionFileLink')
             oSectionLink.FileURL = TemplateName
-            uno.invoke(oTextSection, "setPropertyValues",
-                (("FileLink", "LinkRegion"), (oSectionLink, SectionName)))
+            uno.invoke(
+                oTextSection,
+                "setPropertyValues",
+                (("FileLink", "LinkRegion"), (oSectionLink, SectionName))
+            )
 
             NewSectionName = oTextSection.Name
             if NewSectionName is not SectionName:
@@ -85,19 +91,28 @@ class TextSectionHandler(object):
         except Exception:
             traceback.print_exc()
 
-    def insertTextSection(self, GroupName, TemplateName, _bAddParagraph):
-        try:
-            if _bAddParagraph:
-                xTextCursor = self.xText.createTextCursor()
-                self.xText.insertControlCharacter(
-                    xTextCursor, ControlCharacter.PARAGRAPH_BREAK, False)
-                xTextCursor.collapseToEnd()
+    # The following pyflakes errors flagged this function for me. In my
+    # opinion it is impossible that the first function is ever used anywhere
+    # since it is re-defined immediately afterwards. It also contains the
+    # undefined insertTextSection call which I think is likely erroneous.
+    # ./TextSectionHandler.py:99:13: undefined name 'insertTextSection'
+    # ./TextSectionHandler.py:103:5:
+    # redefinition of unused 'insertTextSection' from line 89
 
-            xSecondTextCursor = self.xText.createTextCursor()
-            xSecondTextCursor.gotoEnd(False)
-            insertTextSection(GroupName, TemplateName, xSecondTextCursor)
-        except Exception:
-            traceback.print_exc()
+    # I have therefore commented this out for now.
+    # def insertTextSection(self, GroupName, TemplateName, _bAddParagraph):
+    #    try:
+    #        if _bAddParagraph:
+    #            xTextCursor = self.xText.createTextCursor()
+    #            self.xText.insertControlCharacter(
+    #                xTextCursor, ControlCharacter.PARAGRAPH_BREAK, False)
+    #            xTextCursor.collapseToEnd()
+    #
+    #        xSecondTextCursor = self.xText.createTextCursor()
+    #        xSecondTextCursor.gotoEnd(False)
+    #        insertTextSection(GroupName, TemplateName, xSecondTextCursor)
+    #    except Exception:
+    #        traceback.print_exc()
 
     def insertTextSection(self, sectionName, templateName, position):
         try:
@@ -110,7 +125,7 @@ class TextSectionHandler(object):
                 position.getText().insertTextContent(
                     position, xTextSection, False)
 
-            linkSectiontoTemplate(xTextSection, templateName, sectionName)
+            self.linkSectiontoTemplate(xTextSection, templateName, sectionName)
         except Exception:
             traceback.print_exc()
 
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py 
b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index 174593b09ff8..5def1b184c40 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -18,7 +18,6 @@
 #
 import uno
 import traceback
-from .UIConsts import UIConsts
 from ..common.PropertyNames import PropertyNames
 from com.sun.star.awt import Rectangle
 from com.sun.star.awt.PosSize import POS
@@ -223,31 +222,25 @@ class UnoDialog(object):
                 nLuminance = ((nBlue * 28 + nGreen * 151 + nRed * 77) / 256)
                 bisactivated = (nLuminance <= 25)
                 self.BisHighContrastModeActivated = bool(bisactivated)
-                return bisactivated;
+                return bisactivated
             else:
                 return self.BisHighContrastModeActivated
         else:
             return False
 
-
     def getRedColorShare(self, _nColor):
-        nRed = _nColor / 65536
-        nRedModulo = _nColor % 65536
-        nGreen = nRedModulo / 256
-        nGreenModulo = (nRedModulo % 256)
-        nBlue = nGreenModulo
-        return nRed
+        # previously these methods contained other calculations that had no
+        # effect on the return value nRed
+        return _nColor / 65536
 
     def getGreenColorShare(self, _nColor):
-        nRed = _nColor / 65536
+        # previously these methods contained other calculations that had no
+        # effect on the return value nGreen
         nRedModulo = _nColor % 65536
-        nGreen = nRedModulo / 256
-        return nGreen
+        return nRedModulo / 256
 
     def getBlueColorShare(self, _nColor):
-        nRed = _nColor / 65536
+        # previously these methods contained other calculations that had no
+        # effect on the return value nGreen
         nRedModulo = _nColor % 65536
-        nGreen = nRedModulo / 256
-        nGreenModulo = (nRedModulo % 256)
-        nBlue = nGreenModulo
-        return nBlue
+        return nRedModulo % 256
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py 
b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
index 42aee8c5f5bd..4c8f8dc9048b 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
@@ -15,7 +15,9 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from .UnoDialog import UnoDialog, UIConsts
+
+from .UIConsts import UIConsts
+from .UnoDialog import UnoDialog
 from ..common.Desktop import Desktop
 from ..common.PropertyNames import PropertyNames
 from ..common.SystemDialog import SystemDialog
@@ -42,7 +44,11 @@ class UnoDialog2(UnoDialog):
 
     def __init__(self, xmsf):
         super(UnoDialog2,self).__init__(xmsf,(), ())
-        ControlList = {}
+        # previously this was variable "ControlList", which was never used
+        # below there is a self.ControlList in a boolean condition
+        # which is never initialised, so from that I am inferring that this
+        # should in fact be self.ControlList
+        self.ControlList = {}
 
     def insertButton(
         self, sName, actionPerformed, sPropNames, oPropValues, listener):
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py 
b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 333c2e98b529..abff6a8cb97f 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -15,19 +15,21 @@
 #   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 os
+import sys
 import traceback
 from abc import ABCMeta, abstractmethod
-from .UnoDialog2 import UnoDialog2, Desktop, PropertyNames, UIConsts, \
-    ItemListenerProcAdapter
-from ..common.HelpIds import HelpIds
-from ..common.FileAccess import FileAccess
 
-from com.sun.star.lang import NoSuchMethodException
-from com.sun.star.frame import TerminationVetoException
+import uno
 from com.sun.star.awt.PushButtonType import HELP, STANDARD
+from com.sun.star.frame import TerminationVetoException
+from com.sun.star.lang import NoSuchMethodException
 
-import sys, os
+from ..common.FileAccess import FileAccess
+from ..common.HelpIds import HelpIds
+from .UIConsts import UIConsts
+from .UnoDialog2 import (Desktop, ItemListenerProcAdapter, PropertyNames,
+                         UnoDialog2)
 
 if sys.version_info < (3,4):
     import imp
@@ -41,8 +43,8 @@ elif sys.version_info < (3,7):
 else:
     # have to jump through hoops since 3.7, partly because python does not 
like loading modules that do have a .py extension
     import importlib
-    import importlib.util
     import importlib.machinery
+    import importlib.util
     module_name = 'strings'
     path = os.path.join(os.path.dirname(__file__), '../common/strings.hrc')
     spec = importlib.util.spec_from_loader(
@@ -188,6 +190,7 @@ class WizardDialog(UnoDialog2):
             self.oRoadmap.Text = strings.RID_COMMON_START_16
         except NoSuchMethodException:
             from com.sun.star.awt.VclWindowPeerAttribute import OK
+
             from .SystemDialog import SystemDialog
             sError = "The files required could not be found.
" + \
                 "Please start the LibreOffice Setup and choose 'Repair'."
@@ -374,7 +377,7 @@ class WizardDialog(UnoDialog2):
                 while self.nNewStep > 0:
                     bIsEnabled = self.isStepEnabled(self.nNewStep)
                     if bIsEnabled:
-                        break;
+                        break
 
                     self.nNewStep -= 1
                 if (self.nNewStep == 0):
diff --git a/wizards/source/access2base/access2base.py 
b/wizards/source/access2base/access2base.py
index ff0a9fbaa9cc..2410e6d88dae 100644
--- a/wizards/source/access2base/access2base.py
+++ b/wizards/source/access2base/access2base.py
@@ -40,7 +40,10 @@ import uno
 XSCRIPTCONTEXT = uno
 
 from platform import system as _opsys
-import datetime, os, sys, traceback
+import datetime
+import os
+import sys
+import traceback
 
 _LIBRARY = ''               # Should be 'Access2Base' or 'Access2BaseDev'
 _VERSION = '7.4'            # Actual version number

Reply via email to