2008-01-18 Raphael Ackermann <raphael.ackermann@gmail.com>

* src/FilterEditor/_ShowResults.py
	* src/GrampsCfg.py
	* src/ReportBase/_StyleComboBox.py
	* src/ReportBase/_PaperMenu.py
	* src/ReportBase/_BookFormatComboBox.py
	* src/ReportBase/_DrawFormatComboBox.py
	* src/ReportBase/_GraphvizReportDialog.py
	* src/ReportBase/_TextFormatComboBox.py
	* src/DisplayTabs/_GalleryTab.py
	* src/ColumnOrder.py
	* src/plugins/WebCal.py
	* src/plugins/RemoveUnused.py
	* src/plugins/Verify.py
	* src/plugins/PatchNames.py
 	* src/ObjectSelector/_FamilyFilterFrame.py
	* src/ObjectSelector/_PersonFilterFrame.py
	* src/GrampsWidgets.py
	* src/ExportOptions.py
	* src/DdTargets.py
	* src/AutoComp.py
	* src/UndoHistory.py
	* src/PluginUtils/_PluginWindows.py
	* src/DbLoader.py
	* src/Filters/_FilterMenu.py
	pylint fixes + init gtk.ListStore() with gobject.TYPE_BOOLEAN types 
	instead of str, int, bool etc + Documentation fixes 

svn: r9905
This commit is contained in:
Raphael Ackermann 2008-01-21 22:03:43 +00:00
parent 88ad5f7133
commit 4261e46bf9
25 changed files with 136 additions and 51 deletions

View File

@ -1,3 +1,31 @@
2008-01-18 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/FilterEditor/_ShowResults.py
* src/GrampsCfg.py
* src/ReportBase/_StyleComboBox.py
* src/ReportBase/_PaperMenu.py
* src/ReportBase/_BookFormatComboBox.py
* src/ReportBase/_DrawFormatComboBox.py
* src/ReportBase/_GraphvizReportDialog.py
* src/ReportBase/_TextFormatComboBox.py
* src/DisplayTabs/_GalleryTab.py
* src/ColumnOrder.py
* src/plugins/WebCal.py
* src/plugins/RemoveUnused.py
* src/plugins/Verify.py
* src/plugins/PatchNames.py
* src/ObjectSelector/_FamilyFilterFrame.py
* src/ObjectSelector/_PersonFilterFrame.py
* src/GrampsWidgets.py
* src/ExportOptions.py
* src/DdTargets.py
* src/AutoComp.py
* src/UndoHistory.py
* src/PluginUtils/_PluginWindows.py
* src/DbLoader.py
* src/Filters/_FilterMenu.py
pylint fixes + init gtk.ListStore() with gobject.TYPE_BOOLEAN types
instead of str, int, bool etc + Documentation fixes
2008-01-21 Gary Burton <gary.burton@zen.co.uk>
* src/DbManager.py: Localise revision last modification dates so that they
are presented the same as database last modification dates.

View File

@ -37,12 +37,13 @@ import locale
#
#-------------------------------------------------------------------------
import gtk
import gobject
def fill_combo(combo, data_list):
"""
Fill a combo box with completion data
"""
store = gtk.ListStore(str)
store = gtk.ListStore(gobject.TYPE_STRING)
for data in [ item for item in data_list if item ]:
store.append(row=[data])
@ -59,7 +60,7 @@ def fill_entry(entry, data_list):
"""
Fill a entry with completion data
"""
store = gtk.ListStore(str)
store = gtk.ListStore(gobject.TYPE_STRING)
for data in [ item for item in data_list if item ]:
store.append(row=[data])
@ -128,7 +129,7 @@ class StandardCustomSelector:
self.additional = additional
# make model
self.store = gtk.ListStore(int, str)
self.store = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
# fill it up using mapping
self.fill()

View File

@ -36,6 +36,7 @@ import logging
#
#-------------------------------------------------------------------------
import gtk.glade
import gobject
#-------------------------------------------------------------------------
#
@ -72,7 +73,8 @@ class ColumnOrder(ManagedWindow.ManagedWindow):
self.arglist = arglist
self.callback = callback
self.model = gtk.ListStore( bool , str , int , object )
self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING,
gobject.TYPE_INT, object)
self.tree.set_model(self.model)

