Skip to content
Permalink
Browse files

fix dox for unnested enums

  • Loading branch information
3nids committed Mar 25, 2019
1 parent 1dc535d commit 38c2d4a03dc269c791b0c98f4a5955fd6f9885de
@@ -1,14 +1,14 @@
# The following has been generated automatically from src/core/qgsmaplayer.h
# monkey patching scoped based enum
QgsMapLayer.VectorLayer.__doc__ = ""
QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
QgsMapLayer.RasterLayer.__doc__ = ""
QgsMapLayer.VectorLayer.__doc__ = ""
QgsMapLayer.RasterLayer = QgsMapLayerType.RasterLayer
QgsMapLayer.PluginLayer.__doc__ = ""
QgsMapLayer.RasterLayer.__doc__ = ""
QgsMapLayer.PluginLayer = QgsMapLayerType.PluginLayer
QgsMapLayer.MeshLayer.__doc__ = "Added in 3.2"
QgsMapLayer.PluginLayer.__doc__ = ""
QgsMapLayer.MeshLayer = QgsMapLayerType.MeshLayer
.QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n' + '* VectorLayer: ' + .QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* RasterLayer: ' + .QgsMapLayerType.RasterLayer.__doc__ + '\n' + '* PluginLayer: ' + .QgsMapLayerType.PluginLayer.__doc__ + '\n' + '* MeshLayer: ' + .QgsMapLayerType.MeshLayer.__doc__
QgsMapLayer.MeshLayer.__doc__ = "Added in 3.2"
QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n' + '* VectorLayer: ' + QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* RasterLayer: ' + QgsMapLayerType.RasterLayer.__doc__ + '\n' + '* PluginLayer: ' + QgsMapLayerType.PluginLayer.__doc__ + '\n' + '* MeshLayer: ' + QgsMapLayerType.MeshLayer.__doc__
# --
QgsMapLayer.LayerFlag.baseClass = QgsMapLayer
QgsMapLayer.LayerFlags.baseClass = QgsMapLayer
@@ -2,8 +2,11 @@
QgsAdvancedDigitizingDockWidget.CadCapacities.baseClass = QgsAdvancedDigitizingDockWidget
CadCapacities = QgsAdvancedDigitizingDockWidget # dirty hack since SIP seems to introduce the flags in module
# monkey patching scoped based enum
QgsAdvancedDigitizingDockWidget.NoConstraint = QgsAdvancedDigitizingDockWidget.AdditionalConstraint.NoConstraint
QgsAdvancedDigitizingDockWidget.AdditionalConstraint.NoConstraint.__doc__ = "No additional constraint"
QgsAdvancedDigitizingDockWidget.Perpendicular = QgsAdvancedDigitizingDockWidget.AdditionalConstraint.Perpendicular
QgsAdvancedDigitizingDockWidget.AdditionalConstraint.Perpendicular.__doc__ = "Perpendicular"
QgsAdvancedDigitizingDockWidget.Parallel = QgsAdvancedDigitizingDockWidget.AdditionalConstraint.Parallel
QgsAdvancedDigitizingDockWidget.AdditionalConstraint.Parallel.__doc__ = "Parallel"
QgsAdvancedDigitizingDockWidget.AdditionalConstraint.__doc__ = 'Additional constraints which can be enabled\n\n' + '* NoConstraint: ' + QgsAdvancedDigitizingDockWidget.AdditionalConstraint.NoConstraint.__doc__ + '\n' + '* Perpendicular: ' + QgsAdvancedDigitizingDockWidget.AdditionalConstraint.Perpendicular.__doc__ + '\n' + '* Parallel: ' + QgsAdvancedDigitizingDockWidget.AdditionalConstraint.Parallel.__doc__
# --
@@ -959,7 +959,7 @@ sub detect_non_method_member{
my $is_scope_based = "0";
$is_scope_based = "1" if defined $2;
my $monkeypatch = "0";
$monkeypatch = "1" if defined $is_scope_based eq "1" and $LINE =~ m/SIP_MONKEYPATCH_SCOPEENUM_UNNEST(:?\(\s*(?<emkb>\w+)\s*\))/;
$monkeypatch = "1" if defined $is_scope_based eq "1" and $LINE =~ m/SIP_MONKEYPATCH_SCOPEENUM(_UNNEST)?(:?\(\s*(?<emkb>\w+)\s*\))?/;
my $enum_mk_base = "";
$enum_mk_base = $+{emkb} if defined $+{emkb};
if ($LINE =~ m/\{((\s*\w+)(\s*=\s*[\w\s\d<|]+.*?)?(,?))+\s*\}/){
@@ -986,18 +986,18 @@ sub detect_non_method_member{
my $enum_decl = $LINE =~ s/^(\s*(?<em>\w+))(\s+SIP_\w+(?:\([^()]+\))?)?(?:\s*=\s*(?:[\w\s\d|+-]|::|<<)+)?(,?)(:?\s*\/\/!<\s*(?<co>.*)|.*)$/$1$3$4/r;
my $enum_member = $+{em};
my $comment = $+{co};
push @enum_members_doc, "'* $enum_member: ' + $ACTUAL_CLASS.$enum_qualname.$2.__doc__";
dbg_info("is_scope_based:$is_scope_based enum_mk_base:$enum_mk_base monkeypatch:$monkeypatch");
if ($is_scope_based eq "1") {
if ( $enum_mk_base ne "" ){
push @OUTPUT_PYTHON, "$enum_mk_base.$enum_member.__doc__ = \"$comment\"\n" ;
if ($monkeypatch eq "1") {
if ( $monkeypatch eq 1 ){
if ($enum_mk_base ne "") {
push @OUTPUT_PYTHON, "$enum_mk_base.$enum_member = $enum_qualname.$enum_member\n";
push @OUTPUT_PYTHON, "$enum_mk_base.$enum_member.__doc__ = \"$comment\"\n" ;
push @enum_members_doc, "'* $enum_member: ' + $enum_qualname.$enum_member.__doc__";
} else {
push @OUTPUT_PYTHON, "$ACTUAL_CLASS.$enum_member = $ACTUAL_CLASS.$enum_qualname.$enum_member\n";
push @OUTPUT_PYTHON, "$ACTUAL_CLASS.$enum_qualname.$enum_member.__doc__ = \"$comment\"\n";
push @enum_members_doc, "'* $enum_member: ' + $ACTUAL_CLASS.$enum_qualname.$enum_member.__doc__";
}
} else {
push @OUTPUT_PYTHON, "$ACTUAL_CLASS.$enum_qualname.$enum_member.__doc__ = \"$comment\"\n";
}
}
$enum_decl = fix_annotations($enum_decl);
@@ -1006,7 +1006,13 @@ sub detect_non_method_member{
detect_comment_block(strict_mode => UNSTRICT);
}
write_output("ENU4", "$LINE\n");
push @OUTPUT_PYTHON, "$ACTUAL_CLASS.$enum_qualname.__doc__ = '$COMMENT\\n\\n' + " . join(" + '\\n' + ", @enum_members_doc) . "\n# --\n" if $is_scope_based eq "1";
if ($is_scope_based eq "1") {
if ( $ACTUAL_CLASS ne "" ){
push @OUTPUT_PYTHON, "$ACTUAL_CLASS.$enum_qualname.__doc__ = '$COMMENT\\n\\n' + " . join(" + '\\n' + ", @enum_members_doc) . "\n# --\n";
} else {
push @OUTPUT_PYTHON, "$enum_qualname.__doc__ = '$COMMENT\\n\\n' + " . join(" + '\\n' + ", @enum_members_doc) . "\n# --\n";
}
}
# enums don't have Docstring apparently
$COMMENT = '';
next;

0 comments on commit 38c2d4a

Please sign in to comment.
You can’t perform that action at this time.