4 changes: 2 additions & 2 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def syntaxCheck(self, filename=None, fromContextMenu=True):
return True

def keyPressEvent(self, e):
if self.settings.value("pythonConsole/autoCloseBracketEditor", True, type=bool):
if self.settings.value("pythonConsole/autoCloseBracketEditor", False, type=bool):
startLine, _, endLine, endPos = self.getSelection()
t = unicode(e.text())
## Close bracket automatically
Expand All @@ -674,7 +674,7 @@ def keyPressEvent(self, e):
self.insert(self.closing[i])
## FIXES #8392 (automatically removes the redundant char
## when autoclosing brackets option is enabled)
if t in self.closing:
if t in [')', ']', '}']:
l, pos = self.getCursorPosition()
txt = self.text(l)
try:
Expand Down
4 changes: 2 additions & 2 deletions python/console/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def keyPressEvent(self, e):
self.showNext()
## TODO: press event for auto-completion file directory
else:
if self.settings.value("pythonConsole/autoCloseBracket", True, type=bool):
if self.settings.value("pythonConsole/autoCloseBracket", False, type=bool):
t = unicode(e.text())
## Close bracket automatically
if t in self.opening:
Expand All @@ -425,7 +425,7 @@ def keyPressEvent(self, e):
self.insert(self.closing[i])
## FIXES #8392 (automatically removes the redundant char
## when autoclosing brackets option is enabled)
if t in self.closing:
if t in [')', ']', '}']:
l, pos = self.getCursorPosition()
txt = self.text(l)
try:
Expand Down
4 changes: 2 additions & 2 deletions python/console/console_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def restoreSettings(self):
self.autoCompThresholdEditor.setValue(settings.value("pythonConsole/autoCompThresholdEditor", 2, type=int))

self.enableObjectInspector.setChecked(settings.value("pythonConsole/enableObjectInsp", False, type=bool))
self.autoCloseBracketEditor.setChecked(settings.value("pythonConsole/autoCloseBracketEditor", True, type=bool))
self.autoCloseBracket.setChecked(settings.value("pythonConsole/autoCloseBracket", True, type=bool))
self.autoCloseBracketEditor.setChecked(settings.value("pythonConsole/autoCloseBracketEditor", False, type=bool))
self.autoCloseBracket.setChecked(settings.value("pythonConsole/autoCloseBracket", False, type=bool))

if settings.value("pythonConsole/autoCompleteSource") == 'fromDoc':
self.autoCompFromDoc.setChecked(True)
Expand Down
35 changes: 24 additions & 11 deletions src/plugins/coordinate_capture/coordinatecapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,22 @@ void CoordinateCapture::initGui()
mTransform.setDestCRS( mCrs ); // set the CRS in the transform
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 5 : 3; // precision depends on CRS units

//create the dock widget
mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
mpDockWidget->setObjectName( "CoordinateCapture" );
mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

// Create the action for tool
mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
mQActionPointer->setCheckable( true );
mQActionPointer->setChecked( mpDockWidget->isVisible() );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
// Connect the action to the run
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( showOrHide() ) );
mQGisIface->addPluginToVectorMenu( tr( "&Coordinate Capture" ), mQActionPointer );
mQGisIface->addVectorToolBarIcon( mQActionPointer );

// create our map tool
mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
Expand Down Expand Up @@ -155,16 +164,9 @@ void CoordinateCapture::initGui()
mypLayout->addWidget( mypCopyButton, 2, 1 );
mypLayout->addWidget( mpCaptureButton, 3, 1 );


//create the dock widget
mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
mpDockWidget->setObjectName( "CoordinateCapture" );
mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

// now add our custom widget to the dock - ownership of the widget is passed to the dock
mpDockWidget->setWidget( mypWidget );

connect( mpDockWidget, SIGNAL( visibilityChanged( bool ) ), mQActionPointer, SLOT( setChecked( bool ) ) );
}

//method defined in interface
Expand Down Expand Up @@ -243,12 +245,23 @@ void CoordinateCapture::run()
//myPluginGui->show();
}

void CoordinateCapture::showOrHide()
{
if ( !mpDockWidget )
run();
else
if ( mQActionPointer->isChecked() )
mpDockWidget->show();
else
mpDockWidget->hide();
}

// Unload the plugin by cleaning up the GUI
void CoordinateCapture::unload()
{
// remove the GUI
mQGisIface->removePluginMenu( "&Coordinate Capture", mQActionPointer );
//mQGisIface->removeToolBarIcon( mQActionPointer );
mQGisIface->removePluginVectorMenu( "&Coordinate Capture", mQActionPointer );
mQGisIface->removeVectorToolBarIcon( mQActionPointer );
mpMapTool->deactivate();
delete mpMapTool;
delete mpDockWidget;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/coordinate_capture/coordinatecapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class CoordinateCapture: public QObject, public QgisPlugin
void run();
//! unload the plugin
void unload();
//! Show/hide the dockwidget
void showOrHide();
//! show the help document
void help();
//! Set the Coordinate Reference System used for displaying non canvas CRS coord
Expand Down