Changeset 5842

Show
Ignore:
Timestamp:
08/20/10 09:06:59 (3 years ago)
Author:
getxsick
Message:

fix #370 : this is for ctrl+c issue

Location:
network-scanner/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • network-scanner/trunk/bin/umit

    r5632 r5842  
    4141from umit.core.Version import VERSION 
    4242from umit.core.Utils import development_mode 
    43  
    4443 
    4544class UmitExceptionHook(object): 
     
    201200 
    202201def main(args): 
    203     # Setting the umit home directory 
    204     from umit.core.Paths import Path 
    205     Path.set_umit_conf(os.path.dirname(args[0])) 
    206     ################################# 
    207     Path.set_running_path(os.path.abspath(os.path.dirname(args[0]))) 
    208  
    209     # Check permissions 
    210     from umit.gui.Utils import verify_config_access 
    211     verify_config_access() 
    212      
    213     from umit.gui.App import App 
    214  
    215     umit_app = App() 
     202    try: 
     203        # Setting the umit home directory 
     204        from umit.core.Paths import Path 
     205        Path.set_umit_conf(os.path.dirname(args[0])) 
     206        ################################# 
     207        Path.set_running_path(os.path.abspath(os.path.dirname(args[0]))) 
     208 
     209        # Check permissions 
     210        from umit.gui.Utils import verify_config_access 
     211        verify_config_access() 
     212         
     213        from umit.gui.App import App 
     214 
     215        umit_app = App() 
     216    except KeyboardInterrupt: 
     217        # there is no need to run safe_shutdown() 
     218        # cause we haven't created App instance yet 
     219        sys.exit(signal.SIGINT) 
    216220 
    217221    if os.name == "posix": 
  • network-scanner/trunk/umit/gui/App.py

    r5632 r5842  
    4747class App: 
    4848    def __init__(self, args=sys.argv): 
     49        self.main_window = None 
    4950        # Initialite the PluginEngine 
    5051        PluginEngine() 
     
    7980        log.debug("SIGNUM: %s" % signum) 
    8081 
    81         try: 
     82        if self.main_window: 
    8283            scans = self.main_window.scan_notebook.get_children() 
    8384            for scan in scans: 
     
    8788                self.main_window.scan_notebook.remove(scan) 
    8889                del(scan) 
    89         except NameError: 
    90             pass 
    9190 
    92         self.main_window._exit_cb() 
     91            self.main_window._exit_cb() 
    9392        sys.exit(signum) 
    9493