* src/DdTargets.py: add support for data items in sources

* src/EventEdit.py: use DisplayTabs
* src/gramps.glade: New EventEditor with display tabs
* src/DisplayTabs.py: specify data _DND_TYPE, don't enable d-n-d if
_DND_TYPE not defined


svn: r5868
This commit is contained in:
Don Allingham 2006-02-02 22:48:21 +00:00
parent d506af5c67
commit 8a45d47e09
5 changed files with 264 additions and 1239 deletions

View File

@ -1,4 +1,9 @@
2006-02-02 Don Allingham <don@gramps-project.org>
* src/DdTargets.py: add support for data items in sources
* src/EventEdit.py: use DisplayTabs
* src/gramps.glade: New EventEditor with display tabs
* src/DisplayTabs.py: specify data _DND_TYPE, don't enable d-n-d if
_DND_TYPE not defined
* src/DisplayState.py: add standard function for using WATCH cursor
* src/PageView.py: enable watch cursor when it is necessary to
rebuild a page.

View File

@ -105,6 +105,7 @@ class _DdTargets(object):
self.SOURCEREF = _DdType(self,'srcref')
self.NAME = _DdType(self,'name')
self.MEDIAOBJ = _DdType(self,'mediaobj')
self.DATA = _DdType(self,'data_tuple')
self.PERSON_LINK = _DdType(self,'person-link')
self.PERSON_LINK_LIST = _DdType(self,'person-link-list')

View File

