Exemplo n.º 1
0
    def addStyle(self, pglayername, vlayer, uri):
        """Add style to layer. Assumes tablename if stylename
        :param pglayername: layer to query for in public.layer_styles
        :param vlayer: layer to apply style for
        :return: True if no error
        """

        qmlfile = os.path.join(JupiterAux.pluginpath(), 'style',
                               'borehole.qml')
        msg, styleloaded = vlayer.loadNamedStyle(qmlfile, True)
        iface.mapCanvas().refresh()
        iface.legendInterface().refreshLayerSymbology(vlayer)
        vlayer.triggerRepaint()

        return True

        JupiterAux.log_info(u'Loading default style from db...')
        db = JupiterDb()
        styleqml = db.get_style(pglayername)

        if styleqml:
            #vlayer.applyNamedStyle(pglayername)
            styleok = vlayer.loadNamedStyle(styleqml, True)
            iface.mapCanvas().refresh()
            iface.legendInterface().refreshLayerSymbology(vlayer)
            vlayer.triggerRepaint()
            JupiterAux.log_info(u'Style applied to: {}'.format(pglayername))
        else:
            JupiterAux.log_info(
                u'Table {} has no default style in db'.format(pglayername))

        return True
Exemplo n.º 2
0
 def getIcon(self):
     """Load icon """
     return QIcon(os.path.join(JupiterAux.pluginpath(), 'pix', 'jupiter_red.png'))
Exemplo n.º 3
0
 def getIcon(self):
     """Load jupiter icon.
     """
     iconpath = os.path.join(JupiterAux.pluginpath(), 'pix', 'jupiter.png')
     return QIcon(iconpath)