Looks ok to me! Peter
On Tuesday 26 May 2009 02:46:05 am David A. Harding wrote: > Hi, > > I made a plugin to print the number of forgotten cards[1] in Mnemosyne > 1.1.x's status bar. The plugin helps me review all the cards I've > learned before I focus on a single category for new learning. > > [1] Forgotten cards = not memorized cards - unseen cards > > The plugin works, but I don't know Python, and I'll appreciate it if a > developer can check over the plugin before I upload it to the website. > Most of the code comes from the Abbreviated Card Statistics in Status > Bar plugin. The only significant new parts follow, although they were > taken from mnemosyne_core.py: > > def forgotten_cards(self): > items = get_items() > unseen = [i for i in items if i.unseen == True] > return non_memorised_items() - len(unseen) > > The entire plugin (68 lines) follows my signature below. I'll appreciate > any advice you can offer. > > Thank You, > > -Dave > > > ########################################################################### >### # > # forgotten_cards_in_stat_bar.py <[email protected]> > # > # Show the number of forgotten cards in the status bar. > # > # Based on a patch posted to the Mnemosyne development list by Adam > # Raizen, improvements by Timothy Bourke <[email protected]>, condensed > # text output by Bill Price, and adaptations to only show the number of > # forgotten cards by David A. Harding. Any problems may be reported to > # David A. Harding at <[email protected]>, but should not be sent to the > # other authors. > # > # This software comes with no warranty, not even the implied warranty of > # merchantability or fitness for a particular purpose. > ########################################################################### >### > > from mnemosyne.core import * > from mnemosyne.pyqt_ui.plugin import get_main_widget > from qt import * > import sys > > class Forgotten(Plugin): > version = "0.1" > > def description(self): > return ("Show the number of forgotten cards in the status bar. (v" + > version + ")") > > def load(self): > self.options = {} > > self.show_until = True > if self.options.has_key('show_until_next'): > self.show_until = self.options['show_until_next'] > > self.main_dlg = get_main_widget() > status_bar = self.main_dlg.statusBar() > > self.widgets = [] > self.forgotten = QLabel("", status_bar) > self.widgets.append(self.forgotten) > > for w in self.widgets: > status_bar.addWidget(w, 0, 0) > > register_function_hook("filter_q", self.set_statbar) > > def unload(self): > for w in self.widgets: > w.parent().removeChild(w) > del w > > unregister_function_hook("filter_q", self.set_statbar) > > def forgotten_cards(self): > items = get_items() > unseen = [i for i in items if i.unseen == True] > return non_memorised_items() - len(unseen) > > > def set_statbar(self, text, card): > self.forgotten.setText(self.main_dlg.trUtf8("Forgotten: ")\ > .append(QString (str(self.forgotten_cards())))) > > return text > > p = Forgotten() > p.load() ------------------------------------------------ Peter Bienstman Ghent University, Dept. of Information Technology Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium tel: +32 9 264 34 46, fax: +32 9 264 35 93 WWW: http://photonics.intec.UGent.be email: [email protected] ------------------------------------------------ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mnemosyne-proj-users?hl=en -~----------~----~----~----~------~----~------~--~---
