This file is indexed.

/usr/share/pyshared/ninja_ide/resources.py is in ninja-ide 2.3-2.

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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NINJA-IDE 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 NINJA-IDE; If not, see <http://www.gnu.org/licenses/>.

from PyQt4.QtGui import QKeySequence
from PyQt4.QtCore import QDir
from PyQt4.QtCore import QSettings
from PyQt4.QtCore import Qt

import os
import sys


###############################################################################
# PATHS
###############################################################################

HOME_PATH = QDir.toNativeSeparators(QDir.homePath())

NINJA_EXECUTABLE = os.path.realpath(sys.argv[0])

PRJ_PATH = os.path.abspath(os.path.dirname(__file__)).decode('utf-8')
#Only for py2exe
frozen = getattr(sys, 'frozen', '')
if frozen in ('dll', 'console_exe', 'windows_exe'):
    # py2exe:
    PRJ_PATH = os.path.abspath(os.path.dirname(sys.executable))
DATA_DIR = "/usr/share/ninja-ide"

HOME_NINJA_PATH = os.path.join(HOME_PATH, ".ninja_ide")

SETTINGS_PATH = os.path.join(HOME_NINJA_PATH, 'settings.ini')

ADDINS = os.path.join(HOME_NINJA_PATH, "addins")

SYNTAX_FILES = os.path.join(DATA_DIR, "addins", "syntax")

PLUGINS = os.path.join(HOME_NINJA_PATH, "addins", "plugins")

PLUGINS_DESCRIPTOR = os.path.join(HOME_NINJA_PATH, "addins",
                                  "plugins", "descriptor.json")

LANGS = os.path.join(DATA_DIR, "addins", "lang")

LANGS_DOWNLOAD = os.path.join(HOME_NINJA_PATH, "addins", "languages")

EDITOR_SKINS = os.path.join(HOME_NINJA_PATH, "addins", "schemes")

NINJA_THEME = os.path.join(DATA_DIR, "addins", "theme", "ninja_dark.qss")

NINJA__THEME_CLASSIC = os.path.join(
    DATA_DIR, "addins", "theme", "ninja_theme.qss")

NINJA_THEME_DOWNLOAD = os.path.join(HOME_NINJA_PATH, "addins", "theme")

LOG_FILE_PATH = os.path.join(HOME_NINJA_PATH, 'ninja_ide.log')

GET_SYSTEM_PATH = os.path.join(PRJ_PATH, 'tools', 'get_system_path.py')

QML_FILES = os.path.join(DATA_DIR, "addins", "qml")

###############################################################################
# URLS
###############################################################################

BUGS_PAGE = "https://github.com/ninja-ide/ninja-ide/issues"

PLUGINS_DOC = "http://ninja-ide.readthedocs.org/en/latest/"

UPDATES_URL = 'http://ninja-ide.org/updates'

SCHEMES_URL = 'http://ninja-ide.org/schemes/api/'

LANGUAGES_URL = 'http://ninja-ide.org/plugins/languages'

PLUGINS_WEB = 'http://ninja-ide.org/plugins/api/official'

PLUGINS_COMMUNITY = 'http://ninja-ide.org/plugins/api/community'


###############################################################################
# IMAGES
###############################################################################

