def on_mLineStyleButton_clicked(self):
        if self.timeStart != 0:
            self.timeEnd = time.time()
            print self.timeEnd
            if self.timeEnd - self.timeStart <= 2:
                self.timeStart = 0
                return
        if (not self.mArrow):
            return

        newSymbol = self.mArrow.lineSymbol().clone()
        d = QgsSymbolV2SelectorDialog(newSymbol, QgsStyleV2.defaultStyle(),
                                      None, self)
        d.setExpressionContext(self.mArrow.createExpressionContext())

        if (d.exec_() == QDialog.Accepted):

            self.mArrow.beginCommand(QString("Arrow line style changed"))
            self.mArrow.setLineSymbol(newSymbol)
            self.updateLineSymbolMarker()
            self.mArrow.endCommand()
            self.mArrow.update()
        else:
            pass
            # delete newSymbol;
        self.timeStart = time.time()
예제 #2
0
    def on_mPageStyleButton_clicked(self):
        if self.timeStart != 0:
            self.timeEnd = time.time()
            print self.timeEnd
            if self.timeEnd - self.timeStart <= 2:
                self.timeStart = 0
                return
        if ( not self.mComposition ):
            return

        coverageLayer = None
        # use the atlas coverage layer, if any
        if ( self.mComposition.atlasComposition().enabled() ):
            coverageLayer = self.mComposition.atlasComposition().coverageLayer()

        newSymbol = self.mComposition.pageStyleSymbol().clone()
        if ( not newSymbol ):
            newSymbol = QgsFillSymbolV2()
        d = QgsSymbolV2SelectorDialog( newSymbol, QgsStyleV2.defaultStyle(), coverageLayer, self)
        d.setExpressionContext( self.mComposition.createExpressionContext() )

        if ( d.exec_() == QDialog.Accepted ):

            self.mComposition.setPageStyleSymbol( newSymbol )
            self.updatePageStyle()
        self.timeStart = time.time()
    def on_mShapeStyleButton_clicked(self):
        if self.timeStart != 0:
            self.timeEnd = time.time()
            print self.timeEnd
            if self.timeEnd - self.timeStart <= 2:
                self.timeStart = 0
                return
        if (not self.mComposerShape):
            return

        # use the atlas coverage layer, if any
        coverageLayer = self.atlasCoverageLayer()

        newSymbol = self.mComposerShape.shapeStyleSymbol().clone()
        d = QgsSymbolV2SelectorDialog(newSymbol, QgsStyleV2.defaultStyle(),
                                      coverageLayer, self)
        d.setExpressionContext(self.mComposerShape.createExpressionContext())

        if (d.exec_() == QDialog.Accepted):

            self.mComposerShape.beginCommand(QString("Shape style changed"))
            self.mComposerShape.setShapeStyleSymbol(newSymbol)
            self.updateShapeStyle()
            self.mComposerShape.endCommand()
        self.timeStart = time.time()
 def on_mMapMarkerButton_clicked(self):
     if ( self.mMarkerSymbol == None ):
         return
     markerSymbol = self.mMarkerSymbol.clone() 
     dlg = QgsSymbolV2SelectorDialog ( markerSymbol, QgsStyleV2.defaultStyle(), None, self )
     if ( dlg.exec_()!= QDialog.Rejected ):
         self.mMarkerSymbol = markerSymbol
         self.updateCenterIcon()
예제 #5
0
# coding: utf-8
from qgis.core import QgsStyleV2
from qgis.gui import QgsSymbolV2SelectorDialog
from qgis.utils import iface

layer = iface.activeLayer()
symbol_v2_selector_dialog = QgsSymbolV2SelectorDialog(
    layer.rendererV2().symbol(),  # Symbol,
    QgsStyleV2.defaultStyle(),  # Style,
    layer,  # QgsVectorLayer
    None,  # Parent
    False  # Embedded
)

symbol_v2_selector_dialog.show()