Allow each grampletpane to have its own config
svn: r14265
This commit is contained in:
parent
9110d76624
commit
df9899a78b
@ -66,12 +66,8 @@ WIKI_HELP_PAGE = const.URL_MANUAL_PAGE + '_-_Gramplets'
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
PLUGMAN = GuiPluginManager.get_instance()
|
PLUGMAN = GuiPluginManager.get_instance()
|
||||||
|
|
||||||
GRAMPLET_FILENAME = os.path.join(const.HOME_DIR,"gramplets.ini")
|
|
||||||
NL = "\n"
|
NL = "\n"
|
||||||
|
|
||||||
debug = False
|
|
||||||
|
|
||||||
def AVAILABLE_GRAMPLETS():
|
def AVAILABLE_GRAMPLETS():
|
||||||
return [gplug.id for gplug in PLUGMAN.get_reg_gramplets()]
|
return [gplug.id for gplug in PLUGMAN.get_reg_gramplets()]
|
||||||
|
|
||||||
@ -133,7 +129,6 @@ def get_gramplet_options_by_name(name):
|
|||||||
"""
|
"""
|
||||||
Get options by gramplet name.
|
Get options by gramplet name.
|
||||||
"""
|
"""
|
||||||
if debug: print "name:", name
|
|
||||||
if name in AVAILABLE_GRAMPLETS():
|
if name in AVAILABLE_GRAMPLETS():
|
||||||
return GET_AVAILABLE_GRAMPLETS(name).copy()
|
return GET_AVAILABLE_GRAMPLETS(name).copy()
|
||||||
else:
|
else:
|
||||||
@ -144,7 +139,6 @@ def get_gramplet_options_by_tname(name):
|
|||||||
"""
|
"""
|
||||||
get options by translated name.
|
get options by translated name.
|
||||||
"""
|
"""
|
||||||
if debug: print "name:", name
|
|
||||||
for key in AVAILABLE_GRAMPLETS():
|
for key in AVAILABLE_GRAMPLETS():
|
||||||
if GET_AVAILABLE_GRAMPLETS(key)["tname"] == name:
|
if GET_AVAILABLE_GRAMPLETS(key)["tname"] == name:
|
||||||
return GET_AVAILABLE_GRAMPLETS(key).copy()
|
return GET_AVAILABLE_GRAMPLETS(key).copy()
|
||||||
@ -785,8 +779,9 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
if gramplet.state == "minimized":
|
if gramplet.state == "minimized":
|
||||||
gramplet.set_state("minimized")
|
gramplet.set_state("minimized")
|
||||||
|
|
||||||
def __init__(self, pageview, dbstate, uistate):
|
def __init__(self, configfile, pageview, dbstate, uistate):
|
||||||
gtk.ScrolledWindow.__init__(self)
|
gtk.ScrolledWindow.__init__(self)
|
||||||
|
self.configfile = os.path.join(const.USER_PLUGINS, "%s.ini" % configfile)
|
||||||
self.dbstate = dbstate
|
self.dbstate = dbstate
|
||||||
self.uistate = uistate
|
self.uistate = uistate
|
||||||
self.pageview = pageview
|
self.pageview = pageview
|
||||||
@ -907,7 +902,7 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
def load_gramplets(self):
|
def load_gramplets(self):
|
||||||
self.column_count = 2 # default for new user
|
self.column_count = 2 # default for new user
|
||||||
retval = []
|
retval = []
|
||||||
filename = GRAMPLET_FILENAME
|
filename = self.configfile
|
||||||
if filename and os.path.exists(filename):
|
if filename and os.path.exists(filename):
|
||||||
cp = ConfigParser.ConfigParser()
|
cp = ConfigParser.ConfigParser()
|
||||||
cp.read(filename)
|
cp.read(filename)
|
||||||
@ -936,10 +931,9 @@ class GrampletPane(gtk.ScrolledWindow):
|
|||||||
return retval
|
return retval
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
if debug: print "saving"
|
|
||||||
if len(self.frame_map) + len(self.detached_gramplets) == 0:
|
if len(self.frame_map) + len(self.detached_gramplets) == 0:
|
||||||
return # something is the matter
|
return # something is the matter
|
||||||
filename = GRAMPLET_FILENAME
|
filename = self.configfile
|
||||||
try:
|
try:
|
||||||
fp = open(filename, "w")
|
fp = open(filename, "w")
|
||||||
except:
|
except:
|
||||||
|
@ -57,7 +57,7 @@ class GrampletView(PageView):
|
|||||||
the base class. Returns a gtk container widget.
|
the base class. Returns a gtk container widget.
|
||||||
"""
|
"""
|
||||||
# load the user's gramplets and set columns, etc
|
# load the user's gramplets and set columns, etc
|
||||||
return GrampletPane(self, self.dbstate, self.uistate)
|
return GrampletPane("Gramplets_grampletview", self, self.dbstate, self.uistate)
|
||||||
|
|
||||||
def define_actions(self):
|
def define_actions(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user