View File

@ -379,7 +379,7 @@ class GrampsFormatWidget(gtk.ComboBox):
gtk.ComboBox.__init__(self, model=None)
def set(self, format_list):
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell, True)

View File

@ -74,15 +74,17 @@ class _DdType:
container.insert(self)
def _calculate_id(self):
"""return the next available app_id."""
"""Return the next available app_id."""
idval = _DdType._APP_ID_OFFSET
_DdType._APP_ID_OFFSET += 1
return idval
def target(self):
"""return the full target information in the format
required by the Gtk functions."""
"""Return the full target information in the format required by the
Gtk functions.
"""
return (self.drag_type, self.target_flags, self.app_id)

View File

@ -37,6 +37,7 @@ import urlparse
import gtk
import pango
import os
import gobject
#-------------------------------------------------------------------------
#
@ -49,7 +50,7 @@ import ThumbNails
import Errors
import Mime
from DdTargets import DdTargets
from _ButtonTab import ButtonTab
from DisplayTabs._ButtonTab import ButtonTab
#-------------------------------------------------------------------------
#
@ -70,6 +71,8 @@ class GalleryTab(ButtonTab):
_DND_EXTRA = DdTargets.URI_LIST
def __init__(self, dbstate, uistate, track, media_list, update=None):
self.iconlist = gtk.IconView()
ButtonTab.__init__(self, dbstate, uistate, track, _('Gallery'), True)
self.media_list = media_list
self.update = update
@ -87,8 +90,10 @@ class GalleryTab(ButtonTab):
def double_click(self, obj, event):
"""
Handles the double click on list. If the double click occurs,
the Edit button handler is called
Handle the double click on list.
If the double click occurs, the Edit button handler is called.
"""
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.edit_button_clicked(obj)
@ -141,7 +146,8 @@ class GalleryTab(ButtonTab):
return len(self.media_list)==0
def _build_icon_model(self):
self.iconmodel= gtk.ListStore(gtk.gdk.Pixbuf, str, object)
self.iconmodel = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING,
object)
def _connect_icon_model(self):
self.iconlist.set_model(self.iconmodel)
@ -160,7 +166,6 @@ class GalleryTab(ButtonTab):
self._build_icon_model()
# build the icon view
self.iconlist = gtk.IconView()
self.iconlist.set_pixbuf_column(0)
# set custom text cell renderer for better control
text_renderer = gtk.CellRendererText()
@ -221,7 +226,7 @@ class GalleryTab(ButtonTab):
#notify user of error
from QuestionDialog import RunDatabaseRepair
RunDatabaseRepair(
_('Unexisting media found in the Gallery'))
_('Non existing media found in the Gallery'))
else :
pixbuf = ThumbNails.get_thumbnail_image(obj.get_path(),
obj.get_mime_type(),
@ -256,13 +261,15 @@ class GalleryTab(ButtonTab):
def share_button_clicked(self, obj):
"""
Function called with the Add button is clicked. This function
should be overridden by the derived class.
Function called when the Add button is clicked.
This function should be overridden by the derived class.
"""
from Selectors import selector_factory
SelectObject = selector_factory('MediaObject')
sel = SelectObject(self.dbstate,self.uistate,self.track)
sel = SelectObject(self.dbstate, self.uistate, self.track)
src = sel.run()
if src:
sref = gen.lib.MediaRef()
@ -371,7 +378,8 @@ class GalleryTab(ButtonTab):
return
# pickle the data, and build the tuple to be passed
value = (self._DND_TYPE.drag_type, id(self), obj, self.find_index(obj))
value = (self._DND_TYPE.drag_type, id(self), obj,
self.find_index(obj))
data = pickle.dumps(value)
# pass as a string (8 bits)
@ -394,7 +402,7 @@ class GalleryTab(ButtonTab):
if mytype == self._DND_TYPE.drag_type:
# determine the destination row
data = self.iconlist.get_dest_item_at_pos(x,y)
data = self.iconlist.get_dest_item_at_pos(x, y)
if data:
(path, pos) = data
row = path[0]
@ -426,7 +434,7 @@ class GalleryTab(ButtonTab):
self.handle_extra_type(mytype, obj)
except pickle.UnpicklingError:
d = Utils.fix_encoding(sel_data.data.replace('\0',' ').strip())
protocol,site,mfile,j,k,l = urlparse.urlparse(d)
protocol, site, mfile, j, k, l = urlparse.urlparse(d)
if protocol == "file":
name = Utils.fix_encoding(mfile)
mime = Mime.get_type(name)
@ -436,7 +444,7 @@ class GalleryTab(ButtonTab):
photo.set_path(name)
photo.set_mime_type(mime)
basename = os.path.basename(name)
(root,ext) = os.path.splitext(basename)
(root, ext) = os.path.splitext(basename)
photo.set_description(root)
trans = self.dbstate.db.transaction_begin()
self.dbstate.db.add_object(photo, trans)

View File

@ -27,6 +27,7 @@
#-------------------------------------------------------------------------
import gtk
from gettext import gettext as _
import gobject
#-------------------------------------------------------------------------
#
@ -89,7 +90,7 @@ class WriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
model = gtk.ListStore(str, object)
model = gtk.ListStore(gobject.TYPE_STRING, object)
for item in the_filters:
model.append(row=[item.get_name(), item])

View File

@ -48,6 +48,7 @@ log = logging.getLogger(".FilterEdit")
#
#-------------------------------------------------------------------------
import gtk
import gobject
#-------------------------------------------------------------------------
#
@ -90,26 +91,26 @@ class ShowResults(ManagedWindow.ManagedWindow):
column_n = gtk.TreeViewColumn(_('ID'), render, text=1)
tree.append_column(column_n)
self.get_widget('close').connect('clicked',self.close)
self.get_widget('close').connect('clicked', self.close)
new_list = [self.sort_val_from_handle(h) for h in handle_list]
new_list.sort()
handle_list = [ h[1] for h in new_list ]
for handle in handle_list:
name,gid = self.get_name_id(handle)
name, gid = self.get_name_id(handle)
model.append(row=[name, gid])
self.show()
def get_name_id(self,handle):
def get_name_id(self, handle):
if self.space == 'Person':
person = self.db.get_person_from_handle(handle)
name = _nd.sorted(person)
gid = person.get_gramps_id()
elif self.space == 'Family':
family = self.db.get_family_from_handle(handle)
name = Utils.family_name(family,self.db)
name = Utils.family_name(family, self.db)
gid = family.get_gramps_id()
elif self.space == 'Event':
event = self.db.get_event_from_handle(handle)
@ -165,4 +166,4 @@ class ShowResults(ManagedWindow.ManagedWindow):
elif self.space == 'Note':
gid = self.db.get_note_from_handle(handle).get_gramps_id()
sortname = locale.strxfrm(gid)
return (sortname,handle)
return (sortname, handle)

View File

@ -27,6 +27,7 @@
#-------------------------------------------------------------------------
import gtk
from gettext import gettext as _
import gobject
#-------------------------------------------------------------------------
#
@ -65,7 +66,7 @@ def build_filter_menu(local_filters = [], default=""):
def build_filter_model(space, local = [], default=""):
from Filters import SystemFilters, CustomFilters
model = gtk.ListStore(str, object)
model = gtk.ListStore(gobject.TYPE_STRING, object)
flist = local + SystemFilters.get_filters(space) + \
CustomFilters.get_filters(space)

View File

@ -309,7 +309,10 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
"""
Create a common model for ComboBox and TreeView
"""
name_format_model = gtk.ListStore(int, str, str, str)
name_format_model = gtk.ListStore(gobject.TYPE_INT,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_STRING)
index = 0
the_index = 0
for num, name, fmt_str, act in _nd.get_name_format():

View File

@ -305,7 +305,7 @@ class TypeCellRenderer(gtk.CellRendererCombo):
def __init__(self, values):
gtk.CellRendererCombo.__init__(self)
model = gtk.ListStore(str, int)
model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT)
for key in values:
model.append(row=[values[key], key])
self.set_property('editable', True)
@ -679,7 +679,7 @@ class MonitoredMenu:
def change_menu(self, mapping):
self.data = {}
self.model = gtk.ListStore(str, int)
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT)
index = 0
for t, v in mapping:
self.model.append(row=[t, v])
@ -700,7 +700,7 @@ class MonitoredStrMenu:
self.get_val = get_val
self.obj = obj
self.model = gtk.ListStore(str)
self.model = gtk.ListStore(gobject.TYPE_STRING)
if len(mapping) > 20:
self.obj.set_wrap_width(3)
@ -2195,7 +2195,7 @@ class MaskedEntry(gtk.Entry):
gtk.Entry.set_completion(self, completion)
# FIXME objects not supported yet, should it be at all?
#completion.set_model(gtk.ListStore(str, object))
completion.set_model(gtk.ListStore(str))
completion.set_model(gtk.ListStore(gobject.TYPE_STRING))
completion.set_text_column(0)
#completion.connect("match-selected",
#self._on_completion__match_selected)

