honor styles in css in add/edit dialogs too

This commit is contained in:
Damien Elmes 2010-01-26 01:23:53 +09:00
parent dcf65465b3
commit ea76ddc9f3
4 changed files with 13 additions and 7 deletions

View file

@ -29,6 +29,7 @@ class AddCards(QDialog):
windParent = parent windParent = parent
QDialog.__init__(self, windParent, Qt.Window) QDialog.__init__(self, windParent, Qt.Window)
self.parent = parent self.parent = parent
ui.utils.applyStyles(self)
self.config = parent.config self.config = parent.config
self.dialog = ankiqt.forms.addcards.Ui_AddCards() self.dialog = ankiqt.forms.addcards.Ui_AddCards()
self.dialog.setupUi(self) self.dialog.setupUi(self)

View file

@ -14,7 +14,8 @@ from anki.facts import factsTable, fieldsTable, Fact
from anki.utils import fmtTimeSpan, parseTags, findTag, addTags, deleteTags, \ from anki.utils import fmtTimeSpan, parseTags, findTag, addTags, deleteTags, \
stripHTML, ids2str stripHTML, ids2str
from ankiqt.ui.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter from ankiqt.ui.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter
from ankiqt.ui.utils import saveHeader, restoreHeader, saveState, restoreState from ankiqt.ui.utils import saveHeader, restoreHeader, saveState, \
restoreState, applyStyles
from anki.errors import * from anki.errors import *
from anki.db import * from anki.db import *
from anki.stats import CardStats from anki.stats import CardStats
@ -336,6 +337,7 @@ class EditDeck(QMainWindow):
else: else:
windParent = parent windParent = parent
QMainWindow.__init__(self, windParent) QMainWindow.__init__(self, windParent)
applyStyles(self)
self.parent = parent self.parent = parent
self.deck = self.parent.deck self.deck = self.parent.deck
self.config = parent.config self.config = parent.config

View file

@ -2540,12 +2540,7 @@ it to your friends.
########################################################################## ##########################################################################
def setupStyle(self): def setupStyle(self):
try: ui.utils.applyStyles(self)
styleFile = open(os.path.join(self.config.configPath,
"style.css"))
self.setStyleSheet(styleFile.read())
except (IOError, OSError):
pass
# Sounds # Sounds
########################################################################## ##########################################################################

View file

@ -205,6 +205,14 @@ def mungeQA(deck, txt):
"font-weight: 900;") "font-weight: 900;")
return txt return txt
def applyStyles(widget):
try:
styleFile = open(os.path.join(ankiqt.mw.config.configPath,
"style.css"))
widget.setStyleSheet(styleFile.read())
except (IOError, OSError):
pass
def getBase(deck, card): def getBase(deck, card):
base = None base = None
if deck and card: if deck and card: