* src/const.py.in: remove unused variables

* src/gramps.glade: remove unused dialogs


svn: r5751
This commit is contained in:
Don Allingham 2006-01-14 05:27:48 +00:00
parent 25fc39a977
commit 8f43528b12
5 changed files with 156 additions and 259 deletions

View File

@ -1,4 +1,6 @@
2006-01-13 Don Allingham <don@gramps-project.org> 2006-01-13 Don Allingham <don@gramps-project.org>
* src/const.py.in: remove unused variables
* src/gramps.glade: remove unused dialogs
* src/DisplayTabs.py: Move event list * src/DisplayTabs.py: Move event list
* src/EditFamily.py: add editing of people, add relationship type * src/EditFamily.py: add editing of people, add relationship type
* src/EventEdit.py: move event list * src/EventEdit.py: move event list

View File

@ -1,3 +1,23 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2004 Donald N. Allingham
#
# 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
#
import gtk import gtk
import DateHandler import DateHandler
import NameDisplay import NameDisplay
@ -10,34 +30,85 @@ _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Localized constants # EmbeddedList
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
_codeset = GrampsLocale.codeset
def sfunc(a,b):
return locale.strcoll(a[0],b[0])
class EmbeddedList(gtk.HBox): class EmbeddedList(gtk.HBox):
_HANDLE_COL = 8 _HANDLE_COL = -1
def __init__(self, db, build_model): def __init__(self, dbstate, uistate, track, build_model):
gtk.HBox.__init__(self) gtk.HBox.__init__(self)
self.build_model = build_model self.build_model = build_model
self.dbstate = dbstate
self.uistate = uistate
self.track = track
self.tree = gtk.TreeView() self.tree = gtk.TreeView()
self.tree.set_rules_hint(True) self.tree.set_rules_hint(True)
self.selection = self.tree.get_selection()
self.selection.connect('changed',self.selection_changed)
scroll = gtk.ScrolledWindow() scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport(self.tree) scroll.add_with_viewport(self.tree)
self.pack_start(scroll,True) self.pack_start(scroll,True)
self.columns = [] self.columns = []
self.db = db
self.build_columns() self.build_columns()
self.create_buttons()
self.rebuild() self.rebuild()
self.show_all() self.show_all()
def get_selected(self):
(model,node) = self.selection.get_selected()
if node:
return model.get_value(node,self._HANDLE_COL)
else:
return None
def selection_changed(self,obj=None):
if self.get_selected():
self.edit_btn.set_sensitive(True)
self.del_btn.set_sensitive(True)
else:
self.edit_btn.set_sensitive(False)
self.del_btn.set_sensitive(False)
def create_buttons(self):
self.add_btn = gtk.Button()
self.add_btn.set_relief(gtk.RELIEF_NONE)
self.add_btn.add(gtk.image_new_from_stock(gtk.STOCK_ADD,
gtk.ICON_SIZE_BUTTON))
self.edit_btn = gtk.Button()
self.edit_btn.set_relief(gtk.RELIEF_NONE)
self.edit_btn.add(gtk.image_new_from_stock(gtk.STOCK_EDIT,
gtk.ICON_SIZE_BUTTON))
self.del_btn = gtk.Button()
self.del_btn.set_relief(gtk.RELIEF_NONE)
self.del_btn.add(gtk.image_new_from_stock(gtk.STOCK_REMOVE,
gtk.ICON_SIZE_BUTTON))
vbox = gtk.VBox()
vbox.set_spacing(6)
vbox.pack_start(self.add_btn,False)
vbox.pack_start(self.edit_btn,False)
vbox.pack_start(self.del_btn,False)
vbox.show_all()
self.pack_start(vbox,False)
self.add_btn.connect('clicked',self.add_button_clicked)
self.del_btn.connect('clicked',self.del_button_clicked)
self.edit_btn.connect('clicked',self.edit_button_clicked)
def add_button_clicked(self,obj):
pass
def del_button_clicked(self,obj):
pass
def edit_button_clicked(self,obj):
pass
def set_label(self): def set_label(self):
return return
@ -65,13 +136,19 @@ class EmbeddedList(gtk.HBox):
self.tree.append_column(column) self.tree.append_column(column)
def rebuild(self): def rebuild(self):
self.model = self.build_model(self.get_data(),self.db) self.model = self.build_model(self.get_data(),self.dbstate.db)
self.tree.set_model(self.model) self.tree.set_model(self.model)
self.set_label() self.set_label()
self.selection_changed()
def get_tab_widget(self): def get_tab_widget(self):
return gtk.Label('UNDEFINED') return gtk.Label('UNDEFINED')
#-------------------------------------------------------------------------
#
# EventEmbedList
#
#-------------------------------------------------------------------------
class EventEmbedList(EmbeddedList): class EventEmbedList(EmbeddedList):
column_names = [ column_names = [
@ -83,13 +160,13 @@ class EventEmbedList(EmbeddedList):
(_('Cause'),5), (_('Cause'),5),
] ]
def __init__(self,db,obj): def __init__(self,dbstate,uistate,track,obj):
self.obj = obj self.obj = obj
self.hbox = gtk.HBox() self.hbox = gtk.HBox()
self.label = gtk.Label(_('Events')) self.label = gtk.Label(_('Events'))
self.hbox.show_all() self.hbox.show_all()
EmbeddedList.__init__(self, db, EventRefModel) EmbeddedList.__init__(self, dbstate, uistate, track, EventRefModel)
def get_data(self): def get_data(self):
return self.obj.get_event_ref_list() return self.obj.get_event_ref_list()
@ -107,6 +184,11 @@ class EventEmbedList(EmbeddedList):
def get_tab_widget(self): def get_tab_widget(self):
return self.label return self.label
#-------------------------------------------------------------------------
#
# NoteTab
#
#-------------------------------------------------------------------------
class NoteTab(gtk.HBox): class NoteTab(gtk.HBox):
def __init__(self, note_obj): def __init__(self, note_obj):
@ -129,6 +211,11 @@ class NoteTab(gtk.HBox):
def get_tab_widget(self): def get_tab_widget(self):
return gtk.Label(_('Note')) return gtk.Label(_('Note'))
#-------------------------------------------------------------------------
#
# GalleryTab
#
#-------------------------------------------------------------------------
class GalleryTab(gtk.HBox): class GalleryTab(gtk.HBox):
def __init__(self,db, media_list): def __init__(self,db, media_list):
@ -158,7 +245,7 @@ class GalleryTab(gtk.HBox):
def rebuild(self): def rebuild(self):
for ref in self.media_list: for ref in self.media_list:
obj = self.db.get_object_from_handle(ref.get_reference_handle()) obj = self.dbstate.db.get_object_from_handle(ref.get_reference_handle())
pixbuf = self.get_image(obj) pixbuf = self.get_image(obj)
self.iconmodel.append(row=[pixbuf,obj.get_description()]) self.iconmodel.append(row=[pixbuf,obj.get_description()])
self.set_label() self.set_label()
@ -185,7 +272,6 @@ class GalleryTab(gtk.HBox):
else: else:
self.label.set_text(_('Gallery')) self.label.set_text(_('Gallery'))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# ChildModel # ChildModel
@ -193,7 +279,9 @@ class GalleryTab(gtk.HBox):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class ChildModel(gtk.ListStore): class ChildModel(gtk.ListStore):
def __init__(self,child_list,db): _HANDLE_COL = -8
def __init__(self, child_list,db):
gtk.ListStore.__init__(self,int,str,str,str,str,str,str,str,str,str,int,int) gtk.ListStore.__init__(self,int,str,str,str,str,str,str,str,str,str,int,int)
self.db = db self.db = db
index = 1 index = 1
@ -266,40 +354,33 @@ class ChildModel(gtk.ListStore):
return self.db.get_place_from_handle(place_handle).get_title() return self.db.get_place_from_handle(place_handle).get_title()
return u"" return u""
def type_name(event):
t = event.get_type()
if t[0] == RelLib.Event.CUSTOM:
return t[1]
else:
return Utils.family_events[t[0]]
def place_of(event):
t = event.get_place_handle()
return t
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EventRefModel # EventRefModel
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class EventRefModel(gtk.ListStore): class EventRefModel(gtk.ListStore):
def __init__(self,event_list,db): def __init__(self,event_list,db):
gtk.ListStore.__init__(self,str,str,str,str,str,str) gtk.ListStore.__init__(self,str,str,str,str,str,str)
self.db = db self.db = db
index = 1
for event_ref in event_list: for event_ref in event_list:
event = db.get_event_from_handle(event_ref.ref) event = db.get_event_from_handle(event_ref.ref)
self.append(row=[ self.append(row=[
event.get_description(), event.get_description(),
event.get_gramps_id(), event.get_gramps_id(),
type_name(event), self.column_type(event),
self.column_date(event_ref), self.column_date(event_ref),
self.column_place(event_ref), self.column_place(event_ref),
event.get_cause(), event.get_cause(),
]) ])
index += 1
def column_type(self,event):
t = event.get_type()
if t[0] == RelLib.Event.CUSTOM:
return t[1]
else:
return Utils.family_events[t[0]]
def column_date(self,event_ref): def column_date(self,event_ref):
event = self.db.get_event_from_handle(event_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
@ -314,25 +395,21 @@ class EventRefModel(gtk.ListStore):
return self.db.get_place_from_handle(place_handle).get_title() return self.db.get_place_from_handle(place_handle).get_title()
return u"" return u""
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EventRefModel # AttrModel
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class AttrModel(gtk.ListStore): class AttrModel(gtk.ListStore):
def __init__(self,attr_list,db): def __init__(self,attr_list,db):
gtk.ListStore.__init__(self,str,str) gtk.ListStore.__init__(self,str,str)
self.db = db self.db = db
index = 1
for attr in attr_list: for attr in attr_list:
self.append(row=[ self.append(row=[
self.type_name(attr), self.type_name(attr),
attr.get_value(), attr.get_value(),
]) ])
index += 1
def type_name(self, attr): def type_name(self, attr):
t = attr.get_type() t = attr.get_type()
@ -341,7 +418,11 @@ class AttrModel(gtk.ListStore):
else: else:
return Utils.personal_attributes[t[0]] return Utils.personal_attributes[t[0]]
#-------------------------------------------------------------------------
#
# FamilyAttrModel
#
#-------------------------------------------------------------------------
class FamilyAttrModel(AttrModel): class FamilyAttrModel(AttrModel):
def __init__(self,attr_list,db): def __init__(self,attr_list,db):

View File

@ -62,22 +62,29 @@ import GrampsWidgets
from DdTargets import DdTargets from DdTargets import DdTargets
from WindowUtils import GladeIf from WindowUtils import GladeIf
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class AttrEmbedList(DisplayTabs.EmbeddedList): class AttrEmbedList(DisplayTabs.EmbeddedList):
_HANDLE_COL = -1
column_names = [ column_names = [
(_('Type'),0), (_('Type'),0),
(_('Value'),1), (_('Value'),1),
] ]
def __init__(self,db,data): def __init__(self,dbstate,uistate,track,data):
self.data = data self.data = data
self.hbox = gtk.HBox() self.hbox = gtk.HBox()
self.label = gtk.Label(_('Attributes')) self.label = gtk.Label(_('Attributes'))
self.hbox.show_all() self.hbox.show_all()
DisplayTabs.EmbeddedList.__init__(self, db, DisplayTabs.FamilyAttrModel) DisplayTabs.EmbeddedList.__init__(self, dbstate, uistate, track,
DisplayTabs.FamilyAttrModel)
def get_data(self): def get_data(self):
return self.data return self.data
@ -94,8 +101,11 @@ class AttrEmbedList(DisplayTabs.EmbeddedList):
def get_tab_widget(self): def get_tab_widget(self):
return self.label return self.label
class ChildEmbedList(DisplayTabs.EmbeddedList): class ChildEmbedList(DisplayTabs.EmbeddedList):
_HANDLE_COL = 8
column_names = [ column_names = [
(_('#'),0) , (_('#'),0) ,
(_('ID'),1) , (_('ID'),1) ,
@ -107,37 +117,19 @@ class ChildEmbedList(DisplayTabs.EmbeddedList):
(_('Death Place'),7), (_('Death Place'),7),
] ]
def __init__(self,db,family): def __init__(self,dbstate,uistate,track,family):
self.family = family self.family = family
self.hbox = gtk.HBox() self.hbox = gtk.HBox()
self.label = gtk.Label(_('Children')) self.label = gtk.Label(_('Children'))
self.add_btn = gtk.Button()
self.add_btn.add(gtk.image_new_from_stock(gtk.STOCK_ADD,
gtk.ICON_SIZE_BUTTON))
self.edit_btn = gtk.Button()
self.edit_btn.add(gtk.image_new_from_stock(gtk.STOCK_EDIT,
gtk.ICON_SIZE_BUTTON))
self.del_btn = gtk.Button()
self.del_btn.add(gtk.image_new_from_stock(gtk.STOCK_REMOVE,
gtk.ICON_SIZE_BUTTON))
self.hbox.show_all() self.hbox.show_all()
DisplayTabs.EmbeddedList.__init__(self, dbstate, uistate, track,
DisplayTabs.ChildModel)
DisplayTabs.EmbeddedList.__init__(self, db, DisplayTabs.ChildModel)
self.set_spacing(6)
vbox = gtk.VBox()
vbox.set_spacing(6)
vbox.pack_start(self.add_btn,False)
vbox.pack_start(self.edit_btn,False)
vbox.pack_start(self.del_btn,False)
vbox.show_all()
self.pack_start(vbox,False)
def get_data(self): def get_data(self):
return self.family.get_child_handle_list() return self.family.get_child_handle_list()
def column_order(self): def column_order(self):
return self.db.get_child_column_order() return self.dbstate.db.get_child_column_order()
def set_label(self): def set_label(self):
if len(self.get_data()): if len(self.get_data()):
@ -149,6 +141,19 @@ class ChildEmbedList(DisplayTabs.EmbeddedList):
def get_tab_widget(self): def get_tab_widget(self):
return self.label return self.label
def add_button_clicked(self,obj):
print "Add Button Clicked"
def del_button_clicked(self,obj):
print "Del Button Clicked"
def edit_button_clicked(self,obj):
handle = self.get_selected()
if handle:
import EditPerson
person = self.dbstate.db.get_person_from_handle(handle)
EditPerson.EditPerson(self.dbstate,self.uistate,self.track,person)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EditFamily # EditFamily
@ -230,9 +235,12 @@ class EditFamily(DisplayState.ManagedWindow):
self.mbutton.connect('clicked',self.mother_clicked) self.mbutton.connect('clicked',self.mother_clicked)
self.fbutton.connect('clicked',self.father_clicked) self.fbutton.connect('clicked',self.father_clicked)
self.child_list = ChildEmbedList(self.dbstate.db, self.family) self.child_list = ChildEmbedList(self.dbstate,self.uistate,
self.event_list = DisplayTabs.EventEmbedList(self.dbstate.db, self.family) self.track, self.family)
self.attr_list = AttrEmbedList(self.dbstate.db, self.family.get_attribute_list()) self.event_list = DisplayTabs.EventEmbedList(self.dbstate, self.uistate,
self.track, self.family)
self.attr_list = AttrEmbedList(self.dbstate, self.uistate, self.track,
self.family.get_attribute_list())
self.note_tab = DisplayTabs.NoteTab(self.family.get_note_object()) self.note_tab = DisplayTabs.NoteTab(self.family.get_note_object())
self.gallery_tab = DisplayTabs.GalleryTab(self.dbstate.db, self.gallery_tab = DisplayTabs.GalleryTab(self.dbstate.db,
self.family.get_media_list()) self.family.get_media_list())

View File

@ -116,7 +116,6 @@ prefsFile = "%s/gramps.glade" % rootDir
stylesFile = "%s/gramps.glade" % rootDir stylesFile = "%s/gramps.glade" % rootDir
dialogFile = "%s/gramps.glade" % rootDir dialogFile = "%s/gramps.glade" % rootDir
srcselFile = "%s/gramps.glade" % rootDir srcselFile = "%s/gramps.glade" % rootDir
findFile = "%s/find.glade" % rootDir
mergeFile = "%s/mergedata.glade" % rootDir mergeFile = "%s/mergedata.glade" % rootDir
merge2File = "%s/merge.glade" % rootDir merge2File = "%s/merge.glade" % rootDir
filterFile = "%s/rule.glade" % rootDir filterFile = "%s/rule.glade" % rootDir

View File

@ -1446,199 +1446,6 @@
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="find">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="icon">gramps.png</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox14">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area14">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="back">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-back</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_back_clicked" last_modification_time="Sat, 22 Mar 2003 23:19:12 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="forward">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-forward</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_next_clicked" last_modification_time="Sat, 22 Mar 2003 23:18:59 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button159">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sat, 22 Mar 2003 23:25:47 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox71">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox89">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox88">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label370">
<property name="visible">True</property>
<property name="label" translatable="yes">_Text:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">entry</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">6</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">12</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="columns"> <widget class="GtkDialog" id="columns">
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes"></property> <property name="title" translatable="yes"></property>