Reorganize custom widgets into a new 'widgets' package.

1. moving existing widget modules under src/widgets/


svn: r10694
This commit is contained in:
Zsolt Foldvari 2008-05-08 19:40:56 +00:00
parent 9fb61bec46
commit 05b39c5c15
38 changed files with 210 additions and 170 deletions

View File

@ -50,7 +50,7 @@ from Utils import media_path_full
import DateHandler
import ThumbNails
import Config
import GrampsWidgets
import widgets
import Errors
import gen.utils
@ -521,15 +521,15 @@ class RelationshipView(PageView.PersonNavView):
name = name_displayer.display(person)
fmt = '<span size="larger" weight="bold">%s</span>'
text = fmt % cgi.escape(name)
label = GrampsWidgets.DualMarkupLabel(text, _GenderCode[person.gender],
x_align=1, y_align=0)
label = widgets.DualMarkupLabel(text, _GenderCode[person.gender],
x_align=1, y_align=0)
if Config.get(Config.RELEDITBTN):
button = GrampsWidgets.IconButton(self.edit_button_press,
person.handle)
button = widgets.IconButton(self.edit_button_press,
person.handle)
self.tooltips.set_tip(button, _('Edit %s') % name)
else:
button = None
hbox = GrampsWidgets.LinkBox(label, button)
hbox = widgets.LinkBox(label, button)
table.attach(hbox, 0, 2, 0, 1)
@ -544,9 +544,9 @@ class RelationshipView(PageView.PersonNavView):
# GRAMPS ID
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % _('ID')),
subtbl.attach(widgets.BasicLabel("%s:" % _('ID')),
1, 2, 0, 1, xoptions=gtk.FILL, yoptions=0)
subtbl.attach(GrampsWidgets.BasicLabel(person.gramps_id),
subtbl.attach(widgets.BasicLabel(person.gramps_id),
2, 3, 0, 1, yoptions=0)
# Birth event.
@ -556,9 +556,9 @@ class RelationshipView(PageView.PersonNavView):
else:
birth_title = _("Birth")
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % birth_title),
subtbl.attach(widgets.BasicLabel("%s:" % birth_title),
1, 2, 1, 2, xoptions=gtk.FILL, yoptions=0)
subtbl.attach(GrampsWidgets.BasicLabel(self.format_event(birth)),
subtbl.attach(widgets.BasicLabel(self.format_event(birth)),
2, 3, 1, 2, yoptions=0)
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
@ -567,9 +567,9 @@ class RelationshipView(PageView.PersonNavView):
else:
death_title = _("Death")
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % death_title),
subtbl.attach(widgets.BasicLabel("%s:" % death_title),
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
subtbl.attach(GrampsWidgets.BasicLabel(self.format_event(death)),
subtbl.attach(widgets.BasicLabel(self.format_event(death)),
2, 3, 2, 3, yoptions=0)
@ -649,10 +649,10 @@ class RelationshipView(PageView.PersonNavView):
return ''
def write_person_data(self, title, data):
self.attach.attach(GrampsWidgets.BasicLabel(title), _ALABEL_START,
self.attach.attach(widgets.BasicLabel(title), _ALABEL_START,
_ALABEL_STOP, self.row, self.row+1,
xoptions=gtk.FILL|gtk.SHRINK)
self.attach.attach(GrampsWidgets.BasicLabel(data),
self.attach.attach(widgets.BasicLabel(data),
_ADATA_START, _ADATA_STOP,
self.row, self.row+1)
self.row += 1
@ -660,17 +660,17 @@ class RelationshipView(PageView.PersonNavView):
def write_label(self, title, family, is_parent, person = None):
msg = '<span style="italic" weight="heavy">%s</span>' % cgi.escape(title)
hbox = gtk.HBox()
label = GrampsWidgets.MarkupLabel(msg, x_align=1)
label = widgets.MarkupLabel(msg, x_align=1)
# Draw the collapse/expand button:
if family != None:
if self.check_collapsed(person.handle, family.handle):
arrow = GrampsWidgets.ExpandCollapseArrow(True,
self.expand_collapse_press,
(person, family.handle))
arrow = widgets.ExpandCollapseArrow(True,
self.expand_collapse_press,
(person, family.handle))
else:
arrow = GrampsWidgets.ExpandCollapseArrow(False,
self.expand_collapse_press,
(person, family.handle))
arrow = widgets.ExpandCollapseArrow(False,
self.expand_collapse_press,
(person, family.handle))
else :
arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_OUT)
hbox.pack_start(arrow, False)
@ -683,7 +683,7 @@ class RelationshipView(PageView.PersonNavView):
value = family.gramps_id
else:
value = ""
self.attach.attach(GrampsWidgets.BasicLabel(value),
self.attach.attach(widgets.BasicLabel(value),
_DATA_START, _DATA_STOP,
self.row, self.row+1, gtk.SHRINK|gtk.FILL)
@ -713,28 +713,29 @@ class RelationshipView(PageView.PersonNavView):
if not self.toolbar_visible and not self.dbstate.db.readonly:
# Show edit-Buttons if toolbar is not visible
if self.reorder_sensitive:
add = GrampsWidgets.IconButton(self.reorder, None,
gtk.STOCK_SORT_ASCENDING)
add = widgets.IconButton(self.reorder, None,
gtk.STOCK_SORT_ASCENDING)
self.tooltips.set_tip(add, ord_msg)
hbox.pack_start(add, False)
add = GrampsWidgets.IconButton(call_fcn, None, gtk.STOCK_ADD)
add = widgets.IconButton(call_fcn, None, gtk.STOCK_ADD)
self.tooltips.set_tip(add, add_msg)
hbox.pack_start(add, False)
if is_parent:
add = GrampsWidgets.IconButton(self.select_family, None, gtk.STOCK_INDEX)
add = widgets.IconButton(self.select_family, None,
gtk.STOCK_INDEX)
self.tooltips.set_tip(add, sel_msg)
hbox.pack_start(add, False)
if family:
edit = GrampsWidgets.IconButton(self.edit_family, family.handle,
gtk.STOCK_EDIT)
edit = widgets.IconButton(self.edit_family, family.handle,
gtk.STOCK_EDIT)
self.tooltips.set_tip(edit, edit_msg)
hbox.pack_start(edit, False)
if not self.dbstate.db.readonly:
delete = GrampsWidgets.IconButton(del_fcn, family.handle,
gtk.STOCK_REMOVE)
delete = widgets.IconButton(del_fcn, family.handle,
gtk.STOCK_REMOVE)
self.tooltips.set_tip(delete, del_msg)
hbox.pack_start(delete, False)
self.attach.attach(hbox, _BTN_START, _BTN_STOP, self.row, self.row+1)
@ -790,13 +791,13 @@ class RelationshipView(PageView.PersonNavView):
active = self.dbstate.active.handle
hbox = gtk.HBox()
if self.check_collapsed(person.handle, "SIBLINGS"):
arrow = GrampsWidgets.ExpandCollapseArrow(True,
self.expand_collapse_press,
(person, "SIBLINGS"))
arrow = widgets.ExpandCollapseArrow(True,
self.expand_collapse_press,
(person, "SIBLINGS"))
else:
arrow = GrampsWidgets.ExpandCollapseArrow(False,
self.expand_collapse_press,
(person, "SIBLINGS"))
arrow = widgets.ExpandCollapseArrow(False,
self.expand_collapse_press,
(person, "SIBLINGS"))
hbox.pack_start(arrow, False)
label_cell = self.build_label_cell(_('Siblings'))
hbox.pack_start(label_cell, True)
@ -837,16 +838,14 @@ class RelationshipView(PageView.PersonNavView):
self.row += 1 # now advance it
else:
hbox = gtk.HBox()
addchild = GrampsWidgets.IconButton(
self.add_child_to_fam,
family.handle,
gtk.STOCK_ADD)
addchild = widgets.IconButton(self.add_child_to_fam,
family.handle,
gtk.STOCK_ADD)
self.tooltips.set_tip(addchild,
_('Add new child to family'))
selchild = GrampsWidgets.IconButton(
self.sel_child_to_fam,
family.handle,
gtk.STOCK_INDEX)
selchild = widgets.IconButton(self.sel_child_to_fam,
family.handle,
gtk.STOCK_INDEX)
self.tooltips.set_tip(selchild,
_('Add existing child to family'))
hbox.pack_start(addchild, False)
@ -886,17 +885,16 @@ class RelationshipView(PageView.PersonNavView):
initial_name = False
if handle:
name = self.get_name(handle, True)
link_label = GrampsWidgets.LinkLabel(
name, self._button_press, handle)
link_label = widgets.LinkLabel(name, self._button_press, handle)
if self.use_shade:
link_label.modify_bg(gtk.STATE_NORMAL, self.color)
if Config.get(Config.RELEDITBTN):
button = GrampsWidgets.IconButton(self.edit_button_press,
handle)
button = widgets.IconButton(self.edit_button_press,
handle)
self.tooltips.set_tip(button, _('Edit %s') % name[0])
else:
button = None
vbox.pack_start(GrampsWidgets.LinkBox(link_label, button),
vbox.pack_start(widgets.LinkBox(link_label, button),
expand=False)
else:
link_label = gtk.Label(_('Unknown'))
@ -914,8 +912,8 @@ class RelationshipView(PageView.PersonNavView):
else:
format = "%s"
label = GrampsWidgets.MarkupLabel(format % cgi.escape(title),
x_align=1, y_align=0)
label = widgets.MarkupLabel(format % cgi.escape(title),
x_align=1, y_align=0)
if Config.get(Config.RELEDITBTN):
label.set_padding(0, 5)
self.attach.attach(label, _PLABEL_START, _PLABEL_STOP, self.row,
@ -926,16 +924,15 @@ class RelationshipView(PageView.PersonNavView):
if handle:
name = self.get_name(handle, True)
link_label = GrampsWidgets.LinkLabel(
name, self._button_press, handle)
link_label = widgets.LinkLabel(name, self._button_press, handle)
if self.use_shade:
link_label.modify_bg(gtk.STATE_NORMAL, self.color)
if Config.get(Config.RELEDITBTN):
button = GrampsWidgets.IconButton(self.edit_button_press, handle)
button = widgets.IconButton(self.edit_button_press, handle)
self.tooltips.set_tip(button, _('Edit %s') % name[0])
else:
button = None
vbox.pack_start(GrampsWidgets.LinkBox(link_label, button))
vbox.pack_start(widgets.LinkBox(link_label, button))
else:
link_label = gtk.Label(_('Unknown'))
link_label.set_alignment(0, 1)
@ -945,7 +942,7 @@ class RelationshipView(PageView.PersonNavView):
if self.show_details:
value = self.info_string(handle)
if value:
vbox.pack_start(GrampsWidgets.MarkupLabel(value))
vbox.pack_start(widgets.MarkupLabel(value))
eventbox = gtk.EventBox()
if self.use_shade:
@ -963,8 +960,8 @@ class RelationshipView(PageView.PersonNavView):
else:
format = "%s"
lbl = GrampsWidgets.MarkupLabel(format % cgi.escape(title),
x_align=1, y_align=.5)
lbl = widgets.MarkupLabel(format % cgi.escape(title),
x_align=1, y_align=.5)
if Config.get(Config.RELEDITBTN):
lbl.set_padding(0, 5)
return lbl
@ -1006,23 +1003,23 @@ class RelationshipView(PageView.PersonNavView):
link_func = None
name = self.get_name(handle, True)
link_label = GrampsWidgets.LinkLabel(name, link_func, handle, format)
link_label = widgets.LinkLabel(name, link_func, handle, format)
if self.use_shade:
link_label.modify_bg(gtk.STATE_NORMAL, self.color)
link_label.set_padding(3, 0)
if child_should_be_linked and Config.get(Config.RELEDITBTN):
button = GrampsWidgets.IconButton(self.edit_button_press, handle)
button = widgets.IconButton(self.edit_button_press, handle)
self.tooltips.set_tip(button, _('Edit %s') % name[0])
else:
button = None
hbox = gtk.HBox()
l = GrampsWidgets.BasicLabel("%d." % index)
l = widgets.BasicLabel("%d." % index)
l.set_width_chars(3)
l.set_alignment(1.0, 0.5)
hbox.pack_start(l, False, False, 0)
hbox.pack_start(GrampsWidgets.LinkBox(link_label, button),
hbox.pack_start(widgets.LinkBox(link_label, button),
False, False, 4)
hbox.show()
vbox.pack_start(hbox)
@ -1030,13 +1027,13 @@ class RelationshipView(PageView.PersonNavView):
if self.show_details:
value = self.info_string(handle)
if value:
l = GrampsWidgets.MarkupLabel(value)
l = widgets.MarkupLabel(value)
l.set_padding(48, 0)
vbox.add(l)
def write_data(self, box, title, start_col=_SDATA_START,
stop_col=_SDATA_STOP):
box.add(GrampsWidgets.BasicLabel(title))
box.add(widgets.BasicLabel(title))
def info_string(self, handle):
person = self.dbstate.db.get_person_from_handle(handle)
@ -1137,7 +1134,7 @@ class RelationshipView(PageView.PersonNavView):
def write_relationship(self, box, family):
msg = _('Relationship type: %s') % cgi.escape(str(family.get_relationship()))
box.add(GrampsWidgets.MarkupLabel(msg))
box.add(widgets.MarkupLabel(msg))
def place_name(self, handle):
p = self.dbstate.db.get_place_from_handle(handle)
@ -1242,13 +1239,13 @@ class RelationshipView(PageView.PersonNavView):
hbox = gtk.HBox()
if self.check_collapsed(person.handle, "CHILDREN"):
arrow = GrampsWidgets.ExpandCollapseArrow(True,
self.expand_collapse_press,
(person, "CHILDREN"))
arrow = widgets.ExpandCollapseArrow(True,
self.expand_collapse_press,
(person, "CHILDREN"))
else:
arrow = GrampsWidgets.ExpandCollapseArrow(False,
self.expand_collapse_press,
(person, "CHILDREN"))
arrow = widgets.ExpandCollapseArrow(False,
self.expand_collapse_press,
(person, "CHILDREN"))
hbox.pack_start(arrow, False)
label_cell = self.build_label_cell(_('Children'))
hbox.pack_start(label_cell, True)
@ -1281,16 +1278,14 @@ class RelationshipView(PageView.PersonNavView):
self.row += 1 # now advance it
else:
hbox = gtk.HBox()
addchild = GrampsWidgets.IconButton(
self.add_child_to_fam,
family.handle,
gtk.STOCK_ADD)
addchild = widgets.IconButton(self.add_child_to_fam,
family.handle,
gtk.STOCK_ADD)
self.tooltips.set_tip(addchild,
_('Add new child to family'))
selchild = GrampsWidgets.IconButton(
self.sel_child_to_fam,
family.handle,
gtk.STOCK_INDEX)
selchild = widgets.IconButton(self.sel_child_to_fam,
family.handle,
gtk.STOCK_INDEX)
self.tooltips.set_tip(selchild,
_('Add existing child to family'))
hbox.pack_start(addchild, False)

View File

@ -40,7 +40,7 @@ import gtk
#
#-------------------------------------------------------------------------
import Errors
from GrampsWidgets import SimpleButton
from widgets import SimpleButton
from _EmbeddedList import EmbeddedList
#-------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ import gtk
# GRAMPS classes
#
#-------------------------------------------------------------------------
from GrampsWidgets import SimpleButton
from widgets import SimpleButton
from _GrampsTab import GrampsTab
import Errors

View File

@ -51,7 +51,7 @@ from _EditSecondary import EditSecondary
from gen.lib import NoteType
from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import MonitoredDate, MonitoredEntry, PrivacyButton
from widgets import MonitoredDate, MonitoredEntry, PrivacyButton
#-------------------------------------------------------------------------
#

View File

@ -51,7 +51,7 @@ from _EditSecondary import EditSecondary
from gen.lib import NoteType
from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType
from widgets import MonitoredEntry, PrivacyButton, MonitoredDataType
#-------------------------------------------------------------------------
#

View File

@ -51,7 +51,7 @@ from gen.lib import NoteType
import Errors
from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import MonitoredDataType, PrivacyButton
from widgets import MonitoredDataType, PrivacyButton
from BasicUtils import name_displayer
#-------------------------------------------------------------------------

View File

@ -48,8 +48,8 @@ from Editors import EditPrimary
from QuestionDialog import ErrorDialog
from DisplayTabs import (SourceEmbedList, NoteTab, GalleryTab,
EventBackRefList, AttrEmbedList)
from GrampsWidgets import (MonitoredEntry, PlaceEntry, PrivacyButton,
MonitoredDataType, MonitoredDate)
from widgets import (MonitoredEntry, PlaceEntry, PrivacyButton,
MonitoredDataType, MonitoredDate)
#-------------------------------------------------------------------------
#

View File

@ -45,8 +45,8 @@ import gen.lib
from DisplayTabs import (SourceEmbedList, NoteTab, GalleryTab,
EventBackRefList, AttrEmbedList)
from GrampsWidgets import (PrivacyButton, MonitoredEntry, PlaceEntry,
MonitoredDate, MonitoredDataType)
from widgets import (PrivacyButton, MonitoredEntry, PlaceEntry,
MonitoredDate, MonitoredDataType)
from _EditReference import RefTab, EditReference
#-------------------------------------------------------------------------

View File

@ -64,8 +64,8 @@ from ReportBase import ReportUtils
from DisplayTabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab,
FamilyLdsEmbedList, ChildModel)
from GrampsWidgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
IconButton, LinkBox, BasicLabel)
from widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
IconButton, LinkBox, BasicLabel)
from ReportBase import CATEGORY_QR_FAMILY
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog)

View File

@ -54,8 +54,8 @@ import LdsUtils
from _EditSecondary import EditSecondary
from DisplayTabs import SourceEmbedList,NoteTab
from GrampsWidgets import (PrivacyButton, MonitoredDate, PlaceEntry,
MonitoredMenu, MonitoredStrMenu)
from widgets import (PrivacyButton, MonitoredDate, PlaceEntry,
MonitoredMenu, MonitoredStrMenu)
_DATA_MAP = {
gen.lib.LdsOrd.BAPTISM : [

View File

@ -36,7 +36,7 @@ import const
import Config
from _EditSecondary import EditSecondary
from GrampsWidgets import MonitoredEntry
from widgets import MonitoredEntry
from gettext import gettext as _
#-------------------------------------------------------------------------

View File

@ -47,7 +47,7 @@ import Mime
import ThumbNails
import Utils
from Editors import EditPrimary
from GrampsWidgets import MonitoredDate, MonitoredEntry, PrivacyButton
from widgets import MonitoredDate, MonitoredEntry, PrivacyButton
from DisplayTabs import (SourceEmbedList, AttrEmbedList, NoteTab,
MediaBackRefList)
from Editors.AddMedia import AddMediaObject

View File

@ -49,7 +49,7 @@ from gen.lib import NoteType
from DisplayTabs import (SourceEmbedList, AttrEmbedList, MediaBackRefList,
NoteTab)
from GrampsWidgets import MonitoredSpinButton, MonitoredEntry, PrivacyButton
from widgets import MonitoredSpinButton, MonitoredEntry, PrivacyButton
from _EditReference import RefTab, EditReference
from AddMedia import AddMediaObject

View File

@ -46,8 +46,8 @@ from BasicUtils import name_displayer
from _EditSecondary import EditSecondary
from gen.lib import NoteType
from DisplayTabs import GrampsTab,SourceEmbedList,NoteTab
from GrampsWidgets import (MonitoredEntry, MonitoredMenu, MonitoredDate,
MonitoredDataType, PrivacyButton)
from widgets import (MonitoredEntry, MonitoredMenu, MonitoredDate,
MonitoredDataType, PrivacyButton)
#-------------------------------------------------------------------------

View File

@ -47,11 +47,11 @@ import pango
#-------------------------------------------------------------------------
import Config
from const import GLADE_FILE
from Editors._StyledTextEditor import StyledTextEditor
from widgets import StyledTextEditor
from Editors._EditPrimary import EditPrimary
from DisplayTabs import GrampsTab, NoteBackRefList
from GrampsWidgets import (MonitoredDataType, MonitoredCheckbox,
MonitoredEntry, PrivacyButton)
from widgets import (MonitoredDataType, MonitoredCheckbox,
MonitoredEntry, PrivacyButton)
from gen.lib import Note
from QuestionDialog import ErrorDialog

View File

@ -50,7 +50,7 @@ import const
import Utils
import Mime
import gen.lib
import GrampsWidgets
import widgets
from BasicUtils import name_displayer
import Errors
@ -224,12 +224,12 @@ class EditPerson(EditPrimary):
"""
self.private = GrampsWidgets.PrivacyButton(
self.private = widgets.PrivacyButton(
self.top.get_widget('private'),
self.obj,
self.db.readonly)
self.gender = GrampsWidgets.MonitoredMenu(
self.gender = widgets.MonitoredMenu(
self.top.get_widget('gender'),
self.obj.set_gender,
self.obj.get_gender,
@ -240,7 +240,7 @@ class EditPerson(EditPrimary):
),
self.db.readonly)
self.marker = GrampsWidgets.MonitoredDataType(
self.marker = widgets.MonitoredDataType(
self.top.get_widget('marker'),
self.obj.set_marker,
self.obj.get_marker,
@ -248,7 +248,7 @@ class EditPerson(EditPrimary):
self.db.get_marker_types(),
)
self.ntype_field = GrampsWidgets.MonitoredDataType(
self.ntype_field = widgets.MonitoredDataType(
self.top.get_widget("ntype"),
self.pname.set_type,
self.pname.get_type,
@ -256,7 +256,7 @@ class EditPerson(EditPrimary):
self.db.get_name_types())
if self.use_patronymic:
self.prefix = GrampsWidgets.MonitoredEntry(
self.prefix = widgets.MonitoredEntry(
self.top.get_widget("prefix"),
self.pname.set_patronymic,
self.pname.get_patronymic,
@ -266,44 +266,44 @@ class EditPerson(EditPrimary):
prefix_label.set_text(_('Patronymic:'))
prefix_label.set_use_underline(True)
else:
self.prefix = GrampsWidgets.MonitoredEntry(
self.prefix = widgets.MonitoredEntry(
self.top.get_widget("prefix"),
self.pname.set_surname_prefix,
self.pname.get_surname_prefix,
self.db.readonly)
self.suffix = GrampsWidgets.MonitoredEntry(
self.suffix = widgets.MonitoredEntry(
self.top.get_widget("suffix"),
self.pname.set_suffix,
self.pname.get_suffix,
self.db.readonly)
self.call = GrampsWidgets.MonitoredEntry(
self.call = widgets.MonitoredEntry(
self.top.get_widget("call"),
self.pname.set_call_name,
self.pname.get_call_name,
self.db.readonly)
self.given = GrampsWidgets.MonitoredEntry(
self.given = widgets.MonitoredEntry(
self.top.get_widget("given_name"),
self.pname.set_first_name,
self.pname.get_first_name,
self.db.readonly)
self.title = GrampsWidgets.MonitoredEntry(
self.title = widgets.MonitoredEntry(
self.top.get_widget("title"),
self.pname.set_title,
self.pname.get_title,
self.db.readonly)
self.surname_field = GrampsWidgets.MonitoredEntry(
self.surname_field = widgets.MonitoredEntry(
self.top.get_widget("surname"),
self.pname.set_surname,
self.pname.get_surname,
self.db.readonly,
autolist=self.db.get_surname_list())
self.gid = GrampsWidgets.MonitoredEntry(
self.gid = widgets.MonitoredEntry(
self.top.get_widget("gid"),
self.obj.set_gramps_id,
self.obj.get_gramps_id,

View File

@ -50,7 +50,7 @@ import Config
from BasicUtils import name_displayer
from _EditSecondary import EditSecondary
from gen.lib import NoteType
from GrampsWidgets import MonitoredEntry, PrivacyButton
from widgets import MonitoredEntry, PrivacyButton
from DisplayTabs import SourceEmbedList, NoteTab
#-------------------------------------------------------------------------

View File

@ -49,7 +49,7 @@ import gen.lib
from Editors._EditPrimary import EditPrimary
from DisplayTabs import (GrampsTab, LocationEmbedList, SourceEmbedList,
GalleryTab, NoteTab, WebEmbedList, PlaceBackRefList)
from GrampsWidgets import MonitoredEntry, PrivacyButton
from widgets import MonitoredEntry, PrivacyButton
from Errors import ValidationError
from PlaceUtils import conv_lat_lon
from QuestionDialog import ErrorDialog

View File

@ -45,7 +45,7 @@ import Config
from gen.lib import NoteType
from DisplayTabs import NoteTab,AddrEmbedList,WebEmbedList,SourceBackRefList
from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType
from widgets import MonitoredEntry, PrivacyButton, MonitoredDataType
from _EditReference import RefTab, EditReference
#-------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ import const
import Config
import gen.lib
from GrampsWidgets import MonitoredEntry, MonitoredDataType, PrivacyButton
from widgets import MonitoredEntry, MonitoredDataType, PrivacyButton
from DisplayTabs import AddrEmbedList, WebEmbedList, NoteTab, SourceBackRefList
from Editors._EditPrimary import EditPrimary
from QuestionDialog import ErrorDialog

View File

@ -50,7 +50,7 @@ from Editors._EditPrimary import EditPrimary
from DisplayTabs import (NoteTab, GalleryTab, DataEmbedList,
SourceBackRefList, RepoEmbedList)
from GrampsWidgets import MonitoredEntry, PrivacyButton
from widgets import MonitoredEntry, PrivacyButton
from QuestionDialog import ErrorDialog
#-------------------------------------------------------------------------

View File

@ -45,8 +45,8 @@ import gen.lib
from DisplayTabs import (NoteTab, GalleryTab, SourceBackRefList,
DataEmbedList, RepoEmbedList)
from GrampsWidgets import (PrivacyButton, MonitoredEntry, MonitoredMenu,
MonitoredDate)
from widgets import (PrivacyButton, MonitoredEntry, MonitoredMenu,
MonitoredDate)
from _EditReference import RefTab, EditReference
#-------------------------------------------------------------------------

View File

@ -42,7 +42,7 @@ from gtk import glade
import const
import Config
from _EditSecondary import EditSecondary
from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType
from widgets import MonitoredEntry, PrivacyButton, MonitoredDataType
#-------------------------------------------------------------------------
#

View File

@ -39,7 +39,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import widgets
import gen.lib
from Filters.SideBar import SidebarFilter
@ -64,11 +64,11 @@ class EventSidebarFilter(SidebarFilter):
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
self.etype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
self.event_menu = widgets.MonitoredDataType(
self.etype,
self.filter_event.set_type,
self.filter_event.get_type)
self.filter_date = gtk.Entry()
self.filter_place = gtk.Entry()
self.filter_note = gtk.Entry()

View File

@ -39,7 +39,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import widgets
import gen.lib
from Filters.SideBar import SidebarFilter
@ -74,12 +74,12 @@ class FamilySidebarFilter(SidebarFilter):
self.family_stub.set_relationship((gen.lib.FamilyRelType.CUSTOM, u''))
self.rtype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
self.event_menu = widgets.MonitoredDataType(
self.etype,
self.filter_event.set_type,
self.filter_event.get_type)
self.rel_menu = GrampsWidgets.MonitoredDataType(
self.rel_menu = widgets.MonitoredDataType(
self.rtype,
self.family_stub.set_relationship,
self.family_stub.get_relationship)
@ -87,7 +87,7 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_marker = gen.lib.Family()
self.filter_marker.set_marker((gen.lib.MarkerType.CUSTOM, u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = GrampsWidgets.MonitoredDataType(
self.marker_menu = widgets.MonitoredDataType(
self.mtype,
self.filter_marker.set_marker,
self.filter_marker.get_marker)

View File

@ -39,7 +39,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import widgets
from gen.lib import Note, NoteType
from Filters.SideBar import SidebarFilter
@ -62,7 +62,7 @@ class NoteSidebarFilter(SidebarFilter):
self.note = Note()
self.note.set_type((NoteType.CUSTOM,''))
self.ntype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
self.event_menu = widgets.MonitoredDataType(
self.ntype,
self.note.set_type,
self.note.get_type)

View File

@ -39,7 +39,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import widgets
import gen.lib
import DateHandler
@ -79,7 +79,7 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_event = gen.lib.Event()
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
self.etype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
self.event_menu = widgets.MonitoredDataType(
self.etype,
self.filter_event.set_type,
self.filter_event.get_type)
@ -87,7 +87,7 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_marker = gen.lib.Person()
self.filter_marker.set_marker((gen.lib.MarkerType.CUSTOM, u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = GrampsWidgets.MonitoredDataType(
self.marker_menu = widgets.MonitoredDataType(
self.mtype,
self.filter_marker.set_marker,
self.filter_marker.get_marker)

View File

@ -39,7 +39,7 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import widgets
from gen.lib import Repository, RepositoryType
from Filters.SideBar import SidebarFilter
@ -66,7 +66,7 @@ class RepoSidebarFilter(SidebarFilter):
self.repo = Repository()
self.repo.set_type((RepositoryType.CUSTOM,''))
self.rtype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
self.event_menu = widgets.MonitoredDataType(
self.rtype,
self.repo.set_type,
self.repo.get_type)

View File

@ -24,7 +24,7 @@ from gettext import gettext as _
import gtk
import pango
import GrampsWidgets
import widgets
import Config
_RETURN = gtk.gdk.keyval_from_name("Return")
@ -51,7 +51,7 @@ class SidebarFilter:
self.dbstate = dbstate
def _init_interface(self):
self.table.attach(GrampsWidgets.MarkupLabel(_('<b>Filter</b>')),
self.table.attach(widgets.MarkupLabel(_('<b>Filter</b>')),
0, 2, 0, 1, xoptions=gtk.FILL|gtk.EXPAND, yoptions=0)
btn = gtk.Button()
img = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
@ -129,7 +129,7 @@ class SidebarFilter:
def add_entry(self, name, widget):
if name:
self.table.attach(GrampsWidgets.BasicLabel(name),
self.table.attach(widgets.BasicLabel(name),
1, 2, self.position, self.position+1,
xoptions=gtk.FILL, yoptions=0)
self.table.attach(widget, 2, 4, self.position, self.position+1,

View File

@ -52,7 +52,7 @@ from BasicUtils import name_displayer as _nd
import Utils
from gen.lib import Name
import ManagedWindow
from GrampsWidgets import MarkupLabel, BasicLabel
from widgets import MarkupLabel, BasicLabel
from QuestionDialog import ErrorDialog, QuestionDialog2
from Errors import NameDisplayError

View File

@ -45,7 +45,7 @@ import gobject
#
#-------------------------------------------------------------------------
import Utils
import GrampsWidgets
import widgets
import ManagedWindow
from QuestionDialog import OptionDialog
from Selectors import selector_factory
@ -398,8 +398,8 @@ class GuiPersonOption(gtk.HBox):
pevt = gtk.EventBox()
pevt.add(self.__person_label)
person_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_person_clicked)
person_button = widgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_person_clicked)
person_button.set_relief(gtk.RELIEF_NORMAL)
self.pack_start(pevt, False)
@ -489,8 +489,8 @@ class GuiFamilyOption(gtk.HBox):
pevt = gtk.EventBox()
pevt.add(self.__family_label)
family_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_family_clicked)
family_button = widgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_family_clicked)
family_button.set_relief(gtk.RELIEF_NORMAL)
self.pack_start(pevt, False)
@ -628,8 +628,8 @@ class GuiNoteOption(gtk.HBox):
pevt = gtk.EventBox()
pevt.add(self.__note_label)
note_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_note_clicked)
note_button = widgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_note_clicked)
note_button.set_relief(gtk.RELIEF_NORMAL)
self.pack_start(pevt, False)
@ -710,8 +710,8 @@ class GuiMediaOption(gtk.HBox):
pevt = gtk.EventBox()
pevt.add(self.__media_label)
media_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_media_clicked)
media_button = widgets.SimpleButton(gtk.STOCK_INDEX,
self.__get_media_clicked)
media_button.set_relief(gtk.RELIEF_NORMAL)
self.pack_start(pevt, False)
@ -813,9 +813,9 @@ class GuiPersonListOption(gtk.HBox):
# now setup the '+' and '-' pushbutton for adding/removing people from
# the container
self.__add_person = GrampsWidgets.SimpleButton(gtk.STOCK_ADD,
self.__add_person = widgets.SimpleButton(gtk.STOCK_ADD,
self.__add_person_clicked)
self.__del_person = GrampsWidgets.SimpleButton(gtk.STOCK_REMOVE,
self.__del_person = widgets.SimpleButton(gtk.STOCK_REMOVE,
self.__del_person_clicked)
self.__vbbox = gtk.VButtonBox()
self.__vbbox.add(self.__add_person)
@ -948,10 +948,10 @@ class GuiSurnameColourOption(gtk.HBox):
self.scrolled_window.set_shadow_type(gtk.SHADOW_OUT)
self.pack_start(self.scrolled_window, expand=True, fill=True)
self.add_surname = GrampsWidgets.SimpleButton(gtk.STOCK_ADD,
self.__add_clicked)
self.del_surname = GrampsWidgets.SimpleButton(gtk.STOCK_REMOVE,
self.__del_clicked)
self.add_surname = widgets.SimpleButton(gtk.STOCK_ADD,
self.__add_clicked)
self.del_surname = widgets.SimpleButton(gtk.STOCK_REMOVE,
self.__del_clicked)
self.vbbox = gtk.VButtonBox()
self.vbbox.add(self.add_surname)
self.vbbox.add(self.del_surname)

View File

@ -70,7 +70,7 @@ import PageView
import Navigation
import RecentFiles
from BasicUtils import name_displayer
import GrampsWidgets
import widgets
import UndoHistory
from DbLoader import DbLoader
import GrampsDisplay
@ -313,10 +313,10 @@ class ViewManager:
self.progress.set_size_request(100, -1)
self.progress.hide()
self.statusbar = GrampsWidgets.Statusbar()
self.statusbar = widgets.Statusbar()
self.statusbar.show()
self.warnbtn = GrampsWidgets.WarnButton()
self.warnbtn = widgets.WarnButton()
hbox2 = gtk.HBox()
hbox2.set_spacing(4)

View File

@ -48,7 +48,14 @@ class StyledTextTag():
"""
def __init__(self, name=None, value=None, ranges=None):
"""Setup initial instance variable values."""
"""Setup initial instance variable values.
@note: Since L{GrampsType} supports the instance initialization
with several different base types, please note that C{name} parameter
can be int, str, unicode, tuple, or even another L{StyledTextTagType}
instance.
"""
self.name = StyledTextTagType(name)
self.value = value
if ranges is None:

View File

@ -45,7 +45,7 @@ from gtk import glade
import Config
import GrampsCfg
import GrampsDisplay
from GrampsWidgets import MonitoredEntry
from widgets import MonitoredEntry
import ManagedWindow
from PluginUtils import Tool, register_tool
from TransUtils import sgettext as _

38
src/widgets/__init__.py Normal file
View File

@ -0,0 +1,38 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 The Gramps Developers
#
# 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$
"""Custom widgets."""
from grampswidgets import *
from styledtextbuffer import *
from styledtexteditor import *
from gtk.glade import set_custom_handler
def get_custom_handler(glade, function_name, widget_name,
str1, str2, int1, int2):
if function_name == 'ValidatableMaskedEntry':
return ValidatableMaskedEntry()
if function_name == 'StyledTextEditor':
return StyledTextEditor()
set_custom_handler(get_custom_handler)

View File

@ -75,15 +75,15 @@ except:
INFO_ICON = gtk.STOCK_DIALOG_INFO
# Enabling custom widgets to be included in Glade
def get_custom_handler(glade, function_name, widget_name,
str1, str2, int1, int2):
from Editors._StyledTextEditor import StyledTextEditor
if function_name == 'ValidatableMaskedEntry':
return ValidatableMaskedEntry()
if function_name == 'StyledTextEditor':
return StyledTextEditor()
##def get_custom_handler(glade, function_name, widget_name,
##str1, str2, int1, int2):
##from Editors._StyledTextEditor import StyledTextEditor
##if function_name == 'ValidatableMaskedEntry':
##return ValidatableMaskedEntry()
##if function_name == 'StyledTextEditor':
##return StyledTextEditor()
gtk.glade.set_custom_handler(get_custom_handler)
##gtk.glade.set_custom_handler(get_custom_handler)
hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)

View File

@ -47,9 +47,9 @@ from pango import UNDERLINE_SINGLE
#
#-------------------------------------------------------------------------
from gen.lib import StyledTextTagType
from Editors._StyledTextBuffer import (StyledTextBuffer, ALLOWED_STYLES,
MATCH_START, MATCH_END,
MATCH_FLAVOR, MATCH_STRING)
from widgets import (StyledTextBuffer, ALLOWED_STYLES,
MATCH_START, MATCH_END,
MATCH_FLAVOR, MATCH_STRING)
from Spell import Spell
from GrampsDisplay import url as display_url