280 |
280 |
281 class SVGHMIEditor(ConfTreeNodeEditor): |
281 class SVGHMIEditor(ConfTreeNodeEditor): |
282 CONFNODEEDITOR_TABS = [ |
282 CONFNODEEDITOR_TABS = [ |
283 (_("HMI Tree"), "CreateSVGHMI_UI")] |
283 (_("HMI Tree"), "CreateSVGHMI_UI")] |
284 |
284 |
|
285 def __init__(self, parent, controler, window): |
|
286 ConfTreeNodeEditor.__init__(self, parent, controler, window) |
|
287 self.Controler = controler |
|
288 |
285 def CreateSVGHMI_UI(self, parent): |
289 def CreateSVGHMI_UI(self, parent): |
286 global hmi_tree_root |
290 global hmi_tree_root |
287 |
291 |
288 if hmi_tree_root is None: |
292 if hmi_tree_root is None: |
289 buildpath = self.Controler.GetCTRoot()._getBuildPath() |
293 buildpath = self.Controler.GetCTRoot()._getBuildPath() |
290 hmitree_backup_path = os.path.join(buildpath, "hmitree.xml") |
294 hmitree_backup_path = os.path.join(buildpath, "hmitree.xml") |
291 if os.path.exists(hmitree_backup_path): |
295 if os.path.exists(hmitree_backup_path): |
292 hmitree_backup_file = open(hmitree_backup_path, 'rb') |
296 hmitree_backup_file = open(hmitree_backup_path, 'rb') |
293 hmi_tree_root = HMITreeNode.from_etree(etree.parse(hmitree_backup_file).getroot()) |
297 hmi_tree_root = HMITreeNode.from_etree(etree.parse(hmitree_backup_file).getroot()) |
294 |
298 |
295 ret = SVGHMI_UI(parent, Register_SVGHMI_UI_for_HMI_tree_updates) |
299 ret = SVGHMI_UI(parent, self.Controler, Register_SVGHMI_UI_for_HMI_tree_updates) |
296 |
300 |
297 on_hmitree_update(hmi_tree_root) |
301 on_hmitree_update(hmi_tree_root) |
298 |
302 |
299 return ret |
303 return ret |
300 |
304 |