-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathabout_dlg.py
76 lines (59 loc) · 2.41 KB
/
about_dlg.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
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : GEM Modellers Toolkit plugin (GEM-MT)
Description : Analysing and Processing Earthquake Catalogue Data
Date : Jun 18, 2012
copyright : (C) 2012 by Giuseppe Sucameli (Faunalia)
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ui.DlgAbout_ui import Ui_DlgAbout
import platform
import re
import ConfigParser
import os
try:
import resources
except ImportError:
import resources_rc
class AboutDlg(QDialog, Ui_DlgAbout):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.setupUi(self)
# read parameters from metadata.txt
config = ConfigParser.ConfigParser()
config.read( os.path.join( os.path.dirname(__file__), 'metadata.txt' ) )
name = config.get("general", "name")
description = config.get("general", "description")
version = config.get("general", "version")
self.logo.setPixmap( QPixmap( ":/faunalia/logo" ) )
self.title.setText( name )
self.description.setText( description )
text = self.txt.toHtml()
text = re.sub("\$PLUGIN_NAME\$", name, text)
subject = "Help: %s" % name
body = """\n\n
--------
Plugin name: %s
Plugin version: %s
Python version: %s
Platform: %s - %s
--------
""" % ( name, version, platform.python_version(), platform.system(), platform.version() )
mail = QUrl( "mailto:[email protected]" )
mail.addQueryItem( "subject", subject )
mail.addQueryItem( "body", body )
text = re.sub("$MAIL_SUBJECT$", unicode(mail.encodedQueryItemValue( "subject" )), text)
text = re.sub("$MAIL_BODY$", unicode(mail.encodedQueryItemValue( "body" )), text)
self.txt.setHtml(text)