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