1 | import functools |
---|
2 | from PyQt4 import QtGui |
---|
3 | |
---|
4 | import sas.sasview |
---|
5 | import LocalConfig |
---|
6 | import GuiUtils |
---|
7 | |
---|
8 | from UI.AboutUI import Ui_AboutUI |
---|
9 | |
---|
10 | class AboutBox(QtGui.QDialog, Ui_AboutUI): |
---|
11 | def __init__(self, parent=None): |
---|
12 | super(AboutBox, self).__init__(parent) |
---|
13 | self.setupUi(self) |
---|
14 | |
---|
15 | self.setWindowTitle("About") |
---|
16 | |
---|
17 | self.addText() |
---|
18 | |
---|
19 | self.addActions() |
---|
20 | |
---|
21 | def addText(self): |
---|
22 | """ |
---|
23 | Modify the labels so the text corresponds to the current version |
---|
24 | """ |
---|
25 | version = sas.sasview.__version__ |
---|
26 | |
---|
27 | self.lblVersion.setText(str(version)) |
---|
28 | lbl_font = self.font() |
---|
29 | lbl_font.setPointSize(24) |
---|
30 | self.lblVersion.setFont(lbl_font) |
---|
31 | about_text = r'<html><head/><body><p>' |
---|
32 | about_text += '<p>Build ' + str(LocalConfig.__build__) +'</p>' |
---|
33 | about_text += '<p>' + LocalConfig._copyright + '</p>' |
---|
34 | about_text += r'<p><a href=http://www.sasview.org>http://www.sasview.org</a></p><br/>' |
---|
35 | about_text += '<p>Comments? Bugs? Requests?<br/>' |
---|
36 | about_text += r'<a href=mailto:help@sasview.org>Send us a ticket</a></p><br/>' |
---|
37 | about_text += r'<a href=' + str(LocalConfig.__download_page__)\ |
---|
38 | + 'Get the latest version</a></p><br/>' |
---|
39 | self.lblAbout.setText(about_text) |
---|
40 | |
---|
41 | # Enable link clicking on the label |
---|
42 | self.lblAbout.setOpenExternalLinks(True) |
---|
43 | |
---|
44 | def addActions(self): |
---|
45 | """ |
---|
46 | Add actions to the logo push buttons |
---|
47 | """ |
---|
48 | self.cmdLinkUT.clicked.connect(functools.partial( |
---|
49 | GuiUtils.openLink, LocalConfig._inst_url)) |
---|
50 | self.cmdLinkUMD.clicked.connect(functools.partial( |
---|
51 | GuiUtils.openLink, LocalConfig._umd_url)) |
---|
52 | self.cmdLinkNIST.clicked.connect(functools.partial( |
---|
53 | GuiUtils.openLink, LocalConfig._nist_url)) |
---|
54 | self.cmdLinkSNS.clicked.connect(functools.partial( |
---|
55 | GuiUtils.openLink, LocalConfig._sns_url)) |
---|
56 | self.cmdLinkISIS.clicked.connect(functools.partial( |
---|
57 | GuiUtils.openLink, LocalConfig._isis_url)) |
---|
58 | self.cmdLinkESS.clicked.connect(functools.partial( |
---|
59 | GuiUtils.openLink, LocalConfig._ess_url)) |
---|
60 | self.cmdLinkILL.clicked.connect(functools.partial( |
---|
61 | GuiUtils.openLink, LocalConfig._ill_url)) |
---|
62 | self.cmdLinkANSTO.clicked.connect(functools.partial( |
---|
63 | GuiUtils.openLink, LocalConfig._ansto_url)) |
---|
64 | |
---|
65 | self.cmdOK.clicked.connect(self.close) |
---|