src/eric7/Preferences/ConfigurationPages/PythonPage.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 18
19 class PythonPage(ConfigurationPageBase, Ui_PythonPage): 19 class PythonPage(ConfigurationPageBase, Ui_PythonPage):
20 """ 20 """
21 Class implementing the Python configuration page. 21 Class implementing the Python configuration page.
22 """ 22 """
23
23 def __init__(self): 24 def __init__(self):
24 """ 25 """
25 Constructor 26 Constructor
26 """ 27 """
27 super().__init__() 28 super().__init__()
28 self.setupUi(self) 29 self.setupUi(self)
29 self.setObjectName("PythonPage") 30 self.setObjectName("PythonPage")
30 31
31 self.stringEncodingComboBox.addItems(sorted(supportedCodecs)) 32 self.stringEncodingComboBox.addItems(sorted(supportedCodecs))
32 self.ioEncodingComboBox.addItems(sorted(supportedCodecs)) 33 self.ioEncodingComboBox.addItems(sorted(supportedCodecs))
33 34
34 # set initial values 35 # set initial values
35 index = self.stringEncodingComboBox.findText( 36 index = self.stringEncodingComboBox.findText(
36 Preferences.getSystem("StringEncoding")) 37 Preferences.getSystem("StringEncoding")
38 )
37 self.stringEncodingComboBox.setCurrentIndex(index) 39 self.stringEncodingComboBox.setCurrentIndex(index)
38 index = self.ioEncodingComboBox.findText( 40 index = self.ioEncodingComboBox.findText(Preferences.getSystem("IOEncoding"))
39 Preferences.getSystem("IOEncoding"))
40 self.ioEncodingComboBox.setCurrentIndex(index) 41 self.ioEncodingComboBox.setCurrentIndex(index)
41 42
42 self.showCodeInfoDetailsCeckBox.setChecked( 43 self.showCodeInfoDetailsCeckBox.setChecked(
43 Preferences.getPython("DisViewerExpandCodeInfoDetails")) 44 Preferences.getPython("DisViewerExpandCodeInfoDetails")
44 45 )
46
45 # these are the same as in the debugger pages 47 # these are the same as in the debugger pages
46 self.py3ExtensionsEdit.setText( 48 self.py3ExtensionsEdit.setText(Preferences.getDebugger("Python3Extensions"))
47 Preferences.getDebugger("Python3Extensions")) 49
48 50 self.py3EnvironmentEdit.setText(Preferences.getDebugger("Python3VirtualEnv"))
49 self.py3EnvironmentEdit.setText( 51
50 Preferences.getDebugger("Python3VirtualEnv"))
51
52 # colours 52 # colours
53 self.initColour("ASTViewerErrorColor", 53 self.initColour(
54 self.astErrorItemButton, 54 "ASTViewerErrorColor", self.astErrorItemButton, Preferences.getPython
55 Preferences.getPython) 55 )
56 self.initColour("DisViewerErrorColor", 56 self.initColour(
57 self.disErrorItemButton, 57 "DisViewerErrorColor", self.disErrorItemButton, Preferences.getPython
58 Preferences.getPython) 58 )
59 self.initColour("DisViewerCurrentColor", 59 self.initColour(
60 self.disCurrentInstructionButton, 60 "DisViewerCurrentColor",
61 Preferences.getPython) 61 self.disCurrentInstructionButton,
62 self.initColour("DisViewerLabeledColor", 62 Preferences.getPython,
63 self.disLabeledInstructionButton, 63 )
64 Preferences.getPython) 64 self.initColour(
65 65 "DisViewerLabeledColor",
66 self.disLabeledInstructionButton,
67 Preferences.getPython,
68 )
69
66 def save(self): 70 def save(self):
67 """ 71 """
68 Public slot to save the Python configuration. 72 Public slot to save the Python configuration.
69 """ 73 """
70 enc = self.stringEncodingComboBox.currentText() 74 enc = self.stringEncodingComboBox.currentText()
71 if not enc: 75 if not enc:
72 enc = "utf-8" 76 enc = "utf-8"
73 Preferences.setSystem("StringEncoding", enc) 77 Preferences.setSystem("StringEncoding", enc)
74 78
75 enc = self.ioEncodingComboBox.currentText() 79 enc = self.ioEncodingComboBox.currentText()
76 if not enc: 80 if not enc:
77 enc = "utf-8" 81 enc = "utf-8"
78 Preferences.setSystem("IOEncoding", enc) 82 Preferences.setSystem("IOEncoding", enc)
79 83
80 Preferences.setDebugger( 84 Preferences.setDebugger("Python3Extensions", self.py3ExtensionsEdit.text())
81 "Python3Extensions", 85
82 self.py3ExtensionsEdit.text())
83
84 Preferences.setPython( 86 Preferences.setPython(
85 "DisViewerExpandCodeInfoDetails", 87 "DisViewerExpandCodeInfoDetails",
86 self.showCodeInfoDetailsCeckBox.isChecked()) 88 self.showCodeInfoDetailsCeckBox.isChecked(),
87 89 )
90
88 # colours 91 # colours
89 self.saveColours(Preferences.setPython) 92 self.saveColours(Preferences.setPython)
90 93
91 @pyqtSlot() 94 @pyqtSlot()
92 def on_refreshButton_clicked(self): 95 def on_refreshButton_clicked(self):
93 """ 96 """
94 Private slot handling a click of the refresh button. 97 Private slot handling a click of the refresh button.
95 """ 98 """
96 self.py3EnvironmentEdit.setText( 99 self.py3EnvironmentEdit.setText(Preferences.getDebugger("Python3VirtualEnv"))
97 Preferences.getDebugger("Python3VirtualEnv")) 100
98
99 101
100 def create(dlg): 102 def create(dlg):
101 """ 103 """
102 Module function to create the configuration page. 104 Module function to create the configuration page.
103 105
104 @param dlg reference to the configuration dialog 106 @param dlg reference to the configuration dialog
105 @return reference to the instantiated page (ConfigurationPageBase) 107 @return reference to the instantiated page (ConfigurationPageBase)
106 """ 108 """
107 page = PythonPage() 109 page = PythonPage()
108 return page 110 return page

eric ide

mercurial