IMAGES = {
    "splash": os.path.join(DATA_DIR, "img", "splash.png"),
    "icon": os.path.join(DATA_DIR, "img", "icon.png"),
    "iconUpdate": os.path.join(DATA_DIR, "img", "icon.png"),
    "new": os.path.join(DATA_DIR, "img", "document-new.png"),
    "newProj": os.path.join(DATA_DIR, "img", "project-new.png"),
    "open": os.path.join(DATA_DIR, "img", "document-open.png"),
    "openProj": os.path.join(DATA_DIR, "img", "project-open.png"),
    "openFolder": os.path.join(DATA_DIR, "img", "folder-open.png"),
    "save": os.path.join(DATA_DIR, "img", "document-save.png"),
    "saveAs": os.path.join(DATA_DIR, "img", "document-save-as.png"),
    "saveAll": os.path.join(DATA_DIR, "img", "document-save-all.png"),
    "activate-profile": os.path.join(DATA_DIR, "img", "activate_profile.png"),
    "deactivate-profile": os.path.join(DATA_DIR, "img",
                                       "deactivate_profile.png"),
    "copy": os.path.join(DATA_DIR, "img", "edit-copy.png"),
    "cut": os.path.join(DATA_DIR, "img", "edit-cut.png"),
    "paste": os.path.join(DATA_DIR, "img", "edit-paste.png"),
    "redo": os.path.join(DATA_DIR, "img", "edit-redo.png"),
    "undo": os.path.join(DATA_DIR, "img", "edit-undo.png"),
    "exit": os.path.join(DATA_DIR, "img", "exit.png"),
    "find": os.path.join(DATA_DIR, "img", "find.png"),
    "findReplace": os.path.join(DATA_DIR, "img", "find-replace.png"),
    "locator": os.path.join(DATA_DIR, "img", "locator.png"),
    "play": os.path.join(DATA_DIR, "img", "play.png"),
    "stop": os.path.join(DATA_DIR, "img", "stop.png"),
    "file-run": os.path.join(DATA_DIR, "img", "file-run.png"),
    "preview-web": os.path.join(DATA_DIR, "img", "preview_web.png"),
    "debug": os.path.join(DATA_DIR, "img", "debug.png"),
    "designer": os.path.join(DATA_DIR, "img", "qtdesigner.png"),
    "bug": os.path.join(DATA_DIR, "img", "bug.png"),
    "function": os.path.join(DATA_DIR, "img", "function.png"),
    "module": os.path.join(DATA_DIR, "img", "module.png"),
    "class": os.path.join(DATA_DIR, "img", "class.png"),
    "attribute": os.path.join(DATA_DIR, "img", "attribute.png"),
    "web": os.path.join(DATA_DIR, "img", "web.png"),
    "fullscreen": os.path.join(DATA_DIR, "img", "fullscreen.png"),
    "follow": os.path.join(DATA_DIR, "img", "follow.png"),
    "splitH": os.path.join(DATA_DIR, "img", "split-horizontal.png"),
    "splitV": os.path.join(DATA_DIR, "img", "split-vertical.png"),
    "zoom-in": os.path.join(DATA_DIR, "img", "zoom_in.png"),
    "zoom-out": os.path.join(DATA_DIR, "img", "zoom_out.png"),
    "splitCPosition": os.path.join(DATA_DIR, "img",
                                   "panels-change-position.png"),
    "splitMPosition": os.path.join(DATA_DIR, "img",
                                   "panels-change-vertical-position.png"),
    "splitCRotate": os.path.join(DATA_DIR, "img",
                                 "panels-change-orientation.png"),
    "indent-less": os.path.join(DATA_DIR, "img", "indent-less.png"),
    "indent-more": os.path.join(DATA_DIR, "img", "indent-more.png"),
    "go-to-definition": os.path.join(DATA_DIR, "img", "go_to_definition.png"),
    "insert-import": os.path.join(DATA_DIR, "img", "insert_import.png"),
    "console": os.path.join(DATA_DIR, "img", "console.png"),
    "pref": os.path.join(DATA_DIR, "img", "preferences-system.png"),
    "tree-app": os.path.join(DATA_DIR, "img", "tree-app.png"),
    "tree-code": os.path.join(DATA_DIR, "img", "tree-code.png"),
    "tree-folder": os.path.join(DATA_DIR, "img", "tree-folder.png"),
    "tree-html": os.path.join(DATA_DIR, "img", "tree-html.png"),
    "tree-generic": os.path.join(DATA_DIR, "img", "tree-generic.png"),
    "tree-css": os.path.join(DATA_DIR, "img", "tree-CSS.png"),
    "tree-python": os.path.join(DATA_DIR, "img", "tree-python.png"),
    "tree-image": os.path.join(DATA_DIR, "img", "tree-image.png"),
    "comment-code": os.path.join(DATA_DIR, "img", "comment-code.png"),
    "uncomment-code": os.path.join(DATA_DIR, "img", "uncomment-code.png"),
    "reload-file": os.path.join(DATA_DIR, "img", "reload-file.png"),
    "print": os.path.join(DATA_DIR, "img", "document-print.png"),
    "book-left": os.path.join(DATA_DIR, "img", "book-left.png"),
    "book-right": os.path.join(DATA_DIR, "img", "book-right.png"),
    "break-left": os.path.join(DATA_DIR, "img", "break-left.png"),
    "break-right": os.path.join(DATA_DIR, "img", "break-right.png"),
    "nav-code-left": os.path.join(DATA_DIR, "img", "nav-code-left.png"),
    "nav-code-right": os.path.join(DATA_DIR, "img", "nav-code-right.png"),
    "locate-file": os.path.join(DATA_DIR, "img", "locate-file.png"),
    "locate-class": os.path.join(DATA_DIR, "img", "locate-class.png"),
    "locate-function": os.path.join(DATA_DIR, "img", "locate-function.png"),
    "locate-attributes": os.path.join(DATA_DIR, "img",
                                      "locate-attributes.png"),
    "locate-nonpython": os.path.join(DATA_DIR, "img", "locate-nonpython.png"),
    "locate-on-this-file": os.path.join(DATA_DIR, "img",
                                        "locate-on-this-file.png"),
    "locate-tab": os.path.join(DATA_DIR, "img", "locate-tab.png"),
    "locate-line": os.path.join(DATA_DIR, "img", "locate-line.png"),
    "add": os.path.join(DATA_DIR, "img", "add.png"),
    "delete": os.path.join(DATA_DIR, "img", "delete.png"),
    "loading": os.path.join(DATA_DIR, "img", "loading.gif"),
    "separator": os.path.join(DATA_DIR, "img", "separator.png")}


