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