forked from danzig666/qconsolidate3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aboutdialog.py
107 lines (92 loc) · 3.97 KB
/
aboutdialog.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2017-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.
# This plugin was forked from https://github.com/alexbruy/qconsolidate
# by Alexander Bruy ([email protected]),
# starting from commit 6f27b0b14b925a25c75ea79aea62a0e3d51e30e3.
import os
import configparser
from qgis.PyQt.QtCore import (
QUrl,
)
from qgis.PyQt.QtGui import (
QDesktopServices,
QPixmap,
QTextDocument,
)
from qgis.PyQt.QtWidgets import (
QDialog,
QDialogButtonBox,
QLabel,
QTextBrowser,
QHBoxLayout,
QVBoxLayout,
)
class AboutDialog(QDialog):
def __init__(self):
QDialog.__init__(self)
self.initGui()
self.btnHelp = self.buttonBox.button(QDialogButtonBox.Help)
self.lblLogo.setPixmap(QPixmap(":/icons/qconsolidate.png"))
cfg = configparser.SafeConfigParser()
cfg.read(os.path.join(os.path.dirname(__file__), "metadata.txt"))
version = cfg.get("general", "version")
self.lblVersion.setText(self.tr("Version: %s") % (version))
doc = QTextDocument()
doc.setHtml(self.getAboutText())
self.textBrowser.setDocument(doc)
self.textBrowser.setOpenExternalLinks(True)
self.buttonBox.helpRequested.connect(self.openHelp)
self.btnClose = self.buttonBox.button(QDialogButtonBox.Close)
self.btnClose.clicked.connect(self.reject)
def initGui(self):
self.setWindowTitle('QConsolidate3')
self.buttonBox = QDialogButtonBox(
QDialogButtonBox.Close | QDialogButtonBox.Help)
self.label = QLabel("QConsolidate3")
self.label.setStyleSheet("font-weight: bold")
self.lblLogo = QLabel()
self.lblVersion = QLabel()
self.textBrowser = QTextBrowser()
self.h_layout = QHBoxLayout()
self.h_layout.addWidget(self.lblLogo)
self.h_layout.addWidget(self.label)
self.v_layout = QVBoxLayout()
self.v_layout.addLayout(self.h_layout)
self.v_layout.addWidget(self.lblVersion)
self.v_layout.addWidget(self.textBrowser)
self.v_layout.addWidget(self.buttonBox)
self.setLayout(self.v_layout)
def openHelp(self):
QDesktopServices.openUrl(QUrl(
"https://github.com/danzig666/qconsolidate3"))
def getAboutText(self):
return self.tr(
"""
<p>Consolidates all layers from current QGIS project into
one directory (optionally zipping the whole project in a
single file).</p>
<p><strong>Developed by</strong>: Danzig </p>
<p>Fork of the q-consolidate plugin by Alexander Bruy</p>
<p>and the OQ-Consolidate plugin GEM Foundation</p>
<p><strong>Homepage</strong>:
<a href="https://github.com/danzig666/qconsolidate3/">
homepage</a></p>
<p>Please report bugs at
<a href="https://github.com/danzig666/qconsolidate3/issues">
bugtracker</a>.</p>
""")