7 Module implementing a dialog to show help about rope. |
7 Module implementing a dialog to show help about rope. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt4.QtGui import QDialog, QDialogButtonBox, QTextDocument, QTextCursor |
12 from PyQt5.QtGui import QTextDocument, QTextCursor |
|
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
13 |
14 |
14 from Ui_HelpDialog import Ui_HelpDialog |
15 from Ui_HelpDialog import Ui_HelpDialog |
15 |
16 |
16 import Globals |
17 import Globals |
17 |
18 |
30 """ |
31 """ |
31 QDialog.__init__(self, parent) |
32 QDialog.__init__(self, parent) |
32 self.setupUi(self) |
33 self.setupUi(self) |
33 |
34 |
34 self.searchButton = self.buttonBox.addButton( |
35 self.searchButton = self.buttonBox.addButton( |
35 self.trUtf8("Search..."), QDialogButtonBox.ActionRole) |
36 self.tr("Search..."), QDialogButtonBox.ActionRole) |
36 self.__searchDlg = None |
37 self.__searchDlg = None |
37 |
38 |
38 if Globals.isWindowsPlatform(): |
39 if Globals.isWindowsPlatform(): |
39 self.helpEdit.setFontFamily("Lucida Console") |
40 self.helpEdit.setFontFamily("Lucida Console") |
40 else: |
41 else: |
45 txt = f.read() |
46 txt = f.read() |
46 f.close() |
47 f.close() |
47 self.helpEdit.setPlainText(txt) |
48 self.helpEdit.setPlainText(txt) |
48 except IOError as err: |
49 except IOError as err: |
49 self.helpEdit.setPlainText( |
50 self.helpEdit.setPlainText( |
50 self.trUtf8("Could not read file {0}.\nReason: {1}") |
51 self.tr("Could not read file {0}.\nReason: {1}") |
51 .format(helpfile, str(err))) |
52 .format(helpfile, str(err))) |
52 |
53 |
53 def on_buttonBox_clicked(self, button): |
54 def on_buttonBox_clicked(self, button): |
54 """ |
55 """ |
55 Private slot called by a button of the button box clicked. |
56 Private slot called by a button of the button box clicked. |