mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
default to win32 theme on win32, set background in css
This commit is contained in:
parent
53cb4790af
commit
887d95203d
5 changed files with 12 additions and 9 deletions
|
@ -43,8 +43,6 @@ def run():
|
|||
pass
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
if sys.platform.startswith("win32"):
|
||||
app.setStyle("plastique")
|
||||
|
||||
# setup paths for forms, icons
|
||||
sys.path.append(modDir)
|
||||
|
|
|
@ -58,7 +58,6 @@ class DeckModel(QAbstractTableModel):
|
|||
f.setPixelSize(12)
|
||||
return QVariant(f)
|
||||
elif role == Qt.DisplayRole or role == Qt.EditRole:
|
||||
#s = self.columns[index.column()][1](self.getCardID(index))
|
||||
s = self.columns[index.column()][1](index)
|
||||
s = s.replace("<br>", u" ")
|
||||
s = s.replace("\n", u" ")
|
||||
|
|
|
@ -22,8 +22,9 @@ class DisplayProperties(QDialog):
|
|||
self.main = main
|
||||
self.deck = main.deck
|
||||
self.ignoreUpdate = False
|
||||
if sys.platform.startswith("darwin"):
|
||||
# mac widgets don't show colours
|
||||
self.plastiqueStyle = None
|
||||
if (sys.platform.startswith("darwin") or
|
||||
sys.platform.startswith("win32")):
|
||||
self.plastiqueStyle = QStyleFactory.create("plastique")
|
||||
self.dialog = ankiqt.forms.displayproperties.Ui_DisplayProperties()
|
||||
self.dialog.setupUi(self)
|
||||
|
@ -82,7 +83,7 @@ class DisplayProperties(QDialog):
|
|||
SIGNAL("valueChanged(int)"),
|
||||
self.saveCard)
|
||||
w = self.cwidget("Colour", type)
|
||||
if sys.platform.startswith("darwin"):
|
||||
if self.plastiqueStyle:
|
||||
w.setStyle(self.plastiqueStyle)
|
||||
self.connect(w,
|
||||
SIGNAL("clicked()"),
|
||||
|
@ -168,7 +169,7 @@ class DisplayProperties(QDialog):
|
|||
SIGNAL("stateChanged(int)"),
|
||||
self.saveField)
|
||||
w = self.fwidget("fontColour", type)
|
||||
if sys.platform.startswith("darwin"):
|
||||
if self.plastiqueStyle:
|
||||
w.setStyle(self.plastiqueStyle)
|
||||
self.connect(w,
|
||||
SIGNAL("clicked()"),
|
||||
|
|
|
@ -115,13 +115,15 @@ class Preferences(QDialog):
|
|||
getattr(self.dialog, type + "Size").setFocus()
|
||||
|
||||
def setupColour(self):
|
||||
if sys.platform.startswith("darwin"):
|
||||
self.plastiqueStyle = None
|
||||
if (sys.platform.startswith("darwin") or
|
||||
sys.platform.startswith("win32")):
|
||||
# mac widgets don't show colours
|
||||
self.plastiqueStyle = QStyleFactory.create("plastique")
|
||||
for c in ("interface", "background"):
|
||||
colour = c + "Colour"
|
||||
button = getattr(self.dialog, colour)
|
||||
if sys.platform.startswith("darwin"):
|
||||
if self.plastiqueStyle:
|
||||
button.setStyle(self.plastiqueStyle)
|
||||
button.setPalette(QPalette(QColor(
|
||||
self.config[colour])))
|
||||
|
|
|
@ -85,6 +85,9 @@ class View(object):
|
|||
color = ("; color: " + self.main.config[base + "Colour"])
|
||||
s += ('.%s {font-family: "%s"; font-size: %spx%s}\n' %
|
||||
(base, family, size, color))
|
||||
s += ("body { background-color: " +
|
||||
self.main.config["backgroundColour"] +
|
||||
"; }")
|
||||
s += "</style>"
|
||||
return s
|
||||
|
||||
|
|
Loading…
Reference in a new issue