* src/DisplayTabs.py: pychecker fixes

* src/EditMedia.py: Handle Note types properly
* src/EditPerson.py: minor cleanup
* src/EventEdit.py: pychecker fixes
* src/MediaView.py: Don't call NoteEditor, use EditMedia instead
* src/PageView.py: pychecker fixes
* src/PersonView.py: typo
* src/gramps.glade: Handle note types in media editor


svn: r5901
This commit is contained in:
Don Allingham 2006-02-08 21:13:05 +00:00
parent 200b8cc17d
commit 47091ad736
9 changed files with 82 additions and 48 deletions

View File

@ -1,3 +1,13 @@
2006-02-08 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: pychecker fixes
* src/EditMedia.py: Handle Note types properly
* src/EditPerson.py: minor cleanup
* src/EventEdit.py: pychecker fixes
* src/MediaView.py: Don't call NoteEditor, use EditMedia instead
* src/PageView.py: pychecker fixes
* src/PersonView.py: typo
* src/gramps.glade: Handle note types in media editor
2006-02-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk> 2006-02-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ObjectSelector/_FamilyPreviewFrame.py: use new baseclass * src/ObjectSelector/_FamilyPreviewFrame.py: use new baseclass
* src/ObjectSelector/_FamilyTreeFrame.py: use new baseclass * src/ObjectSelector/_FamilyTreeFrame.py: use new baseclass
@ -9,7 +19,6 @@
* src/ObjectSelector/_TreeFrameBase.py: added * src/ObjectSelector/_TreeFrameBase.py: added
* src/ObjectSelector/__init__.py: added some documentation * src/ObjectSelector/__init__.py: added some documentation
2006-02-08 Don Allingham <don@gramps-project.org> 2006-02-08 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: reordering items in a Gallery * src/DisplayTabs.py: reordering items in a Gallery

View File

