Preferences/ConfigurationPages/HelpInterfacePage.py

Sat, 14 Dec 2013 23:44:25 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sat, 14 Dec 2013 23:44:25 +0100
branch
Py2 comp.
changeset 3145
a9de05d4a22f
parent 3058
0a02c433f52d
child 3484
645c12de6b0c
permissions
-rw-r--r--

# __IGNORE_WARNING__ added/ removed.

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
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
9 from PyQt4.QtCore import 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
10 from PyQt4.QtGui import QStyleFactory
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
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
20
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
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
22 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
23 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
24 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
25 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
26 """
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 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
28 """
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 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
30 """
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
31 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
32 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
33 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
34
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 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
36
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
37 # 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
38 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
39 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
40
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 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
42 """
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 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
44 """
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 # 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
46 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
47 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
48 Preferences.setUI("Style", style)
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
49 Preferences.setUI(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
50 "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
51 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
52
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
53 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
54 """
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 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
56 """
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 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
58 styles = sorted(list(QStyleFactory.keys()))
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 self.styleComboBox.addItem(self.trUtf8('System'), "System")
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 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
61 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
62 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
63 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
64 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
65 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
66
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 @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
68 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
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 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
71 """
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 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
73 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
74 self.trUtf8("Select style sheet 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
75 self.styleSheetEdit.text(),
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
76 self.trUtf8(
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
77 "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
78 "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
79
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
80 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
81 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
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
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 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
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 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
87
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 @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
89 @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
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 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
92 return page

eric ide

mercurial