eric7/Preferences/ConfigurationPages/GraphicsPage.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2006 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Printer configuration page.
8 """
9
10 from PyQt5.QtCore import pyqtSlot
11
12 from .ConfigurationPageBase import ConfigurationPageBase
13 from .Ui_GraphicsPage import Ui_GraphicsPage
14
15 import Preferences
16
17
18 class GraphicsPage(ConfigurationPageBase, Ui_GraphicsPage):
19 """
20 Class implementing the Printer configuration page.
21 """
22 def __init__(self):
23 """
24 Constructor
25 """
26 super().__init__()
27 self.setupUi(self)
28 self.setObjectName("GraphicsPage")
29
30 # set initial values
31 self.graphicsFont = Preferences.getGraphics("Font")
32 self.graphicsFontSample.setFont(self.graphicsFont)
33
34 drawingMode = Preferences.getGraphics("DrawingMode")
35 if drawingMode == "black_white":
36 self.blackWhiteButton.setChecked(True)
37 elif drawingMode == "white_black":
38 self.whiteBlackButton.setChecked(True)
39 else:
40 self.automaticButton.setChecked(True)
41
42 def save(self):
43 """
44 Public slot to save the Printer configuration.
45 """
46 Preferences.setGraphics("Font", self.graphicsFont)
47
48 if self.blackWhiteButton.isChecked():
49 drawingMode = "black_white"
50 elif self.whiteBlackButton.isChecked():
51 drawingMode = "white_black"
52 else:
53 # default is automatic
54 drawingMode = "automatic"
55 Preferences.setGraphics("DrawingMode", drawingMode)
56
57 @pyqtSlot()
58 def on_graphicsFontButton_clicked(self):
59 """
60 Private method used to select the font for the graphics items.
61 """
62 self.graphicsFont = self.selectFont(self.graphicsFontSample,
63 self.graphicsFont)
64
65 def polishPage(self):
66 """
67 Public slot to perform some polishing actions.
68 """
69 self.graphicsFontSample.setFont(self.graphicsFont)
70
71
72 def create(dlg):
73 """
74 Module function to create the configuration page.
75
76 @param dlg reference to the configuration dialog
77 @return reference to the instantiated page (ConfigurationPageBase)
78 """
79 page = GraphicsPage()
80 return page

eric ide

mercurial