annotate orpg/mapper/images.py @ 39:ed322725b928 ornery-orc tip

Traipse 'OpenRPG' {110114-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 (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log New Earthdawn Dieroller New IronClaw roller, sheet, and image New ShapeShifter PC Sheet Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner Update to Dieroller. Cleaner, more effecient expression system Update to Hidden Die plugin, allows for non standard dice rolls Update to location.py, allows for more portable references when starting Traipse Update to the Features node Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to Server, removing wxPython dependencies where not needed Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets Fix to Gametree for locating gametree files Fix to Send to Chat from Gametree Fix to Gametree, renaming and remapping operates correctly Fix to aliaslib, prevents error caused when SafeHTML is sent None
author sirebral
date Fri, 14 Jan 2011 05:24:52 -0600
parents ff154cf3350c
children
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:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
24 # $Id: images.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
0
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 #
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
28 from __future__ import with_statement
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
29
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
30 import urllib, Queue, thread, time
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
31 from threading import Lock
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
32 from orpg.orpg_wx import *
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
33 from orpg.orpgCore import *
18
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
34
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
35 from orpg.dirpath import dir_struct
97265586402b Traipse 'OpenRPG' {090827-00}
sirebral
parents: 13
diff changeset
36 from orpg.tools.orpg_log import logger
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
37 from orpg.tools.settings import settings
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
38
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
39 class ImageHandlerClass(object):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
40 __cache = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
41 __fetching = {}
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
42 __queue = Queue.Queue(0)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
43 __lock = Lock()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
44
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
45 def __new__(cls):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
46 it = cls.__dict__.get("__it__")
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
47 if it is not None:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
48 return it
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
49 cls.__it__ = it = object.__new__(cls)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
50 return it
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
51
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
52 def load(self, path, image_type, imageId):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
53 # Load an image, with a intermideary fetching image shown while it loads in a background thread
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
54 if self.__cache.has_key(path):
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
55 return wx.ImageFromMime(self.__cache[path][1],
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
56 self.__cache[path][2])
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
57 if path not in self.__fetching:
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
58 self.__fetching[path] = True
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
59 #Start Image Loading Thread
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
60 thread.start_new_thread(self.__loadThread,
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
61 (path, image_type, imageId))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
62 else:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
63 if self.__fetching[path]:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
64 thread.start_new_thread(self.__loadCacheThread,
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
65 (path, image_type, imageId))
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
66 return wx.Image(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):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
69 # Directly load an image, no threads
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
70 if path in self.__cache:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
71 return wx.ImageFromMime(self.__cache[path][1],
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
72 self.__cache[path][2])
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
73 uriPath = urllib.unquote(path)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
74 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
75 d = urllib.urlretrieve(uriPath)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
76 # We have to make sure that not only did we fetch something, but that
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
77 # 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
78 if d[0] and d[1].getmaintype() == "image":
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
79 with self.__lock:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
80 self.__cache[path] = (path, d[0], d[1].gettype(), None)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
81 return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2])
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
82 else:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
83 logger.general("Image refused to load or URI did not "
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
84 "reference a valid image: " + path, True)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
85 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
86 except IOError:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
87 logger.general("Unable to resolve/open the specified URI; "
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
88 "image was NOT loaded: " + path, True)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
89 return None
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
90
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
91 def cleanCache(self):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
92 # Shrinks the Cache down to the proper size
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
93 try:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
94 cacheSize = int(settings.get("ImageCacheSize"))
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
95 except:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
96 cacheSize = 32
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
97 cache = self.__cache.keys()
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
98 cache.sort()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
99 for key in cache[cacheSize:]:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
100 del self.__cache[key]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
101
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
102 def flushCache(self):
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
103 # This function will flush all images contained within the image cache.
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
104 with self.__lock:
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
105 self.__cache = {}
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
106 self.__fetching = {}
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
107 urllib.urlcleanup()
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
108
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
109 #Private Methods
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
110 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
111 uriPath = urllib.unquote(path)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
112 try:
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
113 d = urllib.urlretrieve(uriPath)
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
114 # We have to make sure that not only did we fetch something, but that
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
115 # 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
116 if d[0] and d[1].getmaintype() == "image":
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
117 with self.__lock:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
118 self.__cache[path] = (path, d[0], d[1].gettype(), imageId)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
119 self.__queue.put((self.__cache[path], image_type, imageId))
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
120 if path in self.__fetching: del self.__fetching[path]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
121 else:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
122 logger.general("Image refused to load or URI did not "
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
123 "reference a valid image: " + path, True)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
124 self.__queue.put(('failed', image_type, imageId))
10
5df1340bda13 Big patch! Linux GUI, Fetching Dict., Init2, Streaming lining.
sirebral
parents: 3
diff changeset
125 del self.__fetching[path]
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
126 except IOError:
10
5df1340bda13 Big patch! Linux GUI, Fetching Dict., Init2, Streaming lining.
sirebral
parents: 3
diff changeset
127 del self.__fetching[path]
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
128 logger.general("Unable to resolve/open the specified URI; "
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
129 "image was NOT laoded: " + path, True)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
130 self.__queue.put((dir_struct["icon"] + "failed.png", image_type, imageId))
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
131
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
132 def __loadCacheThread(self, path, image_type, imageId):
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
133 try:
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
134 st = time.time()
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
135 while path in self.__fetching and self.__fetching[path] is not False:
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
136 time.sleep(0.025)
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
137 if (time.time()-st) > 120:
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
138 logger.general("Timeout: " + path, True)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
139 del self.__fetching[path]
27
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
140 break
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
141 except:
51428d30c59e Traipse 'OpenRPG' {091003-00}
sirebral
parents: 18
diff changeset
142 del self.__fetching[path]
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
143 logger.general("Unable to resolve/open the specified URI; "
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
144 "image was NOT loaded: " + path, True)
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
145 return
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
146 with self.__lock:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
147 if path in self.__cache:
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
148 logger.debug("Adding Image to Queue from Cache: " + str(self.__cache[path]))
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
149 self.__queue.put((self.__cache[path], image_type, imageId))
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
150 else: self.__loadThread(path, image_type, imageId)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
151
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
152 #Property Methods
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
153 def _getCache(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
154 return self.__cache
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
155
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
156 def _getQueue(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
157 return self.__queue
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
158
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
159 #Properties
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
160 Cache = property(_getCache)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
161 Queue = property(_getQueue)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
162
28
ff154cf3350c Traipse 'OpenRPG' {100203-00}
sirebral
parents: 27
diff changeset
163 ImageHandler = ImageHandlerClass()