19 |
19 |
20 class ViewmanagerPage(ConfigurationPageBase, Ui_ViewmanagerPage): |
20 class ViewmanagerPage(ConfigurationPageBase, Ui_ViewmanagerPage): |
21 """ |
21 """ |
22 Class implementing the Viewmanager configuration page. |
22 Class implementing the Viewmanager configuration page. |
23 """ |
23 """ |
|
24 |
24 def __init__(self): |
25 def __init__(self): |
25 """ |
26 """ |
26 Constructor |
27 Constructor |
27 """ |
28 """ |
28 super().__init__() |
29 super().__init__() |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 self.setObjectName("ViewmanagerPage") |
31 self.setObjectName("ViewmanagerPage") |
31 |
32 |
32 # set initial values |
33 # set initial values |
33 self.pluginManager = ericApp().getObject("PluginManager") |
34 self.pluginManager = ericApp().getObject("PluginManager") |
34 self.viewmanagers = self.pluginManager.getPluginDisplayStrings( |
35 self.viewmanagers = self.pluginManager.getPluginDisplayStrings("viewmanager") |
35 "viewmanager") |
|
36 self.windowComboBox.clear() |
36 self.windowComboBox.clear() |
37 currentVm = Preferences.getViewManager() |
37 currentVm = Preferences.getViewManager() |
38 |
38 |
39 keys = sorted(self.viewmanagers.keys()) |
39 keys = sorted(self.viewmanagers.keys()) |
40 for key in keys: |
40 for key in keys: |
41 self.windowComboBox.addItem( |
41 self.windowComboBox.addItem(self.tr(self.viewmanagers[key]), key) |
42 self.tr(self.viewmanagers[key]), key) |
|
43 currentIndex = self.windowComboBox.findText( |
42 currentIndex = self.windowComboBox.findText( |
44 self.tr(self.viewmanagers[currentVm])) |
43 self.tr(self.viewmanagers[currentVm]) |
|
44 ) |
45 self.windowComboBox.setCurrentIndex(currentIndex) |
45 self.windowComboBox.setCurrentIndex(currentIndex) |
46 self.on_windowComboBox_activated(currentIndex) |
46 self.on_windowComboBox_activated(currentIndex) |
47 |
47 |
48 self.tabViewGroupBox.setTitle( |
48 self.tabViewGroupBox.setTitle(self.tr(self.viewmanagers["tabview"])) |
49 self.tr(self.viewmanagers["tabview"])) |
49 |
50 |
|
51 self.filenameLengthSpinBox.setValue( |
50 self.filenameLengthSpinBox.setValue( |
52 Preferences.getUI("TabViewManagerFilenameLength")) |
51 Preferences.getUI("TabViewManagerFilenameLength") |
|
52 ) |
53 self.filenameOnlyCheckBox.setChecked( |
53 self.filenameOnlyCheckBox.setChecked( |
54 Preferences.getUI("TabViewManagerFilenameOnly")) |
54 Preferences.getUI("TabViewManagerFilenameOnly") |
55 self.recentFilesSpinBox.setValue( |
55 ) |
56 Preferences.getUI("RecentNumber")) |
56 self.recentFilesSpinBox.setValue(Preferences.getUI("RecentNumber")) |
57 |
57 |
58 def save(self): |
58 def save(self): |
59 """ |
59 """ |
60 Public slot to save the Viewmanager configuration. |
60 Public slot to save the Viewmanager configuration. |
61 """ |
61 """ |
62 vm = self.windowComboBox.itemData( |
62 vm = self.windowComboBox.itemData(self.windowComboBox.currentIndex()) |
63 self.windowComboBox.currentIndex()) |
|
64 Preferences.setViewManager(vm) |
63 Preferences.setViewManager(vm) |
65 Preferences.setUI( |
64 Preferences.setUI( |
66 "TabViewManagerFilenameLength", |
65 "TabViewManagerFilenameLength", self.filenameLengthSpinBox.value() |
67 self.filenameLengthSpinBox.value()) |
66 ) |
68 Preferences.setUI( |
67 Preferences.setUI( |
69 "TabViewManagerFilenameOnly", |
68 "TabViewManagerFilenameOnly", self.filenameOnlyCheckBox.isChecked() |
70 self.filenameOnlyCheckBox.isChecked()) |
69 ) |
71 Preferences.setUI( |
70 Preferences.setUI("RecentNumber", self.recentFilesSpinBox.value()) |
72 "RecentNumber", |
71 |
73 self.recentFilesSpinBox.value()) |
|
74 |
|
75 @pyqtSlot(int) |
72 @pyqtSlot(int) |
76 def on_windowComboBox_activated(self, index): |
73 def on_windowComboBox_activated(self, index): |
77 """ |
74 """ |
78 Private slot to show a preview of the selected workspace view type. |
75 Private slot to show a preview of the selected workspace view type. |
79 |
76 |
80 @param index index of selected workspace view type (integer) |
77 @param index index of selected workspace view type (integer) |
81 """ |
78 """ |
82 workspace = self.windowComboBox.itemData( |
79 workspace = self.windowComboBox.itemData(self.windowComboBox.currentIndex()) |
83 self.windowComboBox.currentIndex()) |
80 pixmap = self.pluginManager.getPluginPreviewPixmap("viewmanager", workspace) |
84 pixmap = self.pluginManager.getPluginPreviewPixmap( |
81 |
85 "viewmanager", workspace) |
|
86 |
|
87 self.previewPixmap.setPixmap(pixmap) |
82 self.previewPixmap.setPixmap(pixmap) |
88 self.tabViewGroupBox.setEnabled(workspace == "tabview") |
83 self.tabViewGroupBox.setEnabled(workspace == "tabview") |
89 |
84 |
90 |
85 |
91 def create(dlg): |
86 def create(dlg): |
92 """ |
87 """ |
93 Module function to create the configuration page. |
88 Module function to create the configuration page. |
94 |
89 |
95 @param dlg reference to the configuration dialog |
90 @param dlg reference to the configuration dialog |
96 @return reference to the instantiated page (ConfigurationPageBase) |
91 @return reference to the instantiated page (ConfigurationPageBase) |
97 """ |
92 """ |
98 page = ViewmanagerPage() |
93 page = ViewmanagerPage() |
99 return page |
94 return page |