|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Templates configuration page. |
|
8 """ |
|
9 |
|
10 from ConfigurationPageBase import ConfigurationPageBase |
|
11 from Ui_TemplatesPage import Ui_TemplatesPage |
|
12 |
|
13 import Preferences |
|
14 |
|
15 class TemplatesPage(ConfigurationPageBase, Ui_TemplatesPage): |
|
16 """ |
|
17 Class implementing the Templates configuration page. |
|
18 """ |
|
19 def __init__(self): |
|
20 """ |
|
21 Constructor |
|
22 """ |
|
23 ConfigurationPageBase.__init__(self) |
|
24 self.setupUi(self) |
|
25 self.setObjectName("TemplatesPage") |
|
26 |
|
27 # set initial values |
|
28 self.templatesAutoOpenGroupsCheckBox.setChecked(\ |
|
29 Preferences.getTemplates("AutoOpenGroups")) |
|
30 self.templatesSeparatorCharEdit.setText(\ |
|
31 Preferences.getTemplates("SeparatorChar")) |
|
32 if Preferences.getTemplates("SingleDialog"): |
|
33 self.templatesSingleDialogButton.setChecked(True) |
|
34 else: |
|
35 self.templatesMultiDialogButton.setChecked(True) |
|
36 self.templatesToolTipCheckBox.setChecked(\ |
|
37 Preferences.getTemplates("ShowTooltip")) |
|
38 |
|
39 def save(self): |
|
40 """ |
|
41 Public slot to save the Templates configuration. |
|
42 """ |
|
43 Preferences.setTemplates("AutoOpenGroups", |
|
44 int(self.templatesAutoOpenGroupsCheckBox.isChecked())) |
|
45 sepChar = self.templatesSeparatorCharEdit.text() |
|
46 if sepChar: |
|
47 Preferences.setTemplates("SeparatorChar", unicode(sepChar)) |
|
48 Preferences.setTemplates("SingleDialog", |
|
49 int(self.templatesSingleDialogButton.isChecked())) |
|
50 Preferences.setTemplates("ShowTooltip", |
|
51 int(self.templatesToolTipCheckBox.isChecked())) |
|
52 |
|
53 def create(dlg): |
|
54 """ |
|
55 Module function to create the configuration page. |
|
56 |
|
57 @param dlg reference to the configuration dialog |
|
58 """ |
|
59 page = TemplatesPage() |
|
60 return page |