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
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