###############################################################################
# COLOR SCHEMES
###############################################################################

COLOR_SCHEME = {
    "keyword": "#6EC7D7",
    "operator": "#FFFFFF",
    "brace": "#FFFFFF",
    "definition": "#F6EC2A",
    "string": "#B369BF",
    "string2": "#86d986",
    "comment": "#80FF80",
    "properObject": "#6EC7D7",
    "numbers": "#F8A008",
    "spaces": "#7b7b7b",
    "extras": "#ee8859",
    "editor-background": "#1E1E1E",
    "editor-selection-color": "#FFFFFF",
    "editor-selection-background": "#437DCD",
    "editor-text": "#B3BFA7",
    "current-line": "#858585",
    "selected-word": "red",
    "pending": "red",
    "selected-word-background": "#009B00",
    "fold-area": "#FFFFFF",
    "fold-arrow": "#454545",
    "linkNavigate": "orange",
    "brace-background": "#5BC85B",
    "brace-foreground": "red",
    "error-underline": "red",
    "pep8-underline": "yellow",
    "sidebar-background": "#c4c4c4",
    "sidebar-foreground": "black",
    "locator-name": "white",
    "locator-name-selected": "black",
    "locator-path": "gray",
    "locator-path-selected": "white",
    "migration-underline": "blue",
    "current-line-opacity": 20,
    "error-background-opacity": 60,
}

CUSTOM_SCHEME = {}


###############################################################################
# SHORTCUTS
###############################################################################