@ -284,7 +284,8 @@ class EmbeddedList(ButtonTab):
self.columns = []
self.build_columns()
self._set_dnd()
if self._DND_TYPE:
self._set_dnd()
# build the initial data
self.rebuild()
@ -668,6 +669,7 @@ class SourceBackRefList(EmbeddedList):
#-------------------------------------------------------------------------
class DataEmbedList(EmbeddedList):
_DND_TYPE = DdTargets.DATA
_column_names = [
(_('Key'),0,150),
(_('Value'),1,250),

View File

@ -51,14 +51,13 @@ import AutoComp
import RelLib
import Date
from DateHandler import parser as _dp, displayer as _dd
import ImageSelect
import DateEdit
import Spell
import GrampsDisplay
import DisplayState
from QuestionDialog import WarningDialog, ErrorDialog
from WindowUtils import GladeIf
from DisplayTabs import *
#-------------------------------------------------------------------------
#
@ -117,12 +116,6 @@ class EventEditor(DisplayState.ManagedWindow):
if self.already_exist:
return
# build list for menu
## values = sets.Set(elist)
## values.union(self.get_event_names())
## self.elist = list(values)
##self.elist.sort()
for key in self.db.get_place_handles():
title = self.db.get_place_from_handle(key).get_title()
self.pmap[title] = key
@ -148,27 +141,13 @@ class EventEditor(DisplayState.ManagedWindow):
self.place_field.set_editable(not noedit)
self.cause_field = self.top.get_widget("eventCause")
self.cause_field.set_editable(not noedit)
self.slist = self.top.get_widget("slist")
self.wlist = self.top.get_widget("wlist")
self.date_field = self.top.get_widget("eventDate")
self.date_field.set_editable(not noedit)
self.descr_field = self.top.get_widget("event_description")
self.descr_field.set_editable(not noedit)
self.note_field = self.top.get_widget("eventNote")
self.note_field.set_editable(not noedit)
self.spell = Spell.Spell(self.note_field)
self.event_menu = self.top.get_widget("personal_events")
self.priv = self.top.get_widget("priv")
self.priv.set_sensitive(not noedit)
self.sources_label = self.top.get_widget("sources_tab")
self.notes_label = self.top.get_widget("note_tab")
self.general_label = self.top.get_widget("general_tab")
self.gallery_label = self.top.get_widget("gallery_tab")
self.witnesses_label = self.top.get_widget("witness_tab")
self.flowed = self.top.get_widget("eventflowed")
self.flowed.set_sensitive(not noedit)
self.preform = self.top.get_widget("eventpreform")
self.preform.set_sensitive(not noedit)
self.ok = self.top.get_widget('ok')
self.ok.set_sensitive(not noedit)
@ -177,26 +156,6 @@ class EventEditor(DisplayState.ManagedWindow):
self.event_menu.set_sensitive(False)
self.date_field.grab_focus()
add_src = self.top.get_widget('add_src')
add_src.set_sensitive(not noedit)
del_src = self.top.get_widget('del_src')
del_src.set_sensitive(not noedit)
self.sourcetab = Sources.SourceTab(self.dbstate, self.uistate, self.track,
self.srcreflist, self, self.top, self.window, self.slist,
add_src, self.top.get_widget('edit_src'), del_src,
self.db.readonly)
add_witness = self.top.get_widget('add_witness')
add_witness.set_sensitive(not noedit)
edit_witness = self.top.get_widget('edit_witness')
del_witness = self.top.get_widget('del_witness')
del_witness.set_sensitive(not noedit)
# self.witnesstab = Witness.WitnessTab(
# self.witnesslist, self, self.top, self.window, self.wlist,
# add_witness, edit_witness, del_witness)
if event:
defval = event.get_type()[0]
else:
@ -221,16 +180,6 @@ class EventEditor(DisplayState.ManagedWindow):
self.descr_field.set_text(event.get_description())
self.priv.set_active(event.get_privacy())
self.note_field.get_buffer().set_text(event.get_note())
if event.get_note():
self.note_field.get_buffer().set_text(event.get_note())
Utils.bold_label(self.notes_label)
if event.get_note_format() == 1:
self.preform.set_active(1)
else:
self.flowed.set_active(1)
if event.get_media_list():
Utils.bold_label(self.gallery_label)
else:
event = RelLib.Event()
date_stat = self.top.get_widget("date_stat")
@ -240,29 +189,41 @@ class EventEditor(DisplayState.ManagedWindow):
date_stat,
self.window)
# self.icon_list = self.top.get_widget("iconlist")
# self.gallery = ImageSelect.Gallery(event, self.db.commit_event,
# self.path, self.icon_list,
# self.db,self,self.window)
self.gladeif.connect('event_edit','delete_event',self.on_delete_event)
self.gladeif.connect('button111','clicked',self.close)
self.gladeif.connect('ok','clicked',self.on_event_edit_ok_clicked)
self.gladeif.connect('button126','clicked',self.on_help_clicked)
self.gladeif.connect('notebook','switch_page',self.on_switch_page)
# self.gladeif.connect('add_obj','clicked',self.gallery.on_add_media_clicked)
# self.gladeif.connect('sel_obj','clicked',self.gallery.on_select_media_clicked)
# self.gladeif.connect('button172','clicked',self.gallery.on_edit_media_clicked)
# self.gladeif.connect('del_obj','clicked',self.gallery.on_delete_media_clicked)
self.top.get_widget('del_obj').set_sensitive(not noedit)
self.top.get_widget('sel_obj').set_sensitive(not noedit)
self.top.get_widget('add_obj').set_sensitive(not noedit)
Utils.bold_label(self.general_label)
self._create_tabbed_pages()
self.show()
def _add_page(self,page):
self.notebook.insert_page(page)
self.notebook.set_tab_label(page,page.get_tab_widget())
return page
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
window.
"""
vbox = self.top.get_widget('vbox')
self.notebook = gtk.Notebook()
self.srcref_list = self._add_page(SourceEmbedList(
self.dbstate,self.uistate, self.track,
self.event.source_list))
self.note_tab = self._add_page(NoteTab(
self.dbstate, self.uistate, self.track,
self.event.get_note_object()))
self.gallery_tab = self._add_page(GalleryTab(
self.dbstate, self.uistate, self.track,
self.event.get_media_list()))
self.notebook.show_all()
vbox.pack_start(self.notebook,True)
def build_menu_names(self,event):
if event:
if event.get_type()[0] == RelLib.Event.CUSTOM:

File diff suppressed because it is too large Load Diff