[deskbar-applet/gnome-2-26] Fixed parts of bug #577649. Check if templates directory can be retrieved and exists in has_requirem
- From: Sebastian Polsterl <sebp src gnome org>
- To: svn-commits-list gnome org
- Subject: [deskbar-applet/gnome-2-26] Fixed parts of bug #577649. Check if templates directory can be retrieved and exists in has_requirem
- Date: Fri, 1 May 2009 13:50:16 -0400 (EDT)
commit b0eacd4fb6615fd012e4c4b0d67fe6983fdc0bcf
Author: Sebastian Pölsterl <sebp k-d-w org>
Date: Fri May 1 19:49:47 2009 +0200
Fixed parts of bug #577649. Check if templates directory can be retrieved and exists in has_requirements.
---
deskbar/handlers/templates.py | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/deskbar/handlers/templates.py b/deskbar/handlers/templates.py
index 7bc2623..b784382 100644
--- a/deskbar/handlers/templates.py
+++ b/deskbar/handlers/templates.py
@@ -219,4 +219,21 @@ class TemplateHandler(deskbar.interfaces.Module):
def stop(self):
for filemonitor in self.monitors:
filemonitor.cancel()
-
\ No newline at end of file
+
+ @staticmethod
+ def has_requirements():
+ # Work around bug #577649
+ try:
+ templates_dir = deskbar.core.Utils.get_xdg_user_dir(deskbar.core.Utils.DIRECTORY_TEMPLATES)
+ except ValueError, e:
+ LOGGER.exception(e)
+ # TODO mark translatable
+ TemplateHandler.INSTRUCTIONS = "Could not retrieve templates directory"
+ return False
+
+ if os.path.exists(templates_dir):
+ return True
+ else:
+ TemplateHandler.INSTRUCTIONS = "Templates directory %s does not exist" % templates_dir
+ return False
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]