-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
55 lines (45 loc) · 2.1 KB
/
Copy path__init__.py
File metadata and controls
55 lines (45 loc) · 2.1 KB
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
47
48
49
50
51
52
53
54
55
from qgis.PyQt.QtCore import QCoreApplication
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QAction
import os.path
from .LLMFileDescribe import LLMFileDescribeDialog
class LLMFileDescribe:
"""QGIS Plugin Implementation."""
def __init__(self, iface):
"""
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface
"""
self.iface = iface
self.plugin_dir = os.path.dirname(__file__)
self.action = None
def tr(self, message):
"""Get the translation for a string using Qt translation API."""
return QCoreApplication.translate('LLMFileDescribe', message)
def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS GUI."""
# Always load the icon from the plugin directory. We do not use
# the Qt resource system here, so avoid `:/plugins/...` paths.
icon_path = os.path.join(self.plugin_dir, 'icon.png')
self.action = QAction(QIcon(icon_path), self.tr('LLM File Describe'), self.iface.mainWindow())
self.action.setStatusTip(self.tr('Interroger un fichier via LLM'))
self.action.triggered.connect(self.run)
self.iface.addPluginToMenu(self.tr('&LLMFileDescribe'), self.action)
self.iface.addToolBarIcon(self.action)
def unload(self):
"""Removes the plugin menu item and icon from QGIS GUI."""
if self.action:
self.iface.removePluginMenu(self.tr('&LLMFileDescribe'), self.action)
self.iface.removeToolBarIcon(self.action)
self.action = None
def run(self):
"""Run method that performs all the real work."""
dialog = LLMFileDescribeDialog(self.iface.mainWindow())
dialog.exec_()
# QGIS calls classFactory to instantiate the plugin. This function must
# exist at the package root. It receives the QGIS interface and returns
# an instance of our plugin class.
def classFactory(iface):
return LLMFileDescribe(iface)