hack groups back into working state, pending port to sidebar

This commit is contained in:
Damien Elmes 2011-09-07 03:13:15 +09:00
parent 24cabc0ce7
commit 7a81015c7a
3 changed files with 14 additions and 18 deletions

View file

@ -670,7 +670,7 @@ class Browser(QMainWindow):
"group", head+g[0])) "group", head+g[0]))
item.setIcon(0, QIcon(":/icons/stock_group.png")) item.setIcon(0, QIcon(":/icons/stock_group.png"))
root.addChild(item) root.addChild(item)
fillGroups(item, g[5], g[0]+"::") fillGroups(item, g[4], g[0]+"::")
fillGroups(root, grps) fillGroups(root, grps)
def _systemTagTree(self, root): def _systemTagTree(self, root):

View file

@ -167,18 +167,19 @@ class Groups(QDialog):
if len(gids) == self.gidCount: if len(gids) == self.gidCount:
# all enabled is same as empty # all enabled is same as empty
gids = [] gids = []
if gids != self.mw.deck.conf['groups']: # if gids != self.mw.deck.conf['groups']:
self.mw.deck.conf['groups'] = gids # self.mw.deck.conf['groups'] = gids
self.mw.reset() # self.mw.reset()
QDialog.accept(self) QDialog.accept(self)
def _makeItems(self, grps): def _makeItems(self, grps):
self.gidCount = 0 self.gidCount = 0
on = {} on = {}
if not self.mw.deck.conf['groups']: a = self.mw.deck.groups.active()
if not a:
on = None on = None
else: else:
for gid in self.mw.deck.conf['groups']: for gid in a:
on[gid] = True on[gid] = True
grey = QBrush(QColor(GREY)) grey = QBrush(QColor(GREY))
def makeItems(grp, head=""): def makeItems(grp, head=""):
@ -196,17 +197,17 @@ class Groups(QDialog):
branch.setText(COLNAME, grp[0]) branch.setText(COLNAME, grp[0])
if gid: if gid:
branch.setText(COLOPTS, self.mw.deck.groups.name(gid)) branch.setText(COLOPTS, self.mw.deck.groups.name(gid))
branch.setText(COLCOUNT, str(grp[2])) branch.setText(COLCOUNT, "")
branch.setText(COLDUE, str(grp[3])) branch.setText(COLDUE, str(grp[2]))
branch.setText(COLNEW, str(grp[4])) branch.setText(COLNEW, str(grp[3]))
for i in (COLCOUNT, COLDUE, COLNEW): for i in (COLCOUNT, COLDUE, COLNEW):
branch.setTextAlignment(i, Qt.AlignRight) branch.setTextAlignment(i, Qt.AlignRight)
self.groupMap[grp[0]] = grp[1] self.groupMap[grp[0]] = grp[1]
self.fullNames[grp[0]] = head+grp[0] self.fullNames[grp[0]] = head+grp[0]
if grp[1]: if grp[1]:
self.gidCount += 1 self.gidCount += 1
if grp[5]: if grp[4]:
for c in grp[5]: for c in grp[4]:
branch.addChild(makeItems(c, head+grp[0]+"::")) branch.addChild(makeItems(c, head+grp[0]+"::"))
return branch return branch
top = [makeItems(g) for g in grps] top = [makeItems(g) for g in grps]

View file

@ -60,14 +60,10 @@ class Overview(object):
fc = self._ovForecast() fc = self._ovForecast()
tbl = self._overviewTable() tbl = self._overviewTable()
but = self.mw.button but = self.mw.button
eta = self.mw.deck.sched.etaStr()
if eta:
eta = _("Estimated study time: %s") % eta
self.web.stdHtml(self._overviewBody % dict( self.web.stdHtml(self._overviewBody % dict(
title=_("Overview"), title=_("Overview"),
table=tbl, table=tbl,
fcsub=_("Reviews over next two weeks"), fcsub=_("Reviews over next two weeks"),
eta=eta,
fcdata=fc, fcdata=fc,
), css) ), css)
@ -77,7 +73,6 @@ class Overview(object):
<p> <p>
%(table)s %(table)s
<p> <p>
%(eta)s<br>
<div id="placeholder" style="width:350px; height:100px;"></div> <div id="placeholder" style="width:350px; height:100px;"></div>
<span class=sub>%(fcsub)s</span> <span class=sub>%(fcsub)s</span>
<p> <p>
@ -136,8 +131,8 @@ $(function () {
def _ovCounts(self): def _ovCounts(self):
# we have the limited count already # we have the limited count already
selcnt = self.mw.deck.sched.selCounts() selcnt = [0,0,0] #self.mw.deck.sched.selCounts()
allcnt = self.mw.deck.sched.allCounts() allcnt = [0,0,0] #self.mw.deck.sched.allCounts()
return [ return [
limitedCount(selcnt[1] + selcnt[2]), limitedCount(selcnt[1] + selcnt[2]),
selcnt[0], selcnt[0],