4 """The notional `Provider' which defines the interface which all service
5 providers for Hermes must meet. Implementations of this class are expected
6 to load their preferences on construction, display them through open_preferences
7 and pass them to the service object as necessary.
9 Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
10 Released under the Artistic Licence."""
13 # -----------------------------------------------------------------------
15 """Return the display name of this service. An icon, of with the lower-case,
16 all-alphabetic version of this name is expected to be provided."""
21 # -----------------------------------------------------------------------
23 """Return the ID of this service. This should be alphanumeric characters
24 only. The default implementation is the lowercase version of get_name()
25 with all non-alphanumeric characters removed.
27 Overridding this method is NOT recommended."""
29 return re.sub('[^a-z0-9]+', '', self.get_name().lower())
32 # -----------------------------------------------------------------------
33 def get_account_detail(self):
34 """Return information on the configured account. This would, typically,
35 be the user's login for the service. If None is returned, no futher
36 information is available."""
41 # -----------------------------------------------------------------------
42 def has_preferences(self):
43 """Whether or not this provider has any preferences. If it does not,
44 open_preferences must NOT be called; as the behaviour is undetermined."""
49 # -----------------------------------------------------------------------
50 def open_preferences(self, parent):
51 """Open the preferences for this provider as a child of the 'parent' widget.
52 The dialogue box should have a _('Disable') and _('Enable') button; and
53 return True if the user chooses to enable the service; False if not.
54 If the user cancels the dialogue, return None."""
59 # -----------------------------------------------------------------------
60 def service(self, gui_callback):
61 """Return the service backend. This must be a class which implements the
67 See Service for more details."""