qgis_layout_plugin/plot_layout/gui/gui.py
2021-07-13 13:47:06 +02:00

58 lines
1.5 KiB
Python

from qgis.PyQt.QtCore import (
QCoreApplication,
QItemSelectionModel
)
from qgis.PyQt.QtWidgets import (
QListWidget,
QHBoxLayout,
QPushButton,
QVBoxLayout
)
from qgis.PyQt.QtGui import QIcon
from qgis.gui import (
QgsLayoutItemAbstractGuiMetadata,
QgsLayoutItemBaseWidget,
QgsLayoutItemPropertiesWidget
)
from qgis.core import ( QgsLayoutItemRegistry )
# from plot_settings_widget import DataPlotlyPanelWidget
ITEM_TYPE = QgsLayoutItemRegistry.PluginItem + 1338
class PlotLayoutItemWidget(QgsLayoutItemBaseWidget):
"""
Configuration widget for layout plot items
"""
def __init__(self, parent, layout_object):
super().__init__(parent, layout_object)
self.plot_item = layout_object
self.message_bar = None
vl = QVBoxLayout()
vl.setContentsMargins(0, 0, 0, 0)
self.item_properties_widget = QgsLayoutItemPropertiesWidget(self, layout_object)
vl.addWidget(self.item_properties_widget)
self.setLayout(vl)
class PlotLayoutItemGuiMetadata(QgsLayoutItemAbstractGuiMetadata):
"""
Metadata for plot item GUI classes
"""
def __init__(self):
super().__init__(ITEM_TYPE, 'layoutItemGui')
def creationIcon(self): # pylint: disable=missing-docstring, no-self-use
icon_path = ':/plugins/plot_layout/icon.png'
return QIcon(icon_path)
def createItemWidget(self, item): # pylint: disable=missing-docstring, no-self-use
return PlotLayoutItemWidget(None, item)