@ -41,6 +41,7 @@ try:
set() set()
except: except:
from sets import Set as set from sets import Set as set
print "set not used"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -51,8 +52,6 @@ import DateHandler
import NameDisplay import NameDisplay
import RelLib import RelLib
import Utils import Utils
import GrampsMime
import const
import ImgManip import ImgManip
import Spell import Spell
@ -64,7 +63,7 @@ from GrampsWidgets import SimpleButton
# constants # constants
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] dnddata = None
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -942,7 +941,7 @@ class LocationEmbedList(EmbeddedList):
if loc: if loc:
import LocEdit import LocEdit
LocEdit.LocationEditor(self.dbstate, self.uistate, self.track, LocEdit.LocationEditor(self.dbstate, self.uistate, self.track,
addr, self.edit_callback) loc, self.edit_callback)
def edit_callback(self,name): def edit_callback(self,name):
self.rebuild() self.rebuild()
@ -1171,7 +1170,7 @@ class SourceEmbedList(EmbeddedList):
self.add_callback) self.add_callback)
def add_callback(self,obj): def add_callback(self,obj):
self.get_data().append(name) self.get_data().append(obj)
self.changed = True self.changed = True
self.rebuild() self.rebuild()
@ -1226,7 +1225,7 @@ class RepoEmbedList(EmbeddedList):
self.dbstate, self.uistate, self.track, ref, self.add_callback) self.dbstate, self.uistate, self.track, ref, self.add_callback)
def add_callback(self,obj): def add_callback(self,obj):
self.get_data().append(name) self.get_data().append(obj)
self.changed = True self.changed = True
self.rebuild() self.rebuild()
@ -1262,7 +1261,7 @@ class ChildModel(gtk.ListStore):
self.append(row=[index, self.append(row=[index,
child.get_gramps_id(), child.get_gramps_id(),
NameDisplay.displayer.display(child), NameDisplay.displayer.display(child),
_GENDER[child.get_gender()], Utils.gender[child.get_gender()],
self.column_father_rel(child), self.column_father_rel(child),
self.column_mother_rel(child), self.column_mother_rel(child),
self.column_birth_day(child), self.column_birth_day(child),

View File

@ -108,8 +108,6 @@ class EditMedia(DisplayState.ManagedWindow):
title = _('Media Properties Editor') title = _('Media Properties Editor')
self.window = self.change_dialog.get_widget('change_global') self.window = self.change_dialog.get_widget('change_global')
self.select = self.change_dialog.get_widget('file_select')
self.select.connect('clicked', self.select_file)
self.date_entry = self.change_dialog.get_widget('date') self.date_entry = self.change_dialog.get_widget('date')
self.date_entry.set_editable(mode) self.date_entry.set_editable(mode)
@ -141,12 +139,13 @@ class EditMedia(DisplayState.ManagedWindow):
if descr: if descr:
self.change_dialog.get_widget("type").set_text(descr) self.change_dialog.get_widget("type").set_text(descr)
else: else:
pb = GrampsMime.find_mime_type_pixbuf('text/plain')
self.pixmap.set_from_pixbuf(pb)
self.change_dialog.get_widget("type").set_text(_('Note')) self.change_dialog.get_widget("type").set_text(_('Note'))
self.pixmap.hide()
self.change_dialog.get_widget("gid").set_text(self.obj.get_gramps_id()) self.change_dialog.get_widget("gid").set_text(self.obj.get_gramps_id())
self.update_info() self.setup_filepath()
self.gladeif.connect('change_global','delete_event', self.gladeif.connect('change_global','delete_event',
self.on_delete_event) self.on_delete_event)
@ -154,6 +153,11 @@ class EditMedia(DisplayState.ManagedWindow):
self.gladeif.connect('ok','clicked',self.on_ok_clicked) self.gladeif.connect('ok','clicked',self.on_ok_clicked)
self.gladeif.connect('button102','clicked',self.on_help_clicked) self.gladeif.connect('button102','clicked',self.on_help_clicked)
self._create_tabbed_windows()
self.show()
def _create_tabbed_windows(self):
self.vbox = self.change_dialog.get_widget('vbox') self.vbox = self.change_dialog.get_widget('vbox')
self.notebook = gtk.Notebook() self.notebook = gtk.Notebook()
self.notebook.show() self.notebook.show()
@ -166,15 +170,18 @@ class EditMedia(DisplayState.ManagedWindow):
self.src_list = SourceEmbedList(self.state,self.uistate, self.src_list = SourceEmbedList(self.state,self.uistate,
self.track,self.obj.source_list) self.track,self.obj.source_list)
if self.obj.get_mime_type():
self.notebook.insert_page(self.src_list) self.notebook.insert_page(self.src_list)
self.notebook.set_tab_label(self.src_list,self.src_list.get_tab_widget())
self.notebook.insert_page(self.attr_list) self.notebook.insert_page(self.attr_list)
self.notebook.set_tab_label(self.attr_list,self.attr_list.get_tab_widget())
self.notebook.insert_page(self.note_tab) self.notebook.insert_page(self.note_tab)
else:
self.notebook.insert_page(self.note_tab)
self.notebook.insert_page(self.src_list)
self.notebook.insert_page(self.attr_list)
self.notebook.set_tab_label(self.src_list,self.src_list.get_tab_widget())
self.notebook.set_tab_label(self.note_tab,self.note_tab.get_tab_widget()) self.notebook.set_tab_label(self.note_tab,self.note_tab.get_tab_widget())
self.show() self.notebook.set_tab_label(self.attr_list,self.attr_list.get_tab_widget())
def build_menu_names(self,person): def build_menu_names(self,person):
win_menu_label = _("Media Properties") win_menu_label = _("Media Properties")
@ -213,10 +220,18 @@ class EditMedia(DisplayState.ManagedWindow):
gobject.source_remove(self.idle) gobject.source_remove(self.idle)
self.close() self.close()
def update_info(self): def setup_filepath(self):
fname = self.obj.get_path() self.select = self.change_dialog.get_widget('file_select')
self.file_path = self.change_dialog.get_widget("path") self.file_path = self.change_dialog.get_widget("path")
if self.obj.get_mime_type():
fname = self.obj.get_path()
self.file_path.set_text(fname) self.file_path.set_text(fname)
self.select.connect('clicked', self.select_file)
else:
self.change_dialog.get_widget('path_label').hide()
self.file_path.hide()
self.select.hide()
def on_apply_clicked(self, obj): def on_apply_clicked(self, obj):
desc = unicode(self.descr_window.get_text()) desc = unicode(self.descr_window.get_text())

View File

@ -111,7 +111,6 @@ class EditPerson(DisplayState.ManagedWindow):
self.orig_surname = self.person.get_primary_name().get_group_name() self.orig_surname = self.person.get_primary_name().get_group_name()
self.db = self.dbstate.db self.db = self.dbstate.db
self.callback = callback self.callback = callback
# self.lds_not_loaded = True
self.pdmap = {} self.pdmap = {}
self.add_places = [] self.add_places = []
self.should_guess_gender = (not person.get_gramps_id() and self.should_guess_gender = (not person.get_gramps_id() and
@ -472,7 +471,7 @@ class EditPerson(DisplayState.ManagedWindow):
changed = True changed = True
if self.pname.get_note() != name.get_note(): if self.pname.get_note() != name.get_note():
changed = True changed = True
# if not self.lds_not_loaded and self.check_lds(): # if self.check_lds():
# changed = True # changed = True
(female,male,unknown) = _select_gender[self.gender.get_active()] (female,male,unknown) = _select_gender[self.gender.get_active()]
@ -483,10 +482,7 @@ class EditPerson(DisplayState.ManagedWindow):
changed = True changed = True
elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN: elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN:
changed = True changed = True
if text != self.person.get_note():
changed = True
# if not self.lds_not_loaded:
# if not self.lds_baptism.are_equal(self.person.get_lds_baptism()): # if not self.lds_baptism.are_equal(self.person.get_lds_baptism()):
# changed= True # changed= True

View File

@ -191,7 +191,7 @@ class EventEditor(DisplayState.ManagedWindow):
date_stat, date_stat,
self.window) self.window)
self.gladeif.connect('button111','clicked',self.close) self.gladeif.connect('button111','clicked',self.close_window)
self.gladeif.connect('ok','clicked',self.on_event_edit_ok_clicked) self.gladeif.connect('ok','clicked',self.on_event_edit_ok_clicked)
self.gladeif.connect('button126','clicked',self.on_help_clicked) self.gladeif.connect('button126','clicked',self.on_help_clicked)
@ -241,15 +241,17 @@ class EventEditor(DisplayState.ManagedWindow):
def build_window_key(self,obj): def build_window_key(self,obj):
if obj: if obj:
win_key = obj.get_handle() return obj.get_handle()
else: else:
win_key = id(self) return id(self)
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.gladeif.close() self.gladeif.close()
self.close()
def close(self,obj): def close_window(self,obj):
self.gladeif.close() self.gladeif.close()
self.close()
self.window.destroy() self.window.destroy()
def on_help_clicked(self,obj): def on_help_clicked(self,obj):
@ -298,7 +300,7 @@ class EventEditor(DisplayState.ManagedWindow):
self.db.commit_event(event,trans) self.db.commit_event(event,trans)
def get_event_names(self): def get_event_names(self):
data = sets.Set(self.db.get_family_event_types()) data = set(self.db.get_family_event_types())
data.union(self.db.get_person_event_types()) data.union(self.db.get_person_event_types())
return list(data) return list(data)

View File

@ -32,7 +32,6 @@ import gtk.gdk
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import RelLib
import PageView import PageView
import DisplayModels import DisplayModels
import ImgManip import ImgManip
@ -171,13 +170,8 @@ class MediaView(PageView.ListView):
return return
obj = self.dbstate.db.get_object_from_handle(handle) obj = self.dbstate.db.get_object_from_handle(handle)
if obj.get_mime_type():
import EditMedia import EditMedia
EditMedia.EditMedia(self.dbstate,self.uistate, [], obj) EditMedia.EditMedia(self.dbstate,self.uistate, [], obj)
else:
import NoteEdit
NoteEdit.NoteEditor(obj,self.parent,self.topWindow,
self.note_callback)
class DeleteMediaQuery: class DeleteMediaQuery:

View File

@ -20,8 +20,26 @@
# $Id$ # $Id$
#----------------------------------------------------------------
#
# python
#
#----------------------------------------------------------------
from gettext import gettext as _
#----------------------------------------------------------------
#
# gtk
#
#----------------------------------------------------------------
import gtk import gtk
import pango import pango
#----------------------------------------------------------------
#
# GRAMPS
#
#----------------------------------------------------------------
import TreeTips import TreeTips
import GenericFilter import GenericFilter
@ -386,7 +404,7 @@ class ListView(PageView):
order = gtk.SORT_ASCENDING order = gtk.SORT_ASCENDING
else: else:
if (self.columns[data].get_sort_order() == gtk.SORT_DESCENDING if (self.columns[data].get_sort_order() == gtk.SORT_DESCENDING
or self.columns[data].get_sort_indicator() == False): or not self.columns[data].get_sort_indicator()):
order = gtk.SORT_ASCENDING order = gtk.SORT_ASCENDING
else: else:
order = gtk.SORT_DESCENDING order = gtk.SORT_DESCENDING

View File

@ -28,6 +28,7 @@
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gettext import gettext as _ from gettext import gettext as _
import cPickle as pickle
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -8738,7 +8738,7 @@ Very High</property>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label180"> <widget class="GtkLabel" id="path_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Path:</property> <property name="label" translatable="yes">Path:</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>