Esempio n. 1
0
 def __init__(self, parent, ID, resource, defaults=None):
     """ Class initialization method.
     """
     self.resource = resource
     self.cache    = {'attrs': [], 'deps': [], }
     commonDialog.CommonDialog.__init__(self, parent, ID, 'Create %s' % config.getResourceId(self.resource), size=(400, 300), defaults=defaults)
     self.Bind(wx.EVT_CLOSE, self.OnClose)
Esempio n. 2
0
    def _sendToOutput(self):
        """ Parse all resources and send information to the outputTextCtrl.

        For every resource, information is parsed in the final YAML format and
        it is displayed in the outputTextCtrl widget.
        """
        self.outputTextCtrl.Clear()
        for resId in [config.getResourceId(resource) for resource in config.RESOURCES]:
            self.outputTextCtrl.AppendText(self.resourceHdlr.parseToYamlForAll(resId))
            self.outputTextCtrl.SetInsertionPoint(0)
Esempio n. 3
0
    def getYamlDict(self):
        """ Return dictionary to be YAMLed.

        It returns the dictionary to be used to generate YAML data.
        """
        classId = config.getResourceId(self._resource)
        yamlData = {classId: {}, }
        yamlData[classId][self.name] = {}
        for attr in [attr for attr in config.getResourceAttrs(self._resource) if not config.isAttrTheAttrName(attr)]:
            attrName = config.getResourceAttrName(attr)
            if config.getResourceAttrEnable(attr):
                yamlData[classId][self.name][attrName] = getattr(self, attrName, None)
        return yamlData
Esempio n. 4
0
    def createResourceButtons(self, panel):
        """ Create all resource buttons.

        It creates all resource buttons and bind them to the OnClickEvent
        handler.
        """
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        for resId in [config.getResourceId(resource) for resource in config.RESOURCES]:
            button = wx.Button(panel, -1, resId)
            sizer.Add(button, 1, wx.HORIZONTAL)
            self.Bind(wx.EVT_BUTTON, self.OnClickConfig, button)

        #eventBtn    = wx.Button(panel, -1, 'Event')

        #sizer.Add(eventBtn, 1, wx.HORIZONTAL)

        #self.Bind(wx.EVT_BUTTON, self.OnClickEvent, eventBtn)

        return sizer
Esempio n. 5
0
 def getResourceId(self):
     return config.getResourceId(self._resource)