This file is indexed.

/usr/share/gEcrit/Configuration.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
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#  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
import os
from SyntaxHighlight import *


class Configuration:
    """
    ConfigNanny

    Manages the application configuration manipulation.

    """

    def __init__(self):
        """
        __init__

        Creates a default configuration dictionary and reads the
        configuration file.
        """
        self.__default_cfg_dict = {
            "Autosave": False,
            "Autosave Interval": 15,
            "StatusBar": True,
            "ActLog": True,
            "LineNumbers": False,
            "Font": "Arial",
            "FontSize": "12",
            "SyntaxHighlight": True,
            "IndentSize": 4,
            "Whitespace": False,
            "IndetationGuides": False,
            "Autoindentation": True,
            "BackSpaceUnindent": False,
            "UseTabs": False,
            "CarretWidth": 7,
            "FoldMarks": False,
            "TabWidth": 8,
            "EdgeLine": False,
            "EdgeColumn": 80,
            "RecentFiles":[],
            "BraceComp":False,
            "StripTrails":False,
            "Session" : True,
            "ActivePlugins": ["Task Keeper","Class Hierarchy Tree",
                              "HTML Converter", "Python Syntax Doctor",
                              "Pastebin.com Uploader","PyTidy","Notes",
                              "Terminator"]
            }

        self.update_funct = {
            "Autosave Interval":self.UpdateAutoSaveInterval,
            "StatusBar":        self.UpdateStatusBar,
            "LineNumbers":      self.UpdateLineNumbers,
            "SyntaxHighlight":  self.UpdateSyntaxHighlight,
            "IndentSize":       self.UpdateIndentSize,
            "Whitespace":       self.UpdateWhitespace,
            "IndetationGuides": self.UpdateIndentationGuides,
            "BackSpaceUnindent":self.UpdateBackSpaceUnindent,
            "UseTabs":          self.UpdateUseTabs,
            "CarretWidth":      self.UpdateCarretWidth,
            "FoldMarks":        self.UpdateFoldMarks,
            "TabWidth":         self.UpdateTabWidth,
            "EdgeLine":         self.UpdateEdgeLine,
            "EdgeColumn":       self.UpdateEdgeColumn
        }

        self.HOMEDIR = os.path.expanduser('~')
        self.cfg_path = os.path.join(self.HOMEDIR, ".gEcrit","gEcrit.conf")
        self.cfg_dir = os.path.join(self.HOMEDIR, ".gEcrit")
        self.__cfg_dict = {}

        self.ReadConfig()

    def GetOption(self, option):
        """
        GetOption

        Return the status of the requested option from the
        configuration dictionary.
        If something goes wrong, returns from default.
        """
        return (self.__cfg_dict)[option]

    def ChangeOption(self, option, val, id_range=0):
        """
        ChangeOption

        Modifies the status of the requested option  to the provided
        value.

        Updates the configuration dictionary and writes it to file.
        """
        self.__cfg_dict[option] = val

        with open(self.cfg_path, "w") as new_cfg:
            new_cfg.write(str(self.__cfg_dict))


        if option in self.update_funct:
            self.update_funct[option](val,id_range)

    def ReadConfig(self):
        """
        ReadConfig

        Reads the configuration file and generates a configuration
        dictionary.

        If something goes wrong, returns from default.
        """
        try:
            cfg_file = open(self.cfg_path, "r")
            self.__cfg_dict = eval(cfg_file.read())
            return self.__cfg_dict
        except:
            if not os.path.exists(self.cfg_path): # create the config dir if it is inexistent
                if not os.path.exists(self.cfg_dir):
                    os.mkdir(self.cfg_dir)
            self.__cfg_dict = self.__default_cfg_dict
            cfg_file = open(self.cfg_path, "w") # write default cfg file
            cfg_file.write(str(self.__default_cfg_dict))
            cfg_file.close()
            return self.__cfg_dict


    def UpdateIndentSize(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetIndent(val)

    def UpdateIndentationGuides(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetIndentationGuides(val)

    def UpdateBackSpaceUnindent(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetBackSpaceUnIndents(val)

    def UpdateWhitespace(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetViewWhiteSpace(val)

    def UpdateUseTabs(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetUseTabs(val)

    def UpdateCarretWidth(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetCaretWidth(val)


    def UpdateLineNumbers(self, val, id_range):

        for id in id_range:
            item = wx.FindWindowById(id)
            if val == True:

                item.SetMarginWidth(1, 45)
            else:
                item.SetMarginWidth(1, 1)

    def UpdateFoldMarks(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            if val == True:
                item.SetMarginType(2, wx.stc.STC_MARGIN_SYMBOL)
                item.SetMarginMask(2, wx.stc.STC_MASK_FOLDERS)
                item.SetMarginSensitive(2, True)
                item.SetMarginWidth(2, 12)
            elif val == False:
                item.SetMarginWidth(2, 1)

    def UpdateSyntaxHighlight(self, val, id_range):

        if val == False:
            for id in id_range:
                item = wx.FindWindowById(id)
                item.StyleClearAll()
        elif val == True:
            for id in id_range:
                item = wx.FindWindowById(id)
                item.ActivateSyntaxHighLight()

    def UpdateStatusBar(self, val=True, id_range=0):

        item = wx.FindWindowById(999)
        if val == True:
            item.Show(True)
        else:
            item.Hide()

    def UpdateTabWidth(self, val, id_range):

        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetTabWidth(val)

    def UpdateEdgeLine(self, val, id_range):
        if val == False:
            for id in id_range:
                item = wx.FindWindowById(id)
                item.SetEdgeMode(wx.stc.STC_EDGE_NONE)
        else:
            for id in id_range:
                item = wx.FindWindowById(id)
                item.SetEdgeMode(wx.stc.STC_EDGE_LINE)

    def UpdateEdgeColumn(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.SetEdgeColumn(val)

    def UpdateAutoSaveInterval(self, val, id_range):
        for id in id_range:
            item = wx.FindWindowById(id)
            item.RestartAutoSaveTimer()

    def GetTab(self, tab_name, notebook):
        """
        GetTab

        Retrieves a AUI NOTEBOOK tab index from a given name.
        """
        end = notebook.GetPageCount()
        selectedtabText = ""

        for i in range(end):
            selectedtabText = notebook.GetPageText(i)

            if tab_name == selectedtabText:
                return i
                None

        return -1
        None


Config = Configuration()