Changeset 4452
- Timestamp:
- 04/05/09 20:34:19 (4 years ago)
- Files:
-
- 1 modified
-
trunk/umit/gui/NmapOutputViewer.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/umit/gui/NmapOutputViewer.py
r4299 r4452 30 30 31 31 from higwidgets.higbuttons import HIGButton 32 from higwidgets.higboxes import HIGVBox 32 33 33 34 from umit.core.I18N import _, enc … … 37 38 from umit.gui.NmapOutputProperties import NmapOutputProperties 38 39 39 class NmapOutputViewer ( gtk.VPaned):40 class NmapOutputViewer (HIGVBox): 40 41 def __init__ (self, refresh=1, stop=1): 41 42 self.nmap_highlight = NmapOutputHighlight() 42 gtk.VPaned.__init__ (self)43 HIGVBox.__init__ (self) 43 44 44 45 # Creating widgets … … 61 62 62 63 # Adding widgets to the VPaned 63 self. pack1(self.scrolled, resize=True, shrink=True)64 self. pack2(self.hbox_buttons, resize=True, shrink=False)64 self._pack_expand_fill(self.scrolled) 65 self._pack_noexpand_nofill(self.hbox_buttons) 65 66 66 67 self.nmap_output_file = None … … 76 77 77 78 self.__create_tags() 78 79 80 79 81 def __create_tags(self): 80 82 tag_table = self.text_buffer.get_tag_table() … … 398 400 399 401 if self.nmap_previous_output != new_output: 402 403 # See if scroll is at the end (must be done before text_buffer 404 # changes 405 scroll_flag = False 406 407 scroll_upper = self.scrolled.get_vadjustment().upper 408 scroll_size = self.scrolled.get_vadjustment().page_size 409 scroll_end = scroll_upper - scroll_size 410 scroll_current = self.scrolled.get_vadjustment().get_value() 411 412 scroll_flag = (scroll_end == scroll_current) 413 400 414 # Setting text and moving mark to the start 401 415 # to update_colors correctly … … 403 417 404 418 self.nmap_previous_output = new_output 419 420 self.text_buffer.move_mark(self.mark, 421 self.text_buffer.get_start_iter()) 422 self.update_output_colors() 423 424 # Do all pending events (otherwise the adjustment don't 425 # work correctly sometimes) 426 while (gtk.events_pending()): 427 gtk.main_iteration() 428 429 # Auto-scroll if scroll was at end 430 if scroll_flag: 431 432 # Get and apply the new scrolled vadjustment value 433 scroll_new_upper = self.scrolled.get_vadjustment().upper 434 scroll_new_size = self.scrolled.get_vadjustment().page_size 435 scroll_new_end = scroll_new_upper - scroll_new_size 436 437 self.scrolled.get_vadjustment().set_value(scroll_new_end) 438 439 else: 440 self.scrolled.get_vadjustment().set_value(scroll_current) 405 441 406 442 nmap_of.close() 407 408 self.text_buffer.move_mark(self.mark, self.text_buffer.get_start_iter()) 409 self.update_output_colors() 410 443 444 411 445 if __name__ == '__main__': 412 446 w = gtk.Window()