View File

@ -58,7 +58,7 @@ class FamilyFilterFrame(FilterFrameBase):
filters = [ filter for filter in default_filters if \
not hasattr(filter,'labels') or len(filter.labels) == 0 ]
self._filter_list = gtk.ListStore(str, object)
self._filter_list = gtk.ListStore(gobject.TYPE_STRING, object)
for filter in filters:
self._filter_list.append([filter.name,filter])

View File

@ -111,7 +111,7 @@ class PersonFilterFrame(FilterFrameBase):
filters = [ filter for filter in default_filters if \
not hasattr(filter,'labels') or len(filter.labels) == 0 ]
self._filter_list = gtk.ListStore(str, gobject)
self._filter_list = gtk.ListStore(gobject.TYPE_STRING, gobject)
for filter in filters:
self._filter_list.append([filter.name,filter])

View File

@ -35,6 +35,7 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
import gtk
import pango
import gobject
#-------------------------------------------------------------------------
#
@ -69,7 +70,8 @@ class PluginStatus(ManagedWindow.ManagedWindow):
scrolled_window = gtk.ScrolledWindow()
self.list = gtk.TreeView()
self.model = gtk.ListStore(str, str, str, object)
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, object)
self.selection = self.list.get_selection()
self.list.set_model(self.model)

