18 |
18 |
19 class UserPropertiesDialog(QDialog, Ui_UserPropertiesDialog): |
19 class UserPropertiesDialog(QDialog, Ui_UserPropertiesDialog): |
20 """ |
20 """ |
21 Class implementing the user specific project properties dialog. |
21 Class implementing the user specific project properties dialog. |
22 """ |
22 """ |
|
23 |
23 def __init__(self, project, parent=None, name=None): |
24 def __init__(self, project, parent=None, name=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param project reference to the project object |
28 @param project reference to the project object |
28 @param parent parent widget of this dialog (QWidget) |
29 @param parent parent widget of this dialog (QWidget) |
29 @param name name of this dialog (string) |
30 @param name name of this dialog (string) |
30 """ |
31 """ |
31 super().__init__(parent) |
32 super().__init__(parent) |
32 if name: |
33 if name: |
33 self.setObjectName(name) |
34 self.setObjectName(name) |
34 self.setupUi(self) |
35 self.setupUi(self) |
35 |
36 |
36 self.project = project |
37 self.project = project |
37 |
38 |
38 if self.project.pudata["VCSSTATUSMONITORINTERVAL"]: |
39 if self.project.pudata["VCSSTATUSMONITORINTERVAL"]: |
39 self.vcsStatusMonitorIntervalSpinBox.setValue( |
40 self.vcsStatusMonitorIntervalSpinBox.setValue( |
40 self.project.pudata["VCSSTATUSMONITORINTERVAL"]) |
41 self.project.pudata["VCSSTATUSMONITORINTERVAL"] |
|
42 ) |
41 else: |
43 else: |
42 self.vcsStatusMonitorIntervalSpinBox.setValue( |
44 self.vcsStatusMonitorIntervalSpinBox.setValue( |
43 Preferences.getVCS("StatusMonitorInterval")) |
45 Preferences.getVCS("StatusMonitorInterval") |
44 |
46 ) |
|
47 |
45 enableVcsGroup = False |
48 enableVcsGroup = False |
46 if self.project.pdata["VCS"]: |
49 if self.project.pdata["VCS"]: |
47 found = False |
50 found = False |
48 for _indicator, vcsData in ( |
51 for _indicator, vcsData in ( |
49 ericApp().getObject("PluginManager") |
52 ericApp().getObject("PluginManager").getVcsSystemIndicators().items() |
50 .getVcsSystemIndicators().items() |
|
51 ): |
53 ): |
52 for vcsSystem, _vcsSystemDisplay in vcsData: |
54 for vcsSystem, _vcsSystemDisplay in vcsData: |
53 if vcsSystem == self.project.pdata["VCS"]: |
55 if vcsSystem == self.project.pdata["VCS"]: |
54 found = True |
56 found = True |
55 break |
57 break |
56 |
58 |
57 if found: |
59 if found: |
58 for vcsSystem, vcsSystemDisplay in vcsData: |
60 for vcsSystem, vcsSystemDisplay in vcsData: |
59 self.vcsInterfaceCombo.addItem( |
61 self.vcsInterfaceCombo.addItem(vcsSystemDisplay, vcsSystem) |
60 vcsSystemDisplay, vcsSystem) |
|
61 enableVcsGroup = len(vcsData) > 1 |
62 enableVcsGroup = len(vcsData) > 1 |
62 break |
63 break |
63 self.vcsGroup.setEnabled(enableVcsGroup) |
64 self.vcsGroup.setEnabled(enableVcsGroup) |
64 |
65 |
65 if self.vcsGroup.isEnabled(): |
66 if self.vcsGroup.isEnabled(): |
66 if self.project.pudata["VCSOVERRIDE"]: |
67 if self.project.pudata["VCSOVERRIDE"]: |
67 vcsSystem = self.project.pudata["VCSOVERRIDE"] |
68 vcsSystem = self.project.pudata["VCSOVERRIDE"] |
68 else: |
69 else: |
69 vcsSystem = self.project.pdata["VCS"] |
70 vcsSystem = self.project.pdata["VCS"] |
70 index = self.vcsInterfaceCombo.findData(vcsSystem) |
71 index = self.vcsInterfaceCombo.findData(vcsSystem) |
71 if index == -1: |
72 if index == -1: |
72 index = 0 |
73 index = 0 |
73 self.vcsInterfaceCombo.setCurrentIndex(index) |
74 self.vcsInterfaceCombo.setCurrentIndex(index) |
74 |
75 |
75 msh = self.minimumSizeHint() |
76 msh = self.minimumSizeHint() |
76 self.resize(max(self.width(), msh.width()), msh.height()) |
77 self.resize(max(self.width(), msh.width()), msh.height()) |
77 |
78 |
78 def storeData(self): |
79 def storeData(self): |
79 """ |
80 """ |
80 Public method to store the entered/modified data. |
81 Public method to store the entered/modified data. |
81 """ |
82 """ |
82 vcsStatusMonitorInterval = self.vcsStatusMonitorIntervalSpinBox.value() |
83 vcsStatusMonitorInterval = self.vcsStatusMonitorIntervalSpinBox.value() |
83 if ( |
84 if vcsStatusMonitorInterval != Preferences.getVCS("StatusMonitorInterval"): |
84 vcsStatusMonitorInterval != |
85 self.project.pudata["VCSSTATUSMONITORINTERVAL"] = vcsStatusMonitorInterval |
85 Preferences.getVCS("StatusMonitorInterval") |
|
86 ): |
|
87 self.project.pudata["VCSSTATUSMONITORINTERVAL"] = ( |
|
88 vcsStatusMonitorInterval |
|
89 ) |
|
90 else: |
86 else: |
91 self.project.pudata["VCSSTATUSMONITORINTERVAL"] = 0 |
87 self.project.pudata["VCSSTATUSMONITORINTERVAL"] = 0 |
92 |
88 |
93 if self.vcsGroup.isEnabled(): |
89 if self.vcsGroup.isEnabled(): |
94 vcsSystem = self.vcsInterfaceCombo.itemData( |
90 vcsSystem = self.vcsInterfaceCombo.itemData( |
95 self.vcsInterfaceCombo.currentIndex()) |
91 self.vcsInterfaceCombo.currentIndex() |
|
92 ) |
96 if self.vcsInterfaceDefaultCheckBox.isChecked(): |
93 if self.vcsInterfaceDefaultCheckBox.isChecked(): |
97 if vcsSystem != self.project.pdata["VCS"]: |
94 if vcsSystem != self.project.pdata["VCS"]: |
98 self.project.pdata["VCS"] = vcsSystem |
95 self.project.pdata["VCS"] = vcsSystem |
99 self.project.pudata["VCSOVERRIDE"] = "" |
96 self.project.pudata["VCSOVERRIDE"] = "" |
100 self.project.setDirty(True) |
97 self.project.setDirty(True) |