Exemplo n.º 1
0
    def process(self, req, start_response):
        self.do_init()

        if self.is_firstrun():
            templ = self.app.get_template('firstrun.xml')
        else:
            templ = self.app.get_template('index.xml')
            if self.app.platform == 'arkos':
                templ.remove('navbar-brand')
                templ.append('navbar-brand-div', UI.Image(cls='navbar-brand', file='/dl/core/ui/arkos.png'))

        # Sort plugins into menus where necessary
        cats = self.app.grab_plugins(ICategoryProvider)
        cats = sorted(cats, key=lambda p: p.text)

        if not self.is_firstrun():
            for c in cats:
                if c.folder in ['top', 'bottom']:
                    templ.append(
                        'topplaceholder-'+c.folder,
                        UI.TopCategory(
                            text=c.text,
                            id=c.plugin_id,
                            iconfont=c.iconfont,
                            counter=c.get_counter(),
                            selected=c==self.selected_category
                        )
                    )
                elif c.folder == 'tools':
                    templ.append(
                        'tools-placeholder',
                        UI.PopoverLink(iconfont=c.iconfont, text=c.text,
                            onclick="Genesis.selectCategory('"+c.plugin_id+"');", 
                        )
                    )
            templ.append('_head', UI.HeadTitle(text='Genesis @ %s'%platform.node()))
            templ.append('version', UI.Label(text='Genesis '+version(), size=2))
            templ.insertText('cat-username', self.app.auth.user)
            templ.appendAll('links', 
                    UI.LinkLabel(iconfont='gen-info', text='About', id='about'),
                )

        return templ.render()
Exemplo n.º 2
0
    def process(self, req, start_response):
        self.do_init()

        templ = self.app.get_template('index.xml')

        cat = None
        v = UI.VContainer(spacing=0)

        # Sort plugins by name
        cats = self.app.grab_plugins(ICategoryProvider)
        cats = sorted(cats, key=lambda p: p.text)

        for fld in self.folder_ids:
            cat_vc = UI.VContainer(spacing=0)
            if self.folders[fld] == '':
                cat_folder = cat_vc # Omit wrapper for special folders
            else:
                cat_folder = UI.CategoryFolder(
                                cat_vc,
                                text=self.folders[fld],
                                icon='/dl/core/ui/catfolders/'+ fld + '.png'
                                    if self.folders[fld] != '' else '',
                                id=fld
                             )
            # cat_vc will be VContainer or CategoryFolder

            exp = False
            empty = True
            for c in cats:
                if c.folder == fld: # Put corresponding plugins in this folder
                    empty = False
                    if c == self.selected_category:
                        exp = True
                    cat_vc.append(UI.Category(
                        iconfont=c.iconfont,
                        name=c.text,
                        id=c.plugin_id,
                        counter=c.get_counter(),
                        selected=c == self.selected_category
                    ))

            if not empty: v.append(cat_folder)
            cat_folder['expanded'] = exp

        for c in cats:
            if c.folder in ['top', 'bottom']:
                templ.append(
                    'topplaceholder-'+c.folder,
                    UI.TopCategory(
                        text=c.text,
                        id=c.plugin_id,
                        iconfont=c.iconfont,
                        counter=c.get_counter(),
                        selected=c==self.selected_category
                    )
                )

        templ.append('_head', UI.HeadTitle(text='Genesis @ %s'%platform.node()))
        templ.append('leftplaceholder', v)
        templ.append('version', UI.Label(text='Genesis '+version(), size=2))
        templ.insertText('cat-username', self.app.auth.user)
        templ.appendAll('links', 
                UI.LinkLabel(iconfont='gen-info', text='About', id='about'),
                UI.OutLinkLabel(iconfont='gen-certificate', text='License', url='http://www.gnu.org/licenses/gpl.html')
            )

        return templ.render()