make setting colour work if there's no selection

This commit is contained in:
Damien Elmes 2009-02-08 16:28:26 +09:00
parent 99f9f9cc40
commit 4d4fb8adba

View file

@ -551,14 +551,16 @@ class FactEditor(object):
# we lose the selection when we open the colour dialog on win32,
# so we need to save it
cursor = w.textCursor()
haveSel = cursor.hasSelection()
new = QColorDialog.getColor(w.textColor(), self.parent)
if new.isValid():
w.setTextCursor(cursor)
self.foregroundFrame.setPalette(QPalette(new))
w.setTextColor(new)
# now we clear the selection
cursor.clearSelection()
w.setTextCursor(cursor)
if haveSel:
cursor.clearSelection()
w.setTextCursor(cursor)
self.fontChanged = True
def insertLatex(self):