svghmi/ui.py
branchsvghmi
changeset 3222 6adeeb16ac3e
parent 3221 3d307ad803ea
child 3223 061796d9855e
equal deleted inserted replaced
3221:3d307ad803ea 3222:6adeeb16ac3e
   288             dropSource.SetData(data)
   288             dropSource.SetData(data)
   289             dropSource.DoDragDrop(wx.Drag_AllowMove)
   289             dropSource.DoDragDrop(wx.Drag_AllowMove)
   290 
   290 
   291     def GiveDetails(self, _context, msgs):
   291     def GiveDetails(self, _context, msgs):
   292         for msg in msgs:
   292         for msg in msgs:
   293             self.msg += msg+"\n"
   293             self.msg += msg.text + "\n"
   294         
   294         
       
   295     def GetSubHMITree(self, _context):
       
   296         return [self.hmitree_node.etree()]
       
   297 
   295     def ValidateWidget(self):
   298     def ValidateWidget(self):
   296         self.msg = ""
   299         self.msg = ""
   297 
   300 
   298         if self.tempf is not None:
   301         if self.tempf is not None:
   299             os.unlink(self.tempf.name)
   302             os.unlink(self.tempf.name)
   305             if self.hmitree_node is None:
   308             if self.hmitree_node is None:
   306                 raise Exception(_("No HMI tree node selected"))
   309                 raise Exception(_("No HMI tree node selected"))
   307 
   310 
   308             transform = XSLTransform(
   311             transform = XSLTransform(
   309                 os.path.join(ScriptDirectory, "gen_dnd_widget_svg.xslt"),
   312                 os.path.join(ScriptDirectory, "gen_dnd_widget_svg.xslt"),
   310                 [("GiveDetails", self.GiveDetails)])
   313                 [("GetSubHMITree", self.GetSubHMITree),
       
   314                  ("GiveDetails", self.GiveDetails)])
   311 
   315 
   312             svgdom = etree.parse(self.selected_SVG)
   316             svgdom = etree.parse(self.selected_SVG)
   313 
   317 
   314             result = transform.transform(svgdom) 
   318             result = transform.transform(svgdom)
   315                 # hmi_path=self.hmitree_node.path,
       
   316                 # hmi_type=self.hmitree_node.nodetype)
       
   317 
   319 
   318             for entry in transform.get_error_log():
   320             for entry in transform.get_error_log():
   319                 self.msg += "XSLT: " + entry.message + "\n" 
   321                 self.msg += "XSLT: " + entry.message + "\n" 
   320 
   322 
   321             self.tempf = NamedTemporaryFile(suffix='.svg', delete=False)
   323             self.tempf = NamedTemporaryFile(suffix='.svg', delete=False)