From 04af3c1884730bbd38b207061a930f71092bcc4f Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 13 Jul 2021 11:47:27 +0200 Subject: [PATCH] simplify icon --- plot_layout/.gitignore | 1 + .../__pycache__/plot_layout.cpython-38.pyc | Bin 6272 -> 6460 bytes plot_layout/gui/gui.py | 10 +-- plot_layout/gui/gui_utils.py | 64 ------------------ .../layouts/__pycache__/layout.cpython-38.pyc | Bin 1356 -> 1490 bytes plot_layout/layouts/layout.py | 40 +++++------ 6 files changed, 24 insertions(+), 91 deletions(-) create mode 100644 plot_layout/.gitignore delete mode 100644 plot_layout/gui/gui_utils.py diff --git a/plot_layout/.gitignore b/plot_layout/.gitignore new file mode 100644 index 0000000..ba0430d --- /dev/null +++ b/plot_layout/.gitignore @@ -0,0 +1 @@ +__pycache__/ \ No newline at end of file diff --git a/plot_layout/__pycache__/plot_layout.cpython-38.pyc b/plot_layout/__pycache__/plot_layout.cpython-38.pyc index 9dbcbbb623974ea31de95722d39ac2c560c5472f..1752234b70adcc94ee8ac40bd0efd548b22e26ab 100644 GIT binary patch delta 891 zcmZuvO>5LZ7@o;)^R?OZV>i1kRkW5O!FEwEQY)e;EtR%bTTueij!sx(CrO=5tc8L~ zJqu-yR&4Kz+Ir|gul@rsxd?)I5Cv}{9-PT~sKo@Hc|V_d=b3qM?Co*;O1W$T@qL>9 zHc$4i+56z*wIgS)L9CKeXn7U{Si?Fg&&t&xcG&KF_#5tVFuPidV_&EK&^} z&w*eJ;4-!!0c@`-UJaWwz->pbiU9B*%Ei~ec8aD8Gxbt48A}7c)i&Y?w`ZEfYyvIE zDH~^gC^Flh+b$HK#g7^bu)^1kUO32ij0g^HA2y%C5nGJyDpat7%wQBn2|>&k5m!dE z&`%Q7^y#4RS}-K7J^?e^(ArW3=bNqp=a7sZ6p*QCanX;kYf+bf@4DCfZ)avAjOWlz z7R1pF{;+Z#j`EL{p>C$Gf)y~QF@3|>1RLfGxUFqM2)I>UxPMZTk4QKxV0Owa(eu)i zQ)C62MzkU=GekjjHHdJ$MEhmFEMY)`F7poAt;=P<86=D@d);E9e-xYa8N!I6zar4# zVM(#)99j?sOvw9OGO(?drE&wKu% zHh-ca8KqV&)yAbYAwibxYRfmxuQz`boYW6=bm|7py*iy0)gFIRM>SotOx;VhRoV7ot+7@yZ!K@ zsDB{N5Af!}i)c=Qi1-^kt-ryO2QMC+*;vrfU3li5XWsXD-kJB)m1pbu2f3W3h)?hT z7~-W#ehC~+R<=4C(s6cIK^ii!?dJwLpdf%uoF5bfXW^pn3>=_rD=3TXmkP39qy{Bq z-dCEr_n++y|CZ@YSGBGRvYeWSz~SG`MbP5EOafZd$JT4mv4v?f#nNJl&5%J7U>LfB zX-G!*-5`MbE^CS13|3@R7qBzkvOj1-^JnSu!bQn03y3v19=ilJZPwsx<&(w#D`N{H zvjzFb-3qsrmaYf|I7giQgv{iepcawpAVl|_U(GO~Q=k%t~Z^q5@| z#NS@ohRmIF(>>ya+mZKHoCQSzikb##kOGE4n9VEb8T?FRxcI| zlO!)e5lXuNo;E7^ QIcon: - """ - Returns a plugin icon - :param icon: icon name (svg file name) - :return: QIcon - """ - path = GuiUtils.get_icon_svg(icon) - if not path: - return QIcon() - - return QIcon(path) - - @staticmethod - def get_icon_svg(icon: str) -> str: - """ - Returns a plugin icon's SVG file path - :param icon: icon name (svg file name) - :return: icon svg path - """ - path = os.path.join( - os.path.dirname(__file__), - '..', - 'icons', - icon) - if not os.path.exists(path): - return '' - - return path - - @staticmethod - def get_ui_file_path(file: str) -> str: - """ - Returns a UI file's path - :param file: file name (uifile name) - :return: ui file path - """ - path = os.path.join( - os.path.dirname(__file__), - '..', - 'ui', - file) - if not os.path.exists(path): - return '' - - return path diff --git a/plot_layout/layouts/__pycache__/layout.cpython-38.pyc b/plot_layout/layouts/__pycache__/layout.cpython-38.pyc index b61897fa603863bdc88bdaf55b847d1fffa5f493..fcdfc20be200ed08e504344981c767fc5a621e17 100644 GIT binary patch delta 342 zcmX@Zb%~odl$V!_0SFexy-i@)$ScUms54ofQC=v8HHEE(A&Rw~frTN8Eto-*eX|E6 zBV!;FNHG+E*o;8z48+AOKq7@9n4yRh$S4v75}Hg!yg=#}dvbnWNoqw2SP()8fy7x- ziW19(C(mS(2D2u6Fa1A zu`<83#IqzdSChF2|YGOYTHvH+boH{$>R delta 206 zcmcb_eTIuSl$V!_0SFfQzD?M%kyns$@*ZaG#es~BlMgZZE9n4bikU$2j8(z`Ir$|% ziIw@KC7vazxq2m)1*w{BlZ~0R7)2*1GaGQQ0F`kt@yJY`%RE(rr6jeuM3cD)WOxxb zh!6%5B9jAH#2F1IXRy>VnoNGiVjv|35*7y$5+DMsR0hP7oNT}H~2x)O6+| Xsmal-Hr!y-I6&&8CNE;uXH*0LA*Lx4 diff --git a/plot_layout/layouts/layout.py b/plot_layout/layouts/layout.py index b48682a..c5fc368 100644 --- a/plot_layout/layouts/layout.py +++ b/plot_layout/layouts/layout.py @@ -15,31 +15,27 @@ class PlotLayoutItem(QgsLayoutItem): def __init__(self, layout): super().__init__(layout) - # self.setCacheMode(QGraphicsItem.NoCache) - # self.plot_settings = [] - # self.plot_settings.append(PlotSettings()) - # self.linked_map_uuid = '' - # self.linked_map = None - # self.filter_by_map = False - # self.filter_by_atlas = False + def draw(self, context): + pass + # if not self.html_loaded: + # self.load_content() - # self.web_page = LoggingWebPage(self) - # self.web_page.setNetworkAccessManager(QgsNetworkAccessManager.instance()) + # 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 + # while not self.html_loaded: + # QCoreApplication.processEvents() - # # This makes the background transparent. (copied from QgsLayoutItemLabel) - # palette = self.web_page.palette() - # palette.setBrush(QPalette.Base, Qt.transparent) - # self.web_page.setPalette(palette) - # self.web_page.mainFrame().setZoomFactor(10.0) - # self.web_page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) - # self.web_page.mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) + # # almost a direct copy from QgsLayoutItemLabel! + # painter = context.renderContext().painter() + # painter.save() - # self.web_page.loadFinished.connect(self.loading_html_finished) - # self.html_loaded = False - # self.html_units_to_layout_units = self.calculate_html_units_to_layout_units() - - # self.sizePositionChanged.connect(self.refresh) + # # painter is scaled to dots, so scale back to layout units + # painter.scale(context.renderContext().scaleFactor() / self.html_units_to_layout_units, + # context.renderContext().scaleFactor() / self.html_units_to_layout_units) + # self.web_page.mainFrame().render(painter) + # painter.restore() def type(self): return ITEM_TYPE @@ -47,7 +43,7 @@ class PlotLayoutItem(QgsLayoutItem): class PlotLayoutItemMetadata(QgsLayoutItemAbstractMetadata): def __init__(self): - super().__init__(ITEM_TYPE, 'test') + super().__init__(ITEM_TYPE, 'layoutItem') def createItem(self, layout): return PlotLayoutItem(layout) \ No newline at end of file