~sinzui/gedit-class-browser/buildable

« back to all changes in this revision

Viewing changes to classbrowser/parser_ctags.py

  • Committer: fredericback
  • Date: 2007-11-11 20:34:27 UTC
  • Revision ID: svn-v4:c41c4367-7422-0410-acad-89ad0d30c555:trunk:42
* Added the option to parse all files in a directory. Patch by Alejandro.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    def __init__(self):
38
38
        self.model = None
39
39
        self.document = None
 
40
        self.parse_all_files = False
40
41
 
41
42
 
42
43
    def parse(self, doc):
75
76
        
76
77
        docpath = doc.get_uri_for_display()
77
78
        path, filename = os.path.split(docpath)
78
 
        if filename.find(".") != -1:
79
 
            arg = path + os.sep + filename[:filename.rfind(".")] + ".*"
 
79
        if not self.parse_all_files:
 
80
            if filename.find(".") != -1:
 
81
                arg = path + os.sep + filename[:filename.rfind(".")] + ".*"
 
82
            else:
 
83
                arg = docpath
80
84
        else:
81
 
            arg = docpath
 
85
            arg = path + os.sep + "*.*" 
 
86
            
82
87
            
83
88
        # simply replacing blanks is the best variant because both gnomevfs
84
89
        # and the fs understand it.
216
221
        
217
222
        
218
223
    def get_menu(self, model, path):
219
 
        m = gtk.ImageMenuItem(gtk.STOCK_REFRESH)
220
 
        m.connect("activate", lambda w: self.__parse_doc_to_model() )
221
 
        return [m]
 
224
        m1 = gtk.CheckMenuItem("Parse _All Files")
 
225
        m1.set_active(self.parse_all_files)
 
226
        m1.connect("toggled", lambda w: self.__set_parse_all_files_option(w.get_active()) )
 
227
        m2 = gtk.ImageMenuItem(gtk.STOCK_REFRESH)
 
228
        m2.connect("activate", lambda w: self.__parse_doc_to_model() )
 
229
        return [m1,m2]
 
230
        
 
231
        
 
232
    def __set_parse_all_files_option(self, onoff):
 
233
        self.parse_all_files = onoff
 
234
        self.__parse_doc_to_model()
222
235
        
223
236
        
224
237
    def __get_type(self, tokrow):