18 |
18 |
19 class TemplatesPage(ConfigurationPageBase, Ui_TemplatesPage): |
19 class TemplatesPage(ConfigurationPageBase, Ui_TemplatesPage): |
20 """ |
20 """ |
21 Class implementing the Templates configuration page. |
21 Class implementing the Templates configuration page. |
22 """ |
22 """ |
|
23 |
23 def __init__(self): |
24 def __init__(self): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 """ |
27 """ |
27 super().__init__() |
28 super().__init__() |
28 self.setupUi(self) |
29 self.setupUi(self) |
29 self.setObjectName("TemplatesPage") |
30 self.setObjectName("TemplatesPage") |
30 |
31 |
31 # set initial values |
32 # set initial values |
32 self.templatesAutoOpenGroupsCheckBox.setChecked( |
33 self.templatesAutoOpenGroupsCheckBox.setChecked( |
33 Preferences.getTemplates("AutoOpenGroups")) |
34 Preferences.getTemplates("AutoOpenGroups") |
|
35 ) |
34 self.templatesSeparatorCharEdit.setText( |
36 self.templatesSeparatorCharEdit.setText( |
35 Preferences.getTemplates("SeparatorChar")) |
37 Preferences.getTemplates("SeparatorChar") |
|
38 ) |
36 if Preferences.getTemplates("SingleDialog"): |
39 if Preferences.getTemplates("SingleDialog"): |
37 self.templatesSingleDialogButton.setChecked(True) |
40 self.templatesSingleDialogButton.setChecked(True) |
38 else: |
41 else: |
39 self.templatesMultiDialogButton.setChecked(True) |
42 self.templatesMultiDialogButton.setChecked(True) |
40 self.templatesToolTipCheckBox.setChecked( |
43 self.templatesToolTipCheckBox.setChecked( |
41 Preferences.getTemplates("ShowTooltip")) |
44 Preferences.getTemplates("ShowTooltip") |
|
45 ) |
42 self.editorFont = Preferences.getTemplates("EditorFont") |
46 self.editorFont = Preferences.getTemplates("EditorFont") |
43 self.editorFontSample.setFont(self.editorFont) |
47 self.editorFontSample.setFont(self.editorFont) |
44 |
48 |
45 def save(self): |
49 def save(self): |
46 """ |
50 """ |
47 Public slot to save the Templates configuration. |
51 Public slot to save the Templates configuration. |
48 """ |
52 """ |
49 Preferences.setTemplates( |
53 Preferences.setTemplates( |
50 "AutoOpenGroups", |
54 "AutoOpenGroups", self.templatesAutoOpenGroupsCheckBox.isChecked() |
51 self.templatesAutoOpenGroupsCheckBox.isChecked()) |
55 ) |
52 sepChar = self.templatesSeparatorCharEdit.text() |
56 sepChar = self.templatesSeparatorCharEdit.text() |
53 if sepChar: |
57 if sepChar: |
54 Preferences.setTemplates("SeparatorChar", sepChar) |
58 Preferences.setTemplates("SeparatorChar", sepChar) |
55 Preferences.setTemplates( |
59 Preferences.setTemplates( |
56 "SingleDialog", |
60 "SingleDialog", self.templatesSingleDialogButton.isChecked() |
57 self.templatesSingleDialogButton.isChecked()) |
61 ) |
58 Preferences.setTemplates( |
62 Preferences.setTemplates( |
59 "ShowTooltip", |
63 "ShowTooltip", self.templatesToolTipCheckBox.isChecked() |
60 self.templatesToolTipCheckBox.isChecked()) |
64 ) |
61 Preferences.setTemplates("EditorFont", self.editorFont) |
65 Preferences.setTemplates("EditorFont", self.editorFont) |
62 |
66 |
63 @pyqtSlot() |
67 @pyqtSlot() |
64 def on_editorFontButton_clicked(self): |
68 def on_editorFontButton_clicked(self): |
65 """ |
69 """ |
66 Private method used to select the font to be used by the code editor. |
70 Private method used to select the font to be used by the code editor. |
67 """ |
71 """ |
68 self.editorFont = self.selectFont( |
72 self.editorFont = self.selectFont( |
69 self.editorFontSample, self.editorFont, |
73 self.editorFontSample, |
70 options=QFontDialog.FontDialogOption.MonospacedFonts) |
74 self.editorFont, |
71 |
75 options=QFontDialog.FontDialogOption.MonospacedFonts, |
|
76 ) |
|
77 |
72 |
78 |
73 def create(dlg): |
79 def create(dlg): |
74 """ |
80 """ |
75 Module function to create the configuration page. |
81 Module function to create the configuration page. |
76 |
82 |
77 @param dlg reference to the configuration dialog |
83 @param dlg reference to the configuration dialog |
78 @return reference to the instantiated page (ConfigurationPageBase) |
84 @return reference to the instantiated page (ConfigurationPageBase) |
79 """ |
85 """ |
80 page = TemplatesPage() |
86 page = TemplatesPage() |
81 return page |
87 return page |