Show
Ignore:
Timestamp:
06/17/07 15:55:13 (6 years ago)
Author:
maxim-gavrilov
Message:

very old trunk sync

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branch/max/umitGUI/ScriptManager.py

    r735 r827  
    2222from gtksourceview import SourceView, SourceLanguagesManager, SourceBuffer 
    2323 
    24 #from umitCore.Paths import Search 
    25 Search = None 
     24from umitCore.Paths import check_access 
    2625from umitCore.I18N import _ 
    2726 
     
    4948# aux nmap_fetchfile functions 
    5049# XXX: will be moved into Paths.Search or/and into Python/Nmap wrapper 
     50def get_file_list(path): 
     51        return [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))] 
     52 
    5153class NmapFetch(object): 
    5254    def __init__(self): 
     
    5961        for path in self.fetchdirs(): 
    6062            fullpath = os.path.join(path, filename) 
    61             if Search.check_access(fullpath, os.R_OK): 
     63            if check_access(fullpath, os.R_OK): 
    6264                return fullpath 
    6365        return None 
     
    6769        for path in self.fetchdirs(): 
    6870            try: 
    69                 for filename in Search.get_file_list(path): 
     71                for filename in get_file_list(path): 
    7072                    fullpath = os.path.join(path, filename) 
    71                     if Search.check_access(fullpath, os.R_OK): 
     73                    if check_access(fullpath, os.R_OK): 
    7274                        result.append(fullpath) 
    7375            except OSError: 
     
    189191    def add_dir(self, dirname): 
    190192        res = False 
    191         for name in Search.get_file_list(dirname): 
     193        for name in get_file_list(dirname): 
    192194            if name.endswith('.nse'): 
    193195                try: 
     
    205207 
    206208# Singletone 
    207 #script_manager = ScriptManager() 
     209script_manager = ScriptManager() 
    208210 
    209211# GUI classes 
     
    313315 
    314316    def add_file(self, filename): 
    315         if Search.check_access(filename, os.R_OK): 
     317        if check_access(filename, os.R_OK): 
    316318            try: 
    317319                script_manager.add_file(filename)