experimenting with a new toolbar

This commit is contained in:
Damien Elmes 2011-11-26 22:07:10 +09:00
parent 5f1b762a15
commit f75ef69fba
6 changed files with 53 additions and 7 deletions

View file

@ -50,14 +50,14 @@ class DeckBrowser(object):
_css = """
.sub { color: #555; }
a.deck { color: #000; text-decoration: none; font-size: 16px; }
a.deck { color: #000; text-decoration: none; font-size: 12px; }
.num { text-align: right; padding: 0 5 0 5; }
td.opts { white-space: nowrap; }
td.deck { width: 90% }
a { font-size: 80%; }
.extra { font-size: 90%; }
.due { vertical-align: text-bottom; }
table { margin: 1em; }
body { margin: 1em; }
"""
_body = """
@ -92,7 +92,7 @@ table { margin: 1em; }
buf += " <a class=deck href='open:%d'>%s</a></td>"% (did, name)
# options
buf += "<td align=right class=opts>%s</td></tr>" % self.mw.button(
link="opts:%d"%did, name=_("Options")+'&#9660')
link="opts:%d"%did, name=_("Options")+'&#9662')
# children
buf += self._renderDeckTree(children, depth+1)
return buf

View file

@ -286,7 +286,7 @@ Are you sure?"""):
sharedCSS = """
body {
background: #eee;
background: #f3f3f3;
margin: 2em;
}
a:hover { background-color: #aaa; }

View file

@ -42,14 +42,16 @@ class Overview(object):
if url == "study":
self.mw.col.reset()
self.mw.moveToState("review")
elif url == "anki":
print "anki menu"
elif url == "cram":
return showInfo("not yet implemented")
#self.mw.col.cramGroups()
#self.mw.moveToState("review")
elif url == "opts":
self.mw.onStudyOptions()
elif url == "chgrp":
self.mw.onGroups()
elif url == "decks":
self.mw.moveToState("deckBrowser")
# HTML
############################################################
@ -60,12 +62,30 @@ class Overview(object):
tbl = self._overviewTable()
but = self.mw.button
deck = self.mw.col.decks.current()
dname = deck['name']
sid = deck.get("sharedFrom")
if True: # sid:
shareLink = '<a class=smallLink href="review">Reviews and Updates</a>'
else:
shareLink = ""
header = """
<table id=header width=100%%>
<tr>
<td width=20%>
<a class="hitem" href="anki">Anki &#9662</a>
</td>
<td align=center>
<a class=hitem href="decks">Decks</a>
<a class=hitem href="study">Study</a>
<a class=hitem href="add">Add</a>
<a class=hitem href="browse">Browse</a>
</td>
<td width=20% align=right>
<a class=hitem href="stats"><img src="qrc:/icons/view-statistics.png"></a>
<a class=hitem href="sync"><img src="qrc:/icons/view-refresh.png"></a>
</td></tr></table>
<div id=headerSpace></div>
""" #% deck['name']
self.web.stdHtml(self._overviewBody % dict(
title=_("Overview"),
table=tbl,
@ -73,10 +93,12 @@ class Overview(object):
deck=deck['name'],
shareLink=shareLink,
desc="",
header=header,
fcdata=fc,
), css)
_overviewBody = """
%(header)s
<center>
<h3>%(deck)s</h3>
%(shareLink)s
@ -112,6 +134,29 @@ $(function () {
.sub { font-size: 80%; color: #555; }
.smallLink { font-size: 12px; }
h3 { margin-bottom: 0; }
#headerSpace { height: 22px; }
#header {
z-index: 100;
position: fixed;
height: 22px;
font-size: 12px;
margin:0;
background: -webkit-gradient(linear, left top, left bottom,
from(#ddd), to(#fff));
border-bottom: 1px solid #ccc;
font-weight: bold;
}
body { margin: 0; }
.deck { }
.hitem { display: inline-block; padding: 4px; padding-right: 6px;
text-decoration: none; color: #000;
}
.hborder { border: 1px solid #ddd; }
.hitem:hover {
background: #333;
color: #fff;
}
.icon { padding-top: 2px; }
"""
def _overviewTable(self):

View file

@ -11,6 +11,7 @@
<file>icons/layout.png</file>
<file>icons/generate_07.png</file>
<file>icons/view-sort-descending.png</file>
<file>icons/view-refresh.png</file>
<file>icons/emblem-important.png</file>
<file>icons/view-sort-ascending.png</file>
<file>icons/media-playback-start2.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 3 KiB