Changeset f87ac85f2ae4…
Parent 2ec2dca59aa0…
by
Changes to 2 files · Browse files at f87ac85f2ae4 Showing diff from parent 2ec2dca59aa0 Diff from another changeset...
@@ -157,7 +157,8 @@ changed = pyqtSignal(QFont)
def __init__(self, name):
QObject.__init__(self)
- self.myfont = QFont(name)
+ self.myfont = QFont()
+ self.myfont.fromString(name)
def font(self):
return self.myfont
def setFont(self, f):
@@ -165,10 +166,10 @@ self.changed.emit(f)
_fontdefaults = {
- 'fontcomment': 'monospace 10',
- 'fontdiff': 'monospace 10',
- 'fontlist': 'sans 9',
- 'fontlog': 'monospace 10'
+ 'fontcomment': 'monospace,10',
+ 'fontdiff': 'monospace,10',
+ 'fontlist': 'sans,9',
+ 'fontlog': 'monospace,10'
}
_fontcache = {}
def getfont(ui, name):
|
@@ -153,11 +153,19 @@ def on_clicked(self, checked):
thgf = qtlib.getfont(ui.ui(), self.fname)
dlg = QFontDialog(self)
- dlg.setCurrentFont(QFont(self.value() or thgf.font()))
+ dlg.setCurrentFont(self.currentFont() or thgf.font())
if dlg.exec_() == QDialog.Accepted:
thgf.setFont(dlg.selectedFont())
self.setText(thgf.font().toString())
+ def currentFont(self):
+ """currently selected QFont if specified"""
+ if not self.value():
+ return None
+
+ f = QFont()
+ f.fromString(self.value())
+
## common APIs for all edit widgets
def setValue(self, curvalue):
|
Loading...