This repository has been archived by the owner on Jun 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
qdeeplandia.py
60 lines (52 loc) · 2.45 KB
/
qdeeplandia.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Oslandia <[email protected]>
#
# This file is a piece of free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
#
import os
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QAction
class QDeeplandiaPlugin:
def __init__(self, iface):
self.iface = iface
def initGui(self):
# Select a trained model on the file system
load_model_msg = "Load a trained model"
load_icon = QIcon(os.path.join(os.path.dirname(__file__), "img/load.svg"))
self.model_loading = QAction(load_icon, load_model_msg, self.iface.mainWindow())
self.model_loading.triggered.connect(self.load_trained_model)
self.iface.addPluginToMenu("QDeeplandia", self.model_loading)
self.model_loading.triggered.connect(lambda: self.load_trained_model())
self.iface.addToolBarIcon(self.model_loading)
# Run-an-inference process
run_inference_msg = "Run an inference"
run_icon = QIcon(os.path.join(os.path.dirname(__file__), "img/run.svg"))
self.inference = QAction(run_icon, run_inference_msg, self.iface.mainWindow())
self.inference.triggered.connect(self.infer)
self.iface.addPluginToMenu("QDeeplandia", self.inference)
self.inference.triggered.connect(lambda: self.infer())
self.iface.addToolBarIcon(self.inference)
def unload(self):
# Select a trained model on the file system
self.iface.removePluginMenu("QDeeplandia", self.model_loading)
self.iface.removeToolBarIcon(self.model_loading)
self.model_loading.setParent(None)
# Run-an-inference process
self.iface.removePluginMenu("QDeeplandia", self.inference)
self.iface.removeToolBarIcon(self.inference)
self.inference.setParent(None)
def load_trained_model(self):
pass
def infer(self):
pass