Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix error when enabling additional providers in processing
Add an interface method to show the options dialog at a specific
page. This is required since plugins can now embed their options
in the main options dialog, so they may also need a way to
force this dialog to open.

Implement this in processing so that enabling additional providers
works again.
  • Loading branch information
nyalldawson committed Mar 24, 2017
1 parent 109be1b commit 2354696
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -213,6 +213,7 @@ class QgisInterface : QObject
virtual QList<QgsComposerInterface *> openComposers() = 0;
virtual QgsComposerInterface *openComposer( QgsComposition *composition ) = 0;
virtual void closeComposer( QgsComposition *composition ) = 0;
virtual void showOptionsDialog( QWidget *parent = 0, const QString &currentPage = QString() ) = 0;

virtual QMap<QString, QVariant> defaultStyleSheetOptions() = 0;

Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/gui/ConfigDialog.py
Expand Up @@ -73,6 +73,7 @@ def __init__(self, parent):
layout.setMargin(0)
self.setLayout(layout)
layout.addWidget(self.config_widget)
self.setObjectName('processingOptions')

def apply(self):
self.config_widget.accept()
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/processing/gui/ProcessingToolbox.py
Expand Up @@ -74,8 +74,7 @@ def openSettings(url):
self.txtTip.setVisible(False)
self.tipWasClosed = True
else:
dlg = ConfigDialog(self)
dlg.exec_()
iface.showOptionsDialog(iface.mainWindow(), 'processingOptions')
self.txtTip.setVisible(self.disabledProviders())
self.txtTip.linkActivated.connect(openSettings)
if hasattr(self.searchBox, 'setPlaceholderText'):
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisappinterface.cpp
Expand Up @@ -418,6 +418,11 @@ void QgisAppInterface::closeComposer( QgsComposition *composition )
}
}

void QgisAppInterface::showOptionsDialog( QWidget *parent, const QString &currentPage )
{
return qgis->showOptionsDialog( parent, currentPage );
}

QMap<QString, QVariant> QgisAppInterface::defaultStyleSheetOptions()
{
return qgis->styleSheetBuilder()->defaultOptions();
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -208,6 +208,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QList<QgsComposerInterface *> openComposers() override;
QgsComposerInterface *openComposer( QgsComposition *composition ) override;
void closeComposer( QgsComposition *composition ) override;
virtual void showOptionsDialog( QWidget *parent = nullptr, const QString &currentPage = QString() ) override;

//! Return changeable options built from settings and/or defaults
QMap<QString, QVariant> defaultStyleSheetOptions() override;
Expand Down
7 changes: 7 additions & 0 deletions src/gui/qgisinterface.h
Expand Up @@ -293,6 +293,13 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual void closeComposer( QgsComposition *composition ) = 0;

/**
* Opens the options dialog. The \a currentPage argument can be used to force
* the dialog to open at a specific page.
* @note added in QGIS 3.0
*/
virtual void showOptionsDialog( QWidget *parent = nullptr, const QString &currentPage = QString() ) = 0;

//! Return changeable options built from settings and/or defaults
virtual QMap<QString, QVariant> defaultStyleSheetOptions() = 0;

Expand Down

0 comments on commit 2354696

Please sign in to comment.