|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Application configuration page. |
|
8 """ |
|
9 |
|
10 import os |
|
11 |
|
12 from PyQt4.QtCore import QVariant, pyqtSlot |
|
13 |
|
14 from ConfigurationPageBase import ConfigurationPageBase |
|
15 from Ui_ApplicationPage import Ui_ApplicationPage |
|
16 |
|
17 import Preferences |
|
18 |
|
19 class ApplicationPage(ConfigurationPageBase, Ui_ApplicationPage): |
|
20 """ |
|
21 Class implementing the Application configuration page. |
|
22 """ |
|
23 def __init__(self): |
|
24 """ |
|
25 Constructor |
|
26 """ |
|
27 ConfigurationPageBase.__init__(self) |
|
28 self.setupUi(self) |
|
29 self.setObjectName("ApplicationPage") |
|
30 |
|
31 # set initial values |
|
32 self.singleApplicationCheckBox.setChecked(\ |
|
33 Preferences.getUI("SingleApplicationMode")) |
|
34 self.splashScreenCheckBox.setChecked(\ |
|
35 Preferences.getUI("ShowSplash")) |
|
36 |
|
37 openOnStartup = Preferences.getUI("OpenOnStartup") |
|
38 if openOnStartup == 0: |
|
39 self.noOpenRadioButton.setChecked(True) |
|
40 elif openOnStartup == 1: |
|
41 self.lastFileRadioButton.setChecked(True) |
|
42 elif openOnStartup == 2: |
|
43 self.lastProjectRadioButton.setChecked(True) |
|
44 elif openOnStartup == 3: |
|
45 self.lastMultiprojectRadioButton.setChecked(True) |
|
46 elif openOnStartup == 4: |
|
47 self.globalSessionRadioButton.setChecked(True) |
|
48 |
|
49 period = Preferences.getUI("PerformVersionCheck") |
|
50 if period == 0: |
|
51 self.noCheckRadioButton.setChecked(True) |
|
52 elif period == 1: |
|
53 self.alwaysCheckRadioButton.setChecked(True) |
|
54 elif period == 2: |
|
55 self.dailyCheckRadioButton.setChecked(True) |
|
56 elif period == 3: |
|
57 self.weeklyCheckRadioButton.setChecked(True) |
|
58 elif period == 4: |
|
59 self.monthlyCheckRadioButton.setChecked(True) |
|
60 |
|
61 self.systemEmailClientCheckBox.setChecked( |
|
62 Preferences.getUser("UseSystemEmailClient")) |
|
63 |
|
64 self.errorlogCheckBox.setChecked( |
|
65 Preferences.getUI("CheckErrorLog")) |
|
66 |
|
67 def save(self): |
|
68 """ |
|
69 Public slot to save the Application configuration. |
|
70 """ |
|
71 Preferences.setUI("SingleApplicationMode", |
|
72 int(self.singleApplicationCheckBox.isChecked())) |
|
73 Preferences.setUI("ShowSplash", |
|
74 int(self.splashScreenCheckBox.isChecked())) |
|
75 |
|
76 if self.noOpenRadioButton.isChecked(): |
|
77 openOnStartup = 0 |
|
78 elif self.lastFileRadioButton.isChecked(): |
|
79 openOnStartup = 1 |
|
80 elif self.lastProjectRadioButton.isChecked(): |
|
81 openOnStartup = 2 |
|
82 elif self.lastMultiprojectRadioButton.isChecked(): |
|
83 openOnStartup = 3 |
|
84 elif self.globalSessionRadioButton.isChecked(): |
|
85 openOnStartup = 4 |
|
86 Preferences.setUI("OpenOnStartup", openOnStartup) |
|
87 |
|
88 if self.noCheckRadioButton.isChecked(): |
|
89 period = 0 |
|
90 elif self.alwaysCheckRadioButton.isChecked(): |
|
91 period = 1 |
|
92 elif self.dailyCheckRadioButton.isChecked(): |
|
93 period = 2 |
|
94 elif self.weeklyCheckRadioButton.isChecked(): |
|
95 period = 3 |
|
96 elif self.monthlyCheckRadioButton.isChecked(): |
|
97 period = 4 |
|
98 Preferences.setUI("PerformVersionCheck", period) |
|
99 |
|
100 Preferences.setUser("UseSystemEmailClient", |
|
101 int(self.systemEmailClientCheckBox.isChecked())) |
|
102 |
|
103 Preferences.setUI("CheckErrorLog", |
|
104 int(self.errorlogCheckBox.isChecked())) |
|
105 |
|
106 def create(dlg): |
|
107 """ |
|
108 Module function to create the configuration page. |
|
109 |
|
110 @param dlg reference to the configuration dialog |
|
111 """ |
|
112 page = ApplicationPage() |
|
113 return page |