fix error __init__ method from base class is not called
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 29 Sep 2017 15:36:33 +0300
changeset 1836 d42b6cf00fa6
parent 1835 7533061a6d82
child 1837 c507c363625e
fix error __init__ method from base class is not called
IDEFrame.py
ProjectController.py
controls/DurationCellEditor.py
controls/LocationCellEditor.py
controls/SearchResultPanel.py
dialogs/DiscoveryDialog.py
docutil/dochtml.py
editors/EditorPanel.py
svgui/pyjs/pyjs.py
tests/tools/check_source.sh
--- a/IDEFrame.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/IDEFrame.py	Fri Sep 29 15:36:33 2017 +0300
@@ -493,9 +493,6 @@
             self.SetIcon(parent.icon)
 
     def _init_ctrls(self, prnt):
-        wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name='IDEFrame',
-                          parent=prnt, pos=wx.DefaultPosition, size=wx.Size(1000, 600),
-                          style=wx.DEFAULT_FRAME_STYLE)
         self._init_icon(prnt)
         self.SetClientSize(wx.Size(1000, 600))
         self.Bind(wx.EVT_ACTIVATE, self.OnActivated)
@@ -678,6 +675,11 @@
         self.AUIManager.Update()
 
     def __init__(self, parent, enable_debug=False):
+        wx.Frame.__init__(self, id=ID_PLCOPENEDITOR, name='IDEFrame',
+                          parent=parent, pos=wx.DefaultPosition,
+                          size=wx.Size(1000, 600),
+                          style=wx.DEFAULT_FRAME_STYLE)
+
         self.Controler = None
         self.Config = wx.ConfigBase.Get()
         self.EnableDebug = enable_debug
--- a/ProjectController.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/ProjectController.py	Fri Sep 29 15:36:33 2017 +0300
@@ -228,6 +228,7 @@
 
     def __init__(self, frame, logger):
         PLCControler.__init__(self)
+        ConfigTreeNode.__init__(self)
 
         if ProjectController.iec2c_cfg is None:
             ProjectController.iec2c_cfg = Iec2CSettings()
--- a/controls/DurationCellEditor.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/controls/DurationCellEditor.py	Fri Sep 29 15:36:33 2017 +0300
@@ -34,7 +34,7 @@
     the DurationEditorDialog.
     '''
     def __init__(self, parent):
-        wx.Control.__init__(self, parent)
+        wx.PyControl.__init__(self, parent)
 
         main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
         main_sizer.AddGrowableCol(0)
--- a/controls/LocationCellEditor.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/controls/LocationCellEditor.py	Fri Sep 29 15:36:33 2017 +0300
@@ -34,7 +34,7 @@
     the BrowseLocationsDialog.
     '''
     def __init__(self, parent):
-        wx.Control.__init__(self, parent)
+        wx.PyControl.__init__(self, parent)
 
         main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
         main_sizer.AddGrowableCol(0)
--- a/controls/SearchResultPanel.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/controls/SearchResultPanel.py	Fri Sep 29 15:36:33 2017 +0300
@@ -88,10 +88,6 @@
         self.SetSizer(self.MainSizer)
 
     def _init_ctrls(self, prnt):
-        wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL,
-                          name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0),
-                          size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
-
         self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL,
                                          name='HeaderLabel', parent=self,
                                          pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
@@ -114,6 +110,11 @@
         self._init_sizers()
 
     def __init__(self, parent, window):
+        wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL,
+                          name='SearchResultPanel', parent=parent,
+                          pos=wx.Point(0, 0),
+                          size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
+
         self.ParentWindow = window
 
         self._init_ctrls(parent)
--- a/dialogs/DiscoveryDialog.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/dialogs/DiscoveryDialog.py	Fri Sep 29 15:36:33 2017 +0300
@@ -80,17 +80,7 @@
 
         self.SetSizer(self.MainSizer)
 
