Skip to content

Commit

Permalink
rename settings editor widget wrappers
Browse files Browse the repository at this point in the history
to allow more than 1 widget type to be supported for each type of setting
  • Loading branch information
3nids committed Oct 4, 2024
1 parent f549811 commit 0f8a72e
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
except NameError:
pass
try:
QgsSettingsStringEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsStringLineEditWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsBoolEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsBoolCheckBoxWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsIntegerEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsIntegerSpinBoxWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsDoubleEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsDoubleSpinBoxWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsColorEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsColorButtonWrapper.__group__ = ['settings']
except NameError:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ To be re-implemented to implemeent type specific configuration (e.g. opacity for

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryString,QLineEdit,QString> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase;

class QgsSettingsStringEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase
class QgsSettingsStringLineEditWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase
{
%Docstring(signature="appended")
This class is a factory of editor for string settings
This class is a factory of editor for string settings with a line edit

.. versionadded:: 3.32
%End
Expand All @@ -91,7 +91,7 @@ This class is a factory of editor for string settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryString,QLineEdit,QString> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase;
%End
public:
QgsSettingsStringEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsStringLineEditWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -115,12 +115,13 @@ Constructor
};



typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryBool,QCheckBox,bool> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase;

class QgsSettingsBoolEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase
class QgsSettingsBoolCheckBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase
{
%Docstring(signature="appended")
This class is a factory of editor for boolean settings
This class is a factory of editor for boolean settings with a checkbox

.. versionadded:: 3.32
%End
Expand All @@ -130,7 +131,7 @@ This class is a factory of editor for boolean settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryBool,QCheckBox,bool> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase;
%End
public:
QgsSettingsBoolEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsBoolCheckBoxWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -156,10 +157,10 @@ Constructor

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryInteger,QSpinBox,int> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase;

class QgsSettingsIntegerEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase
class QgsSettingsIntegerSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase
{
%Docstring(signature="appended")
This class is a factory of editor for integer settings
This class is a factory of editor for integer settings with a spin box

.. versionadded:: 3.32
%End
Expand All @@ -169,7 +170,7 @@ This class is a factory of editor for integer settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryInteger,QSpinBox,int> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase;
%End
public:
QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsIntegerSpinBoxWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -196,10 +197,10 @@ Constructor

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryDouble,QDoubleSpinBox,double> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase;

class QgsSettingsDoubleEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase
class QgsSettingsDoubleSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase
{
%Docstring(signature="appended")
This class is a factory of editor for double settings
This class is a factory of editor for double settings with a double spin box

.. versionadded:: 3.32
%End
Expand All @@ -209,7 +210,7 @@ This class is a factory of editor for double settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryDouble,QDoubleSpinBox,double> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase;
%End
public:
QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsDoubleSpinBoxWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -236,10 +237,10 @@ Constructor

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryColor,QgsColorButton,QColor> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase;

class QgsSettingsColorEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase
class QgsSettingsColorButtonWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase
{
%Docstring(signature="appended")
This class is a factory of editor for color settings
This class is a factory of editor for color settings with a color button

.. versionadded:: 3.32
%End
Expand All @@ -249,7 +250,7 @@ This class is a factory of editor for color settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryColor,QgsColorButton,QColor> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase;
%End
public:
QgsSettingsColorEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsColorButtonWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand Down
7 changes: 7 additions & 0 deletions python/gui/__init__.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ QgsMapLayerAction.EnabledOnlyWhenEditable = _Qgis.MapLayerActionFlag.EnabledOnly
QgsMapLayerAction.EnabledOnlyWhenEditable.is_monkey_patched = True
QgsMapLayerAction.EnabledOnlyWhenEditable.__doc__ = "Action should be shown only for editable layers"
QgsMapLayerAction.Flags = _Qgis.MapLayerActionFlags

# monkey patch old settings wrappers
QgsSettingsStringEditorWidgetWrapper = QgsSettingsStringLineEditWrapper
QgsSettingsBoolEditorWidgetWrapper = QgsSettingsBoolCheckBoxWrapper
QgsSettingsIntegerEditorWidgetWrapper = QgsSettingsIntegerSpinBoxWrapper
QgsSettingsDoubleEditorWidgetWrapper = QgsSettingsDoubleSpinBoxWrapper
QgsSettingsColorEditorWidgetWrapper = QgsSettingsColorButtonWrapper
10 changes: 5 additions & 5 deletions python/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
except NameError:
pass
try:
QgsSettingsStringEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsStringLineEditWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsBoolEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsBoolCheckBoxWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsIntegerEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsIntegerSpinBoxWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsDoubleEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsDoubleSpinBoxWrapper.__group__ = ['settings']
except NameError:
pass
try:
QgsSettingsColorEditorWidgetWrapper.__group__ = ['settings']
QgsSettingsColorButtonWrapper.__group__ = ['settings']
except NameError:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ To be re-implemented to implemeent type specific configuration (e.g. opacity for

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryString,QLineEdit,QString> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase;

class QgsSettingsStringEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase
class QgsSettingsStringLineEditWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase
{
%Docstring(signature="appended")
This class is a factory of editor for string settings
This class is a factory of editor for string settings with a line edit

.. versionadded:: 3.32
%End
Expand All @@ -91,7 +91,7 @@ This class is a factory of editor for string settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryString,QLineEdit,QString> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase;
%End
public:
QgsSettingsStringEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsStringLineEditWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -115,12 +115,13 @@ Constructor
};



typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryBool,QCheckBox,bool> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase;

class QgsSettingsBoolEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase
class QgsSettingsBoolCheckBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase
{
%Docstring(signature="appended")
This class is a factory of editor for boolean settings
This class is a factory of editor for boolean settings with a checkbox

.. versionadded:: 3.32
%End
Expand All @@ -130,7 +131,7 @@ This class is a factory of editor for boolean settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryBool,QCheckBox,bool> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase;
%End
public:
QgsSettingsBoolEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsBoolCheckBoxWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -156,10 +157,10 @@ Constructor

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryInteger,QSpinBox,int> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase;

class QgsSettingsIntegerEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase
class QgsSettingsIntegerSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase
{
%Docstring(signature="appended")
This class is a factory of editor for integer settings
This class is a factory of editor for integer settings with a spin box

.. versionadded:: 3.32
%End
Expand All @@ -169,7 +170,7 @@ This class is a factory of editor for integer settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryInteger,QSpinBox,int> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase;
%End
public:
QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsIntegerSpinBoxWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -196,10 +197,10 @@ Constructor

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryDouble,QDoubleSpinBox,double> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase;

class QgsSettingsDoubleEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase
class QgsSettingsDoubleSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase
{
%Docstring(signature="appended")
This class is a factory of editor for double settings
This class is a factory of editor for double settings with a double spin box

.. versionadded:: 3.32
%End
Expand All @@ -209,7 +210,7 @@ This class is a factory of editor for double settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryDouble,QDoubleSpinBox,double> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase;
%End
public:
QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsDoubleSpinBoxWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand All @@ -236,10 +237,10 @@ Constructor

typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryColor,QgsColorButton,QColor> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase;

class QgsSettingsColorEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase
class QgsSettingsColorButtonWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase
{
%Docstring(signature="appended")
This class is a factory of editor for color settings
This class is a factory of editor for color settings with a color button

.. versionadded:: 3.32
%End
Expand All @@ -249,7 +250,7 @@ This class is a factory of editor for color settings
typedef QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryColor,QgsColorButton,QColor> QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase;
%End
public:
QgsSettingsColorEditorWidgetWrapper( QObject *parent = 0 );
QgsSettingsColorButtonWrapper( QObject *parent = 0 );
%Docstring
Constructor
%End
Expand Down
10 changes: 5 additions & 5 deletions src/gui/settings/qgssettingseditorwidgetregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

QgsSettingsEditorWidgetRegistry::QgsSettingsEditorWidgetRegistry()
{
addWrapper( new QgsSettingsStringEditorWidgetWrapper() );
addWrapper( new QgsSettingsBoolEditorWidgetWrapper() );
addWrapper( new QgsSettingsIntegerEditorWidgetWrapper() );
addWrapper( new QgsSettingsDoubleEditorWidgetWrapper() );
addWrapper( new QgsSettingsColorEditorWidgetWrapper() );
addWrapper( new QgsSettingsStringLineEditWrapper() );
addWrapper( new QgsSettingsBoolCheckBoxWrapper() );
addWrapper( new QgsSettingsIntegerSpinBoxWrapper() );
addWrapper( new QgsSettingsDoubleSpinBoxWrapper() );
addWrapper( new QgsSettingsColorButtonWrapper() );

// enum
#if defined( HAVE_QTSERIALPORT )
Expand Down
Loading

0 comments on commit 0f8a72e

Please sign in to comment.