From 55a416f42211f838338db921fa56b17a8f178930 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 24 Feb 2005 00:25:34 +0000 Subject: [PATCH] * src/AddMedia.py: use new find_mime_type_pixbuf instead of find_icon * src/ImageSelect.py: remove internal media widgets, use new find_mime_type_pixbuf instead of find_icon * src/ImgManip.py: catch pixbuf_new_from_file exception * src/MediaView.py: use new find_mime_type_pixbuf instead of find_icon * src/SelectObject.py: use new find_mime_type_pixbuf instead of find_icon * various: replace the deprecated gtk.TRUE/gtk.FALSE with True/False svn: r4085 --- ChangeLog | 13 +++++++ src/AddMedia.py | 2 +- src/AddSpouse.py | 12 +++---- src/AddrEdit.py | 4 +-- src/AttrEdit.py | 4 +-- src/Bookmarks.py | 4 +-- src/ChooseParents.py | 14 ++++---- src/DbPrompter.py | 6 ++-- src/EditPerson.py | 12 +++---- src/EditPlace.py | 4 +-- src/EditSource.py | 4 +-- src/EventEdit.py | 2 +- src/Exporter.py | 8 ++--- src/FamilyView.py | 2 +- src/ImageSelect.py | 35 +++++++++--------- src/ImgManip.py | 9 ++++- src/ListModel.py | 14 ++++---- src/Marriage.py | 6 ++-- src/MediaView.py | 14 ++++---- src/NameEdit.py | 14 ++++---- src/NoteEdit.py | 2 +- src/PedView.py | 12 +++---- src/PeopleView.py | 6 ++-- src/PlaceView.py | 4 +-- src/Plugins.py | 2 +- src/QuestionDialog.py | 26 +++++++------- src/Report.py | 28 +++++++-------- src/SelectChild.py | 16 ++++----- src/SelectObject.py | 6 ++-- src/SelectPerson.py | 10 +++--- src/SourceView.py | 4 +-- src/Sources.py | 26 +++++++------- src/StartupDialog.py | 2 +- src/StyleEditor.py | 4 +-- src/Utils.py | 65 +++++++++++----------------------- src/Witness.py | 2 +- src/gramps_main.py | 4 +-- src/plugins/BookReport.py | 10 +++--- src/plugins/CustomBookText.py | 6 ++-- src/plugins/Desbrowser.py | 4 +-- src/plugins/Eval.py | 2 +- src/plugins/FilterEditor.py | 2 +- src/plugins/SimpleBookTitle.py | 10 +++--- src/plugins/WebPage.py | 4 +-- 44 files changed, 217 insertions(+), 223 deletions(-) diff --git a/ChangeLog b/ChangeLog index d534a7b14..d18f4daf2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-02-23 Don Allingham + * src/AddMedia.py: use new find_mime_type_pixbuf instead of + find_icon + * src/ImageSelect.py: remove internal media widgets, use new + find_mime_type_pixbuf instead of find_icon + * src/ImgManip.py: catch pixbuf_new_from_file exception + * src/MediaView.py: use new find_mime_type_pixbuf instead of + find_icon + * src/SelectObject.py: use new find_mime_type_pixbuf instead of + find_icon + * various: replace the deprecated gtk.TRUE/gtk.FALSE with + True/False + 2005-02-22 Don Allingham * src/gramps.glade: use ComboBox instead of ComboBoxEntry for temple diff --git a/src/AddMedia.py b/src/AddMedia.py index 1155f2703..33d93057b 100644 --- a/src/AddMedia.py +++ b/src/AddMedia.py @@ -169,7 +169,7 @@ class AddMediaObject: if mtype[0:5] == "image": image = RelImage.scale_image(filename,const.thumbScale) else: - image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(mtype)) + image = Utils.find_mime_type_pixbuf(mtype) self.image.set_from_pixbuf(image) def run(self): diff --git a/src/AddSpouse.py b/src/AddSpouse.py index bf2510687..aa12a63e8 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -145,18 +145,18 @@ class AddSpouse: def add_columns(self,tree): column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_resizable(True) + #column.set_clickable(True) column.set_min_width(225) tree.append_column(column) column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) - column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_resizable(True) + #column.set_clickable(True) column.set_min_width(75) tree.append_column(column) column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) - #column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + #column.set_resizable(True) + column.set_clickable(True) tree.append_column(column) def on_spouse_help_clicked(self,obj): diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 2c2dfc384..95a91dc0d 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -205,7 +205,7 @@ class AddressEditor: phone = unicode(self.phone.get_text()) postal = unicode(self.postal.get_text()) b = self.note_field.get_buffer() - note = unicode(b.get_text(b.get_start_iter(),b.get_end_iter(),gtk.FALSE)) + note = unicode(b.get_text(b.get_start_iter(),b.get_end_iter(),False)) format = self.preform.get_active() priv = self.priv.get_active() @@ -244,7 +244,7 @@ class AddressEditor: def on_switch_page(self,obj,a,page): buf = self.note_field.get_buffer() - text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE)) + text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/AttrEdit.py b/src/AttrEdit.py index 2cd654bb7..b9a670d8e 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -200,7 +200,7 @@ class AttributeEditor: value = unicode(self.value_field.get_text()) buf = self.note_field.get_buffer() - note = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE)) + note = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),False)) format = self.preform.get_active() priv = self.priv.get_active() @@ -238,7 +238,7 @@ class AttributeEditor: def on_switch_page(self,obj,a,page): buf = self.note_field.get_buffer() - text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE)) + text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/Bookmarks.py b/src/Bookmarks.py index ccc2513f8..85bdef014 100644 --- a/src/Bookmarks.py +++ b/src/Bookmarks.py @@ -96,10 +96,10 @@ class Bookmarks : title = "%s - GRAMPS" % _("Edit Bookmarks") self.top = gtk.Dialog(title) self.top.set_default_size(400,350) - self.top.set_has_separator(gtk.FALSE) + self.top.set_has_separator(False) self.top.vbox.set_spacing(5) label = gtk.Label('%s' % _("Edit Bookmarks")) - label.set_use_markup(gtk.TRUE) + label.set_use_markup(True) self.top.vbox.pack_start(label,0,0,5) box = gtk.HBox() self.top.vbox.pack_start(box,1,1,5) diff --git a/src/ChooseParents.py b/src/ChooseParents.py index dd7e17325..b06015d3c 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -185,20 +185,20 @@ class ChooseParents: def add_columns(self,tree): column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + column.set_resizable(True) + column.set_clickable(True) column.set_sort_column_id(0) column.set_min_width(225) tree.append_column(column) column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) - column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + column.set_resizable(True) + column.set_clickable(True) column.set_sort_column_id(1) column.set_min_width(75) tree.append_column(column) column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) - #column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + #column.set_resizable(True) + column.set_clickable(True) tree.append_column(column) def on_delete_event(self,obj,b): @@ -668,7 +668,7 @@ class ModifyParents: "on_parents_help_clicked" : self.on_help_clicked, }) - self.title.set_use_markup(gtk.TRUE) + self.title.set_use_markup(True) if self.family.get_relationship() == RelLib.Family.CIVIL_UNION: self.mlabel.set_label("%s" % _("Pa_rent")) diff --git a/src/DbPrompter.py b/src/DbPrompter.py index 67919c344..5174c666e 100644 --- a/src/DbPrompter.py +++ b/src/DbPrompter.py @@ -139,7 +139,7 @@ class ExistingDbPrompter: gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) - choose.set_local_only(gtk.FALSE) + choose.set_local_only(False) # Always add automatic (macth all files) filter mime_filter = gtk.FileFilter() mime_filter.set_name(_('All files')) @@ -246,7 +246,7 @@ class ImportDbPrompter: gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) - choose.set_local_only(gtk.FALSE) + choose.set_local_only(False) # Always add automatic (macth all files) filter mime_filter = gtk.FileFilter() mime_filter.set_name(_('All files')) @@ -408,7 +408,7 @@ class NewSaveasDbPrompter: gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK)) - choose.set_local_only(gtk.FALSE) + choose.set_local_only(False) # Always add automatic (macth all files) filter mime_filter = gtk.FileFilter() diff --git a/src/EditPerson.py b/src/EditPerson.py index c97321e53..a4b8df81e 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -838,7 +838,7 @@ class EditPerson: t = self.etree.tree (x,y) = icon.get_size() mask = gtk.gdk.Pixmap(self.window.window,x,y,1) - mask.draw_rectangle(t.get_style().white_gc, gtk.TRUE, 0,0,x,y) + mask.draw_rectangle(t.get_style().white_gc, True, 0,0,x,y) t.drag_source_set_icon(t.get_colormap(),icon,mask) def url_drag_data_received(self,widget,context,x,y,sel_data,info,time): @@ -1255,7 +1255,7 @@ class EditPerson: female = self.is_female.get_active() unknown = self.is_unknown.get_active() text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) format = self.preform.get_active() idval = unicode(self.gid.get_text()) if idval == "": @@ -1503,7 +1503,7 @@ class EditPerson: female = self.is_female.get_active() unknown = self.is_unknown.get_active() text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) format = self.preform.get_active() idval = unicode(self.gid.get_text()) if idval == "": @@ -1998,7 +1998,7 @@ class EditPerson: ErrorDialog(msg) text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) if text != self.person.get_note(): self.person.set_note(text) @@ -2155,7 +2155,7 @@ class EditPerson: self.draw_lds() note_buf = self.notes_buffer text = unicode(note_buf.get_text(note_buf.get_start_iter(), - note_buf.get_end_iter(),gtk.FALSE)) + note_buf.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: @@ -2186,7 +2186,7 @@ class EditPerson: # initial values name = '%s' % self.name_display.display(self.person) self.get_widget("activepersonTitle").set_text(name) - self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE) + self.get_widget("activepersonTitle").set_use_markup(True) self.suffix.set_text(self.pname.get_suffix()) if self.use_patronymic: self.prefix.set_text(self.pname.get_patronymic()) diff --git a/src/EditPlace.py b/src/EditPlace.py index 3b70387d2..5c4b70eaa 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -363,7 +363,7 @@ class EditPlace: def on_place_apply_clicked(self,obj): note = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(), - self.note_buffer.get_end_iter(),gtk.FALSE)) + self.note_buffer.get_end_iter(),False)) format = self.preform.get_active() mloc = self.place.get_main_location() @@ -411,7 +411,7 @@ class EditPlace: self.ref_not_loaded = 0 self.display_references() text = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(), - self.note_buffer.get_end_iter(),gtk.FALSE)) + self.note_buffer.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/EditSource.py b/src/EditSource.py index 7cc784947..819009d8b 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -393,7 +393,7 @@ class EditSource: pubinfo = unicode(self.pubinfo.get_text()) abbrev = unicode(self.abbrev.get_text()) note = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) format = self.preform.get_active() if author != self.source.get_author(): @@ -445,7 +445,7 @@ class EditSource: self.ref_not_loaded = 0 self.display_references() text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/EventEdit.py b/src/EventEdit.py index 49367235a..95b7f6ce8 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -391,7 +391,7 @@ class EventEditor: def on_switch_page(self,obj,a,page): buf = self.note_field.get_buffer() - text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE)) + text = unicode(buf.get_text(buf.get_start_iter(),buf.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/Exporter.py b/src/Exporter.py index 48f73b53c..3c4b71523 100644 --- a/src/Exporter.py +++ b/src/Exporter.py @@ -102,7 +102,7 @@ class Exporter: self.last_page = self.build_last_page() self.d.add(self.last_page) - self.d.set_show_help(gtk.TRUE) + self.d.set_show_help(True) self.d.connect('cancel',self.close) self.d.connect('help',self.help) self.w.connect("destroy_event",self.close) @@ -195,7 +195,7 @@ class Exporter: 'Format:\t%s\nName:\t%s\nFolder:\t%s\n\n' 'Press Forward to proceed, Cancel to abort, or Back to ' 'revisit your options.') % (format, name, folder)) - self.confirm_label.set_line_wrap(gtk.TRUE) + self.confirm_label.set_line_wrap(True) def save(self,obj,obj2): """ @@ -258,7 +258,7 @@ class Exporter: self.format_buttons.append(button) table.attach(button,0,2,2*ix,2*ix+1) label = gtk.Label(description) - label.set_line_wrap(gtk.TRUE) + label.set_line_wrap(True) label.set_alignment(0,0.5) table.attach(label,1,2,2*ix+1,2*ix+2,xpadding=24) @@ -315,7 +315,7 @@ class Exporter: p.set_logo(self.logo) self.chooser = gtk.FileChooserWidget(gtk.FILE_CHOOSER_ACTION_SAVE) - self.chooser.set_local_only(gtk.FALSE) + self.chooser.set_local_only(False) p.append_item("",self.chooser,"") # Dirty hack to enable proper EXPAND and FILL properties of the chooser parent = self.chooser.get_parent() diff --git a/src/FamilyView.py b/src/FamilyView.py index c3775de03..d2feccec5 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -274,7 +274,7 @@ class FamilyView: name = column_names[pair[1]][0] column = gtk.TreeViewColumn(name, gtk.CellRendererText(), text=pair[1]) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(40) column.set_sort_column_id(column_names[pair[1]][1]) self.columns.append(column) diff --git a/src/ImageSelect.py b/src/ImageSelect.py index d2b9605fd..4e352218c 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -34,6 +34,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- +import gobject import gtk import gnome import gnome.ui @@ -112,9 +113,7 @@ class ImageSelect: self.fname = self.glade.get_widget("fname") self.image = self.glade.get_widget("image") self.description = self.glade.get_widget("photoDescription") - self.internal = self.glade.get_widget('internal') self.temp_name = "" - self.internal.hide() Utils.set_titles(self.window,self.glade.get_widget('title'), _('Select a media object')) @@ -124,8 +123,6 @@ class ImageSelect: "on_help_imagesel_clicked" : self.on_help_imagesel_clicked, }) - self.internal.connect('toggled',self.internal_toggled) - if os.path.isdir(_last_path): self.fname.set_current_folder(_last_path) @@ -160,7 +157,7 @@ class ImageSelect: image = RelImage.scale_image(filename,const.thumbScale) self.image.set_from_pixbuf(image) else: - i = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(mtype)) + i = Utils.find_mime_type_pixbuf(mtype) self.image.set_from_pixbuf(i) def on_savephoto_clicked(self): @@ -300,7 +297,7 @@ class Gallery(ImageSelect): self.button, event) self.in_event = 0 - return gtk.TRUE + return True style = self.iconlist.get_style() @@ -324,7 +321,7 @@ class Gallery(ImageSelect): self.remember_y = event.y self.button = event.button self.in_event = 0 - return gtk.TRUE + return True elif event.button == 3: item = widget.get_item_at(event.x,event.y) @@ -332,7 +329,7 @@ class Gallery(ImageSelect): (i,t,b,self.photo,oid) = self.p_map[item] self.show_popup(self.photo,event) self.in_event = 0 - return gtk.TRUE + return True elif event.type == gtk.gdk.BUTTON_RELEASE: self.button = 0 # elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: @@ -341,7 +338,7 @@ class Gallery(ImageSelect): # (i,t,b,self.photo,oid) = self.p_map[item] # LocalMediaProperties(self.photo,self.path,self,self.parent_window) # self.in_event = 0 -# return gtk.TRUE +# return True elif event.type == gtk.gdk.MOTION_NOTIFY: if event.state & gtk.gdk.BUTTON1_MASK: # Get the new position and move by the difference @@ -352,13 +349,13 @@ class Gallery(ImageSelect): self.remember_y = new_y self.in_event = 0 - return gtk.TRUE + return True if event.type == gtk.gdk.EXPOSE: self.load_images() self.in_event = 0 - return gtk.FALSE + return False def savephoto(self, photo): """Save the photo in the dataobj object. (Required function)""" @@ -376,15 +373,17 @@ class Gallery(ImageSelect): if x != self.cx or y != self.cy: grp.move(self.cx-x,self.cy-y) else: - import gobject - description = obj.get_description() if len(description) > 20: description = "%s..." % description[0:20] try: media_obj = self.db.get_object_from_handle(oid) - image = ImgManip.get_thumbnail_image(media_obj.get_path()) + mtype = media_obj.get_mime_type() + if mtype[0:5] == "image": + image = ImgManip.get_thumbnail_image(media_obj.get_path()) + else: + image = Utils.find_mime_type_pixbuf(mtype) except gobject.GError,msg: ErrorDialog(str(msg)) image = gtk.gdk.pixbuf_new_from_file(const.icon) @@ -789,7 +788,7 @@ class LocalMediaProperties: def on_notebook_switch_page(self,obj,junk,page): t = self.notes.get_buffer() - text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE)) + text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: @@ -799,7 +798,7 @@ class LocalMediaProperties: priv = self.change_dialog.get_widget("private").get_active() t = self.notes.get_buffer() - text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE)) + text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),False)) note = self.photo.get_note() format = self.preform.get_active() if text != note or priv != self.photo.get_privacy(): @@ -1167,7 +1166,7 @@ class GlobalMediaProperties: if page == 3: self.display_refs() t = self.notes.get_buffer() - text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE)) + text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: @@ -1194,7 +1193,7 @@ class GlobalMediaProperties: def on_apply_clicked(self, obj): t = self.notes.get_buffer() - text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE)) + text = unicode(t.get_text(t.get_start_iter(),t.get_end_iter(),False)) desc = unicode(self.descr_window.get_text()) note = self.obj.get_note() diff --git a/src/ImgManip.py b/src/ImgManip.py index 15eb7b36d..f03f34fb2 100644 --- a/src/ImgManip.py +++ b/src/ImgManip.py @@ -23,6 +23,7 @@ import const import signal import md5 import gtk +import gobject class ImgManip: def __init__(self,source): @@ -109,10 +110,16 @@ def set_thumbnail_image(path): pixbuf = pixbuf.scale_simple(pw,ph,gtk.gdk.INTERP_BILINEAR) pixbuf.save(_build_thumb_path(path),"jpeg") except: + import traceback + traceback.print_stack() + print "Could not create thumbnail for",path def get_thumbnail_image(path): filename = _build_thumb_path(path) if not os.path.isfile(filename): set_thumbnail_image(path) - return gtk.gdk.pixbuf_new_from_file(filename) + try: + return gtk.gdk.pixbuf_new_from_file(filename) + except gobject.GError: + return None diff --git a/src/ListModel.py b/src/ListModel.py index 7d0141511..b70dff2e1 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -33,7 +33,7 @@ class ListModel: l = len(dlist) self.mylist = [TYPE_STRING]*l + [TYPE_PYOBJECT] - self.tree.set_rules_hint(gtk.TRUE) + self.tree.set_rules_hint(True) self.model = None self.selection = None self.mode = mode @@ -49,17 +49,17 @@ class ListModel: renderer = gtk.CellRendererText() renderer.set_fixed_height_from_font(1) column = gtk.TreeViewColumn(name[0],renderer,text=cnum) - column.set_reorderable(gtk.TRUE) + column.set_reorderable(True) column.set_min_width(name[2]) if name[0] == '': - column.set_visible(gtk.FALSE) + column.set_visible(False) else: - column.set_resizable(gtk.TRUE) + column.set_resizable(True) if name[1] == -1: - column.set_clickable(gtk.FALSE) + column.set_clickable(False) else: - column.set_clickable(gtk.TRUE) + column.set_clickable(True) column.set_sort_column_id(name[1]) cnum = cnum + 1 @@ -243,7 +243,7 @@ class ListModel: model,node = self.selection.get_selected() if node: path = model.get_path(node) - self.tree.scroll_to_cell(path,None,gtk.TRUE,0.5,0.5) + self.tree.scroll_to_cell(path,None,True,0.5,0.5) def button_press(self,obj,event): if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: diff --git a/src/Marriage.py b/src/Marriage.py index 203d900c9..9f10fcace 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -533,7 +533,7 @@ class Marriage: changed = 1 text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) format = self.preform.get_active() if text != self.family.get_note(): @@ -616,7 +616,7 @@ class Marriage: self.family.set_relationship(relation) text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) if text != self.family.get_note(): self.family.set_note(text) @@ -796,7 +796,7 @@ class Marriage: def on_switch_page(self,obj,a,page): text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),gtk.FALSE)) + self.notes_buffer.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/MediaView.py b/src/MediaView.py index b19ca4d3d..476681d50 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -141,7 +141,7 @@ class MediaView: self.list.remove_column(column) column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(225) self.list.append_column(column) @@ -153,7 +153,7 @@ class MediaView: continue name = column_names[pair[1]] column = gtk.TreeViewColumn(name, self.renderer, text=pair[1]) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(75) self.columns.append(column) self.list.append_column(column) @@ -183,16 +183,14 @@ class MediaView: path = mobj.get_path() if mtype: type_name = Utils.get_mime_description(mtype) - image = ImgManip.get_thumbnail_image(path) - if image != None: + if mtype[0:5] == "image": + image = ImgManip.get_thumbnail_image(path) self.preview.set_from_pixbuf(image) else: - icon = Utils.find_icon(mtype) - icon_image = gtk.gdk.pixbuf_new_from_file(icon) + icon_image = Utils.find_mime_type_pixbuf(mtype) self.preview.set_from_pixbuf(icon_image) else: - icon = Utils.find_icon('text/plain') - icon_image = gtk.gdk.pixbuf_new_from_file(icon) + icon_image = Utils.find_mime_type_pixbuf('text/plain') self.preview.set_from_pixbuf(icon_image) type_name = _('Note') diff --git a/src/NameEdit.py b/src/NameEdit.py index c6571a12a..a468859b8 100644 --- a/src/NameEdit.py +++ b/src/NameEdit.py @@ -169,12 +169,12 @@ class NameEditor: def on_group_over_toggled(self,obj): if obj.get_active(): - self.group_as.set_sensitive(gtk.TRUE) - self.group_as.set_editable(gtk.TRUE) + self.group_as.set_sensitive(True) + self.group_as.set_editable(True) else: self.group_as.set_text(self.db.get_name_group_mapping(self.surname_field.get_text())) - self.group_as.set_sensitive(gtk.FALSE) - self.group_as.set_editable(gtk.FALSE) + self.group_as.set_sensitive(False) + self.group_as.set_editable(False) def on_delete_event(self,*obj): self.close_child_windows() @@ -230,7 +230,7 @@ class NameEditor: suffix = unicode(self.suffix_field.get_text()) patronymic = unicode(self.patronymic_field.get_text()) note = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(), - self.note_buffer.get_end_iter(),gtk.FALSE)) + self.note_buffer.get_end_iter(),False)) format = self.preform.get_active() priv = self.priv.get_active() @@ -263,7 +263,7 @@ class NameEditor: self.name.set_sort_as(self.sort_as.get_active()) self.parent.lists_changed = 1 - if self.group_over.get_active() == gtk.FALSE: + if self.group_over.get_active() == False: self.name.set_group_as("") self.parent.lists_changed = 1 elif self.name.get_group_as() != grp_as: @@ -329,7 +329,7 @@ class NameEditor: def on_switch_page(self,obj,a,page): text = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(), - self.note_buffer.get_end_iter(),gtk.FALSE)) + self.note_buffer.get_end_iter(),False)) if text: Utils.bold_label(self.notes_label) else: diff --git a/src/NoteEdit.py b/src/NoteEdit.py index 9878892d0..9aa0fc8c4 100644 --- a/src/NoteEdit.py +++ b/src/NoteEdit.py @@ -118,7 +118,7 @@ class NoteEditor: """Saves the note and closes the window""" tbuffer = self.entry.get_buffer() text = unicode(tbuffer.get_text(tbuffer.get_start_iter(), - tbuffer.get_end_iter(),gtk.FALSE)) + tbuffer.get_end_iter(),False)) if text != self.data.get_note(): self.data.set_note(text) if self.callback: diff --git a/src/PedView.py b/src/PedView.py index 0a9c6402f..8f02a891f 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -149,7 +149,7 @@ class DispBox: return 0 if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: self.build_menu(event,self.person) - return gtk.TRUE + return True return 0 def expand(self): @@ -393,7 +393,7 @@ class PedigreeView: label = gtk.Label('%s' % cname) else: label = gtk.Label(cname) - label.set_use_markup(gtk.TRUE) + label.set_use_markup(True) label.show() label.set_alignment(0,0) menuitem.add(label) @@ -528,8 +528,8 @@ class PedigreeView: def on_canvas_press(self,obj,event): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: self.build_nav_menu(event) - return gtk.TRUE - return gtk.FALSE + return True + return False def add_nav_portion_to_menu(self,menu): """ @@ -661,7 +661,7 @@ class PedigreeView: label = gtk.Label(NameDisplay.displayer.display(child)) child_item = gtk.MenuItem(None) - label.set_use_markup(gtk.TRUE) + label.set_use_markup(True) label.show() label.set_alignment(0,0) child_item.add(label) @@ -695,7 +695,7 @@ class PedigreeView: label = gtk.Label(NameDisplay.displayer.display(par)) par_item = gtk.MenuItem(None) - label.set_use_markup(gtk.TRUE) + label.set_use_markup(True) label.show() label.set_alignment(0,0) par_item.add(label) diff --git a/src/PeopleView.py b/src/PeopleView.py index 1ac599b1c..05f7a7e5b 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -75,7 +75,7 @@ class PeopleView: self.DataFilter = None self.pscroll = self.parent.gtop.get_widget("pscroll") self.person_tree = self.parent.gtop.get_widget("person_tree") - self.person_tree.set_rules_hint(gtk.TRUE) + self.person_tree.set_rules_hint(True) self.renderer = gtk.CellRendererText() self.columns = [] @@ -105,7 +105,7 @@ class PeopleView: self.person_tree.remove_column(column) column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) #column.set_clickable(True) #column.connect('clicked',self.sort_clicked) column.set_min_width(225) @@ -119,7 +119,7 @@ class PeopleView: continue name = column_names[pair[1]] column = gtk.TreeViewColumn(name, self.renderer, text=pair[1]) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) #column.set_clickable(True) #column.connect('clicked',self.sort_clicked) column.set_min_width(60) diff --git a/src/PlaceView.py b/src/PlaceView.py index 8f6bb1306..62a2d6c8d 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -91,7 +91,7 @@ class PlaceView: self.list.remove_column(column) column = gtk.TreeViewColumn(_('Place Name'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(225) self.list.append_column(column) @@ -102,7 +102,7 @@ class PlaceView: continue name = column_names[pair[1]] column = gtk.TreeViewColumn(name, self.renderer, text=pair[1]) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(75) self.columns.append(column) self.list.append_column(column) diff --git a/src/Plugins.py b/src/Plugins.py index 596768da1..9225cf88c 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -123,7 +123,7 @@ class PluginDialog: self.apply_button.set_label(button_label) else: self.apply_button.set_label(_("_Apply")) - self.apply_button.set_use_underline(gtk.TRUE) + self.apply_button.set_use_underline(True) if tool_tip: try: tt = gtk.tooltips_data_get(self.apply_button) diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 3cb12a792..71a955ba9 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -35,11 +35,11 @@ class SaveDialog: label1 = self.xml.get_widget('label1') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2 = self.xml.get_widget('label2') label2.set_text(msg2) - label2.set_use_markup(gtk.TRUE) + label2.set_use_markup(True) self.top.show() if parent: @@ -61,11 +61,11 @@ class QuestionDialog: label1 = self.xml.get_widget('label1') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2 = self.xml.get_widget('label2') label2.set_text(msg2) - label2.set_use_markup(gtk.TRUE) + label2.set_use_markup(True) self.xml.get_widget('okbutton').set_label(label) @@ -85,11 +85,11 @@ class QuestionDialog2: label1 = self.xml.get_widget('label1') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2 = self.xml.get_widget('label2') label2.set_text(msg2) - label2.set_use_markup(gtk.TRUE) + label2.set_use_markup(True) self.xml.get_widget('okbutton').set_label(label_msg1) self.xml.get_widget('no').set_label(label_msg2) @@ -110,11 +110,11 @@ class OptionDialog: label1 = self.xml.get_widget('label1') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2 = self.xml.get_widget('label2') label2.set_text(msg2) - label2.set_use_markup(gtk.TRUE) + label2.set_use_markup(True) self.xml.get_widget('option1').set_label(btnmsg1) self.xml.get_widget('option2').set_label(btnmsg2) @@ -142,7 +142,7 @@ class ErrorDialog: label1 = self.xml.get_widget('label1') label2 = self.xml.get_widget('label2') label1.set_text('%s' % str(msg1)) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2.set_text(str(msg2)) self.top.show() if parent: @@ -159,7 +159,7 @@ class WarningDialog: label1 = self.xml.get_widget('label1') label2 = self.xml.get_widget('label2') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2.set_text(msg2) self.top.show() if parent: @@ -176,7 +176,7 @@ class OkDialog: label1 = self.xml.get_widget('label1') label2 = self.xml.get_widget('label2') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2.set_text(msg2) self.top.show() if parent: @@ -194,11 +194,11 @@ class MissingMediaDialog: label1 = self.xml.get_widget('label4') label1.set_text('%s' % msg1) - label1.set_use_markup(gtk.TRUE) + label1.set_use_markup(True) label2 = self.xml.get_widget('label3') label2.set_text(msg2) - label2.set_use_markup(gtk.TRUE) + label2.set_use_markup(True) check_button = self.xml.get_widget('use_always') diff --git a/src/Report.py b/src/Report.py index 657197b42..e6116114a 100644 --- a/src/Report.py +++ b/src/Report.py @@ -261,7 +261,7 @@ class Report: # Customize the dialog for this report (title, header) = self.get_progressbar_data() self.ptop = gtk.Dialog() - self.ptop.set_has_separator(gtk.FALSE) + self.ptop.set_has_separator(False) self.ptop.set_title(title) lbl = gtk.Label(header) lbl.set_use_markup(True) @@ -341,7 +341,7 @@ class BareReportDialog: self.local_filters = [] self.window = gtk.Dialog('GRAMPS') - self.window.set_has_separator(gtk.FALSE) + self.window.set_has_separator(False) self.cancel = self.window.add_button(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL) self.ok = self.window.add_button(gtk.STOCK_OK,gtk.RESPONSE_OK) @@ -356,7 +356,7 @@ class BareReportDialog: self.setup_title() self.setup_header() - self.tbl = gtk.Table(4,4,gtk.FALSE) + self.tbl = gtk.Table(4,4,False) self.tbl.set_col_spacings(12) self.tbl.set_row_spacings(6) self.tbl.set_border_width(6) @@ -532,8 +532,8 @@ class BareReportDialog: title = self.get_header(self.name) label = gtk.Label('%s' % title) - label.set_use_markup(gtk.TRUE) - self.window.vbox.pack_start(label, gtk.TRUE, gtk.TRUE, + label.set_use_markup(True) + self.window.vbox.pack_start(label, True, True, ReportDialog.border_pad) def setup_target_frame(self): @@ -551,7 +551,7 @@ class BareReportDialog: Should be overwritten by standalone report dialogs. """ center_label = gtk.Label("%s" % _("Center Person")) - center_label.set_use_markup(gtk.TRUE) + center_label.set_use_markup(True) center_label.set_alignment(0.0,0.5) self.tbl.set_border_width(12) self.tbl.attach(center_label,0,4,self.col,self.col+1) @@ -637,7 +637,7 @@ class BareReportDialog: label = gtk.Label("%s" % _("Report Options")) label.set_alignment(0.0,0.5) - label.set_use_markup(gtk.TRUE) + label.set_use_markup(True) if len(self.frame_names) == 0: table.attach(label,0,3,0,1) @@ -737,7 +737,7 @@ class BareReportDialog: table.set_row_spacings(6) table.set_border_width(6) l = gtk.Label("%s" % _(key)) - l.set_use_markup(gtk.TRUE) + l.set_use_markup(True) self.notebook.append_page(table,l) row = 0 @@ -821,7 +821,7 @@ class BareReportDialog: if self.extra_textbox: b = self.extra_textbox.get_buffer() - text_val = unicode(b.get_text(b.get_start_iter(),b.get_end_iter(),gtk.FALSE)) + text_val = unicode(b.get_text(b.get_start_iter(),b.get_end_iter(),False)) self.report_text = text_val.split('\n') self.options.handler.set_display_format(self.report_text) else: @@ -870,7 +870,7 @@ class BareReportDialog: new_name = new_person.get_primary_name().get_regular_name() if new_name: self.person_label.set_text( "%s" % new_name ) - self.person_label.set_use_markup(gtk.TRUE) + self.person_label.set_use_markup(True) #------------------------------------------------------------------------ # @@ -1025,10 +1025,10 @@ class ReportDialog(BareReportDialog): label = obj.get_printable() if label: self.print_report.set_label (label) - self.print_report.set_sensitive (gtk.TRUE) + self.print_report.set_sensitive (True) else: self.print_report.set_label (_("Print a copy")) - self.print_report.set_sensitive (gtk.FALSE) + self.print_report.set_sensitive (False) # Is this to be a printed report or an electronic report # (i.e. a set of web pages) @@ -1173,7 +1173,7 @@ class ReportDialog(BareReportDialog): self.output_notebook.append_page(self.paper_table,gtk.Label(_("Paper Options"))) paper_label = gtk.Label("%s" % _("Paper Options")) - paper_label.set_use_markup(gtk.TRUE) + paper_label.set_use_markup(True) paper_label.set_alignment(0.0,0.5) self.paper_table.attach(paper_label,0,6,0,1,gtk.SHRINK|gtk.FILL) @@ -1251,7 +1251,7 @@ class ReportDialog(BareReportDialog): self.html_table.set_border_width(0) html_label = gtk.Label("%s" % _("HTML Options")) html_label.set_alignment(0.0,0.5) - html_label.set_use_markup(gtk.TRUE) + html_label.set_use_markup(True) self.html_table.attach(html_label,0,3,0,1) label = gtk.Label(_("HTML Options")) diff --git a/src/SelectChild.py b/src/SelectChild.py index 7ef799a27..e2a7ca0d2 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -131,18 +131,18 @@ class SelectChild: def add_columns(self,tree): column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_resizable(True) + #column.set_clickable(True) column.set_min_width(225) tree.append_column(column) column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) - column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_resizable(True) + #column.set_clickable(True) column.set_min_width(75) tree.append_column(column) column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) - #column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + #column.set_resizable(True) + column.set_clickable(True) tree.append_column(column) def on_delete_event(self,obj,b): @@ -445,8 +445,8 @@ class EditRel: self.fentry.set_text(_(f[2])) self.mentry.set_text(_(f[1])) - self.fdesc.set_use_markup(gtk.TRUE) - self.mdesc.set_use_markup(gtk.TRUE) + self.fdesc.set_use_markup(True) + self.mdesc.set_use_markup(True) self.top.show() def close(self,obj): diff --git a/src/SelectObject.py b/src/SelectObject.py index 4bb134120..4ccd214f2 100644 --- a/src/SelectObject.py +++ b/src/SelectObject.py @@ -116,11 +116,11 @@ class SelectObject: the_type = Utils.get_mime_description(obj.get_mime_type()) path = obj.get_path() - image = ImgManip.get_thumbnail_image(obj.get_path()) - if image: + if the_type[0:5] == "image": + image = ImgManip.get_thumbnail_image(obj.get_path()) self.preview.set_from_pixbuf(image) else: - icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(the_type)) + icon_image = Utils.find_mime_type_pixbuf(the_type) self.preview.set_from_pixbuf(icon_image) self.object_handle.set_text(obj.get_gramps_id()) diff --git a/src/SelectPerson.py b/src/SelectPerson.py index 1a7a1ef99..e73742a00 100644 --- a/src/SelectPerson.py +++ b/src/SelectPerson.py @@ -76,19 +76,19 @@ class SelectPerson: def add_columns(self,tree): column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + column.set_resizable(True) + column.set_clickable(True) column.set_sort_column_id(0) column.set_min_width(225) tree.append_column(column) column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) - column.set_resizable(gtk.TRUE) - column.set_clickable(gtk.TRUE) + column.set_resizable(True) + column.set_clickable(True) column.set_sort_column_id(1) column.set_min_width(75) tree.append_column(column) column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) - column.set_clickable(gtk.TRUE) + column.set_clickable(True) tree.append_column(column) def select_function(self,store,path,iter,id_list): diff --git a/src/SourceView.py b/src/SourceView.py index 8efaa9625..c6fea8595 100644 --- a/src/SourceView.py +++ b/src/SourceView.py @@ -88,7 +88,7 @@ class SourceView: self.list.remove_column(column) column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(225) self.list.append_column(column) self.columns = [column] @@ -98,7 +98,7 @@ class SourceView: continue name = column_names[pair[1]] column = gtk.TreeViewColumn(name, self.renderer, text=pair[1]) - column.set_resizable(gtk.TRUE) + column.set_resizable(True) column.set_min_width(75) self.columns.append(column) self.list.append_column(column) diff --git a/src/Sources.py b/src/Sources.py index 39e2fd028..cf7bbc8f4 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -105,16 +105,16 @@ class SourceSelector: renderer.set_fixed_height_from_font(1) column = gtk.TreeViewColumn (title[0], renderer, text=colno) colno = colno + 1 - column.set_clickable (gtk.TRUE) - column.set_resizable(gtk.TRUE) + column.set_clickable (True) + column.set_resizable(True) column.set_sort_column_id(title[1]) column.set_min_width(title[2]) self.slist.append_column (column) self.selection.connect('changed',self.selection_changed) - self.delete.set_sensitive(gtk.FALSE) - self.edit.set_sensitive(gtk.FALSE) + self.delete.set_sensitive(False) + self.edit.set_sensitive(False) self.redraw() if self.parent: self.window.set_transient_for(self.parent.window) @@ -164,11 +164,11 @@ class SourceSelector: def selection_changed(self,obj): (store,node) = self.selection.get_selected() if node: - self.delete.set_sensitive(gtk.TRUE) - self.edit.set_sensitive(gtk.TRUE) + self.delete.set_sensitive(True) + self.edit.set_sensitive(True) else: - self.delete.set_sensitive(gtk.FALSE) - self.edit.set_sensitive(gtk.FALSE) + self.delete.set_sensitive(False) + self.edit.set_sensitive(False) def redraw(self): self.model.clear() @@ -237,8 +237,8 @@ class SourceTab: renderer = gtk.CellRendererText () column = gtk.TreeViewColumn (title[0], renderer, text=colno) colno = colno + 1 - column.set_clickable (gtk.TRUE) - column.set_resizable(gtk.TRUE) + column.set_clickable (True) + column.set_resizable(True) column.set_sort_column_id(title[1]) column.set_min_width(title[2]) self.slist.append_column (column) @@ -487,15 +487,15 @@ class SourceEditor: buf = self.get_widget("scomment").get_buffer() comments = unicode(buf.get_text(buf.get_start_iter(), - buf.get_end_iter(),gtk.FALSE)) + buf.get_end_iter(),False)) buf = self.get_widget("stext").get_buffer() text = unicode(buf.get_text(buf.get_start_iter(), - buf.get_end_iter(),gtk.FALSE)) + buf.get_end_iter(),False)) buf = self.get_widget('spage').get_buffer() page = unicode(buf.get_text(buf.get_start_iter(), - buf.get_end_iter(),gtk.FALSE)) + buf.get_end_iter(),False)) self.source_ref.set_page(page) self.source_ref.set_date(self.date_obj) diff --git a/src/StartupDialog.py b/src/StartupDialog.py index dd86d6884..0fbfb5fc4 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -124,7 +124,7 @@ class StartupDialog: label = gtk.Label(_('In order to create valid GEDCOM files, the following information ' 'needs to be entered. If you do not plan to generate GEDCOM files, ' 'you may leave this empty.')) - label.set_line_wrap(gtk.TRUE) + label.set_line_wrap(True) box.pack_start(label) diff --git a/src/StyleEditor.py b/src/StyleEditor.py index 5fcb0e6e0..14545139b 100644 --- a/src/StyleEditor.py +++ b/src/StyleEditor.py @@ -81,7 +81,7 @@ class StyleListDisplay: title_label = self.top.get_widget('title') title_label.set_text(Utils.title(_('Style Editor'))) - title_label.set_use_markup(gtk.TRUE) + title_label.set_use_markup(True) self.list = ListModel.ListModel(self.top.get_widget("list"), [('Style',-1,10)],) @@ -202,7 +202,7 @@ class StyleEditor: self.current_p = p self.pname.set_text('%s' % name) - self.pname.set_use_markup(gtk.TRUE) + self.pname.set_use_markup(True) descr = p.get_description() if descr: diff --git a/src/Utils.py b/src/Utils.py index 895471def..ce72de72d 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -227,47 +227,24 @@ def view_photo(photo): if os.fork() == 0: os.execvp(args[0],args) -def nautilus_icon(icon,mime_type): - import GrampsKeys +_icon_theme = gtk.icon_theme_get_default() + +def find_mime_type_pixbuf(mime_type): + icontmp = mime_type.replace('/','-') + try: + newicon = "gnome-mime-%s" % icontmp + try: + return _icon_theme.load_icon(newicon,48,0) + except: + icontmp = mime_type.split('/')[0] + try: + newicon = "gnome-mime-%s" % icontmp + return _icon_theme.load_icon(newicon,48,0) + except: + return gtk.gdk.pixbuf_new_from_file(const.icon) + except: + return gtk.gdk.pixbuf_new_from_file(const.icon) - theme = GrampsKeys.client.get_string("/desktop/gnome/file_views/icon_theme") - - if icon : - newicon = "%s/%s/%s.png" % (const.nautdir,theme,icon) - if os.path.isfile(newicon): - return newicon - else: - newicon = "%s/document-icons/%s.png" % (const.pixdir,icon) - if os.path.isfile(newicon): - return newicon - return None - elif mime_type == "x-directory/": - if theme: - newicon = "%s/%s/i-directory.png" % (const.nautdir,theme) - else: - newicon = "%s/gnome-folder.png" % const.pixdir - if os.path.isfile(newicon): - return newicon - return None - else: - icontmp = mime_type.replace('/','-') - if theme: - newicon = "%s/%s/gnome-%s.png" % (const.nautdir,theme,icontmp) - if os.path.isfile(newicon): - return newicon - else: - newicon = "%s/document-icons/gnome-%s.png" % (const.nautdir,icontmp) - if os.path.isfile(newicon): - return newicon - return None - -def find_icon(mtype): - n = nautilus_icon(None,mtype) - if n: - return n - else: - return const.icon - def get_mime_description(mime_type): try: value = mime_get_description(mime_type) @@ -323,8 +300,8 @@ def build_columns(tree,list): if name[2] >= 0: column.set_sort_column_id(name[2]) if name[0] == '': - column.set_clickable(gtk.TRUE) - column.set_visible(gtk.FALSE) + column.set_clickable(True) + column.set_visible(False) cnum = cnum + 1 tree.append_column(column) @@ -369,11 +346,11 @@ def title(n): def set_title_label(xmlobj,t): title_label = xmlobj.get_widget('title') title_label.set_text('%s' % t) - title_label.set_use_markup(gtk.TRUE) + title_label.set_use_markup(True) def set_titles(window,title,t,msg=None): title.set_text('%s' % t) - title.set_use_markup(gtk.TRUE) + title.set_use_markup(True) if msg: window.set_title('%s - GRAMPS' % msg) else: diff --git a/src/Witness.py b/src/Witness.py index 34f7cd67b..8640bb0dd 100644 --- a/src/Witness.py +++ b/src/Witness.py @@ -243,7 +243,7 @@ class WitnessEditor: self.ref.set_type(RelLib.Event.NAME) c = self.comment.get_buffer() - self.ref.set_comment(unicode(c.get_text(c.get_start_iter(),c.get_end_iter(),gtk.FALSE))) + self.ref.set_comment(unicode(c.get_text(c.get_start_iter(),c.get_end_iter(),False))) self.ref.set_privacy(self.private.get_active()) if self.update: diff --git a/src/gramps_main.py b/src/gramps_main.py index 7c4dc1c31..f728b4405 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1074,7 +1074,7 @@ class Gramps: self.import_tool_callback() def read_file(self,filename,callback=None): - self.topWindow.set_resizable(gtk.FALSE) + self.topWindow.set_resizable(False) mode = "w" filename = os.path.normpath(os.path.abspath(filename)) @@ -1115,7 +1115,7 @@ class Gramps: return 0 - self.topWindow.set_resizable(gtk.TRUE) + self.topWindow.set_resizable(True) self.gtop.get_widget('import1').set_sensitive(not self.db.readonly) self.gtop.get_widget('abandon').set_sensitive(not self.db.readonly) self.gtop.get_widget('undolabel').set_sensitive(not self.db.readonly) diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 24bab3783..4681e844a 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -499,7 +499,7 @@ class BookListDisplay: title_label = self.xml.get_widget('title') title_label.set_text(Utils.title(_('Book List'))) - title_label.set_use_markup(gtk.TRUE) + title_label.set_use_markup(True) self.blist = ListModel.ListModel(self.xml.get_widget("list"), [('Name',-1,10)],) @@ -621,12 +621,12 @@ class BookReportSelector: avail_label = self.xml.get_widget('avail_label') avail_label.set_text("%s" % _("_Available items")) - avail_label.set_use_markup(gtk.TRUE) - avail_label.set_use_underline(gtk.TRUE) + avail_label.set_use_markup(True) + avail_label.set_use_underline(True) book_label = self.xml.get_widget('book_label') book_label.set_text("%s" % _("Current _book")) - book_label.set_use_underline(gtk.TRUE) - book_label.set_use_markup(gtk.TRUE) + book_label.set_use_underline(True) + book_label.set_use_markup(True) av_titles = [(_('Name'),0,150),(_('Type'),1,50),('',-1,0)] bk_titles = [(_('Item name'),-1,150),(_('Type'),-1,50),('',-1,0), diff --git a/src/plugins/CustomBookText.py b/src/plugins/CustomBookText.py index 442f52d7d..8e0ef30fa 100644 --- a/src/plugins/CustomBookText.py +++ b/src/plugins/CustomBookText.py @@ -156,7 +156,7 @@ class CustomTextOptions(ReportOptions.ReportOptions): self.top_text_view.get_buffer().get_text( self.top_text_view.get_buffer().get_start_iter(), self.top_text_view.get_buffer().get_end_iter(), - gtk.FALSE + False ) ).replace('\n',' ') @@ -164,7 +164,7 @@ class CustomTextOptions(ReportOptions.ReportOptions): self.middle_text_view.get_buffer().get_text( self.middle_text_view.get_buffer().get_start_iter(), self.middle_text_view.get_buffer().get_end_iter(), - gtk.FALSE + False ) ).replace('\n',' ') @@ -172,7 +172,7 @@ class CustomTextOptions(ReportOptions.ReportOptions): self.bottom_text_view.get_buffer().get_text( self.bottom_text_view.get_buffer().get_start_iter(), self.bottom_text_view.get_buffer().get_end_iter(), - gtk.FALSE + False ) ).replace('\n',' ') diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index 2f560ff33..2ee7cc5ed 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -85,8 +85,8 @@ class DesBrowse: self.tree.append_column(col) self.model = gtk.TreeStore(gobject.TYPE_STRING,gobject.TYPE_PYOBJECT) self.tree.set_model(self.model) - self.tree.set_rules_hint(gtk.TRUE) - self.tree.set_headers_visible(gtk.FALSE) + self.tree.set_rules_hint(True) + self.tree.set_headers_visible(False) self.add_to_tree(None,None,self.active.get_handle()) self.tree.expand_all() diff --git a/src/plugins/Eval.py b/src/plugins/Eval.py index e66a2e3a6..6159f7bdd 100644 --- a/src/plugins/Eval.py +++ b/src/plugins/Eval.py @@ -84,7 +84,7 @@ class EvalWindow: def apply_clicked(self,obj): text = unicode(self.ebuf.get_text(self.ebuf.get_start_iter(), - self.ebuf.get_end_iter(),gtk.FALSE)) + self.ebuf.get_end_iter(),False)) outtext = cStringIO.StringIO() errtext = cStringIO.StringIO() diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index 7e45b9417..538d3c654 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -154,7 +154,7 @@ class MyPlaces(gtk.Entry): class MyID(gtk.HBox): def __init__(self,db): - gtk.HBox.__init__(self,gtk.FALSE,6) + gtk.HBox.__init__(self,False,6) self.db = db self.entry = gtk.Entry() diff --git a/src/plugins/SimpleBookTitle.py b/src/plugins/SimpleBookTitle.py index 6883b0ffe..a2bdc8684 100644 --- a/src/plugins/SimpleBookTitle.py +++ b/src/plugins/SimpleBookTitle.py @@ -202,7 +202,7 @@ class SimpleBookTitleOptions(ReportOptions.ReportOptions): self.size.set_digits(2) self.size.set_increments(1,2) self.size.set_range(0,20) - self.size.set_numeric(gtk.TRUE) + self.size.set_numeric(True) self.size.set_value(self.options_dict['imgsize']) dialog.add_frame_option(_('Image'),_('Preview'),preview_table) @@ -230,8 +230,8 @@ class SimpleBookTitleOptions(ReportOptions.ReportOptions): self.options_dict['imgid'] = "" self.obj_title.set_text('') self.preview.set_from_pixbuf(None) - self.remove_obj_button.set_sensitive(gtk.FALSE) - self.size.set_sensitive(gtk.FALSE) + self.remove_obj_button.set_sensitive(False) + self.size.set_sensitive(False) def select_obj(self,obj,database): s_o = SelectObject.SelectObject(database,_("Select an Object")) @@ -250,8 +250,8 @@ class SimpleBookTitleOptions(ReportOptions.ReportOptions): self.obj_title.set_text(the_object.get_description()) icon_image = ImgManip.get_thumbnail_image(the_object.get_path()) self.preview.set_from_pixbuf(icon_image) - self.remove_obj_button.set_sensitive(gtk.TRUE) - self.size.set_sensitive(gtk.TRUE) + self.remove_obj_button.set_sensitive(True) + self.size.set_sensitive(True) def make_default_style(self,default_style): """Make the default output style for the Simple Boot Title report.""" diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index affa4b19f..fd1f2d3d1 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -1304,7 +1304,7 @@ class WebReportOptions(ReportOptions.ReportOptions): self.depth.set_digits(0) self.depth.set_increments(1,2) self.depth.set_range(1,10) - self.depth.set_numeric(gtk.TRUE) + self.depth.set_numeric(True) self.depth.set_value(self.options_dict['HTMLtreed']) self.use_link = gtk.CheckButton(lnk_msg) @@ -1371,7 +1371,7 @@ class WebReportOptions(ReportOptions.ReportOptions): self.use_n_cols.set_digits(0) self.use_n_cols.set_increments(1,2) self.use_n_cols.set_range(1,5) - self.use_n_cols.set_numeric(gtk.TRUE) + self.use_n_cols.set_numeric(True) self.use_n_cols.set_value(self.options_dict['HTMLidxcol']) tlist = Report._template_map.keys()