119 changes: 55 additions & 64 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,79 +297,64 @@ def contextMenuEvent(self, e):
iconCut = QgsApplication.getThemeIcon("console/iconCutEditorConsole.png")
iconCopy = QgsApplication.getThemeIcon("console/iconCopyEditorConsole.png")
iconPaste = QgsApplication.getThemeIcon("console/iconPasteEditorConsole.png")
hideEditorAction = menu.addAction(QCoreApplication.translate("PythonConsole", "Hide Editor"),
self.hideEditor)
menu.addSeparator()
hideEditorAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Hide Editor"),
self.hideEditor)
menu.addSeparator() # ------------------------------
syntaxCheck = menu.addAction(iconSyntaxCk,
QCoreApplication.translate("PythonConsole",
"Check Syntax"),
self.syntaxCheck, 'Ctrl+4')
QCoreApplication.translate("PythonConsole", "Check Syntax"),
self.syntaxCheck, 'Ctrl+4')
menu.addSeparator()
runSelected = menu.addAction(iconRun,
QCoreApplication.translate("PythonConsole",
"Run selected"),
self.runSelectedCode, 'Ctrl+E')
QCoreApplication.translate("PythonConsole", "Run selected"),
self.runSelectedCode, 'Ctrl+E')
runScript = menu.addAction(iconRunScript,
QCoreApplication.translate("PythonConsole",
"Run Script"),
self.runScriptCode, 'Shift+Ctrl+E')
QCoreApplication.translate("PythonConsole", "Run Script"),
self.runScriptCode, 'Shift+Ctrl+E')
menu.addSeparator()
undoAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Undo"),
self.undo, QKeySequence.Undo)
redoAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Redo"),
self.redo, 'Ctrl+Shift+Z')
undoAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Undo"),
self.undo, QKeySequence.Undo)
redoAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Redo"),
self.redo, 'Ctrl+Shift+Z')
menu.addSeparator()
findAction = menu.addAction(iconFind,
QCoreApplication.translate("PythonConsole",
"Find Text"),
self.showFindWidget)
QCoreApplication.translate("PythonConsole", "Find Text"),
self.showFindWidget)
menu.addSeparator()
cutAction = menu.addAction(iconCut,
QCoreApplication.translate("PythonConsole",
"Cut"),
self.cut,
QKeySequence.Cut)
QCoreApplication.translate("PythonConsole", "Cut"),
self.cut, QKeySequence.Cut)
copyAction = menu.addAction(iconCopy,
QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy,
QKeySequence.Copy)
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(iconPaste,
QCoreApplication.translate("PythonConsole",
"Paste"),
self.paste, QKeySequence.Paste)
QCoreApplication.translate("PythonConsole", "Paste"),
self.paste, QKeySequence.Paste)
menu.addSeparator()
commentCodeAction = menu.addAction(iconCommentEditor,
QCoreApplication.translate("PythonConsole",
"Comment"),
self.parent.pc.commentCode, 'Ctrl+3')
QCoreApplication.translate("PythonConsole", "Comment"),
self.parent.pc.commentCode, 'Ctrl+3')
uncommentCodeAction = menu.addAction(iconUncommentEditor,
QCoreApplication.translate("PythonConsole",
"Uncomment"),
self.parent.pc.uncommentCode,
'Shift+Ctrl+3')
QCoreApplication.translate("PythonConsole", "Uncomment"),
self.parent.pc.uncommentCode, 'Shift+Ctrl+3')
menu.addSeparator()
codePadAction = menu.addAction(iconCodePad,
QCoreApplication.translate("PythonConsole",
"Share on codepad"),
self.codepad)
QCoreApplication.translate("PythonConsole", "Share on codepad"),
self.codepad)
menu.addSeparator()
showCodeInspection = menu.addAction(iconObjInsp,
QCoreApplication.translate("PythonConsole",
"Hide/Show Object Inspector"),
self.objectListEditor)
QCoreApplication.translate("PythonConsole", "Hide/Show Object Inspector"),
self.objectListEditor)
menu.addSeparator()
selectAllAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Select All"),
self.selectAll,
QKeySequence.SelectAll)
selectAllAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Select All"),
self.selectAll, QKeySequence.SelectAll)
menu.addSeparator()
settingsDialog = menu.addAction(iconSettings,
QCoreApplication.translate("PythonConsole",
"Settings"),
self.parent.pc.openSettings)
QCoreApplication.translate("PythonConsole", "Settings"),
self.parent.pc.openSettings)
syntaxCheck.setEnabled(False)
pasteAction.setEnabled(False)
codePadAction.setEnabled(False)
Expand Down Expand Up @@ -977,20 +962,26 @@ def contextMenuEvent(self, e):
cW = self.widget(self.idx)
menu = QMenu(self)
menu.addSeparator()
newTabAction = menu.addAction("New Editor",
self.newTabEditor)
newTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "New Editor"),
self.newTabEditor)
menu.addSeparator()
closeTabAction = menu.addAction("Close Tab",
cW.close)
closeAllTabAction = menu.addAction("Close All",
self.closeAll)
closeOthersTabAction = menu.addAction("Close Others",
self.closeOthers)
closeTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Close Tab"),
cW.close)
closeAllTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Close All"),
self.closeAll)
closeOthersTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Close Others"),
self.closeOthers)
menu.addSeparator()
saveAction = menu.addAction("Save",
cW.save)
saveAsAction = menu.addAction("Save As",
self.saveAs)
saveAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Save"),
cW.save)
saveAsAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Save As"),
self.saveAs)
closeTabAction.setEnabled(False)
closeAllTabAction.setEnabled(False)
closeOthersTabAction.setEnabled(False)
Expand Down
31 changes: 22 additions & 9 deletions python/console/console_history_dlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="2" column="1">
<item row="2" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -39,14 +39,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="reloadHistory">
<property name="text">
<string>Reload</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<item row="0" column="0" colspan="3">
<widget class="QListView" name="listView">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
Expand All @@ -60,6 +53,26 @@
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="reloadHistory">
<property name="text">
<string>Reload</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="saveHistory">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
Expand Down
42 changes: 18 additions & 24 deletions python/console/console_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,38 +206,32 @@ def contextMenuEvent(self, e):
iconHideTool = QgsApplication.getThemeIcon("console/iconHideToolConsole.png")
iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png")
hideToolBar = menu.addAction(iconHideTool,
QCoreApplication.translate("PythonConsole",
"Hide/Show Toolbar"),
self.hideToolBar)
QCoreApplication.translate("PythonConsole", "Hide/Show Toolbar"),
self.hideToolBar)
menu.addSeparator()
showEditorAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Show Editor"),
self.showEditor)
showEditorAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Show Editor"),
self.showEditor)
menu.addSeparator()
runAction = menu.addAction(iconRun,
QCoreApplication.translate("PythonConsole",
"Enter Selected"),
self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E))
QCoreApplication.translate("PythonConsole", "Enter Selected"),
self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E))
clearAction = menu.addAction(iconClear,
QCoreApplication.translate("PythonConsole",
"Clear console"),
self.clearConsole)
QCoreApplication.translate("PythonConsole", "Clear console"),
self.clearConsole)
menu.addSeparator()
copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy,
QKeySequence.Copy)
copyAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
menu.addSeparator()
selectAllAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Select All"),
self.selectAll,
QKeySequence.SelectAll)
selectAllAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Select All"),
self.selectAll, QKeySequence.SelectAll)
menu.addSeparator()
settingsDialog = menu.addAction(iconSettings,
QCoreApplication.translate("PythonConsole",
"Settings"),
self.parent.openSettings)
QCoreApplication.translate("PythonConsole", "Settings"),
self.parent.openSettings)
runAction.setEnabled(False)
clearAction.setEnabled(False)
copyAction.setEnabled(False)
Expand Down
52 changes: 34 additions & 18 deletions python/console/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,28 +476,28 @@ def contextMenuEvent(self, e):
subMenu = QMenu(menu)
titleHistoryMenu = QCoreApplication.translate("PythonConsole", "Command History")
subMenu.setTitle(titleHistoryMenu)
showHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Show"),
self.showHistory, 'Ctrl+Shift+SPACE')
showHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Show"),
self.showHistory, 'Ctrl+Shift+SPACE')
subMenu.addSeparator()
saveHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Save"),
self.writeHistoryFile)
saveHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Save"),
self.writeHistoryFile)
subMenu.addSeparator()
clearHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Clear File"),
self.clearHistory)
clearSessHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Clear Session"),
self.clearHistorySession)
clearHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Clear File"),
self.clearHistory)
clearSessHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Clear Session"),
self.clearHistorySession)
menu.addMenu(subMenu)
menu.addSeparator()
copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Paste"),
self.paste, QKeySequence.Paste)
copyAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Paste"),
self.paste, QKeySequence.Paste)
copyAction.setEnabled(False)
pasteAction.setEnabled(False)
if self.hasSelectedText():
Expand Down Expand Up @@ -629,13 +629,19 @@ def __init__(self, parent):

