./PaxHeaders.8617/eric4-4.5.18 0000644 0001750 0000144 00000000132 12262730777 013664 x ustar 00 0000000 0000000 30 mtime=1389081087.711724292
30 atime=1389081086.305724332
30 ctime=1389081087.711724292
eric4-4.5.18/ 0000755 0001750 0000144 00000000000 12262730777 013336 5 ustar 00detlev users 0000000 0000000 eric4-4.5.18/PaxHeaders.8617/patch_modpython.py 0000644 0001750 0000144 00000000130 12262730776 017353 x ustar 00 0000000 0000000 29 mtime=1389081086.00472434
29 atime=1389081086.00472434
30 ctime=1389081086.307724332
eric4-4.5.18/patch_modpython.py 0000644 0001750 0000144 00000010275 12262730776 017114 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2003-2014 Detlev Offenbach
#
# This is a script to patch mod_python for eric4.
"""
Script to patch mod_python for usage with the eric4 IDE.
"""
import sys
import os
import shutil
import py_compile
import distutils.sysconfig
# Define the globals.
progName = None
modDir = None
def usage(rcode = 2):
"""
Display a usage message and exit.
rcode is the return code passed back to the calling process.
"""
global progName, modDir
print "Usage:"
print " %s [-h] [-d dir]" % (progName)
print "where:"
print " -h display this help message"
print " -d dir where Mod_python files are installed [default %s]" % \
(modDir)
print
print "This script patches the file apache.py of the Mod_python distribution"
print "so that it will work with the eric4 debugger instead of pdb."
print "Please see mod_python.html for more details."
print
sys.exit(rcode)
def initGlobals():
"""
Sets the values of globals that need more than a simple assignment.
"""
global modDir
modDir = os.path.join(distutils.sysconfig.get_python_lib(True), "mod_python")
def main(argv):
"""The main function of the script.
argv is the list of command line arguments.
"""
import getopt
# Parse the command line.
global progName, modDir
progName = os.path.basename(argv[0])
initGlobals()
try:
optlist, args = getopt.getopt(argv[1:],"hd:")
except getopt.GetoptError:
usage()
for opt, arg in optlist:
if opt == "-h":
usage(0)
elif opt == "-d":
global modDir
modDir = arg
try:
filename = os.path.join(modDir, "apache.py")
f = open(filename, "r")
except EnvironmentError:
print "The file %s does not exist. Aborting." % filename
sys.exit(1)
lines = f.readlines()
f.close()
pdbFound = False
ericFound = False
sn = "apache.py"
s = open(sn, "w")
for line in lines:
if not pdbFound and line.startswith("import pdb"):
s.write("import eric4.DebugClients.Python.eric4dbgstub as pdb\n")
pdbFound = True
else:
s.write(line)
if line.startswith("import eric4"):
ericFound = True
if not ericFound:
s.write("\n")
s.write('def initDebugger(name):\n')
s.write(' """\n')
s.write(' Initialize the debugger and set the script name to be reported \n')
s.write(' by the debugger. This is a patch for eric4.\n')
s.write(' """\n')
s.write(' if not pdb.initDebugger("standard"):\n')
s.write(' raise ImportError("Could not initialize debugger")\n')
s.write(' pdb.setScriptname(name)\n')
s.write("\n")
s.close()
if ericFound:
print "Mod_python is already patched for eric4."
os.remove(sn)
else:
try:
py_compile.compile(sn)
except py_compile.PyCompileError, e:
print "Error compiling %s. Aborting" % sn
print e
os.remove(sn)
sys.exit(1)
except SyntaxError, e:
print "Error compiling %s. Aborting" % sn
print e
os.remove(sn)
sys.exit(1)
shutil.copy(os.path.join(modDir, "apache.py"),
os.path.join(modDir, "apache.py.orig"))
shutil.copy(sn, modDir)
os.remove(sn)
if os.path.exists("%sc" % sn):
shutil.copy("%sc" % sn, modDir)
os.remove("%sc" % sn)
if os.path.exists("%so" % sn):
shutil.copy("%so" % sn, modDir)
os.remove("%so" % sn)
print "Mod_python patched successfully."
print "Unpatched file copied to %s." % os.path.join(modDir, "apache.py.orig")
if __name__ == "__main__":
try:
main(sys.argv)
except SystemExit:
raise
except:
print \
"""An internal error occured. Please report all the output of the program,
including the following traceback, to eric-bugs@die-offenbachs.de.
"""
raise
eric4-4.5.18/PaxHeaders.8617/eric 0000644 0001750 0000144 00000000132 12262730776 014450 x ustar 00 0000000 0000000 30 mtime=1389081086.289724333
30 atime=1389081086.290724332
30 ctime=1389081086.315724332
eric4-4.5.18/eric/ 0000755 0001750 0000144 00000000000 12262730776 014257 5 ustar 00detlev users 0000000 0000000 eric4-4.5.18/eric/PaxHeaders.8617/ViewManager 0000644 0001750 0000144 00000000132 12262730776 016655 x ustar 00 0000000 0000000 30 mtime=1389081086.300724332
30 atime=1389081086.305724332
30 ctime=1389081086.315724332
eric4-4.5.18/eric/ViewManager/ 0000755 0001750 0000144 00000000000 12262730776 016464 5 ustar 00detlev users 0000000 0000000 eric4-4.5.18/eric/ViewManager/PaxHeaders.8617/BookmarkedFilesDialog.py 0000644 0001750 0000144 00000000132 12261012647 023452 x ustar 00 0000000 0000000 30 mtime=1388582311.748073872
30 atime=1389081057.399723464
30 ctime=1389081086.307724332
eric4-4.5.18/eric/ViewManager/BookmarkedFilesDialog.py 0000644 0001750 0000144 00000014020 12261012647 023201 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2004 - 2014 Detlev Offenbach
#
"""
Module implementing a configuration dialog for the bookmarked files menu.
"""
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from KdeQt import KQFileDialog
from E4Gui.E4Completers import E4FileCompleter
from Ui_BookmarkedFilesDialog import Ui_BookmarkedFilesDialog
import Utilities
class BookmarkedFilesDialog(QDialog, Ui_BookmarkedFilesDialog):
"""
Class implementing a configuration dialog for the bookmarked files menu.
"""
def __init__(self, bookmarks, parent = None):
"""
Constructor
@param bookmarks list of bookmarked files (QStringList)
@param parent parent widget (QWidget)
"""
QDialog.__init__(self, parent)
self.setupUi(self)
self.fileCompleter = E4FileCompleter(self.fileEdit)
self.bookmarks = QStringList(bookmarks)
for bookmark in self.bookmarks:
itm = QListWidgetItem(bookmark, self.filesList)
if not QFileInfo(bookmark).exists():
itm.setBackgroundColor(QColor(Qt.red))
if len(self.bookmarks):
self.filesList.setCurrentRow(0)
def on_fileEdit_textChanged(self, txt):
"""
Private slot to handle the textChanged signal of the file edit.
@param txt the text of the file edit (QString)
"""
self.addButton.setEnabled(not txt.isEmpty())
self.changeButton.setEnabled(not txt.isEmpty() and \
self.filesList.currentRow() != -1)
def on_filesList_currentRowChanged(self, row):
"""
Private slot to set the lineedit depending on the selected entry.
@param row the current row (integer)
"""
if row == -1:
self.fileEdit.clear()
self.downButton.setEnabled(False)
self.upButton.setEnabled(False)
self.deleteButton.setEnabled(False)
self.changeButton.setEnabled(False)
else:
maxIndex = len(self.bookmarks) - 1
self.upButton.setEnabled(row != 0)
self.downButton.setEnabled(row != maxIndex)
self.deleteButton.setEnabled(True)
self.changeButton.setEnabled(True)
bookmark = self.bookmarks[row]
self.fileEdit.setText(bookmark)
@pyqtSignature("")
def on_addButton_clicked(self):
"""
Private slot to add a new entry.
"""
bookmark = self.fileEdit.text()
if not bookmark.isEmpty():
bookmark = Utilities.toNativeSeparators(bookmark)
itm = QListWidgetItem(bookmark, self.filesList)
if not QFileInfo(bookmark).exists():
itm.setBackgroundColor(QColor(Qt.red))
self.fileEdit.clear()
self.bookmarks.append(bookmark)
row = self.filesList.currentRow()
self.on_filesList_currentRowChanged(row)
@pyqtSignature("")
def on_changeButton_clicked(self):
"""
Private slot to change an entry.
"""
row = self.filesList.currentRow()
bookmark = self.fileEdit.text()
bookmark = Utilities.toNativeSeparators(bookmark)
self.bookmarks[row] = bookmark
itm = self.filesList.item(row)
itm.setText(bookmark)
if not QFileInfo(bookmark).exists():
itm.setBackgroundColor(QColor(Qt.red))
else:
itm.setBackgroundColor(QColor())
@pyqtSignature("")
def on_deleteButton_clicked(self):
"""
Private slot to delete the selected entry.
"""
row = self.filesList.currentRow()
itm = self.filesList.takeItem(row)
del itm
del self.bookmarks[row]
row = self.filesList.currentRow()
self.on_filesList_currentRowChanged(row)
@pyqtSignature("")
def on_downButton_clicked(self):
"""
Private slot to move an entry down in the list.
"""
rows = self.filesList.count()
row = self.filesList.currentRow()
if row == rows - 1:
# we're already at the end
return
self.__swap(row, row + 1)
itm = self.filesList.takeItem(row)
self.filesList.insertItem(row + 1, itm)
self.filesList.setCurrentItem(itm)
self.upButton.setEnabled(True)
if row == rows - 2:
self.downButton.setEnabled(False)
else:
self.downButton.setEnabled(True)
@pyqtSignature("")
def on_upButton_clicked(self):
"""
Private slot to move an entry up in the list.
"""
row = self.filesList.currentRow()
if row == 0:
# we're already at the top
return
self.__swap(row - 1, row)
itm = self.filesList.takeItem(row)
self.filesList.insertItem(row - 1, itm)
self.filesList.setCurrentItem(itm)
if row == 1:
self.upButton.setEnabled(False)
else:
self.upButton.setEnabled(True)
self.downButton.setEnabled(True)
@pyqtSignature("")
def on_fileButton_clicked(self):
"""
Private slot to handle the file selection via a file selection dialog.
"""
bookmark = KQFileDialog.getOpenFileName()
if not bookmark.isEmpty():
bookmark = Utilities.toNativeSeparators(bookmark)
self.fileEdit.setText(bookmark)
def getBookmarkedFiles(self):
"""
Public method to retrieve the tools list.
@return a list of filenames (QStringList)
"""
return self.bookmarks
def __swap(self, itm1, itm2):
"""
Private method used two swap two list entries given by their index.
@param itm1 index of first entry (int)
@param itm2 index of second entry (int)
"""
tmp = self.bookmarks[itm1]
self.bookmarks[itm1] = self.bookmarks[itm2]
self.bookmarks[itm2] = tmp
eric4-4.5.18/eric/ViewManager/PaxHeaders.8617/ViewManager.py 0000644 0001750 0000144 00000000132 12261012647 021476 x ustar 00 0000000 0000000 30 mtime=1388582311.762074049
30 atime=1389081057.399723464
30 ctime=1389081086.307724332
eric4-4.5.18/eric/ViewManager/ViewManager.py 0000644 0001750 0000144 00000714473 12261012647 021250 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2002 - 2014 Detlev Offenbach
#
"""
Module implementing the viewmanager base class.
"""
import os
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.Qsci import QsciScintilla
from KdeQt import KQFileDialog, KQMessageBox
from KdeQt.KQApplication import e4App
from Globals import recentNameFiles, isMacPlatform
import Preferences
from BookmarkedFilesDialog import BookmarkedFilesDialog
from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
from QScintilla.Editor import Editor
from QScintilla.GotoDialog import GotoDialog
from QScintilla.SearchReplaceWidget import SearchReplaceWidget
from QScintilla.ZoomDialog import ZoomDialog
from QScintilla.APIsManager import APIsManager
from QScintilla.SpellChecker import SpellChecker
import QScintilla.Lexers
import QScintilla.Exporters
from QScintilla.Shell import Shell
import Utilities
import UI.PixmapCache
import UI.Config
from E4Gui.E4Action import E4Action, createActionGroup
class QuickSearchLineEdit(QLineEdit):
"""
Class implementing a line edit that reacts to newline and cancel commands.
@signal escPressed() emitted after the cancel command was activated
@signal returnPressed() emitted after a newline command was activated
@signal gotFocus() emitted when the focus is changed to this widget
"""
def editorCommand(self, cmd):
"""
Public method to perform an editor command.
@param cmd the scintilla command to be performed
"""
if cmd == QsciScintilla.SCI_NEWLINE:
cb = self.parent()
hasEntry = cb.findText(self.text()) != -1
if not hasEntry:
if cb.insertPolicy() == QComboBox.InsertAtTop:
cb.insertItem(0, self.text())
else:
cb.addItem(self.text())
self.emit(SIGNAL("returnPressed()"))
elif cmd == QsciScintilla.SCI_CANCEL:
self.emit(SIGNAL("escPressed()"))
def keyPressEvent(self, evt):
"""
Re-implemented to handle the press of the ESC key.
@param evt key event (QKeyPressEvent)
"""
if evt.key() == Qt.Key_Escape:
self.emit(SIGNAL("escPressed()"))
else:
QLineEdit.keyPressEvent(self, evt) # pass it on
def focusInEvent(self, evt):
"""
Re-implemented to record the current editor widget.
@param evt focus event (QFocusEvent)
"""
self.emit(SIGNAL("gotFocus()"))
QLineEdit.focusInEvent(self, evt) # pass it on
class ViewManager(QObject):
"""
Base class inherited by all specific viewmanager classes.
It defines the interface to be implemented by specific
viewmanager classes and all common methods.
@signal lastEditorClosed emitted after the last editor window was closed
@signal editorOpened(string) emitted after an editor window was opened
@signal editorOpenedEd(editor) emitted after an editor window was opened
@signal editorClosed(string) emitted just before an editor window gets closed
@signal editorClosedEd(editor) emitted just before an editor window gets closed
@signal editorSaved(string) emitted after an editor window was saved
@signal checkActions(editor) emitted when some actions should be checked
for their status
@signal cursorChanged(editor) emitted after the cursor position of the active
window has changed
@signal breakpointToggled(editor) emitted when a breakpoint is toggled.
@signal bookmarkToggled(editor) emitted when a bookmark is toggled.
"""
def __init__(self):
"""
Constructor
@param ui reference to the main user interface
@param dbs reference to the debug server object
"""
QObject.__init__(self)
# initialize the instance variables
self.editors = []
self.currentEditor = None
self.untitledCount = 0
self.srHistory = {
"search" : QStringList(),
"replace" : QStringList()
}
self.editorsCheckFocusIn = True
self.recent = QStringList()
self.__loadRecent()
self.bookmarked = QStringList()
bs = Preferences.Prefs.settings.value("Bookmarked/Sources")
if bs.isValid():
self.bookmarked = bs.toStringList()
# initialize the autosave timer
self.autosaveInterval = Preferences.getEditor("AutosaveInterval")
self.autosaveTimer = QTimer(self)
self.autosaveTimer.setObjectName("AutosaveTimer")
self.autosaveTimer.setSingleShot(True)
self.connect(self.autosaveTimer, SIGNAL('timeout()'), self.__autosave)
# initialize the APIs manager
self.apisManager = APIsManager(parent = self)
def setReferences(self, ui, dbs):
"""
Public method to set some references needed later on.
@param ui reference to the main user interface
@param dbs reference to the debug server object
"""
self.ui = ui
self.dbs = dbs
self.searchDlg = SearchReplaceWidget(False, self, ui)
self.replaceDlg = SearchReplaceWidget(True, self, ui)
self.connect(self, SIGNAL("checkActions"),
self.searchDlg.updateSelectionCheckBox)
self.connect(self, SIGNAL("checkActions"),
self.replaceDlg.updateSelectionCheckBox)
def __loadRecent(self):
"""
Private method to load the recently opened filenames.
"""
self.recent.clear()
Preferences.Prefs.rsettings.sync()
rs = Preferences.Prefs.rsettings.value(recentNameFiles)
if rs.isValid():
for f in rs.toStringList():
if QFileInfo(f).exists():
self.recent.append(f)
def __saveRecent(self):
"""
Private method to save the list of recently opened filenames.
"""
Preferences.Prefs.rsettings.setValue(recentNameFiles, QVariant(self.recent))
Preferences.Prefs.rsettings.sync()
def getMostRecent(self):
"""
Public method to get the most recently opened file.
@return path of the most recently opened file (string)
"""
if len(self.recent):
return unicode(self.recent[0])
else:
return None
def setSbInfo(self, sbFile, sbLine, sbPos, sbWritable, sbEncoding, sbLanguage, sbEol):
"""
Public method to transfer statusbar info from the user interface to viewmanager.
@param sbFile reference to the file part of the statusbar (E4SqueezeLabelPath)
@param sbLine reference to the line number part of the statusbar (QLabel)
@param sbPos reference to the character position part of the statusbar (QLabel)
@param sbWritable reference to the writability indicator part of
the statusbar (QLabel)
@param sbEncoding reference to the encoding indicator part of the
statusbar (QLabel)
@param sbLanguage reference to the language indicator part of the
statusbar (QLabel)
@param sbEol reference to the eol indicator part of the statusbar (QLabel)
"""
self.sbFile = sbFile
self.sbLine = sbLine
self.sbPos = sbPos
self.sbWritable = sbWritable
self.sbEnc = sbEncoding
self.sbLang = sbLanguage
self.sbEol = sbEol
self.__setSbFile()
############################################################################
## methods below need to be implemented by a subclass
############################################################################
def canCascade(self):
"""
Public method to signal if cascading of managed windows is available.
@return flag indicating cascading of windows is available
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def canTile(self):
"""
Public method to signal if tiling of managed windows is available.
@return flag indicating tiling of windows is available
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def tile(self):
"""
Public method to tile the managed windows.
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def cascade(self):
"""
Public method to cascade the managed windows.
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def activeWindow(self):
"""
Public method to return the active (i.e. current) window.
@return reference to the active editor
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def _removeAllViews(self):
"""
Protected method to remove all views (i.e. windows)
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def _removeView(self, win):
"""
Protected method to remove a view (i.e. window)
@param win editor window to be removed
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def _addView(self, win, fn=None, noName=""):
"""
Protected method to add a view (i.e. window)
@param win editor window to be added
@param fn filename of this editor
@param noName name to be used for an unnamed editor (string or QString)
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def _showView(self, win, fn=None):
"""
Protected method to show a view (i.e. window)
@param win editor window to be shown
@param fn filename of this editor
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def showWindowMenu(self, windowMenu):
"""
Public method to set up the viewmanager part of the Window menu.
@param windowMenu reference to the window menu
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def _initWindowActions(self):
"""
Protected method to define the user interface actions for window handling.
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def setEditorName(self, editor, newName):
"""
Public method to change the displayed name of the editor.
@param editor editor window to be changed
@param newName new name to be shown (string or QString)
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
def _modificationStatusChanged(self, m, editor):
"""
Protected slot to handle the modificationStatusChanged signal.
@param m flag indicating the modification status (boolean)
@param editor editor window changed
@exception RuntimeError Not implemented
"""
raise RuntimeError('Not implemented')
#####################################################################
## methods above need to be implemented by a subclass
#####################################################################
def canSplit(self):
"""
Public method to signal if splitting of the view is available.
@return flag indicating splitting of the view is available.
"""
return False
def addSplit(self):
"""
Public method used to split the current view.
"""
pass
def removeSplit(self):
"""
Public method used to remove the current split view.
@return Flag indicating successful deletion
"""
return False
def setSplitOrientation(self, orientation):
"""
Public method used to set the orientation of the split view.
@param orientation orientation of the split
(Qt.Horizontal or Qt.Vertical)
"""
pass
def nextSplit(self):
"""
Public slot used to move to the next split.
"""
pass
def prevSplit(self):
"""
Public slot used to move to the previous split.
"""
pass
def eventFilter(self, object, event):
"""
Public method called to filter an event.
@param object object, that generated the event (QObject)
@param event the event, that was generated by object (QEvent)
@return flag indicating if event was filtered out
"""
return False
#####################################################################
## methods above need to be implemented by a subclass, that supports
## splitting of the viewmanager area.
#####################################################################
def initActions(self):
"""
Public method defining the user interface actions.
"""
# list containing all edit actions
self.editActions = []
# list containing all file actions
self.fileActions = []
# list containing all search actions
self.searchActions = []
# list containing all view actions
self.viewActions = []
# list containing all window actions
self.windowActions = []
# list containing all macro actions
self.macroActions = []
# list containing all bookmark actions
self.bookmarkActions = []
# list containing all spell checking actions
self.spellingActions = []
self._initWindowActions()
self.__initFileActions()
self.__initEditActions()
self.__initSearchActions()
self.__initViewActions()
self.__initMacroActions()
self.__initBookmarkActions()
self.__initSpellingActions()
##################################################################
## Initialize the file related actions, file menu and toolbar
##################################################################
def __initFileActions(self):
"""
Private method defining the user interface actions for file handling.
"""
self.newAct = E4Action(QApplication.translate('ViewManager', 'New'),
UI.PixmapCache.getIcon("new.png"),
QApplication.translate('ViewManager', '&New'),
QKeySequence(QApplication.translate('ViewManager', "Ctrl+N", "File|New")),
0, self, 'vm_file_new')
self.newAct.setStatusTip(\
QApplication.translate('ViewManager', 'Open an empty editor window'))
self.newAct.setWhatsThis(QApplication.translate('ViewManager',
"""New"""
"""An empty editor window will be created.
"""
))
self.connect(self.newAct, SIGNAL('triggered()'), self.newEditor)
self.fileActions.append(self.newAct)
self.openAct = E4Action(QApplication.translate('ViewManager', 'Open'),
UI.PixmapCache.getIcon("open.png"),
QApplication.translate('ViewManager', '&Open...'),
QKeySequence(\
QApplication.translate('ViewManager', "Ctrl+O", "File|Open")),
0, self, 'vm_file_open')
self.openAct.setStatusTip(QApplication.translate('ViewManager', 'Open a file'))
self.openAct.setWhatsThis(QApplication.translate('ViewManager',
"""Open a file"""
"""You will be asked for the name of a file to be opened"""
""" in an editor window.
"""
))
self.connect(self.openAct, SIGNAL('triggered()'), self.openFiles)
self.fileActions.append(self.openAct)
self.closeActGrp = createActionGroup(self)
self.closeAct = E4Action(QApplication.translate('ViewManager', 'Close'),
UI.PixmapCache.getIcon("close.png"),
QApplication.translate('ViewManager', '&Close'),
QKeySequence(\
QApplication.translate('ViewManager', "Ctrl+W", "File|Close")),
0, self.closeActGrp, 'vm_file_close')
self.closeAct.setStatusTip(\
QApplication.translate('ViewManager', 'Close the current window'))
self.closeAct.setWhatsThis(QApplication.translate('ViewManager',
"""Close Window"""
"""Close the current window.
"""
))
self.connect(self.closeAct, SIGNAL('triggered()'), self.closeCurrentWindow)
self.fileActions.append(self.closeAct)
self.closeAllAct = E4Action(QApplication.translate('ViewManager', 'Close All'),
QApplication.translate('ViewManager', 'Clos&e All'),
0, 0, self.closeActGrp, 'vm_file_close_all')
self.closeAllAct.setStatusTip(\
QApplication.translate('ViewManager', 'Close all editor windows'))
self.closeAllAct.setWhatsThis(QApplication.translate('ViewManager',
"""Close All Windows"""
"""Close all editor windows.
"""
))
self.connect(self.closeAllAct, SIGNAL('triggered()'), self.closeAllWindows)
self.fileActions.append(self.closeAllAct)
self.closeActGrp.setEnabled(False)
self.saveActGrp = createActionGroup(self)
self.saveAct = E4Action(QApplication.translate('ViewManager', 'Save'),
UI.PixmapCache.getIcon("fileSave.png"),
QApplication.translate('ViewManager', '&Save'),
QKeySequence(\
QApplication.translate('ViewManager', "Ctrl+S", "File|Save")),
0, self.saveActGrp, 'vm_file_save')
self.saveAct.setStatusTip(\
QApplication.translate('ViewManager', 'Save the current file'))
self.saveAct.setWhatsThis(QApplication.translate('ViewManager',
"""Save File"""
"""Save the contents of current editor window.
"""
))
self.connect(self.saveAct, SIGNAL('triggered()'), self.saveCurrentEditor)
self.fileActions.append(self.saveAct)
self.saveAsAct = E4Action(QApplication.translate('ViewManager', 'Save as'),
UI.PixmapCache.getIcon("fileSaveAs.png"),
QApplication.translate('ViewManager', 'Save &as...'),
QKeySequence(QApplication.translate('ViewManager',
"Shift+Ctrl+S", "File|Save As")),
0, self.saveActGrp, 'vm_file_save_as')
self.saveAsAct.setStatusTip(QApplication.translate('ViewManager',
'Save the current file to a new one'))
self.saveAsAct.setWhatsThis(QApplication.translate('ViewManager',
"""Save File as"""
"""Save the contents of current editor window to a new file."""
""" The file can be entered in a file selection dialog.
"""
))
self.connect(self.saveAsAct, SIGNAL('triggered()'), self.saveAsCurrentEditor)
self.fileActions.append(self.saveAsAct)
self.saveAllAct = E4Action(QApplication.translate('ViewManager', 'Save all'),
UI.PixmapCache.getIcon("fileSaveAll.png"),
QApplication.translate('ViewManager', 'Save a&ll'),
0, 0, self.saveActGrp, 'vm_file_save_all')
self.saveAllAct.setStatusTip(QApplication.translate('ViewManager',
'Save all files'))
self.saveAllAct.setWhatsThis(QApplication.translate('ViewManager',
"""Save All Files"""
"""Save the contents of all editor windows.
"""
))
self.connect(self.saveAllAct, SIGNAL('triggered()'), self.saveAllEditors)
self.fileActions.append(self.saveAllAct)
self.saveActGrp.setEnabled(False)
self.printAct = E4Action(QApplication.translate('ViewManager', 'Print'),
UI.PixmapCache.getIcon("print.png"),
QApplication.translate('ViewManager', '&Print'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+P", "File|Print")),
0, self, 'vm_file_print')
self.printAct.setStatusTip(QApplication.translate('ViewManager',
'Print the current file'))
self.printAct.setWhatsThis(QApplication.translate('ViewManager',
"""Print File"""
"""Print the contents of current editor window.
"""
))
self.connect(self.printAct, SIGNAL('triggered()'), self.printCurrentEditor)
self.printAct.setEnabled(False)
self.fileActions.append(self.printAct)
self.printPreviewAct = \
E4Action(QApplication.translate('ViewManager', 'Print Preview'),
UI.PixmapCache.getIcon("printPreview.png"),
QApplication.translate('ViewManager', 'Print Preview'),
0, 0, self, 'vm_file_print_preview')
self.printPreviewAct.setStatusTip(QApplication.translate('ViewManager',
'Print preview of the current file'))
self.printPreviewAct.setWhatsThis(QApplication.translate('ViewManager',
"""Print Preview"""
"""Print preview of the current editor window.
"""
))
self.connect(self.printPreviewAct, SIGNAL('triggered()'),
self.printPreviewCurrentEditor)
self.printPreviewAct.setEnabled(False)
self.fileActions.append(self.printPreviewAct)
self.findFileNameAct = E4Action(QApplication.translate('ViewManager',
'Search File'),
QApplication.translate('ViewManager', 'Search &File...'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Ctrl+F", "File|Search File")),
0, self, 'vm_file_search_file')
self.findFileNameAct.setStatusTip(QApplication.translate('ViewManager',
'Search for a file'))
self.findFileNameAct.setWhatsThis(QApplication.translate('ViewManager',
"""Search File"""
"""Search for a file.
"""
))
self.connect(self.findFileNameAct, SIGNAL('triggered()'), self.__findFileName)
self.fileActions.append(self.findFileNameAct)
def initFileMenu(self):
"""
Public method to create the File menu.
@return the generated menu
"""
menu = QMenu(QApplication.translate('ViewManager', '&File'), self.ui)
self.recentMenu = QMenu(QApplication.translate('ViewManager',
'Open &Recent Files'), menu)
self.bookmarkedMenu = QMenu(QApplication.translate('ViewManager',
'Open &Bookmarked Files'), menu)
self.exportersMenu = self.__initContextMenuExporters()
menu.setTearOffEnabled(True)
menu.addAction(self.newAct)
menu.addAction(self.openAct)
self.menuRecentAct = menu.addMenu(self.recentMenu)
menu.addMenu(self.bookmarkedMenu)
menu.addSeparator()
menu.addAction(self.closeAct)
menu.addAction(self.closeAllAct)
menu.addSeparator()
menu.addAction(self.findFileNameAct)
menu.addSeparator()
menu.addAction(self.saveAct)
menu.addAction(self.saveAsAct)
menu.addAction(self.saveAllAct)
self.exportersMenuAct = menu.addMenu(self.exportersMenu)
menu.addSeparator()
menu.addAction(self.printPreviewAct)
menu.addAction(self.printAct)
self.connect(self.recentMenu, SIGNAL('aboutToShow()'),
self.__showRecentMenu)
self.connect(self.recentMenu, SIGNAL('triggered(QAction *)'),
self.__openSourceFile)
self.connect(self.bookmarkedMenu, SIGNAL('aboutToShow()'),
self.__showBookmarkedMenu)
self.connect(self.bookmarkedMenu, SIGNAL('triggered(QAction *)'),
self.__openSourceFile)
self.connect(menu, SIGNAL('aboutToShow()'), self.__showFileMenu)
self.exportersMenuAct.setEnabled(False)
return menu
def initFileToolbar(self, toolbarManager):
"""
Public method to create the File toolbar.
@param toolbarManager reference to a toolbar manager object (E4ToolBarManager)
@return the generated toolbar
"""
tb = QToolBar(QApplication.translate('ViewManager', 'File'), self.ui)
tb.setIconSize(UI.Config.ToolBarIconSize)
tb.setObjectName("FileToolbar")
tb.setToolTip(QApplication.translate('ViewManager', 'File'))
tb.addAction(self.newAct)
tb.addAction(self.openAct)
tb.addAction(self.closeAct)
tb.addSeparator()
tb.addAction(self.saveAct)
tb.addAction(self.saveAsAct)
tb.addAction(self.saveAllAct)
toolbarManager.addToolBar(tb, tb.windowTitle())
toolbarManager.addAction(self.printPreviewAct, tb.windowTitle())
toolbarManager.addAction(self.printAct, tb.windowTitle())
return tb
def __initContextMenuExporters(self):
"""
Private method used to setup the Exporters sub menu.
"""
menu = QMenu(QApplication.translate('ViewManager', "Export as"))
supportedExporters = QScintilla.Exporters.getSupportedFormats()
exporters = supportedExporters.keys()
exporters.sort()
for exporter in exporters:
act = menu.addAction(supportedExporters[exporter])
act.setData(QVariant(exporter))
self.connect(menu, SIGNAL('triggered(QAction *)'), self.__exportMenuTriggered)
return menu
##################################################################
## Initialize the edit related actions, edit menu and toolbar
##################################################################
def __initEditActions(self):
"""
Private method defining the user interface actions for the edit commands.
"""
self.editActGrp = createActionGroup(self)
self.undoAct = E4Action(QApplication.translate('ViewManager', 'Undo'),
UI.PixmapCache.getIcon("editUndo.png"),
QApplication.translate('ViewManager', '&Undo'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Z", "Edit|Undo")),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Backspace", "Edit|Undo")),
self.editActGrp, 'vm_edit_undo')
self.undoAct.setStatusTip(QApplication.translate('ViewManager',
'Undo the last change'))
self.undoAct.setWhatsThis(QApplication.translate('ViewManager',
"""Undo"""
"""Undo the last change done in the current editor.
"""
))
self.connect(self.undoAct, SIGNAL('triggered()'), self.__editUndo)
self.editActions.append(self.undoAct)
self.redoAct = E4Action(QApplication.translate('ViewManager', 'Redo'),
UI.PixmapCache.getIcon("editRedo.png"),
QApplication.translate('ViewManager', '&Redo'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Shift+Z", "Edit|Redo")),
0, self.editActGrp, 'vm_edit_redo')
self.redoAct.setStatusTip(QApplication.translate('ViewManager',
'Redo the last change'))
self.redoAct.setWhatsThis(QApplication.translate('ViewManager',
"""Redo"""
"""Redo the last change done in the current editor.
"""
))
self.connect(self.redoAct, SIGNAL('triggered()'), self.__editRedo)
self.editActions.append(self.redoAct)
self.revertAct = E4Action(QApplication.translate('ViewManager',
'Revert to last saved state'),
QApplication.translate('ViewManager', 'Re&vert to last saved state'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Y", "Edit|Revert")),
0,
self.editActGrp, 'vm_edit_revert')
self.revertAct.setStatusTip(QApplication.translate('ViewManager',
'Revert to last saved state'))
self.revertAct.setWhatsThis(QApplication.translate('ViewManager',
"""Revert to last saved state"""
"""Undo all changes up to the last saved state"""
""" of the current editor.
"""
))
self.connect(self.revertAct, SIGNAL('triggered()'), self.__editRevert)
self.editActions.append(self.revertAct)
self.copyActGrp = createActionGroup(self.editActGrp)
self.cutAct = E4Action(QApplication.translate('ViewManager', 'Cut'),
UI.PixmapCache.getIcon("editCut.png"),
QApplication.translate('ViewManager', 'Cu&t'),
QKeySequence(QApplication.translate('ViewManager', "Ctrl+X", "Edit|Cut")),
QKeySequence(QApplication.translate('ViewManager',
"Shift+Del", "Edit|Cut")),
self.copyActGrp, 'vm_edit_cut')
self.cutAct.setStatusTip(QApplication.translate('ViewManager',
'Cut the selection'))
self.cutAct.setWhatsThis(QApplication.translate('ViewManager',
"""Cut"""
"""Cut the selected text of the current editor to the clipboard.
"""
))
self.connect(self.cutAct, SIGNAL('triggered()'), self.__editCut)
self.editActions.append(self.cutAct)
self.copyAct = E4Action(QApplication.translate('ViewManager', 'Copy'),
UI.PixmapCache.getIcon("editCopy.png"),
QApplication.translate('ViewManager', '&Copy'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+C", "Edit|Copy")),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Ins", "Edit|Copy")),
self.copyActGrp, 'vm_edit_copy')
self.copyAct.setStatusTip(QApplication.translate('ViewManager',
'Copy the selection'))
self.copyAct.setWhatsThis(QApplication.translate('ViewManager',
"""Copy"""
"""Copy the selected text of the current editor to the clipboard.
"""
))
self.connect(self.copyAct, SIGNAL('triggered()'), self.__editCopy)
self.editActions.append(self.copyAct)
self.pasteAct = E4Action(QApplication.translate('ViewManager', 'Paste'),
UI.PixmapCache.getIcon("editPaste.png"),
QApplication.translate('ViewManager', '&Paste'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+V", "Edit|Paste")),
QKeySequence(QApplication.translate('ViewManager',
"Shift+Ins", "Edit|Paste")),
self.copyActGrp, 'vm_edit_paste')
self.pasteAct.setStatusTip(QApplication.translate('ViewManager',
'Paste the last cut/copied text'))
self.pasteAct.setWhatsThis(QApplication.translate('ViewManager',
"""Paste"""
"""Paste the last cut/copied text from the clipboard to"""
""" the current editor.
"""
))
self.connect(self.pasteAct, SIGNAL('triggered()'), self.__editPaste)
self.editActions.append(self.pasteAct)
self.deleteAct = E4Action(QApplication.translate('ViewManager', 'Clear'),
UI.PixmapCache.getIcon("editDelete.png"),
QApplication.translate('ViewManager', 'Cl&ear'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Shift+C", "Edit|Clear")),
0,
self.copyActGrp, 'vm_edit_clear')
self.deleteAct.setStatusTip(QApplication.translate('ViewManager',
'Clear all text'))
self.deleteAct.setWhatsThis(QApplication.translate('ViewManager',
"""Clear"""
"""Delete all text of the current editor.
"""
))
self.connect(self.deleteAct, SIGNAL('triggered()'), self.__editDelete)
self.editActions.append(self.deleteAct)
self.indentAct = E4Action(QApplication.translate('ViewManager', 'Indent'),
UI.PixmapCache.getIcon("editIndent.png"),
QApplication.translate('ViewManager', '&Indent'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+I", "Edit|Indent")),
0,
self.editActGrp, 'vm_edit_indent')
self.indentAct.setStatusTip(QApplication.translate('ViewManager', 'Indent line'))
self.indentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Indent"""
"""Indents the current line or the lines of the"""
""" selection by one level.
"""
))
self.connect(self.indentAct, SIGNAL('triggered()'), self.__editIndent)
self.editActions.append(self.indentAct)
self.unindentAct = E4Action(QApplication.translate('ViewManager', 'Unindent'),
UI.PixmapCache.getIcon("editUnindent.png"),
QApplication.translate('ViewManager', 'U&nindent'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Shift+I", "Edit|Unindent")),
0,
self.editActGrp, 'vm_edit_unindent')
self.unindentAct.setStatusTip(QApplication.translate('ViewManager',
'Unindent line'))
self.unindentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Unindent"""
"""Unindents the current line or the lines of the"""
""" selection by one level.
"""
))
self.connect(self.unindentAct, SIGNAL('triggered()'), self.__editUnindent)
self.editActions.append(self.unindentAct)
self.smartIndentAct = E4Action(QApplication.translate('ViewManager',
'Smart indent'),
UI.PixmapCache.getIcon("editSmartIndent.png"),
QApplication.translate('ViewManager', 'Smart indent'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Alt+I", "Edit|Smart indent")),
0,
self.editActGrp, 'vm_edit_smart_indent')
self.smartIndentAct.setStatusTip(QApplication.translate('ViewManager',
'Smart indent Line or Selection'))
self.smartIndentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Smart indent"""
"""Indents the current line or the lines of the"""
""" current selection smartly.
"""
))
self.connect(self.smartIndentAct, SIGNAL('triggered()'), self.__editSmartIndent)
self.editActions.append(self.smartIndentAct)
self.commentAct = E4Action(QApplication.translate('ViewManager', 'Comment'),
UI.PixmapCache.getIcon("editComment.png"),
QApplication.translate('ViewManager', 'C&omment'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+M", "Edit|Comment")),
0,
self.editActGrp, 'vm_edit_comment')
self.commentAct.setStatusTip(QApplication.translate('ViewManager',
'Comment Line or Selection'))
self.commentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Comment"""
"""Comments the current line or the lines of the"""
""" current selection.
"""
))
self.connect(self.commentAct, SIGNAL('triggered()'), self.__editComment)
self.editActions.append(self.commentAct)
self.uncommentAct = E4Action(QApplication.translate('ViewManager', 'Uncomment'),
UI.PixmapCache.getIcon("editUncomment.png"),
QApplication.translate('ViewManager', 'Unco&mment'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Ctrl+M", "Edit|Uncomment")),
0,
self.editActGrp, 'vm_edit_uncomment')
self.uncommentAct.setStatusTip(QApplication.translate('ViewManager',
'Uncomment Line or Selection'))
self.uncommentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Uncomment"""
"""Uncomments the current line or the lines of the"""
""" current selection.
"""
))
self.connect(self.uncommentAct, SIGNAL('triggered()'), self.__editUncomment)
self.editActions.append(self.uncommentAct)
self.streamCommentAct = E4Action(QApplication.translate('ViewManager',
'Stream Comment'),
QApplication.translate('ViewManager', 'Stream Comment'),
0, 0, self.editActGrp, 'vm_edit_stream_comment')
self.streamCommentAct.setStatusTip(QApplication.translate('ViewManager',
'Stream Comment Line or Selection'))
self.streamCommentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Stream Comment"""
"""Stream comments the current line or the current selection.
"""
))
self.connect(self.streamCommentAct, SIGNAL('triggered()'),
self.__editStreamComment)
self.editActions.append(self.streamCommentAct)
self.boxCommentAct = E4Action(QApplication.translate('ViewManager',
'Box Comment'),
QApplication.translate('ViewManager', 'Box Comment'),
0, 0, self.editActGrp, 'vm_edit_box_comment')
self.boxCommentAct.setStatusTip(QApplication.translate('ViewManager',
'Box Comment Line or Selection'))
self.boxCommentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Box Comment"""
"""Box comments the current line or the lines of the"""
""" current selection.
"""
))
self.connect(self.boxCommentAct, SIGNAL('triggered()'), self.__editBoxComment)
self.editActions.append(self.boxCommentAct)
self.selectBraceAct = E4Action(QApplication.translate('ViewManager',
'Select to brace'),
QApplication.translate('ViewManager', 'Select to &brace'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+E", "Edit|Select to brace")),
0,
self.editActGrp, 'vm_edit_select_to_brace')
self.selectBraceAct.setStatusTip(QApplication.translate('ViewManager',
'Select text to the matching brace'))
self.selectBraceAct.setWhatsThis(QApplication.translate('ViewManager',
"""Select to brace"""
"""Select text of the current editor to the matching brace.
"""
))
self.connect(self.selectBraceAct, SIGNAL('triggered()'), self.__editSelectBrace)
self.editActions.append(self.selectBraceAct)
self.selectAllAct = E4Action(QApplication.translate('ViewManager', 'Select all'),
QApplication.translate('ViewManager', '&Select all'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+A", "Edit|Select all")),
0,
self.editActGrp, 'vm_edit_select_all')
self.selectAllAct.setStatusTip(QApplication.translate('ViewManager',
'Select all text'))
self.selectAllAct.setWhatsThis(QApplication.translate('ViewManager',
"""Select All"""
"""Select all text of the current editor.
"""
))
self.connect(self.selectAllAct, SIGNAL('triggered()'), self.__editSelectAll)
self.editActions.append(self.selectAllAct)
self.deselectAllAct = E4Action(QApplication.translate('ViewManager',
'Deselect all'),
QApplication.translate('ViewManager', '&Deselect all'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Ctrl+A", "Edit|Deselect all")),
0,
self.editActGrp, 'vm_edit_deselect_all')
self.deselectAllAct.setStatusTip(QApplication.translate('ViewManager',
'Deselect all text'))
self.deselectAllAct.setWhatsThis(QApplication.translate('ViewManager',
"""Deselect All"""
"""Deselect all text of the current editor.
"""
))
self.connect(self.deselectAllAct, SIGNAL('triggered()'), self.__editDeselectAll)
self.editActions.append(self.deselectAllAct)
self.convertEOLAct = E4Action(QApplication.translate('ViewManager',
'Convert Line End Characters'),
QApplication.translate('ViewManager', 'Convert &Line End Characters'),
0, 0, self.editActGrp, 'vm_edit_convert_eol')
self.convertEOLAct.setStatusTip(QApplication.translate('ViewManager',
'Convert Line End Characters'))
self.convertEOLAct.setWhatsThis(QApplication.translate('ViewManager',
"""Convert Line End Characters"""
"""Convert the line end characters to the currently set type.
"""
))
self.connect(self.convertEOLAct, SIGNAL('triggered()'), self.__convertEOL)
self.editActions.append(self.convertEOLAct)
self.shortenEmptyAct = E4Action(QApplication.translate('ViewManager',
'Shorten empty lines'),
QApplication.translate('ViewManager', 'Shorten empty lines'),
0, 0, self.editActGrp, 'vm_edit_shorten_empty_lines')
self.shortenEmptyAct.setStatusTip(QApplication.translate('ViewManager',
'Shorten empty lines'))
self.shortenEmptyAct.setWhatsThis(QApplication.translate('ViewManager',
"""Shorten empty lines"""
"""Shorten lines consisting solely of whitespace characters.
"""
))
self.connect(self.shortenEmptyAct, SIGNAL('triggered()'),
self.__shortenEmptyLines)
self.editActions.append(self.shortenEmptyAct)
self.autoCompleteAct = E4Action(QApplication.translate('ViewManager',
'Autocomplete'),
QApplication.translate('ViewManager', '&Autocomplete'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Space", "Edit|Autocomplete")),
0,
self.editActGrp, 'vm_edit_autocomplete')
self.autoCompleteAct.setStatusTip(QApplication.translate('ViewManager',
'Autocomplete current word'))
self.autoCompleteAct.setWhatsThis(QApplication.translate('ViewManager',
"""Autocomplete"""
"""Performs an autocompletion of the word containing the cursor.
"""
))
self.connect(self.autoCompleteAct, SIGNAL('triggered()'), self.__editAutoComplete)
self.editActions.append(self.autoCompleteAct)
self.autoCompleteFromDocAct = E4Action(QApplication.translate('ViewManager',
'Autocomplete from Document'),
QApplication.translate('ViewManager', 'Autocomplete from Document'),
QKeySequence(QApplication.translate('ViewManager', "Ctrl+Shift+Space",
"Edit|Autocomplete from Document")),
0, self.editActGrp, 'vm_edit_autocomplete_from_document')
self.autoCompleteFromDocAct.setStatusTip(QApplication.translate('ViewManager',
'Autocomplete current word from Document'))
self.autoCompleteFromDocAct.setWhatsThis(QApplication.translate('ViewManager',
"""Autocomplete from Document"""
"""Performs an autocompletion from document of the word"""
""" containing the cursor.
"""
))
self.connect(self.autoCompleteFromDocAct, SIGNAL('triggered()'),
self.__editAutoCompleteFromDoc)
self.editActions.append(self.autoCompleteFromDocAct)
self.autoCompleteFromAPIsAct = E4Action(QApplication.translate('ViewManager',
'Autocomplete from APIs'),
QApplication.translate('ViewManager', 'Autocomplete from APIs'),
QKeySequence(QApplication.translate('ViewManager', "Ctrl+Alt+Space",
"Edit|Autocomplete from APIs")),
0, self.editActGrp, 'vm_edit_autocomplete_from_api')
self.autoCompleteFromAPIsAct.setStatusTip(QApplication.translate('ViewManager',
'Autocomplete current word from APIs'))
self.autoCompleteFromAPIsAct.setWhatsThis(QApplication.translate('ViewManager',
"""Autocomplete from APIs"""
"""Performs an autocompletion from APIs of the word containing"""
""" the cursor.
"""
))
self.connect(self.autoCompleteFromAPIsAct, SIGNAL('triggered()'),
self.__editAutoCompleteFromAPIs)
self.editActions.append(self.autoCompleteFromAPIsAct)
self.autoCompleteFromAllAct = E4Action(\
QApplication.translate('ViewManager',
'Autocomplete from Document and APIs'),
QApplication.translate('ViewManager',
'Autocomplete from Document and APIs'),
QKeySequence(QApplication.translate('ViewManager', "Alt+Shift+Space",
"Edit|Autocomplete from Document and APIs")),
0, self.editActGrp, 'vm_edit_autocomplete_from_all')
self.autoCompleteFromAllAct.setStatusTip(QApplication.translate('ViewManager',
'Autocomplete current word from Document and APIs'))
self.autoCompleteFromAllAct.setWhatsThis(QApplication.translate('ViewManager',
"""Autocomplete from Document and APIs"""
"""Performs an autocompletion from document and APIs"""
""" of the word containing the cursor.
"""
))
self.connect(self.autoCompleteFromAllAct, SIGNAL('triggered()'),
self.__editAutoCompleteFromAll)
self.editActions.append(self.autoCompleteFromAllAct)
self.calltipsAct = E4Action(QApplication.translate('ViewManager',
'Calltip'),
QApplication.translate('ViewManager', '&Calltip'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Space", "Edit|Calltip")),
0,
self.editActGrp, 'vm_edit_calltip')
self.calltipsAct.setStatusTip(QApplication.translate('ViewManager',
'Show Calltips'))
self.calltipsAct.setWhatsThis(QApplication.translate('ViewManager',
"""Calltip"""
"""Show calltips based on the characters immediately to the"""
""" left of the cursor.
"""
))
self.connect(self.calltipsAct, SIGNAL('triggered()'), self.__editShowCallTips)
self.editActions.append(self.calltipsAct)
self.editActGrp.setEnabled(False)
self.copyActGrp.setEnabled(False)
####################################################################
## Below follow the actions for QScintilla standard commands.
####################################################################
self.esm = QSignalMapper(self)
self.connect(self.esm, SIGNAL('mapped(int)'), self.__editorCommand)
self.editorActGrp = createActionGroup(self.editActGrp)
act = E4Action(QApplication.translate('ViewManager', 'Move left one character'),
QApplication.translate('ViewManager', 'Move left one character'),
QKeySequence(QApplication.translate('ViewManager', 'Left')), 0,
self.editorActGrp, 'vm_edit_move_left_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+B')))
self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move right one character'),
QApplication.translate('ViewManager', 'Move right one character'),
QKeySequence(QApplication.translate('ViewManager', 'Right')), 0,
self.editorActGrp, 'vm_edit_move_right_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+F')))
self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move up one line'),
QApplication.translate('ViewManager', 'Move up one line'),
QKeySequence(QApplication.translate('ViewManager', 'Up')), 0,
self.editorActGrp, 'vm_edit_move_up_line')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+P')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEUP)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move down one line'),
QApplication.translate('ViewManager', 'Move down one line'),
QKeySequence(QApplication.translate('ViewManager', 'Down')), 0,
self.editorActGrp, 'vm_edit_move_down_line')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+N')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWN)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move left one word part'),
QApplication.translate('ViewManager', 'Move left one word part'),
0, 0,
self.editorActGrp, 'vm_edit_move_left_word_part')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Left')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move right one word part'),
QApplication.translate('ViewManager', 'Move right one word part'),
0, 0,
self.editorActGrp, 'vm_edit_move_right_word_part')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move left one word'),
QApplication.translate('ViewManager', 'Move left one word'),
0, 0,
self.editorActGrp, 'vm_edit_move_left_word')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Left')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Left')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move right one word'),
QApplication.translate('ViewManager', 'Move right one word'),
0, 0,
self.editorActGrp, 'vm_edit_move_right_word')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Move to first visible character in document line'),
QApplication.translate('ViewManager',
'Move to first visible character in document line'),
0, 0,
self.editorActGrp, 'vm_edit_move_first_visible_char')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Home')))
self.esm.setMapping(act, QsciScintilla.SCI_VCHOME)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Move to start of display line'),
QApplication.translate('ViewManager',
'Move to start of display line'),
0, 0,
self.editorActGrp, 'vm_edit_move_start_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Left')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Home')))
self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAY)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Move to end of document line'),
QApplication.translate('ViewManager',
'Move to end of document line'),
0, 0,
self.editorActGrp, 'vm_edit_move_end_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+E')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'End')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Scroll view down one line'),
QApplication.translate('ViewManager', 'Scroll view down one line'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Down')), 0,
self.editorActGrp, 'vm_edit_scroll_down_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLDOWN)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Scroll view up one line'),
QApplication.translate('ViewManager', 'Scroll view up one line'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Up')), 0,
self.editorActGrp, 'vm_edit_scroll_up_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINESCROLLUP)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move up one paragraph'),
QApplication.translate('ViewManager', 'Move up one paragraph'),
QKeySequence(QApplication.translate('ViewManager', 'Alt+Up')), 0,
self.editorActGrp, 'vm_edit_move_up_para')
self.esm.setMapping(act, QsciScintilla.SCI_PARAUP)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move down one paragraph'),
QApplication.translate('ViewManager', 'Move down one paragraph'),
QKeySequence(QApplication.translate('ViewManager', 'Alt+Down')), 0,
self.editorActGrp, 'vm_edit_move_down_para')
self.esm.setMapping(act, QsciScintilla.SCI_PARADOWN)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move up one page'),
QApplication.translate('ViewManager', 'Move up one page'),
QKeySequence(QApplication.translate('ViewManager', 'PgUp')), 0,
self.editorActGrp, 'vm_edit_move_up_page')
self.esm.setMapping(act, QsciScintilla.SCI_PAGEUP)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move down one page'),
QApplication.translate('ViewManager', 'Move down one page'),
QKeySequence(QApplication.translate('ViewManager', 'PgDown')), 0,
self.editorActGrp, 'vm_edit_move_down_page')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+V')))
self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWN)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move to start of document'),
QApplication.translate('ViewManager', 'Move to start of document'),
0, 0,
self.editorActGrp, 'vm_edit_move_start_text')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Up')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Home')))
self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTART)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Move to end of document'),
QApplication.translate('ViewManager', 'Move to end of document'),
0, 0,
self.editorActGrp, 'vm_edit_move_end_text')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Down')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+End')))
self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Indent one level'),
QApplication.translate('ViewManager', 'Indent one level'),
QKeySequence(QApplication.translate('ViewManager', 'Tab')), 0,
self.editorActGrp, 'vm_edit_indent_one_level')
self.esm.setMapping(act, QsciScintilla.SCI_TAB)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Unindent one level'),
QApplication.translate('ViewManager', 'Unindent one level'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Tab')), 0,
self.editorActGrp, 'vm_edit_unindent_one_level')
self.esm.setMapping(act, QsciScintilla.SCI_BACKTAB)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection left one character'),
QApplication.translate('ViewManager',
'Extend selection left one character'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Left')),
0,
self.editorActGrp, 'vm_edit_extend_selection_left_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+B')))
self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection right one character'),
QApplication.translate('ViewManager',
'Extend selection right one character'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Right')),
0,
self.editorActGrp, 'vm_edit_extend_selection_right_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+F')))
self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection up one line'),
QApplication.translate('ViewManager',
'Extend selection up one line'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Up')), 0,
self.editorActGrp, 'vm_edit_extend_selection_up_line')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+P')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEUPEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection down one line'),
QApplication.translate('ViewManager',
'Extend selection down one line'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Down')),
0,
self.editorActGrp, 'vm_edit_extend_selection_down_line')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+N')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection left one word part'),
QApplication.translate('ViewManager',
'Extend selection left one word part'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_left_word_part')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+Left')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTLEFTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection right one word part'),
QApplication.translate('ViewManager',
'Extend selection right one word part'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_right_word_part')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDPARTRIGHTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection left one word'),
QApplication.translate('ViewManager',
'Extend selection left one word'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_left_word')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+Left')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Left')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection right one word'),
QApplication.translate('ViewManager',
'Extend selection right one word'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_right_word')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+Right')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to first visible character in document line'),
QApplication.translate('ViewManager',
'Extend selection to first visible character in document line'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_first_visible_char')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Shift+Home')))
self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to end of document line'),
QApplication.translate('ViewManager',
'Extend selection to end of document line'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_end_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+E')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Shift+End')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEENDEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection up one paragraph'),
QApplication.translate('ViewManager',
'Extend selection up one paragraph'),
QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+Up')),
0,
self.editorActGrp, 'vm_edit_extend_selection_up_para')
self.esm.setMapping(act, QsciScintilla.SCI_PARAUPEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection down one paragraph'),
QApplication.translate('ViewManager',
'Extend selection down one paragraph'),
QKeySequence(QApplication.translate('ViewManager',
'Alt+Shift+Down')),
0,
self.editorActGrp, 'vm_edit_extend_selection_down_para')
self.esm.setMapping(act, QsciScintilla.SCI_PARADOWNEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection up one page'),
QApplication.translate('ViewManager',
'Extend selection up one page'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+PgUp')),
0,
self.editorActGrp, 'vm_edit_extend_selection_up_page')
self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection down one page'),
QApplication.translate('ViewManager',
'Extend selection down one page'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+PgDown')),
0,
self.editorActGrp, 'vm_edit_extend_selection_down_page')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+V')))
self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to start of document'),
QApplication.translate('ViewManager',
'Extend selection to start of document'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_start_text')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Up')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Home')))
self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTSTARTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to end of document'),
QApplication.translate('ViewManager',
'Extend selection to end of document'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_end_text')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Down')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+End')))
self.esm.setMapping(act, QsciScintilla.SCI_DOCUMENTENDEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Delete previous character'),
QApplication.translate('ViewManager', 'Delete previous character'),
QKeySequence(QApplication.translate('ViewManager', 'Backspace')),
0,
self.editorActGrp, 'vm_edit_delete_previous_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+H')))
else:
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Shift+Backspace')))
self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACK)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Delete previous character if not at start of line'),
QApplication.translate('ViewManager',
'Delete previous character if not at start of line'),
0, 0,
self.editorActGrp, 'vm_edit_delet_previous_char_not_line_start')
self.esm.setMapping(act, QsciScintilla.SCI_DELETEBACKNOTLINE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Delete current character'),
QApplication.translate('ViewManager', 'Delete current character'),
QKeySequence(QApplication.translate('ViewManager', 'Del')), 0,
self.editorActGrp, 'vm_edit_delete_current_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+D')))
self.esm.setMapping(act, QsciScintilla.SCI_CLEAR)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Delete word to left'),
QApplication.translate('ViewManager', 'Delete word to left'),
QKeySequence(QApplication.translate('ViewManager',
'Ctrl+Backspace')),
0,
self.editorActGrp, 'vm_edit_delete_word_left')
self.esm.setMapping(act, QsciScintilla.SCI_DELWORDLEFT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Delete word to right'),
QApplication.translate('ViewManager', 'Delete word to right'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Del')), 0,
self.editorActGrp, 'vm_edit_delete_word_right')
self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Delete line to left'),
QApplication.translate('ViewManager', 'Delete line to left'),
QKeySequence(QApplication.translate('ViewManager',
'Ctrl+Shift+Backspace')),
0,
self.editorActGrp, 'vm_edit_delete_line_left')
self.esm.setMapping(act, QsciScintilla.SCI_DELLINELEFT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Delete line to right'),
QApplication.translate('ViewManager', 'Delete line to right'),
0, 0,
self.editorActGrp, 'vm_edit_delete_line_right')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+K')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Del')))
self.esm.setMapping(act, QsciScintilla.SCI_DELLINERIGHT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Insert new line'),
QApplication.translate('ViewManager', 'Insert new line'),
QKeySequence(QApplication.translate('ViewManager', 'Return')),
QKeySequence(QApplication.translate('ViewManager', 'Enter')),
self.editorActGrp, 'vm_edit_insert_line')
self.esm.setMapping(act, QsciScintilla.SCI_NEWLINE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Insert new line below current line'),
QApplication.translate('ViewManager',
'Insert new line below current line'),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Return')),
QKeySequence(QApplication.translate('ViewManager', 'Shift+Enter')),
self.editorActGrp, 'vm_edit_insert_line_below')
self.connect(act, SIGNAL('triggered()'), self.__newLineBelow)
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Delete current line'),
QApplication.translate('ViewManager', 'Delete current line'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+L')),
0,
self.editorActGrp, 'vm_edit_delete_current_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINEDELETE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Duplicate current line'),
QApplication.translate('ViewManager', 'Duplicate current line'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+D')), 0,
self.editorActGrp, 'vm_edit_duplicate_current_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINEDUPLICATE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Swap current and previous lines'),
QApplication.translate('ViewManager',
'Swap current and previous lines'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+T')), 0,
self.editorActGrp, 'vm_edit_swap_current_previous_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINETRANSPOSE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Cut current line'),
QApplication.translate('ViewManager', 'Cut current line'),
QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+L')),
0,
self.editorActGrp, 'vm_edit_cut_current_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINECUT)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Copy current line'),
QApplication.translate('ViewManager', 'Copy current line'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+T')),
0,
self.editorActGrp, 'vm_edit_copy_current_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINECOPY)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Toggle insert/overtype'),
QApplication.translate('ViewManager', 'Toggle insert/overtype'),
QKeySequence(QApplication.translate('ViewManager', 'Ins')), 0,
self.editorActGrp, 'vm_edit_toggle_insert_overtype')
self.esm.setMapping(act, QsciScintilla.SCI_EDITTOGGLEOVERTYPE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Convert selection to lower case'),
QApplication.translate('ViewManager',
'Convert selection to lower case'),
QKeySequence(QApplication.translate('ViewManager', 'Alt+Shift+U')),
0,
self.editorActGrp, 'vm_edit_convert_selection_lower')
self.esm.setMapping(act, QsciScintilla.SCI_LOWERCASE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Convert selection to upper case'),
QApplication.translate('ViewManager',
'Convert selection to upper case'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+U')),
0,
self.editorActGrp, 'vm_edit_convert_selection_upper')
self.esm.setMapping(act, QsciScintilla.SCI_UPPERCASE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Move to end of display line'),
QApplication.translate('ViewManager',
'Move to end of display line'),
0, 0,
self.editorActGrp, 'vm_edit_move_end_displayed_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Right')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+End')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAY)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to end of display line'),
QApplication.translate('ViewManager',
'Extend selection to end of display line'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_end_displayed_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEENDDISPLAYEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Formfeed'),
QApplication.translate('ViewManager', 'Formfeed'),
0, 0,
self.editorActGrp, 'vm_edit_formfeed')
self.esm.setMapping(act, QsciScintilla.SCI_FORMFEED)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager', 'Escape'),
QApplication.translate('ViewManager', 'Escape'),
QKeySequence(QApplication.translate('ViewManager', 'Esc')), 0,
self.editorActGrp, 'vm_edit_escape')
self.esm.setMapping(act, QsciScintilla.SCI_CANCEL)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection down one line'),
QApplication.translate('ViewManager',
'Extend rectangular selection down one line'),
QKeySequence(QApplication.translate('ViewManager',
'Alt+Ctrl+Down')),
0,
self.editorActGrp, 'vm_edit_extend_rect_selection_down_line')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+N')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEDOWNRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection up one line'),
QApplication.translate('ViewManager',
'Extend rectangular selection up one line'),
QKeySequence(QApplication.translate('ViewManager', 'Alt+Ctrl+Up')),
0,
self.editorActGrp, 'vm_edit_extend_rect_selection_up_line')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+P')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEUPRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection left one character'),
QApplication.translate('ViewManager',
'Extend rectangular selection left one character'),
QKeySequence(QApplication.translate('ViewManager',
'Alt+Ctrl+Left')),
0,
self.editorActGrp, 'vm_edit_extend_rect_selection_left_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+B')))
self.esm.setMapping(act, QsciScintilla.SCI_CHARLEFTRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection right one character'),
QApplication.translate('ViewManager',
'Extend rectangular selection right one character'),
QKeySequence(QApplication.translate('ViewManager',
'Alt+Ctrl+Right')),
0,
self.editorActGrp, 'vm_edit_extend_rect_selection_right_char')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+F')))
self.esm.setMapping(act, QsciScintilla.SCI_CHARRIGHTRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection to first'
' visible character in document line'),
QApplication.translate('ViewManager',
'Extend rectangular selection to first'
' visible character in document line'),
0, 0,
self.editorActGrp,
'vm_edit_extend_rect_selection_first_visible_char')
if not isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+Home')))
self.esm.setMapping(act, QsciScintilla.SCI_VCHOMERECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection to end of document line'),
QApplication.translate('ViewManager',
'Extend rectangular selection to end of document line'),
0, 0,
self.editorActGrp, 'vm_edit_extend_rect_selection_end_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+E')))
else:
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+End')))
self.esm.setMapping(act, QsciScintilla.SCI_LINEENDRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection up one page'),
QApplication.translate('ViewManager',
'Extend rectangular selection up one page'),
QKeySequence(QApplication.translate('ViewManager',
'Alt+Shift+PgUp')),
0,
self.editorActGrp, 'vm_edit_extend_rect_selection_up_page')
self.esm.setMapping(act, QsciScintilla.SCI_PAGEUPRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection down one page'),
QApplication.translate('ViewManager',
'Extend rectangular selection down one page'),
QKeySequence(QApplication.translate('ViewManager',
'Alt+Shift+PgDown')),
0,
self.editorActGrp, 'vm_edit_extend_rect_selection_down_page')
if isMacPlatform():
act.setAlternateShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+V')))
self.esm.setMapping(act, QsciScintilla.SCI_PAGEDOWNRECTEXTEND)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
act = E4Action(QApplication.translate('ViewManager',
'Duplicate current selection'),
QApplication.translate('ViewManager',
'Duplicate current selection'),
QKeySequence(QApplication.translate('ViewManager', 'Ctrl+Shift+D')),
0,
self.editorActGrp, 'vm_edit_duplicate_current_selection')
self.esm.setMapping(act, QsciScintilla.SCI_SELECTIONDUPLICATE)
self.connect(act, SIGNAL('triggered()'), self.esm, SLOT('map()'))
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_SCROLLTOSTART"):
act = E4Action(QApplication.translate('ViewManager',
'Scroll to start of document'),
QApplication.translate('ViewManager',
'Scroll to start of document'),
0, 0,
self.editorActGrp, 'vm_edit_scroll_start_text')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Home')))
self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOSTART)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_SCROLLTOEND"):
act = E4Action(QApplication.translate('ViewManager',
'Scroll to end of document'),
QApplication.translate('ViewManager',
'Scroll to end of document'),
0, 0,
self.editorActGrp, 'vm_edit_scroll_end_text')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'End')))
self.esm.setMapping(act, QsciScintilla.SCI_SCROLLTOEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_VERTICALCENTRECARET"):
act = E4Action(QApplication.translate('ViewManager',
'Scroll vertically to center current line'),
QApplication.translate('ViewManager',
'Scroll vertically to center current line'),
0, 0,
self.editorActGrp, 'vm_edit_scroll_vertically_center')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+L')))
self.esm.setMapping(act, QsciScintilla.SCI_VERTICALCENTRECARET)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_WORDRIGHTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Move to end of next word'),
QApplication.translate('ViewManager',
'Move to end of next word'),
0, 0,
self.editorActGrp, 'vm_edit_move_end_next_word')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_WORDRIGHTENDEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to end of next word'),
QApplication.translate('ViewManager',
'Extend selection to end of next word'),
0, 0,
self.editorActGrp, 'vm_edit_select_end_next_word')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Shift+Right')))
self.esm.setMapping(act, QsciScintilla.SCI_WORDRIGHTENDEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_WORDLEFTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Move to end of previous word'),
QApplication.translate('ViewManager',
'Move to end of previous word'),
0, 0,
self.editorActGrp, 'vm_edit_move_end_previous_word')
self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_WORDLEFTENDEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to end of previous word'),
QApplication.translate('ViewManager',
'Extend selection to end of previous word'),
0, 0,
self.editorActGrp, 'vm_edit_select_end_previous_word')
self.esm.setMapping(act, QsciScintilla.SCI_WORDLEFTENDEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_HOME"):
act = E4Action(QApplication.translate('ViewManager',
'Move to start of document line'),
QApplication.translate('ViewManager',
'Move to start of document line'),
0, 0,
self.editorActGrp, 'vm_edit_move_start_document_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+A')))
self.esm.setMapping(act, QsciScintilla.SCI_HOME)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_HOMEEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to start of document line'),
QApplication.translate('ViewManager',
'Extend selection to start of document line'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_start_document_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Shift+A')))
self.esm.setMapping(act, QsciScintilla.SCI_HOME)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_HOMERECTEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend rectangular selection to start of document line'),
QApplication.translate('ViewManager',
'Extend rectangular selection to start of document line'),
0, 0,
self.editorActGrp, 'vm_edit_select_rect_start_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Meta+Alt+Shift+A')))
self.esm.setMapping(act, QsciScintilla.SCI_HOMERECTEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_HOMEDISPLAYEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to start of display line'),
QApplication.translate('ViewManager',
'Extend selection to start of display line'),
0, 0,
self.editorActGrp, 'vm_edit_extend_selection_start_display_line')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Ctrl+Shift+Left')))
self.esm.setMapping(act, QsciScintilla.SCI_HOMEDISPLAYEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_HOMEWRAP"):
act = E4Action(QApplication.translate('ViewManager',
'Move to start of display or document line'),
QApplication.translate('ViewManager',
'Move to start of display or document line'),
0, 0,
self.editorActGrp, 'vm_edit_move_start_display_document_line')
self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAP)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_HOMEWRAPEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to start of display or document line'),
QApplication.translate('ViewManager',
'Extend selection to start of display or document line'),
0, 0,
self.editorActGrp,
'vm_edit_extend_selection_start_display_document_line')
self.esm.setMapping(act, QsciScintilla.SCI_HOMEWRAPEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_VCHOMEWRAP"):
act = E4Action(QApplication.translate('ViewManager',
'Move to first visible character in display'
' or document line'),
QApplication.translate('ViewManager',
'Move to first visible character in display'
' or document line'),
0, 0,
self.editorActGrp,
'vm_edit_move_first_visible_char_document_line')
self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAP)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_VCHOMEWRAPEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to first visible character in'
' display or document line'),
QApplication.translate('ViewManager',
'Extend selection to first visible character in'
' display or document line'),
0, 0,
self.editorActGrp,
'vm_edit_extend_selection_first_visible_char_document_line')
self.esm.setMapping(act, QsciScintilla.SCI_VCHOMEWRAPEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_LINEENDWRAP"):
act = E4Action(QApplication.translate('ViewManager',
'Move to end of display or document line'),
QApplication.translate('ViewManager',
'Move to end of display or document line'),
0, 0,
self.editorActGrp, 'vm_edit_end_start_display_document_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAP)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_LINEENDWRAPEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Extend selection to end of display or document line'),
QApplication.translate('ViewManager',
'Extend selection to end of display or document line'),
0, 0,
self.editorActGrp,
'vm_edit_extend_selection_end_display_document_line')
self.esm.setMapping(act, QsciScintilla.SCI_LINEENDWRAPEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUP"):
act = E4Action(QApplication.translate('ViewManager',
'Stuttered move up one page'),
QApplication.translate('ViewManager',
'Stuttered move up one page'),
0, 0,
self.editorActGrp, 'vm_edit_stuttered_move_up_page')
self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUP)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEUPEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Stuttered extend selection up one page'),
QApplication.translate('ViewManager',
'Stuttered extend selection up one page'),
0, 0,
self.editorActGrp, 'vm_edit_stuttered_extend_selection_up_page')
self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEUPEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWN"):
act = E4Action(QApplication.translate('ViewManager',
'Stuttered move down one page'),
QApplication.translate('ViewManager',
'Stuttered move down one page'),
0, 0,
self.editorActGrp, 'vm_edit_stuttered_move_down_page')
self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWN)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_STUTTEREDPAGEDOWNEXTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Stuttered extend selection down one page'),
QApplication.translate('ViewManager',
'Stuttered extend selection down one page'),
0, 0,
self.editorActGrp, 'vm_edit_stuttered_extend_selection_down_page')
self.esm.setMapping(act, QsciScintilla.SCI_STUTTEREDPAGEDOWNEXTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_DELWORDRIGHTEND"):
act = E4Action(QApplication.translate('ViewManager',
'Delete right to end of next word'),
QApplication.translate('ViewManager',
'Delete right to end of next word'),
0, 0,
self.editorActGrp, 'vm_edit_delete_right_end_next_word')
if isMacPlatform():
act.setShortcut(QKeySequence(
QApplication.translate('ViewManager', 'Alt+Del')))
self.esm.setMapping(act, QsciScintilla.SCI_DELWORDRIGHTEND)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESUP"):
act = E4Action(QApplication.translate('ViewManager',
'Move selected lines up one line'),
QApplication.translate('ViewManager',
'Move selected lines up one line'),
0, 0,
self.editorActGrp, 'vm_edit_move_selection_up_one_line')
self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESUP)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
if hasattr(QsciScintilla, "SCI_MOVESELECTEDLINESDOWN"):
act = E4Action(QApplication.translate('ViewManager',
'Move selected lines down one line'),
QApplication.translate('ViewManager',
'Move selected lines down one line'),
0, 0,
self.editorActGrp, 'vm_edit_move_selection_down_one_line')
self.esm.setMapping(act, QsciScintilla.SCI_MOVESELECTEDLINESDOWN)
act.triggered[()].connect(self.esm.map)
self.editActions.append(act)
self.editorActGrp.setEnabled(False)
def initEditMenu(self):
"""
Public method to create the Edit menu
@return the generated menu
"""
autocompletionMenu = \
QMenu(QApplication.translate('ViewManager', '&Autocomplete'), self.ui)
autocompletionMenu.setTearOffEnabled(True)
autocompletionMenu.addAction(self.autoCompleteAct)
autocompletionMenu.addAction(self.autoCompleteFromDocAct)
autocompletionMenu.addAction(self.autoCompleteFromAPIsAct)
autocompletionMenu.addAction(self.autoCompleteFromAllAct)
autocompletionMenu.addSeparator()
autocompletionMenu.addAction(self.calltipsAct)
searchMenu = \
QMenu(QApplication.translate('ViewManager', '&Search'), self.ui)
searchMenu.setTearOffEnabled(True)
searchMenu.addAction(self.quickSearchAct)
searchMenu.addAction(self.quickSearchBackAct)
searchMenu.addAction(self.searchAct)
searchMenu.addAction(self.searchNextAct)
searchMenu.addAction(self.searchPrevAct)
searchMenu.addAction(self.replaceAct)
searchMenu.addSeparator()
searchMenu.addAction(self.searchClearMarkersAct)
searchMenu.addSeparator()
searchMenu.addAction(self.searchFilesAct)
searchMenu.addAction(self.replaceFilesAct)
menu = QMenu(QApplication.translate('ViewManager', '&Edit'), self.ui)
menu.setTearOffEnabled(True)
menu.addAction(self.undoAct)
menu.addAction(self.redoAct)
menu.addAction(self.revertAct)
menu.addSeparator()
menu.addAction(self.cutAct)
menu.addAction(self.copyAct)
menu.addAction(self.pasteAct)
menu.addAction(self.deleteAct)
menu.addSeparator()
menu.addAction(self.indentAct)
menu.addAction(self.unindentAct)
menu.addAction(self.smartIndentAct)
menu.addSeparator()
menu.addAction(self.commentAct)
menu.addAction(self.uncommentAct)
menu.addAction(self.streamCommentAct)
menu.addAction(self.boxCommentAct)
menu.addSeparator()
menu.addMenu(autocompletionMenu)
menu.addSeparator()
menu.addMenu(searchMenu)
menu.addSeparator()
menu.addAction(self.gotoAct)
menu.addAction(self.gotoBraceAct)
menu.addSeparator()
menu.addAction(self.selectBraceAct)
menu.addAction(self.selectAllAct)
menu.addAction(self.deselectAllAct)
menu.addSeparator()
menu.addAction(self.shortenEmptyAct)
menu.addAction(self.convertEOLAct)
return menu
def initEditToolbar(self, toolbarManager):
"""
Public method to create the Edit toolbar
@param toolbarManager reference to a toolbar manager object (E4ToolBarManager)
@return the generated toolbar
"""
tb = QToolBar(QApplication.translate('ViewManager', 'Edit'), self.ui)
tb.setIconSize(UI.Config.ToolBarIconSize)
tb.setObjectName("EditToolbar")
tb.setToolTip(QApplication.translate('ViewManager', 'Edit'))
tb.addAction(self.undoAct)
tb.addAction(self.redoAct)
tb.addSeparator()
tb.addAction(self.cutAct)
tb.addAction(self.copyAct)
tb.addAction(self.pasteAct)
tb.addAction(self.deleteAct)
tb.addSeparator()
tb.addAction(self.indentAct)
tb.addAction(self.unindentAct)
tb.addSeparator()
tb.addAction(self.commentAct)
tb.addAction(self.uncommentAct)
toolbarManager.addToolBar(tb, tb.windowTitle())
toolbarManager.addAction(self.smartIndentAct, tb.windowTitle())
return tb
##################################################################
## Initialize the search related actions and the search toolbar
##################################################################
def __initSearchActions(self):
"""
Private method defining the user interface actions for the search commands.
"""
self.searchActGrp = createActionGroup(self)
self.searchAct = E4Action(QApplication.translate('ViewManager', 'Search'),
UI.PixmapCache.getIcon("find.png"),
QApplication.translate('ViewManager', '&Search...'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+F", "Search|Search")),
0,
self.searchActGrp, 'vm_search')
self.searchAct.setStatusTip(QApplication.translate('ViewManager',
'Search for a text'))
self.searchAct.setWhatsThis(QApplication.translate('ViewManager',
"""Search"""
"""Search for some text in the current editor. A"""
""" dialog is shown to enter the searchtext and options"""
""" for the search.
"""
))
self.connect(self.searchAct, SIGNAL('triggered()'), self.__search)
self.searchActions.append(self.searchAct)
self.searchNextAct = E4Action(QApplication.translate('ViewManager',
'Search next'),
UI.PixmapCache.getIcon("findNext.png"),
QApplication.translate('ViewManager', 'Search &next'),
QKeySequence(QApplication.translate('ViewManager',
"F3", "Search|Search next")),
0,
self.searchActGrp, 'vm_search_next')
self.searchNextAct.setStatusTip(QApplication.translate('ViewManager',
'Search next occurrence of text'))
self.searchNextAct.setWhatsThis(QApplication.translate('ViewManager',
"""Search next"""
"""Search the next occurrence of some text in the current editor."""
""" The previously entered searchtext and options are reused.
"""
))
self.connect(self.searchNextAct, SIGNAL('triggered()'), self.searchDlg.findNext)
self.searchActions.append(self.searchNextAct)
self.searchPrevAct = E4Action(QApplication.translate('ViewManager',
'Search previous'),
UI.PixmapCache.getIcon("findPrev.png"),
QApplication.translate('ViewManager', 'Search &previous'),
QKeySequence(QApplication.translate('ViewManager',
"Shift+F3", "Search|Search previous")),
0,
self.searchActGrp, 'vm_search_previous')
self.searchPrevAct.setStatusTip(QApplication.translate('ViewManager',
'Search previous occurrence of text'))
self.searchPrevAct.setWhatsThis(QApplication.translate('ViewManager',
"""Search previous"""
"""Search the previous occurrence of some text in the current editor."""
""" The previously entered searchtext and options are reused.
"""
))
self.connect(self.searchPrevAct, SIGNAL('triggered()'), self.searchDlg.findPrev)
self.searchActions.append(self.searchPrevAct)
self.searchClearMarkersAct = E4Action(QApplication.translate('ViewManager',
'Clear search markers'),
UI.PixmapCache.getIcon("findClear.png"),
QApplication.translate('ViewManager', 'Clear search markers'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+3", "Search|Clear search markers")),
0,
self.searchActGrp, 'vm_clear_search_markers')
self.searchClearMarkersAct.setStatusTip(QApplication.translate('ViewManager',
'Clear all displayed search markers'))
self.searchClearMarkersAct.setWhatsThis(QApplication.translate('ViewManager',
"""Clear search markers"""
"""Clear all displayed search markers.
"""
))
self.connect(self.searchClearMarkersAct, SIGNAL('triggered()'),
self.__searchClearMarkers)
self.searchActions.append(self.searchClearMarkersAct)
self.replaceAct = E4Action(QApplication.translate('ViewManager', 'Replace'),
QApplication.translate('ViewManager', '&Replace...'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+R", "Search|Replace")),
0,
self.searchActGrp, 'vm_search_replace')
self.replaceAct.setStatusTip(QApplication.translate('ViewManager',
'Replace some text'))
self.replaceAct.setWhatsThis(QApplication.translate('ViewManager',
"""Replace"""
"""Search for some text in the current editor and replace it. A"""
""" dialog is shown to enter the searchtext, the replacement text"""
""" and options for the search and replace.
"""
))
self.connect(self.replaceAct, SIGNAL('triggered()'), self.__replace)
self.searchActions.append(self.replaceAct)
self.quickSearchAct = E4Action(QApplication.translate('ViewManager',
'Quicksearch'),
UI.PixmapCache.getIcon("quickFindNext.png"),
QApplication.translate('ViewManager', '&Quicksearch'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Shift+K", "Search|Quicksearch")),
0,
self.searchActGrp, 'vm_quicksearch')
self.quickSearchAct.setStatusTip(QApplication.translate('ViewManager',
'Perform a quicksearch'))
self.quickSearchAct.setWhatsThis(QApplication.translate('ViewManager',
"""Quicksearch"""
"""This activates the quicksearch function of the IDE by"""
""" giving focus to the quicksearch entry field. If this field"""
""" is already active and contains text, it searches for the"""
""" next occurrence of this text.
"""
))
self.connect(self.quickSearchAct, SIGNAL('triggered()'), self.__quickSearch)
self.searchActions.append(self.quickSearchAct)
self.quickSearchBackAct = E4Action(QApplication.translate('ViewManager',
'Quicksearch backwards'),
UI.PixmapCache.getIcon("quickFindPrev.png"),
QApplication.translate('ViewManager', 'Quicksearch &backwards'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Shift+J", "Search|Quicksearch backwards")),
0, self.searchActGrp, 'vm_quicksearch_backwards')
self.quickSearchBackAct.setStatusTip(QApplication.translate('ViewManager',
'Perform a quicksearch backwards'))
self.quickSearchBackAct.setWhatsThis(QApplication.translate('ViewManager',
"""Quicksearch backwards"""
"""This searches the previous occurrence of the quicksearch text.
"""
))
self.connect(self.quickSearchBackAct, SIGNAL('triggered()'),
self.__quickSearchPrev)
self.searchActions.append(self.quickSearchBackAct)
self.quickSearchExtendAct = E4Action(QApplication.translate('ViewManager',
'Quicksearch extend'),
UI.PixmapCache.getIcon("quickFindExtend.png"),
QApplication.translate('ViewManager', 'Quicksearch e&xtend'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Shift+H", "Search|Quicksearch extend")),
0,
self.searchActGrp, 'vm_quicksearch_extend')
self.quickSearchExtendAct.setStatusTip(QApplication.translate('ViewManager', \
'Extend the quicksearch to the end of the current word'))
self.quickSearchExtendAct.setWhatsThis(QApplication.translate('ViewManager',
"""Quicksearch extend"""
"""This extends the quicksearch text to the end of the word"""
""" currently found.
"""
))
self.connect(self.quickSearchExtendAct, SIGNAL('triggered()'),
self.__quickSearchExtend)
self.searchActions.append(self.quickSearchExtendAct)
self.gotoAct = E4Action(QApplication.translate('ViewManager', 'Goto Line'),
UI.PixmapCache.getIcon("goto.png"),
QApplication.translate('ViewManager', '&Goto Line...'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+G", "Search|Goto Line")),
0,
self.searchActGrp, 'vm_search_goto_line')
self.gotoAct.setStatusTip(QApplication.translate('ViewManager', 'Goto Line'))
self.gotoAct.setWhatsThis(QApplication.translate('ViewManager',
"""Goto Line"""
"""Go to a specific line of text in the current editor."""
""" A dialog is shown to enter the linenumber.
"""
))
self.connect(self.gotoAct, SIGNAL('triggered()'), self.__goto)
self.searchActions.append(self.gotoAct)
self.gotoBraceAct = E4Action(QApplication.translate('ViewManager', 'Goto Brace'),
UI.PixmapCache.getIcon("gotoBrace.png"),
QApplication.translate('ViewManager', 'Goto &Brace'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+L", "Search|Goto Brace")),
0,
self.searchActGrp, 'vm_search_goto_brace')
self.gotoBraceAct.setStatusTip(QApplication.translate('ViewManager',
'Goto Brace'))
self.gotoBraceAct.setWhatsThis(QApplication.translate('ViewManager',
"""Goto Brace"""
"""Go to the matching brace in the current editor.
"""
))
self.connect(self.gotoBraceAct, SIGNAL('triggered()'), self.__gotoBrace)
self.searchActions.append(self.gotoBraceAct)
self.searchActGrp.setEnabled(False)
self.searchFilesAct = E4Action(QApplication.translate('ViewManager',
'Search in Files'),
UI.PixmapCache.getIcon("projectFind.png"),
QApplication.translate('ViewManager', 'Search in &Files...'),
QKeySequence(QApplication.translate('ViewManager',
"Shift+Ctrl+F", "Search|Search Files")),
0,
self, 'vm_search_in_files')
self.searchFilesAct.setStatusTip(QApplication.translate('ViewManager',
'Search for a text in files'))
self.searchFilesAct.setWhatsThis(QApplication.translate('ViewManager',
"""Search in Files"""
"""Search for some text in the files of a directory tree"""
""" or the project. A dialog is shown to enter the searchtext"""
""" and options for the search and to display the result.
"""
))
self.connect(self.searchFilesAct, SIGNAL('triggered()'), self.__searchFiles)
self.searchActions.append(self.searchFilesAct)
self.replaceFilesAct = E4Action(QApplication.translate('ViewManager',
'Replace in Files'),
QApplication.translate('ViewManager', 'Replace in F&iles...'),
QKeySequence(QApplication.translate('ViewManager',
"Shift+Ctrl+R", "Search|Replace in Files")),
0,
self, 'vm_replace_in_files')
self.replaceFilesAct.setStatusTip(QApplication.translate('ViewManager',
'Search for a text in files and replace it'))
self.replaceFilesAct.setWhatsThis(QApplication.translate('ViewManager',
"""Replace in Files"""
"""Search for some text in the files of a directory tree"""
""" or the project and replace it. A dialog is shown to enter"""
""" the searchtext, the replacement text and options for the"""
""" search and to display the result.
"""
))
self.connect(self.replaceFilesAct, SIGNAL('triggered()'), self.__replaceFiles)
self.searchActions.append(self.replaceFilesAct)
def initSearchToolbars(self, toolbarManager):
"""
Public method to create the Search toolbars
@param toolbarManager reference to a toolbar manager object (E4ToolBarManager)
@return a tuple of the generated toolbar (search, quicksearch)
"""
qtb = QToolBar(QApplication.translate('ViewManager', 'Quicksearch'), self.ui)
qtb.setIconSize(UI.Config.ToolBarIconSize)
qtb.setObjectName("QuicksearchToolbar")
qtb.setToolTip(QApplication.translate('ViewManager', 'Quicksearch'))
self.quickFindLineEdit = QuickSearchLineEdit(self)
self.quickFindtextCombo = QComboBox(self)
self.quickFindtextCombo.setEditable(True)
self.quickFindtextCombo.setLineEdit(self.quickFindLineEdit)
self.quickFindtextCombo.setDuplicatesEnabled(False)
self.quickFindtextCombo.setInsertPolicy(QComboBox.InsertAtTop)
self.quickFindtextCombo.lastActive = None
self.quickFindtextCombo.lastCursorPos = None
self.quickFindtextCombo.leForegroundColor = \
self.quickFindtextCombo.lineEdit().palette().color(QPalette.Text)
self.quickFindtextCombo.leBackgroundColor = \
self.quickFindtextCombo.lineEdit().palette().color(QPalette.Base)
self.quickFindtextCombo.lastSearchText = QString()
self.quickFindtextCombo._editor = self.quickFindtextCombo.lineEdit()
# this allows us not to jump across searched text
# just because of autocompletion enabled
self.quickFindtextCombo.setAutoCompletion(False)
self.quickFindtextCombo.setMinimumWidth(250)
self.quickFindtextCombo.addItem("")
self.quickFindtextCombo.setWhatsThis(QApplication.translate('ViewManager',
"""Enter the searchtext directly into this field."""
""" The search will be performed case insensitive."""
""" The quicksearch function is activated upon activation"""
""" of the quicksearch next action (default key Ctrl+Shift+K),"""
""" if this entry field does not have the input focus."""
""" Otherwise it searches for the next occurrence of the"""
""" text entered. The quicksearch backwards action"""
""" (default key Ctrl+Shift+J) searches backward."""
""" Activating the 'quicksearch extend' action"""
""" (default key Ctrl+Shift+H) extends the current"""
""" searchtext to the end of the currently found word."""
""" The quicksearch can be ended by pressing the Return key"""
""" while the quicksearch entry has the the input focus.
"""
))
self.connect(self.quickFindtextCombo._editor, SIGNAL('returnPressed()'),
self.__quickSearchEnter)
self.connect(self.quickFindtextCombo._editor,
SIGNAL('textChanged(const QString&)'), self.__quickSearchText)
self.connect(self.quickFindtextCombo._editor, SIGNAL('escPressed()'),
self.__quickSearchEscape)
self.connect(self.quickFindtextCombo._editor, SIGNAL('gotFocus()'),
self.__quickSearchFocusIn)
self.quickFindtextAction = QWidgetAction(self)
self.quickFindtextAction.setDefaultWidget(self.quickFindtextCombo)
self.quickFindtextAction.setObjectName("vm_quickfindtext_action")
self.quickFindtextAction.setText(self.trUtf8("Quicksearch Textedit"))
qtb.addAction(self.quickFindtextAction)
qtb.addAction(self.quickSearchAct)
qtb.addAction(self.quickSearchBackAct)
qtb.addAction(self.quickSearchExtendAct)
self.quickFindtextCombo.setEnabled(False)
self.__quickSearchToolbar = qtb
self.__quickSearchToolbarVisibility = None
tb = QToolBar(QApplication.translate('ViewManager', 'Search'), self.ui)
tb.setIconSize(UI.Config.ToolBarIconSize)
tb.setObjectName("SearchToolbar")
tb.setToolTip(QApplication.translate('ViewManager', 'Search'))
tb.addAction(self.searchAct)
tb.addAction(self.searchNextAct)
tb.addAction(self.searchPrevAct)
tb.addSeparator()
tb.addAction(self.searchClearMarkersAct)
tb.addSeparator()
tb.addAction(self.searchFilesAct)
tb.setAllowedAreas(Qt.ToolBarAreas(Qt.TopToolBarArea | Qt.BottomToolBarArea))
toolbarManager.addToolBar(qtb, qtb.windowTitle())
toolbarManager.addToolBar(tb, tb.windowTitle())
toolbarManager.addAction(self.gotoAct, tb.windowTitle())
toolbarManager.addAction(self.gotoBraceAct, tb.windowTitle())
return tb, qtb
##################################################################
## Initialize the view related actions, view menu and toolbar
##################################################################
def __initViewActions(self):
"""
Private method defining the user interface actions for the view commands.
"""
self.viewActGrp = createActionGroup(self)
self.viewFoldActGrp = createActionGroup(self)
self.zoomInAct = E4Action(QApplication.translate('ViewManager', 'Zoom in'),
UI.PixmapCache.getIcon("zoomIn.png"),
QApplication.translate('ViewManager', 'Zoom &in'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl++", "View|Zoom in")),
QKeySequence(QApplication.translate('ViewManager',
"Zoom In", "View|Zoom in")),
self.viewActGrp, 'vm_view_zoom_in')
self.zoomInAct.setStatusTip(QApplication.translate('ViewManager',
'Zoom in on the text'))
self.zoomInAct.setWhatsThis(QApplication.translate('ViewManager',
"""Zoom in"""
"""Zoom in on the text. This makes the text bigger.
"""
))
self.connect(self.zoomInAct, SIGNAL('triggered()'), self.__zoomIn)
self.viewActions.append(self.zoomInAct)
self.zoomOutAct = E4Action(QApplication.translate('ViewManager', 'Zoom out'),
UI.PixmapCache.getIcon("zoomOut.png"),
QApplication.translate('ViewManager', 'Zoom &out'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+-", "View|Zoom out")),
QKeySequence(QApplication.translate('ViewManager',
"Zoom Out", "View|Zoom out")),
self.viewActGrp, 'vm_view_zoom_out')
self.zoomOutAct.setStatusTip(QApplication.translate('ViewManager',
'Zoom out on the text'))
self.zoomOutAct.setWhatsThis(QApplication.translate('ViewManager',
"""Zoom out"""
"""Zoom out on the text. This makes the text smaller.
"""
))
self.connect(self.zoomOutAct, SIGNAL('triggered()'), self.__zoomOut)
self.viewActions.append(self.zoomOutAct)
self.zoomResetAct = E4Action(QApplication.translate('ViewManager', 'Zoom reset'),
UI.PixmapCache.getIcon("zoomReset.png"),
QApplication.translate('ViewManager', 'Zoom &reset'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+0", "View|Zoom reset")),
0,
self.viewActGrp, 'vm_view_zoom_reset')
self.zoomResetAct.setStatusTip(QApplication.translate('ViewManager',
'Reset the zoom of the text'))
self.zoomResetAct.setWhatsThis(QApplication.translate('ViewManager',
"""Zoom reset"""
"""Reset the zoom of the text. """
"""This sets the zoom factor to 100%.
"""
))
self.connect(self.zoomResetAct, SIGNAL('triggered()'), self.__zoomReset)
self.viewActions.append(self.zoomResetAct)
self.zoomToAct = E4Action(QApplication.translate('ViewManager', 'Zoom'),
UI.PixmapCache.getIcon("zoomTo.png"),
QApplication.translate('ViewManager', '&Zoom'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+#", "View|Zoom")),
0,
self.viewActGrp, 'vm_view_zoom')
self.zoomToAct.setStatusTip(QApplication.translate('ViewManager',
'Zoom the text'))
self.zoomToAct.setWhatsThis(QApplication.translate('ViewManager',
"""Zoom"""
"""Zoom the text. This opens a dialog where the"""
""" desired size can be entered.
"""
))
self.connect(self.zoomToAct, SIGNAL('triggered()'), self.__zoom)
self.viewActions.append(self.zoomToAct)
self.toggleAllAct = E4Action(QApplication.translate('ViewManager',
'Toggle all folds'),
QApplication.translate('ViewManager', 'Toggle &all folds'),
0, 0, self.viewFoldActGrp, 'vm_view_toggle_all_folds')
self.toggleAllAct.setStatusTip(QApplication.translate('ViewManager',
'Toggle all folds'))
self.toggleAllAct.setWhatsThis(QApplication.translate('ViewManager',
"""Toggle all folds"""
"""Toggle all folds of the current editor.
"""
))
self.connect(self.toggleAllAct, SIGNAL('triggered()'), self.__toggleAll)
self.viewActions.append(self.toggleAllAct)
self.toggleAllChildrenAct = \
E4Action(QApplication.translate('ViewManager',
'Toggle all folds (including children)'),
QApplication.translate('ViewManager',
'Toggle all &folds (including children)'),
0, 0, self.viewFoldActGrp, 'vm_view_toggle_all_folds_children')
self.toggleAllChildrenAct.setStatusTip(QApplication.translate('ViewManager',
'Toggle all folds (including children)'))
self.toggleAllChildrenAct.setWhatsThis(QApplication.translate('ViewManager',
"""Toggle all folds (including children)"""
"""Toggle all folds of the current editor including"""
""" all children.
"""
))
self.connect(self.toggleAllChildrenAct, SIGNAL('triggered()'),
self.__toggleAllChildren)
self.viewActions.append(self.toggleAllChildrenAct)
self.toggleCurrentAct = E4Action(QApplication.translate('ViewManager',
'Toggle current fold'),
QApplication.translate('ViewManager', 'Toggle ¤t fold'),
0, 0, self.viewFoldActGrp, 'vm_view_toggle_current_fold')
self.toggleCurrentAct.setStatusTip(QApplication.translate('ViewManager',
'Toggle current fold'))
self.toggleCurrentAct.setWhatsThis(QApplication.translate('ViewManager',
"""Toggle current fold"""
"""Toggle the folds of the current line of the current editor.
"""
))
self.connect(self.toggleCurrentAct, SIGNAL('triggered()'), self.__toggleCurrent)
self.viewActions.append(self.toggleCurrentAct)
self.unhighlightAct = E4Action(QApplication.translate('ViewManager',
'Remove all highlights'),
UI.PixmapCache.getIcon("unhighlight.png"),
QApplication.translate('ViewManager',
'Remove all highlights'),
0, 0, self, 'vm_view_unhighlight')
self.unhighlightAct.setStatusTip(QApplication.translate('ViewManager',
'Remove all highlights'))
self.unhighlightAct.setWhatsThis(QApplication.translate('ViewManager',
"""Remove all highlights"""
"""Remove the highlights of all editors.
"""
))
self.connect(self.unhighlightAct, SIGNAL('triggered()'), self.unhighlight)
self.viewActions.append(self.unhighlightAct)
self.splitViewAct = E4Action(QApplication.translate('ViewManager', 'Split view'),
UI.PixmapCache.getIcon("splitVertical.png"),
QApplication.translate('ViewManager', '&Split view'),
0, 0, self, 'vm_view_split_view')
self.splitViewAct.setStatusTip(QApplication.translate('ViewManager',
'Add a split to the view'))
self.splitViewAct.setWhatsThis(QApplication.translate('ViewManager',
"""Split view"""
"""Add a split to the view.
"""
))
self.connect(self.splitViewAct, SIGNAL('triggered()'), self.__splitView)
self.viewActions.append(self.splitViewAct)
self.splitOrientationAct = E4Action(QApplication.translate('ViewManager',
'Arrange horizontally'),
QApplication.translate('ViewManager',
'Arrange &horizontally'),
0, 0, self, 'vm_view_arrange_horizontally', True)
self.splitOrientationAct.setStatusTip(QApplication.translate('ViewManager',
'Arrange the splitted views horizontally'))
self.splitOrientationAct.setWhatsThis(QApplication.translate('ViewManager',
"""Arrange horizontally"""
"""Arrange the splitted views horizontally.
"""
))
self.splitOrientationAct.setChecked(False)
self.connect(self.splitOrientationAct, SIGNAL('toggled(bool)'),
self.__splitOrientation)
self.viewActions.append(self.splitOrientationAct)
self.splitRemoveAct = E4Action(QApplication.translate('ViewManager',
'Remove split'),
UI.PixmapCache.getIcon("remsplitVertical.png"),
QApplication.translate('ViewManager', '&Remove split'),
0, 0, self, 'vm_view_remove_split')
self.splitRemoveAct.setStatusTip(QApplication.translate('ViewManager',
'Remove the current split'))
self.splitRemoveAct.setWhatsThis(QApplication.translate('ViewManager',
"""Remove split"""
"""Remove the current split.
"""
))
self.connect(self.splitRemoveAct, SIGNAL('triggered()'), self.removeSplit)
self.viewActions.append(self.splitRemoveAct)
self.nextSplitAct = E4Action(QApplication.translate('ViewManager', 'Next split'),
QApplication.translate('ViewManager', '&Next split'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Alt+N", "View|Next split")),
0,
self, 'vm_next_split')
self.nextSplitAct.setStatusTip(QApplication.translate('ViewManager',
'Move to the next split'))
self.nextSplitAct.setWhatsThis(QApplication.translate('ViewManager',
"""Next split"""
"""Move to the next split.
"""
))
self.connect(self.nextSplitAct, SIGNAL('triggered()'), self.nextSplit)
self.viewActions.append(self.nextSplitAct)
self.prevSplitAct = E4Action(QApplication.translate('ViewManager',
'Previous split'),
QApplication.translate('ViewManager', '&Previous split'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+Alt+P", "View|Previous split")),
0, self, 'vm_previous_split')
self.prevSplitAct.setStatusTip(QApplication.translate('ViewManager',
'Move to the previous split'))
self.prevSplitAct.setWhatsThis(QApplication.translate('ViewManager',
"""Previous split"""
"""Move to the previous split.
"""
))
self.connect(self.prevSplitAct, SIGNAL('triggered()'), self.prevSplit)
self.viewActions.append(self.prevSplitAct)
self.viewActGrp.setEnabled(False)
self.viewFoldActGrp.setEnabled(False)
self.unhighlightAct.setEnabled(False)
self.splitViewAct.setEnabled(False)
self.splitOrientationAct.setEnabled(False)
self.splitRemoveAct.setEnabled(False)
self.nextSplitAct.setEnabled(False)
self.prevSplitAct.setEnabled(False)
def initViewMenu(self):
"""
Public method to create the View menu
@return the generated menu
"""
menu = QMenu(QApplication.translate('ViewManager', '&View'), self.ui)
menu.setTearOffEnabled(True)
menu.addActions(self.viewActGrp.actions())
menu.addSeparator()
menu.addActions(self.viewFoldActGrp.actions())
menu.addSeparator()
menu.addAction(self.unhighlightAct)
if self.canSplit():
menu.addSeparator()
menu.addAction(self.splitViewAct)
menu.addAction(self.splitOrientationAct)
menu.addAction(self.splitRemoveAct)
menu.addAction(self.nextSplitAct)
menu.addAction(self.prevSplitAct)
return menu
def initViewToolbar(self, toolbarManager):
"""
Public method to create the View toolbar
@param toolbarManager reference to a toolbar manager object (E4ToolBarManager)
@return the generated toolbar
"""
tb = QToolBar(QApplication.translate('ViewManager', 'View'), self.ui)
tb.setIconSize(UI.Config.ToolBarIconSize)
tb.setObjectName("ViewToolbar")
tb.setToolTip(QApplication.translate('ViewManager', 'View'))
tb.addActions(self.viewActGrp.actions())
toolbarManager.addToolBar(tb, tb.windowTitle())
toolbarManager.addAction(self.unhighlightAct, tb.windowTitle())
toolbarManager.addAction(self.splitViewAct, tb.windowTitle())
toolbarManager.addAction(self.splitRemoveAct, tb.windowTitle())
return tb
##################################################################
## Initialize the macro related actions and macro menu
##################################################################
def __initMacroActions(self):
"""
Private method defining the user interface actions for the macro commands.
"""
self.macroActGrp = createActionGroup(self)
self.macroStartRecAct = E4Action(QApplication.translate('ViewManager',
'Start Macro Recording'),
QApplication.translate('ViewManager',
'S&tart Macro Recording'),
0, 0, self.macroActGrp, 'vm_macro_start_recording')
self.macroStartRecAct.setStatusTip(QApplication.translate('ViewManager',
'Start Macro Recording'))
self.macroStartRecAct.setWhatsThis(QApplication.translate('ViewManager',
"""Start Macro Recording"""
"""Start recording editor commands into a new macro.
"""
))
self.connect(self.macroStartRecAct, SIGNAL('triggered()'),
self.__macroStartRecording)
self.macroActions.append(self.macroStartRecAct)
self.macroStopRecAct = E4Action(QApplication.translate('ViewManager',
'Stop Macro Recording'),
QApplication.translate('ViewManager',
'Sto&p Macro Recording'),
0, 0, self.macroActGrp, 'vm_macro_stop_recording')
self.macroStopRecAct.setStatusTip(QApplication.translate('ViewManager',
'Stop Macro Recording'))
self.macroStopRecAct.setWhatsThis(QApplication.translate('ViewManager',
"""Stop Macro Recording"""
"""Stop recording editor commands into a new macro.
"""
))
self.connect(self.macroStopRecAct, SIGNAL('triggered()'),
self.__macroStopRecording)
self.macroActions.append(self.macroStopRecAct)
self.macroRunAct = E4Action(QApplication.translate('ViewManager', 'Run Macro'),
QApplication.translate('ViewManager', '&Run Macro'),
0, 0, self.macroActGrp, 'vm_macro_run')
self.macroRunAct.setStatusTip(QApplication.translate('ViewManager', 'Run Macro'))
self.macroRunAct.setWhatsThis(QApplication.translate('ViewManager',
"""Run Macro"""
"""Run a previously recorded editor macro.
"""
))
self.connect(self.macroRunAct, SIGNAL('triggered()'), self.__macroRun)
self.macroActions.append(self.macroRunAct)
self.macroDeleteAct = E4Action(QApplication.translate('ViewManager',
'Delete Macro'),
QApplication.translate('ViewManager', '&Delete Macro'),
0, 0, self.macroActGrp, 'vm_macro_delete')
self.macroDeleteAct.setStatusTip(QApplication.translate('ViewManager',
'Delete Macro'))
self.macroDeleteAct.setWhatsThis(QApplication.translate('ViewManager',
"""Delete Macro"""
"""Delete a previously recorded editor macro.
"""
))
self.connect(self.macroDeleteAct, SIGNAL('triggered()'), self.__macroDelete)
self.macroActions.append(self.macroDeleteAct)
self.macroLoadAct = E4Action(QApplication.translate('ViewManager', 'Load Macro'),
QApplication.translate('ViewManager', '&Load Macro'),
0, 0, self.macroActGrp, 'vm_macro_load')
self.macroLoadAct.setStatusTip(QApplication.translate('ViewManager',
'Load Macro'))
self.macroLoadAct.setWhatsThis(QApplication.translate('ViewManager',
"""Load Macro"""
"""Load an editor macro from a file.
"""
))
self.connect(self.macroLoadAct, SIGNAL('triggered()'), self.__macroLoad)
self.macroActions.append(self.macroLoadAct)
self.macroSaveAct = E4Action(QApplication.translate('ViewManager', 'Save Macro'),
QApplication.translate('ViewManager', '&Save Macro'),
0, 0, self.macroActGrp, 'vm_macro_save')
self.macroSaveAct.setStatusTip(QApplication.translate('ViewManager',
'Save Macro'))
self.macroSaveAct.setWhatsThis(QApplication.translate('ViewManager',
"""Save Macro"""
"""Save a previously recorded editor macro to a file.
"""
))
self.connect(self.macroSaveAct, SIGNAL('triggered()'), self.__macroSave)
self.macroActions.append(self.macroSaveAct)
self.macroActGrp.setEnabled(False)
def initMacroMenu(self):
"""
Public method to create the Macro menu
@return the generated menu
"""
menu = QMenu(QApplication.translate('ViewManager', "&Macros"), self.ui)
menu.setTearOffEnabled(True)
menu.addActions(self.macroActGrp.actions())
return menu
#####################################################################
## Initialize the bookmark related actions, bookmark menu and toolbar
#####################################################################
def __initBookmarkActions(self):
"""
Private method defining the user interface actions for the bookmarks commands.
"""
self.bookmarkActGrp = createActionGroup(self)
self.bookmarkToggleAct = E4Action(QApplication.translate('ViewManager',
'Toggle Bookmark'),
UI.PixmapCache.getIcon("bookmarkToggle.png"),
QApplication.translate('ViewManager', '&Toggle Bookmark'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Ctrl+T", "Bookmark|Toggle")), 0,
self.bookmarkActGrp, 'vm_bookmark_toggle')
self.bookmarkToggleAct.setStatusTip(QApplication.translate('ViewManager',
'Toggle Bookmark'))
self.bookmarkToggleAct.setWhatsThis(QApplication.translate('ViewManager',
"""Toggle Bookmark"""
"""Toggle a bookmark at the current line of the current editor.
"""
))
self.connect(self.bookmarkToggleAct, SIGNAL('triggered()'), self.__toggleBookmark)
self.bookmarkActions.append(self.bookmarkToggleAct)
self.bookmarkNextAct = E4Action(QApplication.translate('ViewManager',
'Next Bookmark'),
UI.PixmapCache.getIcon("bookmarkNext.png"),
QApplication.translate('ViewManager', '&Next Bookmark'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+PgDown", "Bookmark|Next")), 0,
self.bookmarkActGrp, 'vm_bookmark_next')
self.bookmarkNextAct.setStatusTip(QApplication.translate('ViewManager',
'Next Bookmark'))
self.bookmarkNextAct.setWhatsThis(QApplication.translate('ViewManager',
"""Next Bookmark"""
"""Go to next bookmark of the current editor.
"""
))
self.connect(self.bookmarkNextAct, SIGNAL('triggered()'), self.__nextBookmark)
self.bookmarkActions.append(self.bookmarkNextAct)
self.bookmarkPreviousAct = E4Action(QApplication.translate('ViewManager',
'Previous Bookmark'),
UI.PixmapCache.getIcon("bookmarkPrevious.png"),
QApplication.translate('ViewManager', '&Previous Bookmark'),
QKeySequence(QApplication.translate('ViewManager',
"Ctrl+PgUp", "Bookmark|Previous")),
0, self.bookmarkActGrp, 'vm_bookmark_previous')
self.bookmarkPreviousAct.setStatusTip(QApplication.translate('ViewManager',
'Previous Bookmark'))
self.bookmarkPreviousAct.setWhatsThis(QApplication.translate('ViewManager',
"""Previous Bookmark"""
"""Go to previous bookmark of the current editor.
"""
))
self.connect(self.bookmarkPreviousAct, SIGNAL('triggered()'),
self.__previousBookmark)
self.bookmarkActions.append(self.bookmarkPreviousAct)
self.bookmarkClearAct = E4Action(QApplication.translate('ViewManager',
'Clear Bookmarks'),
QApplication.translate('ViewManager', '&Clear Bookmarks'),
QKeySequence(QApplication.translate('ViewManager',
"Alt+Ctrl+C", "Bookmark|Clear")),
0,
self.bookmarkActGrp, 'vm_bookmark_clear')
self.bookmarkClearAct.setStatusTip(QApplication.translate('ViewManager',
'Clear Bookmarks'))
self.bookmarkClearAct.setWhatsThis(QApplication.translate('ViewManager',
"""Clear Bookmarks"""
"""Clear bookmarks of all editors.
"""
))
self.connect(self.bookmarkClearAct, SIGNAL('triggered()'),
self.__clearAllBookmarks)
self.bookmarkActions.append(self.bookmarkClearAct)
self.syntaxErrorGotoAct = E4Action(QApplication.translate('ViewManager',
'Goto Syntax Error'),
UI.PixmapCache.getIcon("syntaxErrorGoto.png"),
QApplication.translate('ViewManager', '&Goto Syntax Error'),
0, 0,
self.bookmarkActGrp, 'vm_syntaxerror_goto')
self.syntaxErrorGotoAct.setStatusTip(QApplication.translate('ViewManager',
'Goto Syntax Error'))
self.syntaxErrorGotoAct.setWhatsThis(QApplication.translate('ViewManager',
"""Goto Syntax Error"""
"""Go to next syntax error of the current editor.
"""
))
self.connect(self.syntaxErrorGotoAct, SIGNAL('triggered()'), self.__gotoSyntaxError)
self.bookmarkActions.append(self.syntaxErrorGotoAct)
self.syntaxErrorClearAct = E4Action(QApplication.translate('ViewManager',
'Clear Syntax Errors'),
QApplication.translate('ViewManager', 'Clear &Syntax Errors'),
0, 0,
self.bookmarkActGrp, 'vm_syntaxerror_clear')
self.syntaxErrorClearAct.setStatusTip(QApplication.translate('ViewManager',
'Clear Syntax Errors'))
self.syntaxErrorClearAct.setWhatsThis(QApplication.translate('ViewManager',
"""Clear Syntax Errors"""
"""Clear syntax errors of all editors.
"""
))
self.connect(self.syntaxErrorClearAct, SIGNAL('triggered()'),
self.__clearAllSyntaxErrors)
self.bookmarkActions.append(self.syntaxErrorClearAct)
self.notcoveredNextAct = E4Action(QApplication.translate('ViewManager',
'Next uncovered line'),
UI.PixmapCache.getIcon("notcoveredNext.png"),
QApplication.translate('ViewManager', '&Next uncovered line'),
0, 0,
self.bookmarkActGrp, 'vm_uncovered_next')
self.notcoveredNextAct.setStatusTip(QApplication.translate('ViewManager',
'Next uncovered line'))
self.notcoveredNextAct.setWhatsThis(QApplication.translate('ViewManager',
"""Next uncovered line"""
"""Go to next line of the current editor marked as not covered.
"""
))
self.connect(self.notcoveredNextAct, SIGNAL('triggered()'), self.__nextUncovered)
self.bookmarkActions.append(self.notcoveredNextAct)
self.notcoveredPreviousAct = E4Action(QApplication.translate('ViewManager',
'Previous uncovered line'),
UI.PixmapCache.getIcon("notcoveredPrev.png"),
QApplication.translate('ViewManager',
'&Previous uncovered line'),
0, 0,
self.bookmarkActGrp, 'vm_uncovered_previous')
self.notcoveredPreviousAct.setStatusTip(QApplication.translate('ViewManager',
'Previous uncovered line'))
self.notcoveredPreviousAct.setWhatsThis(QApplication.translate('ViewManager',
"""Previous uncovered line"""
"""Go to previous line of the current editor marked"""
""" as not covered.
"""
))
self.connect(self.notcoveredPreviousAct, SIGNAL('triggered()'),
self.__previousUncovered)
self.bookmarkActions.append(self.notcoveredPreviousAct)
self.taskNextAct = E4Action(QApplication.translate('ViewManager',
'Next Task'),
UI.PixmapCache.getIcon("taskNext.png"),
QApplication.translate('ViewManager', '&Next Task'),
0, 0,
self.bookmarkActGrp, 'vm_task_next')
self.taskNextAct.setStatusTip(QApplication.translate('ViewManager',
'Next Task'))
self.taskNextAct.setWhatsThis(QApplication.translate('ViewManager',
"""Next Task"""
"""Go to next line of the current editor having a task.
"""
))
self.connect(self.taskNextAct, SIGNAL('triggered()'), self.__nextTask)
self.bookmarkActions.append(self.taskNextAct)
self.taskPreviousAct = E4Action(QApplication.translate('ViewManager',
'Previous Task'),
UI.PixmapCache.getIcon("taskPrev.png"),
QApplication.translate('ViewManager',
'&Previous Task'),
0, 0,
self.bookmarkActGrp, 'vm_task_previous')
self.taskPreviousAct.setStatusTip(QApplication.translate('ViewManager',
'Previous Task'))
self.taskPreviousAct.setWhatsThis(QApplication.translate('ViewManager',
"""Previous Task"""
"""Go to previous line of the current editor having a task.
"""
))
self.connect(self.taskPreviousAct, SIGNAL('triggered()'), self.__previousTask)
self.bookmarkActions.append(self.taskPreviousAct)
self.bookmarkActGrp.setEnabled(False)
def initBookmarkMenu(self):
"""
Public method to create the Bookmark menu
@return the generated menu
"""
menu = QMenu(QApplication.translate('ViewManager', '&Bookmarks'), self.ui)
self.bookmarksMenu = QMenu(QApplication.translate('ViewManager', '&Bookmarks'),
menu)
menu.setTearOffEnabled(True)
menu.addAction(self.bookmarkToggleAct)
menu.addAction(self.bookmarkNextAct)
menu.addAction(self.bookmarkPreviousAct)
menu.addAction(self.bookmarkClearAct)
menu.addSeparator()
self.menuBookmarksAct = menu.addMenu(self.bookmarksMenu)
menu.addSeparator()
menu.addAction(self.syntaxErrorGotoAct)
menu.addAction(self.syntaxErrorClearAct)
menu.addSeparator()
menu.addAction(self.notcoveredNextAct)
menu.addAction(self.notcoveredPreviousAct)
menu.addSeparator()
menu.addAction(self.taskNextAct)
menu.addAction(self.taskPreviousAct)
self.connect(self.bookmarksMenu, SIGNAL('aboutToShow()'),
self.__showBookmarksMenu)
self.connect(self.bookmarksMenu, SIGNAL('triggered(QAction *)'),
self.__bookmarkSelected)
self.connect(menu, SIGNAL('aboutToShow()'), self.__showBookmarkMenu)
return menu
def initBookmarkToolbar(self, toolbarManager):
"""
Public method to create the Bookmark toolbar
@param toolbarManager reference to a toolbar manager object (E4ToolBarManager)
@return the generated toolbar
"""
tb = QToolBar(QApplication.translate('ViewManager', 'Bookmarks'), self.ui)
tb.setIconSize(UI.Config.ToolBarIconSize)
tb.setObjectName("BookmarksToolbar")
tb.setToolTip(QApplication.translate('ViewManager', 'Bookmarks'))
tb.addAction(self.bookmarkToggleAct)
tb.addAction(self.bookmarkNextAct)
tb.addAction(self.bookmarkPreviousAct)
tb.addSeparator()
tb.addAction(self.syntaxErrorGotoAct)
tb.addSeparator()
tb.addAction(self.taskNextAct)
tb.addAction(self.taskPreviousAct)
toolbarManager.addToolBar(tb, tb.windowTitle())
toolbarManager.addAction(self.notcoveredNextAct, tb.windowTitle())
toolbarManager.addAction(self.notcoveredPreviousAct, tb.windowTitle())
return tb
##################################################################
## Initialize the spell checking related actions
##################################################################
def __initSpellingActions(self):
"""
Private method to initialize the spell checking actions.
"""
self.spellingActGrp = createActionGroup(self)
self.spellCheckAct = E4Action(QApplication.translate('ViewManager',
'Spell check'),
UI.PixmapCache.getIcon("spellchecking.png"),
QApplication.translate('ViewManager',
'&Spell Check...'),
QKeySequence(QApplication.translate('ViewManager',
"Shift+F7", "Spelling|Spell Check")),
0,
self.spellingActGrp, 'vm_spelling_spellcheck')
self.spellCheckAct.setStatusTip(QApplication.translate('ViewManager',
'Perform spell check of current editor'))
self.spellCheckAct.setWhatsThis(QApplication.translate('ViewManager',
"""Spell check"""
"""Perform a spell check of the current editor.
"""
))
self.connect(self.spellCheckAct, SIGNAL('triggered()'), self.__spellCheck)
self.spellingActions.append(self.spellCheckAct)
self.autoSpellCheckAct = E4Action(QApplication.translate('ViewManager',
'Automatic spell checking'),
UI.PixmapCache.getIcon("autospellchecking.png"),
QApplication.translate('ViewManager',
'&Automatic spell checking'),
0, 0,
self.spellingActGrp, 'vm_spelling_autospellcheck')
self.autoSpellCheckAct.setStatusTip(QApplication.translate('ViewManager',
'(De-)Activate automatic spell checking'))
self.autoSpellCheckAct.setWhatsThis(QApplication.translate('ViewManager',
"""Automatic spell checking"""
"""Activate or deactivate the automatic spell checking function of"""
""" all editors.
"""
))
self.autoSpellCheckAct.setCheckable(True)
self.autoSpellCheckAct.setChecked(
Preferences.getEditor("AutoSpellCheckingEnabled"))
self.connect(self.autoSpellCheckAct, SIGNAL('triggered()'),
self.__setAutoSpellChecking)
self.spellingActions.append(self.autoSpellCheckAct)
self.__enableSpellingActions()
def __enableSpellingActions(self):
"""
Private method to set the enabled state of the spelling actions.
"""
spellingAvailable = SpellChecker.isAvailable()
self.spellCheckAct.setEnabled(len(self.editors) != 0 and spellingAvailable)
self.autoSpellCheckAct.setEnabled(spellingAvailable)
def addToExtrasMenu(self, menu):
"""
Public method to add some actions to the extras menu.
"""
menu.addAction(self.spellCheckAct)
menu.addAction(self.autoSpellCheckAct)
menu.addSeparator()
def initSpellingToolbar(self, toolbarManager):
"""
Public method to create the Spelling toolbar
@param toolbarManager reference to a toolbar manager object (E4ToolBarManager)
@return the generated toolbar
"""
tb = QToolBar(QApplication.translate('ViewManager', 'Spelling'), self.ui)
tb.setIconSize(UI.Config.ToolBarIconSize)
tb.setObjectName("SpellingToolbar")
tb.setToolTip(QApplication.translate('ViewManager', 'Spelling'))
tb.addAction(self.spellCheckAct)
tb.addAction(self.autoSpellCheckAct)
toolbarManager.addToolBar(tb, tb.windowTitle())
return tb
##################################################################
## Methods and slots that deal with file and window handling
##################################################################
def openFiles(self, prog = None):
"""
Public slot to open some files.
@param prog name of file to be opened (string or QString)
"""
# Get the file name if one wasn't specified.
if prog is None:
# set the cwd of the dialog based on the following search criteria:
# 1: Directory of currently active editor
# 2: Directory of currently active project
# 3: CWD
filter = self._getOpenFileFilter()
progs = KQFileDialog.getOpenFileNames(\
self.ui,
QApplication.translate('ViewManager', "Open files"),
self._getOpenStartDir(),
QScintilla.Lexers.getOpenFileFiltersList(True, True),
filter)
else:
progs = [prog]
for prog in progs:
prog = Utilities.normabspath(unicode(prog))
# Open up the new files.
self.openSourceFile(prog)
def checkDirty(self, editor, autosave = False):
"""
Public method to check dirty status and open a message window.
@param editor editor window to check
@param autosave flag indicating that the file should be saved
automatically (boolean)
@return flag indicating successful reset of the dirty flag (boolean)
"""
if editor.isModified():
fn = editor.getFileName()
# ignore the dirty status, if there is more than one open editor
# for the same file
if fn and self.getOpenEditorCount(fn) > 1:
return True
if fn is None:
fn = editor.getNoName()
autosave = False
if autosave:
res = QMessageBox.Save
else:
res = KQMessageBox.warning(self.ui,
QApplication.translate('ViewManager', "File Modified"),
QApplication.translate('ViewManager',
"""The file %1 has unsaved changes.
""")
.arg(fn),
QMessageBox.StandardButtons(\
QMessageBox.Abort | \
QMessageBox.Discard | \
QMessageBox.Save),
QMessageBox.Save)
if res == QMessageBox.Save:
ok, newName = editor.saveFile()
if ok:
self.setEditorName(editor, newName)
return ok
elif res == QMessageBox.Abort or res == QMessageBox.Cancel:
return False
return True
def checkAllDirty(self):
"""
Public method to check the dirty status of all editors.
@return flag indicating successful reset of all dirty flags (boolean)
"""
for editor in self.editors:
if not self.checkDirty(editor):
return False
return True
def closeEditor(self, editor):
"""
Public method to close an editor window.
@param editor editor window to be closed
@return flag indicating success (boolean)
"""
# save file if necessary
if not self.checkDirty(editor):
return False
# get the filename of the editor for later use
fn = editor.getFileName()
# remove the window
self._removeView(editor)
self.editors.remove(editor)
# send a signal, if it was the last editor for this filename
if fn and self.getOpenEditor(fn) is None:
self.emit(SIGNAL('editorClosed'), fn)
self.emit(SIGNAL('editorClosedEd'), editor)
# send a signal, if it was the very last editor
if not len(self.editors):
self.__lastEditorClosed()
self.emit(SIGNAL('lastEditorClosed'))
return True
def closeCurrentWindow(self):
"""
Public method to close the current window.
@return flag indicating success (boolean)
"""
aw = self.activeWindow()
if aw is None:
return False
res = self.closeEditor(aw)
if res and aw == self.currentEditor:
self.currentEditor = None
return res
def closeAllWindows(self):
"""
Private method to close all editor windows via file menu.
"""
savedEditors = self.editors[:]
for editor in savedEditors:
self.closeEditor(editor)
def closeWindow(self, fn):
"""
Public method to close an arbitrary source editor.
@param fn filename of editor to be closed
@return flag indicating success (boolean)
"""
for editor in self.editors:
if Utilities.samepath(fn, editor.getFileName()):
break
else:
return True
res = self.closeEditor(editor)
if res and editor == self.currentEditor:
self.currentEditor = None
return res
def closeEditorWindow(self, editor):
"""
Public method to close an arbitrary source editor.
@param editor editor to be closed
"""
if editor is None:
return
res = self.closeEditor(editor)
if res and editor == self.currentEditor:
self.currentEditor = None
def exit(self):
"""
Public method to handle the debugged program terminating.
"""
if self.currentEditor is not None:
self.currentEditor.highlight()
self.currentEditor = None
self.__setSbFile()
def openSourceFile(self, fn, lineno = -1, filetype = "", selection = None):
"""
Public slot to display a file in an editor.
@param fn name of file to be opened
@param lineno line number to place the cursor at
@param filetype type of the source file (string)
@param selection tuple (start, end) of an area to be selected
"""
try:
newWin, editor = self.getEditor(fn, filetype = filetype)
except IOError:
return
if newWin:
self._modificationStatusChanged(editor.isModified(), editor)
self._checkActions(editor)
if lineno >= 0:
editor.ensureVisibleTop(lineno)
editor.gotoLine(lineno)
if selection is not None:
editor.setSelection(lineno - 1, selection[0], lineno - 1, selection[1])
# insert filename into list of recently opened files
self.addToRecentList(fn)
def __connectEditor(self, editor):
"""
Private method to establish all editor connections.
@param editor reference to the editor object to be connected
"""
self.connect(editor, SIGNAL('modificationStatusChanged'),
self._modificationStatusChanged)
self.connect(editor, SIGNAL('cursorChanged'), self.__cursorChanged)
self.connect(editor, SIGNAL('editorSaved'), self.__editorSaved)
self.connect(editor, SIGNAL('breakpointToggled'), self.__breakpointToggled)
self.connect(editor, SIGNAL('bookmarkToggled'), self.__bookmarkToggled)
self.connect(editor, SIGNAL('syntaxerrorToggled'), self._syntaxErrorToggled)
self.connect(editor, SIGNAL('coverageMarkersShown'),
self.__coverageMarkersShown)
self.connect(editor, SIGNAL('autoCompletionAPIsAvailable'),
self.__editorAutoCompletionAPIsAvailable)
self.connect(editor, SIGNAL('undoAvailable'), self.undoAct.setEnabled)
self.connect(editor, SIGNAL('redoAvailable'), self.redoAct.setEnabled)
self.connect(editor, SIGNAL('taskMarkersUpdated'), self.__taskMarkersUpdated)
self.connect(editor, SIGNAL('languageChanged'), self.__editorConfigChanged)
self.connect(editor, SIGNAL('eolChanged'), self.__editorConfigChanged)
self.connect(editor, SIGNAL('encodingChanged'), self.__editorConfigChanged)
self.connect(editor, SIGNAL("selectionChanged()"),
self.searchDlg.selectionChanged)
self.connect(editor, SIGNAL("selectionChanged()"),
self.replaceDlg.selectionChanged)
def newEditorView(self, fn, caller, filetype = ""):
"""
Public method to create a new editor displaying the given document.
@param fn filename of this view
@param caller reference to the editor calling this method
@param filetype type of the source file (string)
"""
editor = self.cloneEditor(caller, filetype, fn)
self._addView(editor, fn, caller.getNoName())
self._modificationStatusChanged(editor.isModified(), editor)
self._checkActions(editor)
def cloneEditor(self, caller, filetype, fn):
"""
Public method to clone an editor displaying the given document.
@param caller reference to the editor calling this method
@param filetype type of the source file (string)
@param fn filename of this view
@return reference to the new editor object (Editor.Editor)
"""
editor = Editor(self.dbs, fn, self, filetype = filetype, editor = caller,
tv = e4App().getObject("TaskViewer"))
self.editors.append(editor)
self.__connectEditor(editor)
self.__editorOpened()
self.emit(SIGNAL('editorOpened'), fn)
self.emit(SIGNAL('editorOpenedEd'), editor)
return editor
def addToRecentList(self, fn):
"""
Public slot to add a filename to the list of recently opened files.
@param fn name of the file to be added
"""
self.recent.removeAll(fn)
self.recent.prepend(fn)
maxRecent = Preferences.getUI("RecentNumber")
if len(self.recent) > maxRecent:
self.recent = self.recent[:maxRecent]
self.__saveRecent()
def showDebugSource(self, fn, line):
"""
Public method to open the given file and highlight the given line in it.
@param fn filename of editor to update (string)
@param line line number to highlight (int)
"""
self.openSourceFile(fn, line)
self.setFileLine(fn, line)
def setFileLine(self, fn, line, error = False, syntaxError = False):
"""
Public method to update the user interface when the current program
or line changes.
@param fn filename of editor to update (string)
@param line line number to highlight (int)
@param error flag indicating an error highlight (boolean)
@param syntaxError flag indicating a syntax error
"""
try:
newWin, self.currentEditor = self.getEditor(fn)
except IOError:
return
enc = self.currentEditor.getEncoding()
lang = self.currentEditor.getLanguage()
eol = self.currentEditor.getEolIndicator()
self.__setSbFile(fn, line, encoding = enc, language = lang, eol = eol)
# Change the highlighted line.
self.currentEditor.highlight(line, error, syntaxError)
self.currentEditor.highlightVisible()
self._checkActions(self.currentEditor, False)
def __setSbFile(self, fn = None, line = None, pos = None,
encoding = None, language = None, eol = None):
"""
Private method to set the file info in the status bar.
@param fn filename to display (string)
@param line line number to display (int)
@param pos character position to display (int)
@param encoding encoding name to display (string)
@param language language to display (string)
@param eol eol indicator to display (string)
"""
if fn is None:
fn = ''
writ = ' '
else:
if QFileInfo(fn).isWritable():
writ = ' rw'
else:
writ = ' ro'
self.sbWritable.setText(writ)
self.sbFile.setTextPath(QApplication.translate('ViewManager', 'File: %1'), fn)
if line is None:
line = ''
self.sbLine.setText(QApplication.translate('ViewManager', 'Line: %1').arg(line, 5))
if pos is None:
pos = ''
self.sbPos.setText(QApplication.translate('ViewManager', 'Pos: %1').arg(pos, 5))
if encoding is None:
encoding = ''
self.sbEnc.setText(encoding)
if language is None:
language = ''
self.sbLang.setText(language)
if eol is None:
eol = ''
self.sbEol.setText(eol)
def unhighlight(self, current = False):
"""
Public method to switch off all highlights.
@param current flag indicating only the current editor should be unhighlighted
(boolean)
"""
if current:
if self.currentEditor is not None:
self.currentEditor.highlight()
else:
for editor in self.editors:
editor.highlight()
def getOpenFilenames(self):
"""
Public method returning a list of the filenames of all editors.
@return list of all opened filenames (list of strings)
"""
filenames = []
for editor in self.editors:
fn = editor.getFileName()
if fn is not None and fn not in filenames:
filenames.append(fn)
return filenames
def getEditor(self, fn, filetype = ""):
"""
Public method to return the editor displaying the given file.
If there is no editor with the given file, a new editor window is
created.
@param fn filename to look for
@param filetype type of the source file (string)
@return tuple of two values giving a flag indicating a new window creation and
a reference to the editor displaying this file
"""
newWin = False
editor = self.activeWindow()
if editor is None or not Utilities.samepath(fn, editor.getFileName()):
for editor in self.editors:
if Utilities.samepath(fn, editor.getFileName()):
break
else:
editor = Editor(self.dbs, fn, self, filetype = filetype,
tv = e4App().getObject("TaskViewer"))
self.editors.append(editor)
self.__connectEditor(editor)
self.__editorOpened()
self.emit(SIGNAL('editorOpened'), fn)
self.emit(SIGNAL('editorOpenedEd'), editor)
newWin = True
if newWin:
self._addView(editor, fn)
else:
self._showView(editor, fn)
return (newWin, editor)
def getOpenEditors(self):
"""
Public method to get references to all open editors.
@return list of references to all open editors (list of QScintilla.editor)
"""
return self.editors
def getOpenEditorsCount(self):
"""
Public method to get the number of open editors.
@return number of open editors (integer)
"""
return len(self.editors)
def getOpenEditor(self, fn):
"""
Public method to return the editor displaying the given file.
@param fn filename to look for
@return a reference to the editor displaying this file or None, if
no editor was found
"""
for editor in self.editors:
if Utilities.samepath(fn, editor.getFileName()):
return editor
return None
def getOpenEditorCount(self, fn):
"""
Public method to return the count of editors displaying the given file.
@param fn filename to look for
@return count of editors displaying this file (integer)
"""
count = 0
for editor in self.editors:
if Utilities.samepath(fn, editor.getFileName()):
count += 1
return count
def getActiveName(self):
"""
Public method to retrieve the filename of the active window.
@return filename of active window (string)
"""
aw = self.activeWindow()
if aw:
return aw.getFileName()
else:
return None
def saveEditor(self, fn):
"""
Public method to save a named editor file.
@param fn filename of editor to be saved (string)
@return flag indicating success (boolean)
"""
for editor in self.editors:
if Utilities.samepath(fn, editor.getFileName()):
break
else:
return True
if not editor.isModified():
return True
else:
ok = editor.saveFile()[0]
return ok
def saveEditorEd(self, ed):
"""
Public slot to save the contents of an editor.
@param ed editor to be saved
@return flag indicating success (boolean)
"""
if ed:
if not ed.isModified():
return True
else:
ok, newName = ed.saveFile()
if ok:
self.setEditorName(ed, newName)
return ok
else:
return False
def saveCurrentEditor(self):
"""
Public slot to save the contents of the current editor.
"""
aw = self.activeWindow()
self.saveEditorEd(aw)
def saveAsEditorEd(self, ed):
"""
Public slot to save the contents of an editor to a new file.
@param ed editor to be saved
"""
if ed:
ok, newName = ed.saveFileAs()
if ok:
self.setEditorName(ed, newName)
else:
return
def saveAsCurrentEditor(self):
"""
Public slot to save the contents of the current editor to a new file.
"""
aw = self.activeWindow()
self.saveAsEditorEd(aw)
def saveEditorsList(self, editors):
"""
Public slot to save a list of editors.
@param editors list of editors to be saved
"""
for editor in editors:
ok, newName = editor.saveFile()
if ok:
self.setEditorName(editor, newName)
def saveAllEditors(self):
"""
Public slot to save the contents of all editors.
"""
for editor in self.editors:
ok, newName = editor.saveFile()
if ok:
self.setEditorName(editor, newName)
# restart autosave timer
if self.autosaveInterval > 0:
self.autosaveTimer.start(self.autosaveInterval * 60000)
def __exportMenuTriggered(self, act):
"""
Private method to handle the selection of an export format.
@param act reference to the action that was triggered (QAction)
"""
aw = self.activeWindow()
if aw:
exporterFormat = unicode(act.data().toString())
aw.exportFile(exporterFormat)
def newEditor(self):
"""
Public slot to generate a new empty editor.
"""
editor = Editor(self.dbs, None, self, tv = e4App().getObject("TaskViewer"))
self.editors.append(editor)
self.__connectEditor(editor)
self._addView(editor, None)
self.__editorOpened()
self._checkActions(editor)
self.emit(SIGNAL('editorOpened'), "")
self.emit(SIGNAL('editorOpenedEd'), editor)
def printEditor(self, editor):
"""
Public slot to print an editor.
@param editor editor to be printed
"""
if editor:
editor.printFile()
else:
return
def printCurrentEditor(self):
"""
Public slot to print the contents of the current editor.
"""
aw = self.activeWindow()
self.printEditor(aw)
def printPreviewCurrentEditor(self):
"""
Public slot to show a print preview of the current editor.
"""
aw = self.activeWindow()
if aw:
aw.printPreviewFile()
def __showFileMenu(self):
"""
Private method to set up the file menu.
"""
self.menuRecentAct.setEnabled(len(self.recent) > 0)
def __showRecentMenu(self):
"""
Private method to set up recent files menu.
"""
self.__loadRecent()
self.recentMenu.clear()
idx = 1
for rs in self.recent:
if idx < 10:
formatStr = '&%d. %s'
else:
formatStr = '%d. %s'
act = self.recentMenu.addAction(\
formatStr % (idx,
Utilities.compactPath(unicode(rs), self.ui.maxMenuFilePathLen)))
act.setData(QVariant(rs))
act.setEnabled(QFileInfo(rs).exists())
idx += 1
self.recentMenu.addSeparator()
self.recentMenu.addAction(\
QApplication.translate('ViewManager', '&Clear'), self.__clearRecent)
def __openSourceFile(self, act):
"""
Private method to open a file from the list of rencently opened files.
@param act reference to the action that triggered (QAction)
"""
file = unicode(act.data().toString())
if file:
self.openSourceFile(file)
def __clearRecent(self):
"""
Private method to clear the recent files menu.
"""
self.recent.clear()
def __showBookmarkedMenu(self):
"""
Private method to set up bookmarked files menu.
"""
self.bookmarkedMenu.clear()
for rp in self.bookmarked:
act = self.bookmarkedMenu.addAction(\
Utilities.compactPath(unicode(rp), self.ui.maxMenuFilePathLen))
act.setData(QVariant(rp))
act.setEnabled(QFileInfo(rp).exists())
if len(self.bookmarked):
self.bookmarkedMenu.addSeparator()
self.bookmarkedMenu.addAction(\
QApplication.translate('ViewManager', '&Add'), self.__addBookmarked)
self.bookmarkedMenu.addAction(\
QApplication.translate('ViewManager', '&Edit...'), self.__editBookmarked)
self.bookmarkedMenu.addAction(\
QApplication.translate('ViewManager', '&Clear'), self.__clearBookmarked)
def __addBookmarked(self):
"""
Private method to add the current file to the list of bookmarked files.
"""
an = self.getActiveName()
if an is not None and self.bookmarked.indexOf(QString(an)) == -1:
self.bookmarked.append(an)
def __editBookmarked(self):
"""
Private method to edit the list of bookmarked files.
"""
dlg = BookmarkedFilesDialog(self.bookmarked, self.ui)
if dlg.exec_() == QDialog.Accepted:
self.bookmarked = QStringList(dlg.getBookmarkedFiles())
def __clearBookmarked(self):
"""
Private method to clear the bookmarked files menu.
"""
self.bookmarked = QStringList()
def projectOpened(self):
"""
Public slot to handle the projectOpened signal.
"""
for editor in self.editors:
editor.projectOpened()
def projectClosed(self):
"""
Public slot to handle the projectClosed signal.
"""
for editor in self.editors:
editor.projectClosed()
def projectFileRenamed(self, oldfn, newfn):
"""
Public slot to handle the projectFileRenamed signal.
@param oldfn old filename of the file (string)
@param newfn new filename of the file (string)
"""
editor = self.getOpenEditor(oldfn)
if editor:
editor.fileRenamed(newfn)
def projectLexerAssociationsChanged(self):
"""
Public slot to handle changes of the project lexer associations.
"""
for editor in self.editors:
editor.projectLexerAssociationsChanged()
def enableEditorsCheckFocusIn(self, enabled):
"""
Public method to set a flag enabling the editors to perform focus in checks.
@param enabled flag indicating focus in checks should be performed (boolean)
"""
self.editorsCheckFocusIn = enabled
def editorsCheckFocusInEnabled(self):
"""
Public method returning the flag indicating editors should perform
focus in checks.
@return flag indicating focus in checks should be performed (boolean)
"""
return self.editorsCheckFocusIn
def __findFileName(self):
"""
Private method to handle the search for file action.
"""
self.ui.findFileNameDialog.show()
self.ui.findFileNameDialog.raise_()
self.ui.findFileNameDialog.activateWindow()
def appFocusChanged(self, old, now):
"""
Public method to handle the global change of focus.
@param old reference to the widget loosing focus (QWidget)
@param now reference to the widget gaining focus (QWidget)
"""
if not isinstance(now, (Editor, Shell)):
self.editActGrp.setEnabled(False)
self.copyActGrp.setEnabled(False)
self.viewActGrp.setEnabled(False)
##################################################################
## Below are the action methods for the edit menu
##################################################################
def __editUndo(self):
"""
Private method to handle the undo action.
"""
self.activeWindow().undo()
def __editRedo(self):
"""
Private method to handle the redo action.
"""
self.activeWindow().redo()
def __editRevert(self):
"""
Private method to handle the revert action.
"""
self.activeWindow().revertToUnmodified()
def __editCut(self):
"""
Private method to handle the cut action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").cut()
else:
self.activeWindow().cut()
def __editCopy(self):
"""
Private method to handle the copy action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").copy()
else:
self.activeWindow().copy()
def __editPaste(self):
"""
Private method to handle the paste action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").paste()
else:
self.activeWindow().paste()
def __editDelete(self):
"""
Private method to handle the delete action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").clear()
else:
self.activeWindow().clear()
def __editIndent(self):
"""
Private method to handle the indent action.
"""
self.activeWindow().indentLineOrSelection()
def __editUnindent(self):
"""
Private method to handle the unindent action.
"""
self.activeWindow().unindentLineOrSelection()
def __editSmartIndent(self):
"""
Private method to handle the smart indent action
"""
self.activeWindow().smartIndentLineOrSelection()
def __editComment(self):
"""
Private method to handle the comment action.
"""
self.activeWindow().commentLineOrSelection()
def __editUncomment(self):
"""
Private method to handle the uncomment action.
"""
self.activeWindow().uncommentLineOrSelection()
def __editStreamComment(self):
"""
Private method to handle the stream comment action.
"""
self.activeWindow().streamCommentLineOrSelection()
def __editBoxComment(self):
"""
Private method to handle the box comment action.
"""
self.activeWindow().boxCommentLineOrSelection()
def __editSelectBrace(self):
"""
Private method to handle the select to brace action.
"""
self.activeWindow().selectToMatchingBrace()
def __editSelectAll(self):
"""
Private method to handle the select all action.
"""
self.activeWindow().selectAll(True)
def __editDeselectAll(self):
"""
Private method to handle the select all action.
"""
self.activeWindow().selectAll(False)
def __convertEOL(self):
"""
Private method to handle the convert line end characters action.
"""
aw = self.activeWindow()
aw.convertEols(aw.eolMode())
def __shortenEmptyLines(self):
"""
Private method to handle the shorten empty lines action.
"""
self.activeWindow().shortenEmptyLines()
def __editAutoComplete(self):
"""
Private method to handle the autocomplete action.
"""
self.activeWindow().autoComplete()
def __editAutoCompleteFromDoc(self):
"""
Private method to handle the autocomplete from document action.
"""
self.activeWindow().autoCompleteFromDocument()
def __editAutoCompleteFromAPIs(self):
"""
Private method to handle the autocomplete from APIs action.
"""
self.activeWindow().autoCompleteFromAPIs()
def __editAutoCompleteFromAll(self):
"""
Private method to handle the autocomplete from All action.
"""
self.activeWindow().autoCompleteFromAll()
def __editorAutoCompletionAPIsAvailable(self, available):
"""
Private method to handle the availability of API autocompletion signal.
"""
self.autoCompleteFromAPIsAct.setEnabled(available)
def __editShowCallTips(self):
"""
Private method to handle the calltips action.
"""
self.activeWindow().callTip()
##################################################################
## Below are the action and utility methods for the search menu
##################################################################
def textForFind(self, getCurrentWord = True):
"""
Public method to determine the selection or the current word for the next
find operation.
@param getCurrentWord flag indicating to return the current word, if no selected
text was found (boolean)
@return selection or current word (QString)
"""
aw = self.activeWindow()
if aw is None:
return QString('')
return aw.getSearchText(not getCurrentWord)
def getSRHistory(self, key):
"""
Public method to get the search or replace history list.
@param key list to return (must be 'search' or 'replace')
@return the requested history list (QStringList)
"""
return self.srHistory[key]
def __quickSearch(self):
"""
Private slot to handle the incremental quick search.
"""
# first we have to check if quick search is active
# and try to activate it if not
if self.__quickSearchToolbarVisibility is None:
self.__quickSearchToolbarVisibility = self.__quickSearchToolbar.isVisible()
if not self.__quickSearchToolbar.isVisible():
self.__quickSearchToolbar.show()
if not self.quickFindtextCombo.lineEdit().hasFocus():
aw = self.activeWindow()
self.quickFindtextCombo.lastActive = aw
if aw:
self.quickFindtextCombo.lastCursorPos = aw.getCursorPosition()
else:
self.quickFindtextCombo.lastCursorPos = None
tff = self.textForFind(False)
if not tff.isEmpty():
self.quickFindtextCombo.lineEdit().setText(tff)
self.quickFindtextCombo.lineEdit().setFocus()
self.quickFindtextCombo.lineEdit().selectAll()
self.__quickSearchSetEditColors(False)
else:
self.__quickSearchInEditor(True, False)
def __quickSearchFocusIn(self):
"""
Private method to handle a focus in signal of the quicksearch lineedit.
"""
self.quickFindtextCombo.lastActive = self.activeWindow()
def __quickSearchEnter(self):
"""
Private slot to handle the incremental quick search return pressed
(jump back to text)
"""
if self.quickFindtextCombo.lastActive:
self.quickFindtextCombo.lastActive.setFocus()
if self.__quickSearchToolbarVisibility is not None:
self.__quickSearchToolbar.setVisible(self.__quickSearchToolbarVisibility)
self.__quickSearchToolbarVisibility = None
def __quickSearchEscape(self):
"""
Private slot to handle the incremental quick search escape pressed
(jump back to text)
"""
if self.quickFindtextCombo.lastActive:
self.quickFindtextCombo.lastActive.setFocus()
aw = self.activeWindow()
if aw and self.quickFindtextCombo.lastCursorPos:
aw.setCursorPosition(self.quickFindtextCombo.lastCursorPos[0],
self.quickFindtextCombo.lastCursorPos[1])
if self.__quickSearchToolbarVisibility is not None:
self.__quickSearchToolbar.setVisible(self.__quickSearchToolbarVisibility)
self.__quickSearchToolbarVisibility = None
def __quickSearchText(self):
"""
Private slot to handle the textChanged signal of the quicksearch edit.
"""
self.__quickSearchInEditor(False, False)
def __quickSearchPrev(self):
"""
Private slot to handle the quickFindPrev toolbutton action.
"""
# first we have to check if quick search is active
# and try to activate it if not
if self.__quickSearchToolbarVisibility is None:
self.__quickSearchToolbarVisibility = self.__quickSearchToolbar.isVisible()
if not self.__quickSearchToolbar.isVisible():
self.__quickSearchToolbar.show()
if not self.quickFindtextCombo.lineEdit().hasFocus():
aw = self.activeWindow()
self.quickFindtextCombo.lastActive = aw
if aw:
self.quickFindtextCombo.lastCursorPos = aw.getCursorPosition()
else:
self.quickFindtextCombo.lastCursorPos = None
tff = self.textForFind(False)
if not tff.isEmpty():
self.quickFindtextCombo.lineEdit().setText(tff)
self.quickFindtextCombo.lineEdit().setFocus()
self.quickFindtextCombo.lineEdit().selectAll()
self.__quickSearchSetEditColors(False)
else:
self.__quickSearchInEditor(True, True)
def __quickSearchMarkOccurrences(self, txt):
"""
Private method to mark all occurrences of the search text.
@param txt text to search for (QString)
"""
aw = self.activeWindow()
lineFrom = 0
indexFrom = 0
lineTo = -1
indexTo = -1
aw.clearSearchIndicators()
ok = aw.findFirstTarget(txt, False, False, False,
lineFrom, indexFrom, lineTo, indexTo)
while ok:
tgtPos, tgtLen = aw.getFoundTarget()
aw.setSearchIndicator(tgtPos, tgtLen)
ok = aw.findNextTarget()
def __quickSearchInEditor(self, again, back):
"""
Private slot to perform a quick search.
@param again flag indicating a repeat of the last search (boolean)
@param back flag indicating a backwards search operation (boolean)
@author Maciek Fijalkowski, 2005-07-23
"""
aw = self.activeWindow()
if not aw:
return
text = self.quickFindtextCombo.lineEdit().text()
if text.isEmpty() and again:
text = self.quickFindtextCombo.lastSearchText
if text.isEmpty():
if Preferences.getEditor("QuickSearchMarkersEnabled"):
aw.clearSearchIndicators()
return
else:
self.quickFindtextCombo.lastSearchText = text
if Preferences.getEditor("QuickSearchMarkersEnabled"):
self.__quickSearchMarkOccurrences(text)
lineFrom, indexFrom, lineTo, indexTo = aw.getSelection()
cline, cindex = aw.getCursorPosition ()
if again:
if back:
if indexFrom != 0:
index = indexFrom - 1
line = lineFrom
elif lineFrom == 0:
return
else:
line = lineFrom - 1
index = aw.lineLength(line)
ok = aw.findFirst(text, False, False, False, True, False, line, index)
else:
ok = aw.findFirst(text, False, False, False, True, not back,
cline, cindex)
else:
ok = aw.findFirst(text, False, False, False, True, not back,
lineFrom, indexFrom)
self.__quickSearchSetEditColors(not ok)
def __quickSearchSetEditColors(self, error):
"""
Private method to set the quick search edit colors.
@param error flag indicating an error (boolean)
"""
if error:
palette = self.quickFindtextCombo.lineEdit().palette()
palette.setColor(QPalette.Base, QColor("red"))
palette.setColor(QPalette.Text, QColor("white"))
self.quickFindtextCombo.lineEdit().setPalette(palette)
else:
palette = self.quickFindtextCombo.lineEdit().palette()
palette.setColor(QPalette.Base,
self.quickFindtextCombo.palette().color(QPalette.Base))
palette.setColor(QPalette.Text,
self.quickFindtextCombo.palette().color(QPalette.Text))
self.quickFindtextCombo.lineEdit().setPalette(palette)
def __quickSearchExtend(self):
"""
Private method to handle the quicksearch extend action.
"""
aw = self.activeWindow()
if aw is None:
return
txt = self.quickFindtextCombo.lineEdit().text()
if txt.isEmpty():
return
line, index = aw.getCursorPosition()
text = aw.text(line)
re = QRegExp('[^\w_]')
end = text.indexOf(re, index)
if end > index:
ext = text.mid(index, end - index)
txt.append(ext)
self.quickFindtextCombo.lineEdit().setText(txt)
def __search(self):
"""
Private method to handle the search action.
"""
self.replaceDlg.close()
self.searchDlg.show(self.textForFind())
def __replace(self):
"""
Private method to handle the replace action.
"""
self.searchDlg.close()
self.replaceDlg.show(self.textForFind())
def __searchClearMarkers(self):
"""
Private method to clear the search markers of the active window.
"""
self.activeWindow().clearSearchIndicators()
def __goto(self):
"""
Private method to handle the goto action.
"""
aw = self.activeWindow()
lines = aw.lines()
curLine = aw.getCursorPosition()[0] + 1
dlg = GotoDialog(lines, curLine, self.ui, None, True)
if dlg.exec_() == QDialog.Accepted:
aw.gotoLine(dlg.getLinenumber())
def __gotoBrace(self):
"""
Private method to handle the goto brace action.
"""
self.activeWindow().moveToMatchingBrace()
def __searchFiles(self):
"""
Private method to handle the search in files action.
"""
self.ui.findFilesDialog.show(self.textForFind())
self.ui.findFilesDialog.raise_()
self.ui.findFilesDialog.activateWindow()
def __replaceFiles(self):
"""
Private method to handle the replace in files action.
"""
self.ui.replaceFilesDialog.show(self.textForFind())
self.ui.replaceFilesDialog.raise_()
self.ui.replaceFilesDialog.activateWindow()
##################################################################
## Below are the action methods for the view menu
##################################################################
def __zoomIn(self):
"""
Private method to handle the zoom in action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").zoomIn()
else:
aw = self.activeWindow()
if aw:
aw.zoomIn()
def __zoomOut(self):
"""
Private method to handle the zoom out action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").zoomOut()
else:
aw = self.activeWindow()
if aw:
aw.zoomOut()
def __zoomReset(self):
"""
Private method to reset the zoom factor.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
e4App().getObject("Shell").zoomTo(0)
else:
aw = self.activeWindow()
if aw:
aw.zoomTo(0)
def __zoom(self):
"""
Private method to handle the zoom action.
"""
if QApplication.focusWidget() == e4App().getObject("Shell"):
aw = e4App().getObject("Shell")
else:
aw = self.activeWindow()
if aw:
dlg = ZoomDialog(aw.getZoom(), self.ui, None, True)
if dlg.exec_() == QDialog.Accepted:
aw.zoomTo(dlg.getZoomSize())
def __toggleAll(self):
"""
Private method to handle the toggle all folds action.
"""
aw = self.activeWindow()
if aw:
aw.foldAll()
def __toggleAllChildren(self):
"""
Private method to handle the toggle all folds (including children) action.
"""
aw = self.activeWindow()
if aw:
aw.foldAll(True)
def __toggleCurrent(self):
"""
Private method to handle the toggle current fold action.
"""
aw = self.activeWindow()
if aw:
line, index = aw.getCursorPosition()
aw.foldLine(line)
def __splitView(self):
"""
Private method to handle the split view action.
"""
self.addSplit()
def __splitOrientation(self, checked):
"""
Private method to handle the split orientation action.
"""
if checked:
self.setSplitOrientation(Qt.Horizontal)
self.splitViewAct.setIcon(\
UI.PixmapCache.getIcon("splitHorizontal.png"))
self.splitRemoveAct.setIcon(\
UI.PixmapCache.getIcon("remsplitHorizontal.png"))
else:
self.setSplitOrientation(Qt.Vertical)
self.splitViewAct.setIcon(\
UI.PixmapCache.getIcon("splitVertical.png"))
self.splitRemoveAct.setIcon(\
UI.PixmapCache.getIcon("remsplitVertical.png"))
##################################################################
## Below are the action methods for the macro menu
##################################################################
def __macroStartRecording(self):
"""
Private method to handle the start macro recording action.
"""
self.activeWindow().macroRecordingStart()
def __macroStopRecording(self):
"""
Private method to handle the stop macro recording action.
"""
self.activeWindow().macroRecordingStop()
def __macroRun(self):
"""
Private method to handle the run macro action.
"""
self.activeWindow().macroRun()
def __macroDelete(self):
"""
Private method to handle the delete macro action.
"""
self.activeWindow().macroDelete()
def __macroLoad(self):
"""
Private method to handle the load macro action.
"""
self.activeWindow().macroLoad()
def __macroSave(self):
"""
Private method to handle the save macro action.
"""
self.activeWindow().macroSave()
##################################################################
## Below are the action methods for the bookmarks menu
##################################################################
def __toggleBookmark(self):
"""
Private method to handle the toggle bookmark action.
"""
self.activeWindow().menuToggleBookmark()
def __nextBookmark(self):
"""
Private method to handle the next bookmark action.
"""
self.activeWindow().nextBookmark()
def __previousBookmark(self):
"""
Private method to handle the previous bookmark action.
"""
self.activeWindow().previousBookmark()
def __clearAllBookmarks(self):
"""
Private method to handle the clear all bookmarks action.
"""
for editor in self.editors:
editor.clearBookmarks()
self.bookmarkNextAct.setEnabled(False)
self.bookmarkPreviousAct.setEnabled(False)
self.bookmarkClearAct.setEnabled(False)
def __showBookmarkMenu(self):
"""
Private method to set up the bookmark menu.
"""
bookmarksFound = 0
filenames = self.getOpenFilenames()
for filename in filenames:
editor = self.getOpenEditor(filename)
bookmarksFound = len(editor.getBookmarks()) > 0
if bookmarksFound:
self.menuBookmarksAct.setEnabled(True)
return
self.menuBookmarksAct.setEnabled(False)
def __showBookmarksMenu(self):
"""
Private method to handle the show bookmarks menu signal.
"""
self.bookmarksMenu.clear()
filenames = self.getOpenFilenames()
filenames.sort()
for filename in filenames:
editor = self.getOpenEditor(filename)
for bookmark in editor.getBookmarks():
bmSuffix = " : %d" % bookmark
act = self.bookmarksMenu.addAction(\
"%s%s" % (\
Utilities.compactPath(\
filename,
self.ui.maxMenuFilePathLen - len(bmSuffix)),
bmSuffix))
act.setData(QVariant([QVariant(filename), QVariant(bookmark)]))
def __bookmarkSelected(self, act):
"""
Private method to handle the bookmark selected signal.
@param act reference to the action that triggered (QAction)
"""
try:
qvList = act.data().toPyObject()
filename = unicode(qvList[0])
line = qvList[1]
except AttributeError:
qvList = act.data().toList()
filename = unicode(qvList[0].toString())
line = qvList[1].toInt()[0]
self.openSourceFile(filename, line)
def __bookmarkToggled(self, editor):
"""
Private slot to handle the bookmarkToggled signal.
It checks some bookmark actions and reemits the signal.
@param editor editor that sent the signal
"""
if editor.hasBookmarks():
self.bookmarkNextAct.setEnabled(True)
self.bookmarkPreviousAct.setEnabled(True)
self.bookmarkClearAct.setEnabled(True)
else:
self.bookmarkNextAct.setEnabled(False)
self.bookmarkPreviousAct.setEnabled(False)
self.bookmarkClearAct.setEnabled(False)
self.emit(SIGNAL('bookmarkToggled'), editor)
def __gotoSyntaxError(self):
"""
Private method to handle the goto syntax error action.
"""
self.activeWindow().gotoSyntaxError()
def __clearAllSyntaxErrors(self):
"""
Private method to handle the clear all syntax errors action.
"""
for editor in self.editors:
editor.clearSyntaxError()
def _syntaxErrorToggled(self, editor):
"""
Protected slot to handle the syntaxerrorToggled signal.
It checks some syntax error actions and reemits the signal.
@param editor editor that sent the signal
"""
if editor.hasSyntaxErrors():
self.syntaxErrorGotoAct.setEnabled(True)
self.syntaxErrorClearAct.setEnabled(True)
else:
self.syntaxErrorGotoAct.setEnabled(False)
self.syntaxErrorClearAct.setEnabled(False)
self.emit(SIGNAL('syntaxerrorToggled'), editor)
def __nextUncovered(self):
"""
Private method to handle the next uncovered action.
"""
self.activeWindow().nextUncovered()
def __previousUncovered(self):
"""
Private method to handle the previous uncovered action.
"""
self.activeWindow().previousUncovered()
def __coverageMarkersShown(self, shown):
"""
Private slot to handle the coverageMarkersShown signal.
@param shown flag indicating whether the markers were shown or cleared
"""
if shown:
self.notcoveredNextAct.setEnabled(True)
self.notcoveredPreviousAct.setEnabled(True)
else:
self.notcoveredNextAct.setEnabled(False)
self.notcoveredPreviousAct.setEnabled(False)
def __taskMarkersUpdated(self, editor):
"""
Protected slot to handle the syntaxerrorToggled signal.
It checks some syntax error actions and reemits the signal.
@param editor editor that sent the signal
"""
if editor.hasTaskMarkers():
self.taskNextAct.setEnabled(True)
self.taskPreviousAct.setEnabled(True)
else:
self.taskNextAct.setEnabled(False)
self.taskPreviousAct.setEnabled(False)
def __nextTask(self):
"""
Private method to handle the next task action.
"""
self.activeWindow().nextTask()
def __previousTask(self):
"""
Private method to handle the previous task action.
"""
self.activeWindow().previousTask()
##################################################################
## Below are the action methods for the spell checking functions
##################################################################
def __setAutoSpellChecking(self):
"""
Private slot to set the automatic spell checking of all editors.
"""
enabled = self.autoSpellCheckAct.isChecked()
Preferences.setEditor("AutoSpellCheckingEnabled", int(enabled))
for editor in self.editors:
editor.setAutoSpellChecking()
def __spellCheck(self):
"""
Private slot to perform a spell check of the current editor.
"""
aw = self.activeWindow()
if aw:
aw.checkSpelling()
##################################################################
## Below are general utility methods
##################################################################
def handleResetUI(self):
"""
Public slot to handle the resetUI signal.
"""
editor = self.activeWindow()
if editor is None:
self.__setSbFile()
else:
line, pos = editor.getCursorPosition()
enc = editor.getEncoding()
lang = editor.getLanguage()
eol = editor.getEolIndicator()
self.__setSbFile(editor.getFileName(), line + 1, pos, enc, lang, eol)
def closeViewManager(self):
"""
Public method to shutdown the viewmanager.
If it cannot close all editor windows, it aborts the shutdown process.
@return flag indicating success (boolean)
"""
self.disconnect(e4App(), SIGNAL("focusChanged(QWidget*, QWidget*)"),
self.appFocusChanged)
self.closeAllWindows()
# save the list of recently opened projects
self.__saveRecent()
# save the list of recently opened projects
Preferences.Prefs.settings.setValue('Bookmarked/Sources',
QVariant(self.bookmarked))
if len(self.editors):
res = False
else:
res = True
if not res:
self.connect(e4App(), SIGNAL("focusChanged(QWidget*, QWidget*)"),
elf.appFocusChanged)
return res
def __lastEditorClosed(self):
"""
Private slot to handle the lastEditorClosed signal.
"""
self.closeActGrp.setEnabled(False)
self.saveActGrp.setEnabled(False)
self.exportersMenuAct.setEnabled(False)
self.printAct.setEnabled(False)
if self.printPreviewAct:
self.printPreviewAct.setEnabled(False)
self.editActGrp.setEnabled(False)
self.searchActGrp.setEnabled(False)
self.quickFindtextCombo.setEnabled(False)
self.viewActGrp.setEnabled(False)
self.viewFoldActGrp.setEnabled(False)
self.unhighlightAct.setEnabled(False)
self.splitViewAct.setEnabled(False)
self.splitOrientationAct.setEnabled(False)
self.macroActGrp.setEnabled(False)
self.bookmarkActGrp.setEnabled(False)
self.__enableSpellingActions()
self.__setSbFile()
# remove all split views, if this is supported
if self.canSplit():
while self.removeSplit(): pass
# stop the autosave timer
if self.autosaveTimer.isActive():
self.autosaveTimer.stop()
# close the search and replace forms
self.searchDlg.close()
self.replaceDlg.close()
def __editorOpened(self):
"""
Private slot to handle the editorOpened signal.
"""
self.closeActGrp.setEnabled(True)
self.saveActGrp.setEnabled(True)
self.exportersMenuAct.setEnabled(True)
self.printAct.setEnabled(True)
if self.printPreviewAct:
self.printPreviewAct.setEnabled(True)
self.editActGrp.setEnabled(True)
self.searchActGrp.setEnabled(True)
self.quickFindtextCombo.setEnabled(True)
self.viewActGrp.setEnabled(True)
self.viewFoldActGrp.setEnabled(True)
self.unhighlightAct.setEnabled(True)
if self.canSplit():
self.splitViewAct.setEnabled(True)
self.splitOrientationAct.setEnabled(True)
self.macroActGrp.setEnabled(True)
self.bookmarkActGrp.setEnabled(True)
self.__enableSpellingActions()
# activate the autosave timer
if not self.autosaveTimer.isActive() and \
self.autosaveInterval > 0:
self.autosaveTimer.start(self.autosaveInterval * 60000)
def __autosave(self):
"""
Private slot to save the contents of all editors automatically.
Only named editors will be saved by the autosave timer.
"""
for editor in self.editors:
if editor.shouldAutosave():
ok, newName = editor.saveFile()
if ok:
self.setEditorName(editor, newName)
# restart autosave timer
if self.autosaveInterval > 0:
self.autosaveTimer.start(self.autosaveInterval * 60000)
def _checkActions(self, editor, setSb = True):
"""
Protected slot to check some actions for their enable/disable status
and set the statusbar info.
@param editor editor window
@param setSb flag indicating an update of the status bar is wanted (boolean)
"""
if editor is not None:
self.saveAct.setEnabled(editor.isModified())
self.revertAct.setEnabled(editor.isModified())
self.undoAct.setEnabled(editor.isUndoAvailable())
self.redoAct.setEnabled(editor.isRedoAvailable())
lex = editor.getLexer()
if lex is not None:
self.commentAct.setEnabled(lex.canBlockComment())
self.uncommentAct.setEnabled(lex.canBlockComment())
self.streamCommentAct.setEnabled(lex.canStreamComment())
self.boxCommentAct.setEnabled(lex.canBoxComment())
else:
self.commentAct.setEnabled(False)
self.uncommentAct.setEnabled(False)
self.streamCommentAct.setEnabled(False)
self.boxCommentAct.setEnabled(False)
if editor.hasBookmarks():
self.bookmarkNextAct.setEnabled(True)
self.bookmarkPreviousAct.setEnabled(True)
self.bookmarkClearAct.setEnabled(True)
else:
self.bookmarkNextAct.setEnabled(False)
self.bookmarkPreviousAct.setEnabled(False)
self.bookmarkClearAct.setEnabled(False)
if editor.hasSyntaxErrors():
self.syntaxErrorGotoAct.setEnabled(True)
self.syntaxErrorClearAct.setEnabled(True)
else:
self.syntaxErrorGotoAct.setEnabled(False)
self.syntaxErrorClearAct.setEnabled(False)
if editor.hasCoverageMarkers():
self.notcoveredNextAct.setEnabled(True)
self.notcoveredPreviousAct.setEnabled(True)
else:
self.notcoveredNextAct.setEnabled(False)
self.notcoveredPreviousAct.setEnabled(False)
if editor.hasTaskMarkers():
self.taskNextAct.setEnabled(True)
self.taskPreviousAct.setEnabled(True)
else:
self.taskNextAct.setEnabled(False)
self.taskPreviousAct.setEnabled(False)
if editor.canAutoCompleteFromAPIs():
self.autoCompleteFromAPIsAct.setEnabled(True)
else:
self.autoCompleteFromAPIsAct.setEnabled(False)
if setSb:
line, pos = editor.getCursorPosition()
enc = editor.getEncoding()
lang = editor.getLanguage()
eol = editor.getEolIndicator()
self.__setSbFile(editor.getFileName(), line + 1, pos, enc, lang, eol)
self.emit(SIGNAL('checkActions'), editor)
def preferencesChanged(self):
"""
Public slot to handle the preferencesChanged signal.
This method performs the following actions
- reread the colours for the syntax highlighting
- reloads the already created API objetcs
- starts or stops the autosave timer
- Note: changes in viewmanager type are activated
on an application restart.
"""
# reload the APIs
self.apisManager.reloadAPIs()
# reload editor settings
for editor in self.editors:
editor.readSettings()
# reload the autosave timer setting
self.autosaveInterval = Preferences.getEditor("AutosaveInterval")
if len(self.editors):
if self.autosaveTimer.isActive() and \
self.autosaveInterval == 0:
self.autosaveTimer.stop()
elif not self.autosaveTimer.isActive() and \
self.autosaveInterval > 0:
self.autosaveTimer.start(self.autosaveInterval * 60000)
self.__enableSpellingActions()
def __editorSaved(self, fn):
"""
Private slot to handle the editorSaved signal.
It simply reemits the signal.
@param fn filename of the saved editor
"""
self.emit(SIGNAL('editorSaved'), fn)
def __cursorChanged(self, fn, line, pos):
"""
Private slot to handle the cursorChanged signal.
It emits the signal cursorChanged with parameter editor.
@param fn filename (string)
@param line line number of the cursor (int)
@param pos position in line of the cursor (int)
"""
editor = self.getOpenEditor(fn)
if editor is None:
editor = self.sender()
if editor is not None:
enc = editor.getEncoding()
lang = editor.getLanguage()
eol = editor.getEolIndicator()
else:
enc = None
lang = None
eol = None
self.__setSbFile(fn, line, pos, enc, lang, eol)
self.emit(SIGNAL('cursorChanged'), editor)
def __breakpointToggled(self, editor):
"""
Private slot to handle the breakpointToggled signal.
It simply reemits the signal.
@param editor editor that sent the signal
"""
self.emit(SIGNAL('breakpointToggled'), editor)
def getActions(self, type):
"""
Public method to get a list of all actions.
@param type string denoting the action set to get.
It must be one of "edit", "file", "search",
"view", "window", "macro" or "bookmark"
@return list of all actions (list of E4Action)
"""
try:
exec 'actionList = self.%sActions[:]' % type
except AttributeError:
actionList = []
return actionList
def __editorCommand(self, cmd):
"""
Private method to send an editor command to the active window.
@param cmd the scintilla command to be sent
"""
focusWidget = QApplication.focusWidget()
if focusWidget == e4App().getObject("Shell"):
e4App().getObject("Shell").editorCommand(cmd)
elif focusWidget == self.quickFindtextCombo:
self.quickFindtextCombo._editor.editorCommand(cmd)
else:
aw = self.activeWindow()
if aw:
aw.editorCommand(cmd)
def __newLineBelow(self):
"""
Private method to insert a new line below the current one even if
cursor is not at the end of the line.
"""
focusWidget = QApplication.focusWidget()
if focusWidget == e4App().getObject("Shell") or \
focusWidget == self.quickFindtextCombo:
return
else:
aw = self.activeWindow()
if aw:
aw.newLineBelow()
def __editorConfigChanged(self):
"""
Private method to handle changes of an editors configuration (e.g. language).
"""
editor = self.sender()
fn = editor.getFileName()
line, pos = editor.getCursorPosition()
enc = editor.getEncoding()
lang = editor.getLanguage()
eol = editor.getEolIndicator()
self.__setSbFile(fn, line + 1, pos, encoding = enc, language = lang, eol = eol)
##################################################################
## Below are protected utility methods
##################################################################
def _getOpenStartDir(self):
"""
Protected method to return the starting directory for a file open dialog.
The appropriate starting directory is calculated
using the following search order, until a match is found:
1: Directory of currently active editor
2: Directory of currently active Project
3: CWD
@return name of directory to start (string) or None
"""
# if we have an active source, return its path
if self.activeWindow() is not None and \
self.activeWindow().getFileName():
return os.path.dirname(self.activeWindow().getFileName())
# check, if there is an active project and return its path
elif e4App().getObject("Project").isOpen():
return e4App().getObject("Project").ppath
else:
return Preferences.getMultiProject("Workspace") or Utilities.getHomeDir()
def _getOpenFileFilter(self):
"""
Protected method to return the active filename filter for a file open dialog.
The appropriate filename filter is determined by file extension of
the currently active editor.
@return name of the filename filter (QString) or None
"""
if self.activeWindow() is not None and \
self.activeWindow().getFileName():
ext = os.path.splitext(self.activeWindow().getFileName())[1]
rx = QRegExp(".*\*\.%s[ )].*" % ext[1:])
filters = QScintilla.Lexers.getOpenFileFiltersList()
index = filters.indexOf(rx)
if index == -1:
return QString(Preferences.getEditor("DefaultOpenFilter"))
else:
return filters[index]
else:
return QString(Preferences.getEditor("DefaultOpenFilter"))
##################################################################
## Below are API handling methods
##################################################################
def getAPIsManager(self):
"""
Public method to get a reference to the APIs manager.
@return the APIs manager object (eric4.QScintilla.APIsManager)
"""
return self.apisManager
eric4-4.5.18/eric/ViewManager/PaxHeaders.8617/__init__.py 0000644 0001750 0000144 00000000130 12261012647 021026 x ustar 00 0000000 0000000 28 mtime=1388582311.7660741
30 atime=1389081057.416723465
30 ctime=1389081086.307724332
eric4-4.5.18/eric/ViewManager/__init__.py 0000644 0001750 0000144 00000003275 12261012647 020571 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2014 Detlev Offenbach
#
"""
Package implementing the viewmanager of the eric4 IDE.
The viewmanager is responsible for the layout of the editor windows. This is
the central part of the IDE. In additon to this, the viewmanager provides all
editor related actions, menus and toolbars.
View managers are provided as plugins and loaded via the factory function. If
the requested view manager type is not available, tabview will be used by
default.
"""
import Preferences
######################################################################
## Below is the factory function to instantiate the appropriate
## viewmanager depending on the configuration settings
######################################################################
def factory(parent, ui, dbs, pluginManager):
"""
Modul factory function to generate the right viewmanager type.
The viewmanager is instantiated depending on the data set in
the current preferences.
@param parent parent widget (QWidget)
@param ui reference to the main UI object
@param dbs reference to the debug server object
@param pluginManager reference to the plugin manager object
@return the instantiated viewmanager
"""
viewManagerStr = Preferences.getViewManager()
vm = pluginManager.getPluginObject("viewmanager", viewManagerStr)
if vm is None:
# load tabview view manager as default
vm = pluginManager.getPluginObject("viewmanager", "tabview")
if vm is None:
raise RuntimeError("Could not create a viemanager object.")
Preferences.setViewManager("tabview")
vm.setReferences(ui, dbs)
return vm
eric4-4.5.18/eric/ViewManager/PaxHeaders.8617/BookmarkedFilesDialog.ui 0000644 0001750 0000144 00000000074 11072435335 023446 x ustar 00 0000000 0000000 30 atime=1389081057.416723465
30 ctime=1389081086.307724332
eric4-4.5.18/eric/ViewManager/BookmarkedFilesDialog.ui 0000644 0001750 0000144 00000015245 11072435335 023202 0 ustar 00detlev users 0000000 0000000
BookmarkedFilesDialog
0
0
475
391
Configure Bookmarked Files Menu
true
-
-
true
-
false
Delete the selected entry
<b>Delete</b>
<p>Delete the selected entry.</p>
&Delete
Alt+D
-
Qt::Vertical
QSizePolicy::Expanding
87
130
-
false
Move up
<b>Move Up</b>
<p>Move the selected entry up.</p>
&Up
Alt+U
-
Select the file via a file selection dialog
<b>File</b>
<p>Select the file to be bookmarked via a file selection dialog.</p>
...
-
false
Move down
<b>Move Down</b>
<p>Move the selected entry down.</p>
&Down
Alt+D
-
false
Add a new bookmarked file
<b>Add</b>
<p>Add a new bookmarked file with the value entered below.</p>
&Add
Alt+A
-
&File:
fileEdit
-
false
Change the value of the selected entry
<b>Change</b>
<p>Change the value of the selected entry.</p>
C&hange
Alt+H
-
Enter the filename of the file
<b>File</b>
<p>Enter the filename of the bookmarked file.</p>
-
Qt::Horizontal
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
qPixmapFromMimeSource
filesList
addButton
changeButton
deleteButton
upButton
downButton
fileEdit
fileButton
buttonBox
accepted()
BookmarkedFilesDialog
accept()
25
373
25
388
buttonBox
rejected()
BookmarkedFilesDialog
reject()
105
370
105
389
eric4-4.5.18/eric/PaxHeaders.8617/Templates 0000644 0001750 0000144 00000000132 12262730776 016406 x ustar 00 0000000 0000000 30 mtime=1389081086.300724332
30 atime=1389081086.305724332
30 ctime=1389081086.315724332
eric4-4.5.18/eric/Templates/ 0000755 0001750 0000144 00000000000 12262730776 016215 5 ustar 00detlev users 0000000 0000000 eric4-4.5.18/eric/Templates/PaxHeaders.8617/TemplateSingleVariableDialog.ui 0000644 0001750 0000144 00000000073 11072435344 024520 x ustar 00 0000000 0000000 29 atime=1389081057.46272347
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/TemplateSingleVariableDialog.ui 0000644 0001750 0000144 00000004475 11072435344 024260 0 ustar 00detlev users 0000000 0000000
TemplateSingleVariableDialog
0
0
403
218
Enter Template Variable
true
-
Enter the value for the variable.
QTextEdit::NoWrap
false
-
Variable:
Qt::AlignTop
-
Qt::Horizontal
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
qPixmapFromMimeSource
variableEdit
buttonBox
accepted()
TemplateSingleVariableDialog
accept()
40
195
40
217
buttonBox
rejected()
TemplateSingleVariableDialog
reject()
96
197
96
217
eric4-4.5.18/eric/Templates/PaxHeaders.8617/TemplateSingleVariableDialog.py 0000644 0001750 0000144 00000000132 12261012647 024525 x ustar 00 0000000 0000000 30 mtime=1388582311.773074189
30 atime=1389081057.483723474
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/TemplateSingleVariableDialog.py 0000644 0001750 0000144 00000002003 12261012647 024252 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2014 Detlev Offenbach
#
"""
Module implementing a dialog for entering a single template variable.
"""
from PyQt4.QtGui import QDialog
from Ui_TemplateSingleVariableDialog import Ui_TemplateSingleVariableDialog
class TemplateSingleVariableDialog(QDialog, Ui_TemplateSingleVariableDialog):
"""
Class implementing a dialog for entering a single template variable.
"""
def __init__(self, variable, parent = None):
"""
Constructor
@param variable template variable name (string)
@param parent parent widget of this dialog (QWidget)
"""
QDialog.__init__(self, parent)
self.setupUi(self)
self.variableLabel.setText(variable)
def getVariable(self):
"""
Public method to get the value for the variable.
@return value for the template variable (string)
"""
return unicode(self.variableEdit.toPlainText())
eric4-4.5.18/eric/Templates/PaxHeaders.8617/__init__.py 0000644 0001750 0000144 00000000132 12261012647 020561 x ustar 00 0000000 0000000 30 mtime=1388582311.776074227
30 atime=1389081057.483723474
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/__init__.py 0000644 0001750 0000144 00000000242 12261012647 020311 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2006 - 2014 Detlev Offenbach
#
"""
Package containing modules for the templating system.
"""
eric4-4.5.18/eric/Templates/PaxHeaders.8617/TemplatePropertiesDialog.py 0000644 0001750 0000144 00000000132 12261012647 023772 x ustar 00 0000000 0000000 30 mtime=1388582311.785074342
30 atime=1389081057.483723474
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/TemplatePropertiesDialog.py 0000644 0001750 0000144 00000020015 12261012647 023522 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2014 Detlev Offenbach
#
"""
Module implementing the templates properties dialog.
"""
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from KdeQt import KQMessageBox
import QScintilla.Lexers
from Ui_TemplatePropertiesDialog import Ui_TemplatePropertiesDialog
class TemplatePropertiesDialog(QDialog, Ui_TemplatePropertiesDialog):
"""
Class implementing the templates properties dialog.
"""
def __init__(self, parent, groupMode = False, itm = None):
"""
Constructor
@param parent the parent widget (QWidget)
@param groupMode flag indicating group mode (boolean)
@param itm item (TemplateEntry or TemplateGroup) to
read the data from
"""
QDialog.__init__(self, parent)
self.setupUi(self)
if not groupMode:
self.nameEdit.setWhatsThis(self.trUtf8(
"""Template nameEnter the name of the template."""
""" Templates may be autocompleted upon this name."""
""" In order to support autocompletion. the template name"""
""" must only consist of letters (a-z and A-Z),"""
""" digits (0-9) and underscores (_).
"""
))
self.__nameValidator = QRegExpValidator(QRegExp("[a-zA-Z0-9_]+"),
self.nameEdit)
self.nameEdit.setValidator(self.__nameValidator)
self.languages = [("All", self.trUtf8("All"))]
supportedLanguages = QScintilla.Lexers.getSupportedLanguages()
languages = supportedLanguages.keys()
languages.sort()
for language in languages:
self.languages.append((language, supportedLanguages[language][0]))
self.groupMode = groupMode
if groupMode:
langList = QStringList()
for lang, langDisp in self.languages:
langList.append(langDisp)
self.groupLabel.setText(self.trUtf8("Language:"))
self.groupCombo.addItems(langList)
self.templateLabel.setEnabled(False)
self.templateEdit.setEnabled(False)
self.templateEdit.setPlainText(self.trUtf8("GROUP"))
self.helpButton.setEnabled(False)
self.descriptionLabel.hide()
self.descriptionEdit.hide()
else:
groups = QStringList()
for group in parent.getGroupNames():
groups.append(group)
self.groupCombo.addItems(groups)
if itm is not None:
self.nameEdit.setText(itm.getName())
if groupMode:
lang = itm.getLanguage()
for l, d in self.languages:
if l == lang:
self.setSelectedGroup(d)
break
else:
self.setSelectedGroup(itm.getGroupName())
self.templateEdit.setPlainText(itm.getTemplateText())
self.descriptionEdit.setText(itm.getDescription())
self.nameEdit.selectAll()
def keyPressEvent(self, ev):
"""
Re-implemented to handle the user pressing the escape key.
@param ev key event (QKeyEvent)
"""
if ev.key() == Qt.Key_Escape:
res = KQMessageBox.question(self,
self.trUtf8("Close dialog"),
self.trUtf8("""Do you really want to close the dialog?"""),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res == QMessageBox.Yes:
self.reject()
@pyqtSignature("")
def on_helpButton_clicked(self):
"""
Public slot to show some help.
"""
KQMessageBox.information(self,
self.trUtf8("Template Help"),
self.trUtf8(\
"""To use variables in a template, you just have to enclose"""
""" the variablename with $-characters. When you use the template,"""
""" you will then be asked for a value for this variable.
"""
"""Example template: This is a $VAR$
"""
"""When you use this template you will be prompted for a value"""
""" for the variable $VAR$. Any occurrences of $VAR$ will then be"""
""" replaced with whatever you've entered.
"""
"""If you need a single $-character in a template, which is not"""
""" used to enclose a variable, type $$(two dollar characters)"""
""" instead. They will automatically be replaced with a single"""
""" $-character when you use the template.
"""
"""If you want a variables contents to be treated specially,"""
""" the variablename must be followed by a ':' and one formatting"""
""" specifier (e.g. $VAR:ml$). The supported specifiers are:"""
"""
"""
"""ml | Specifies a multiline formatting."""
""" The first line of the variable contents is prefixed with the string"""
""" occuring before the variable on the same line of the template."""
""" All other lines are prefixed by the same amount of whitespace"""
""" as the line containing the variable."""
""" |
"""
"""rl | Specifies a repeated line formatting."""
""" Each line of the variable contents is prefixed with the string"""
""" occuring before the variable on the same line of the template."""
""" |
"""
"""
"""
"""The following predefined variables may be used in a template:"""
"""
"""
"""date | """
"""today's date in ISO format (YYYY-MM-DD) |
"""
"""year | """
"""the current year |
"""
"""project_name | """
"""the name of the project (if any) |
"""
"""path_name | """
"""full path of the current file |
"""
"""dir_name | """
"""full path of the parent directory |
"""
"""file_name | """
"""the current file name (without directory) |
"""
"""base_name | """
"""like file_name, but without extension |
"""
"""ext | """
"""the extension of the current file |
"""
"""
"""
"""If you want to change the default delimiter to anything"""
""" different, please use the configuration dialog to do so.
"""))
def setSelectedGroup(self, name):
"""
Public method to select a group.
@param name name of the group to be selected (string or QString)
"""
index = self.groupCombo.findText(name)
self.groupCombo.setCurrentIndex(index)
def getData(self):
"""
Public method to get the data entered into the dialog.
@return a tuple of two strings (name, language), if the dialog is in group mode,
and a tuple of four strings (name, description,group name, template)
otherwise.
"""
if self.groupMode:
return (unicode(self.nameEdit.text()),
self.languages[self.groupCombo.currentIndex()][0]
)
else:
return (unicode(self.nameEdit.text()),
unicode(self.descriptionEdit.text()),
unicode(self.groupCombo.currentText()),
unicode(self.templateEdit.toPlainText())
)
eric4-4.5.18/eric/Templates/PaxHeaders.8617/TemplatePropertiesDialog.ui 0000644 0001750 0000144 00000000074 11114310101 023742 x ustar 00 0000000 0000000 30 atime=1389081057.483723474
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/TemplatePropertiesDialog.ui 0000644 0001750 0000144 00000011667 11114310101 023502 0 ustar 00detlev users 0000000 0000000
TemplatePropertiesDialog
0
0
448
323
Template Properties
true
-
-
Name:
-
Enter the name of the template/group. Templates are autocompleted upon this name.
-
Description:
-
Enter a description for the template
-
Group:
-
-
Template:
Qt::AlignTop
-
Enter the text of the template
<b>Template Text</b>
<p>Enter the template text in this area. Every occurrence of $VAR$ will be replaced
by the associated text when the template is applied. Predefined variables may be used in the template. The separator character might
be changed via the preferences dialog.</p>
<p>Press the help button for more information.</p>
QTextEdit::NoWrap
false
-
&Help
Alt+H
-
Qt::Vertical
QSizePolicy::Expanding
84
98
-
Qt::Horizontal
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
qPixmapFromMimeSource
nameEdit
descriptionEdit
groupCombo
templateEdit
helpButton
buttonBox
buttonBox
rejected()
TemplatePropertiesDialog
reject()
80
307
80
319
buttonBox
accepted()
TemplatePropertiesDialog
accept()
45
300
41
324
eric4-4.5.18/eric/Templates/PaxHeaders.8617/TemplateMultipleVariablesDialog.py 0000644 0001750 0000144 00000000131 12261012647 025261 x ustar 00 0000000 0000000 29 mtime=1388582311.78807438
30 atime=1389081057.484723474
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/TemplateMultipleVariablesDialog.py 0000644 0001750 0000144 00000010373 12261012647 025020 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2014 Detlev Offenbach
#
"""
Module implementing a dialog for entering multiple template variables.
"""
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class TemplateMultipleVariablesDialog(QDialog):
"""
Class implementing a dialog for entering multiple template variables.
"""
def __init__(self, variables, parent = None):
"""
Constructor
@param variables list of template variable names (list of strings)
@param parent parent widget of this dialog (QWidget)
"""
QDialog.__init__(self, parent)
self.TemplateMultipleVariablesDialogLayout = QVBoxLayout(self)
self.TemplateMultipleVariablesDialogLayout.setMargin(6)
self.TemplateMultipleVariablesDialogLayout.setSpacing(6)
self.TemplateMultipleVariablesDialogLayout.setObjectName(\
"TemplateMultipleVariablesDialogLayout")
self.setLayout(self.TemplateMultipleVariablesDialogLayout)
# generate the scrollarea
self.variablesView = QScrollArea(self)
self.variablesView.setObjectName("variablesView")
self.TemplateMultipleVariablesDialogLayout.addWidget(self.variablesView)
self.variablesView.setWidgetResizable(True)
self.variablesView.setFrameStyle(QFrame.NoFrame)
self.top = QWidget(self)
self.variablesView.setWidget(self.top)
self.grid = QGridLayout(self.top)
self.grid.setMargin(0)
self.grid.setSpacing(6)
self.top.setLayout(self.grid)
# populate the scrollarea with labels and text edits
self.variablesEntries = {}
row = 0
for var in variables:
l = QLabel("%s:" % var, self.top)
self.grid.addWidget(l, row, 0, Qt.Alignment(Qt.AlignTop))
if var.find(":") >= 0:
formatStr = var[1:-1].split(":")[1]
if formatStr in ["ml", "rl"]:
t = QTextEdit(self.top)
t.setTabChangesFocus(True)
else:
t = QLineEdit(self.top)
else:
t = QLineEdit(self.top)
self.grid.addWidget(t, row, 1)
self.variablesEntries[var] = t
row += 1
# add a spacer to make the entries aligned at the top
spacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.grid.addItem(spacer, row, 1)
self.variablesEntries[variables[0]].setFocus()
self.top.adjustSize()
# generate the buttons
layout1 = QHBoxLayout()
layout1.setMargin(0)
layout1.setSpacing(6)
layout1.setObjectName("layout1")
spacer1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
layout1.addItem(spacer1)
self.okButton = QPushButton(self)
self.okButton.setObjectName("okButton")
self.okButton.setDefault(True)
layout1.addWidget(self.okButton)
self.cancelButton = QPushButton(self)
self.cancelButton.setObjectName("cancelButton")
layout1.addWidget(self.cancelButton)
spacer2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
layout1.addItem(spacer2)
self.TemplateMultipleVariablesDialogLayout.addLayout(layout1)
# set the texts of the standard widgets
self.setWindowTitle(self.trUtf8("Enter Template Variables"))
self.okButton.setText(self.trUtf8("&OK"))
self.cancelButton.setText(self.trUtf8("&Cancel"))
# polish up the dialog
self.resize(QSize(400, 480).expandedTo(self.minimumSizeHint()))
self.connect(self.okButton, SIGNAL("clicked()"), self.accept)
self.connect(self.cancelButton, SIGNAL("clicked()"), self.reject)
def getVariables(self):
"""
Public method to get the values for all variables.
@return dictionary with the variable as a key and its value (string)
"""
values = {}
for var, textEdit in self.variablesEntries.items():
try:
values[var] = unicode(textEdit.text())
except AttributeError:
values[var] = unicode(textEdit.toPlainText())
return values
eric4-4.5.18/eric/Templates/PaxHeaders.8617/TemplateViewer.py 0000644 0001750 0000144 00000000132 12261012647 021757 x ustar 00 0000000 0000000 30 mtime=1388582311.791074418
30 atime=1389081057.484723474
30 ctime=1389081086.307724332
eric4-4.5.18/eric/Templates/TemplateViewer.py 0000644 0001750 0000144 00000102623 12261012647 021515 0 ustar 00detlev users 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2014 Detlev Offenbach
#
"""
Module implementing a template viewer and associated classes.
"""
import datetime
import os
import sys
import re
import cStringIO
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from KdeQt.KQApplication import e4App
from TemplatePropertiesDialog import TemplatePropertiesDialog
from TemplateMultipleVariablesDialog import TemplateMultipleVariablesDialog
from TemplateSingleVariableDialog import TemplateSingleVariableDialog
import Preferences
from E4XML.XMLUtilities import make_parser
from E4XML.XMLErrorHandler import XMLErrorHandler, XMLFatalParseError
from E4XML.XMLEntityResolver import XMLEntityResolver
from E4XML.TemplatesHandler import TemplatesHandler
from E4XML.TemplatesWriter import TemplatesWriter
import UI.PixmapCache
import Utilities
from KdeQt import KQMessageBox, KQFileDialog
from KdeQt.KQApplication import e4App
class TemplateGroup(QTreeWidgetItem):
"""
Class implementing a template group.
"""
def __init__(self, parent, name, language = "All"):
"""
Constructor
@param parent parent widget of the template group (QWidget)
@param name name of the group (string or QString)
@param language programming language for the group (string or QString)
"""
self.name = unicode(name)
self.language = unicode(language)
self.entries = {}
QTreeWidgetItem.__init__(self, parent, QStringList(name))
if Preferences.getTemplates("ShowTooltip"):
self.setToolTip(0, language)
def setName(self, name):
"""
Public method to update the name of the group.
@param name name of the group (string or QString)
"""
self.name = unicode(name)
self.setText(0, name)
def getName(self):
"""
Public method to get the name of the group.
@return name of the group (string)
"""
return self.name
def setLanguage(self, language):
"""
Public method to update the name of the group.
@param language programming language for the group (string or QString)
"""
self.language = unicode(language)
if Preferences.getTemplates("ShowTooltip"):
self.setToolTip(0, language)
def getLanguage(self):
"""
Public method to get the name of the group.
@return language of the group (string)
"""
return self.language
def addEntry(self, name, description, template, quiet = False):
"""
Public method to add a template entry to this group.
@param name name of the entry (string or QString)
@param description description of the entry to add (string or QString)
@param template template text of the entry (string or QString)
@param quiet flag indicating quiet operation (boolean)
"""
name = unicode(name)
if self.entries.has_key(name):
if not quiet:
KQMessageBox.critical(None,
QApplication.translate("TemplateGroup", "Add Template"),
QApplication.translate("TemplateGroup",
"""The group %1 already contains a"""
""" template named %2.
""")\
.arg(self.name).arg(name))
return
self.entries[name] = TemplateEntry(self, name, description, template)
if Preferences.getTemplates("AutoOpenGroups") and not self.isExpanded():
self.setExpanded(True)
def removeEntry(self, name):
"""
Public method to remove a template entry from this group.
@param name name of the entry to be removed (string or QString)
"""
name = unicode(name)
if not self.entries.has_key(name):
return
index = self.indexOfChild(self.entries[name])
self.takeChild(index)
del self.entries[name]
if len(self.entries) == 0:
if Preferences.getTemplates("AutoOpenGroups") and self.isExpanded():
self.setExpanded(False)
def removeAllEntries(self):
"""
Public method to remove all template entries of this group.
"""
for name in self.entries.keys()[:]:
self.removeEntry(name)
def hasEntry(self, name):
"""
Public method to check, if the group has an entry with the given name.
@param name name of the entry to check for (string or QString)
@return flag indicating existence (boolean)
"""
return unicode(name) in self.entries
def getEntry(self, name):
"""
Public method to get an entry.
@param name name of the entry to retrieve (string or QString)
@return reference to the entry (TemplateEntry)
"""
try:
return self.entries[unicode(name)]
except KeyError:
return None
def getEntryNames(self, beginning):
"""
Public method to get the names of all entries, who's name starts with the
given string.
@param beginning string denoting the beginning of the template name
(string or QString)
@return list of entry names found (list of strings)
"""
beginning = unicode(beginning)
names = []
for name in self.entries:
if name.startswith(beginning):
names.append(name)
return names
def getAllEntries(self):
"""
Public method to retrieve all entries.
@return list of all entries (list of TemplateEntry)
"""
return self.entries.values()
class TemplateEntry(QTreeWidgetItem):
"""
Class immplementing a template entry.
"""
def __init__(self, parent, name, description, templateText):
"""
Constructor
@param parent parent widget of the template entry (QWidget)
@param name name of the entry (string or QString)
@param description descriptive text for the template (string or QString)
@param templateText text of the template entry (string or QString)
"""
self.name = unicode(name)
self.description = unicode(description)
self.template = unicode(templateText)
self.__extractVariables()
QTreeWidgetItem.__init__(self, parent, QStringList(self.__displayText()))
if Preferences.getTemplates("ShowTooltip"):
self.setToolTip(0, self.template)
def __displayText(self):
"""
Private method to generate the display text.
@return display text (QString)
"""
if self.description:
txt = QString("%1 - %2").arg(self.name).arg(self.description)
else:
txt = QString(self.name)
return txt
def setName(self, name):
"""
Public method to update the name of the entry.
@param name name of the entry (string or QString)
"""
self.name = unicode(name)
self.setText(0, self.__displayText())
def getName(self):
"""
Public method to get the name of the entry.
@return name of the entry (string)
"""
return self.name
def setDescription(self, description):
"""
Public method to update the description of the entry.
@param description description of the entry (string or QString)
"""
self.description = unicode(description)
self.setText(0, self.__displayText())
def getDescription(self):
"""
Public method to get the description of the entry.
@return description of the entry (string)
"""
return self.description
def getGroupName(self):
"""
Public method to get the name of the group this entry belongs to.
@return name of the group containing this entry (string)
"""
return self.parent().getName()
def setTemplateText(self, templateText):
"""
Public method to update the template text.
@param templateText text of the template entry (string or QString)
"""
self.template = unicode(templateText)
self.__extractVariables()
if Preferences.getTemplates("ShowTooltip"):
self.setToolTip(0, self.template)
def getTemplateText(self):
"""
Public method to get the template text.
@return the template text (string)
"""
return self.template
def getExpandedText(self, varDict, indent):
"""
Public method to get the template text with all variables expanded.
@param varDict dictionary containing the texts of each variable
with the variable name as key.
@param indent indentation of the line receiving he expanded
template text (string)
@return a tuple of the expanded template text (string), the
number of lines (integer) and the length of the last line (integer)
"""
txt = self.template
for var, val in varDict.items():
if var in self.formatedVariables:
txt = self.__expandFormattedVariable(var, val, txt)
else:
txt = txt.replace(var, val)
sepchar = str(Preferences.getTemplates("SeparatorChar"))
txt = txt.replace("%s%s" % (sepchar, sepchar), sepchar)
prefix = "%s%s" % (os.linesep, indent)
trailingEol = txt.endswith(os.linesep)
lines = txt.splitlines()
lineCount = len(lines)
lineLen = len(lines[-1])
txt = prefix.join(lines).lstrip()
if trailingEol:
txt = "%s%s" % (txt, os.linesep)
lineCount += 1
lineLen = 0
return txt, lineCount, lineLen
def __expandFormattedVariable(self, var, val, txt):
"""
Private method to expand a template variable with special formatting.
@param var template variable name (string)
@param val value of the template variable (string)
@param txt template text (string)
"""
t = ""
for line in txt.splitlines():
ind = line.find(var)
if ind >= 0:
format = var[1:-1].split(':', 1)[1]
if format == 'rl':
prefix = line[:ind]
postfix = line [ind+len(var):]
for v in val.splitlines():
t = "%s%s%s%s%s" % (t, os.linesep, prefix, v, postfix)
elif format == 'ml':
indent = line.replace(line.lstrip(), "")
prefix = line[:ind]
postfix = line[ind + len(var):]
count = 0
for v in val.splitlines():
if count:
t = "%s%s%s%s" % (t, os.linesep, indent, v)
else:
t = "%s%s%s%s" % (t, os.linesep, prefix, v)
count += 1
t = "%s%s" % (t, postfix)
else:
t = "%s%s%s" % (t, os.linesep, line)
else:
t = "%s%s%s" % (t, os.linesep, line)
return "".join(t.splitlines(1)[1:])
def getVariables(self):
"""
Public method to get the list of variables.
@return list of variables (list of strings)
"""
return self.variables
def __extractVariables(self):
"""
Private method to retrieve the list of variables.
"""
sepchar = str(Preferences.getTemplates("SeparatorChar"))
variablesPattern = \
re.compile(r"""\%s[a-zA-Z][a-zA-Z0-9_]*(?::(?:ml|rl))?\%s""" % \
(sepchar, sepchar))
variables = variablesPattern.findall(self.template)
self.variables = []
self.formatedVariables = []
for var in variables:
if not var in self.variables:
self.variables.append(var)
if var.find(':') >= 0 and not var in self.formatedVariables:
self.formatedVariables.append(var)
class TemplateViewer(QTreeWidget):
"""
Class implementing the template viewer.
"""
def __init__(self, parent, viewmanager):
"""
Constructor
@param parent the parent (QWidget)
@param viewmanager reference to the viewmanager object
"""
QTreeWidget.__init__(self, parent)
self.viewmanager = viewmanager
self.groups = {}
self.setHeaderLabels(QStringList("Template"))
self.header().hide()
self.header().setSortIndicator(0, Qt.AscendingOrder)
self.setRootIsDecorated(True)
self.setAlternatingRowColors(True)
self.__menu = QMenu(self)
self.applyAct = \
self.__menu.addAction(self.trUtf8("Apply"), self.__templateItemActivated)
self.__menu.addSeparator()
self.__menu.addAction(self.trUtf8("Add entry..."), self.__addEntry)
self.__menu.addAction(self.trUtf8("Add group..."), self.__addGroup)
self.__menu.addAction(self.trUtf8("Edit..."), self.__edit)
self.__menu.addAction(self.trUtf8("Remove"), self.__remove)
self.__menu.addSeparator()
self.__menu.addAction(self.trUtf8("Save"), self.__save)
self.__menu.addAction(self.trUtf8("Import..."), self.__import)
self.__menu.addAction(self.trUtf8("Export..."), self.__export)
self.__menu.addSeparator()
self.__menu.addAction(self.trUtf8("Help about Templates..."), self.__showHelp)
self.__menu.addSeparator()
self.__menu.addAction(self.trUtf8("Configure..."), self.__configure)
self.__backMenu = QMenu(self)
self.__backMenu.addAction(self.trUtf8("Add group..."), self.__addGroup)
self.__backMenu.addSeparator()
self.__backMenu.addAction(self.trUtf8("Save"), self.__save)
self.__backMenu.addAction(self.trUtf8("Import..."), self.__import)
self.__backMenu.addAction(self.trUtf8("Export..."), self.__export)
self.__backMenu.addSeparator()
self.__backMenu.addAction(self.trUtf8("Help about Templates..."), self.__showHelp)
self.__backMenu.addSeparator()
self.__backMenu.addAction(self.trUtf8("Configure..."), self.__configure)
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.connect(self, SIGNAL("customContextMenuRequested(const QPoint &)"),
self.__showContextMenu)
self.connect(self, SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
self.__templateItemActivated)
self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
def __resort(self):
"""
Private method to resort the tree.
"""
self.sortItems(self.sortColumn(), self.header().sortIndicatorOrder())
def __templateItemActivated(self, itm = None, col = 0):
"""
Private slot to handle the activation of an item.
@param itm reference to the activated item (QTreeWidgetItem)
@param col column the item was activated in (integer)
"""
itm = self.currentItem()
if isinstance(itm, TemplateEntry):
self.applyTemplate(itm)
def __showContextMenu(self, coord):
"""
Private slot to show the context menu of the list.
@param coord the position of the mouse pointer (QPoint)
"""
itm = self.itemAt(coord)
coord = self.mapToGlobal(coord)
if itm is None:
self.__backMenu.popup(coord)
else:
self.applyAct.setEnabled(self.viewmanager.activeWindow() is not None)
self.__menu.popup(coord)
def __addEntry(self):
"""
Private slot to handle the Add Entry context menu action.
"""
itm = self.currentItem()
if isinstance(itm, TemplateGroup):
groupName = itm.getName()
else:
groupName = itm.getGroupName()
dlg = TemplatePropertiesDialog(self)
dlg.setSelectedGroup(groupName)
if dlg.exec_() == QDialog.Accepted:
name, description, groupName, template = dlg.getData()
self.addEntry(groupName, name, description, template)
def __addGroup(self):
"""
Private slot to handle the Add Group context menu action.
"""
dlg = TemplatePropertiesDialog(self, True)
if dlg.exec_() == QDialog.Accepted:
name, language = dlg.getData()
self.addGroup(name, language)
def __edit(self):
"""
Private slot to handle the Edit context menu action.
"""
itm = self.currentItem()
if isinstance(itm, TemplateEntry):
editGroup = False
else:
editGroup = True
dlg = TemplatePropertiesDialog(self, editGroup, itm)
if dlg.exec_() == QDialog.Accepted:
if editGroup:
name, language = dlg.getData()
self.changeGroup(itm.getName(), name, language)
else:
name, description, groupName, template = dlg.getData()
self.changeEntry(itm, name, groupName, description, template)
def __remove(self):
"""
Private slot to handle the Remove context menu action.
"""
itm = self.currentItem()
res = KQMessageBox.question(self,
self.trUtf8("Remove Template"),
self.trUtf8("""Do you really want to remove %1?
""")\
.arg(itm.getName()),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res != QMessageBox.Yes:
return
if isinstance(itm, TemplateGroup):
self.removeGroup(itm)
else:
self.removeEntry(itm)
def __save(self):
"""
Private slot to handle the Save context menu action.
"""
self.writeTemplates()
def __import(self):
"""
Private slot to handle the Import context menu action.
"""
fn = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Import Templates"),
QString(),
self.trUtf8("Templates Files (*.e3c *.e4c);; All Files (*)"))
if not fn.isEmpty():
self.readTemplates(fn)
def __export(self):
"""
Private slot to handle the Export context menu action.
"""
selectedFilter = QString("")
fn = KQFileDialog.getSaveFileName(\
self,
self.trUtf8("Export Templates"),
QString(),
self.trUtf8("Templates Files (*.e4c);; All Files (*)"),
selectedFilter,
QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
if not fn.isEmpty():
ext = QFileInfo(fn).suffix()
if ext.isEmpty():
ex = selectedFilter.section('(*', 1, 1).section(')', 0, 0)
if not ex.isEmpty():
fn.append(ex)
self.writeTemplates(fn)
def __showHelp(self):
"""
Private method to show some help.
"""
KQMessageBox.information(self,
self.trUtf8("Template Help"),
self.trUtf8("""Template groups are a means of grouping individual"""
""" templates. Groups have an attribute that specifies,"""
""" which programming language they apply for."""
""" In order to add template entries, at least one group"""
""" has to be defined.
"""
"""Template entries are the actual templates."""
""" They are grouped by the template groups. Help about"""
""" how to define them is available in the template edit"""
""" dialog.
"""))
def __getPredefinedVars(self):
"""
Private method to return predefined variables.
@return dictionary of predefined variables and their values
"""
project = e4App().getObject("Project")
editor = self.viewmanager.activeWindow()
today = datetime.datetime.now().date()
sepchar = str(Preferences.getTemplates("SeparatorChar"))
if sepchar == '%':
sepchar = '%%'
keyfmt = sepchar + "%s" + sepchar
varValues = {keyfmt % 'date': today.isoformat(),
keyfmt % 'year': str(today.year)}
if project.name:
varValues[keyfmt % 'project_name'] = project.name
path_name = editor.getFileName()
if path_name:
dir_name, file_name = os.path.split(path_name)
base_name, ext = os.path.splitext(file_name)
if ext:
ext = ext[1:]
varValues.update({
keyfmt % 'path_name': path_name,
keyfmt % 'dir_name': dir_name,
keyfmt % 'file_name': file_name,
keyfmt % 'base_name': base_name,
keyfmt % 'ext': ext
})
return varValues
def applyTemplate(self, itm):
"""
Public method to apply the template.
@param itm reference to the template item to apply (TemplateEntry)
"""
editor = self.viewmanager.activeWindow()
if editor is None:
return
ok = False
vars = itm.getVariables()
varValues = self.__getPredefinedVars()
# Remove predefined variables from list so user doesn't have to fill
# these values out in the dialog.
for v in varValues.keys():
if v in vars:
vars.remove(v)
if vars:
if Preferences.getTemplates("SingleDialog"):
dlg = TemplateMultipleVariablesDialog(vars, self)
if dlg.exec_() == QDialog.Accepted:
varValues.update(dlg.getVariables())
ok = True
else:
for var in vars:
dlg = TemplateSingleVariableDialog(var, self)
if dlg.exec_() == QDialog.Accepted:
varValues[var] = dlg.getVariable()
else:
return
del dlg
ok = True
else:
ok = True
if ok:
line = unicode(editor.text(editor.getCursorPosition()[0]))\
.replace(os.linesep, "")
indent = line.replace(line.lstrip(), "")
txt, lines, count = itm.getExpandedText(varValues, indent)
# It should be done on this way to allow undo
editor.beginUndoAction()
if editor.hasSelectedText():
editor.removeSelectedText()
line, index = editor.getCursorPosition()
editor.insert(txt)
editor.setCursorPosition(line + lines - 1,
count and index + count or 0)
editor.endUndoAction()
editor.setFocus()
def applyNamedTemplate(self, templateName, groupName=""):
"""
Public method to apply a template given a template name.
@param templateName name of the template item to apply (string or QString)
@param groupName name of the group to get the entry from (string or QString).
Empty means to apply the first template found with the given name.
"""
groupName = unicode(groupName)
if groupName:
if self.hasGroup(groupName):
groups = [self.groups[groupName]]
else:
return
else:
groups = self.groups.values()
for group in groups:
template = group.getEntry(templateName)
if template is not None:
self.applyTemplate(template)
break
def addEntry(self, groupName, name, description, template, quiet = False):
"""
Public method to add a template entry.
@param groupName name of the group to add to (string or QString)
@param name name of the entry to add (string or QString)
@param description description of the entry to add (string or QString)
@param template template text of the entry (string or QString)
@param quiet flag indicating quiet operation (boolean)
"""
self.groups[unicode(groupName)].addEntry(unicode(name), unicode(description),
unicode(template), quiet = quiet)
self.__resort()
def hasGroup(self, name):
"""
Public method to check, if a group with the given name exists.
@param name name of the group to be checked for (string or QString)
@return flag indicating an existing group (boolean)
"""
return unicode(name) in self.groups
def addGroup(self, name, language = "All"):
"""
Public method to add a group.
@param name name of the group to be added (string or QString)
@param language programming language for the group (string or QString)
"""
name = unicode(name)
if not self.groups.has_key(name):
self.groups[name] = TemplateGroup(self, name, language)
self.__resort()
def changeGroup(self, oldname, newname, language = "All"):
"""
Public method to rename a group.
@param oldname old name of the group (string or QString)
@param newname new name of the group (string or QString)
@param language programming language for the group (string or QString)
"""
if oldname != newname:
if self.groups.has_key(newname):
KQMessageBox.warning(self,
self.trUtf8("Edit Template Group"),
self.trUtf8("""A template group with the name"""
""" %1 already exists.
""")\
.arg(newname))
return
self.groups[newname] = self.groups[oldname]
del self.groups[oldname]
self.groups[newname].setName(newname)
self.groups[newname].setLanguage(language)
self.__resort()
def getAllGroups(self):
"""
Public method to get all groups.
@return list of all groups (list of TemplateGroup)
"""
return self.groups.values()
def getGroupNames(self):
"""
Public method to get all group names.
@return list of all group names (list of strings)
"""
groups = self.groups.keys()[:]
groups.sort()
return groups
def removeGroup(self, itm):
"""
Public method to remove a group.
@param itm template group to be removed (TemplateGroup)
"""
name = itm.getName()
itm.removeAllEntries()
index = self.indexOfTopLevelItem(itm)
self.takeTopLevelItem(index)
del self.groups[name]
def removeEntry(self, itm):
"""
Public method to remove a template entry.
@param itm template entry to be removed (TemplateEntry)
"""
groupName = itm.getGroupName()
self.groups[groupName].removeEntry(itm.getName())
def changeEntry(self, itm, name, groupName, description, template):
"""
Public method to change a template entry.
@param itm template entry to be changed (TemplateEntry)
@param name new name for the entry (string or QString)
@param groupName name of the group the entry should belong to
(string or QString)
@param description description of the entry (string or QString)
@param template template text of the entry (string or QString)
"""
if itm.getGroupName() != groupName:
# move entry to another group
self.groups[itm.getGroupName()].removeEntry(itm.getName())
self.groups[groupName].addEntry(name, description, template)
return
if itm.getName() != name:
# entry was renamed
self.groups[groupName].removeEntry(itm.getName())
self.groups[groupName].addEntry(name, description, template)
return
tmpl = self.groups[groupName].getEntry(name)
tmpl.setDescription(description)
tmpl.setTemplateText(template)
self.__resort()
def writeTemplates(self, filename = None):
"""
Public method to write the templates data to an XML file (.e4c).
@param filename name of a templates file to read (string or QString)
"""
try:
if filename is None:
fn = os.path.join(Utilities.getConfigDir(), "eric4templates.e4c")
else:
fn = unicode(filename)
f = open(fn, "wb")
TemplatesWriter(f, self).writeXML()
f.close()
except IOError:
KQMessageBox.critical(None,
self.trUtf8("Save templates"),
self.trUtf8("The templates file %1 could not be written.
")
.arg(fn))
def readTemplates(self, filename = None):
"""
Public method to read in the templates file (.e4c)
@param filename name of a templates file to read (string or QString)
"""
try:
if filename is None:
fn = os.path.join(Utilities.getConfigDir(), "eric4templates.e4c")
if not os.path.exists(fn):
return
else:
fn = unicode(filename)
f = open(fn, "rb")
line = f.readline()
dtdLine = f.readline()
f.close()
except IOError:
KQMessageBox.critical(None,
self.trUtf8("Read templates"),
self.trUtf8("The templates file %1 could not be read.
")
.arg(fn))
return
# now read the file
if line.startswith('The templates file %1 could not be read.")
.arg(fn))
return
except XMLFatalParseError:
pass
eh.showParseMessages()
else:
KQMessageBox.critical(None,
self.trUtf8("Read templates"),
self.trUtf8("The templates file %1 has an"
" unsupported format.
")
.arg(fn))
def __configure(self):
"""
Private method to open the configuration dialog.
"""
e4App().getObject("UserInterface").showPreferences("templatesPage")
def hasTemplate(self, entryName, groupName=""):
"""
Public method to check, if an entry of the given name exists.
@param entryName name of the entry to check for (string or QString)
@param groupName name of the group to check the entry (string or QString).
Empty means to check all groups.
@return flag indicating the existence (boolean)
"""
groupName = unicode(groupName)
if groupName:
if self.hasGroup(groupName):
groups = [self.groups[groupName]]
else:
groups = []
else:
groups = self.groups.values()
for group in groups:
if group.hasEntry(entryName):
return True
return False
def getTemplateNames(self, start, groupName=""):
"""
Public method to get the names of templates starting with the given string.
@param start start string of the name (string or QString)
@param groupName name of the group to get the entry from (string or QString).
Empty means to look in all groups.
@return sorted list of matching template names (list of strings)
"""
names = []
groupName = unicode(groupName)
if groupName:
if self.hasGroup(groupName):
groups = [self.groups[groupName]]
else:
groups = []
else:
groups = self.groups.values()
for group in groups:
names.extend(group.getEntryNames(start))
return sorted(names)
eric4-4.5.18/eric/PaxHeaders.8617/pylint.rc 0000644 0001750 0000144 00000000074 11172323754 016370 x ustar 00 0000000 0000000 30 atime=1389081057.485723473
30 ctime=1389081086.307724332
eric4-4.5.18/eric/pylint.rc 0000644 0001750 0000144 00000041134 11172323754 016120 0 ustar 00detlev users 0000000 0000000 # lint Python modules using external checkers.
#
# This is the main checker controling the other ones and the reports
# generation. It is itself both a raw checker and an astng checker in order
# to:
# * handle message activation / deactivation at the module level
# * handle some basic but necessary stats'data (number of classes, methods...)
#
# This checker also defines the following reports:
# * R0001: Total errors / warnings
# * R0002: % errors / warnings by module
# * R0003: Messages
# * R0004: Global evaluation
#
[MASTER]
# Add to the black list. It should be a base name, not a
# path. You may set this option multiple times.
ignore=CVS,
.svn,
.hg,
.ropeproject,
.eric4project,
ThirdParty,
Examples,
Ruby,
# ignore autogenerated files for Qt designer forms
# Checks
Ui_PyLintConfigDialog.py,
Ui_PyLintExecDialog.py,
Ui_SyntaxCheckerDialog.py,
Ui_TabnannyDialog.py,
Tabnanny.py,
# DataViews
Ui_CodeMetricsDialog.py,
Ui_PyCoverageDialog.py,
Ui_PyProfileDialog.py,
# Debugger
Ui_EditBreakpointDialog.py,
Ui_EditWatchpointDialog.py,
Ui_ExceptionsFilterDialog.py,
Ui_StartCoverageDialog.py,
Ui_StartDebugDialog.py,
Ui_StartProfileDialog.py,
Ui_StartRunDialog.py,
Ui_VariableDetailDialog.py,
Ui_VariablesFilterDialog.py,
# DocumentationTools
Ui_DocGeneratorExecDialog.py,
Ui_EricapiConfigDialog.py,
Ui_EricdocConfigDialog.py,
# Graphics
Ui_UMLSceneSizeDialog.py,
Ui_ZoomDialog,
# Helpviewer
Ui_BookmarkDialog.py,
Ui_SearchDialog.py,
# Packagers
Ui_CxfreezeConfigDialog.py,
Ui_PackagersExecDialog.py,
# Preferences
Ui_ConfigurationDialog.py,
Ui_ShortcutDialog.py,
Ui_ShortcutsDialog.py,
Ui_ToolConfigurationDialog.py,
Ui_ToolGroupConfigurationDialog.py,
Ui_ViewProfileDialog.py,
# Preferences - ConfigurationPages
Ui_ApplicationPage.py,
Ui_CorbaPage.py,
Ui_DebuggerGeneral1Page.py,
Ui_DebuggerGeneral2Page.py,
Ui_DebuggerPythonPage.py,
Ui_DebuggerRubyPage.py,
Ui_EditorAPIsPage.py,
Ui_EditorAutocompletionPage.py,
Ui_EditorCalltipsPage.py,
Ui_EditorColoursPage.py,
Ui_EditorGeneralPage.py,
Ui_EditorHighlightersPage.py,
Ui_EditorHighlightingStylesPage.py,
Ui_EditorProperties1Page.py,
Ui_EditorProperties2Page.py,
Ui_EditorStylesPage.py,
Ui_EmailPage.py,
Ui_GraphicsPage.py,
Ui_HelpDocumentationPage.py,
Ui_HelpViewersPage.py,
Ui_IconsPage.py,
Ui_IconsPreviewDialog.py,
Ui_InterfacePage.py,
Ui_PrinterPage.py,
Ui_ProgramsPage.py,
Ui_ProjectPage.py,
Ui_ProjectBrowserPage.py,
Ui_PythonPage.py,
Ui_QtPage.py,
Ui_RefactoringPage.py,
Ui_ShellPage.py,
Ui_TasksPage.py,
Ui_TemplatesPage.py,
Ui_VcsPage.py,
Ui_ViewmanagerPage.py,
# Project
Ui_AddDirectoryDialog.py,
Ui_AddFileDialog.py,
Ui_AddFoundFilesDialog.py,
Ui_AddLanguageDialog.py,
Ui_DebuggerPropertiesDialog.py,
Ui_FiletypeAssociationsDialog.py,
Ui_PropertiesDialog.py,
Ui_TranslationPropertiesDialog.py,
Ui_UserPropertiesDialog.py,
# PyUnit
Ui_UnittestDialog.py,
Ui_UnittestStacktraceDialog.py,
# QScintilla
Ui_GotoDialog.py,
Ui_ReplaceDialog.py,
Ui_SearchDialog.py,
Ui_ZoomDialog.py,
# Refactoring
Ui_MatchesDialog.py,
# Scripting
Ui_LoadScriptDialog.py,
# Tasks
Ui_TaskFilterConfigDialog.py,
Ui_TaskPropertiesDialog.py,
# Templates
Ui_TemplatePropertiesDialog.py,
Ui_TemplateSingleVariableDialog.py,
# UI
Ui_AboutDialog.py,
Ui_CompareDialog.py,
Ui_DeleteFilesConfirmationDialog.py,
Ui_DiffDialog.py,
Ui_EmailDialog.py,
Ui_FindFileDialog.py,
Ui_FindFileNameDialog.py,
# VCS
Ui_CommandOptionsDialog.py,
Ui_RepositoryInfoDialog.py,
# VCS - vcsCVS
Ui_CvsCommandDialog.py,
Ui_CvsCommitDialog.py,
Ui_CvsDialog.py,
Ui_CvsHistoryDialog.py,
Ui_CvsLogDialog.py,
Ui_CvsLoginDialog.py,
Ui_CvsLogoutDialog.py,
Ui_CvsMergeDialog.py,
Ui_CvsNewProjectOptionsDialog.py,
Ui_CvsOptionsDialog.py,
Ui_CvsSwitchDialog.py,
Ui_CvsTagDialog.py,
# VCS - vcsPySvn, vcsSubversion
Ui_SvnBlameDialog.py,
Ui_SvnCommandDialog.py,
Ui_SvnCommitDialog.py,
Ui_SvnCopyDialog.py,
Ui_SvnDialog.py,
Ui_SvnDiffDialog.py,
Ui_SvnLogDialog.py,
Ui_SvnLoginDialog.py,
Ui_SvnMergeDialog.py,
Ui_SvnNewProjectOptionsDialog.py,
Ui_SvnOptionsDialog.py,
Ui_SvnPropDelDialog.py,
Ui_SvnPropListDialog.py,
Ui_SvnPropSetDialog.py,
Ui_SvnRelocateDialog.py,
Ui_SvnRevisionSelectionDialog.py,
Ui_SvnStatusDialog.py,
Ui_SvnSwitchDialog.py,
Ui_SvnTagBranchListDialog.py,
Ui_SvnTagDialog.py,
Ui_SvnUrlSelectionDialog.py,
# ViewManager
Ui_BookmarkedFilesDialog.py,
# Wizards
Ui_ColorDialogWizardDialog.py,
Ui_FileDialogWizardDialog.py,
Ui_FontDialogWizardDialog.py,
Ui_InputDialogWizardDialog.py,
Ui_MessageBoxWizardDialog.py,
Ui_PyRegExpWizardCharactersDialog.py,
Ui_PyRegExpWizardDialog.py,
Ui_PyRegExpWizardRepeatDialog.py,
Ui_QRegExpWizardCharactersDialog.py,
Ui_QRegExpWizardDialog.py,
Ui_QRegExpWizardRepeatDialog.py,
# XML
Ui_XMLMessageDialog.py
# Pickle collected data for later comparisons.
persistent=yes
# Set the cache size for astng objects.
cache-size=500
[REPORTS]
# Tells wether to display a full report or only the messages
reports=yes
# Use HTML as output format instead of text
html=no
# Use a parseable text output format, so your favorite text editor will be able
# to jump to the line corresponding to a message.
parseable=no
# Colorizes text output using ansi escape codes
color=no
# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no
# Python expression which should return a note less than 10 (10 is the highest
# note).You have access to the variables errors warning, statement which
# respectivly contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (R0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Add a comment according to your evaluation note. This is used by the global
# evaluation report (R0004).
comment=no
# Include message's id in output
include-ids=no
# checks for
# * unused variables / imports
# * undefined variables
# * redefinition of variable from builtins or from an outer scope
# * use of variable before assigment
#
[VARIABLES]
# Enable / disable this checker
enable-variables=yes
# Tells wether we should check for unused import in __init__ files.
init-import=no
# List of variable names used for dummy variables (i.e. not used).
dummy-variables=_,dummy
# List of additional names supposed to be defined in builtins. Remember that you
# should avoid to define new builtins when possible.
additional-builtins=
# checks for :
# * doc strings
# * modules / classes / functions / methods / arguments / variables name
# * number of arguments, local variables, branchs, returns and statements in
# functions, methods
# * required module attributes
# * dangerous default values as arguments
# * redefinition of function / method / class
# * uses of the global statement
#
# This checker also defines the following reports:
# * R0101: Statistics by type
#
[BASIC]
# Enable / disable this checker
enable-basic=yes
# Required attributes for module, separated by a comma
#required-attributes=__revision__
required-attributes=
# Regular expression which should only match functions or classes name which do
# not require a docstring
no-docstring-rgx=__.*__
# Minimal length for module / class / function / method / argument / variable
# names
min-name-length=2
# Regular expression which should only match correct module names
module-rgx=(([a-z_][a-z0-9_\-]*)|([A-Z][a-zA-Z0-9_\-]+))$
# Regular expression which should only match correct module level names
const-rgx=(([a-z_][a-zA-Z0-9_]*)|(__.*__))$
# Regular expression which should only match correct class names
class-rgx=(([A-Z_][a-zA-Z0-9]+)|(__qt[A-Z][a-zA-Z0-9]+)|(__kde[A-Z][a-zA-Z0-9]+))$
# Regular expression which should only match correct function names
function-rgx=[a-z_][a-zA-Z0-9_]*$
# Regular expression which should only match correct method names
method-rgx=[a-z_][a-zA-Z0-9_]*$
# Regular expression which should only match correct instance attribute names
attr-rgx=[a-z_][a-zA-Z0-9_]*$
# Regular expression which should only match correct argument names
argument-rgx=[a-z_][a-zA-Z0-9_]*$
# Regular expression which should only match correct variable names
variable-rgx=[a-z_][a-zA-Z0-9_]*$
# Regular expression which should only match correct list comprehension /
# generator expression variable names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,_,s,f
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input
# checks for sign of poor/misdesign:
# * number of methods, attributes, local variables...
# * size, complexity of functions, methods
#
[DESIGN]
# Enable / disable this checker
enable-design=yes
# Maximum number of arguments for function / method
max-args=5
# Maximum number of locals for function / method body
max-locals=15
# Maximum number of return / yield for function / method body
max-returns=6
# Maximum number of branch for function / method body
max-branchs=12
# Maximum number of statements in function / method body
max-statements=100
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of attributes for a class (see R0902).
max-attributes=20
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# checks for
# * external modules dependencies
# * relative / wildcard imports
# * cyclic imports
# * uses of deprecated modules
#
# This checker also defines the following reports:
# * R0401: External dependencies
# * R0402: Modules dependencies graph
#
[IMPORTS]
# Enable / disable this checker
enable-imports=yes
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
# Create a graph of every (i.e. internal and external) dependencies in the given
# file (report R0402 must not be disabled)
import-graph=
# Create a graph of external dependencies in the given file (report R0402 must
# not be disabled)
ext-import-graph=
# Create a graph of internal dependencies in the given file (report R0402 must
# not be disabled)
int-import-graph=
# checks for :
# * methods without self as first argument
# * overriden methods signature
# * access only to existant members via self
# * attributes not defined in the __init__ method
# * supported interfaces implementation
# * unreachable code
#
[CLASSES]
# Enable / disable this checker
enable-classes=yes
# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
# Tells wether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# checks for
# * excepts without exception filter
# * string exceptions
#
[EXCEPTIONS]
# Enable / disable this checker
enable-exceptions=yes
# does not check anything but gives some raw metrics :
# * total number of lines
# * total number of code lines
# * total number of docstring lines
# * total number of comments lines
# * total number of empty lines
#
# This checker also defines the following reports:
# * R0701: Raw metrics
#
[METRICS]
# Enable / disable this checker
enable-metrics=yes
# checks for similarities and duplicated code. This computation may be
# memory / CPU intensive, so you should disable it if you experiments some
# problems.
#
# This checker also defines the following reports:
# * R0801: Duplication
#
[SIMILARITIES]
# Enable / disable this checker
enable-similarities=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
# Ignore comments when computing similarities.
ignore-comments=yes
# checks for:
# * warning notes in the code like FIXME, XXX
# * PEP 263: source code with non ascii character but no encoding declaration
#
[MISCELLANEOUS]
# Enable / disable this checker
enable-miscellaneous=yes
# List of note tags to take in consideration, separated by a comma. Default to
# FIXME, XXX, TODO
notes=FIXME,XXX,TODO
# checks for :
# * unauthorized constructions
# * strict indentation
# * line length
# * use of <> instead of !=
#
[FORMAT]
# Enable / disable this checker
enable-format=yes
# Maximum number of characters on a single line.
max-line-length=90
# Maximum number of lines in a module
max-module-lines=1000
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab).
indent-string=' '
eric4-4.5.18/eric/PaxHeaders.8617/pixmaps 0000644 0001750 0000144 00000000132 12262730776 016131 x ustar 00 0000000 0000000 30 mtime=1389081086.289724333
30 atime=1389081086.290724332
30 ctime=1389081086.315724332
eric4-4.5.18/eric/pixmaps/ 0000755 0001750 0000144 00000000000 12262730776 015740 5 ustar 00detlev users 0000000 0000000 eric4-4.5.18/eric/pixmaps/PaxHeaders.8617/ericSplash.png 0000644 0001750 0000144 00000000132 12170217300 020766 x ustar 00 0000000 0000000 30 mtime=1373707968.932653286
30 atime=1389081057.526723475
30 ctime=1389081086.307724332
eric4-4.5.18/eric/pixmaps/ericSplash.png 0000644 0001750 0000144 00000417366 12170217300 020541 0 ustar 00detlev users 0000000 0000000 PNG
IHDR 0 pHYs .# .#x?v tIME
"
gM4 tEXtComment Created with The GIMPd%n bKGD ZIDATx˒,ɑ%v{Df[j`Ơ1ӂp(
e?ܒO ?2"40h o"Ty-\qHɌsjPgPm[W 궟`]YN %燗rٿ/_U?opoÇ3/&;r+.pX Ri*:,a\ wT=| ==> !Xncg?c3O~FYCr?)wL:HHp54 3xfwTo3` #CBhtڑ~{\ @Dsy\HɄcd @E! NL0E u
$)JIdH2A
0D$Q; 2 T̀Q9ش& D Ikꬋ}P+$ɲ&,#ꂒ:P+