Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ka_importer.py
diff options
context:
space:
mode:
Diffstat (limited to 'ka_importer.py')
-rw-r--r--ka_importer.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/ka_importer.py b/ka_importer.py
new file mode 100644
index 0000000..ece269f
--- /dev/null
+++ b/ka_importer.py
@@ -0,0 +1,46 @@
+# coding: UTF8
+# Copyright 2009 Thomas Jourdan
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+import os
+
+_rgb_image_list = []
+_alpha_image_list = []
+
+def _populate_image_list():
+ #TODO use correct folder for user files
+ image_path = '/home/strom/.sugar/1/net.sourceforge.kandid/instance'
+ if 'SUGAR_BUNDLE_PATH' in os.environ:
+ from sugar.activity import activity
+ image_path = os.path.join(activity.get_activity_root(), 'instance')
+ for element in os.listdir(image_path):
+ if element.endswith('.png') or element.endswith('.PNG'):
+ abs_name = os.path.join(image_path, element)
+ if os.path.isfile(abs_name):
+ if element.find('.alpha.') == -1:
+ _rgb_image_list.append(abs_name)
+ else:
+ _alpha_image_list.append(abs_name)
+
+def get_rgb_image_list():
+ if len(_rgb_image_list) == 0:
+ _populate_image_list()
+ return _rgb_image_list
+
+def get_alpha_image_list():
+ if len(_alpha_image_list) == 0:
+ _populate_image_list()
+ return _alpha_image_list