View File

@ -20,7 +20,19 @@
# $Id$
#-------------------------------------------------------------------------
#
# GTK libraries
#
#-------------------------------------------------------------------------
import gtk
import gobject
#-------------------------------------------------------------------------
#
# GRAMPS classes
#
#-------------------------------------------------------------------------
import Config
import PluginUtils
@ -32,7 +44,7 @@ import PluginUtils
class BookFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None):
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)

View File

@ -21,6 +21,7 @@
# $Id$
import gtk
import gobject
import Config
import PluginUtils
@ -32,7 +33,7 @@ import PluginUtils
class DrawFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None):
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)

View File

@ -36,6 +36,7 @@ from gettext import gettext as _
#
#-------------------------------------------------------------------------------
import gtk
import gobject
#-------------------------------------------------------------------------------
#
@ -637,7 +638,7 @@ class GraphvizFormatComboBox(gtk.ComboBox):
Format combo box class for Graphviz report.
"""
def set(self,active=None):
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)

View File

@ -34,6 +34,7 @@ import os
#
#-------------------------------------------------------------------------
import gtk
import gobject
#-------------------------------------------------------------------------
#
@ -71,7 +72,7 @@ class PaperComboBox(gtk.ComboBox):
def __init__(self,default_name):
gtk.ComboBox.__init__(self)
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)
@ -106,7 +107,7 @@ class OrientationComboBox(gtk.ComboBox):
def __init__(self,default=BaseDoc.PAPER_PORTRAIT):
gtk.ComboBox.__init__(self)
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)

View File

@ -23,6 +23,7 @@
from gettext import gettext as _
import gtk
import gobject
#-------------------------------------------------------------------------
#
@ -55,7 +56,7 @@ class StyleComboBox(gtk.ComboBox):
@param default: Default selection in the ComboBox
@type default: str
"""
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
self.style_map = style_map
keys = style_map.keys()

