Preferences/ConfigurationPages/HelpInterfacePage.py

Sun, 29 Jun 2014 20:13:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Jun 2014 20:13:56 +0200
changeset 3656
441956d8fce5
parent 3484
645c12de6b0c
child 4541
e8ddd9d76414
permissions
-rw-r--r--

Started porting eric5 to PyQt5.

2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 Module implementing the Interface configuration page (variant for web browser).
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3058
diff changeset
7 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2100
diff changeset
8
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
9 from PyQt5.QtCore import pyqtSlot
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
10 from PyQt5.QtWidgets import QStyleFactory
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from E5Gui.E5Completers import E5FileCompleter
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from E5Gui import E5FileDialog
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from .ConfigurationPageBase import ConfigurationPageBase
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from .Ui_HelpInterfacePage import Ui_HelpInterfacePage
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import Preferences
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import Utilities
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3025
diff changeset
20 import UI.PixmapCache
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
22
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 class HelpInterfacePage(ConfigurationPageBase, Ui_HelpInterfacePage):
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
25 Class implementing the Interface configuration page (variant for web
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
26 browser).
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 def __init__(self):
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Constructor
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2100
diff changeset
32 super(HelpInterfacePage, self).__init__()
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.setObjectName("InterfacePage")
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3025
diff changeset
36 self.styleSheetButton.setIcon(UI.PixmapCache.getIcon("open.png"))
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3025
diff changeset
37
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.styleSheetCompleter = E5FileCompleter(self.styleSheetEdit)
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 # set initial values
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.__populateStyleCombo()
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.styleSheetEdit.setText(Preferences.getUI("StyleSheet"))
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 def save(self):
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 Public slot to save the Interface configuration.
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 # save the style settings
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 styleIndex = self.styleComboBox.currentIndex()
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 style = self.styleComboBox.itemData(styleIndex)
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 Preferences.setUI("Style", style)
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
52 Preferences.setUI(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
53 "StyleSheet",
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.styleSheetEdit.text())
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def __populateStyleCombo(self):
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Private method to populate the style combo box.
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 curStyle = Preferences.getUI("Style")
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 styles = sorted(list(QStyleFactory.keys()))
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
62 self.styleComboBox.addItem(self.tr('System'), "System")
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 for style in styles:
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.styleComboBox.addItem(style, style)
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 currentIndex = self.styleComboBox.findData(curStyle)
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 if currentIndex == -1:
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 currentIndex = 0
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.styleComboBox.setCurrentIndex(currentIndex)
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 @pyqtSlot()
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 def on_styleSheetButton_clicked(self):
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 Private method to select the style sheet file via a dialog.
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 file = E5FileDialog.getOpenFileName(
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
77 self.tr("Select style sheet file"),
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.styleSheetEdit.text(),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
79 self.tr(
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
80 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
81 "All files (*)"))
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 if file:
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.styleSheetEdit.setText(Utilities.toNativeSeparators(file))
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 def create(dlg):
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 Module function to create the configuration page.
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 @param dlg reference to the configuration dialog
2964
84b65fb9e780 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2100
diff changeset
92 @return reference to the instantiated page (ConfigurationPageBase)
2100
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 page = HelpInterfacePage()
fb16f4650860 Added a style sheet file to disable single click activation and an interface configuration page for the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 return page

eric ide

mercurial