source: sasview/src/sas/qtgui/MainWindow/AboutBox.py @ d32a594

Last change on this file since d32a594 was 33c0561, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 6 years ago

Replace Apply button menu driven functionality with additional button.
Removed Cancel.
Removed the window system context help button from all affected widgets.
SASVIEW-1239

  • Property mode set to 100644
File size: 3.0 KB
Line 
1import functools
2from PyQt5 import QtWidgets, QtCore
3
4import sas.sasview
5import sas.qtgui.Utilities.LocalConfig as LocalConfig
6import sas.qtgui.Utilities.GuiUtils as GuiUtils
7from sas.qtgui.UI import images_rc
8from sas.qtgui.UI import main_resources_rc
9
10from .UI.AboutUI import Ui_AboutUI
11
12class AboutBox(QtWidgets.QDialog, Ui_AboutUI):
13    def __init__(self, parent=None):
14        super(AboutBox, self).__init__(parent)
15        self.setupUi(self)
16        # disable the context help icon
17        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
18
19        self.setWindowTitle("About")
20
21        self.addText()
22
23        self.addActions()
24
25    def addText(self):
26        """
27        Modify the labels so the text corresponds to the current version
28        """
29        version = sas.sasview.__version__
30
31        self.lblVersion.setText(str(version))
32        lbl_font = self.font()
33        lbl_font.setPointSize(24)
34        self.lblVersion.setFont(lbl_font)
35        about_text = r'<html><head/><body><p>'
36        about_text += '<p>Build ' + str(LocalConfig.__build__) +'</p>'
37        about_text += '<p>' + LocalConfig._copyright + '</p>'
38        about_text += r'<p><a href=http://www.sasview.org>http://www.sasview.org</a></p><br/>'
39        about_text += '<p>Comments? Bugs? Requests?<br/>'
40        about_text += r'<a href=mailto:help@sasview.org>Send us a ticket</a></p><br/>'
41        about_text += r'<a href=' + str(LocalConfig.__download_page__)\
42                   + 'Get the latest version</a></p><br/>'
43        self.lblAbout.setText(about_text)
44
45        # Enable link clicking on the label
46        self.lblAbout.setOpenExternalLinks(True)
47
48    def addActions(self):
49        """
50        Add actions to the logo push buttons
51        """
52        self.cmdLinkUT.clicked.connect(functools.partial(
53            GuiUtils.openLink, LocalConfig._inst_url))
54        self.cmdLinkUMD.clicked.connect(functools.partial(
55            GuiUtils.openLink, LocalConfig._umd_url))
56        self.cmdLinkNIST.clicked.connect(functools.partial(
57            GuiUtils.openLink, LocalConfig._nist_url))
58        self.cmdLinkSNS.clicked.connect(functools.partial(
59            GuiUtils.openLink, LocalConfig._sns_url))
60        self.cmdLinkISIS.clicked.connect(functools.partial(
61            GuiUtils.openLink, LocalConfig._isis_url))
62        self.cmdLinkESS.clicked.connect(functools.partial(
63            GuiUtils.openLink, LocalConfig._ess_url))
64        self.cmdLinkILL.clicked.connect(functools.partial(
65            GuiUtils.openLink, LocalConfig._ill_url))
66        self.cmdLinkANSTO.clicked.connect(functools.partial(
67            GuiUtils.openLink, LocalConfig._ansto_url))
68        self.cmdLinkBAM.clicked.connect(functools.partial(
69            GuiUtils.openLink, LocalConfig._bam_url))
70        self.cmdLinkDELFT.clicked.connect(functools.partial(
71            GuiUtils.openLink, LocalConfig._delft_url))
72        self.cmdLinkDIAMOND.clicked.connect(functools.partial(
73            GuiUtils.openLink, LocalConfig._diamond_url))
74
75        self.cmdOK.clicked.connect(self.close)
Note: See TracBrowser for help on using the repository browser.