Skip to content

Commit

Permalink
Update metadata and bridgestyle, tweak style viewer look and plugin a…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
GeoSander committed Sep 21, 2024
1 parent 959a365 commit f9b62fc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
5 changes: 3 additions & 2 deletions geocatbridge/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ repository=https://github.com/GeoCat/qgis-bridge-plugin
hasProcessingProvider=yes
deprecated=False
changelog=Version 4.5.0, September 2024
- Replaced PNG icons with SVG icons
- Properly release resources when plugin reloads [#187]
- Replaced QtWebKit related code with regular Qt UI elements [#152, #185]
- bridgestyle: fix SLD XSD reference [#184]
- Replaced PNG icons with SVG icons
- Tweaked UI and renamed dialogs and actions for clarity
- bridgestyle -> 0.1.2: fix single-band raster styling, SLD XSD reference, and label concatenation

Version 4.4.2, July 2024
- Fix crash when temporary layer path/URI is too long
Expand Down
15 changes: 7 additions & 8 deletions geocatbridge/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,22 @@ def initGui(self):
self.initProcessing()

# Publish / main dialog menu item + toolbar button
self.action_publish = QAction(gui.getSvgIcon("bridge_icon"),
QCoreApplication.translate(self.name, f"{self.short_name} Publisher"),
self._win)
self.action_publish.setObjectName("startPublish")
publisher_name = QCoreApplication.translate(self.name, f"{self.short_name} Publisher")
self.action_publish = QAction(gui.getSvgIcon("bridge_icon"), publisher_name, self._win)
self.action_publish.setObjectName(publisher_name)
self.action_publish.triggered.connect(self.bridgeButtonClicked)
self.iface.addPluginToWebMenu(self.name, self.action_publish)
self.iface.addWebToolBarIcon(self.action_publish)

# Register dockable StyleViewer widget (also registers to View > Panels) but keep hidden
styleviewer_name = QCoreApplication.translate(self.name, f"{self.short_name} Style Viewer")
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.widget_styleviewer)
self.widget_styleviewer.setTitle(styleviewer_name)
self.widget_styleviewer.hide()

# StyleViewer menu item
self.action_styleviewer = QAction(gui.getSvgIcon("styleviewer"),
QCoreApplication.translate(self.name, "StyleViewer"),
self._win)
self.action_styleviewer.setObjectName("Style Viewer")
self.action_styleviewer = QAction(gui.getSvgIcon("styleviewer"), styleviewer_name, self._win)
self.action_styleviewer.setObjectName(styleviewer_name)
self.action_styleviewer.triggered.connect(self.widget_styleviewer.show)
self.iface.addPluginToWebMenu(self.name, self.action_styleviewer)

Expand Down
26 changes: 18 additions & 8 deletions geocatbridge/ui/styleviewerwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from qgis.PyQt.Qsci import QsciScintilla, QsciLexerXML, QsciLexerJSON
from qgis.PyQt.QtGui import QFont, QColor, QFontMetrics
from qgis.PyQt.QtWidgets import QVBoxLayout
from qgis.PyQt.QtWidgets import QVBoxLayout, QDockWidget, QFrame
from qgis.utils import iface

from geocatbridge.publish.style import (
Expand All @@ -17,7 +17,7 @@

class StyleViewerWidget(BASE, WIDGET):

def __init__(self, ):
def __init__(self):
super(StyleViewerWidget, self).__init__(iface.mainWindow())
self.setupUi(self)

Expand All @@ -43,6 +43,11 @@ def __init__(self, ):

self.updateForCurrentLayer()

def setTitle(self, title: str):
if not isinstance(self, QDockWidget):
return
self.setWindowTitle(title)

def updateLayer(self, layer):
active_layer = iface.activeLayer()
if active_layer is None or layer.id() == iface.activeLayer().id():
Expand Down Expand Up @@ -92,16 +97,20 @@ class EditorWidget(QsciScintilla):
def __init__(self, lexer=None):
super(EditorWidget, self).__init__()

if isinstance(self, QFrame):
self.setFrameStyle(QFrame.Panel | QFrame.Sunken)

font = QFont()
font.setFamily('Courier')
font.setFamily('Cascadia Mono, Roboto Mono, monospace')
font.setFixedPitch(True)
font.setPointSize(10)

self.setFont(font)
self.setMarginsFont(font)
fontmetrics = QFontMetrics(font)

font_metrics = QFontMetrics(font)
self.setMarginsFont(font)
self.setMarginWidth(0, fontmetrics.width("00000") + 6)
self.setMarginWidth(0, font_metrics.width("00000") + 6)
self.setMarginLineNumbers(0, True)
self.setMarginsBackgroundColor(QColor("#cccccc"))

Expand All @@ -110,9 +119,10 @@ def __init__(self, lexer=None):
self.setCaretLineVisible(True)
self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

self.setFolding(QsciScintilla.CircledTreeFoldStyle)

if lexer is not None:
lexer.setDefaultFont(font)
lexer.setDefaultFont(font)
self.setLexer(lexer)

self.setReadOnly(True)
self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier'.encode())
7 changes: 5 additions & 2 deletions geocatbridge/ui/styleviewerwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</sizepolicy>
</property>
<property name="windowTitle">
<string>StyleViewer</string>
<string>Style Viewer</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<property name="sizePolicy">
Expand All @@ -36,7 +36,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideMiddle</enum>
Expand Down Expand Up @@ -167,6 +167,9 @@
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
Expand Down

0 comments on commit f9b62fc

Please sign in to comment.