Ejemplo n.º 1
0
        def get_ui_mods(self):
            tbl = UI.DataTable(
                UI.DataTableRow(UI.DataTableCell(UI.Label(), width='20px'),
                                UI.DataTableCell(UI.Label(text='Name'),
                                                 width='200px'),
                                UI.DataTableCell(UI.Label(text='')),
                                header=True))

            mods = self._backend.get_mods()
            for x in sorted(mods.keys()):
                tbl.append(
                    UI.DataTableRow(
                        UI.Image(file='/dl/core/ui/stock/status-%sabled.png' %
                                 ('en' if mods[x].enabled else 'dis')),
                        UI.Label(text=x),
                        UI.DataTableCell(UI.HContainer(
                            UI.MiniButton(id='editmod/' + x, text='Edit')
                            if mods[x].has_config else None,
                            UI.MiniButton(id='togglemod/' + x,
                                          text='Disable'
                                          if mods[x].enabled else 'Enable'),
                            spacing=0),
                                         hidden=True)))

            ui = UI.Container(tbl)
            if self._editing_mod is not None:
                ui.append(
                    UI.AreaInputBox(text='Module config:',
                                    value=self._backend.get_mods()[
                                        self._editing_mod].config,
                                    id='dlgEditMod'))

            return ui
Ejemplo n.º 2
0
Archivo: main.py Proyecto: vlara/ajenti
    def get_ui(self):
        ui = self.app.inflate('dashboard:main')
        self._mgr.refresh()

        self.fill('l', self._mgr.list_left(), ui, 'cleft')
        self.fill('r', self._mgr.list_right(), ui, 'cright')

        ui.insertText('host', platform.node())
        ui.insertText('distro', detect_distro())
        ui.find('icon').set('src', '/dl/dashboard/distributor-logo-%s.png'%detect_platform(mapping=False))

        if self._adding_widget == True:
            dlg = self.app.inflate('dashboard:add-widget')
            idx = 0
            for prov in sorted(self.app.grab_plugins(apis.dashboard.IWidget)):
                if hasattr(prov, 'hidden'):
                    continue
                dlg.append('list', UI.ListItem(
                    UI.HContainer(
                        UI.Image(file=prov.icon),
                        UI.Label(text=prov.name),
                    ),
                    id=prov.plugin_id,
                ))
                idx += 1
            ui.append('main', dlg)

        elif self._adding_widget != None:
            ui.append('main', self._mgr.get_by_name(self._adding_widget).get_config_dialog())

        return ui
Ejemplo n.º 3
0
 def get_ui_about(self):
     ui = UI.Centerer(
         UI.VContainer(
             UI.Image(file='/dl/core/ui/logo_big.png'), UI.Spacer(height=6),
             UI.Label(text='Ajenti ' + version, size=4),
             UI.Label(text='Your personal server affairs agent'),
             UI.Spacer(height=10),
             UI.HContainer(
                 UI.OutLinkLabel(
                     url
                     ='http://www.assembla.com/spaces/ajenti/wiki?id=aLa8XiGfWr36nLeJe5cbLA',
                     text='Wiki'),
                 UI.OutLinkLabel(
                     url=
                     'http://www.assembla.com/spaces/ajenti/wiki?id=ajenti&wiki_id=Developers',
                     text='Credits'),
                 UI.OutLinkLabel(
                     text='License',
                     url='http://www.gnu.org/licenses/lgpl.html'),
                 UI.OutLinkLabel(
                     text='Bugs',
                     url=
                     'http://www.assembla.com/spaces/ajenti/support/tickets'
                 ),
                 spacing=6), UI.Spacer(height=10),
             UI.Button(text='Close', id='closeabout')))
     return UI.DialogBox(ui, hideok=True, hidecancel=True)
