7 Module implementing the Viewmanager configuration page. |
7 Module implementing the Viewmanager configuration page. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import pyqtSlot, QVariant |
12 from PyQt4.QtCore import pyqtSlot |
13 from PyQt4.QtGui import QPixmap |
13 from PyQt4.QtGui import QPixmap |
14 |
14 |
15 from E4Gui.E4Application import e4App |
15 from E4Gui.E4Application import e4App |
16 |
16 |
17 from ConfigurationPageBase import ConfigurationPageBase |
17 from ConfigurationPageBase import ConfigurationPageBase |
39 self.windowComboBox.clear() |
39 self.windowComboBox.clear() |
40 currentVm = Preferences.getViewManager() |
40 currentVm = Preferences.getViewManager() |
41 |
41 |
42 keys = sorted(self.viewmanagers.keys()) |
42 keys = sorted(self.viewmanagers.keys()) |
43 for key in keys: |
43 for key in keys: |
44 self.windowComboBox.addItem(self.trUtf8(self.viewmanagers[key]), |
44 self.windowComboBox.addItem(self.trUtf8(self.viewmanagers[key]), key) |
45 QVariant(key)) |
|
46 currentIndex = self.windowComboBox.findText(\ |
45 currentIndex = self.windowComboBox.findText(\ |
47 self.trUtf8(self.viewmanagers[currentVm])) |
46 self.trUtf8(self.viewmanagers[currentVm])) |
48 self.windowComboBox.setCurrentIndex(currentIndex) |
47 self.windowComboBox.setCurrentIndex(currentIndex) |
49 self.on_windowComboBox_activated(currentIndex) |
48 self.on_windowComboBox_activated(currentIndex) |
50 |
49 |
60 def save(self): |
59 def save(self): |
61 """ |
60 """ |
62 Public slot to save the Viewmanager configuration. |
61 Public slot to save the Viewmanager configuration. |
63 """ |
62 """ |
64 vm = \ |
63 vm = \ |
65 self.windowComboBox.itemData(self.windowComboBox.currentIndex()).toString() |
64 self.windowComboBox.itemData(self.windowComboBox.currentIndex()) |
66 Preferences.setViewManager(vm) |
65 Preferences.setViewManager(vm) |
67 Preferences.setUI("TabViewManagerFilenameLength", |
66 Preferences.setUI("TabViewManagerFilenameLength", |
68 self.filenameLengthSpinBox.value()) |
67 self.filenameLengthSpinBox.value()) |
69 Preferences.setUI("TabViewManagerFilenameOnly", |
68 Preferences.setUI("TabViewManagerFilenameOnly", |
70 int(self.filenameOnlyCheckBox.isChecked())) |
69 self.filenameOnlyCheckBox.isChecked()) |
71 Preferences.setUI("RecentNumber", |
70 Preferences.setUI("RecentNumber", |
72 self.recentFilesSpinBox.value()) |
71 self.recentFilesSpinBox.value()) |
73 |
72 |
74 @pyqtSlot(int) |
73 @pyqtSlot(int) |
75 def on_windowComboBox_activated(self, index): |
74 def on_windowComboBox_activated(self, index): |
77 Private slot to show a preview of the selected workspace view type. |
76 Private slot to show a preview of the selected workspace view type. |
78 |
77 |
79 @param index index of selected workspace view type (integer) |
78 @param index index of selected workspace view type (integer) |
80 """ |
79 """ |
81 workspace = \ |
80 workspace = \ |
82 self.windowComboBox.itemData(self.windowComboBox.currentIndex()).toString() |
81 self.windowComboBox.itemData(self.windowComboBox.currentIndex()) |
83 pixmap = self.pluginManager.getPluginPreviewPixmap("viewmanager", workspace) |
82 pixmap = self.pluginManager.getPluginPreviewPixmap("viewmanager", workspace) |
84 |
83 |
85 self.previewPixmap.setPixmap(pixmap) |
84 self.previewPixmap.setPixmap(pixmap) |
86 self.tabViewGroupBox.setEnabled(workspace == "tabview") |
85 self.tabViewGroupBox.setEnabled(workspace == "tabview") |
87 |
86 |