24 |
22 |
25 class PyramidPage(ConfigurationPageBase, Ui_PyramidPage): |
23 class PyramidPage(ConfigurationPageBase, Ui_PyramidPage): |
26 """ |
24 """ |
27 Class implementing the Pyramid configuration page. |
25 Class implementing the Pyramid configuration page. |
28 """ |
26 """ |
|
27 |
29 def __init__(self, plugin): |
28 def __init__(self, plugin): |
30 """ |
29 """ |
31 Constructor |
30 Constructor |
32 |
31 |
33 @param plugin reference to the plugin object |
32 @param plugin reference to the plugin object |
34 @type ProjectPyramidPlugin |
33 @type ProjectPyramidPlugin |
35 """ |
34 """ |
36 super().__init__() |
35 super().__init__() |
37 self.setupUi(self) |
36 self.setupUi(self) |
38 self.setObjectName("PyramidPage") |
37 self.setObjectName("PyramidPage") |
39 |
38 |
40 self.__plugin = plugin |
39 self.__plugin = plugin |
41 |
40 |
42 consoleList = [] |
41 consoleList = [] |
43 if isWindowsPlatform(): |
42 if isWindowsPlatform(): |
44 consoleList.append("cmd.exe /c") |
43 consoleList.append("cmd.exe /c") |
45 elif isMacPlatform(): |
44 elif isMacPlatform(): |
46 consoleList.append("xterm -e") |
45 consoleList.append("xterm -e") |
51 consoleList.append("gnome-terminal -e") |
50 consoleList.append("gnome-terminal -e") |
52 consoleList.append("mate-terminal -e") |
51 consoleList.append("mate-terminal -e") |
53 consoleList.append("xfce4-terminal -e") |
52 consoleList.append("xfce4-terminal -e") |
54 consoleList.append("xterm -e") |
53 consoleList.append("xterm -e") |
55 self.consoleCommandCombo.addItems(consoleList) |
54 self.consoleCommandCombo.addItems(consoleList) |
56 |
55 |
57 self.urlResetButton.setIcon(UI.PixmapCache.getIcon("editUndo")) |
56 self.urlResetButton.setIcon(UI.PixmapCache.getIcon("editUndo")) |
58 |
57 |
59 self.py3ShellCombo.addItem(self.tr("Plain Python"), "python") |
58 self.py3ShellCombo.addItem(self.tr("Plain Python"), "python") |
60 self.py3ShellCombo.addItem(self.tr("IPython"), "ipython") |
59 self.py3ShellCombo.addItem(self.tr("IPython"), "ipython") |
61 self.py3ShellCombo.addItem(self.tr("bpython"), "bpython") |
60 self.py3ShellCombo.addItem(self.tr("bpython"), "bpython") |
62 |
61 |
63 venvManager = ericApp().getObject("VirtualEnvManager") |
62 venvManager = ericApp().getObject("VirtualEnvManager") |
64 |
63 |
65 self.py3VenvNameComboBox.addItems( |
64 self.py3VenvNameComboBox.addItems( |
66 [""] + sorted(venvManager.getVirtualenvNames())) |
65 [""] + sorted(venvManager.getVirtualenvNames()) |
67 |
66 ) |
68 self.translationsEditorPicker.setMode( |
67 |
69 EricPathPickerModes.OPEN_FILE_MODE) |
68 self.translationsEditorPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
70 self.translationsEditorPicker.setFilters(self.tr("All Files (*)")) |
69 self.translationsEditorPicker.setFilters(self.tr("All Files (*)")) |
71 |
70 |
72 # set initial values |
71 # set initial values |
73 self.consoleCommandCombo.setEditText( |
72 self.consoleCommandCombo.setEditText( |
74 self.__plugin.getPreferences("ConsoleCommand")) |
73 self.__plugin.getPreferences("ConsoleCommand") |
75 |
74 ) |
|
75 |
76 self.externalBrowserCheckBox.setChecked( |
76 self.externalBrowserCheckBox.setChecked( |
77 self.__plugin.getPreferences("UseExternalBrowser")) |
77 self.__plugin.getPreferences("UseExternalBrowser") |
78 |
78 ) |
79 venvName = self.__plugin.getPreferences( |
79 |
80 "VirtualEnvironmentNamePy3") |
80 venvName = self.__plugin.getPreferences("VirtualEnvironmentNamePy3") |
81 if venvName: |
81 if venvName: |
82 index = self.py3VenvNameComboBox.findText(venvName) |
82 index = self.py3VenvNameComboBox.findText(venvName) |
83 if index < 0: |
83 if index < 0: |
84 index = 0 |
84 index = 0 |
85 self.py3VenvNameComboBox.setCurrentIndex(index) |
85 self.py3VenvNameComboBox.setCurrentIndex(index) |
86 self.py3ShellCombo.setCurrentIndex(self.py3ShellCombo.findData( |
86 self.py3ShellCombo.setCurrentIndex( |
87 self.__plugin.getPreferences("Python3ConsoleType"))) |
87 self.py3ShellCombo.findData( |
88 |
88 self.__plugin.getPreferences("Python3ConsoleType") |
89 self.urlEdit.setText( |
89 ) |
90 self.__plugin.getPreferences("PyramidDocUrl")) |
90 ) |
91 |
91 |
|
92 self.urlEdit.setText(self.__plugin.getPreferences("PyramidDocUrl")) |
|
93 |
92 self.translationsEditorPicker.setText( |
94 self.translationsEditorPicker.setText( |
93 self.__plugin.getPreferences("TranslationsEditor")) |
95 self.__plugin.getPreferences("TranslationsEditor") |
94 |
96 ) |
|
97 |
95 def save(self): |
98 def save(self): |
96 """ |
99 """ |
97 Public slot to save the Pyramid configuration. |
100 Public slot to save the Pyramid configuration. |
98 """ |
101 """ |
99 self.__plugin.setPreferences( |
102 self.__plugin.setPreferences( |
100 "ConsoleCommand", self.consoleCommandCombo.currentText()) |
103 "ConsoleCommand", self.consoleCommandCombo.currentText() |
101 |
104 ) |
|
105 |
102 self.__plugin.setPreferences( |
106 self.__plugin.setPreferences( |
103 "UseExternalBrowser", self.externalBrowserCheckBox.isChecked()) |
107 "UseExternalBrowser", self.externalBrowserCheckBox.isChecked() |
104 |
108 ) |
|
109 |
105 self.__plugin.setPreferences( |
110 self.__plugin.setPreferences( |
106 "VirtualEnvironmentNamePy3", |
111 "VirtualEnvironmentNamePy3", self.py3VenvNameComboBox.currentText() |
107 self.py3VenvNameComboBox.currentText()) |
112 ) |
108 self.__plugin.setPreferences( |
113 self.__plugin.setPreferences( |
109 "Python3ConsoleType", |
114 "Python3ConsoleType", |
110 self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex())) |
115 self.py3ShellCombo.itemData(self.py3ShellCombo.currentIndex()), |
111 |
116 ) |
|
117 |
|
118 self.__plugin.setPreferences("PyramidDocUrl", self.urlEdit.text()) |
|
119 |
112 self.__plugin.setPreferences( |
120 self.__plugin.setPreferences( |
113 "PyramidDocUrl", self.urlEdit.text()) |
121 "TranslationsEditor", self.translationsEditorPicker.text() |
114 |
122 ) |
115 self.__plugin.setPreferences( |
123 |
116 "TranslationsEditor", self.translationsEditorPicker.text()) |
|
117 |
|
118 @pyqtSlot() |
124 @pyqtSlot() |
119 def on_urlResetButton_clicked(self): |
125 def on_urlResetButton_clicked(self): |
120 """ |
126 """ |
121 Private slot to reset the Pyramid documentation URL. |
127 Private slot to reset the Pyramid documentation URL. |
122 """ |
128 """ |
123 self.urlEdit.setText( |
129 self.urlEdit.setText(self.__plugin.getDefaultPreference("PyramidDocUrl")) |
124 self.__plugin.getDefaultPreference("PyramidDocUrl")) |
|