940 |
sensitive = _has_selected_layer) |
sensitive = _has_selected_layer) |
941 |
|
|
942 |
def _can_unjoin(context): |
def _can_unjoin(context): |
943 |
|
"""Return whether the Layer/Unjoin command can be executed. |
944 |
|
|
945 |
|
This is the case if a layer is selected and that layer has a |
946 |
|
shapestore that has an original shapestore. |
947 |
|
""" |
948 |
layer = context.mainwindow.SelectedLayer() |
layer = context.mainwindow.SelectedLayer() |
949 |
return bool(layer and layer.ShapeStore().OrigShapeStore() is not None) |
if layer is None: |
950 |
|
return 0 |
951 |
|
getstore = getattr(layer, "ShapeStore", None) |
952 |
|
if getstore is not None: |
953 |
|
return getstore().OrigShapeStore() is not None |
954 |
|
else: |
955 |
|
return 0 |
956 |
_method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable", |
_method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable", |
957 |
sensitive = _can_unjoin) |
sensitive = _can_unjoin) |
958 |
|
|