예제 #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
예제 #2
0
파일: api.py 프로젝트: vlara/ajenti
        def get_ui(self):
            mgr = self.app.get_backend(apis.services.IServiceManager)

            st = 'failed'
            st = mgr.get_status(self.service_name)
            try:
                st = mgr.get_status(self.service_name)
                if self.service_expected_status:
                    if self.service_expected_status != st:
                        st = 'failed'
            except:
                st = 'failed'

            self.service_status = st
            self.service_expected_status = None

            panel = UI.ServicePluginPanel(status=self.service_status,
                                          servicename=self.service_name)
            return UI.Container(panel, self.get_main_ui())