Title: [commits] (pje) [16051] [APP] Make config file usage egg-safe
Revision
16051
Author
pje
Date
2007-12-05 14:18:29 -0800 (Wed, 05 Dec 2007)

Log Message

[APP] Make config file usage egg-safe

Modified Paths

Diff

Modified: branches/rearchitecture/Chandler-Platform/ocap/wxui/colors.py (16050 => 16051)

--- branches/rearchitecture/Chandler-Platform/ocap/wxui/colors.py	2007-12-05 22:10:55 UTC (rev 16050)
+++ branches/rearchitecture/Chandler-Platform/ocap/wxui/colors.py	2007-12-05 22:18:29 UTC (rev 16051)
@@ -2,12 +2,13 @@
 from ConfigParser import SafeConfigParser, NoOptionError
 from os.path import dirname, join
 from colorsys import rgb_to_hsv, hsv_to_rgb
-import wx
+import wx, pkg_resources
 
 cfg = SafeConfigParser()
 
-with file(join(dirname(__file__), 'colors.conf'), 'r') as f:
-    cfg.readfp(f)
+stream = pkg_resources.resource_stream(__name__, 'colors.conf')
+cfg.readfp(stream)
+stream.close()
 
 # hue -> colorName mapping
 hue_map = dict((int(v), k) for k, v in cfg.items('colors'))




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to