17 |
17 |
18 class GraphicsPage(ConfigurationPageBase, Ui_GraphicsPage): |
18 class GraphicsPage(ConfigurationPageBase, Ui_GraphicsPage): |
19 """ |
19 """ |
20 Class implementing the Printer configuration page. |
20 Class implementing the Printer configuration page. |
21 """ |
21 """ |
|
22 |
22 def __init__(self): |
23 def __init__(self): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 """ |
26 """ |
26 super().__init__() |
27 super().__init__() |
27 self.setupUi(self) |
28 self.setupUi(self) |
28 self.setObjectName("GraphicsPage") |
29 self.setObjectName("GraphicsPage") |
29 |
30 |
30 # set initial values |
31 # set initial values |
31 self.graphicsFont = Preferences.getGraphics("Font") |
32 self.graphicsFont = Preferences.getGraphics("Font") |
32 self.graphicsFontSample.setFont(self.graphicsFont) |
33 self.graphicsFontSample.setFont(self.graphicsFont) |
33 |
34 |
34 drawingMode = Preferences.getGraphics("DrawingMode") |
35 drawingMode = Preferences.getGraphics("DrawingMode") |
35 if drawingMode == "black_white": |
36 if drawingMode == "black_white": |
36 self.blackWhiteButton.setChecked(True) |
37 self.blackWhiteButton.setChecked(True) |
37 elif drawingMode == "white_black": |
38 elif drawingMode == "white_black": |
38 self.whiteBlackButton.setChecked(True) |
39 self.whiteBlackButton.setChecked(True) |
39 else: |
40 else: |
40 self.automaticButton.setChecked(True) |
41 self.automaticButton.setChecked(True) |
41 |
42 |
42 def save(self): |
43 def save(self): |
43 """ |
44 """ |
44 Public slot to save the Printer configuration. |
45 Public slot to save the Printer configuration. |
45 """ |
46 """ |
46 Preferences.setGraphics("Font", self.graphicsFont) |
47 Preferences.setGraphics("Font", self.graphicsFont) |
47 |
48 |
48 if self.blackWhiteButton.isChecked(): |
49 if self.blackWhiteButton.isChecked(): |
49 drawingMode = "black_white" |
50 drawingMode = "black_white" |
50 elif self.whiteBlackButton.isChecked(): |
51 elif self.whiteBlackButton.isChecked(): |
51 drawingMode = "white_black" |
52 drawingMode = "white_black" |
52 else: |
53 else: |
53 # default is automatic |
54 # default is automatic |
54 drawingMode = "automatic" |
55 drawingMode = "automatic" |
55 Preferences.setGraphics("DrawingMode", drawingMode) |
56 Preferences.setGraphics("DrawingMode", drawingMode) |
56 |
57 |
57 @pyqtSlot() |
58 @pyqtSlot() |
58 def on_graphicsFontButton_clicked(self): |
59 def on_graphicsFontButton_clicked(self): |
59 """ |
60 """ |
60 Private method used to select the font for the graphics items. |
61 Private method used to select the font for the graphics items. |
61 """ |
62 """ |
62 self.graphicsFont = self.selectFont(self.graphicsFontSample, |
63 self.graphicsFont = self.selectFont(self.graphicsFontSample, self.graphicsFont) |
63 self.graphicsFont) |
64 |
64 |
|
65 def polishPage(self): |
65 def polishPage(self): |
66 """ |
66 """ |
67 Public slot to perform some polishing actions. |
67 Public slot to perform some polishing actions. |
68 """ |
68 """ |
69 self.graphicsFontSample.setFont(self.graphicsFont) |
69 self.graphicsFontSample.setFont(self.graphicsFont) |
70 |
70 |
71 |
71 |
72 def create(dlg): |
72 def create(dlg): |
73 """ |
73 """ |
74 Module function to create the configuration page. |
74 Module function to create the configuration page. |
75 |
75 |
76 @param dlg reference to the configuration dialog |
76 @param dlg reference to the configuration dialog |
77 @return reference to the instantiated page (ConfigurationPageBase) |
77 @return reference to the instantiated page (ConfigurationPageBase) |
78 """ |
78 """ |
79 page = GraphicsPage() |
79 page = GraphicsPage() |
80 return page |
80 return page |