Introduce experimental netbook mode for small screen sizes
svn: r17965
This commit is contained in:
parent
390410f2ca
commit
59c793608c
@ -257,6 +257,7 @@ src/gui/views/treemodels/repomodel.py
|
|||||||
src/gui/views/treemodels/sourcemodel.py
|
src/gui/views/treemodels/sourcemodel.py
|
||||||
|
|
||||||
# gui/widgets - the GUI widgets package
|
# gui/widgets - the GUI widgets package
|
||||||
|
src/gui/widgets/basicentry.py
|
||||||
src/gui/widgets/menutoolbuttonaction.py
|
src/gui/widgets/menutoolbuttonaction.py
|
||||||
src/gui/widgets/styledtextbuffer.py
|
src/gui/widgets/styledtextbuffer.py
|
||||||
src/gui/widgets/undoablestyledbuffer.py
|
src/gui/widgets/undoablestyledbuffer.py
|
||||||
|
@ -402,6 +402,16 @@ class DisplayState(gen.utils.Callback):
|
|||||||
# but this connection is still made!
|
# but this connection is still made!
|
||||||
# self.dbstate.connect('database-changed', self.db_changed)
|
# self.dbstate.connect('database-changed', self.db_changed)
|
||||||
|
|
||||||
|
self.__netbook_mode = False
|
||||||
|
if self.window.get_screen().get_width() <= 1024:
|
||||||
|
self.__netbook_mode = True
|
||||||
|
|
||||||
|
def netbook_mode(self):
|
||||||
|
"""
|
||||||
|
Return True if running on a small screen, else return False.
|
||||||
|
"""
|
||||||
|
return self.__netbook_mode
|
||||||
|
|
||||||
def clear_history(self):
|
def clear_history(self):
|
||||||
"""
|
"""
|
||||||
Clear all history objects.
|
Clear all history objects.
|
||||||
|
@ -58,8 +58,8 @@ class EventSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_desc = gtk.Entry()
|
self.filter_desc = widgets.BasicEntry()
|
||||||
self.filter_event = gen.lib.Event()
|
self.filter_event = gen.lib.Event()
|
||||||
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
|
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
|
||||||
self.etype = gtk.ComboBoxEntry()
|
self.etype = gtk.ComboBoxEntry()
|
||||||
@ -69,11 +69,11 @@ class EventSidebarFilter(SidebarFilter):
|
|||||||
self.filter_event.set_type,
|
self.filter_event.set_type,
|
||||||
self.filter_event.get_type)
|
self.filter_event.get_type)
|
||||||
|
|
||||||
self.filter_mainparts = gtk.Entry()
|
self.filter_mainparts = widgets.BasicEntry()
|
||||||
self.filter_date = gtk.Entry()
|
self.filter_date = widgets.BasicEntry()
|
||||||
self.filter_place = gtk.Entry()
|
self.filter_place = widgets.BasicEntry()
|
||||||
self.filter_note = gtk.Entry()
|
self.filter_note = widgets.BasicEntry()
|
||||||
|
|
||||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
|
|
||||||
self.generic = gtk.ComboBox()
|
self.generic = gtk.ComboBox()
|
||||||
@ -88,15 +88,17 @@ class EventSidebarFilter(SidebarFilter):
|
|||||||
self.generic.add_attribute(cell, 'text', 0)
|
self.generic.add_attribute(cell, 'text', 0)
|
||||||
self.on_filters_changed('Event')
|
self.on_filters_changed('Event')
|
||||||
|
|
||||||
|
self.etype.child.set_width_chars(5)
|
||||||
|
|
||||||
self.add_text_entry(_('ID'), self.filter_id)
|
self.add_text_entry(_('ID'), self.filter_id)
|
||||||
self.add_text_entry(_('Description'), self.filter_desc)
|
self.add_text_entry(_('Description'), self.filter_desc)
|
||||||
self.add_entry(_('Type'), self.etype)
|
self.add_entry(_('Type'), self.etype)
|
||||||
self.add_text_entry(_('Main Participants'), self.filter_mainparts)
|
self.add_text_entry(_('Participants'), self.filter_mainparts)
|
||||||
self.add_text_entry(_('Date'), self.filter_date)
|
self.add_text_entry(_('Date'), self.filter_date)
|
||||||
self.add_text_entry(_('Place'), self.filter_place)
|
self.add_text_entry(_('Place'), self.filter_place)
|
||||||
self.add_text_entry(_('Note'), self.filter_note)
|
self.add_text_entry(_('Note'), self.filter_note)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text(u'')
|
self.filter_id.set_text(u'')
|
||||||
|
@ -62,10 +62,10 @@ class FamilySidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_father = gtk.Entry()
|
self.filter_father = widgets.BasicEntry()
|
||||||
self.filter_mother = gtk.Entry()
|
self.filter_mother = widgets.BasicEntry()
|
||||||
self.filter_child = gtk.Entry()
|
self.filter_child = widgets.BasicEntry()
|
||||||
|
|
||||||
self.filter_event = gen.lib.Event()
|
self.filter_event = gen.lib.Event()
|
||||||
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
|
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
|
||||||
@ -85,8 +85,8 @@ class FamilySidebarFilter(SidebarFilter):
|
|||||||
self.family_stub.set_relationship,
|
self.family_stub.set_relationship,
|
||||||
self.family_stub.get_relationship)
|
self.family_stub.get_relationship)
|
||||||
|
|
||||||
self.filter_note = gtk.Entry()
|
self.filter_note = widgets.BasicEntry()
|
||||||
|
|
||||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
|
|
||||||
self.tag = gtk.ComboBox()
|
self.tag = gtk.ComboBox()
|
||||||
@ -108,6 +108,9 @@ class FamilySidebarFilter(SidebarFilter):
|
|||||||
self.tag.pack_start(cell, True)
|
self.tag.pack_start(cell, True)
|
||||||
self.tag.add_attribute(cell, 'text', 0)
|
self.tag.add_attribute(cell, 'text', 0)
|
||||||
|
|
||||||
|
self.etype.child.set_width_chars(5)
|
||||||
|
self.rtype.child.set_width_chars(5)
|
||||||
|
|
||||||
self.add_text_entry(_('ID'), self.filter_id)
|
self.add_text_entry(_('ID'), self.filter_id)
|
||||||
self.add_text_entry(_('Father'), self.filter_father)
|
self.add_text_entry(_('Father'), self.filter_father)
|
||||||
self.add_text_entry(_('Mother'), self.filter_mother)
|
self.add_text_entry(_('Mother'), self.filter_mother)
|
||||||
@ -117,7 +120,7 @@ class FamilySidebarFilter(SidebarFilter):
|
|||||||
self.add_text_entry(_('Family Note'), self.filter_note)
|
self.add_text_entry(_('Family Note'), self.filter_note)
|
||||||
self.add_entry(_('Tag'), self.tag)
|
self.add_entry(_('Tag'), self.tag)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text(u'')
|
self.filter_id.set_text(u'')
|
||||||
|
@ -40,6 +40,7 @@ import gtk
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from gui import widgets
|
||||||
from Filters.SideBar import SidebarFilter
|
from Filters.SideBar import SidebarFilter
|
||||||
from Filters import GenericFilterFactory, build_filter_model, Rules
|
from Filters import GenericFilterFactory, build_filter_model, Rules
|
||||||
from Filters.Rules.MediaObject import (RegExpIdOf, HasIdOf, HasMedia, HasTag,
|
from Filters.Rules.MediaObject import (RegExpIdOf, HasIdOf, HasMedia, HasTag,
|
||||||
@ -56,13 +57,12 @@ class MediaSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_title = gtk.Entry()
|
self.filter_title = widgets.BasicEntry()
|
||||||
self.filter_type = gtk.Entry()
|
self.filter_type = widgets.BasicEntry()
|
||||||
self.filter_path = gtk.Entry()
|
self.filter_path = widgets.BasicEntry()
|
||||||
self.filter_date = gtk.Entry()
|
self.filter_date = widgets.BasicEntry()
|
||||||
|
self.filter_note = widgets.BasicEntry()
|
||||||
self.filter_note = gtk.Entry()
|
|
||||||
|
|
||||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class MediaSidebarFilter(SidebarFilter):
|
|||||||
self.add_text_entry(_('Note'), self.filter_note)
|
self.add_text_entry(_('Note'), self.filter_note)
|
||||||
self.add_entry(_('Tag'), self.tag)
|
self.add_entry(_('Tag'), self.tag)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text('')
|
self.filter_id.set_text('')
|
||||||
|
@ -58,8 +58,8 @@ class NoteSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_text = gtk.Entry()
|
self.filter_text = widgets.BasicEntry()
|
||||||
|
|
||||||
self.note = Note()
|
self.note = Note()
|
||||||
self.note.set_type((NoteType.CUSTOM,''))
|
self.note.set_type((NoteType.CUSTOM,''))
|
||||||
@ -90,12 +90,14 @@ class NoteSidebarFilter(SidebarFilter):
|
|||||||
self.tag.pack_start(cell, True)
|
self.tag.pack_start(cell, True)
|
||||||
self.tag.add_attribute(cell, 'text', 0)
|
self.tag.add_attribute(cell, 'text', 0)
|
||||||
|
|
||||||
|
self.ntype.child.set_width_chars(5)
|
||||||
|
|
||||||
self.add_text_entry(_('ID'), self.filter_id)
|
self.add_text_entry(_('ID'), self.filter_id)
|
||||||
self.add_text_entry(_('Text'), self.filter_text)
|
self.add_text_entry(_('Text'), self.filter_text)
|
||||||
self.add_entry(_('Type'), self.ntype)
|
self.add_entry(_('Type'), self.ntype)
|
||||||
self.add_entry(_('Tag'), self.tag)
|
self.add_entry(_('Tag'), self.tag)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text('')
|
self.filter_id.set_text('')
|
||||||
|
@ -72,10 +72,10 @@ class PersonSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_name = gtk.Entry()
|
self.filter_name = widgets.BasicEntry()
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_birth = gtk.Entry()
|
self.filter_birth = widgets.BasicEntry()
|
||||||
self.filter_death = gtk.Entry()
|
self.filter_death = widgets.BasicEntry()
|
||||||
self.filter_event = gen.lib.Event()
|
self.filter_event = gen.lib.Event()
|
||||||
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
|
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
|
||||||
self.etype = gtk.ComboBoxEntry()
|
self.etype = gtk.ComboBoxEntry()
|
||||||
@ -84,7 +84,7 @@ class PersonSidebarFilter(SidebarFilter):
|
|||||||
self.filter_event.set_type,
|
self.filter_event.set_type,
|
||||||
self.filter_event.get_type)
|
self.filter_event.get_type)
|
||||||
|
|
||||||
self.filter_note = gtk.Entry()
|
self.filter_note = widgets.BasicEntry()
|
||||||
self.filter_gender = gtk.combo_box_new_text()
|
self.filter_gender = gtk.combo_box_new_text()
|
||||||
map(self.filter_gender.append_text,
|
map(self.filter_gender.append_text,
|
||||||
[ _('any'), _('male'), _('female'), _('unknown') ])
|
[ _('any'), _('male'), _('female'), _('unknown') ])
|
||||||
@ -111,6 +111,8 @@ class PersonSidebarFilter(SidebarFilter):
|
|||||||
self.tag.pack_start(cell, True)
|
self.tag.pack_start(cell, True)
|
||||||
self.tag.add_attribute(cell, 'text', 0)
|
self.tag.add_attribute(cell, 'text', 0)
|
||||||
|
|
||||||
|
self.etype.child.set_width_chars(5)
|
||||||
|
|
||||||
exdate1 = gen.lib.Date()
|
exdate1 = gen.lib.Date()
|
||||||
exdate2 = gen.lib.Date()
|
exdate2 = gen.lib.Date()
|
||||||
exdate1.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_RANGE,
|
exdate1.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_RANGE,
|
||||||
@ -133,7 +135,7 @@ class PersonSidebarFilter(SidebarFilter):
|
|||||||
self.add_text_entry(_('Note'), self.filter_note)
|
self.add_text_entry(_('Note'), self.filter_note)
|
||||||
self.add_entry(_('Tag'), self.tag)
|
self.add_entry(_('Tag'), self.tag)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_name.set_text(u'')
|
self.filter_name.set_text(u'')
|
||||||
|
@ -41,7 +41,7 @@ import gtk
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from gui import widgets
|
||||||
from Filters.SideBar import SidebarFilter
|
from Filters.SideBar import SidebarFilter
|
||||||
from Filters import GenericFilterFactory, build_filter_model, Rules
|
from Filters import GenericFilterFactory, build_filter_model, Rules
|
||||||
from Filters.Rules.Place import (RegExpIdOf, HasIdOf, HasPlace, HasNoteRegexp,
|
from Filters.Rules.Place import (RegExpIdOf, HasIdOf, HasPlace, HasNoteRegexp,
|
||||||
@ -58,17 +58,18 @@ class PlaceSidebarFilter(SidebarFilter):
|
|||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
|
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_title = gtk.Entry()
|
self.filter_title = widgets.BasicEntry()
|
||||||
self.filter_street = gtk.Entry()
|
self.filter_street = widgets.BasicEntry()
|
||||||
self.filter_locality = gtk.Entry()
|
self.filter_locality = widgets.BasicEntry()
|
||||||
self.filter_city = gtk.Entry()
|
self.filter_city = widgets.BasicEntry()
|
||||||
self.filter_county = gtk.Entry()
|
self.filter_county = widgets.BasicEntry()
|
||||||
self.filter_state = gtk.Entry()
|
self.filter_state = widgets.BasicEntry()
|
||||||
self.filter_country = gtk.Entry()
|
self.filter_country = widgets.BasicEntry()
|
||||||
self.filter_zip = gtk.Entry()
|
self.filter_zip = widgets.BasicEntry()
|
||||||
self.filter_parish = gtk.Entry()
|
self.filter_parish = widgets.BasicEntry()
|
||||||
self.filter_note = gtk.Entry()
|
self.filter_note = widgets.BasicEntry()
|
||||||
|
|
||||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
self.generic = gtk.ComboBox()
|
self.generic = gtk.ComboBox()
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ class PlaceSidebarFilter(SidebarFilter):
|
|||||||
self.add_text_entry(_('Church parish'), self.filter_parish)
|
self.add_text_entry(_('Church parish'), self.filter_parish)
|
||||||
self.add_text_entry(_('Note'), self.filter_note)
|
self.add_text_entry(_('Note'), self.filter_note)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text('')
|
self.filter_id.set_text('')
|
||||||
|
@ -58,10 +58,10 @@ class RepoSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_title = gtk.Entry()
|
self.filter_title = widgets.BasicEntry()
|
||||||
self.filter_address = gtk.Entry()
|
self.filter_address = widgets.BasicEntry()
|
||||||
self.filter_url = gtk.Entry()
|
self.filter_url = widgets.BasicEntry()
|
||||||
|
|
||||||
self.repo = Repository()
|
self.repo = Repository()
|
||||||
self.repo.set_type((RepositoryType.CUSTOM,''))
|
self.repo.set_type((RepositoryType.CUSTOM,''))
|
||||||
@ -71,7 +71,7 @@ class RepoSidebarFilter(SidebarFilter):
|
|||||||
self.repo.set_type,
|
self.repo.set_type,
|
||||||
self.repo.get_type)
|
self.repo.get_type)
|
||||||
|
|
||||||
self.filter_note = gtk.Entry()
|
self.filter_note = widgets.BasicEntry()
|
||||||
|
|
||||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
|
|
||||||
@ -87,6 +87,8 @@ class RepoSidebarFilter(SidebarFilter):
|
|||||||
self.generic.add_attribute(cell, 'text', 0)
|
self.generic.add_attribute(cell, 'text', 0)
|
||||||
self.on_filters_changed('Repository')
|
self.on_filters_changed('Repository')
|
||||||
|
|
||||||
|
self.rtype.child.set_width_chars(5)
|
||||||
|
|
||||||
self.add_text_entry(_('ID'), self.filter_id)
|
self.add_text_entry(_('ID'), self.filter_id)
|
||||||
self.add_text_entry(_('Name'), self.filter_title)
|
self.add_text_entry(_('Name'), self.filter_title)
|
||||||
self.add_entry(_('Type'), self.rtype)
|
self.add_entry(_('Type'), self.rtype)
|
||||||
@ -94,7 +96,7 @@ class RepoSidebarFilter(SidebarFilter):
|
|||||||
self.add_text_entry(_('URL'), self.filter_url)
|
self.add_text_entry(_('URL'), self.filter_url)
|
||||||
self.add_text_entry(_('Note'), self.filter_note)
|
self.add_text_entry(_('Note'), self.filter_note)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text('')
|
self.filter_id.set_text('')
|
||||||
|
@ -34,7 +34,7 @@ _RETURN = gtk.gdk.keyval_from_name("Return")
|
|||||||
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
|
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
|
||||||
|
|
||||||
class SidebarFilter(DbGUIElement):
|
class SidebarFilter(DbGUIElement):
|
||||||
_FILTER_WIDTH = 200
|
_FILTER_WIDTH = 20
|
||||||
_FILTER_ELLIPSIZE = pango.ELLIPSIZE_END
|
_FILTER_ELLIPSIZE = pango.ELLIPSIZE_END
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, namespace):
|
def __init__(self, dbstate, uistate, namespace):
|
||||||
@ -47,7 +47,9 @@ class SidebarFilter(DbGUIElement):
|
|||||||
DbGUIElement.__init__(self, dbstate.db)
|
DbGUIElement.__init__(self, dbstate.db)
|
||||||
|
|
||||||
self.position = 1
|
self.position = 1
|
||||||
|
self.vbox = gtk.VBox()
|
||||||
self.table = gtk.Table(4, 11)
|
self.table = gtk.Table(4, 11)
|
||||||
|
self.vbox.pack_start(self.table, False, False)
|
||||||
self.table.set_border_width(6)
|
self.table.set_border_width(6)
|
||||||
self.table.set_row_spacings(6)
|
self.table.set_row_spacings(6)
|
||||||
self.table.set_col_spacing(0, 6)
|
self.table.set_col_spacing(0, 6)
|
||||||
@ -83,16 +85,18 @@ class SidebarFilter(DbGUIElement):
|
|||||||
self.clear_btn.add(hbox)
|
self.clear_btn.add(hbox)
|
||||||
self.clear_btn.connect('clicked', self.clear)
|
self.clear_btn.connect('clicked', self.clear)
|
||||||
|
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HButtonBox()
|
||||||
|
hbox.set_layout(gtk.BUTTONBOX_START)
|
||||||
hbox.set_spacing(6)
|
hbox.set_spacing(6)
|
||||||
|
hbox.set_border_width(12)
|
||||||
hbox.add(self.apply_btn)
|
hbox.add(self.apply_btn)
|
||||||
hbox.add(self.clear_btn)
|
hbox.add(self.clear_btn)
|
||||||
hbox.show()
|
hbox.show()
|
||||||
self.table.attach(hbox, 2, 4, self.position, self.position+1,
|
self.vbox.pack_start(hbox, False, False)
|
||||||
xoptions=gtk.FILL, yoptions=0)
|
self.vbox.show()
|
||||||
|
|
||||||
def get_widget(self):
|
def get_widget(self):
|
||||||
return self.table
|
return self.vbox
|
||||||
|
|
||||||
def create_widget(self):
|
def create_widget(self):
|
||||||
pass
|
pass
|
||||||
@ -111,6 +115,11 @@ class SidebarFilter(DbGUIElement):
|
|||||||
def get_filter(self):
|
def get_filter(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def add_regex_entry(self, widget):
|
||||||
|
hbox = gtk.HBox()
|
||||||
|
hbox.pack_start(widget, False, False, 12)
|
||||||
|
self.vbox.pack_start(hbox, False, False)
|
||||||
|
|
||||||
def add_text_entry(self, name, widget, tooltip=None):
|
def add_text_entry(self, name, widget, tooltip=None):
|
||||||
self.add_entry(name, widget)
|
self.add_entry(name, widget)
|
||||||
widget.connect('key-press-event', self.key_press)
|
widget.connect('key-press-event', self.key_press)
|
||||||
@ -129,7 +138,7 @@ class SidebarFilter(DbGUIElement):
|
|||||||
1, 2, self.position, self.position+1,
|
1, 2, self.position, self.position+1,
|
||||||
xoptions=gtk.FILL, yoptions=0)
|
xoptions=gtk.FILL, yoptions=0)
|
||||||
self.table.attach(widget, 2, 4, self.position, self.position+1,
|
self.table.attach(widget, 2, 4, self.position, self.position+1,
|
||||||
xoptions=gtk.FILL, yoptions=0)
|
xoptions=gtk.FILL|gtk.EXPAND, yoptions=0)
|
||||||
self.position += 1
|
self.position += 1
|
||||||
|
|
||||||
def on_filters_changed(self, namespace):
|
def on_filters_changed(self, namespace):
|
||||||
@ -208,8 +217,8 @@ class SidebarFilter(DbGUIElement):
|
|||||||
Adds the text and widget to GUI, with an Edit button.
|
Adds the text and widget to GUI, with an Edit button.
|
||||||
"""
|
"""
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
hbox.pack_start(widget)
|
hbox.pack_start(widget, True, True)
|
||||||
hbox.pack_start(widgets.SimpleButton(gtk.STOCK_EDIT, self.edit_filter))
|
hbox.pack_start(widgets.SimpleButton(gtk.STOCK_EDIT, self.edit_filter), False, False)
|
||||||
self.add_entry(text, hbox)
|
self.add_entry(text, hbox)
|
||||||
|
|
||||||
def edit_filter(self, obj):
|
def edit_filter(self, obj):
|
||||||
|
@ -39,6 +39,7 @@ import gtk
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from gui import widgets
|
||||||
from Filters.SideBar import SidebarFilter
|
from Filters.SideBar import SidebarFilter
|
||||||
from Filters import GenericFilterFactory, build_filter_model, Rules
|
from Filters import GenericFilterFactory, build_filter_model, Rules
|
||||||
from Filters.Rules.Source import (RegExpIdOf, HasIdOf, HasSource,
|
from Filters.Rules.Source import (RegExpIdOf, HasIdOf, HasSource,
|
||||||
@ -55,11 +56,11 @@ class SourceSidebarFilter(SidebarFilter):
|
|||||||
|
|
||||||
def __init__(self, dbstate, uistate, clicked):
|
def __init__(self, dbstate, uistate, clicked):
|
||||||
self.clicked_func = clicked
|
self.clicked_func = clicked
|
||||||
self.filter_id = gtk.Entry()
|
self.filter_id = widgets.BasicEntry()
|
||||||
self.filter_title = gtk.Entry()
|
self.filter_title = widgets.BasicEntry()
|
||||||
self.filter_author = gtk.Entry()
|
self.filter_author = widgets.BasicEntry()
|
||||||
self.filter_pub = gtk.Entry()
|
self.filter_pub = widgets.BasicEntry()
|
||||||
self.filter_note = gtk.Entry()
|
self.filter_note = widgets.BasicEntry()
|
||||||
|
|
||||||
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ class SourceSidebarFilter(SidebarFilter):
|
|||||||
self.add_text_entry(_('Publication'), self.filter_pub)
|
self.add_text_entry(_('Publication'), self.filter_pub)
|
||||||
self.add_text_entry(_('Note'), self.filter_note)
|
self.add_text_entry(_('Note'), self.filter_note)
|
||||||
self.add_filter_entry(_('Custom filter'), self.generic)
|
self.add_filter_entry(_('Custom filter'), self.generic)
|
||||||
self.add_entry(None, self.filter_regex)
|
self.add_regex_entry(self.filter_regex)
|
||||||
|
|
||||||
def clear(self, obj):
|
def clear(self, obj):
|
||||||
self.filter_id.set_text('')
|
self.filter_id.set_text('')
|
||||||
|
@ -314,7 +314,11 @@ class GrampsBar(gtk.Notebook):
|
|||||||
"""
|
"""
|
||||||
Add a tab to the notebook for the given gramplet.
|
Add a tab to the notebook for the given gramplet.
|
||||||
"""
|
"""
|
||||||
gramplet.set_size_request(gramplet.width, gramplet.height)
|
if self.uistate.netbook_mode():
|
||||||
|
gramplet.set_size_request(225, 120)
|
||||||
|
else:
|
||||||
|
gramplet.set_size_request(285, 200)
|
||||||
|
|
||||||
page_num = self.append_page(gramplet)
|
page_num = self.append_page(gramplet)
|
||||||
return page_num
|
return page_num
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/gui/widgets
|
|||||||
|
|
||||||
pkgdata_PYTHON = \
|
pkgdata_PYTHON = \
|
||||||
__init__.py \
|
__init__.py \
|
||||||
|
basicentry.py \
|
||||||
buttons.py \
|
buttons.py \
|
||||||
expandcollapsearrow.py \
|
expandcollapsearrow.py \
|
||||||
grampletpane.py \
|
grampletpane.py \
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
"""Custom widgets."""
|
"""Custom widgets."""
|
||||||
|
|
||||||
|
from basicentry import *
|
||||||
from buttons import *
|
from buttons import *
|
||||||
from expandcollapsearrow import *
|
from expandcollapsearrow import *
|
||||||
from labels import *
|
from labels import *
|
||||||
|
50
src/gui/widgets/basicentry.py
Normal file
50
src/gui/widgets/basicentry.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 Nick Hall
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
__all__ = ["BasicEntry"]
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import logging
|
||||||
|
_LOG = logging.getLogger(".widgets.basicentry")
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GTK/Gnome modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import gtk
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# BasicEntry class
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class BasicEntry(gtk.Entry):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
gtk.Entry.__init__(self)
|
||||||
|
self.set_width_chars(5)
|
||||||
|
self.show()
|
@ -44,7 +44,7 @@ class Photo(gtk.EventBox):
|
|||||||
"""
|
"""
|
||||||
Displays an image and allows it to be viewed in an external image viewer.
|
Displays an image and allows it to be viewed in an external image viewer.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self, netbook_mode=False):
|
||||||
gtk.EventBox.__init__(self)
|
gtk.EventBox.__init__(self)
|
||||||
self.full_path = None
|
self.full_path = None
|
||||||
self.photo = gtk.Image()
|
self.photo = gtk.Image()
|
||||||
@ -53,6 +53,9 @@ class Photo(gtk.EventBox):
|
|||||||
tip = _('Double-click on the picture to view it in the default image '
|
tip = _('Double-click on the picture to view it in the default image '
|
||||||
'viewer application.')
|
'viewer application.')
|
||||||
self.set_tooltip_text(tip)
|
self.set_tooltip_text(tip)
|
||||||
|
self.__size = ThumbNails.SIZE_LARGE
|
||||||
|
if netbook_mode:
|
||||||
|
self.__size = ThumbNails.SIZE_NORMAL
|
||||||
|
|
||||||
def set_image(self, full_path, mime_type=None, rectangle=None):
|
def set_image(self, full_path, mime_type=None, rectangle=None):
|
||||||
"""
|
"""
|
||||||
@ -63,7 +66,7 @@ class Photo(gtk.EventBox):
|
|||||||
pixbuf = ThumbNails.get_thumbnail_image(full_path,
|
pixbuf = ThumbNails.get_thumbnail_image(full_path,
|
||||||
mime_type,
|
mime_type,
|
||||||
rectangle,
|
rectangle,
|
||||||
ThumbNails.SIZE_LARGE)
|
self.__size)
|
||||||
self.photo.set_from_pixbuf(pixbuf)
|
self.photo.set_from_pixbuf(pixbuf)
|
||||||
self.photo.show()
|
self.photo.show()
|
||||||
else:
|
else:
|
||||||
|
@ -39,6 +39,8 @@ class CalendarGramplet(Gramplet):
|
|||||||
self.set_tooltip(_("Double-click a day for details"))
|
self.set_tooltip(_("Double-click a day for details"))
|
||||||
self.gui.calendar = gtk.Calendar()
|
self.gui.calendar = gtk.Calendar()
|
||||||
self.gui.calendar.connect('day-selected-double-click', self.double_click)
|
self.gui.calendar.connect('day-selected-double-click', self.double_click)
|
||||||
|
if self.uistate.netbook_mode():
|
||||||
|
self.gui.calendar.set_display_options(gtk.CALENDAR_SHOW_HEADING)
|
||||||
self.gui.get_container_widget().remove(self.gui.textview)
|
self.gui.get_container_widget().remove(self.gui.textview)
|
||||||
self.gui.get_container_widget().add_with_viewport(self.gui.calendar)
|
self.gui.get_container_widget().add_with_viewport(self.gui.calendar)
|
||||||
self.gui.calendar.show()
|
self.gui.calendar.show()
|
||||||
|
@ -61,7 +61,7 @@ class Gallery(Gramplet):
|
|||||||
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
||||||
mime_type = media.get_mime_type()
|
mime_type = media.get_mime_type()
|
||||||
if mime_type and mime_type.startswith("image"):
|
if mime_type and mime_type.startswith("image"):
|
||||||
photo = Photo()
|
photo = Photo(self.uistate.netbook_mode())
|
||||||
photo.set_image(full_path, mime_type, media_ref.get_rectangle())
|
photo.set_image(full_path, mime_type, media_ref.get_rectangle())
|
||||||
self.image_list.append(photo)
|
self.image_list.append(photo)
|
||||||
self.top.pack_start(photo, expand=False, fill=False)
|
self.top.pack_start(photo, expand=False, fill=False)
|
||||||
|
@ -38,7 +38,7 @@ class MediaPreview(Gramplet):
|
|||||||
Build the GUI interface.
|
Build the GUI interface.
|
||||||
"""
|
"""
|
||||||
self.top = gtk.HBox()
|
self.top = gtk.HBox()
|
||||||
self.photo = Photo()
|
self.photo = Photo(self.uistate.netbook_mode())
|
||||||
self.top.pack_start(self.photo, fill=True, expand=False, padding=5)
|
self.top.pack_start(self.photo, fill=True, expand=False, padding=5)
|
||||||
self.top.show_all()
|
self.top.show_all()
|
||||||
return self.top
|
return self.top
|
||||||
|
@ -45,7 +45,7 @@ class PersonDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
self.top = gtk.HBox()
|
self.top = gtk.HBox()
|
||||||
vbox = gtk.VBox()
|
vbox = gtk.VBox()
|
||||||
self.photo = Photo()
|
self.photo = Photo(self.uistate.netbook_mode())
|
||||||
self.photo.show()
|
self.photo.show()
|
||||||
self.name = gtk.Label()
|
self.name = gtk.Label()
|
||||||
self.name.set_alignment(0, 0)
|
self.name.set_alignment(0, 0)
|
||||||
|
@ -42,7 +42,7 @@ class PlaceDetails(Gramplet):
|
|||||||
"""
|
"""
|
||||||
self.top = gtk.HBox()
|
self.top = gtk.HBox()
|
||||||
vbox = gtk.VBox()
|
vbox = gtk.VBox()
|
||||||
self.photo = Photo()
|
self.photo = Photo(self.uistate.netbook_mode())
|
||||||
self.title = gtk.Label()
|
self.title = gtk.Label()
|
||||||
self.title.set_alignment(0, 0)
|
self.title.set_alignment(0, 0)
|
||||||
self.title.modify_font(pango.FontDescription('sans bold 12'))
|
self.title.modify_font(pango.FontDescription('sans bold 12'))
|
||||||
|
Loading…
Reference in New Issue
Block a user