Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
Conflicts:
	python/plugins/sextante/grass/GrassAlgorithm.py
  • Loading branch information
volaya committed Dec 11, 2012
2 parents a4186df + c84408e commit d401a6e
Show file tree
Hide file tree
Showing 184 changed files with 2,062 additions and 1,789 deletions.
6 changes: 6 additions & 0 deletions mac/xcode/src/x_qgsspatialitesourceselect.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#if !SQLITE_QSYSTEM

#include "../../src/app/qgsspatialitesourceselect.cpp"
Expand Down
6 changes: 6 additions & 0 deletions mac/xcode/src/x_spatialite.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#if SQLITE_QINTERNAL

#include "../../src/core/spatialite/spatialite.c"
Expand Down
6 changes: 6 additions & 0 deletions mac/xcode/src/x_sqlite3.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#if SQLITE_QINTERNAL

#include "../../src/core/spatialite/sqlite3.c"
Expand Down
34 changes: 17 additions & 17 deletions python/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, parent=None):
QDockWidget.__init__(self, parent)
self.setObjectName("PythonConsole")
self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console"))
#self.setAllowedAreas(Qt.BottomDockWidgetArea)
#self.setAllowedAreas(Qt.BottomDockWidgetArea)

self.console = PythonConsoleWidget(self)
self.setWidget( self.console )
Expand All @@ -78,26 +78,26 @@ def activate(self):
self.activateWindow()
self.raise_()
QDockWidget.setFocus(self)

def closeEvent(self, event):
self.console.edit.writeHistoryFile()
QWidget.closeEvent(self, event)

class PythonConsoleWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console"))
self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console"))
self.widgetButton = QWidget()
#self.widgetEditors = QWidget()

self.options = optionsDialog(self)
self.helpDlg = HelpDialog(self)

self.splitter = QSplitter(self)
self.splitter.setOrientation(Qt.Vertical)
self.splitter.setHandleWidth(3)
self.splitter.setChildrenCollapsible(False)

self.toolBar = QToolBar()
self.toolBar.setEnabled(True)
self.toolBar.setFocusPolicy(Qt.NoFocus)
Expand Down Expand Up @@ -263,9 +263,9 @@ def __init__(self, parent=None):
self.b.addWidget(self.toolBar)
self.edit = PythonEdit(self)
self.textEditOut = EditorOutput(self)

self.setFocusProxy(self.edit)

sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
Expand All @@ -274,10 +274,10 @@ def __init__(self, parent=None):

self.splitter.addWidget(self.textEditOut)
self.splitter.addWidget(self.edit)

sizes = self.splitter.sizes()
self.splitter.setSizes(sizes)

self.f.addWidget(self.widgetButton, 0, 0)
self.f.addWidget(self.splitter, 0, 1)

Expand All @@ -289,7 +289,7 @@ def __init__(self, parent=None):

self.textEditOut.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.edit.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)

self.clearButton.triggered.connect(self.textEditOut.clearConsole)
self.optionsButton.triggered.connect(self.openSettings)
self.loadIfaceButton.triggered.connect(self.iface)
Expand All @@ -300,18 +300,18 @@ def __init__(self, parent=None):
self.openFileButton.triggered.connect(self.openScriptFile)
self.saveFileButton.triggered.connect(self.saveScriptFile)
self.helpButton.triggered.connect(self.openHelp)
QObject.connect(self.options.buttonBox, SIGNAL("accepted()"),
QObject.connect(self.options.buttonBox, SIGNAL("accepted()"),
self.prefChanged)

def sextante(self):
self.edit.commandConsole('sextante')

def iface(self):
self.edit.commandConsole('iface')

def qtCore(self):
self.edit.commandConsole('qtCore')

def qtGui(self):
self.edit.commandConsole('qtGui')

Expand Down Expand Up @@ -354,14 +354,14 @@ def saveScriptFile(self):
sF.write('\n')
sF.write(s)
sF.close()

def openHelp(self):
self.helpDlg.show()
self.helpDlg.activateWindow()

def openSettings(self):
self.options.exec_()

def prefChanged(self):
self.edit.refreshLexerProperties()
self.textEditOut.refreshLexerProperties()
Expand Down
4 changes: 2 additions & 2 deletions python/console/console_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class HelpDialog(QDialog, Ui_Help):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)

self.setWindowTitle(QCoreApplication.translate("PythonConsole","Help Python Console"))
self.setMaximumSize(530, 300)

qgisDataDir = QgsApplication.pkgDataPath()
listFile = os.listdir(qgisDataDir + "/python/console/console_help/i18n")
localeFullName = QSettings().value( "locale/userLocale", QVariant( "" ) ).toString()
Expand Down
76 changes: 38 additions & 38 deletions python/console/console_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.Qsci import (QsciScintilla,
QsciScintillaBase,
QsciScintillaBase,
QsciLexerPython)
import sys

