@@ -47,8 +47,8 @@ def __init__(self) -> None:
47
47
48
48
def add_action (
49
49
self ,
50
- icon_path : str ,
51
50
text : str ,
51
+ icon : QIcon | None = None ,
52
52
triggered_callback : Callable | None = None ,
53
53
* ,
54
54
toggled_callback : Callable | None = None ,
@@ -63,8 +63,7 @@ def add_action(
63
63
) -> QAction :
64
64
"""Add a toolbar icon to the toolbar.
65
65
66
- :param icon_path: Path to the icon for this action. Can be a resource
67
- path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
66
+ :param icon: Icon for this action.
68
67
69
68
:param text: Text that should be shown in menu items for this action.
70
69
@@ -91,8 +90,8 @@ def add_action(
91
90
added to self.actions list.
92
91
:rtype: QAction
93
92
"""
94
-
95
- icon = QIcon (icon_path )
93
+ if not icon :
94
+ icon = QIcon ("" )
96
95
action = QAction (icon , text , parent )
97
96
# noinspection PyUnresolvedReferences
98
97
if triggered_callback :
@@ -138,16 +137,14 @@ def initGui(self) -> None: # noqa N802
138
137
139
138
# Add main plugin action to the toolbar
140
139
self .new_land_use_plan_action = self .add_action (
141
- "" ,
142
- "Luo uusi kaava" ,
143
- self .add_new_plan ,
140
+ text = "Luo uusi kaava" ,
141
+ triggered_callback = self .add_new_plan ,
144
142
add_to_menu = True ,
145
143
add_to_toolbar = True ,
146
144
status_tip = "Luo uusi kaava" ,
147
145
)
148
146
149
147
self .load_land_use_plan_action = self .add_action (
150
- "" ,
151
148
text = "Lataa/avaa kaavaa" ,
152
149
triggered_callback = self .load_existing_land_use_plan ,
153
150
parent = iface .mainWindow (),
@@ -157,25 +154,21 @@ def initGui(self) -> None: # noqa N802
157
154
)
158
155
159
156
self .template_dock_action = self .add_action (
160
- "" ,
161
- "Kaavakohdetemplaatit" ,
162
- None ,
157
+ text = "Kaavakohdetemplaatit" ,
163
158
toggled_callback = self .toggle_template_dock ,
164
159
checkable = True ,
165
160
add_to_menu = True ,
166
161
add_to_toolbar = True ,
167
162
)
168
163
169
164
self .new_plan_regulation_group = self .add_action (
170
- "" ,
171
165
text = "Luo kaavamääräysryhmä" ,
172
166
triggered_callback = self .open_plan_regulation_group_form ,
173
167
add_to_menu = True ,
174
168
add_to_toolbar = True ,
175
169
)
176
170
177
171
self .serialize_plan_action = self .add_action (
178
- "" ,
179
172
text = "Tallenna kaava JSON" ,
180
173
triggered_callback = self .serialize_plan ,
181
174
add_to_menu = True ,
@@ -184,7 +177,6 @@ def initGui(self) -> None: # noqa N802
184
177
)
185
178
186
179
self .plugin_settings_action = self .add_action (
187
- "" ,
188
180
text = "Asetukset" ,
189
181
triggered_callback = self .open_settings ,
190
182
add_to_menu = True ,
0 commit comments