def __create_widgets(self): # Creating widgets self.scrolled = gtk.ScrolledWindow() self.text_view = gtk.TextView() self.__hbox = HIGVBox() self.__attractor = AttractorWidget() self.__osinfo = gtk.Label() self.__textalign = gtk.Alignment() self.__textalign.add(self.__osinfo) self.__textalign.set_padding(8, 0, 0, 8) self.__frame_attractor = HIGFrameRNet(_('Attractor')) self.__frame_attractor._add(self.__attractor) self.__hbox._pack_noexpand_nofill(self.__frame_attractor) self.__hbox._pack_noexpand_nofill(self.__textalign)
def __create_widgets (self): # Creating widgets self.scrolled = gtk.ScrolledWindow() self.text_view = gtk.TextView() self.__hbox = HIGVBox() self.__attractor = AttractorWidget() self.__osinfo = gtk.Label() self.__textalign = gtk.Alignment() self.__textalign.add(self.__osinfo) self.__textalign.set_padding(8, 0, 0, 8) self.__frame_attractor = HIGFrameRNet(_('Attractor')) self.__frame_attractor._add(self.__attractor) self.__hbox._pack_noexpand_nofill(self.__frame_attractor) self.__hbox._pack_noexpand_nofill(self.__textalign)
class ZionScansPage(HIGHBox): """ """ def __init__(self): """ """ HIGHBox.__init__(self) # Creating widgets self.__create_widgets() # Setting scrolled window self.__set_scrolled_window() # Setting text view self.__set_text_view() # Getting text buffer self.text_buffer = self.text_view.get_buffer() # Adding widgets self.__boxalign = gtk.Alignment() self.__boxalign.set_padding(8, 0, 0, 8) self.__boxalign.add(self.__hbox) self._pack_expand_fill(self.scrolled) self._pack_noexpand_nofill(self.__boxalign) def __create_widgets (self): # Creating widgets self.scrolled = gtk.ScrolledWindow() self.text_view = gtk.TextView() self.__hbox = HIGVBox() self.__attractor = AttractorWidget() self.__osinfo = gtk.Label() self.__textalign = gtk.Alignment() self.__textalign.add(self.__osinfo) self.__textalign.set_padding(8, 0, 0, 8) self.__frame_attractor = HIGFrameRNet(_('Attractor')) self.__frame_attractor._add(self.__attractor) self.__hbox._pack_noexpand_nofill(self.__frame_attractor) self.__hbox._pack_noexpand_nofill(self.__textalign) def __set_scrolled_window(self): # By default the vertical scroller remains at bottom self._scroll_at_bottom = True # Seting scrolled window self.scrolled.set_border_width(5) self.scrolled.add(self.text_view) self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) def __set_text_view(self): self.text_view.set_wrap_mode(gtk.WRAP_WORD) self.text_view.set_editable(False) def write(self, text): """ Write text to output box. """ self.text_buffer.insert(self.text_buffer.get_end_iter(), text) def clean(self): """ Clear all text in output box. """ self.text_buffer.set_text('') self.clear_os_info() self.clear_attractors() def update_attractors(self,attractors): """ Update the attractors at widget to plot them. """ self.__attractor.update(attractors) def clear_attractors(self): """ Clean the attractors ploted in widget """ self.__attractor.update([]) def update_os_info(self, info): """ Update information about OS running on host. """ str = 'Information:\nVendor: %s\nOS: %s %s' % (info['vendor_name'], info['os_name'], info['os_version']) self.__osinfo.set_text(str) def clear_os_info(self): """ Clear information about OS scanned """ self.__osinfo.set_text("") def hide_attractor_box(self): """ Hide the box containing the attractor widget. """ self.remove(self.__boxalign) def show_attractor_box(self): """ Show the box containing the attractor widget. """ self._pack_noexpand_nofill(self.__boxalign) self.show_all()
class ZionScansPage(HIGHBox): """ """ def __init__(self): """ """ HIGHBox.__init__(self) # Creating widgets self.__create_widgets() # Setting scrolled window self.__set_scrolled_window() # Setting text view self.__set_text_view() # Getting text buffer self.text_buffer = self.text_view.get_buffer() # Adding widgets self.__boxalign = gtk.Alignment() self.__boxalign.set_padding(8, 0, 0, 8) self.__boxalign.add(self.__hbox) self._pack_expand_fill(self.scrolled) self._pack_noexpand_nofill(self.__boxalign) def __create_widgets(self): # Creating widgets self.scrolled = gtk.ScrolledWindow() self.text_view = gtk.TextView() self.__hbox = HIGVBox() self.__attractor = AttractorWidget() self.__osinfo = gtk.Label() self.__textalign = gtk.Alignment() self.__textalign.add(self.__osinfo) self.__textalign.set_padding(8, 0, 0, 8) self.__frame_attractor = HIGFrameRNet(_('Attractor')) self.__frame_attractor._add(self.__attractor) self.__hbox._pack_noexpand_nofill(self.__frame_attractor) self.__hbox._pack_noexpand_nofill(self.__textalign) def __set_scrolled_window(self): # By default the vertical scroller remains at bottom self._scroll_at_bottom = True # Seting scrolled window self.scrolled.set_border_width(5) self.scrolled.add(self.text_view) self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) def __set_text_view(self): self.text_view.set_wrap_mode(gtk.WRAP_WORD) self.text_view.set_editable(False) def write(self, text): """ Write text to output box. """ self.text_buffer.insert(self.text_buffer.get_end_iter(), text) def clean(self): """ Clear all text in output box. """ self.text_buffer.set_text('') self.clear_os_info() self.clear_attractors() def update_attractors(self, attractors): """ Update the attractors at widget to plot them. """ self.__attractor.update(attractors) def clear_attractors(self): """ Clean the attractors ploted in widget """ self.__attractor.update([]) def update_os_info(self, info): """ Update information about OS running on host. """ str = 'Information:\nVendor: %s\nOS: %s %s' % ( info['vendor_name'], info['os_name'], info['os_version']) self.__osinfo.set_text(str) def clear_os_info(self): """ Clear information about OS scanned """ self.__osinfo.set_text("") def hide_attractor_box(self): """ Hide the box containing the attractor widget. """ self.remove(self.__boxalign) def show_attractor_box(self): """ Show the box containing the attractor widget. """ self._pack_noexpand_nofill(self.__boxalign) self.show_all()