/usr/share/pyshared/ninja_ide/gui/menus/menu_source.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 | # -*- 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 __future__ import absolute_import
from PyQt4.QtGui import QIcon
from PyQt4.QtGui import QKeySequence
from PyQt4.QtCore import SIGNAL
from PyQt4.QtCore import QObject
from PyQt4.QtCore import Qt
from ninja_ide import resources
from ninja_ide.core import settings
from ninja_ide.gui import actions
class MenuSource(QObject):
def __init__(self, menuSource):
QObject.__init__(self)
indentMoreAction = menuSource.addAction(
QIcon(resources.IMAGES['indent-more']),
(self.trUtf8("Indent More (%s)") %
QKeySequence(Qt.Key_Tab).toString(QKeySequence.NativeText)))
indentLessAction = menuSource.addAction(
QIcon(resources.IMAGES['indent-less']),
(self.trUtf8("Indent Less (%s)") %
resources.get_shortcut("Indent-less").toString(
QKeySequence.NativeText)))
menuSource.addSeparator()
commentAction = menuSource.addAction(
QIcon(resources.IMAGES['comment-code']),
(self.trUtf8("Comment (%s)") %
resources.get_shortcut("Comment").toString(
QKeySequence.NativeText)))
unCommentAction = menuSource.addAction(
QIcon(resources.IMAGES['uncomment-code']),
(self.trUtf8("Uncomment (%s)") %
resources.get_shortcut("Uncomment").toString(
QKeySequence.NativeText)))
horizontalLineAction = menuSource.addAction(
(self.trUtf8("Insert Horizontal Line (%s)") %
resources.get_shortcut("Horizontal-line").toString(
QKeySequence.NativeText)))
titleCommentAction = menuSource.addAction(
(self.trUtf8("Insert Title Comment (%s)") %
resources.get_shortcut("Title-comment").toString(
QKeySequence.NativeText)))
countCodeLinesAction = menuSource.addAction(
self.trUtf8("Count Code Lines"))
menuSource.addSeparator()
# tellTaleAction = menuSource.addAction(
# self.trUtf8("Tell me a Tale of Code"))
# tellTaleAction.setEnabled(False)
goToDefinitionAction = menuSource.addAction(
QIcon(resources.IMAGES['go-to-definition']),
(self.trUtf8("Go To Definition (%s or %s+Click)") %
(resources.get_shortcut("Go-to-definition").toString(
QKeySequence.NativeText),
settings.OS_KEY)))
insertImport = menuSource.addAction(
QIcon(resources.IMAGES['insert-import']),
(self.trUtf8("Insert &Import (%s)") %
resources.get_shortcut("Import").toString(
QKeySequence.NativeText)))
menu_debugging = menuSource.addMenu(self.trUtf8("Debugging Tricks"))
insertPrints = menu_debugging.addAction(
self.trUtf8("Insert Prints per selected line."))
insertPdb = menu_debugging.addAction(
self.trUtf8("Insert pdb.set_trace()"))
# organizeImportsAction = menuSource.addAction(
# self.trUtf8("&Organize Imports"))
# removeUnusedImportsAction = menuSource.addAction(
# self.trUtf8("Remove Unused &Imports"))
# extractMethodAction = menuSource.addAction(
# self.trUtf8("Extract selected &code as Method"))
menuSource.addSeparator()
removeTrailingSpaces = menuSource.addAction(
self.trUtf8("&Remove Trailing Spaces"))
replaceTabsSpaces = menuSource.addAction(
self.trUtf8("Replace Tabs With &Spaces"))
moveUp = menuSource.addAction((self.trUtf8("Move &Up (%s)") %
resources.get_shortcut("Move-up").toString(
QKeySequence.NativeText)))
moveDown = menuSource.addAction((self.trUtf8("Move &Down (%s)") %
resources.get_shortcut("Move-down").toString(
QKeySequence.NativeText)))
duplicate = menuSource.addAction(
(self.trUtf8("Duplica&te (%s)") %
resources.get_shortcut("Duplicate").toString(
QKeySequence.NativeText)))
remove = menuSource.addAction(
(self.trUtf8("&Remove Line (%s)") %
resources.get_shortcut("Remove-line").toString(
QKeySequence.NativeText)))
self.toolbar_items = {
'indent-more': indentMoreAction,
'indent-less': indentLessAction,
'comment': commentAction,
'uncomment': unCommentAction,
'go-to-definition': goToDefinitionAction,
'insert-import': insertImport}
self.connect(goToDefinitionAction, SIGNAL("triggered()"),
actions.Actions().editor_go_to_definition)
self.connect(countCodeLinesAction, SIGNAL("triggered()"),
actions.Actions().count_file_code_lines)
self.connect(insertImport, SIGNAL("triggered()"),
actions.Actions().import_from_everywhere)
self.connect(indentMoreAction, SIGNAL("triggered()"),
actions.Actions().editor_indent_more)
self.connect(indentLessAction, SIGNAL("triggered()"),
actions.Actions().editor_indent_less)
self.connect(commentAction, SIGNAL("triggered()"),
actions.Actions().editor_comment)
self.connect(unCommentAction, SIGNAL("triggered()"),
actions.Actions().editor_uncomment)
self.connect(horizontalLineAction, SIGNAL("triggered()"),
actions.Actions().editor_insert_horizontal_line)
self.connect(titleCommentAction, SIGNAL("triggered()"),
actions.Actions().editor_insert_title_comment)
# QObject.connect(removeUnusedImportsAction, SIGNAL("triggered()"),
# lambda: self._main._central.obtain_editor().remove_unused_imports())
## QObject.connect(addMissingImportsAction, SIGNAL("triggered()"),
# lambda: self._main._central.obtain_editor().add_missing_imports())
# QObject.connect(organizeImportsAction, SIGNAL("triggered()"),
# lambda: self._main._central.obtain_editor().organize_imports())
# QObject.connect(extractMethodAction, SIGNAL("triggered()"),
# lambda: self._main._central.obtain_editor().extract_method())
self.connect(moveUp, SIGNAL("triggered()"),
actions.Actions().editor_move_up)
self.connect(moveDown, SIGNAL("triggered()"),
actions.Actions().editor_move_down)
self.connect(duplicate, SIGNAL("triggered()"),
actions.Actions().editor_duplicate)
self.connect(replaceTabsSpaces, SIGNAL("triggered()"),
actions.Actions().editor_replace_tabs_with_spaces)
self.connect(removeTrailingSpaces, SIGNAL("triggered()"),
actions.Actions().editor_remove_trailing_spaces)
self.connect(remove, SIGNAL("triggered()"),
actions.Actions().editor_remove_line)
self.connect(insertPrints, SIGNAL("triggered()"),
actions.Actions().editor_insert_debugging_prints)
self.connect(insertPdb, SIGNAL("triggered()"),
actions.Actions().editor_insert_pdb)
|