class writeOut:
def __init__(self, edit, out=None, style=None):
"""
Expand All @@ -46,19 +46,19 @@ def write(self, m):

if self.out:
self.out.write(m)

def move_cursor_to_end(self):
"""Move cursor to end of text"""
line, index = self.get_end_pos()
self.outputArea.setCursorPosition(line, index)
self.outputArea.ensureCursorVisible()
self.outputArea.ensureLineVisible(line)

def get_end_pos(self):
"""Return (line, index) position of the last character"""
line = self.outputArea.lines() - 1
return (line, self.outputArea.text(line).length())

def flush(self):
pass

Expand All @@ -68,17 +68,17 @@ def __init__(self, parent=None):
super(EditorOutput,self).__init__(parent)
self.parent = parent
self.edit = self.parent.edit
# Enable non-ascii chars for editor

# Enable non-ascii chars for editor
self.setUtf8(True)

sys.stdout = writeOut(self, sys.stdout)
sys.stderr = writeOut(self, sys.stderr, "traceback")

self.insertInitText()
self.setLexers()
self.setReadOnly(True)

# Set the default font
font = QFont()
font.setFamily('Courier')
Expand All @@ -102,42 +102,42 @@ def __init__(self, parent=None):
#self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
#self.setFoldMarginColors(QColor("#99CC66"),QColor("#333300"))
#self.setWrapMode(QsciScintilla.WrapCharacter)

## Edge Mode
#self.setEdgeMode(QsciScintilla.EdgeLine)
#self.setEdgeColumn(80)
#self.setEdgeColor(QColor("#FF0000"))
#self.setEdgeColor(QColor("#FF0000"))

self.setWrapMode(QsciScintilla.WrapCharacter)
self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)

self.runShortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_E), self)
self.runShortcut.activated.connect(self.enteredSelected)
# Reimplemeted copy action to prevent paste prompt (>>>,...) in command view
self.copyShortcut = QShortcut(QKeySequence.Copy, self)
self.copyShortcut.activated.connect(self.copy)
self.selectAllShortcut = QShortcut(QKeySequence.SelectAll, self)
self.selectAllShortcut.activated.connect(self.selectAll)

def insertInitText(self):
txtInit = QCoreApplication.translate("PythonConsole",
"## To access Quantum GIS environment from this console\n"
"## use qgis.utils.iface object (instance of QgisInterface class). Read help for more info.\n\n")
initText = self.setText(txtInit)

def refreshLexerProperties(self):
self.setLexers()

def setLexers(self):
self.lexer = QsciLexerPython()

settings = QSettings()
loadFont = settings.value("pythonConsole/fontfamilytext", "Monospace").toString()
fontSize = settings.value("pythonConsole/fontsize", 10).toInt()[0]
font = QFont(loadFont)
font.setFixedPitch(True)
font.setPointSize(fontSize)

self.lexer.setDefaultFont(font)
self.lexer.setColor(Qt.red, 1)
self.lexer.setColor(Qt.darkGreen, 5)
Expand All @@ -153,40 +153,40 @@ def getTextFromEditor(self):
text = self.text()
textList = text.split("\n")
return textList

def clearConsole(self):
#self.SendScintilla(QsciScintilla.SCI_CLEARALL)
self.setText('')
self.insertInitText()
self.edit.setFocus()
def contextMenuEvent(self, e):

def contextMenuEvent(self, e):
menu = QMenu(self)
iconRun = QIcon(":/images/console/iconRunConsole.png")
iconPastebin = QIcon(":/images/console/iconCodepadConsole.png")
iconClear = QIcon(":/images/console/iconClearConsole.png")
iconHideTool = QIcon(":/images/console/iconHideToolConsole.png")
hideToolBar = menu.addAction(iconHideTool,
"Hide/Show Toolbar",
hideToolBar = menu.addAction(iconHideTool,
"Hide/Show Toolbar",
self.hideToolBar)
menu.addSeparator()
runAction = menu.addAction(iconRun,
"Enter Selected",
self.enteredSelected,
runAction = menu.addAction(iconRun,
"Enter Selected",
self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E))
clearAction = menu.addAction(iconClear,
"Clear console",
clearAction = menu.addAction(iconClear,
"Clear console",
self.clearConsole)
menu.addSeparator()
copyAction = menu.addAction("Copy",
self.copy,
copyAction = menu.addAction("Copy",
self.copy,
QKeySequence.Copy)
pastebinAction = menu.addAction(iconPastebin,
"Share on codepad",
pastebinAction = menu.addAction(iconPastebin,
"Share on codepad",
self.pastebin)
menu.addSeparator()
selectAllAction = menu.addAction("Select All",
self.selectAll,
selectAllAction = menu.addAction("Select All",
self.selectAll,
QKeySequence.SelectAll)
runAction.setEnabled(False)
clearAction.setEnabled(False)
Expand All @@ -201,12 +201,12 @@ def contextMenuEvent(self, e):
selectAllAction.setEnabled(True)
clearAction.setEnabled(True)
action = menu.exec_(self.mapToGlobal(e.pos()))

def hideToolBar(self):
tB = self.parent.toolBar
tB.hide() if tB.isVisible() else tB.show()
self.edit.setFocus()

def copy(self):
"""Copy text to clipboard... or keyboard interrupt"""
if self.hasSelectedText():
Expand All @@ -220,7 +220,7 @@ def enteredSelected(self):
cmd = self.selectedText()
self.edit.insertFromDropPaste(cmd)
self.edit.entered()