[f82ab8c] | 1 | import functools |
---|
[f51ed67] | 2 | from PyQt4 import QtGui |
---|
[f82ab8c] | 3 | |
---|
| 4 | import sas.sasview |
---|
| 5 | import LocalConfig |
---|
| 6 | import GuiUtils |
---|
| 7 | |
---|
[f51ed67] | 8 | from UI.AboutUI import Ui_AboutUI |
---|
[f82ab8c] | 9 | |
---|
[f51ed67] | 10 | class AboutBox(QtGui.QDialog, Ui_AboutUI): |
---|
[f82ab8c] | 11 | def __init__(self, parent=None): |
---|
| 12 | super(AboutBox, self).__init__(parent) |
---|
[f51ed67] | 13 | self.setupUi(self) |
---|
| 14 | |
---|
[f82ab8c] | 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/>' |
---|
[481ff26] | 37 | about_text += r'<a href=' + str(LocalConfig.__download_page__)\ |
---|
| 38 | + 'Get the latest version</a></p><br/>' |
---|
[f82ab8c] | 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 | """ |
---|
[481ff26] | 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)) |
---|
[e207c3f] | 62 | self.cmdLinkANSTO.clicked.connect(functools.partial( |
---|
| 63 | GuiUtils.openLink, LocalConfig._ansto_url)) |
---|
[f82ab8c] | 64 | |
---|
| 65 | self.cmdOK.clicked.connect(self.close) |
---|