6307: Bug fixes for To Do gramplets
svn: r21071
This commit is contained in:
parent
d9c1a330f3
commit
3dbd69ad31
@ -257,15 +257,15 @@ register(GRAMPLET,
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="TODO",
|
||||
name=_("TODO"),
|
||||
description = _("Gramplet for generic notes"),
|
||||
id="To Do",
|
||||
name=_("To Do"),
|
||||
description = _("Gramplet for displaying a To Do list"),
|
||||
status = STABLE,
|
||||
fname="todogramplet.py",
|
||||
height=300,
|
||||
expand=True,
|
||||
gramplet = 'TODOGramplet',
|
||||
gramplet_title=_("TODO List"),
|
||||
gramplet = 'ToDoGramplet',
|
||||
gramplet_title=_("To Do"),
|
||||
version="1.0.0",
|
||||
gramps_target_version="4.1",
|
||||
)
|
||||
|
@ -45,14 +45,19 @@ class ToDo(Gramplet):
|
||||
|
||||
hbox = Gtk.HBox()
|
||||
self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
|
||||
self.left.set_tooltip_text(_('Previous To Do note'))
|
||||
self.left.set_sensitive(False)
|
||||
hbox.pack_start(self.left, False, False, 0)
|
||||
self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
|
||||
self.right.set_tooltip_text(_('Next To Do note'))
|
||||
self.right.set_sensitive(False)
|
||||
hbox.pack_start(self.right, False, False, 0)
|
||||
self.edit = SimpleButton(Gtk.STOCK_EDIT, self.edit_clicked)
|
||||
self.edit.set_tooltip_text(_('Edit the selected To Do note'))
|
||||
self.edit.set_sensitive(False)
|
||||
hbox.pack_start(self.edit, False, False, 0)
|
||||
self.new = SimpleButton(Gtk.STOCK_NEW, self.new_clicked)
|
||||
self.new.set_tooltip_text(_('Add a new To Do note'))
|
||||
hbox.pack_start(self.new, False, False, 0)
|
||||
self.page = Gtk.Label()
|
||||
hbox.pack_end(self.page, False, False, 10)
|
||||
@ -88,11 +93,13 @@ class ToDo(Gramplet):
|
||||
self.obj = obj
|
||||
self.left.set_sensitive(False)
|
||||
self.right.set_sensitive(False)
|
||||
self.edit.set_sensitive(False)
|
||||
self.texteditor.set_text(StyledText())
|
||||
self.note_list = self.get_note_list(obj)
|
||||
self.page.set_text('')
|
||||
if len(self.note_list) > 0:
|
||||
self.set_has_data(True)
|
||||
self.edit.set_sensitive(True)
|
||||
if len(self.note_list) > 1:
|
||||
self.right.set_sensitive(True)
|
||||
self.current = 0
|
||||
@ -103,6 +110,7 @@ class ToDo(Gramplet):
|
||||
def clear_text(self):
|
||||
self.left.set_sensitive(False)
|
||||
self.right.set_sensitive(False)
|
||||
self.edit.set_sensitive(False)
|
||||
self.texteditor.set_text(StyledText())
|
||||
self.page.set_text('')
|
||||
self.current = 0
|
||||
|
@ -30,7 +30,7 @@ from gramps.gen.db import DbTxn
|
||||
from gramps.gen.ggettext import gettext as _
|
||||
from gi.repository import Gtk
|
||||
|
||||
class TODOGramplet(Gramplet):
|
||||
class ToDoGramplet(Gramplet):
|
||||
"""
|
||||
Displays all the To Do notes in the database.
|
||||
"""
|
||||
@ -48,14 +48,19 @@ class TODOGramplet(Gramplet):
|
||||
|
||||
hbox = Gtk.HBox()
|
||||
self.left = SimpleButton(Gtk.STOCK_GO_BACK, self.left_clicked)
|
||||
self.left.set_tooltip_text(_('Previous To Do note'))
|
||||
self.left.set_sensitive(False)
|
||||
hbox.pack_start(self.left, False, False, 0)
|
||||
self.right = SimpleButton(Gtk.STOCK_GO_FORWARD, self.right_clicked)
|
||||
self.right.set_tooltip_text(_('Next To Do note'))
|
||||
self.right.set_sensitive(False)
|
||||
hbox.pack_start(self.right, False, False, 0)
|
||||
self.edit = SimpleButton(Gtk.STOCK_EDIT, self.edit_clicked)
|
||||
self.edit.set_tooltip_text(_('Edit the selected To Do note'))
|
||||
self.edit.set_sensitive(False)
|
||||
hbox.pack_start(self.edit, False, False, 0)
|
||||
self.new = SimpleButton(Gtk.STOCK_NEW, self.new_clicked)
|
||||
self.new.set_tooltip_text(_('Add a new To Do note'))
|
||||
hbox.pack_start(self.new, False, False, 0)
|
||||
self.page = Gtk.Label()
|
||||
hbox.pack_end(self.page, False, False, 10)
|
||||
@ -98,12 +103,14 @@ class TODOGramplet(Gramplet):
|
||||
"""
|
||||
self.left.set_sensitive(False)
|
||||
self.right.set_sensitive(False)
|
||||
self.edit.set_sensitive(False)
|
||||
self.texteditor.set_text(StyledText())
|
||||
self.note_list = self.get_note_list()
|
||||
self.page.set_text('')
|
||||
self.title.set_text('')
|
||||
if len(self.note_list) > 0:
|
||||
self.set_has_data(True)
|
||||
self.edit.set_sensitive(True)
|
||||
if len(self.note_list) > 1:
|
||||
self.right.set_sensitive(True)
|
||||
self.current = 0
|
||||
@ -114,6 +121,7 @@ class TODOGramplet(Gramplet):
|
||||
def clear_text(self):
|
||||
self.left.set_sensitive(False)
|
||||
self.right.set_sensitive(False)
|
||||
self.edit.set_sensitive(False)
|
||||
self.texteditor.set_text(StyledText())
|
||||
self.page.set_text('')
|
||||
self.title.set_text('')
|
||||
@ -130,7 +138,7 @@ class TODOGramplet(Gramplet):
|
||||
name, obj = navigation_label(self.dbstate.db, obj[0][0], obj[0][1])
|
||||
self.title.set_text(name)
|
||||
else:
|
||||
self.title.set_text("Unattached")
|
||||
self.title.set_text(_("Unattached"))
|
||||
self.texteditor.set_text(note.get_styledtext())
|
||||
self.page.set_text(_('%(current)d of %(total)d') %
|
||||
{'current': self.current + 1,
|
||||
|
Loading…
Reference in New Issue
Block a user