eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py

branch
eric7
changeset 8319
ea11a3948f40
parent 8318
962bce857696
child 8755
30f52c9d5153
equal deleted inserted replaced
8318:962bce857696 8319:ea11a3948f40
7 Module implementing the base class for all configuration pages. 7 Module implementing the base class for all configuration pages.
8 """ 8 """
9 9
10 from PyQt6.QtCore import pyqtSlot, pyqtSignal 10 from PyQt6.QtCore import pyqtSlot, pyqtSignal
11 from PyQt6.QtGui import QIcon, QPixmap, QColor 11 from PyQt6.QtGui import QIcon, QPixmap, QColor
12 from PyQt6.QtWidgets import QWidget, QColorDialog, QFontDialog 12 from PyQt6.QtWidgets import QWidget, QColorDialog, QFontDialog, QDialog
13 13
14 14
15 class ConfigurationPageBase(QWidget): 15 class ConfigurationPageBase(QWidget):
16 """ 16 """
17 Class implementing the base class for all configuration pages. 17 Class implementing the base class for all configuration pages.
90 colDlg.setCurrentColor(self.__coloursDict[colorKey][0]) 90 colDlg.setCurrentColor(self.__coloursDict[colorKey][0])
91 colDlg.currentColorChanged.connect( 91 colDlg.currentColorChanged.connect(
92 lambda col: self.colourChanged.emit(colorKey, col)) 92 lambda col: self.colourChanged.emit(colorKey, col))
93 colDlg.exec() 93 colDlg.exec()
94 94
95 if colDlg.result() == colDlg.Accepted: 95 if colDlg.result() == QDialog.DialogCode.Accepted:
96 colour = colDlg.selectedColor() 96 colour = colDlg.selectedColor()
97 size = button.iconSize() 97 size = button.iconSize()
98 pm = QPixmap(size.width(), size.height()) 98 pm = QPixmap(size.width(), size.height())
99 pm.fill(colour) 99 pm.fill(colour)
100 button.setIcon(QIcon(pm)) 100 button.setIcon(QIcon(pm))
123 @param fontSample reference to the font sample widget (QLineEdit) 123 @param fontSample reference to the font sample widget (QLineEdit)
124 @param fontVar reference to the variable containing the font (QFont) 124 @param fontVar reference to the variable containing the font (QFont)
125 @param showFontInfo flag indicating to show some font info 125 @param showFontInfo flag indicating to show some font info
126 as the sample (boolean) 126 as the sample (boolean)
127 @param options options for the font dialog 127 @param options options for the font dialog
128 (QFontDialog.FontDialogOptions) 128 (QFontDialog.FontDialogOption)
129 @return selected font (QFont) 129 @return selected font (QFont)
130 """ 130 """
131 if options is None: 131 if options is None:
132 options = QFontDialog.FontDialogOptions(0) 132 options = QFontDialog.FontDialogOption(0)
133 font, ok = QFontDialog.getFont(fontVar, self, "", options) 133 font, ok = QFontDialog.getFont(fontVar, self, "", options)
134 if ok: 134 if ok:
135 fontSample.setFont(font) 135 fontSample.setFont(font)
136 if showFontInfo: 136 if showFontInfo:
137 fontSample.setText( 137 fontSample.setText(

eric ide

mercurial