Changeset 3126

Show
Ignore:
Timestamp:
07/10/08 14:55:01 (5 years ago)
Author:
nopper
Message:

Making more exotic blah

Location:
branch/UmitPlugins/source-plugins
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branch/UmitPlugins/source-plugins/context-menu/sources/main.py

    r3095 r3126  
    2525from umitPlugin.Engine import Plugin 
    2626from higwidgets.higanimates import HIGAnimatedBar 
     27from umitGUI.ScanNotebook import ScanNotebookPage, ScanResult 
     28 
     29class MyWidget(HIGAnimatedBar): 
     30    pass 
    2731 
    2832class MenuPlugin(Plugin): 
     
    3236        self.id = Core().connect('ScanHostsView-created', self.__on_created_hosts) 
    3337 
     38        for page in Core().get_main_scan_notebook(): 
     39            if isinstance(page, ScanNotebookPage): 
     40                self.__on_created_hosts( \ 
     41                    Core(), page.scan_result.scan_host_view) 
     42 
    3443    def stop(self): 
    3544        Core().disconnect(self.id) 
    3645 
     46        for page in Core().get_main_scan_notebook(): 
     47            if not isinstance(page, ScanNotebookPage): 
     48                continue 
     49 
     50            for child in page.scan_result.scan_host_view: 
     51                if isinstance(child, MyWidget): 
     52                    page.scan_result.scan_host_view.remove(child) 
     53                    child.hide() 
     54                    child.destroy() 
     55 
    3756    def __on_created_hosts(self, core, view): 
    38         widget = HIGAnimatedBar('<tt>I\'m here spying your hosts</tt>') 
     57        widget = MyWidget('<tt>I\'m here spying your hosts</tt>') 
    3958        widget.show() 
    4059        view.pack_start(widget, False, False) 
  • branch/UmitPlugins/source-plugins/flow-analyzer/sources/main.py

    r3095 r3126  
    2525from umitPlugin.Engine import Plugin 
    2626from higwidgets.higanimates import HIGAnimatedBar 
     27from umitGUI.ScanNotebook import ScanNotebookPage 
    2728 
    2829class FlowContainer(gtk.VBox): 
     
    4445        paned.pack1(scroll(self.text1)) 
    4546        paned.pack2(scroll(self.text2)) 
     47 
     48        message = "Not yet avaiable. Try to start a scan!" 
     49 
     50        self.text1.get_buffer().set_text(message) 
     51        self.text2.get_buffer().set_text(message) 
    4652         
    4753        self.pack_start(paned) 
     
    5056    def update(self, page): 
    5157        # Simple set the xml and normal output to textviews 
    52         f = open(page.command_execution.get_xml_output_file(), "r") 
    53         txt = "".join(f.readlines()) 
    54          
    55         self.text1.get_buffer().set_text(txt) 
    56          
    57         f = open(page.command_execution.get_output_file(), "r") 
    58         txt = "".join(f.readlines()) 
    59          
    60         self.text2.get_buffer().set_text(txt) 
    61          
     58 
     59        if hasattr(page, 'command_execution') and page.command_execution: 
     60            f = open(page.command_execution.get_xml_output_file(), "r") 
     61            txt = "".join(f.readlines()) 
     62             
     63            self.text1.get_buffer().set_text(txt) 
     64             
     65            f = open(page.command_execution.get_output_file(), "r") 
     66            txt = "".join(f.readlines()) 
     67             
     68            self.text2.get_buffer().set_text(txt) 
    6269 
    6370class FlowPlugin(Plugin): 
     
    6572        self.id = Core().connect('ScanNotebookPage-created', self.__on_created) 
    6673 
     74        for page in Core().get_main_scan_notebook(): 
     75            if isinstance(page, ScanNotebookPage): 
     76                self.__on_created(Core(), page) 
     77                page.emit('scan-finished') 
     78 
    6779    def stop(self): 
    6880        Core().disconnect(self.id) 
     81 
     82        for page in Core().get_main_scan_notebook(): 
     83            if not isinstance(page, ScanNotebookPage): 
     84                continue 
     85 
     86            for child in page.scan_result.scan_result_notebook: 
     87                if not isinstance(child, FlowContainer): 
     88                    continue 
     89 
     90                idx = page.scan_result.scan_result_notebook.page_num(child) 
     91                page.scan_result.scan_result_notebook.remove_page(idx) 
     92 
     93                child.hide() 
     94                child.destroy() 
    6995 
    7096    def __on_created(self, core, page):