def get_default_ui(self): recent = [UI.SelectOption(text=x[0:40] + "..." if len(x) > 40 else x, value=x) for x in self._recent] log = UI.CustomHTML(enquote(self._process.output + self._process.errors)) frm = UI.FormBox( UI.TextInput(name="cmd", size=30, id="shell-command"), id="frmRun", hideok=True, hidecancel=True ) frmr = UI.FormBox( UI.Select(*recent, name="cmd", id="shell-recent", onclick="shellRecentClick()"), id="frmRecent", hideok=True, hidecancel=True, ) logc = UI.ScrollContainer(log, width=500, height=300) lt = UI.VContainer( UI.HContainer(frm, UI.Button(text="Run", form="frmRun", onclick="form")), UI.HContainer(UI.Label(text="Repeat:"), frmr), ) rp = None if self._process.is_running(): rp = UI.VContainer( UI.HContainer( UI.Image(file="/dl/core/ui/ajax.gif"), UI.Label(text="Running: " + self._process.cmdline, size=2), UI.Refresh(time=3000), ), UI.Button(text="Abort command", id="abort"), ) t = UI.VContainer(lt, rp, logc, spacing=10) return t
def get_default_ui(self): recent = [UI.SelectOption(text=x[0:40] + '...' if len(x) > 40 else x, value=x) for x in self._recent] log = UI.CustomHTML(html=enquote(self._process.output + self._process.errors)) frm = UI.FormBox( UI.TextInput(name='cmd', size=30, id='shell-command'), id='frmRun', hideok=True, hidecancel=True ) frmr = UI.FormBox( UI.Select(*recent, name='cmd', id='shell-recent', onclick='shellRecentClick()'), id='frmRecent', hideok=True, hidecancel=True ) logc = UI.ScrollContainer(log, width=500, height=300) lt = UI.VContainer( UI.HContainer( frm, UI.Button(text='Run', form='frmRun', onclick='form')), UI.HContainer( UI.Label(text='Repeat:'), frmr ) ) t = UI.VContainer(lt, logc, spacing=10) return t
def get_ui(self): ui = self.app.inflate('shell:main') recent = [UI.SelectOption(text=x[0:40] + '...' if len(x) > 40 else x, value=x) for x in self._recent] if self._process is not None and self._process.is_running(): time.sleep(1) if self._process is not None and self._process.is_running(): ui.append('status', UI.Label( text='Process is running. Refresh on will' )) log = UI.CustomHTML(id='logdata', html=enquote(self._process.output + self._process.errors)) ui.append('log', log) ui.appendAll('shell-recent', *recent) return ui