annotate orpg/mapper/images.py @ 18:97265586402b ornery-orc

Traipse 'OpenRPG' {090827-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user. Update Summary: Update Manager is now in version 0.8. While not every button works, users can now browse the different revisions and their different changesets. The code has been refined some with feature from Core added to it. A Crash report is now created if the users software crashes. Update Manager has been moved to the Traipse Suite menu item, and a Debug Console as been added as well.
author sirebral
date Thu, 27 Aug 2009 01:04:43 -0500
parents 211ac836b6a0
children 51428d30c59e
rev   line source
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
1 # Copyright (C) 2000-2001 The OpenRPG Project
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
2 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
3 # openrpg-dev@lists.sourceforge.net
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
4 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
5 # This program is free software; you can redistribute it and/or modify
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
7 # the Free Software Foundation; either version 2 of the License, or
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
8 # (at your option) any later version.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
9 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
13 # GNU General Public License for more details.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
14 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
18 # --
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
19 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
20 # File: mapper/images.py
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
21 # Author: OpenRPG
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
22 # Maintainer:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
23 # Version:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
24 # $Id: images.py,v 1.21 2007/12/11 04:07:15 digitalxero Exp $
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
25 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
26 # Description:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
27 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
28 __version__ = "$Id: images.py,v 1.21 2007/12/11 04:07:15 digitalxero Exp $"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
29
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
30 import urllib
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
31 import Queue
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
32 import thread
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
33 from threading import Lock
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
34 import time
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
35
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
36 from orpg.orpg_wx import *
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
37 from orpg.orpgCore import component
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
38 from orpg.dirpath import dir_struct
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
39 from orpg.tools.orpg_log import logger
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
40
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
41 def singleton(cls):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
42 instances = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
43 def getinstance():
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
44 if cls not in instances:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
45 instances[cls] = cls()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
46 return instances[cls]
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
47 return getinstance()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
48
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
49 class ImageHandlerClass(object):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
50 __cache = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
51 __fetching = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
52 __queue = Queue.Queue(0)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
53 __lock = Lock()
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
54 chat = component.get("chat")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
55
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
56 def load(self, path, image_type, imageId):
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
57 """Load an image, with a intermideary fetching image shown while it loads in a background thread"""
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
58 if self.__cache.has_key(path): return wx.ImageFromMime(self.__cache[path][1],
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
59 self.__cache[path][2]).ConvertToBitmap()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
60 if not self.__fetching.has_key(path):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
61 self.__fetching[path] = True
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
62 """Start Image Loading Thread"""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
63 thread.start_new_thread(self.__loadThread, (path, image_type, imageId))
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
64 else:
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
65 if self.__fetching[path] is True: thread.start_new_thread(self.__loadCacheThread, (path, image_type, imageId))
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
66 return wx.Bitmap(dir_struct["icon"] + "fetching.png", wx.BITMAP_TYPE_PNG)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
67
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
68 def directLoad(self, path):
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
69 """Directly load an image, no threads"""
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
70 if self.__cache.has_key(path): return wx.ImageFromMime(self.__cache[path][1],
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
71 self.__cache[path][2]).ConvertToBitmap()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
72 uriPath = urllib.unquote(path)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
73 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
74 d = urllib.urlretrieve(uriPath)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
75 """We have to make sure that not only did we fetch something, but that
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
76 it was an image that we got back."""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
77 if d[0] and d[1].getmaintype() == "image":
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
78 self.__cache[path] = (path, d[0], d[1].gettype(), None)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
79 return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
80 else:
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
81 logger.general("Image refused to load or URI did not reference a valid image: " + path)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
82 component.get('chat').InfoPost("<font color='#FF0000'>Image refused to load or URI did not reference a valid image: " + path + "</font>")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
83 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
84 except IOError:
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
85 logger.general("Unable to resolve/open the specified URI; image was NOT loaded: " + path)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
86 component.get('chat').InfoPost("<font color='#FF0000'>Unable to resolve/open the specified URI; image was NOT loaded: " + path + "</font>")
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
87 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
88
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
89 def cleanCache(self):
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
90 """Shrinks the Cache down to the proper size"""
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
91 try: cacheSize = int(component.get('settings').get_setting("ImageCacheSize"))
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
92 except: cacheSize = 32
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
93 cache = self.__cache.keys()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
94 cache.sort()
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
95 for key in cache[cacheSize:]: del self.__cache[key]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
96
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
97 def flushCache(self):
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
98 """This function will flush all images contained within the image cache."""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
99 self.__lock.acquire()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
100 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
101 keyList = self.__cache.keys()
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
102 for key in keyList: del self.__cache[key]
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
103 finally: self.__lock.release()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
104 urllib.urlcleanup()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
105
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
106 """Private Methods"""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
107 def __loadThread(self, path, image_type, imageId):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
108 uriPath = urllib.unquote(path)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
109 self.__lock.acquire()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
110 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
111 d = urllib.urlretrieve(uriPath)
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
112 """We have to make sure that not only did we fetch something, but that
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
113 it was an image that we got back."""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
114 if d[0] and d[1].getmaintype() == "image":
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
115 self.__cache[path] = (path, d[0], d[1].gettype(), imageId)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
116 self.__queue.put((self.__cache[path], image_type, imageId))
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
117 if self.__fetching.has_key(path): self.__fetching[path] = False #Fix for failed multi-load?
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
118 else:
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
119 logger.general("Image refused to load or URI did not reference a valid image: " + path)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
120 component.get('chat').InfoPost("<font color='#FF0000'>Image refused to load or URI did not reference a valid image: " + path +"</font>")
10
5df1340bda13 Big patch! Linux GUI, Fetching Dict., Init2, Streaming lining.
sirebral
parents: 3
diff changeset
121 del self.__fetching[path]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
122 except IOError:
10
5df1340bda13 Big patch! Linux GUI, Fetching Dict., Init2, Streaming lining.
sirebral
parents: 3
diff changeset
123 del self.__fetching[path]
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
124 logger.general("Unable to resolve/open the specified URI; image was NOT loaded: " + path)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
125 component.get('chat').InfoPost("<font color='#FF0000'> Unable to resolve/open the specified URI; image was NOT loaded: " + path + "</font>")
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
126 finally: self.__lock.release()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
127
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
128 def __loadCacheThread(self, path, image_type, imageId):
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
129 if self.__cache.has_key(path):
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
130 try:
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
131 st = time.time()
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
132 while self.__fetching.has_key(path) and self.__fetching[path] is not False:
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
133 time.sleep(0.025)
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
134 if (time.time()-st) > 120:
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
135 logger.general("Timeout: " + path)
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
136 break
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
137 except:
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
138 del self.__fetching[path]
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
139 logger.general("Unable to resolve/open the specified URI; image was NOT loaded: " + path)
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
140 component.get('chat').InfoPost("<font color='#FF0000'>Unable to resolve/open the specified URI; image was NOT loaded: " + path + "</font>")
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
141 return
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
142 self.__lock.acquire()
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
143 try:
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
144 logger.debug("Adding Image to Queue from Cache: " + str(self.__cache[path]))
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
145 component.debug('chat').InfoPost("<font color='#FF0000'>Adding Image to Queue from Cache: " + str(self.__cache[path]) + "</font>")
13
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
146 self.__queue.put((self.__cache[path], image_type, imageId))
211ac836b6a0 {090731-00} Fixes problem with Name & Settings window, cleans code.
sirebral
parents: 10
diff changeset
147 finally: self.__lock.release()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
148
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
149 """Property Methods"""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
150 def _getCache(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
151 return self.__cache
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
152
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
153 def _getQueue(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
154 return self.__queue
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
155
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
156 """Properties"""
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
157 Cache = property(_getCache)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
158 Queue = property(_getQueue)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
159
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
160 ImageHandler = singleton(ImageHandlerClass)