eric6/Project/UserPropertiesDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2006 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the user specific project properties dialog.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QDialog
13
14 from E5Gui.E5Application import e5App
15
16 import Preferences
17
18 from .Ui_UserPropertiesDialog import Ui_UserPropertiesDialog
19
20
21 class UserPropertiesDialog(QDialog, Ui_UserPropertiesDialog):
22 """
23 Class implementing the user specific project properties dialog.
24 """
25 def __init__(self, project, parent=None, name=None):
26 """
27 Constructor
28
29 @param project reference to the project object
30 @param parent parent widget of this dialog (QWidget)
31 @param name name of this dialog (string)
32 """
33 super(UserPropertiesDialog, self).__init__(parent)
34 if name:
35 self.setObjectName(name)
36 self.setupUi(self)
37
38 self.project = project
39
40 if self.project.pudata["VCSSTATUSMONITORINTERVAL"]:
41 self.vcsStatusMonitorIntervalSpinBox.setValue(
42 self.project.pudata["VCSSTATUSMONITORINTERVAL"])
43 else:
44 self.vcsStatusMonitorIntervalSpinBox.setValue(
45 Preferences.getVCS("StatusMonitorInterval"))
46
47 enableVcsGroup = False
48 if self.project.pdata["VCS"]:
49 found = False
50 for _indicator, vcsData in \
51 e5App().getObject("PluginManager")\
52 .getVcsSystemIndicators().items():
53 for vcsSystem, _vcsSystemDisplay in vcsData:
54 if vcsSystem == self.project.pdata["VCS"]:
55 found = True
56 break
57
58 if found:
59 for vcsSystem, vcsSystemDisplay in vcsData:
60 self.vcsInterfaceCombo.addItem(
61 vcsSystemDisplay, vcsSystem)
62 enableVcsGroup = len(vcsData) > 1
63 break
64 self.vcsGroup.setEnabled(enableVcsGroup)
65
66 if self.vcsGroup.isEnabled():
67 if self.project.pudata["VCSOVERRIDE"]:
68 vcsSystem = self.project.pudata["VCSOVERRIDE"]
69 else:
70 vcsSystem = self.project.pdata["VCS"]
71 index = self.vcsInterfaceCombo.findData(vcsSystem)
72 if index == -1:
73 index = 0
74 self.vcsInterfaceCombo.setCurrentIndex(index)
75
76 msh = self.minimumSizeHint()
77 self.resize(max(self.width(), msh.width()), msh.height())
78
79 def storeData(self):
80 """
81 Public method to store the entered/modified data.
82 """
83 vcsStatusMonitorInterval = self.vcsStatusMonitorIntervalSpinBox.value()
84 if vcsStatusMonitorInterval != \
85 Preferences.getVCS("StatusMonitorInterval"):
86 self.project.pudata["VCSSTATUSMONITORINTERVAL"] = \
87 vcsStatusMonitorInterval
88 else:
89 self.project.pudata["VCSSTATUSMONITORINTERVAL"] = 0
90
91 if self.vcsGroup.isEnabled():
92 vcsSystem = self.vcsInterfaceCombo\
93 .itemData(self.vcsInterfaceCombo.currentIndex())
94 if self.vcsInterfaceDefaultCheckBox.isChecked():
95 if vcsSystem != self.project.pdata["VCS"]:
96 self.project.pdata["VCS"] = vcsSystem
97 self.project.pudata["VCSOVERRIDE"] = ""
98 self.project.setDirty(True)
99 else:
100 if vcsSystem != self.project.pdata["VCS"]:
101 self.project.pudata["VCSOVERRIDE"] = vcsSystem
102 else:
103 self.project.pudata["VCSOVERRIDE"] = ""

eric ide

mercurial