4772: Performance improvement for context menu
svn: r17213
This commit is contained in:
parent
4856cf9dbb
commit
d3cd2e6acf
@ -60,6 +60,7 @@ import ManagedWindow
|
|||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
from gui.widgets.grampletpane import (AVAILABLE_GRAMPLETS,
|
from gui.widgets.grampletpane import (AVAILABLE_GRAMPLETS,
|
||||||
GET_AVAILABLE_GRAMPLETS,
|
GET_AVAILABLE_GRAMPLETS,
|
||||||
|
GET_GRAMPLET_LIST,
|
||||||
get_gramplet_opts,
|
get_gramplet_opts,
|
||||||
get_gramplet_options_by_name,
|
get_gramplet_options_by_name,
|
||||||
make_requested_gramplet,
|
make_requested_gramplet,
|
||||||
@ -413,15 +414,9 @@ class GrampsBar(gtk.Notebook):
|
|||||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||||
uiman = self.uistate.uimanager
|
uiman = self.uistate.uimanager
|
||||||
ag_menu = uiman.get_widget('/GrampsBarPopup/AddGramplet')
|
ag_menu = uiman.get_widget('/GrampsBarPopup/AddGramplet')
|
||||||
|
nav_type = self.pageview.navigation_type()
|
||||||
skip = self.all_gramplets()
|
skip = self.all_gramplets()
|
||||||
gramplet_list = []
|
gramplet_list = GET_GRAMPLET_LIST(nav_type, skip)
|
||||||
for name in AVAILABLE_GRAMPLETS():
|
|
||||||
if name not in skip:
|
|
||||||
if (GET_AVAILABLE_GRAMPLETS(name)["navtypes"] == [] or
|
|
||||||
self.pageview.navigation_type() in GET_AVAILABLE_GRAMPLETS(name)["navtypes"] or
|
|
||||||
self.pageview.navigation_type() is None):
|
|
||||||
gramplet_list.append((GET_AVAILABLE_GRAMPLETS(name)["tname"],
|
|
||||||
name))
|
|
||||||
gramplet_list.sort()
|
gramplet_list.sort()
|
||||||
self.__create_submenu(ag_menu, gramplet_list, self.__add_clicked)
|
self.__create_submenu(ag_menu, gramplet_list, self.__add_clicked)
|
||||||
|
|
||||||
|
@ -95,6 +95,11 @@ def GET_AVAILABLE_GRAMPLETS(name):
|
|||||||
}
|
}
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def GET_GRAMPLET_LIST(nav_type, skip):
|
||||||
|
return [(gplug.name, gplug.id) for gplug in PLUGMAN.get_reg_gramplets()
|
||||||
|
if gplug.navtypes == [] or nav_type in gplug.navtypes
|
||||||
|
and gplug.name not in skip]
|
||||||
|
|
||||||
def parse_tag_attr(text):
|
def parse_tag_attr(text):
|
||||||
"""
|
"""
|
||||||
Function used to parse markup.
|
Function used to parse markup.
|
||||||
|
Loading…
Reference in New Issue
Block a user