comparison orpg/mapper/miniatures.py @ 195:b633f4c64aae alpha

Traipse Alpha 'OpenRPG' {100219-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 (Patch-2) New Features: New Namespace method with two new syntaxes Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup
author sirebral
date Sat, 24 Apr 2010 08:37:20 -0500
parents 033887bb8a86
children 24769389a7ba
comparison
equal deleted inserted replaced
182:4b2884f29a72 195:b633f4c64aae
19 # 19 #
20 # File: mapper/miniatures.py 20 # File: mapper/miniatures.py
21 # Author: Chris Davis 21 # Author: Chris Davis
22 # Maintainer: 22 # Maintainer:
23 # Version: 23 # Version:
24 # $Id: miniatures.py,v 1.46 2007/12/07 20:39:50 digitalxero Exp $ 24 # $Id: miniatures.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: This file contains some of the basic definitions for the chat 26 # Description: This file contains some of the basic definitions for the chat
27 # utilities in the orpg project. 27 # utilities in the orpg project.
28 # 28 #
29 __version__ = "$Id: miniatures.py,v 1.46 2007/12/07 20:39:50 digitalxero Exp $" 29 __version__ = "$Id: miniatures.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
30 30
31 from base import * 31 from base import *
32 import thread, time, urllib, os.path, mimetypes 32 import thread, time, urllib, os.path, mimetypes
33 33
34 import xml.dom.minidom as minidom 34 import xml.dom.minidom as minidom
194 except: print bmp 194 except: print bmp
195 self.left = 0 195 self.left = 0
196 self.right = self.bmp.GetWidth() 196 self.right = self.bmp.GetWidth()
197 self.top = 0 197 self.top = 0
198 self.bottom = self.bmp.GetHeight() 198 self.bottom = self.bmp.GetHeight()
199
200 # Draw the facing marker if needed 199 # Draw the facing marker if needed
201 if self.face != 0: 200 if self.face != 0:
202 x_mid = self.pos.x + (self.bmp.GetWidth()/2) 201 x_mid = self.pos.x + (self.bmp.GetWidth()/2)
203 x_right = self.pos.x + self.bmp.GetWidth() 202 x_right = self.pos.x + self.bmp.GetWidth()
204 y_mid = self.pos.y + (self.bmp.GetHeight()/2) 203 y_mid = self.pos.y + (self.bmp.GetHeight()/2)
205 y_bottom = self.pos.y + self.bmp.GetHeight() 204 y_bottom = self.pos.y + self.bmp.GetHeight()
206 dc.SetPen(wx.WHITE_PEN) 205 dc.SetPen(wx.WHITE_PEN)
207 dc.SetBrush(wx.RED_BRUSH) 206 dc.SetBrush(wx.RED_BRUSH)
208 triangle = [] 207 triangle = []
209
210 # Figure out which direction to draw the marker!! 208 # Figure out which direction to draw the marker!!
211 tri_list = { 209 tri_list = {
212 FACE_WEST: [cmpPoint(self.pos.x, self.pos.y), cmpPoint(self.pos.x-5, y_mid), cmpPoint(self.pos.x, y_bottom)], 210 FACE_WEST: [cmpPoint(self.pos.x, self.pos.y), cmpPoint(self.pos.x-5, y_mid), cmpPoint(self.pos.x, y_bottom)],
213 FACE_EAST: [cmpPoint(x_right, self.pos.y), cmpPoint(x_right + 5, y_mid), cmpPoint(x_right, y_bottom)], 211 FACE_EAST: [cmpPoint(x_right, self.pos.y), cmpPoint(x_right + 5, y_mid), cmpPoint(x_right, y_bottom)],
214 FACE_SOUTH: [cmpPoint(self.pos.x, y_bottom), cmpPoint(x_mid, y_bottom + 5), cmpPoint(x_right, y_bottom)], 212 FACE_SOUTH: [cmpPoint(self.pos.x, y_bottom), cmpPoint(x_mid, y_bottom + 5), cmpPoint(x_right, y_bottom)],
223 triangle.append(tri) 221 triangle.append(tri)
224 del tri_list 222 del tri_list
225 dc.DrawPolygon(triangle) 223 dc.DrawPolygon(triangle)
226 dc.SetBrush(wx.NullBrush) 224 dc.SetBrush(wx.NullBrush)
227 dc.SetPen(wx.NullPen) 225 dc.SetPen(wx.NullPen)
228
229 # Draw the heading if needed 226 # Draw the heading if needed
230 if self.heading: 227 if self.heading:
231 x_adjust = 0 228 x_adjust = 0
232 y_adjust = 4 229 y_adjust = 4
233 x_half = self.bmp.GetWidth()/2 230 x_half = self.bmp.GetWidth()/2
341 xml_str += ' localPath="' + str(urllib.quote(self.localPath).replace('%3A', ':')) + '"' 338 xml_str += ' localPath="' + str(urllib.quote(self.localPath).replace('%3A', ':')) + '"'
342 xml_str += ' localTime="' + str(self.localTime) + '"' 339 xml_str += ' localTime="' + str(self.localTime) + '"'
343 xml_str += " />" 340 xml_str += " />"
344 if (action == "update" and self.isUpdated) or action == "new": 341 if (action == "update" and self.isUpdated) or action == "new":
345 self.isUpdated = False 342 self.isUpdated = False
346 print xml_str; return xml_str 343 return xml_str
347 else: return '' 344 else: return ''
348 345
349 def takedom(self, xml_dom): 346 def takedom(self, xml_dom):
350 self.id = xml_dom.getAttribute("id") 347 self.id = xml_dom.getAttribute("id")
351 if xml_dom.hasAttribute("posx"): self.pos.x = int(xml_dom.getAttribute("posx")) 348 if xml_dom.hasAttribute("posx"): self.pos.x = int(xml_dom.getAttribute("posx"))
374 ##----------------------------- 371 ##-----------------------------
375 class miniature_layer(layer_base): 372 class miniature_layer(layer_base):
376 def __init__(self, canvas): 373 def __init__(self, canvas):
377 self.canvas = canvas 374 self.canvas = canvas
378 layer_base.__init__(self) 375 layer_base.__init__(self)
379 self.id = -1 #added. 376 self.id = -1
380 self.miniatures = [] 377 self.miniatures = []
381 self.serial_number = 0 378 self.serial_number = 0
382 self.show_labels = True 379 self.show_labels = True
383 # Set the font of the labels to be the same as the chat window 380 # Set the font of the labels to be the same as the chat window
384 # only smaller. 381 # only smaller.