Re: [sabayon] identity crisis
- From: Mark McLoughlin <markmc redhat com>
- To: John Dennis <jdennis redhat com>
- Cc: sabayon-list <sabayon-list gnome org>
- Subject: Re: [sabayon] identity crisis
- Date: Fri, 17 Jun 2005 09:58:15 +0100
Hi John,
I think there are two options:
1) Assume delegate names are unique across sources - i.e. that we're
never going to have delegates of two different sources with the
same name. Oh, we'd also be assuming that no delegate would have
the same name as any source.
or
2) Add a "delegate" tag to the profile metadata format which would
contain the delegate name (the <source> tag would then contain the
actual source name rather than the delegate name)
I think (1) is fine.
Either way, what you need to do is a add a UserProfile:get_delegate()
function which will iterate over all the sources looking for a specific
delegate:
---
class UserProfile:
def get_delegate (self, delegate_name):
for source in self.sources:
delegate = source.get_delegate ()
if not delegate is None:
return delegate
return None
class ProfileSource:
def get_delegate (self, delegate_name):
for delegate in self.delegates:
if delegate.get_name () == delegate_name:
return delegate
return None
---
and in editorwindow.py you'd want something like:
---
for (source_name, path) in self.profile.storage.list ():
source = self.profile.get_source (source_name)
if source is None:
source = self.profile.get_delegate (source_name)
description = source.get_path_description (path)
---
You'll also need to add a get_path_description() method to the
SourceDelegate base class and the MozillaDelegate class - it would
return stuff like "Mandatory Mozilla preferences", "Default Mozilla
Bookmarks" etc.
Oh, you're also using a translated string as the delegate name:
userprofile.SourceDelegate.__init__ (self, _("Firefox"), source, ".mozilla")
You shouldn't translate the string since you want the name to be the
same across all locales (since its in the profile metadata)
Cheers,
Mark.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]