This file is indexed.

/usr/share/treeline/treeline.py is in treeline 1.4.1-1.1.

This file is owned by root:root, with mode 0o755.

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
#! /usr/bin/python

"""
****************************************************************************
 treeline.py, the main program file

 TreeLine, an information storage program
 Copyright (C) 2011, Douglas W. Bell

 This is free software; you can redistribute it and/or modify it under the
 terms of the GNU General Public License, either Version 2 or any later
 version.  This program is distributed in the hope that it will be useful,
 but WITTHOUT ANY WARRANTY.  See the included LICENSE file for details.
*****************************************************************************
"""

__progname__ = 'TreeLine'
__version__ = '1.4.1'
__author__ = 'Doug Bell'

helpFilePath = '/usr/share/doc/treeline'   # modified by install script
iconPath =  '/usr/share/icons/treeline'   # modified by install script
templatePath = '/usr/share/treeline/templates'   # modified by install script
translationPath = 'translations'


import sys
import signal
import getopt
import os.path
import locale
import __builtin__
from PyQt4 import QtCore, QtGui
import globalref


def setModulePath():
    """Set module path in globalref"""
    globalref.modPath = unicode(os.path.abspath(sys.path[0]),
                                sys.getfilesystemencoding())
    if globalref.modPath.endswith('.zip'):  # for py2exe
        globalref.modPath = os.path.dirname(globalref.modPath)

def loadTranslator(fileName, app):
    """Load and install qt translator, return True if sucessful"""
    translator = QtCore.QTranslator(app)
    path = os.path.join(globalref.modPath, translationPath)
    result = translator.load(fileName, path)
    if not result:
        path = os.path.join(globalref.modPath, '..', translationPath)
        result = translator.load(fileName, path)
    if not result:
        path = os.path.join(globalref.modPath, '..', 'i18n', translationPath)
        result = translator.load(fileName, path)
    if result:
        QtCore.QCoreApplication.installTranslator(translator)
        return True
    else:
        print 'Warning: translation file "%s" could not be loaded' % fileName
        return False

def setupTranslator(app):
    """Set language, load translators and setup translator function"""
    try:
        locale.setlocale(locale.LC_ALL, '')
    except locale.Error:
        pass
    globalref.lang = os.environ.get('LC_MESSAGES', '')
    if not globalref.lang:
        globalref.lang = os.environ.get('LANG', '')
        if not globalref.lang:
            try:
                globalref.lang = locale.getdefaultlocale()[0]
            except ValueError:
                pass
            if not globalref.lang:
                globalref.lang = ''
    numTranslators = 0
    if globalref.lang and globalref.lang[:2] not in ['C', 'en']:
        numTranslators += loadTranslator('qt_%s' % globalref.lang, app)
        numTranslators += loadTranslator('treeline_%s' % globalref.lang, app)

    def translate(text, comment=''):
        """Translation function that sets context to calling module's
           filename"""
        try:
            frame = sys._getframe(1)
            fileName = frame.f_code.co_filename
        finally:
            del frame
        context = os.path.basename(os.path.splitext(fileName)[0])
        return unicode(QtCore.QCoreApplication.translate(context, text,
                                                         comment))

    def markNoTranslate(text, comment=''):
        return text

    if numTranslators:
        __builtin__._ = translate
    else:
        __builtin__._ = markNoTranslate
    __builtin__.N_ = markNoTranslate

def setLocalEncoding():
    """Store locale's default text encoding in globalref.localTextEncoding"""
    try:
        # not reliable?
        globalref.localTextEncoding = locale.getpreferredencoding()
        'test'.encode(globalref.localTextEncoding)
    except (AttributeError, LookupError, TypeError, locale.Error):
        try:
            # not available on windows
            globalref.localTextEncoding = locale.nl_langinfo(locale.CODESET)
            'test'.encode(globalref.localTextEncoding)
        except (AttributeError, LookupError, TypeError, locale.Error):
            try:
                globalref.localTextEncoding = locale.getdefaultlocale()[1]
                'test'.encode(globalref.localTextEncoding)
            except (AttributeError, LookupError, TypeError, locale.Error):
                globalref.localTextEncoding = 'utf-8'


def main():
    userStyle = '-style' in ' '.join(sys.argv)
    app = QtGui.QApplication(sys.argv)
    setModulePath()
    setupTranslator(app)  # must be before importing any treeline modules
    setLocalEncoding()

    import treedoc
    from cmdline import CmdLine
    import treecontrol
    import treemainwin

    if not treedoc.testXmlParser():
        QtGui.QMessageBox.critical(None, _('Error'),
                                   _('Error loading XML Parser\n'\
                                     'See TreeLine ReadMe file'), 1, 0)
        sys.exit(3)
    try:
        opts, args = getopt.gnu_getopt(sys.argv, CmdLine.options,
                                       CmdLine.longOptions)
    except getopt.GetoptError:
        import cmdline
        cmdline.printUsage()
        sys.exit(2)
    args = args[1:]

    treeControl = treecontrol.TreeControl(userStyle)

    if opts:
        CmdLine(opts, args)
    else:
        treeControl.firstWindow(args)
        signal.signal(signal.SIGINT, signal.SIG_IGN)
        app.exec_()


if __name__ == '__main__':
    main()