|
6 | 6 | from qgis.core import QgsApplication
|
7 | 7 | from qgis.PyQt.QtCore import QCoreApplication, Qt, QTranslator
|
8 | 8 | from qgis.PyQt.QtGui import QIcon
|
9 |
| -from qgis.PyQt.QtWidgets import QAction, QWidget |
| 9 | +from qgis.PyQt.QtWidgets import QAction, QMenu, QToolButton, QWidget |
10 | 10 |
|
11 | 11 | from arho_feature_template.core.geotiff_creator import GeoTiffCreator
|
12 | 12 | from arho_feature_template.core.plan_manager import PlanManager
|
@@ -175,16 +175,35 @@ def initGui(self) -> None: # noqa N802
|
175 | 175 | status_tip="Lataa/avaa kaava",
|
176 | 176 | )
|
177 | 177 |
|
| 178 | + self.edit_plan_tool_button = QToolButton() |
| 179 | + self.edit_plan_tool_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) |
| 180 | + self.edit_plan_tool_button.setMenu(QMenu()) |
| 181 | + self.edit_plan_tool_button.setPopupMode(QToolButton.MenuButtonPopup) |
| 182 | + self.edit_plan_tool_action = self.toolbar.addWidget(self.edit_plan_tool_button) |
| 183 | + |
178 | 184 | self.edit_land_use_plan_action = self.add_action(
|
179 | 185 | text="Muokkaa kaavaa",
|
180 | 186 | # icon=QgsApplication.getThemeIcon("mActionFileOpen.svg"),
|
181 | 187 | icon=QIcon(resources_path("icons", "toolbar", "muokkaa_kaavaa2.svg")),
|
182 | 188 | triggered_callback=self.plan_manager.edit_plan,
|
183 | 189 | parent=iface.mainWindow(),
|
184 | 190 | add_to_menu=True,
|
185 |
| - add_to_toolbar=True, |
| 191 | + add_to_toolbar=False, |
186 | 192 | status_tip="Muokkaa aktiivisen kaavan tietoja",
|
187 | 193 | )
|
| 194 | + self.edit_plan_tool_button.menu().addAction(self.edit_land_use_plan_action) |
| 195 | + self.edit_plan_tool_button.setDefaultAction(self.edit_land_use_plan_action) |
| 196 | + |
| 197 | + self.edit_lifecycles_action = self.add_action( |
| 198 | + text="Muokkaa kaavan elinkaarien päivämääriä", |
| 199 | + icon=QgsApplication.getThemeIcon("mIconFieldDate.svg"), |
| 200 | + # icon=QIcon(resources_path("icons", "toolbar", "tallenna_jsonina2.svg")), |
| 201 | + triggered_callback=self.edit_lifecycles, |
| 202 | + add_to_menu=True, |
| 203 | + add_to_toolbar=False, |
| 204 | + status_tip="Muokkaa kaavan elinkaarien päivämääriä", |
| 205 | + ) |
| 206 | + self.edit_plan_tool_button.menu().addAction(self.edit_lifecycles_action) |
188 | 207 |
|
189 | 208 | self.new_feature_dock_action = self.add_action(
|
190 | 209 | text="Luo kaavakohde",
|
@@ -221,16 +240,6 @@ def initGui(self) -> None: # noqa N802
|
221 | 240 | add_to_toolbar=True,
|
222 | 241 | )
|
223 | 242 |
|
224 |
| - self.edit_lifecycles_action = self.add_action( |
225 |
| - text="Kaavan elinkaaret", |
226 |
| - icon=QgsApplication.getThemeIcon("mIconFieldDate.svg"), |
227 |
| - # icon=QIcon(resources_path("icons", "toolbar", "tallenna_jsonina2.svg")), |
228 |
| - triggered_callback=self.edit_lifecycles, |
229 |
| - add_to_menu=True, |
230 |
| - add_to_toolbar=True, |
231 |
| - status_tip="Muokkaa kaavan elinkaaria", |
232 |
| - ) |
233 |
| - |
234 | 243 | self.serialize_plan_action = self.add_action(
|
235 | 244 | text="Tallenna kaava JSON",
|
236 | 245 | # icon=QgsApplication.getThemeIcon("mActionFileSaveAs.svg"),
|
|
0 commit comments