Ejemplo n.º 4
0
Archivo: api.py Proyecto: vlara/ajenti
        def get_ui_hosts(self, gui):
            ui = self.app.inflate('webserver_common:hosts')
            tbl = ui.find('list') 
               
            hosts = self._backend.get_hosts()
            for x in sorted(hosts.keys()):
                tbl.append(UI.DTR(
                            UI.Image(file='/dl/core/ui/stock/status-%sabled.png'%(
                                'en' if hosts[x].enabled else 'dis')),
                            UI.Label(text=x),
                            UI.DTD(
                                UI.HContainer(
                                    UI.TipIcon(
                                        icon='/dl/core/ui/stock/edit.png',
                                        id='edithost/'+x, 
                                        text='Edit'
                                    ),
                                    UI.TipIcon(
                                        icon='/dl/core/ui/stock/'+ ('dis' if hosts[x].enabled else 'en') + 'able.png',
                                        id='togglehost/'+x, 
                                        text='Disable' if hosts[x].enabled else 'Enable'
                                    ),
                                    UI.TipIcon(
                                        icon='/dl/core/ui/stock/delete.png',
                                        id='deletehost/'+x, 
                                        text='Delete',
                                        warning='Delete host %s'%x
                                    ),
                                    spacing=0
                                ),
                                hidden=True
                            )
                          ))
                            
            if self._creating_host:
                gui.append(
                    'main',
                    UI.InputBox(
                        text='Host config name', 
                        id='dlgCreateHost'
                    )
                )

            if self._editing_host is not None:
                gui.append(
                    'main',
                    UI.InputBox(
                        extra='code',
                        text='Host config', 
                        value=self._backend.get_hosts()[self._editing_host].config,
                        id='dlgEditHost'
                    )
                )
                
            return ui
Ejemplo n.º 5
0
Archivo: api.py Proyecto: vlara/ajenti
 def get_ui_mods(self, gui):
     ui = self.app.inflate('webserver_common:mods')
     tbl = ui.find('list') 
     
     mods = self._backend.get_mods()
     for x in sorted(mods.keys()):
         tbl.append(UI.DTR(
                     UI.Image(file='/dl/core/ui/stock/status-%sabled.png'%(
                         'en' if mods[x].enabled else 'dis')),
                     UI.Label(text=x),
                     UI.DTD(
                         UI.HContainer(
                             UI.TipIcon(
                                 icon='/dl/core/ui/stock/edit.png',
                                 id='editmod/'+x, 
                                 text='Edit'
                             ) if mods[x].has_config else None,
                             UI.TipIcon(
                                 icon='/dl/core/ui/stock/'+ ('dis' if mods[x].enabled else 'en') + 'able.png',
                                 id='togglemod/'+x, 
                                 text='Disable' if mods[x].enabled else 'Enable'
                             ),
                             spacing=0
                         ),
                         hidden=True
                     )
                   ))
     
     if self._editing_mod is not None:
         gui.append(
             'main',
             UI.InputBox(
                 extra='code',
                 text='Module config:', 
                 value=self._backend.get_mods()[self._editing_mod].config,
                 id='dlgEditMod'
             )
         )
         
     return ui
Ejemplo n.º 6
0
        def get_ui_hosts(self):
            tbl = UI.DataTable(
                UI.DataTableRow(UI.Label(),
                                UI.Label(text='Name'),
                                UI.Label(),
                                header=True))

            hosts = self._backend.get_hosts()
            for x in sorted(hosts.keys()):
                tbl.append(
                    UI.DataTableRow(
                        UI.Image(file='/dl/core/ui/stock/status-%sabled.png' %
                                 ('en' if hosts[x].enabled else 'dis')),
                        UI.Label(text=x),
                        UI.DataTableCell(UI.HContainer(
                            UI.MiniButton(id='edithost/' + x, text='Edit'),
                            UI.MiniButton(id='togglehost/' + x,
                                          text='Disable'
                                          if hosts[x].enabled else 'Enable'),
                            UI.WarningMiniButton(id='deletehost/' + x,
                                                 text='Delete',
                                                 msg='Delete host %s' % x),
                            spacing=0),
                                         hidden=True)))

            ui = UI.VContainer(tbl, UI.Button(text='Add host', id='addhost'))

            if self._creating_host:
                ui.append(
                    UI.InputBox(text='Host config name:', id='dlgCreateHost'))

            if self._editing_host is not None:
                ui.append(
                    UI.AreaInputBox(text='Host config:',
                                    value=self._backend.get_hosts()[
                                        self._editing_host].config,
                                    id='dlgEditHost'))

            return ui