From cb28240d7430d0587ae4efa6017be67761f270f5 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 13 Jul 2021 13:47:06 +0200 Subject: [PATCH] add properties in the layout widget --- .../__pycache__/plot_layout.cpython-38.pyc | Bin 6460 -> 0 bytes plot_layout/gui/gui.py | 230 +----------------- .../layouts/__pycache__/layout.cpython-38.pyc | Bin 1490 -> 0 bytes plot_layout/layouts/layout.py | 11 +- 4 files changed, 13 insertions(+), 228 deletions(-) delete mode 100644 plot_layout/__pycache__/plot_layout.cpython-38.pyc delete mode 100644 plot_layout/layouts/__pycache__/layout.cpython-38.pyc diff --git a/plot_layout/__pycache__/plot_layout.cpython-38.pyc b/plot_layout/__pycache__/plot_layout.cpython-38.pyc deleted file mode 100644 index 1752234b70adcc94ee8ac40bd0efd548b22e26ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6460 zcmb_gNsk-H74B{}wpZh5I`Vdde}8&OTAFl z)f&%)xSYZRW-L6SqcI*!RlIHy?XV%tv_E` zaSS|vyYr7<2H!D^zf)uJDWLHY{>kr9ct+RoOwS6;(CS)Yp<4*;u5D6ZAt;8WZb{Yc zpd41Z6;&?=)zIlWs$L3eVZB>Nz3f$jl@7hD!D_hHT~p&uu-@H3UoE&0UhG~}^XkE+ z@N)OEY3vx@inscu;jKQgx>r2suF+U?|7;tE)4KNJ9*5ltV!0dLc8}v!I_!DR7Te$1 zy~{>HI`AWhNuEe{7z^flo*xa+A4}#(EXc|2@Q4dna*rJxV<%d~K2H6>wbKuKideHRa*8adxHue0?e17XW%x#{3W-AUjZG7fwvm4iMyt8@zhnw%b zJDUj>STb~%r?%Paw_+Sx7pS0h9XQS-X6N)DA~O29|)ez z7V^;bgT+NuZ?pSp;Pa>%`Vp5O_4Ud?t!(z=c;v7bck9<$&I?A-wX^5>zuVVvP%Q2Y z{e+D~JP>ZkP(2i!vm`#0N3P)SGoY3A-G~Y9`H2+%K`J@J-MNw10vyBG^AC?1%ZXti zjet2O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%!m7gQd#I2&5EEMBWe=jD++Sti zgj7V7r-l-VMVN)aOmW>SKqU6bwa<{ZA`KhH03pRgBc#^|w8(tHyTI-NwE;Vd#e>c* zl7hlZ4I5?!FBl-#g5$}G{0rXiO#|i<;yh$ZXAUe#oBoP_LgBViRHrRCmSf?(>r3Ya zP#dLAr?a=W*KjC}q8yfT*Io}F@=}$@)_c8&sT<@Y= len(self.plot_item.plot_settings) - 1: - # return - - # item = self.plot_item.plot_settings.pop(selected_index) - # self.plot_item.plot_settings.insert(selected_index + 1, item) - # self.plot_list.setCurrentRow(selected_index + 1, QItemSelectionModel.SelectCurrent) - # self.populate_plot_list() - # self.plot_item.refresh() - - # def show_properties(self): - # """ - # Shows the plot properties panel - # """ - # selected_plot_index = self.plot_list.currentRow() - # if selected_plot_index < 0: - # return - - # self.panel = DataPlotlyPanelWidget(mode=DataPlotlyPanelWidget.MODE_LAYOUT, message_bar=self.message_bar) - - # # not quite right -- we ideally want to also add the source layer scope into the context given by plot item, - # # but that causes a hard lock in the Python GIL (because PyQt doesn't release the GIL when creating the menu - # # for the property override buttons). Nothing much we can do about that here (or in QGIS, - # # it's a Python/PyQt limitation) - # self.panel.registerExpressionContextGenerator(self.plot_item) - # self.panel.set_print_layout(self.plot_item.layout()) - - # self.panel.linked_map_combo.blockSignals(True) - # self.panel.linked_map_combo.setItem(self.plot_item.linked_map) - # self.panel.linked_map_combo.blockSignals(False) - - # self.panel.filter_by_map_check.toggled.connect(self.filter_by_map_toggled) - # self.panel.filter_by_atlas_check.toggled.connect(self.filter_by_atlas_toggled) - # self.panel.linked_map_combo.itemChanged.connect(self.linked_map_changed) - - # self.panel.filter_by_map_check.blockSignals(True) - # self.panel.filter_by_map_check.setChecked(self.plot_item.filter_by_map) - # self.panel.filter_by_map_check.blockSignals(False) - - # self.panel.filter_by_atlas_check.blockSignals(True) - # self.panel.filter_by_atlas_check.setChecked(self.plot_item.filter_by_atlas) - # self.panel.filter_by_atlas_check.blockSignals(False) - - # self.panel.set_settings(self.plot_item.plot_settings[selected_plot_index]) - # # self.panel.set_settings(self.layoutItem().plot_settings) - # self.openPanel(self.panel) - # self.panel.widgetChanged.connect(self.update_item_settings) - # self.panel.panelAccepted.connect(self.set_item_settings) - - # def update_item_settings(self): - # """ - # Updates the plot item without dismissing the properties panel - # """ - # if not self.panel: - # return - - # self.plot_item.set_plot_settings(self.plot_list.currentRow(), self.panel.get_settings()) - # self.populate_plot_list() - # self.plot_item.update() - - # def set_item_settings(self): - # """ - # Updates the plot item based on the settings from the properties panel - # """ - # if not self.panel: - # return - - # self.plot_item.set_plot_settings(self.plot_list.currentRow(), self.panel.get_settings()) - # self.populate_plot_list() - # self.panel = None - # self.plot_item.update() - - # def filter_by_map_toggled(self, value): - # """ - # Triggered when the filter by map option is toggled - # """ - # self.plot_item.filter_by_map = bool(value) - # self.plot_item.update() - - # def filter_by_atlas_toggled(self, value): - # """ - # Triggered when the filter by atlas option is toggled - # """ - # self.plot_item.filter_by_atlas = bool(value) - # self.plot_item.update() - - # def linked_map_changed(self, linked_map): - # """ - # Triggered when the linked map is changed - # """ - # self.plot_item.set_linked_map(linked_map) - # self.plot_item.update() - - # def setNewItem(self, item): # pylint: disable=missing-docstring - # if item.type() != ITEM_TYPE: - # return False - - # self.plot_item = item - # self.item_properties_widget.setItem(item) - # self.populate_plot_list() - - # if self.panel is not None: - # self.panel.set_settings(self.plot_item.plot_settings[0]) - - # self.panel.filter_by_map_check.blockSignals(True) - # self.panel.filter_by_map_check.setChecked(item.filter_by_map) - # self.panel.filter_by_map_check.blockSignals(False) - - # self.panel.filter_by_atlas_check.blockSignals(True) - # self.panel.filter_by_atlas_check.setChecked(item.filter_by_atlas) - # self.panel.filter_by_atlas_check.blockSignals(False) - - # self.panel.linked_map_combo.blockSignals(True) - # self.panel.linked_map_combo.setItem(self.plot_item.linked_map) - # self.panel.linked_map_combo.blockSignals(False) - - # return True - - # def setDesignerInterface(self, iface): # pylint: disable=missing-docstring - # super().setDesignerInterface(iface) - # self.message_bar = iface.messageBar() - # if self.panel: - # self.panel.message_bar = self.message_bar - - + 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): diff --git a/plot_layout/layouts/__pycache__/layout.cpython-38.pyc b/plot_layout/layouts/__pycache__/layout.cpython-38.pyc deleted file mode 100644 index fcdfc20be200ed08e504344981c767fc5a621e17..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1490 zcmaJ>OK;Oa5Z?7Gj@v+?wBc1A5(g|GM&gDLqC!ffNp{-wQg;=mu^#LPOO38k#GpLcfcnfYeE_4``QBQQ=s{`^E7LcXIhIV>>Vz!WWj zl%zBxISpxUghpAqi$NIn0qEp2C8WkftOwPDq=k zG&PRh&@8!yR>>)}Pl!cA2N+eB=UftF!ZEJVH%>7JAjuK=Mi1#JrBK@~azeeL)vZ>b$eYIMQ4Vx1k2jW$#jj*sH#R$lEp&6A^Eiv>;ju$Z;*9aFKA>%5@&(f zjX4W8SJ$>Qya@WdXm>Lvf|Rx6K_-L#Q0^AJpq~vo-JXDFA)_)tP(H-y+2{}X3}lNL z3(bdqtxwZzjB~xfm%>MH@k106a^zK5@M{3R!E5kPm89rN_C@N=60YOEmGbyt9#-R^ z^M3`!^8^Eo2d<|A%5gv+YPPn$(u}r0Y^;ZQ8W?wD!zhjxeIUwrhr>WTw~UB7xZ2N z=F~v-;1G`h{-;i@N*h#ZtHtTcjql8b;$f4tIx(eEozh6@sZr|FH(JUo#eo;qH#z=1 zO0o;MT13#Cu)!rUl+H7lEt zDLCUugkyO*)|tbvhj8pRuK*}-L*GP9nCoI9UF~Kf;-9iA_f;vq*C==`ng^a|&Mo~0 D&@V^z diff --git a/plot_layout/layouts/layout.py b/plot_layout/layouts/layout.py index c5fc368..0026d99 100644 --- a/plot_layout/layouts/layout.py +++ b/plot_layout/layouts/layout.py @@ -17,10 +17,15 @@ class PlotLayoutItem(QgsLayoutItem): super().__init__(layout) def draw(self, context): - pass - # if not self.html_loaded: - # self.load_content() + #pass + #if not self.html_loaded: + painter = context.renderContext().painter() + painter.save() + + + def load_content(self): + return 'vjdnvjndjn' # if not self.layout().renderContext().isPreviewRender(): # # this is NOT safe to do when rendering in the gui (i.e. a preview render), but for exports we have # # to loop around until the HTML has fully loaded