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