|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the VCS configuration page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from .ConfigurationPageBase import ConfigurationPageBase |
|
13 from .Ui_VcsPage import Ui_VcsPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 |
|
18 class VcsPage(ConfigurationPageBase, Ui_VcsPage): |
|
19 """ |
|
20 Class implementing the VCS configuration page. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 super(VcsPage, self).__init__() |
|
27 self.setupUi(self) |
|
28 self.setObjectName("VcsPage") |
|
29 |
|
30 # set initial values |
|
31 self.vcsAutoCloseCheckBox.setChecked(Preferences.getVCS("AutoClose")) |
|
32 self.vcsAutoSaveCheckBox.setChecked( |
|
33 Preferences.getVCS("AutoSaveFiles")) |
|
34 self.vcsAutoSaveProjectCheckBox.setChecked( |
|
35 Preferences.getVCS("AutoSaveProject")) |
|
36 self.vcsStatusMonitorIntervalSpinBox.setValue( |
|
37 Preferences.getVCS("StatusMonitorInterval")) |
|
38 self.vcsMonitorLocalStatusCheckBox.setChecked( |
|
39 Preferences.getVCS("MonitorLocalStatus")) |
|
40 self.autoUpdateCheckBox.setChecked( |
|
41 Preferences.getVCS("AutoUpdate")) |
|
42 |
|
43 self.initColour( |
|
44 "VcsAdded", self.pbVcsAddedButton, |
|
45 Preferences.getProjectBrowserColour) |
|
46 self.initColour( |
|
47 "VcsConflict", self.pbVcsConflictButton, |
|
48 Preferences.getProjectBrowserColour) |
|
49 self.initColour( |
|
50 "VcsModified", self.pbVcsModifiedButton, |
|
51 Preferences.getProjectBrowserColour) |
|
52 self.initColour( |
|
53 "VcsReplaced", self.pbVcsReplacedButton, |
|
54 Preferences.getProjectBrowserColour) |
|
55 self.initColour( |
|
56 "VcsUpdate", self.pbVcsUpdateButton, |
|
57 Preferences.getProjectBrowserColour) |
|
58 self.initColour( |
|
59 "VcsRemoved", self.pbVcsRemovedButton, |
|
60 Preferences.getProjectBrowserColour) |
|
61 |
|
62 def save(self): |
|
63 """ |
|
64 Public slot to save the VCS configuration. |
|
65 """ |
|
66 Preferences.setVCS( |
|
67 "AutoClose", |
|
68 self.vcsAutoCloseCheckBox.isChecked()) |
|
69 Preferences.setVCS( |
|
70 "AutoSaveFiles", |
|
71 self.vcsAutoSaveCheckBox.isChecked()) |
|
72 Preferences.setVCS( |
|
73 "AutoSaveProject", |
|
74 self.vcsAutoSaveProjectCheckBox.isChecked()) |
|
75 Preferences.setVCS( |
|
76 "StatusMonitorInterval", |
|
77 self.vcsStatusMonitorIntervalSpinBox.value()) |
|
78 Preferences.setVCS( |
|
79 "MonitorLocalStatus", |
|
80 self.vcsMonitorLocalStatusCheckBox.isChecked()) |
|
81 Preferences.setVCS( |
|
82 "AutoUpdate", |
|
83 self.autoUpdateCheckBox.isChecked()) |
|
84 |
|
85 self.saveColours(Preferences.setProjectBrowserColour) |
|
86 |
|
87 |
|
88 def create(dlg): |
|
89 """ |
|
90 Module function to create the configuration page. |
|
91 |
|
92 @param dlg reference to the configuration dialog |
|
93 @return reference to the instantiated page (ConfigurationPageBase) |
|
94 """ |
|
95 page = VcsPage() |
|
96 return page |