Пример #1
0
    def __setstate__(self, state):
        """!TXT! Handle startup event"""

        Folder.inheritedAttribute('__setstate__')(self, state)

        # initialize profiles
        if not hasattr(self, '_Profiles__profiles'):
            self.init_profiles()

        # create missing new folders
        ids = self.objectIds()
        if not 'designs' in ids:
            add_MetaPublisher2Designs(self, 'designs')
        if not 'frontends' in ids:
            add_MetaPublisher2Frontends(self, 'frontends')
        if not 'languages' in ids:
            add_MetaPublisher2Languages(self, 'languages')
        if not 'tools' in ids:
            add_MetaPublisher2Tools(self, 'tools')
        if not 'widgets' in ids:
            add_MetaPublisher2Widgets(self, 'widgets')

        # move frontends from legacy location into frontends folder
        if 'interfaces' in ids and self.interfaces.meta_type == 'InterfacesFolder':
            try:
                if self.interfaces.objectIds():
                    clipboard = self.interfaces.manage_copyObjects(self.interfaces.objectIds())
                    self.frontends.manage_pasteObjects(clipboard)
                self.manage_delObjects('interfaces')
            except:
                pass
    def all_meta_types(self, interfaces=None):
        """!TXT! Return list of containable object types"""

        interfaces = (interfaces and list(interfaces) or []) + [IWidgetPluginBase, ]
        return Folder.all_meta_types(self, interfaces)