69 |
70 |
70 self.py3ShellCombo.addItem(self.tr("Plain Python"), "python") |
71 self.py3ShellCombo.addItem(self.tr("Plain Python"), "python") |
71 self.py3ShellCombo.addItem(self.tr("IPython"), "ipython") |
72 self.py3ShellCombo.addItem(self.tr("IPython"), "ipython") |
72 self.py3ShellCombo.addItem(self.tr("bpython"), "bpython") |
73 self.py3ShellCombo.addItem(self.tr("bpython"), "bpython") |
73 |
74 |
|
75 try: |
|
76 venvManager = e5App().getObject("VirtualEnvManager") |
|
77 |
|
78 self.py2VenvNameComboBox.addItems( |
|
79 [""] + sorted(venvManager.getVirtualenvNamesForVariant(2))) |
|
80 self.py3VenvNameComboBox.addItems( |
|
81 [""] + sorted(venvManager.getVirtualenvNamesForVariant(3))) |
|
82 |
|
83 self.pyramidVirtualEnvPy2Group.hide() |
|
84 self.pyramidVirtualEnvPy3Group.hide() |
|
85 |
|
86 self.__hasVirtualEnvironmentManager = True |
|
87 except KeyError: |
|
88 venvManager = None |
|
89 |
|
90 self.pyramidVirtualEnvironmentPy2Group.hide() |
|
91 self.pyramidVirtualEnvironmentPy3Group.hide() |
|
92 |
|
93 self.__hasVirtualEnvironmentManager = False |
|
94 |
74 # set initial values |
95 # set initial values |
75 self.consoleCommandCombo.setEditText( |
96 self.consoleCommandCombo.setEditText( |
76 self.__plugin.getPreferences("ConsoleCommand")) |
97 self.__plugin.getPreferences("ConsoleCommand")) |
77 |
98 |
78 self.externalBrowserCheckBox.setChecked( |
99 self.externalBrowserCheckBox.setChecked( |
79 self.__plugin.getPreferences("UseExternalBrowser")) |
100 self.__plugin.getPreferences("UseExternalBrowser")) |
80 |
101 |
81 self.virtualEnvPy2Edit.setText( |
102 if venvManager: |
82 self.__plugin.getPreferences("VirtualEnvironmentPy2")) |
103 venvName = self.__plugin.getPreferences( |
83 self.virtualEnvPy3Edit.setText( |
104 "VirtualEnvironmentNamePy2") |
84 self.__plugin.getPreferences("VirtualEnvironmentPy3")) |
105 if venvName: |
85 |
106 index = self.py2VenvNameComboBox.findText(venvName) |
|
107 if index < 0: |
|
108 index = 0 |
|
109 self.py2VenvNameComboBox.setCurrentIndex(index) |
|
110 else: |
|
111 self.virtualEnvPy2Edit.setText( |
|
112 self.__plugin.getPreferences("VirtualEnvironmentPy2")) |
86 self.py2ShellCombo.setCurrentIndex(self.py2ShellCombo.findData( |
113 self.py2ShellCombo.setCurrentIndex(self.py2ShellCombo.findData( |
87 self.__plugin.getPreferences("Python2ConsoleType"))) |
114 self.__plugin.getPreferences("Python2ConsoleType"))) |
|
115 |
|
116 if venvManager: |
|
117 venvName = self.__plugin.getPreferences( |
|
118 "VirtualEnvironmentNamePy3") |
|
119 if venvName: |
|
120 index = self.py3VenvNameComboBox.findText(venvName) |
|
121 if index < 0: |
|
122 index = 0 |
|
123 self.py3VenvNameComboBox.setCurrentIndex(index) |
|
124 else: |
|
125 self.virtualEnvPy3Edit.setText( |
|
126 self.__plugin.getPreferences("VirtualEnvironmentPy3")) |
88 self.py3ShellCombo.setCurrentIndex(self.py3ShellCombo.findData( |
127 self.py3ShellCombo.setCurrentIndex(self.py3ShellCombo.findData( |
89 self.__plugin.getPreferences("Python3ConsoleType"))) |
128 self.__plugin.getPreferences("Python3ConsoleType"))) |
90 |
129 |
91 self.urlEdit.setText( |
130 self.urlEdit.setText( |
92 self.__plugin.getPreferences("PyramidDocUrl")) |
131 self.__plugin.getPreferences("PyramidDocUrl")) |
102 "ConsoleCommand", self.consoleCommandCombo.currentText()) |
141 "ConsoleCommand", self.consoleCommandCombo.currentText()) |
103 |
142 |
104 self.__plugin.setPreferences( |
143 self.__plugin.setPreferences( |
105 "UseExternalBrowser", self.externalBrowserCheckBox.isChecked()) |
144 "UseExternalBrowser", self.externalBrowserCheckBox.isChecked()) |
106 |
145 |
107 self.__plugin.setPreferences( |
146 if self.__hasVirtualEnvironmentManager: |
108 "VirtualEnvironmentPy2", self.virtualEnvPy2Edit.text()) |
147 self.__plugin.setPreferences( |
109 self.__plugin.setPreferences( |
148 "VirtualEnvironmentNamePy2", |
110 "VirtualEnvironmentPy3", self.virtualEnvPy3Edit.text()) |
149 self.py2VenvNameComboBox.currentText()) |
111 |
150 else: |
|
151 self.__plugin.setPreferences( |
|
152 "VirtualEnvironmentPy2", self.virtualEnvPy2Edit.text()) |
112 self.__plugin.setPreferences( |
153 self.__plugin.setPreferences( |
113 "Python2ConsoleType", |
154 "Python2ConsoleType", |
114 self.py2ShellCombo.itemData(self.py2ShellCombo.currentIndex())) |
155 self.py2ShellCombo.itemData(self.py2ShellCombo.currentIndex())) |
|
156 |
|
157 if self.__hasVirtualEnvironmentManager: |
|
158 self.__plugin.setPreferences( |
|
159 "VirtualEnvironmentNamePy3", |
|
160 self.py3VenvNameComboBox.currentText()) |
|
161 else: |
|
162 self.__plugin.setPreferences( |
|
163 "VirtualEnvironmentPy3", self.virtualEnvPy3Edit.text()) |
115 self.__plugin.setPreferences( |
164 self.__plugin.setPreferences( |
116 "Python3ConsoleType", |
165 "Python3ConsoleType", |
117 self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex())) |
166 self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex())) |
118 |
167 |
119 self.__plugin.setPreferences( |
168 self.__plugin.setPreferences( |