Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix monkey patching when comment contains "
  • Loading branch information
nyalldawson committed Apr 26, 2023
1 parent bf668be commit b290179
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions python/core/auto_additions/qgis.py
Expand Up @@ -3522,14 +3522,15 @@
QgsEditFormConfig.EditorLayout.GeneratedLayout = Qgis.AttributeFormLayout.AutoGenerated
QgsEditFormConfig.GeneratedLayout.is_monkey_patched = True
QgsEditFormConfig.GeneratedLayout.__doc__ = "Autogenerate a simple tabular layout for the form"
QgsEditFormConfig.DragAndDrop = Qgis.AttributeFormLayout.DragAndDrop
QgsEditFormConfig.DragAndDrop.is_monkey_patched = True
QgsEditFormConfig.DragAndDrop.__doc__ = "\"Drag and drop\" layout. Needs to be configured."
QgsEditFormConfig.TabLayout = Qgis.AttributeFormLayout.DragAndDrop
QgsEditFormConfig.EditorLayout.TabLayout = Qgis.AttributeFormLayout.DragAndDrop
QgsEditFormConfig.TabLayout.is_monkey_patched = True
QgsEditFormConfig.TabLayout.__doc__ = "\"Drag and drop\" layout. Needs to be configured."
QgsEditFormConfig.UiFileLayout = Qgis.AttributeFormLayout.UiFile
QgsEditFormConfig.EditorLayout.UiFileLayout = Qgis.AttributeFormLayout.UiFile
QgsEditFormConfig.UiFileLayout.is_monkey_patched = True
QgsEditFormConfig.UiFileLayout.__doc__ = "Load a .ui file for the layout. Needs to be configured."
Qgis.AttributeFormLayout.__doc__ = 'Available form types for layout of the attribute form editor.\n\n.. note::\n\n Prior to QGIS 3.32 this was available as :py:class:`QgsEditFormConfig`.EditorLayout.\n\n.. versionadded:: 3.32\n\n' + '* ``GeneratedLayout``: ' + Qgis.AttributeFormLayout.AutoGenerated.__doc__ + '\n' + '* ``DragAndDrop``: ' + Qgis.AttributeFormLayout.DragAndDrop.__doc__ + '\n' + '* ``UiFileLayout``: ' + Qgis.AttributeFormLayout.UiFile.__doc__
Qgis.AttributeFormLayout.__doc__ = 'Available form types for layout of the attribute form editor.\n\n.. note::\n\n Prior to QGIS 3.32 this was available as :py:class:`QgsEditFormConfig`.EditorLayout.\n\n.. versionadded:: 3.32\n\n' + '* ``GeneratedLayout``: ' + Qgis.AttributeFormLayout.AutoGenerated.__doc__ + '\n' + '* ``TabLayout``: ' + Qgis.AttributeFormLayout.DragAndDrop.__doc__ + '\n' + '* ``UiFileLayout``: ' + Qgis.AttributeFormLayout.UiFile.__doc__
# --
Qgis.AttributeFormLayout.baseClass = Qgis
QgsEditFormConfig.FeatureFormSuppress = Qgis.AttributeFormSuppression
Expand Down
2 changes: 1 addition & 1 deletion scripts/sipify.pl
Expand Up @@ -1151,10 +1151,10 @@ sub detect_non_method_member{
my $enum_decl = $LINE =~ s/^(\s*(?<em>\w+))(\s+SIP_PYNAME(?:\(\s*(?<pyname>[^() ]+)\s*\)\s*)?)?(\s+SIP_MONKEY\w+(?:\(\s*(?<compat>[^() ]+)\s*\)\s*)?)?(?:\s*=\s*(?:[\w\s\d|+-]|::|<<)+)?(,?)(:?\s*\/\/!<\s*(?<co>.*)|.*)$/$1$3$7/r;
my $enum_member = $+{em};
my $comment = $+{co};
my $compat_name = $+{compat} ? $+{compat} : $enum_member;
# replace :: with . (changes c++ style namespace/class directives to Python style)
$comment =~ s/::/./g;
$comment =~ s/\"/\\"/g;
my $compat_name = $+{compat} ? $+{compat} : $enum_member;
dbg_info("is_scope_based:$is_scope_based enum_mk_base:$enum_mk_base monkeypatch:$monkeypatch");
if ($is_scope_based eq "1" and $enum_member ne "") {
if ( $monkeypatch eq 1 and $enum_mk_base ne ""){
Expand Down

0 comments on commit b290179

Please sign in to comment.