Compare commits
1 Commits
master
...
FR10850_V2
Author | SHA1 | Date | |
---|---|---|---|
|
f5e53e53bc |
@ -196,6 +196,7 @@ register('interface.view-categories',
|
|||||||
register('interface.filter', False)
|
register('interface.filter', False)
|
||||||
register('interface.fullscreen', False)
|
register('interface.fullscreen', False)
|
||||||
register('interface.grampletbar-close', False)
|
register('interface.grampletbar-close', False)
|
||||||
|
register('interface.grampletbar-freeze', False)
|
||||||
register('interface.ignore-gexiv2', False)
|
register('interface.ignore-gexiv2', False)
|
||||||
register('interface.ignore-pil', False)
|
register('interface.ignore-pil', False)
|
||||||
register('interface.ignore-osmgpsmap', False)
|
register('interface.ignore-osmgpsmap', False)
|
||||||
|
@ -291,17 +291,46 @@ class Gramplet:
|
|||||||
"""
|
"""
|
||||||
The main interface for running the :meth:`main` method.
|
The main interface for running the :meth:`main` method.
|
||||||
"""
|
"""
|
||||||
from gi.repository import GLib
|
|
||||||
if ((not self.active) and
|
if ((not self.active) and
|
||||||
not self.gui.force_update):
|
not self.gui.force_update):
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
if self.dbstate.is_open():
|
if self.dbstate.is_open():
|
||||||
#print " %s is not active" % self.gui.gname
|
#print(" %s is not active" % self.gui.gname)
|
||||||
self.update_has_data()
|
self.update_has_data()
|
||||||
else:
|
else:
|
||||||
self.set_has_data(False)
|
self.set_has_data(False)
|
||||||
return
|
return
|
||||||
#print " %s is UPDATING" % self.gui.gname
|
#print(" %s is UPDATING" % self.gui.gname)
|
||||||
|
uva = self.uistate.viewmanager.active_page
|
||||||
|
# The dashboard has no sidebar or bottombar
|
||||||
|
if uva.bottombar:
|
||||||
|
for gramplets in [uva.bottombar.get_children()]:
|
||||||
|
for gramplet in gramplets:
|
||||||
|
for i in range(gramplet.pui.gui.pane.get_n_pages()):
|
||||||
|
child = gramplet.pui.gui.pane.get_nth_page(i)
|
||||||
|
label = gramplet.pui.gui.pane.get_tab_label(child)
|
||||||
|
act_grplet = (i == gramplet.pui.gui.pane.get_current_page())
|
||||||
|
if (gramplet.title == child.get_title() and
|
||||||
|
gramplet.title == self.gui.title and
|
||||||
|
not label.get_freeze().get_active() and
|
||||||
|
act_grplet):
|
||||||
|
self._really_update()
|
||||||
|
for gramplets in [uva.sidebar.get_children()]:
|
||||||
|
for gramplet in gramplets:
|
||||||
|
for i in range(gramplet.pui.gui.pane.get_n_pages()):
|
||||||
|
child = gramplet.pui.gui.pane.get_nth_page(i)
|
||||||
|
label = gramplet.pui.gui.pane.get_tab_label(child)
|
||||||
|
act_grplet = (i == gramplet.pui.gui.pane.get_current_page())
|
||||||
|
if (gramplet.title == child.get_title() and
|
||||||
|
gramplet.title == self.gui.title and
|
||||||
|
not label.get_freeze().get_active() and
|
||||||
|
act_grplet):
|
||||||
|
self._really_update()
|
||||||
|
else:
|
||||||
|
self._really_update()
|
||||||
|
|
||||||
|
def _really_update(self):
|
||||||
|
from gi.repository import GLib
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
LOG.debug("gramplet updater: %s: running" % self.gui.title)
|
LOG.debug("gramplet updater: %s: running" % self.gui.title)
|
||||||
if self._idle_id != 0:
|
if self._idle_id != 0:
|
||||||
|
@ -984,6 +984,12 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
"""
|
"""
|
||||||
self.uistate.emit('grampletbar-close-changed')
|
self.uistate.emit('grampletbar-close-changed')
|
||||||
|
|
||||||
|
def cb_grampletbar_freeze(self, obj):
|
||||||
|
"""
|
||||||
|
Gramplet bar freeze/unfreeze button preference callback
|
||||||
|
"""
|
||||||
|
self.uistate.emit('grampletbar-freeze-changed')
|
||||||
|
|
||||||
def add_formats_panel(self, configdialog):
|
def add_formats_panel(self, configdialog):
|
||||||
row = 0
|
row = 0
|
||||||
grid = Gtk.Grid()
|
grid = Gtk.Grid()
|
||||||
@ -1185,6 +1191,13 @@ class GrampsPreferences(ConfigureDialog):
|
|||||||
row, 'interface.grampletbar-close', stop=3,
|
row, 'interface.grampletbar-close', stop=3,
|
||||||
extra_callback=self.cb_grampletbar_close)
|
extra_callback=self.cb_grampletbar_close)
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
|
# Gramplet bar freeze button:
|
||||||
|
self.add_checkbox(grid,
|
||||||
|
_("Enable freeze/unfreeze for the active gramplet"),
|
||||||
|
row, 'interface.grampletbar-freeze', stop=3,
|
||||||
|
extra_callback=self.cb_grampletbar_freeze)
|
||||||
|
row += 1
|
||||||
return _('Display'), grid
|
return _('Display'), grid
|
||||||
|
|
||||||
def auto_title_changed(self, obj):
|
def auto_title_changed(self, obj):
|
||||||
|
@ -398,6 +398,7 @@ class DisplayState(Callback):
|
|||||||
'nameformat-changed' : None,
|
'nameformat-changed' : None,
|
||||||
'placeformat-changed' : None,
|
'placeformat-changed' : None,
|
||||||
'grampletbar-close-changed' : None,
|
'grampletbar-close-changed' : None,
|
||||||
|
'grampletbar-freeze-changed' : None,
|
||||||
'update-available' : (list, ),
|
'update-available' : (list, ),
|
||||||
'autobackup' : None,
|
'autobackup' : None,
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,7 @@ class GrampletBar(Gtk.Notebook):
|
|||||||
self.set_current_page(config_settings[1])
|
self.set_current_page(config_settings[1])
|
||||||
|
|
||||||
uistate.connect('grampletbar-close-changed', self.cb_close_changed)
|
uistate.connect('grampletbar-close-changed', self.cb_close_changed)
|
||||||
|
uistate.connect('grampletbar-freeze-changed', self.cb_freeze_changed)
|
||||||
|
|
||||||
# Connect after gramplets added to prevent making them active
|
# Connect after gramplets added to prevent making them active
|
||||||
self.connect('switch-page', self.__switch_page)
|
self.connect('switch-page', self.__switch_page)
|
||||||
@ -389,6 +390,11 @@ class GrampletBar(Gtk.Notebook):
|
|||||||
else: # just a function; always show yes it has data
|
else: # just a function; always show yes it has data
|
||||||
tablabel.set_has_data(True)
|
tablabel.set_has_data(True)
|
||||||
|
|
||||||
|
if config.get('interface.grampletbar-freeze'):
|
||||||
|
tablabel.use_freeze(True)
|
||||||
|
else:
|
||||||
|
tablabel.use_freeze(False)
|
||||||
|
|
||||||
if config.get('interface.grampletbar-close'):
|
if config.get('interface.grampletbar-close'):
|
||||||
tablabel.use_close(True)
|
tablabel.use_close(True)
|
||||||
else:
|
else:
|
||||||
@ -404,6 +410,14 @@ class GrampletBar(Gtk.Notebook):
|
|||||||
tablabel = self.get_tab_label(gramplet)
|
tablabel = self.get_tab_label(gramplet)
|
||||||
tablabel.use_close(config.get('interface.grampletbar-close'))
|
tablabel.use_close(config.get('interface.grampletbar-close'))
|
||||||
|
|
||||||
|
def cb_freeze_changed(self):
|
||||||
|
"""
|
||||||
|
Freeze/unfreeze button preference changed.
|
||||||
|
"""
|
||||||
|
for gramplet in self.get_children():
|
||||||
|
tablabel = self.get_tab_label(gramplet)
|
||||||
|
tablabel.use_freeze(config.get('interface.grampletbar-freeze'))
|
||||||
|
|
||||||
def __delete_clicked(self, button, gramplet):
|
def __delete_clicked(self, button, gramplet):
|
||||||
"""
|
"""
|
||||||
Called when the delete button is clicked.
|
Called when the delete button is clicked.
|
||||||
@ -476,6 +490,16 @@ class GrampletBar(Gtk.Notebook):
|
|||||||
gramplet.detached_window.close()
|
gramplet.detached_window.close()
|
||||||
gramplet.detached_window = None
|
gramplet.detached_window = None
|
||||||
|
|
||||||
|
def __freeze_clicked(self, button):
|
||||||
|
"""
|
||||||
|
Called when the freeze/unfreeze button is clicked.
|
||||||
|
"""
|
||||||
|
for gramplet in self.get_children():
|
||||||
|
if gramplet and gramplet.pui:
|
||||||
|
if gramplet.pui.active:
|
||||||
|
if not self.freeze:
|
||||||
|
gramplet.pui.main()
|
||||||
|
|
||||||
def __button_clicked(self, button):
|
def __button_clicked(self, button):
|
||||||
"""
|
"""
|
||||||
Called when the drop-down button is clicked.
|
Called when the drop-down button is clicked.
|
||||||
@ -601,6 +625,7 @@ class TabGramplet(Gtk.ScrolledWindow, GuiGramplet):
|
|||||||
self.add(self.textview)
|
self.add(self.textview)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
self.track = []
|
self.track = []
|
||||||
|
self.pane = pane
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
return self.title
|
return self.title
|
||||||
@ -721,6 +746,11 @@ class TabLabel(Gtk.Box):
|
|||||||
self.label.set_tooltip_text(gramplet.tname)
|
self.label.set_tooltip_text(gramplet.tname)
|
||||||
self.label.show()
|
self.label.show()
|
||||||
|
|
||||||
|
self.freezebtn = Gtk.ToggleButton()
|
||||||
|
self.freezebtn.connect("toggled", self.update_freeze, gramplet)
|
||||||
|
self.freezebtn.set_active(False)
|
||||||
|
self.update_freeze(self.freezebtn, gramplet)
|
||||||
|
|
||||||
self.closebtn = Gtk.Button()
|
self.closebtn = Gtk.Button()
|
||||||
image = Gtk.Image()
|
image = Gtk.Image()
|
||||||
image.set_from_icon_name('window-close', Gtk.IconSize.MENU)
|
image.set_from_icon_name('window-close', Gtk.IconSize.MENU)
|
||||||
@ -729,6 +759,7 @@ class TabLabel(Gtk.Box):
|
|||||||
self.closebtn.set_relief(Gtk.ReliefStyle.NONE)
|
self.closebtn.set_relief(Gtk.ReliefStyle.NONE)
|
||||||
|
|
||||||
self.pack_start(self.label, True, True, 0)
|
self.pack_start(self.label, True, True, 0)
|
||||||
|
self.pack_start(self.freezebtn, False, False, 0)
|
||||||
self.pack_end(self.closebtn, False, False, 0)
|
self.pack_end(self.closebtn, False, False, 0)
|
||||||
|
|
||||||
def set_has_data(self, has_data):
|
def set_has_data(self, has_data):
|
||||||
@ -741,9 +772,42 @@ class TabLabel(Gtk.Box):
|
|||||||
else:
|
else:
|
||||||
self.label.set_text(self.text)
|
self.label.set_text(self.text)
|
||||||
|
|
||||||
|
def update_freeze(self, obj, gramplet):
|
||||||
|
"""
|
||||||
|
Display the correct icon for the button according to user
|
||||||
|
gramplet preference.
|
||||||
|
"""
|
||||||
|
child = obj.get_child()
|
||||||
|
if child:
|
||||||
|
obj.remove(child)
|
||||||
|
image = Gtk.Image()
|
||||||
|
if obj.get_active():
|
||||||
|
image.set_from_icon_name('gramps-lock', Gtk.IconSize.MENU)
|
||||||
|
obj.set_tooltip_text(_('Gramplet update is freezed'))
|
||||||
|
else:
|
||||||
|
image.set_from_icon_name('gramps-unlock', Gtk.IconSize.MENU)
|
||||||
|
obj.set_tooltip_text(_('Gramplet update is allowed'))
|
||||||
|
image.show()
|
||||||
|
obj.add(image)
|
||||||
|
|
||||||
|
def get_freeze(self):
|
||||||
|
"""
|
||||||
|
return the freeze button
|
||||||
|
"""
|
||||||
|
return self.freezebtn
|
||||||
|
|
||||||
|
def use_freeze(self, use_freeze):
|
||||||
|
"""
|
||||||
|
Display the close button according to user preference.
|
||||||
|
"""
|
||||||
|
if use_freeze:
|
||||||
|
self.freezebtn.show()
|
||||||
|
else:
|
||||||
|
self.freezebtn.hide()
|
||||||
|
|
||||||
def use_close(self, use_close):
|
def use_close(self, use_close):
|
||||||
"""
|
"""
|
||||||
Display the cose button according to user preference.
|
Display the close button according to user preference.
|
||||||
"""
|
"""
|
||||||
if use_close:
|
if use_close:
|
||||||
self.closebtn.show()
|
self.closebtn.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user