plugins/svgui/svgui.py
changeset 42 2bff00eb6cd0
parent 39 243ff39fef11
child 43 937640beb464
equal deleted inserted replaced
41:1608a434fb8c 42:2bff00eb6cd0
   747         Gen_C_file = os.path.join(buildpath, "program.cpp" )
   747         Gen_C_file = os.path.join(buildpath, "program.cpp" )
   748         return [(Gen_C_file,"")],""
   748         return [(Gen_C_file,"")],""
   749     
   749     
   750     def BlockTypesFactory(self):
   750     def BlockTypesFactory(self):
   751         def generate_svgui_block(generator, block, body, link):
   751         def generate_svgui_block(generator, block, body, link):
   752             controller = generator.GetController()
       
   753             name = block.getInstanceName()
   752             name = block.getInstanceName()
   754             type = block.getTypeName()
   753             type = block.getTypeName()
   755             block_infos = self.GetBlockType(type)
   754             block_infos = self.GetBlockType(type)
   756             bus_id, name = [word for word in name.split("_") if word != ""]
   755             block_id = self.GetElementIdFromName(name)
   757             block_id = self.PlugChilds[bus_id].GetElementIdFromName(name)
       
   758             if block_id == None:
   756             if block_id == None:
   759                 raise ValueError, "No corresponding block found"
   757                 raise ValueError, "No corresponding block found"
   760             if not generator.ComputedBlocks.get(name, False):
   758             if not generator.ComputedBlocks.get(name, False):
   761                 for num, variable in enumerate(block.inputVariables.getVariable()):
   759                 for num, variable in enumerate(block.inputVariables.getVariable()):
   762                     connections = variable.connectionPointIn.getConnections()
   760                     connections = variable.connectionPointIn.getConnections()
   777 
   775 
   778         return [{"name" : "SVGUI function blocks", "list" :
   776         return [{"name" : "SVGUI function blocks", "list" :
   779            [{"name" : "Container", "type" : "functionBlock", "extensible" : False, 
   777            [{"name" : "Container", "type" : "functionBlock", "extensible" : False, 
   780                     "inputs" : [("Show","BOOL","none"),("Set State","BOOL","none")], 
   778                     "inputs" : [("Show","BOOL","none"),("Set State","BOOL","none")], 
   781                     "outputs" : [("Show","BOOL","none"),("State Changed","BOOL","none")],
   779                     "outputs" : [("Show","BOOL","none"),("State Changed","BOOL","none")],
   782                     "comment" : "SVGUI Container"},
   780                     "comment" : "SVGUI Container",
       
   781                     "generate" : generate_svgui_block},
   783                 {"name" : "Button", "type" : "functionBlock", "extensible" : False, 
   782                 {"name" : "Button", "type" : "functionBlock", "extensible" : False, 
   784                     "inputs" : [("Show","BOOL","none"),("Toggle","BOOL","none")], 
   783                     "inputs" : [("Show","BOOL","none"),("Toggle","BOOL","none")], 
   785                     "outputs" : [("Visible","BOOL","none"),("State","BOOL","none")],
   784                     "outputs" : [("Visible","BOOL","none"),("State","BOOL","none")],
   786                     "comment" : "SVGUI Button"},
   785                     "comment" : "SVGUI Button",
       
   786                     "generate" : generate_svgui_block},
   787                 {"name" : "TextCtrl", "type" : "functionBlock", "extensible" : False, 
   787                 {"name" : "TextCtrl", "type" : "functionBlock", "extensible" : False, 
   788                     "inputs" : [("Text","STRING","none"),("Set Text","BOOL","none")], 
   788                     "inputs" : [("Text","STRING","none"),("Set Text","BOOL","none")], 
   789                     "outputs" : [("Text","STRING","none"),("Text Changed","BOOL","none")],
   789                     "outputs" : [("Text","STRING","none"),("Text Changed","BOOL","none")],
   790                     "comment" : "SVGUI Text Control"},
   790                     "comment" : "SVGUI Text Control",
       
   791                     "generate" : generate_svgui_block},
   791                 {"name" : "ScrollBar", "type" : "functionBlock", "extensible" : False, 
   792                 {"name" : "ScrollBar", "type" : "functionBlock", "extensible" : False, 
   792                     "inputs" : [("Position","UINT","none"),("Set Position","BOOL","none")], 
   793                     "inputs" : [("Position","UINT","none"),("Set Position","BOOL","none")], 
   793                     "outputs" : [("Position","UINT","none"),("Position Changed","BOOL","none")],
   794                     "outputs" : [("Position","UINT","none"),("Position Changed","BOOL","none")],
   794                     "comment" : "SVGUI ScrollBar"},
   795                     "comment" : "SVGUI ScrollBar",
       
   796                     "generate" : generate_svgui_block},
   795                 {"name" : "NoteBook", "type" : "functionBlock", "extensible" : False, 
   797                 {"name" : "NoteBook", "type" : "functionBlock", "extensible" : False, 
   796                     "inputs" : [("Selected","UINT","none"),("Set Selected","BOOL","none")], 
   798                     "inputs" : [("Selected","UINT","none"),("Set Selected","BOOL","none")], 
   797                     "outputs" : [("Selected","UINT","none"),("Selected Changed","BOOL","none")],
   799                     "outputs" : [("Selected","UINT","none"),("Selected Changed","BOOL","none")],
   798                     "comment" : "SVGUI Notebook"},
   800                     "comment" : "SVGUI Notebook",
       
   801                     "generate" : generate_svgui_block},
   799                 {"name" : "RotatingCtrl", "type" : "functionBlock", "extensible" : False, 
   802                 {"name" : "RotatingCtrl", "type" : "functionBlock", "extensible" : False, 
   800                     "inputs" : [("Angle","REAL","none"),("Set Angle","BOOL","none")], 
   803                     "inputs" : [("Angle","REAL","none"),("Set Angle","BOOL","none")], 
   801                     "outputs" : [("Angle","REAL","none"),("Angle changed","BOOL","none")],
   804                     "outputs" : [("Angle","REAL","none"),("Angle changed","BOOL","none")],
   802                     "comment" : "SVGUI Rotating Control"},
   805                     "comment" : "SVGUI Rotating Control",
       
   806                     "generate" : generate_svgui_block},
   803                 {"name" : "Transform", "type" : "functionBlock", "extensible" : False, 
   807                 {"name" : "Transform", "type" : "functionBlock", "extensible" : False, 
   804                     "inputs" : [("X","REAL","none"),("Y","REAL","none"),("Scale X","REAL","none"),("Scale Y","REAL","none"),("Angle","REAL","none"),("Set","BOOL","none")], 
   808                     "inputs" : [("X","REAL","none"),("Y","REAL","none"),("Scale X","REAL","none"),("Scale Y","REAL","none"),("Angle","REAL","none"),("Set","BOOL","none")], 
   805                     "outputs" : [("X","REAL","none"),("Y","REAL","none"),("Scale X","REAL","none"),("Scale Y","REAL","none"),("Angle","REAL","none"),("Changed","BOOL","none")],
   809                     "outputs" : [("X","REAL","none"),("Y","REAL","none"),("Scale X","REAL","none"),("Scale Y","REAL","none"),("Angle","REAL","none"),("Changed","BOOL","none")],
   806                     "comment" : "SVGUI Transform"},
   810                     "comment" : "SVGUI Transform",
       
   811                     "generate" : generate_svgui_block},
   807                ]}
   812                ]}
   808         ]
   813         ]
   809     
   814     
   810     def GetBlockType(self,type):
   815     def GetBlockType(self,type):
   811         for category in self.BlockTypesFactory():
   816         for category in self.BlockTypesFactory():