-    def _init_ctrls(self, prnt):
-        wx.Dialog.__init__(
-            self, id=ID_DISCOVERYDIALOG,
-            name='DiscoveryDialog', parent=prnt, style=wx.DEFAULT_DIALOG_STYLE,
-            title=_('Service Discovery'))
-
-        self.staticText1 = wx.StaticText(
-            id=ID_DISCOVERYDIALOGSTATICTEXT1,
-            label=_('Services available:'), name='staticText1', parent=self,
-            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
-
+    def _init_list_ctrl(self):
         # Set up list control
         self.ServicesList = AutoWidthListCtrl(
             id=ID_DISCOVERYDIALOGSERVICESLIST,
@@ -108,7 +98,11 @@
         self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=ID_DISCOVERYDIALOGSERVICESLIST)
         self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, id=ID_DISCOVERYDIALOGSERVICESLIST)
 
-        listmix.ColumnSorterMixin.__init__(self, 4)
+    def _init_ctrls(self, prnt):
+        self.staticText1 = wx.StaticText(
+            id=ID_DISCOVERYDIALOGSTATICTEXT1,
+            label=_('Services available:'), name='staticText1', parent=self,
+            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
 
         self.RefreshButton = wx.Button(
             id=ID_DISCOVERYDIALOGREFRESHBUTTON,
@@ -134,6 +128,15 @@
         self.Fit()
 
     def __init__(self, parent):
+        wx.Dialog.__init__(
+            self, id=ID_DISCOVERYDIALOG,
+            name='DiscoveryDialog', parent=parent,
+            style=wx.DEFAULT_DIALOG_STYLE,
+            title=_('Service Discovery'))
+
+        self._init_list_ctrl()
+        listmix.ColumnSorterMixin.__init__(self, 4)
+
         self._init_ctrls(parent)
 
         self.itemDataMap = {}
--- a/docutil/dochtml.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/docutil/dochtml.py	Fri Sep 29 15:36:33 2017 +0300
@@ -68,9 +68,6 @@
 
 class HtmlFrame(wx.Frame):
         def _init_ctrls(self, prnt):
-            wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
-                              parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
-                              style=wx.DEFAULT_FRAME_STYLE, title='')
             self.SetIcon(prnt.icon)
             self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
 
@@ -80,6 +77,10 @@
             self.HtmlContent.Bind(HtmlWindowUrlClick, self.OnLinkClick)
 
         def __init__(self, parent, opened):
+            wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
+                              parent=parent, pos=wx.Point(320, 231),
+                              size=wx.Size(853, 616),
+                              style=wx.DEFAULT_FRAME_STYLE, title='')
             self._init_ctrls(parent)
             self.HtmlFrameOpened = opened
 
--- a/editors/EditorPanel.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/editors/EditorPanel.py	Fri Sep 29 15:36:33 2017 +0300
@@ -38,8 +38,6 @@
         self.MenuItems = []
 
     def _init_ctrls(self, parent):
-        wx.SplitterWindow.__init__(self, parent,
-                                   style=wx.SUNKEN_BORDER | wx.SP_3D)
         self.SetMinimumPaneSize(1)
 
         self._init_MenuItems()
@@ -60,6 +58,9 @@
             self.Initialize(self.Editor)
 
     def __init__(self, parent, tagname, window, controler, debug=False):
+        wx.SplitterWindow.__init__(self, parent,
+                                   style=wx.SUNKEN_BORDER | wx.SP_3D)
+
         self.ParentWindow = window
         self.Controler = controler
         self.TagName = tagname
--- a/svgui/pyjs/pyjs.py	Thu Sep 28 17:24:33 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Fri Sep 29 15:36:33 2017 +0300
@@ -155,6 +155,7 @@
 
 class TranslationError(Exception):
     def __init__(self, message, node):
+        Exception.__init__(self)
         self.message = "line %s:\n%s\n%s" % (node.lineno, message, node)
 
     def __str__(self):
--- a/tests/tools/check_source.sh	Thu Sep 28 17:24:33 2017 +0300
+++ b/tests/tools/check_source.sh	Fri Sep 29 15:36:33 2017 +0300
@@ -209,7 +209,8 @@
     enable=$enable,W0108          # (unnecessary-lambda) Lambda may not be necessary
     enable=$enable,C0412          # (ungrouped-imports) Imports from package X are not grouped
     enable=$enable,C0321          # (multiple-statements) More than one statement on a single line
-
+    enable=$enable,W0231          # (super-init-not-called) __init__ method from base class is not called
+    
     # enable=$enable,W0403        # relative import
     # enable=$enable,W0622        # (redefined-builtin) Redefining built-in
     # enable=$enable,W0612        # unused-variable