move stats and sync buttons to the center

This commit is contained in:
Damien Elmes 2017-06-23 14:03:18 +10:00
parent a3bdd04d42
commit e635157ee4
2 changed files with 7 additions and 26 deletions

View file

@ -1809,7 +1809,7 @@ class BrowserToolbar(Toolbar):
"Bulk Remove Tags (Ctrl+Alt+T)"))) "Bulk Remove Tags (Ctrl+Alt+T)")))
right += borderImg("delete", "delete16", _("Delete")) right += borderImg("delete", "delete16", _("Delete"))
right += "</div>" right += "</div>"
return self._body % ("", right, "") return self._body % right
def css(self): def css(self):
return self._css + """ return self._css + """

View file

@ -29,29 +29,18 @@ class Toolbar:
def draw(self): def draw(self):
self.web.onBridgeCmd = self._linkHandler self.web.onBridgeCmd = self._linkHandler
self.web.onLoadFinished = self.onLoaded self.web.onLoadFinished = self.onLoaded
self.web.stdHtml(self._body % ( self.web.stdHtml(self._body % self._centerLinks(), self._css)
# may want a context menu here in the future
'&nbsp;'*20,
self._centerLinks(),
self._rightIcons()),
self._css)
# Available links # Available links
###################################################################### ######################################################################
def _rightIconsList(self):
return [
["stats", "qrc:/icons/view-statistics.png",
_("Show statistics. Shortcut key: %s") % "Shift+S"],
["sync", "qrc:/icons/view-refresh.png",
_("Synchronize with AnkiWeb. Shortcut key: %s") % "Y"],
]
def _centerLinks(self): def _centerLinks(self):
links = [ links = [
["decks", _("Decks"), _("Shortcut key: %s") % "D"], ["decks", _("Decks"), _("Shortcut key: %s") % "D"],
["add", _("Add"), _("Shortcut key: %s") % "A"], ["add", _("Add"), _("Shortcut key: %s") % "A"],
["browse", _("Browse"), _("Shortcut key: %s") % "B"], ["browse", _("Browse"), _("Shortcut key: %s") % "B"],
["stats", _("Stats"), _("Shortcut key: %s") % "Shift+S"],
["sync", _("Sync"), _("Shortcut key: %s") % "Y"],
] ]
return self._linkHTML(links) return self._linkHTML(links)
@ -64,14 +53,6 @@ class Toolbar:
buf += "&nbsp;"*3 buf += "&nbsp;"*3
return buf return buf
def _rightIcons(self):
buf = ""
for ln, icon, title in self._rightIconsList():
buf += '''
<a class=hitem title="%s" href=# onclick='pycmd("%s")'><img width="16px" height="16px" src="%s"></a>''' % (
title, ln, icon)
return buf
# Link handling # Link handling
###################################################################### ######################################################################
@ -110,9 +91,7 @@ class Toolbar:
<center id=outer> <center id=outer>
<table id=header width=100%%> <table id=header width=100%%>
<tr> <tr>
<td width=16%% align=left>%s</td> <td class=tdcenter align=center>%s</td>
<td align=center>%s</td>
<td width=15%% valign=middle align=right>%s</td>
</tr></table> </tr></table>
</center> </center>
""" """
@ -125,6 +104,8 @@ border-bottom: 1px solid #aaa;
background: %s; background: %s;
} }
.tdcenter { white-space: nowrap; }
body { body {
margin:0; padding:0; margin:0; padding:0;
-webkit-user-select: none; -webkit-user-select: none;