forked from lucadelu/QuickMultiAttributeEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickmultiattributeedit_menu.py
46 lines (36 loc) · 1.87 KB
/
quickmultiattributeedit_menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# --------------------------------------------------------
# QuickMultiAttributeEdit_menu - QGIS plugins menu class
#
# begin : May 9, 2011
# copyright : (c) 2011 by Marco Braida
# email : marcobra.ubuntu at gmail.com
#
# QuickMultiAttributeEdit is free software and is offered
# without guarantee or warranty. You can redistribute it
# and/or modify it under the terms of version 2 of the
# GNU General Public License (GPL v2) as published by the
# Free Software Foundation (www.gnu.org).
# --------------------------------------------------------
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from quickmultiattributeedit_dialogs import *
# ---------------------------------------------
class quickmultiattributeedit_menu:
def __init__(self, iface):
self.iface = iface
def initGui(self):
icon = QIcon(os.path.dirname(__file__) + "/icons/quickmultiattributeedit_update_selected.png")
self.update_selected_action = QAction(icon, "Update field of selected features", self.iface.mainWindow())
QObject.connect(self.update_selected_action, SIGNAL("triggered()"), self.update_selected)
self.iface.registerMainWindowAction(self.update_selected_action, "F12") # self.update_selected_action is triggered by the F12
self.iface.addToolBarIcon(self.update_selected_action)
self.iface.addPluginToMenu("&QuickMultiAttributeEdit", self.update_selected_action)
#self.iface.layerMenu().findChild(QMenu, 'menuNew').addAction(self.action)
def unload(self):
self.iface.unregisterMainWindowAction(self.update_selected_action)
self.iface.removeToolBarIcon(self.update_selected_action)
self.iface.removePluginMenu("&QuickMultiAttributeEdit", self.update_selected_action)
def update_selected(self):
dialog = quickmultiattributeedit_update_selected_dialog(self.iface)
dialog.exec_()