/usr/share/gEcrit/data/plugins/TreeFileBrowser.py is in gecrit 2.8.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # Copyright (C) 2011 Groza Cristian
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wx
from data.plugins.categories import General
import yapsy.IPlugin
class TreeFileBrowser(wx.GenericDirCtrl):
def __init__(self, parent):
file_filter ="Python files (.py)|*.py|PythonW files (.pyw)|*.pyw|Ruby files (.rb) |*.rb|Text files (.txt) |*.txt|All files (*.*)|*.*"
self.parent = parent
wx.GenericDirCtrl.__init__(self, self.parent, -1, filter =file_filter,
style =wx.DIRCTRL_SHOW_FILTERS)
def OnItemActivated(self, event):
file_path = self.GetFilePath()
if file_path != "":
self.parent.parent.OpenFile(file_path)
event.Skip()
class TreeFilePanel(wx.Panel, General, yapsy.IPlugin.IPlugin):
def __init__(self):
self.name = "Tree File Browser"
def Init(self, parent):
self.parent = parent
wx.Panel.__init__(self, self.parent.GetSidePanel())
self.main_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.file_browser = TreeFileBrowser(self)
self.file_browser.Bind(wx.EVT_TREE_ITEM_ACTIVATED,
self.file_browser.OnItemActivated)
self.main_sizer.Add(self.file_browser, 1, wx.EXPAND)
self.SetSizer(self.main_sizer)
self.Fit()
self.Layout()
self.parent.AddToSidePanel(self,"File Browser")
def NotifyTabChanged(self):
self.file_browser.ExpandPath(self.parent.GetCurrentDocument().GetFilePath())
def Stop(self):
self.parent.DeleteSidePage("File Browser")
|