Rename extension instance 'wxHMI' to 'wxglade_hmi'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 13 Aug 2018 18:19:17 +0300
changeset 2282 73f95ba6d3af
parent 2281 a778eee0bc09
child 2283 f7132d89fbc0
Rename extension instance 'wxHMI' to 'wxglade_hmi'

It is necessary because of following commit 7f59aa398669 ('WxGlade HMI extension now does
only instanciate wx object who's name match extension's name. If no
object match the name and no code is provided in 'start' user python
code section, then a warning is issued')
tests/wxHMI/HMI@wxglade_hmi/baseconfnode.xml
tests/wxHMI/HMI@wxglade_hmi/hmi.wxg
tests/wxHMI/HMI@wxglade_hmi/pyfile.xml
tests/wxHMI/wxglade_hmi@wxglade_hmi/baseconfnode.xml
tests/wxHMI/wxglade_hmi@wxglade_hmi/hmi.wxg
tests/wxHMI/wxglade_hmi@wxglade_hmi/pyfile.xml
--- a/tests/wxHMI/HMI@wxglade_hmi/baseconfnode.xml	Mon Aug 13 18:05:16 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<BaseParams Name="HMI" IEC_Channel="0"/>
--- a/tests/wxHMI/HMI@wxglade_hmi/hmi.wxg	Mon Aug 13 18:05:16 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-<!-- generated by wxGlade 0.7.2 on Tue Jun  6 12:26:48 2017 -->
-
-<application class="" encoding="UTF-8" for_version="2.8" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" name="" option="0" overwrite="0" path="..py.py" source_extension=".cpp" top_window="wxglade_hmi" use_gettext="1" use_new_namespace="1">
-    <object class="Class_wxglade_hmi" name="wxglade_hmi" base="EditFrame">
-        <style>wxDEFAULT_FRAME_STYLE|wxMAXIMIZE</style>
-        <title>frame_1</title>
-        <object class="wxFlexGridSizer" name="grid_sizer_1" base="EditFlexGridSizer">
-            <hgap>0</hgap>
-            <growable_rows>0</growable_rows>
-            <rows>1</rows>
-            <growable_cols>0</growable_cols>
-            <cols>4</cols>
-            <vgap>0</vgap>
-            <object class="sizeritem">
-                <flag>wxALIGN_CENTER</flag>
-                <border>0</border>
-                <option>1</option>
-                <object class="ThreeDee" name="window_1" base="CustomWidget">
-                    <extracode># WHERE IS THAT ?\nprint "hello"\n</extracode>
-                    <arguments>
-                        <argument>$parent</argument>
-                        <argument>$id</argument>
-                    </arguments>
-                    <size>400,400</size>
-                </object>
-            </object>
-            <object class="sizeritem">
-                <flag>wxEXPAND</flag>
-                <border>0</border>
-                <option>1</option>
-                <object class="wxFlexGridSizer" name="sizer_1" base="EditFlexGridSizer">
-                    <hgap>0</hgap>
-                    <growable_rows>0</growable_rows>
-                    <rows>2</rows>
-                    <cols>1</cols>
-                    <vgap>0</vgap>
-                    <object class="sizeritem">
-                        <flag>wxEXPAND</flag>
-                        <border>0</border>
-                        <option>1</option>
-                        <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer">
-                            <orient>wxVERTICAL</orient>
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                        </object>
-                    </object>
-                    <object class="sizeritem">
-                        <flag>wxEXPAND</flag>
-                        <border>0</border>
-                        <option>1</option>
-                        <object class="wxGridSizer" name="sizer_3" base="EditGridSizer">
-                            <hgap>0</hgap>
-                            <rows>6</rows>
-                            <cols>2</cols>
-                            <vgap>0</vgap>
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                            <object class="sizerslot" />
-                        </object>
-                    </object>
-                </object>
-            </object>
-            <object class="sizeritem">
-                <border>0</border>
-                <option>0</option>
-                <object class="wxToggleButton" name="DrawTestBt" base="EditToggleButton">
-                    <label>Please Draw!</label>
-                    <events>
-                        <handler event="EVT_TOGGLEBUTTON">SetPLCTestBtnGlobalVar</handler>
-                    </events>
-                </object>
-            </object>
-            <object class="sizeritem">
-                <border>0</border>
-                <option>0</option>
-                <object class="wxToggleButton" name="DrawTestBt2" base="EditToggleButton">
-                    <label>Please Draw copy!</label>
-                    <events>
-                        <handler event="EVT_TOGGLEBUTTON">SetPLCTestBtn2GlobalVar</handler>
-                    </events>
-                </object>
-            </object>
-        </object>
-    </object>
-</application>
--- a/tests/wxHMI/HMI@wxglade_hmi/pyfile.xml	Mon Aug 13 18:05:16 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<PyFile xmlns:xhtml="http://www.w3.org/1999/xhtml">
-  <variables>
-    <variable name="Power_ON" type="BOOL"/>
-    <variable name="Power_OFF" type="BOOL"/>
-    <variable name="DrawTest" type="BOOL"/>
-    <variable name="DrawLogo" type="BOOL"/>
-    <variable name="DrawEscher" type="BOOL"/>
-    <variable name="Detect_Circle" type="BOOL"/>
-    <variable name="XaxisPos" type="INT"/>
-    <variable name="YaxisPos" type="INT"/>
-    <variable name="ZaxisPos" type="INT"/>
-    <variable name="TaxisPos" type="INT"/>
-    <variable name="XaxisMinus" type="BOOL"/>
-    <variable name="YaxisMinus" type="BOOL"/>
-    <variable name="ZaxisMinus" type="BOOL"/>
-    <variable name="TaxisMinus" type="BOOL"/>
-    <variable name="XaxisPlus" type="BOOL"/>
-    <variable name="YaxisPlus" type="BOOL"/>
-    <variable name="ZaxisPlus" type="BOOL"/>
-    <variable name="TaxisPlus" type="BOOL"/>
-    <variable name="DrawTestBtn" type="BOOL"/>
-    <variable name="DrawTestBtn2" type="BOOL"/>
-  </variables>
-  <globals>
-    <xhtml:p><![CDATA[
-import ctypes
-import wx, sys
-
-AxisList = ["X","Y","Z","T"]
-
-PwrButtons = ['Power_ON',
-              'Power_OFF']
-
-ActionButtons = ['Detect_Circle',
-                 'DrawTest',
-                 'DrawLogo',
-                 'DrawEscher']
-
-class ThreeDee(wx.StaticText):
-    def __init__(self, *args, **kwargs):
-        self.initialized = False
-        kwargs["style"] = wx.ALIGN_CENTRE_HORIZONTAL
-        super(ThreeDee, self).__init__(*args, **kwargs)
-
-        self.SetFont(wx.Font(24, wx.SWISS, wx.NORMAL, wx.BOLD))
-        
-        self.positions = [0.]*4
-
-        self.Message = None
-        self.NegLimits = None
-        self.Disk = None
-
-
-    def UpdatePositions(self, positions):
-        # get globals from PLC
-        self.positions = positions
-        self.SetLabel(
-            ((self.Message  +'\n\n') if self.Message else '' )+
-            " ".join(["%s %+.2f"%(axis,self.positions[i])
-                          for i,axis in enumerate(AxisList)]))
-
-def MakeButtonFunc(window, sizer, btname):
-    def ButtonDown(event):
-        setattr(PLCGlobals,btname,1)
-        event.Skip()
-    def ButtonUp(event):
-        setattr(PLCGlobals,btname,0)
-        event.Skip()
-    obj = wx.BitmapButton(window, -1, wx.Bitmap('%s.png'%btname))
-    sizer.Add(obj, 2, wx.EXPAND, 0)
-    obj.Bind(wx.EVT_LEFT_DOWN, ButtonDown)
-    obj.Bind(wx.EVT_LEFT_UP, ButtonUp)
-    return obj
-
-def UpdPos(self):
-    positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList]
-
-    self.window_1.UpdatePositions(positions)
-
-Class_wxglade_hmi.UpdPos = UpdPos
-
-
-#def UpdatePositions(self, event):
-#
-#    positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList]
-#
-#    self.window_1.UpdatePositions(positions)
-#
-#    event.Skip()
-
-#Class_wxglade_hmi.UpdatePositions = UpdatePositions
-
-initorig = Class_wxglade_hmi.__init__
-def Init(self,*args,**kargs):
-    initorig(self,*args,**kargs)
-    sizer = self.GetSizer().GetItem(1).GetSizer().GetItem(0).GetSizer()
-    self.main_buttons = map(
-        lambda btname: MakeButtonFunc(self, sizer, btname), PwrButtons)
-    sizer = self.GetSizer().GetItem(1).GetSizer().GetItem(1).GetSizer()
-    self.main_buttons = map(
-        lambda btname: MakeButtonFunc(self, sizer, btname), ActionButtons)
-    self.axis_buttons = map(
-        lambda axis:( MakeButtonFunc(self, sizer, axis+"axisMinus"), 
-                        MakeButtonFunc(self, sizer, axis+"axisPlus")),
-        AxisList)
-
-    
-    # self.timer = wx.Timer(self, -1)
-    # self.Bind(wx.EVT_TIMER, self.UpdatePositions, self.timer)
-    # self.ShowFullScreen(True,wx.FULLSCREEN_ALL)
-    # wx.CallAfter(self.timer.Start,200)
-    
-Class_wxglade_hmi.__init__ = Init
-
-def SetPLCTestBtnGlobalVar(self, evt):
-    setattr(PLCGlobals, "DrawTestBtn", evt.GetEventObject().GetValue())
-
-def SetPLCTestBtn2GlobalVar(self, evt):
-    setattr(PLCGlobals, "DrawTestBtn2", evt.GetEventObject().GetValue())
-
-]]></xhtml:p>
-  </globals>
-  <init>
-    <xhtml:p><![CDATA[
-]]></xhtml:p>
-  </init>
-  <cleanup>
-    <xhtml:p><![CDATA[
-]]></xhtml:p>
-  </cleanup>
-  <start>
-    <xhtml:p><![CDATA[
-]]></xhtml:p>
-  </start>
-  <stop>
-    <xhtml:p><![CDATA[
-]]></xhtml:p>
-  </stop>
-</PyFile>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/wxHMI/wxglade_hmi@wxglade_hmi/baseconfnode.xml	Mon Aug 13 18:19:17 2018 +0300
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?>
+<BaseParams Name="wxglade_hmi" IEC_Channel="0"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/wxHMI/wxglade_hmi@wxglade_hmi/hmi.wxg	Mon Aug 13 18:19:17 2018 +0300
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+<!-- generated by wxGlade 0.8.3 on Mon Aug 13 18:07:00 2018 -->
+
+<application encoding="UTF-8" for_version="2.8" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" option="0" overwrite="0" path="..py.py" source_extension=".cpp" top_window="wxglade_hmi" use_gettext="1" use_new_namespace="1">
+    <object class="Class_wxglade_hmi" name="wxglade_hmi" base="EditFrame">
+        <title>frame_1</title>
+        <style>wxDEFAULT_FRAME_STYLE|wxMAXIMIZE</style>
+        <object class="wxFlexGridSizer" name="grid_sizer_1" base="EditFlexGridSizer">
+            <rows>1</rows>
+            <cols>4</cols>
+            <vgap>0</vgap>
+            <hgap>0</hgap>
+            <growable_rows>0</growable_rows>
+            <growable_cols>0</growable_cols>
+            <object class="sizeritem">
+                <option>1</option>
+                <border>0</border>
+                <flag>wxALIGN_CENTER</flag>
+                <object class="ThreeDee" name="window_1" base="CustomWidget">
+                    <extracode># WHERE IS THAT ?\nprint "hello"\n</extracode>
+                    <size>400,400</size>
+                    <arguments>
+                        <argument>$parent</argument>
+                        <argument>$id</argument>
+                    </arguments>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <option>1</option>
+                <border>0</border>
+                <flag>wxEXPAND</flag>
+                <object class="wxFlexGridSizer" name="sizer_1" base="EditFlexGridSizer">
+                    <rows>2</rows>
+                    <cols>1</cols>
+                    <vgap>0</vgap>
+                    <hgap>0</hgap>
+                    <growable_rows>0</growable_rows>
+                    <object class="sizeritem">
+                        <option>1</option>
+                        <border>0</border>
+                        <flag>wxEXPAND</flag>
+                        <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer">
+                            <orient>wxVERTICAL</orient>
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <option>1</option>
+                        <border>0</border>
+                        <flag>wxEXPAND</flag>
+                        <object class="wxGridSizer" name="sizer_3" base="EditGridSizer">
+                            <rows>6</rows>
+                            <cols>2</cols>
+                            <vgap>0</vgap>
+                            <hgap>0</hgap>
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                            <object class="sizerslot" />
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <option>0</option>
+                <border>0</border>
+                <object class="wxToggleButton" name="DrawTestBt" base="EditToggleButton">
+                    <events>
+                        <handler event="EVT_TOGGLEBUTTON">SetPLCTestBtnGlobalVar</handler>
+                    </events>
+                    <label>Please Draw!</label>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <option>0</option>
+                <border>0</border>
+                <object class="wxToggleButton" name="DrawTestBt2" base="EditToggleButton">
+                    <events>
+                        <handler event="EVT_TOGGLEBUTTON">SetPLCTestBtn2GlobalVar</handler>
+                    </events>
+                    <label>Please Draw copy!</label>
+                </object>
+            </object>
+        </object>
+    </object>
+</application>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/wxHMI/wxglade_hmi@wxglade_hmi/pyfile.xml	Mon Aug 13 18:19:17 2018 +0300
@@ -0,0 +1,140 @@
+<?xml version='1.0' encoding='utf-8'?>
+<PyFile xmlns:xhtml="http://www.w3.org/1999/xhtml">
+  <variables>
+    <variable name="Power_ON" type="BOOL"/>
+    <variable name="Power_OFF" type="BOOL"/>
+    <variable name="DrawTest" type="BOOL"/>
+    <variable name="DrawLogo" type="BOOL"/>
+    <variable name="DrawEscher" type="BOOL"/>
+    <variable name="Detect_Circle" type="BOOL"/>
+    <variable name="XaxisPos" type="INT"/>
+    <variable name="YaxisPos" type="INT"/>
+    <variable name="ZaxisPos" type="INT"/>
+    <variable name="TaxisPos" type="INT"/>
+    <variable name="XaxisMinus" type="BOOL"/>
+    <variable name="YaxisMinus" type="BOOL"/>
+    <variable name="ZaxisMinus" type="BOOL"/>
+    <variable name="TaxisMinus" type="BOOL"/>
+    <variable name="XaxisPlus" type="BOOL"/>
+    <variable name="YaxisPlus" type="BOOL"/>
+    <variable name="ZaxisPlus" type="BOOL"/>
+    <variable name="TaxisPlus" type="BOOL"/>
+    <variable name="DrawTestBtn" type="BOOL"/>
+    <variable name="DrawTestBtn2" type="BOOL"/>
+  </variables>
+  <globals>
+    <xhtml:p><![CDATA[
+import ctypes
+import wx, sys
+
+AxisList = ["X","Y","Z","T"]
+
+PwrButtons = ['Power_ON',
+              'Power_OFF']
+
+ActionButtons = ['Detect_Circle',
+                 'DrawTest',
+                 'DrawLogo',
+                 'DrawEscher']
+
+class ThreeDee(wx.StaticText):
+    def __init__(self, *args, **kwargs):
+        self.initialized = False
+        kwargs["style"] = wx.ALIGN_CENTRE_HORIZONTAL
+        super(ThreeDee, self).__init__(*args, **kwargs)
+
+        self.SetFont(wx.Font(24, wx.SWISS, wx.NORMAL, wx.BOLD))
+        
+        self.positions = [0.]*4
+
+        self.Message = None
+        self.NegLimits = None
+        self.Disk = None
+
+
+    def UpdatePositions(self, positions):
+        # get globals from PLC
+        self.positions = positions
+        self.SetLabel(
+            ((self.Message  +'\n\n') if self.Message else '' )+
+            " ".join(["%s %+.2f"%(axis,self.positions[i])
+                          for i,axis in enumerate(AxisList)]))
+
+def MakeButtonFunc(window, sizer, btname):
+    def ButtonDown(event):
+        setattr(PLCGlobals,btname,1)
+        event.Skip()
+    def ButtonUp(event):
+        setattr(PLCGlobals,btname,0)
+        event.Skip()
+    obj = wx.BitmapButton(window, -1, wx.Bitmap('%s.png'%btname))
+    sizer.Add(obj, 2, wx.EXPAND, 0)
+    obj.Bind(wx.EVT_LEFT_DOWN, ButtonDown)
+    obj.Bind(wx.EVT_LEFT_UP, ButtonUp)
+    return obj
+
+def UpdPos(self):
+    positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList]
+
+    self.window_1.UpdatePositions(positions)
+
+Class_wxglade_hmi.UpdPos = UpdPos
+
+
+#def UpdatePositions(self, event):
+#
+#    positions = [getattr(PLCGlobals,axname+"axisPos") for axname in AxisList]
+#
+#    self.window_1.UpdatePositions(positions)
+#
+#    event.Skip()
+
+#Class_wxglade_hmi.UpdatePositions = UpdatePositions
+
+initorig = Class_wxglade_hmi.__init__
+def Init(self,*args,**kargs):
+    initorig(self,*args,**kargs)
+    sizer = self.GetSizer().GetItem(1).GetSizer().GetItem(0).GetSizer()
+    self.main_buttons = map(
+        lambda btname: MakeButtonFunc(self, sizer, btname), PwrButtons)
+    sizer = self.GetSizer().GetItem(1).GetSizer().GetItem(1).GetSizer()
+    self.main_buttons = map(
+        lambda btname: MakeButtonFunc(self, sizer, btname), ActionButtons)
+    self.axis_buttons = map(
+        lambda axis:( MakeButtonFunc(self, sizer, axis+"axisMinus"), 
+                        MakeButtonFunc(self, sizer, axis+"axisPlus")),
+        AxisList)
+
+    
+    # self.timer = wx.Timer(self, -1)
+    # self.Bind(wx.EVT_TIMER, self.UpdatePositions, self.timer)
+    # self.ShowFullScreen(True,wx.FULLSCREEN_ALL)
+    # wx.CallAfter(self.timer.Start,200)
+    
+Class_wxglade_hmi.__init__ = Init
+
+def SetPLCTestBtnGlobalVar(self, evt):
+    setattr(PLCGlobals, "DrawTestBtn", evt.GetEventObject().GetValue())
+
+def SetPLCTestBtn2GlobalVar(self, evt):
+    setattr(PLCGlobals, "DrawTestBtn2", evt.GetEventObject().GetValue())
+
+]]></xhtml:p>
+  </globals>
+  <init>
+    <xhtml:p><![CDATA[
+]]></xhtml:p>
+  </init>
+  <cleanup>
+    <xhtml:p><![CDATA[
+]]></xhtml:p>
+  </cleanup>
+  <start>
+    <xhtml:p><![CDATA[
+]]></xhtml:p>
+  </start>
+  <stop>
+    <xhtml:p><![CDATA[
+]]></xhtml:p>
+  </stop>
+</PyFile>