def __init__(self, loglines, logfilename, parent='osd', text=None, handler=None, left=None, top=None, width=600, height=300, bg_color=None, fg_color=None, icon=None, border=None, bd_color=None, bd_width=None, vertical_expansion=1): if not text: text = _('Command finished') PopupBox.__init__(self, text, handler, top, left, width, height, icon, vertical_expansion, None, parent) items_height = 40 self.loglines = loglines self.logfilename = logfilename self.num_shown_items = 2 self.results = ListBox(width=(self.width-2*self.h_margin), height=self.num_shown_items*items_height, show_v_scrollbar=0) self.results.y_scroll_interval = self.results.items_height = items_height self.add_child(self.results) self.results.add_item(text=_('OK'), value='ok') if loglines or logfilename: self.results.add_item(text=_('Show output'), value='out') self.results.toggle_selected_index(0)
def __init__(self, parent='osd', text=None, handler=None, left=None, top=None, width=600, height=300, bg_color=None, fg_color=None, icon=None, border=None, bd_color=None, bd_width=None, vertical_expansion=1): if not text: text = _('Command finished') #PopupBox.__init__(self, text, handler=handler, x=top, y=left, width=width, height=height) PopupBox.__init__(self, text, handler, top, left, width, height, icon, vertical_expansion, None, parent) items_height = 40 self.num_shown_items = 3 self.results = ListBox(width=(self.width - 2 * self.h_margin), height=self.num_shown_items * items_height, show_v_scrollbar=0) self.results.y_scroll_interval = self.results.items_height = items_height self.add_child(self.results) self.results.add_item(text=_('OK'), value='ok') if islog('err'): self.results.add_item(text=_('Show Stderr'), value='err') if islog('out'): self.results.add_item(text=_('Show Stdout'), value='out') self.results.toggle_selected_index(0)
class CommandOptions(PopupBox): """ Show the command results """ def __init__(self, loglines, logfilename, parent='osd', text=None, handler=None, left=None, top=None, width=600, height=300, bg_color=None, fg_color=None, icon=None, border=None, bd_color=None, bd_width=None, vertical_expansion=1): if not text: text = _('Command finished') PopupBox.__init__(self, text, handler, top, left, width, height, icon, vertical_expansion, None, parent) items_height = 40 self.loglines = loglines self.logfilename = logfilename self.num_shown_items = 2 self.results = ListBox(width=(self.width-2*self.h_margin), height=self.num_shown_items*items_height, show_v_scrollbar=0) self.results.y_scroll_interval = self.results.items_height = items_height self.add_child(self.results) self.results.add_item(text=_('OK'), value='ok') if loglines or logfilename: self.results.add_item(text=_('Show output'), value='out') self.results.toggle_selected_index(0) def eventhandler(self, event, menuw=None): """ eventhandler to browse the result popup """ if event in (INPUT_UP, INPUT_DOWN, INPUT_LEFT, INPUT_RIGHT): return self.results.eventhandler(event) elif event == INPUT_ENTER: selection = self.results.get_selected_item().value #print selection if selection == 'ok': self.destroy() elif selection == 'out': LogScroll(self.loglines, self.logfilename, text=_('Output')).show() return elif event == INPUT_EXIT: self.destroy() else: return self.parent.eventhandler(event)
class CommandOptions(PopupBox): """ Show the command results """ def __init__(self, parent='osd', text=None, handler=None, left=None, top=None, width=600, height=300, bg_color=None, fg_color=None, icon=None, border=None, bd_color=None, bd_width=None, vertical_expansion=1): if not text: text = _('Command finished') #PopupBox.__init__(self, text, handler=handler, x=top, y=left, width=width, height=height) PopupBox.__init__(self, text, handler, top, left, width, height, icon, vertical_expansion, None, parent) items_height = 40 self.num_shown_items = 3 self.results = ListBox(width=(self.width - 2 * self.h_margin), height=self.num_shown_items * items_height, show_v_scrollbar=0) self.results.y_scroll_interval = self.results.items_height = items_height self.add_child(self.results) self.results.add_item(text=_('OK'), value='ok') if islog('err'): self.results.add_item(text=_('Show Stderr'), value='err') if islog('out'): self.results.add_item(text=_('Show Stdout'), value='out') self.results.toggle_selected_index(0) def eventhandler(self, event, menuw=None): """ eventhandler to browse the result popup """ if event in (INPUT_UP, INPUT_DOWN, INPUT_LEFT, INPUT_RIGHT): return self.results.eventhandler(event) elif event == INPUT_ENTER: selection = self.results.get_selected_item().value #print selection if selection == 'ok': self.destroy() elif selection == 'out': LogScroll(os.path.join(config.FREEVO_LOGDIR, 'command-stdout.log'), text=_('Stdout File')).show() return elif selection == 'err': LogScroll(os.path.join(config.FREEVO_LOGDIR, 'command-stderr.log'), text=_('Stderr File')).show() return elif event == INPUT_EXIT: self.destroy() else: return self.parent.eventhandler(event)