comparison orpg/gametree/nodehandlers/map_miniature_nodehandler.py @ 151:06f10429eedc alpha

Traipse Alpha 'OpenRPG' {091125-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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Pretty important update that can help remove thousands of dead children from your gametree. Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Wed, 25 Nov 2009 06:15:49 -0600
parents 217fb049bd00
children bf799efe7a8a
comparison
equal deleted inserted replaced
149:c2caca988a11 151:06f10429eedc
39 <nodehandler name='Elf-1' module='map_miniature_nodehandler' class='map_miniature_handler' > 39 <nodehandler name='Elf-1' module='map_miniature_nodehandler' class='map_miniature_handler' >
40 <miniature id='' label='Elf-1' posx='' posy='' path='' ... /> 40 <miniature id='' label='Elf-1' posx='' posy='' path='' ... />
41 </nodehandler > 41 </nodehandler >
42 """ 42 """
43 43
44
45 def __init__(self,xml,tree_node): 44 def __init__(self,xml,tree_node):
46 node_handler.__init__(self,xml,tree_node) 45 node_handler.__init__(self,xml,tree_node)
47 self.mapper = component.get("map") 46 self.mapper = component.get("map")
48 self.session = component.get("session") 47 self.session = component.get("session")
49 self.miniature_xml = self.xml.find("miniature") 48 self.miniature_xml = self.xml.find("miniature")
54 bmp = None 53 bmp = None
55 path = my_mini_msg.get_prop("path") 54 path = my_mini_msg.get_prop("path")
56 55
57 if path: 56 if path:
58 path = urllib.unquote(path) 57 path = urllib.unquote(path)
59 if ImageHandler.Cache.has_key(path): 58 if ImageHandler.Cache.has_key(path): bmp = ImageHandler.Cache[path]
60 bmp = ImageHandler.Cache[path] 59 else: bmp = ImageHandler.directLoad(path)# Old Code TaS.
61 else:
62 #bmp = ImageHandler.directLoad(path, 'miniature', id)
63 bmp = ImageHandler.directLoad(path)# Old Code TaS.
64 60
65 if bmp: 61 if bmp:
66 img = wx.ImageFromMime(ImageHandler.Cache[path][1], ImageHandler.Cache[path][2]) 62 img = wx.ImageFromMime(ImageHandler.Cache[path][1], ImageHandler.Cache[path][2])
67 #img = wx.ImageFromBitmap(bmp) 63 #img = wx.ImageFromBitmap(bmp)
68 scaled_img = img.Scale(x,y) 64 scaled_img = img.Scale(x,y)
109 try: 105 try:
110 align = int(self.xml.get("align")) 106 align = int(self.xml.get("align"))
111 width = int(self.xml.get("width")) 107 width = int(self.xml.get("width"))
112 height = int(self.xml.get("height")) 108 height = int(self.xml.get("height"))
113 pos = grid.get_snapped_to_pos(pos, align, width, height) 109 pos = grid.get_snapped_to_pos(pos, align, width, height)
114 except: 110 except: pass
115 pass
116 self.miniature_xml.set("posx", str(pos.x)) 111 self.miniature_xml.set("posx", str(pos.x))
117 self.miniature_xml.set("posy", str(pos.y)) 112 self.miniature_xml.set("posy", str(pos.y))
118 new_xml = self.get_to_map_XML() 113 new_xml = self.get_to_map_XML()
119 if (self.session.my_role() != self.session.ROLE_GM) and (self.session.my_role() != self.session.ROLE_PLAYER): 114 if (self.session.my_role() != self.session.ROLE_GM) and (self.session.my_role() != self.session.ROLE_PLAYER):
120 component.get("chat").InfoPost("You must be either a player or GM to use the miniature Layer") 115 component.get("chat").InfoPost("You must be either a player or GM to use the miniature Layer")
121 return 116 return
122
123 if new_xml: 117 if new_xml:
124 self.mapper.new_data(new_xml) 118 self.mapper.new_data(new_xml)
125 self.session.send(new_xml) 119 self.session.send(new_xml)
126 else: 120 else: print "problem converting old mini xml to new mini xml"
127 print "problem converting old mini xml to new mini xml"
128 121
129 def about(self): 122 def about(self):
130 return "Miniature node by Andrew Bennett" 123 return "Miniature node by Andrew Bennett"
131 124
132 def tohtml(self): 125 def tohtml(self):