--- a/svghmi/svghmi.py Wed Jun 01 09:15:26 2022 +0200
+++ b/svghmi/svghmi.py Wed Jun 01 09:22:07 2022 +0200
@@ -282,6 +282,10 @@
CONFNODEEDITOR_TABS = [
(_("HMI Tree"), "CreateSVGHMI_UI")]
+ def __init__(self, parent, controler, window):
+ ConfTreeNodeEditor.__init__(self, parent, controler, window)
+ self.Controler = controler
+
def CreateSVGHMI_UI(self, parent):
global hmi_tree_root
@@ -292,25 +296,29 @@
hmitree_backup_file = open(hmitree_backup_path, 'rb')
hmi_tree_root = HMITreeNode.from_etree(etree.parse(hmitree_backup_file).getroot())
- ret = SVGHMI_UI(parent, Register_SVGHMI_UI_for_HMI_tree_updates)
+ ret = SVGHMI_UI(parent, self.Controler, Register_SVGHMI_UI_for_HMI_tree_updates)
on_hmitree_update(hmi_tree_root)
return ret
if wx.Platform == '__WXMSW__':
- browser_launch_cmd="cmd.exe /c 'start msedge {url}'"
+ default_cmds={
+ "launch":"cmd.exe /c 'start msedge {url}'",
+ "watchdog":"cmd.exe /k 'echo watchdog for {url} !'"}
else:
- browser_launch_cmd="chromium {url}"
+ default_cmds={
+ "launch":"chromium {url}",
+ "watchdog":"echo Watchdog for {name} !"}
class SVGHMI(object):
XSD = """<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="SVGHMI">
<xsd:complexType>
- <xsd:attribute name="OnStart" type="xsd:string" use="optional" default="%s"/>
+ <xsd:attribute name="OnStart" type="xsd:string" use="optional" default="%(launch)s"/>
<xsd:attribute name="OnStop" type="xsd:string" use="optional" default=""/>
- <xsd:attribute name="OnWatchdog" type="xsd:string" use="optional" default=""/>
+ <xsd:attribute name="OnWatchdog" type="xsd:string" use="optional" default="%(watchdog)s"/>
<xsd:attribute name="EnableWatchdog" type="xsd:boolean" use="optional" default="false"/>
<xsd:attribute name="WatchdogInitial" use="optional" default="30">
<xsd:simpleType>
@@ -342,7 +350,7 @@
</xsd:complexType>
</xsd:element>
</xsd:schema>
- """%browser_launch_cmd
+ """%default_cmds
EditorType = SVGHMIEditor
@@ -399,9 +407,13 @@
if from_project_path is not None:
shutil.copyfile(self._getSVGpath(from_project_path),
self._getSVGpath())
- shutil.copyfile(self._getPOTpath(from_project_path),
- self._getPOTpath())
- # XXX TODO copy .PO files
+
+ potpath = self._getPOTpath(from_project_path)
+ if os.path.isfile(potpath):
+ shutil.copyfile(potpath, self._getPOTpath())
+ # copy .PO files
+ for _name, pofile in GetPoFiles(from_project_path):
+ shutil.copy(pofile, self.CTNPath())
return True
def GetSVGGeometry(self):