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