Esempio n. 1
0
    def generateOnAction (self) :
        onAction = self.element.onAction
        if hasattr(onAction, "executeCode") : 
            actionHeaderFile = self.generated.actionHeaderFile
            actionSrcFile = self.generated.actionSrcFile

            regularName = self.widgetName
            capitalName = self.name.upper()

            actionHeaderFile = actionHeaderFile.replace("CAPITAL_NAME_HERE", capitalName)
            actionHeaderFile = actionHeaderFile.replace("REGULAR_NAME_HERE", regularName)

            actionSrcFile = actionSrcFile.replace("CAPITAL_NAME_HERE", capitalName)
            actionSrcFile = actionSrcFile.replace("REGULAR_NAME_HERE", regularName)
            actionSrcFile = actionSrcFile.replace("ADDITIONAL_INCLUDES_HERE", self.generated.srcIncludes)
            actionSrcFile = actionSrcFile.replace("EXECUTE_ACTION_HERE", onAction.executeCode)

            self.generated.headerIncludes += self.generateHeaderInclude()

            genH = open(self.generated.path + "/" + regularName + ".h", 'w')
            genH.write(actionHeaderFile)
            genH.close()
            genC = open(self.generated.path + "/" + regularName + ".cc", 'w')
            genC.write(actionSrcFile)
            genC.close()

        elif hasattr(onAction, "dialog") : 
            dialog = dw.Dialog(self.generated, onAction.dialog, self.name, self.languageSetName)
            dialog.generate()
Esempio n. 2
0
 def generateOnAction (self) :
     onAction = self.element.onAction
     if hasattr(onAction, "executeCode") : 
         self.generated.executeAction += self.executeCases + "        {0}\n".format("{")    
         self.generated.executeAction += "            {0}\n        {1}\n        break;\n\n".format(onAction.executeCode, "}")
     elif hasattr(onAction, "dialog") : 
         dialogElem = onAction.dialog
         dialog = dw.Dialog(self.generated, dialogElem, (self.parentObjectPath + self.objectPathSuffix), self.languageSetName)
         dialog.generate()
Esempio n. 3
0
    if hasattr(o.root.controlPanelDevice, "controlPanels"):
        for cp in o.root.controlPanelDevice.controlPanels.controlPanel:
            generated.addControlPanel(cp.rootContainer)
            container = cw.Container(
                generated, cp.rootContainer, generated.ObjectPathPrefix +
                cp.rootContainer.name + "/REPLACE_LANG",
                cp.attr["languageSet"], 1)
            container.generate()

    ### Get and process all NotificationAction
    if hasattr(o.root.controlPanelDevice, "notificationActions"):
        if hasattr(o.root.controlPanelDevice.notificationActions, "dialog"):
            for notDialog in o.root.controlPanelDevice.notificationActions.dialog:
                generated.addNotificationAction(notDialog)
                dialog = dw.Dialog(
                    generated, notDialog, generated.ObjectPathPrefix +
                    notDialog.name + "/REPLACE_LANG",
                    notDialog.attr["languageSet"], 1)
                dialog.generate()
        if hasattr(o.root.controlPanelDevice.notificationActions, "container"):
            for notContainer in o.root.controlPanelDevice.notificationActions.container:
                generated.addNotificationAction(notContainer)
                container = cw.Container(
                    generated, notContainer, generated.ObjectPathPrefix +
                    notContainer.name + "/REPLACE_LANG",
                    notContainer.attr["languageSet"], 1)
                container.generate()

### Finish up merging all the different components ###
generated.replaceInFiles()
generated.writeFiles()
sys.exit(0)
Esempio n. 4
0
if hasattr(o.root.controlPanelDevice, "url") :
    httpControl = http.HttpControl(generated, o.root.controlPanelDevice.url)
    httpControl.generate()

### Get and process all ControlPanels
if hasattr(o.root.controlPanelDevice, "controlPanels") :
   for cp in o.root.controlPanelDevice.controlPanels.controlPanel :
        generated.addControlPanel(cp.rootContainer, cp.attr["languageSet"])

        container = cw.Container(generated, cp.rootContainer, cp.rootContainer.name + "ControlPanel", cp.attr["languageSet"], 1) 
        container.generate()

### Get and process all NotificationAction 
if hasattr(o.root.controlPanelDevice, "notificationActions") :
    if hasattr(o.root.controlPanelDevice.notificationActions, "dialog") :
        for notDialog in o.root.controlPanelDevice.notificationActions.dialog :
            generated.addNotificationAction(notDialog, notDialog.attr["languageSet"])
            dialog = dw.Dialog(generated, notDialog, notDialog.name + "NotificationAction", notDialog.attr["languageSet"], 1) 
            dialog.generate()
    if hasattr(o.root.controlPanelDevice.notificationActions, "container") : 
        for notContainer in o.root.controlPanelDevice.notificationActions.container :
            generated.addNotificationAction(notContainer, notContainer.attr["languageSet"])
            container = cw.Container(generated, notContainer, notContainer.name + "NotificationAction", notContainer.attr["languageSet"], 1) 
            container.generate()

### Finish up merging all the different components ###
generated.replaceInFiles()
generated.writeFiles()
sys.exit(1)

Esempio n. 5
0
            generated.addControlPanel(cp.rootContainer, cp.attr["languageSet"])
            parentName = generated.unitName + cp.rootContainer.name[:1].upper(
            ) + cp.rootContainer.name[1:] + "ControlPanel"
            container = cw.Container(generated, cp.rootContainer, parentName,
                                     cp.attr["languageSet"], 1)
            container.generate()

    ### Get and process all NotificationAction
    if hasattr(o.root.controlPanelDevice, "notificationActions"):
        if hasattr(o.root.controlPanelDevice.notificationActions, "dialog"):
            for notDialog in o.root.controlPanelDevice.notificationActions.dialog:
                generated.addNotificationAction(notDialog,
                                                notDialog.attr["languageSet"])
                parentName = generated.unitName + notDialog.name[:1].upper(
                ) + notDialog.name[1:] + "NotificationAction"
                dialog = dw.Dialog(generated, notDialog, parentName,
                                   notDialog.attr["languageSet"], 1)
                dialog.generate()
        if hasattr(o.root.controlPanelDevice.notificationActions, "container"):
            for notContainer in o.root.controlPanelDevice.notificationActions.container:
                generated.addNotificationAction(
                    notContainer, notContainer.attr["languageSet"])
                parentName = generated.unitName + notContainer.name[:1].upper(
                ) + notContainer.name[1:] + "NotificationAction"
                container = cw.Container(generated, notContainer, parentName,
                                         notContainer.attr["languageSet"], 1)
                container.generate()

### Finish up merging all the different components ###
generated.replaceInFiles()
generated.writeFiles()
sys.exit(0)