Ticket #361: 361_no_pyc.patch

File 361_no_pyc.patch, 1.1 KB (added by erikos, 15 years ago)

Hide pyc files

  • extensions/globalkey/viewsource.py

    diff --git a/extensions/globalkey/viewsource.py b/extensions/globalkey/viewsource.py
    index 86356a7..3ad5498 100644
    a b class FileViewer(gtk.ScrolledWindow): 
    292292    def _add_dir_to_model(self, dir_path, parent=None):
    293293        model = self._tree_view.get_model()
    294294        for f in os.listdir(dir_path):
    295             full_path = os.path.join(dir_path, f)
    296             if os.path.isdir(full_path):
    297                 new_iter = model.append(parent, [f, full_path])
    298                 self._add_dir_to_model(full_path, new_iter)
    299             else:
    300                 model.append(parent, [f, full_path])
     295            if not f.endswith('.pyc'):
     296                full_path = os.path.join(dir_path, f)
     297                if os.path.isdir(full_path):
     298                    new_iter = model.append(parent, [f, full_path])
     299                    self._add_dir_to_model(full_path, new_iter)
     300                else:
     301                    model.append(parent, [f, full_path])
    301302
    302303    def __selection_changed_cb(self, selection):
    303304        model, tree_iter = selection.get_selected()