View File

@ -21,6 +21,7 @@
# $Id$
import gtk
import gobject
import Config
import PluginUtils
@ -32,7 +33,7 @@ import PluginUtils
class TextFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None):
self.store = gtk.ListStore(str)
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)

View File

@ -36,6 +36,7 @@ from gettext import gettext as _
#
#-------------------------------------------------------------------------
import gtk
import gobject
#-------------------------------------------------------------------------
#
@ -83,7 +84,8 @@ class UndoHistory(ManagedWindow.ManagedWindow):
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
self.tree = gtk.TreeView()
self.model = gtk.ListStore(str,str,str,str)
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING)
self.selection = self.tree.get_selection()
self.renderer = gtk.CellRendererText()

View File

@ -38,6 +38,7 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
import gtk
import gtk.glade
import gobject
#-------------------------------------------------------------------------
#
@ -190,7 +191,9 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow):
self.list = self.top.get_widget("list")
self.set_window(window,self.top.get_widget('title'),self.label)
self.model = gtk.ListStore(bool, str, str, str, str)
self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING)
r = gtk.CellRendererToggle()
r.connect('toggled',self.toggled)

View File

@ -45,6 +45,7 @@ log = logging.getLogger(".RemoveUnused")
#-------------------------------------------------------------------------
import gtk
import gtk.glade
import gobject
#-------------------------------------------------------------------------
#
@ -150,7 +151,11 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback):
self.invert_button = self.top.get_widget('invert_button')
self.invert_button.connect('clicked',self.invert_clicked)
self.real_model = gtk.ListStore(bool,str,str,str,str)
self.real_model = gtk.ListStore(gobject.TYPE_BOOLEAN,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_STRING)
self.sort_model = gtk.TreeModelSort(self.real_model)
self.warn_tree.set_model(self.sort_model)

View File

@ -43,6 +43,7 @@ import Errors
#------------------------------------------------------------------------
import gtk
import gtk.glade
import gobject
#------------------------------------------------------------------------
#
@ -486,8 +487,15 @@ class VerifyResults(ManagedWindow):
self.invert_button = self.top.get_widget('invert_all')
self.invert_button.connect('clicked',self.invert_clicked)
self.real_model = gtk.ListStore(bool,str,str,str,str,object,str,str,
bool,bool)
self.real_model = gtk.ListStore(gobject.TYPE_BOOLEAN,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_STRING, object,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_BOOLEAN,
gobject.TYPE_BOOLEAN)
self.filt_model = self.real_model.filter_new()
self.filt_model.set_visible_column(VerifyResults.TRUE_COL)
self.sort_model = gtk.TreeModelSort(self.filt_model)

View File

@ -62,6 +62,7 @@ log = logging.getLogger(".WebPage")
#
#------------------------------------------------------------------------
import gtk
import gobject
#------------------------------------------------------------------------
#
@ -751,7 +752,7 @@ class WebReportOptions(ReportOptions):
cset_node = None
cset = self.options_dict['WCencoding']
store = gtk.ListStore(str,str)
store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
for data in _character_sets:
if data[1] == cset:
cset_node = store.append(row=data)
@ -791,7 +792,7 @@ class WebReportOptions(ReportOptions):
self.Country_options = map(lambda c: ("", c, c), _countries)
self.Country = gtk.ComboBox()
store = gtk.ListStore(str)
store = gtk.ListStore(gobject.TYPE_STRING)
self.Country.set_model(store)
cell = gtk.CellRendererText()
self.Country.pack_start(cell,True)
@ -1390,7 +1391,7 @@ class GrampsNoteComboBox(gtk.ComboBox):
return handle
def mk_combobox(media_list,select_value):
store = gtk.ListStore(str,str)
store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
node = None
for data in media_list: