Working about dialog, preferences, quickview on click in gramplet, event editor opens, and minor things

svn: r19871
This commit is contained in:
Benny Malengier
2012-06-18 22:56:57 +00:00
parent 35ccf01827
commit ff93112221
30 changed files with 56 additions and 36 deletions

View File

@@ -44,6 +44,7 @@ except ImportError:
# Gtk modules # Gtk modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import GObject
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf

View File

@@ -168,7 +168,7 @@ class ConfigureDialog(ManagedWindow):
self.__config = configmanager self.__config = configmanager
ManagedWindow.__init__(self, uistate, [], configobj) ManagedWindow.__init__(self, uistate, [], configobj)
self.set_window( self.set_window(
Gtk.Dialog(dialogtitle, flags=Gtk.DialogFlags.NO_SEPARATOR, Gtk.Dialog(dialogtitle,
buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)), buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)),
None, dialogtitle, None) None, dialogtitle, None)
self.panel = Gtk.Notebook() self.panel = Gtk.Notebook()
@@ -307,8 +307,8 @@ class ConfigureDialog(ManagedWindow):
image.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON) image.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)
image.show() image.show()
btn.add(image) btn.add(image)
hbox.pack_start(entry, expand=True, fill=True) hbox.pack_start(entry, True, True, 0)
hbox.pack_start(btn, expand=False, fill=False) hbox.pack_start(btn, False, False, 0)
table.attach(lwidget, 1, 2, index, index+1, yoptions=0, table.attach(lwidget, 1, 2, index, index+1, yoptions=0,
xoptions=Gtk.AttachOptions.FILL) xoptions=Gtk.AttachOptions.FILL)
table.attach(hbox, 2, 3, index, index+1, yoptions=0) table.attach(hbox, 2, 3, index, index+1, yoptions=0)
@@ -418,7 +418,7 @@ class ConfigureDialog(ManagedWindow):
callback = self.update_spinner callback = self.update_spinner
lwidget = BasicLabel("%s: " % label) lwidget = BasicLabel("%s: " % label)
adj = Gtk.Adjustment(config.get(constant), range[0], range[1], 1, 0, 0) adj = Gtk.Adjustment(config.get(constant), range[0], range[1], 1, 0, 0)
spinner = Gtk.SpinButton(adj) spinner = Gtk.SpinButton(adjustment=adj, climb_rate=0.0, digits=0)
spinner.connect('value-changed', callback, constant) spinner.connect('value-changed', callback, constant)
table.attach(lwidget, 1, 2, index, index+1, yoptions=0, table.attach(lwidget, 1, 2, index, index+1, yoptions=0,
xoptions=Gtk.AttachOptions.FILL) xoptions=Gtk.AttachOptions.FILL)
@@ -875,8 +875,8 @@ class GrampsPreferences(ConfigureDialog):
hbox = Gtk.HBox() hbox = Gtk.HBox()
btn = Gtk.Button("%s..." % _('Edit') ) btn = Gtk.Button("%s..." % _('Edit') )
btn.connect('clicked', self.cb_name_dialog) btn.connect('clicked', self.cb_name_dialog)
hbox.pack_start(self.fmt_obox, expand=True, fill=True) hbox.pack_start(self.fmt_obox, True, True, 0)
hbox.pack_start(btn, expand=False, fill=False) hbox.pack_start(btn, False, False, 0)
table.attach(lwidget, 0, 1, row, row+1, yoptions=0) table.attach(lwidget, 0, 1, row, row+1, yoptions=0)
table.attach(hbox, 1, 3, row, row+1, yoptions=0) table.attach(hbox, 1, 3, row, row+1, yoptions=0)
row += 1 row += 1

View File

@@ -90,6 +90,13 @@ class _DdType:
return Gtk.TargetEntry.new(self.drag_type, self.target_flags, return Gtk.TargetEntry.new(self.drag_type, self.target_flags,
self.app_id) self.app_id)
def target_data(self):
"""
Return the target information as a list in the format required by
Gtk3 functions.
"""
return [self.drag_type, self.target_flags, self.app_id]
class _DdTargets(object): class _DdTargets(object):
"""A single class that manages all the drag and drop targets.""" """A single class that manages all the drag and drop targets."""

View File

@@ -52,7 +52,7 @@ class AddressModel(Gtk.ListStore):
""" """
AddressModel derives from the ListStore, defining te items in the list AddressModel derives from the ListStore, defining te items in the list
""" """
GObject.GObject.__init__(self, str, str, str, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, str, str, str, object)
self.db = dbase self.db = dbase
for obj in obj_list: for obj in obj_list:
self.append(row=[ self.append(row=[

View File

@@ -42,7 +42,7 @@ from gi.repository import Gtk
class AttrModel(Gtk.ListStore): class AttrModel(Gtk.ListStore):
def __init__(self, attr_list, db): def __init__(self, attr_list, db):
GObject.GObject.__init__(self, str, str, object) Gtk.ListStore.__init__(self, str, str, object)
self.db = db self.db = db
for attr in attr_list: for attr in attr_list:
self.append(row=[ self.append(row=[

View File

@@ -49,7 +49,7 @@ class BackRefModel(Gtk.ListStore):
dispstr = _('%(part1)s - %(part2)s') dispstr = _('%(part1)s - %(part2)s')
def __init__(self, sref_list, db): def __init__(self, sref_list, db):
GObject.GObject.__init__(self, str, str, str, str, str) Gtk.ListStore.__init__(self, str, str, str, str, str)
self.db = db self.db = db
self.sref_list = sref_list self.sref_list = sref_list
self.count = 0 self.count = 0

View File

@@ -47,7 +47,7 @@ from gen.utils import get_birth_or_fallback, get_death_or_fallback
class ChildModel(Gtk.ListStore): class ChildModel(Gtk.ListStore):
def __init__(self, child_ref_list, db): def __init__(self, child_ref_list, db):
GObject.GObject.__init__(self, int, str, str, str, str, str, Gtk.ListStore.__init__(self, int, str, str, str, str, str,
str, str, str, str, str, str, str, object) str, str, str, str, str, str, str, object)
self.db = db self.db = db
for index, child_ref in enumerate(child_ref_list): for index, child_ref in enumerate(child_ref_list):

View File

@@ -36,7 +36,7 @@ from gi.repository import Gtk
class CitationRefModel(Gtk.ListStore): class CitationRefModel(Gtk.ListStore):
def __init__(self, citation_list, db): def __init__(self, citation_list, db):
GObject.GObject.__init__(self, str, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, str, object)
self.db = db self.db = db
for handle in citation_list: for handle in citation_list:
citation = self.db.get_citation_from_handle(handle) citation = self.db.get_citation_from_handle(handle)

View File

@@ -42,7 +42,7 @@ from gi.repository import Gtk
class DataModel(Gtk.ListStore): class DataModel(Gtk.ListStore):
def __init__(self, attr_list, db): def __init__(self, attr_list, db):
GObject.GObject.__init__(self, str, str) Gtk.ListStore.__init__(self, str, str)
self.db = db self.db = db
for key,value in attr_list.items(): for key,value in attr_list.items():

View File

@@ -176,14 +176,15 @@ class EmbeddedList(ButtonTab):
""" """
if self._DND_EXTRA: if self._DND_EXTRA:
dnd_types = [ self._DND_TYPE.target(), self._DND_EXTRA.target() ] dnd_types = [self._DND_TYPE.target_data(),
self._DND_EXTRA.target_data()]
else: else:
dnd_types = [ self._DND_TYPE.target() ] dnd_types = [self._DND_TYPE.target_data()]
self.tree.enable_model_drag_dest(dnd_types, self.tree.enable_model_drag_dest(dnd_types,
Gdk.DragAction.COPY) Gdk.DragAction.COPY)
self.tree.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, self.tree.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK,
[self._DND_TYPE.target()], [self._DND_TYPE.target_data()],
Gdk.DragAction.COPY) Gdk.DragAction.COPY)
self.tree.connect('drag_data_get', self.drag_data_get) self.tree.connect('drag_data_get', self.drag_data_get)
if not self.dbstate.db.readonly: if not self.dbstate.db.readonly:

View File

@@ -35,6 +35,8 @@ import urlparse
# GTK libraries # GTK libraries
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Pango from gi.repository import Pango
import os import os
@@ -197,8 +199,8 @@ class GalleryTab(ButtonTab, DbGUIElement):
text_renderer.set_property('wrap-mode', Pango.WrapMode.WORD_CHAR) text_renderer.set_property('wrap-mode', Pango.WrapMode.WORD_CHAR)
text_renderer.set_property('wrap-width', const.THUMBSCALE) text_renderer.set_property('wrap-width', const.THUMBSCALE)
text_renderer.set_property('alignment', Pango.Alignment.CENTER) text_renderer.set_property('alignment', Pango.Alignment.CENTER)
self.iconlist.pack_end(text_renderer) self.iconlist.pack_end(text_renderer, True)
self.iconlist.set_attributes(text_renderer, text=1) self.iconlist.add_attribute(text_renderer, "text", 1)
# set basic properties of the icon view # set basic properties of the icon view
self.iconlist.set_margin(padding) self.iconlist.set_margin(padding)
@@ -218,7 +220,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
# put everything together # put everything together
scroll.add(self.iconlist) scroll.add(self.iconlist)
self.pack_end(scroll, True) self.pack_end(scroll, True, True, 0)
def _update_internal_list(self, *obj): def _update_internal_list(self, *obj):
newlist = [] newlist = []

View File

@@ -51,7 +51,7 @@ class LdsModel(Gtk.ListStore):
_HANDLE_COL = 5 _HANDLE_COL = 5
def __init__(self, lds_list, db): def __init__(self, lds_list, db):
GObject.GObject.__init__(self, str, str, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, str, str, object)
self.db = db self.db = db
for lds_ord in lds_list: for lds_ord in lds_list:

View File

@@ -42,7 +42,7 @@ from gi.repository import Gtk
class LocationModel(Gtk.ListStore): class LocationModel(Gtk.ListStore):
def __init__(self, obj_list, db): def __init__(self, obj_list, db):
GObject.GObject.__init__(self, str, str, str, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, str, str, str, object)
self.db = db self.db = db
for obj in obj_list: for obj in obj_list:
self.append(row=[obj.street, obj.locality, obj.city, obj.county, self.append(row=[obj.street, obj.locality, obj.city, obj.county,

View File

@@ -35,7 +35,7 @@ from gi.repository import Gtk
class NoteModel(Gtk.ListStore): class NoteModel(Gtk.ListStore):
def __init__(self, note_list, db): def __init__(self, note_list, db):
GObject.GObject.__init__(self, str, str, object) Gtk.ListStore.__init__(self, str, str, object)
self.db = db self.db = db
for handle in note_list: for handle in note_list:
note = self.db.get_note_from_handle(handle) note = self.db.get_note_from_handle(handle)

View File

@@ -42,7 +42,7 @@ from gen.display.name import displayer as name_displayer
class PersonRefModel(Gtk.ListStore): class PersonRefModel(Gtk.ListStore):
def __init__(self, obj_list, db): def __init__(self, obj_list, db):
GObject.GObject.__init__(self, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, object)
self.db = db self.db = db
for obj in obj_list: for obj in obj_list:
p = self.db.get_person_from_handle(obj.ref) p = self.db.get_person_from_handle(obj.ref)

View File

@@ -42,7 +42,7 @@ from gi.repository import Gtk
class RepoRefModel(Gtk.ListStore): class RepoRefModel(Gtk.ListStore):
def __init__(self, ref_list, db): def __init__(self, ref_list, db):
GObject.GObject.__init__(self, str, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, str, object)
self.db = db self.db = db
for ref in ref_list: for ref in ref_list:
repo = self.db.get_repository_from_handle(ref.ref) repo = self.db.get_repository_from_handle(ref.ref)

View File

@@ -45,7 +45,7 @@ class SurnameModel(Gtk.ListStore):
def __init__(self, surn_list, db): def __init__(self, surn_list, db):
#setup model for the treeview #setup model for the treeview
GObject.GObject.__init__(self, str, str, str, str, Gtk.ListStore.__init__(self, str, str, str, str,
bool, object) bool, object)
for surn in surn_list: for surn in surn_list:
# fill the liststore # fill the liststore

View File

@@ -42,7 +42,7 @@ class WebModel(Gtk.ListStore):
""" """
def __init__(self, obj_list, dbase): def __init__(self, obj_list, dbase):
GObject.GObject.__init__(self, str, str, str, object) Gtk.ListStore.__init__(self, str, str, str, object)
self.db = dbase self.db = dbase
for obj in obj_list: for obj in obj_list:
self.append(row=[str(obj.type), obj.path, obj.desc, obj]) self.append(row=[str(obj.type), obj.path, obj.desc, obj])

View File

@@ -210,7 +210,7 @@ class EditEvent(EditPrimary):
self._setup_notebook_tabs(notebook) self._setup_notebook_tabs(notebook)
notebook.show_all() notebook.show_all()
self.top.get_object('vbox').pack_start(notebook, True) self.top.get_object('vbox').pack_start(notebook, True, True, 0)
self.track_ref_for_deletion("citation_list") self.track_ref_for_deletion("citation_list")
self.track_ref_for_deletion("note_list") self.track_ref_for_deletion("note_list")

View File

@@ -147,7 +147,7 @@ class EditPrimary(ManagedWindow, DbGUIElement):
def _add_tab(self, notebook, page): def _add_tab(self, notebook, page):
self.__tabs.append(page) self.__tabs.append(page)
notebook.insert_page(page, page.get_tab_widget()) notebook.insert_page(page, page.get_tab_widget(), -1)
page.label.set_use_underline(True) page.label.set_use_underline(True)
return page return page

View File

@@ -158,7 +158,7 @@ class EditReference(ManagedWindow, DbGUIElement):
def _add_tab(self, notebook,page): def _add_tab(self, notebook,page):
self.__tabs.append(page) self.__tabs.append(page)
notebook.insert_page(page, page.get_tab_widget()) notebook.insert_page(page, page.get_tab_widget(), -1)
page.label.set_use_underline(True) page.label.set_use_underline(True)
return page return page

View File

@@ -102,7 +102,7 @@ class EditSecondary(ManagedWindow, DbGUIElement):
def _add_tab(self, notebook,page): def _add_tab(self, notebook,page):
self.__tabs.append(page) self.__tabs.append(page)
notebook.insert_page(page, page.get_tab_widget()) notebook.insert_page(page, page.get_tab_widget(), -1)
page.label.set_use_underline(True) page.label.set_use_underline(True)
return page return page

View File

@@ -36,6 +36,7 @@ _LOG = logging.getLogger(".objectentries")
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Pango from gi.repository import Pango
@@ -133,7 +134,7 @@ class ObjEntry(object):
self.label.set_use_markup(True) self.label.set_use_markup(True)
else: else:
self.label.set_text(name) self.label.set_text(name)
self.label.set_ellipsize(Pango.ELLIPSIZE_END) self.label.set_ellipsize(Pango.EllipsizeMode.END)
def _init_dnd(self): def _init_dnd(self):
"""inheriting objects must set this """inheriting objects must set this

View File

@@ -219,7 +219,8 @@ class SidebarFilter(DbGUIElement):
""" """
hbox = Gtk.HBox() hbox = Gtk.HBox()
hbox.pack_start(widget, True, True, 0) hbox.pack_start(widget, True, True, 0)
hbox.pack_start(widgets.SimpleButton(Gtk.STOCK_EDIT, self.edit_filter), False, False) hbox.pack_start(widgets.SimpleButton(Gtk.STOCK_EDIT, self.edit_filter),
False, False, 0)
self.add_entry(text, hbox) self.add_entry(text, hbox)
def edit_filter(self, obj): def edit_filter(self, obj):

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-requires grampswidgets 0.0 -->
<!-- interface-naming-policy project-wide --> <!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="editevent"> <object class="GtkDialog" id="editevent">
@@ -247,9 +246,15 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxEntry" id="personal_events"> <object class="GtkComboBox" id="personal_events">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip_text" translatable="yes">What type of event this is. Eg 'Burial', 'Graduation', ... .</property> <property name="tooltip_text" translatable="yes">What type of event this is. Eg 'Burial', 'Graduation', ... .</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="personal_events-entry">
<property name="can_focus">False</property>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>

View File

@@ -460,7 +460,7 @@ class ManagedWindow(object):
else : else :
assert self.window, "ManagedWindow: self.window does not exist!" assert self.window, "ManagedWindow: self.window does not exist!"
self.set_transient_for(self.parent_window) self.window.set_transient_for(self.parent_window)
self.opened = True self.opened = True
self.window.show_all() self.window.show_all()

View File

@@ -339,7 +339,7 @@ class QuickTable(SimpleTable):
#treeview.enable_model_drag_dest(DdTargets.all_targets(), #treeview.enable_model_drag_dest(DdTargets.all_targets(),
# Gdk.DragAction.DEFAULT) # Gdk.DragAction.DEFAULT)
treeview.connect('drag_data_get', self.object_drag_data_get) treeview.connect('drag_data_get', self.object_drag_data_get)
treeview.set_grid_lines(Gtk.TREE_VIEW_GRID_LINES_BOTH) treeview.set_grid_lines(Gtk.TreeViewGridLines.BOTH)
#treeview.connect('row-activated', on_table_doubleclick, self) #treeview.connect('row-activated', on_table_doubleclick, self)
#treeview.connect('cursor-changed', on_table_click, self) #treeview.connect('cursor-changed', on_table_click, self)
treeview.connect('button-press-event', self.button_press_event) treeview.connect('button-press-event', self.button_press_event)

View File

@@ -69,7 +69,7 @@ class DisplayBuf(ManagedWindow):
document.text_view.set_buffer(document.buffer) document.text_view.set_buffer(document.buffer)
self.window.connect('response', self.close) self.window.connect('response', self.close)
scrolled_window.add(document.text_view) scrolled_window.add(document.text_view)
self.window.vbox.add(scrolled_window) self.window.vbox.pack_start(scrolled_window, True, True, 0)
self.window.show_all() self.window.show_all()
def build_menu_names(self, obj): def build_menu_names(self, obj):

View File

@@ -39,6 +39,7 @@ _LOG = logging.getLogger('.navigationview')
# gtk # gtk
# #
#---------------------------------------------------------------- #----------------------------------------------------------------
from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
#---------------------------------------------------------------- #----------------------------------------------------------------

View File

@@ -38,6 +38,7 @@ _LOG = logging.getLogger(".widgets.buttons")
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import GObject from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------