self._reloadHistory()

self.deleteScut = QShortcut(QKeySequence(Qt.Key_Delete), self)
self.deleteScut.activated.connect(self._deleteItem)
self.listView.doubleClicked.connect(self._runHistory)
self.reloadHistory.clicked.connect(self._reloadHistory)
self.saveHistory.clicked.connect(self._saveHistory)

def _runHistory(self, item):
cmd = item.data(Qt.DisplayRole)
self.parent.runCommand(unicode(cmd))

def _saveHistory(self):
self.parent.writeHistoryFile(True)

def _reloadHistory(self):
self.model.clear()
for i in self.parent.history:
Expand All @@ -646,3 +652,13 @@ def _reloadHistory(self):

self.listView.setModel(self.model)
self.listView.scrollToBottom()

def _deleteItem(self):
itemsSelected = self.listView.selectionModel().selectedIndexes()
if itemsSelected:
item = itemsSelected[0].row()
## Remove item from the command history (just for the current session)
self.parent.history.pop(item)
self.parent.historyIndex -= 1
## Remove row from the command history dialog
self.model.removeRow(item)
1 change: 1 addition & 0 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ class QgisInterface : QObject
virtual QAction *actionZoomToLayer() = 0;
virtual QAction *actionZoomToSelected() = 0;
virtual QAction *actionZoomLast() = 0;
virtual QAction *actionZoomNext() = 0;
virtual QAction *actionZoomActualSize() = 0;
virtual QAction *actionMapTips() = 0;
virtual QAction *actionNewBookmark() = 0;
Expand Down
Binary file modified python/qsci_apis/pyqgis.pap
Binary file not shown.
12 changes: 10 additions & 2 deletions src/core/qgsmimedatautils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )
parts << part;
}

if ( parts.size() == 4 )
if ( parts.size() <= 5 ) // PostGISTRaster layers yields five parts
{
layerType = parts[0];
providerKey = parts[1];
name = parts[2];
uri = parts[3];
// fetchs PostGISRaster layers
if ( parts[3] == "PG" )
{
uri = parts[3] + ":" + parts[4];
}
else
{
uri = parts[3];
}
QgsDebugMsg( "type: " + layerType + " key: " + providerKey + " name: " + name + " uri: " + uri );
}
}
Expand Down
Loading