#default shortcuts
SHORTCUTS = {
    "Duplicate": QKeySequence(Qt.CTRL + Qt.Key_R),  # Replicate
    "Remove-line": QKeySequence(Qt.CTRL + Qt.Key_E),  # Eliminate
    "Move-up": QKeySequence(Qt.ALT + Qt.Key_Up),
    "Move-down": QKeySequence(Qt.ALT + Qt.Key_Down),
    "Close-tab": QKeySequence(Qt.CTRL + Qt.Key_W),
    "New-file": QKeySequence(Qt.CTRL + Qt.Key_N),
    "New-project": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_N),
    "Open-file": QKeySequence(Qt.CTRL + Qt.Key_O),
    "Open-project": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_O),
    "Save-file": QKeySequence(Qt.CTRL + Qt.Key_S),
    "Save-project": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_S),
    "Print-file": QKeySequence(Qt.CTRL + Qt.Key_P),
    "Redo": QKeySequence(Qt.CTRL + Qt.Key_Y),
    "Comment": QKeySequence(Qt.CTRL + Qt.Key_D),
    "Uncomment": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_D),
    "Horizontal-line": QKeySequence(),
    "Title-comment": QKeySequence(),
    "Indent-less": QKeySequence(Qt.SHIFT + Qt.Key_Tab),
    "Hide-misc": QKeySequence(Qt.Key_F4),
    "Hide-editor": QKeySequence(Qt.Key_F3),
    "Hide-explorer": QKeySequence(Qt.Key_F2),
    "Run-file": QKeySequence(Qt.CTRL + Qt.Key_F6),
    "Run-project": QKeySequence(Qt.Key_F6),
    "Debug": QKeySequence(Qt.Key_F7),
    "Switch-Focus": QKeySequence(Qt.CTRL + Qt.Key_QuoteLeft),
    "Stop-execution": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_F6),
    "Hide-all": QKeySequence(Qt.Key_F11),
    "Full-screen": QKeySequence(Qt.CTRL + Qt.Key_F11),
    "Find": QKeySequence(Qt.CTRL + Qt.Key_F),
    "Find-replace": QKeySequence(Qt.CTRL + Qt.Key_H),
    "Find-with-word": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_F),
    "Find-next": QKeySequence(Qt.CTRL + Qt.Key_F3),
    "Find-previous": QKeySequence(Qt.SHIFT + Qt.Key_F3),
    "Help": QKeySequence(Qt.Key_F1),
    "Split-horizontal": QKeySequence(Qt.Key_F9),
    "Split-vertical": QKeySequence(Qt.Key_F10),
    "Follow-mode": QKeySequence(Qt.CTRL + Qt.Key_F10),
    "Reload-file": QKeySequence(Qt.Key_F5),
    "Find-in-files": QKeySequence(Qt.CTRL + Qt.Key_L),
    "Import": QKeySequence(Qt.CTRL + Qt.Key_I),
    "Go-to-definition": QKeySequence(Qt.CTRL + Qt.Key_Return),
    "Complete-Declarations": QKeySequence(Qt.ALT + Qt.Key_Return),
    "Code-locator": QKeySequence(Qt.CTRL + Qt.Key_K),
    "File-Opener": QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_O),
    "Navigate-back": QKeySequence(Qt.ALT + Qt.Key_Left),
    "Navigate-forward": QKeySequence(Qt.ALT + Qt.Key_Right),
    "Open-recent-closed": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_T),
    "Change-Tab": QKeySequence(Qt.CTRL + Qt.Key_PageDown),
    "Change-Tab-Reverse": QKeySequence(Qt.CTRL + Qt.Key_PageUp),
    "Move-Tab-to-right": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_0),
    "Move-Tab-to-left": QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_9),
    "Show-Code-Nav": QKeySequence(Qt.CTRL + Qt.Key_1),
    "Show-Paste-History": QKeySequence(Qt.CTRL + Qt.Key_4),
    "History-Copy": QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_C),
    "History-Paste": QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_V),
    "Add-Bookmark-or-Breakpoint": QKeySequence(Qt.CTRL + Qt.Key_B),
    "change-split-focus": QKeySequence(Qt.CTRL + Qt.Key_Tab),
    "move-tab-to-next-split": QKeySequence(Qt.SHIFT + Qt.Key_F10),
    "change-tab-visibility": QKeySequence(Qt.SHIFT + Qt.Key_F1),
    "Highlight-Word": QKeySequence(Qt.CTRL + Qt.Key_Down)}

CUSTOM_SHORTCUTS = {}

###############################################################################
# FUNCTIONS
###############################################################################


def load_shortcuts():
    """
    Loads the shortcuts from QSettings
    """
    global SHORTCUTS
    global CUSTOM_SHORTCUTS
    settings = QSettings(SETTINGS_PATH, QSettings.IniFormat)
    for action in SHORTCUTS:
        #default shortcut
        default_action = SHORTCUTS[action].toString()
        #get the custom shortcut or the default
        shortcut_action = settings.value("shortcuts/%s" % action,
                                         default_action)
        #set the shortcut
        CUSTOM_SHORTCUTS[action] = QKeySequence(shortcut_action)


def get_shortcut(shortcut_name):
    """
    Returns the shortcut looking into CUSTOM_SHORTCUTS and
    SHORTCUTS
    """
    global SHORTCUTS
    global CUSTOM_SHORTCUTS
    return CUSTOM_SHORTCUTS.get(shortcut_name, SHORTCUTS.get(shortcut_name))


def clean_custom_shortcuts():
    """
    Cleans CUSTOMS_SHORTCUTS
    """
    global CUSTOM_SHORTCUTS
    CUSTOM_SHORTCUTS = {}


def create_home_dir_structure():
    """
    Create the necesary directories structure for NINJA-IDE
    """
    for d in (HOME_NINJA_PATH, ADDINS, PLUGINS, EDITOR_SKINS,
              LANGS_DOWNLOAD, NINJA_THEME_DOWNLOAD):
        if not os.path.isdir(d):
            os.mkdir(d)