Beispiel #1
0
    def OnLayerChangeOpacity(self, event):
        """Opacity of a layer is changing."""
        layers = self._layerList.GetSelectedLayers()
        if not layers or len(layers) > 1:
            return
        layer = layers[0]
        dlg = SetOpacityDialog(self, opacity=layer.opacity,
                               title=_("Set opacity of <%s>") % layer.name)
        dlg.applyOpacity.connect(lambda value:
                                 self._setLayerOpacity(layer, value))
        dlg.CentreOnParent()

        if dlg.ShowModal() == wx.ID_OK:
            self._setLayerOpacity(layer, dlg.GetOpacity())
        dlg.Destroy()
        event.Skip()
Beispiel #2
0
    def OnPopupOpacityLevel(self, event):
        """Popup opacity level indicator"""

        cat_id = self.cats_mgr.GetCategories()[self.rightClickedItemIdx]
        cat_attrs = self.cats_mgr.GetCategoryAttrs(cat_id)
        value = cat_attrs['opacity'] * 100
        name = cat_attrs['name']

        dlg = SetOpacityDialog(self,
                               opacity=value,
                               title=_("Change opacity of class <%s>" % name))

        dlg.applyOpacity.connect(lambda value: self._setCatAttrs(
            cat_id=cat_id, attrs={'opacity': value}))
        dlg.CentreOnParent()

        if dlg.ShowModal() == wx.ID_OK:
            self._setCatAttrs(cat_id=cat_id, attrs={'opacity': value})

        dlg.Destroy()