7 Module implementing the Multi Project configuration page. |
7 Module implementing the Multi Project configuration page. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import pyqtSlot |
|
13 |
|
14 from .ConfigurationPageBase import ConfigurationPageBase |
12 from .ConfigurationPageBase import ConfigurationPageBase |
15 from .Ui_MultiProjectPage import Ui_MultiProjectPage |
13 from .Ui_MultiProjectPage import Ui_MultiProjectPage |
16 |
14 |
17 from E5Gui import E5FileDialog |
15 from E5Gui.E5PathPicker import E5PathPickerModes |
18 |
16 |
19 import Preferences |
17 import Preferences |
20 import Utilities |
18 import Utilities |
21 import UI.PixmapCache |
|
22 |
19 |
23 |
20 |
24 class MultiProjectPage(ConfigurationPageBase, Ui_MultiProjectPage): |
21 class MultiProjectPage(ConfigurationPageBase, Ui_MultiProjectPage): |
25 """ |
22 """ |
26 Class implementing the Multi Project configuration page. |
23 Class implementing the Multi Project configuration page. |
31 """ |
28 """ |
32 super(MultiProjectPage, self).__init__() |
29 super(MultiProjectPage, self).__init__() |
33 self.setupUi(self) |
30 self.setupUi(self) |
34 self.setObjectName("MultiProjectPage") |
31 self.setObjectName("MultiProjectPage") |
35 |
32 |
36 self.workspaceButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
33 self.workspacePicker.setMode(E5PathPickerModes.DiretoryMode) |
37 |
34 |
38 # set initial values |
35 # set initial values |
39 self.openMasterAutomaticallyCheckBox.setChecked( |
36 self.openMasterAutomaticallyCheckBox.setChecked( |
40 Preferences.getMultiProject("OpenMasterAutomatically")) |
37 Preferences.getMultiProject("OpenMasterAutomatically")) |
41 self.multiProjectTimestampCheckBox.setChecked( |
38 self.multiProjectTimestampCheckBox.setChecked( |
42 Preferences.getMultiProject("XMLTimestamp")) |
39 Preferences.getMultiProject("XMLTimestamp")) |
43 self.multiProjectRecentSpinBox.setValue( |
40 self.multiProjectRecentSpinBox.setValue( |
44 Preferences.getMultiProject("RecentNumber")) |
41 Preferences.getMultiProject("RecentNumber")) |
45 self.workspaceEdit.setText( |
42 self.workspacePicker.setText( |
46 Utilities.toNativeSeparators( |
43 Utilities.toNativeSeparators( |
47 Preferences.getMultiProject("Workspace") or |
44 Preferences.getMultiProject("Workspace") or |
48 Utilities.getHomeDir())) |
45 Utilities.getHomeDir())) |
49 |
46 |
50 def save(self): |
47 def save(self): |
60 Preferences.setMultiProject( |
57 Preferences.setMultiProject( |
61 "RecentNumber", |
58 "RecentNumber", |
62 self.multiProjectRecentSpinBox.value()) |
59 self.multiProjectRecentSpinBox.value()) |
63 Preferences.setMultiProject( |
60 Preferences.setMultiProject( |
64 "Workspace", |
61 "Workspace", |
65 self.workspaceEdit.text()) |
62 self.workspacePicker.text()) |
66 |
|
67 @pyqtSlot() |
|
68 def on_workspaceButton_clicked(self): |
|
69 """ |
|
70 Private slot to display a directory selection dialog. |
|
71 """ |
|
72 default = self.workspaceEdit.text() |
|
73 if default == "": |
|
74 default = Utilities.getHomeDir() |
|
75 directory = E5FileDialog.getExistingDirectory( |
|
76 self, |
|
77 self.tr("Select Workspace Directory"), |
|
78 default, |
|
79 E5FileDialog.Options(0)) |
|
80 |
|
81 if directory: |
|
82 self.workspaceEdit.setText(Utilities.toNativeSeparators(directory)) |
|
83 |
63 |
84 |
64 |
85 def create(dlg): |
65 def create(dlg): |
86 """ |
66 """ |
87 Module function to create the configuration page. |
67 Module function to create the configuration page. |