|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2011 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Editor Syntax Checker configuration page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from .ConfigurationPageBase import ConfigurationPageBase |
|
13 from .Ui_EditorSyntaxPage import Ui_EditorSyntaxPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 |
|
18 class EditorSyntaxPage(ConfigurationPageBase, Ui_EditorSyntaxPage): |
|
19 """ |
|
20 Class implementing the Editor Syntax Checker configuration page. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 super(EditorSyntaxPage, self).__init__() |
|
27 self.setupUi(self) |
|
28 self.setObjectName("EditorSyntaxPage") |
|
29 |
|
30 # set initial values |
|
31 self.onlineCheckBox.setChecked( |
|
32 Preferences.getEditor("OnlineSyntaxCheck")) |
|
33 self.onlineTimeoutSpinBox.setValue( |
|
34 Preferences.getEditor("OnlineSyntaxCheckInterval")) |
|
35 self.automaticSyntaxCheckCheckBox.setChecked( |
|
36 Preferences.getEditor("AutoCheckSyntax")) |
|
37 |
|
38 # pyflakes related stuff |
|
39 self.includeCheckBox.setChecked( |
|
40 Preferences.getFlakes("IncludeInSyntaxCheck")) |
|
41 self.ignoreStarImportCheckBox.setChecked( |
|
42 Preferences.getFlakes("IgnoreStarImportWarnings")) |
|
43 |
|
44 def save(self): |
|
45 """ |
|
46 Public slot to save the Editor Syntax Checker configuration. |
|
47 """ |
|
48 Preferences.setEditor( |
|
49 "OnlineSyntaxCheck", |
|
50 self.onlineCheckBox.isChecked()) |
|
51 Preferences.setEditor( |
|
52 "OnlineSyntaxCheckInterval", |
|
53 self.onlineTimeoutSpinBox.value()) |
|
54 Preferences.setEditor( |
|
55 "AutoCheckSyntax", |
|
56 self.automaticSyntaxCheckCheckBox.isChecked()) |
|
57 |
|
58 # pyflakes related stuff |
|
59 Preferences.setFlakes( |
|
60 "IncludeInSyntaxCheck", |
|
61 self.includeCheckBox.isChecked()) |
|
62 Preferences.setFlakes( |
|
63 "IgnoreStarImportWarnings", |
|
64 self.ignoreStarImportCheckBox.isChecked()) |
|
65 |
|
66 |
|
67 def create(dlg): |
|
68 """ |
|
69 Module function to create the configuration page. |
|
70 |
|
71 @param dlg reference to the configuration dialog |
|
72 @return reference to the instantiated page (ConfigurationPageBase) |
|
73 """ |
|
74 page = EditorSyntaxPage() |
|
75 return page |