comparison orpg/gametree/nodehandlers/minilib.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 4385a7d0efd1
children baee049045be
comparison
equal deleted inserted replaced
17:265b987cce4f 18:97265586402b
30 30
31 """Nodehandler for collections of miniatures. User can add, delete, edit 31 """Nodehandler for collections of miniatures. User can add, delete, edit
32 miniatures as sending them to the map singly or in batches. 32 miniatures as sending them to the map singly or in batches.
33 """ 33 """
34 from core import * 34 from core import *
35 import orpg.dirpath 35 from orpg.dirpath import dir_struct
36 import string 36 import string
37 import map_miniature_nodehandler 37 import map_miniature_nodehandler
38 import orpg.mapper.map_msg 38 import orpg.mapper.map_msg
39 # import scriptkit 39 # import scriptkit
40 40
187 if mini == None: 187 if mini == None:
188 return 188 return
189 if mini.getAttribute( ATTRIBUTE_URL ) == '' or mini.getAttribute( ATTRIBUTE_URL ) == 'http://': 189 if mini.getAttribute( ATTRIBUTE_URL ) == '' or mini.getAttribute( ATTRIBUTE_URL ) == 'http://':
190 self.chat.ParsePost( self.chat.colorize(self.chat.syscolor, '"%s" is not a valid URL, the mini "%s" will not be added to the map' % ( mini.getAttribute( ATTRIBUTE_URL ), mini.getAttribute( ATTRIBUTE_NAME ) )) ) 190 self.chat.ParsePost( self.chat.colorize(self.chat.syscolor, '"%s" is not a valid URL, the mini "%s" will not be added to the map' % ( mini.getAttribute( ATTRIBUTE_URL ), mini.getAttribute( ATTRIBUTE_NAME ) )) )
191 return 191 return
192 session = open_rpg.get_component( COMPONENT_SESSION ) 192 session = component.get( COMPONENT_SESSION )
193 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER): 193 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER):
194 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use the miniature Layer") 194 component.get("chat").InfoPost("You must be either a player or GM to use the miniature Layer")
195 return 195 return
196 map = open_rpg.get_component(COMPONENT_MAP) 196 map = component.get(COMPONENT_MAP)
197 for loop in range( count ): 197 for loop in range( count ):
198 msg = self.get_miniature_XML( mini, addName) 198 msg = self.get_miniature_XML( mini, addName)
199 msg = str("<map action='update'><miniatures>" + msg + "</miniatures></map>") 199 msg = str("<map action='update'><miniatures>" + msg + "</miniatures></map>")
200 map.new_data( msg ) 200 map.new_data( msg )
201 session.send( msg ) 201 session.send( msg )
202 202
203 def get_miniature_XML( self, mini, addName = True ): 203 def get_miniature_XML( self, mini, addName = True ):
204 msg = orpg.mapper.map_msg.mini_msg() 204 msg = orpg.mapper.map_msg.mini_msg()
205 map = open_rpg.get_component( COMPONENT_MAP ) 205 map = component.get( COMPONENT_MAP )
206 session = open_rpg.get_component( COMPONENT_SESSION ) 206 session = component.get( COMPONENT_SESSION )
207 msg.init_prop( ATTRIBUTE_ID, session.get_next_id() ) 207 msg.init_prop( ATTRIBUTE_ID, session.get_next_id() )
208 for k in mini.getAttributeKeys(): 208 for k in mini.getAttributeKeys():
209 # translate our attributes to map attributes 209 # translate our attributes to map attributes
210 key = FROM_MINILIB_MAP.get( k, k ) 210 key = FROM_MINILIB_MAP.get( k, k )
211 if key != None: 211 if key != None:
216 unique = self.is_unique( mini ) 216 unique = self.is_unique( mini )
217 if addName: 217 if addName:
218 label = mini.getAttribute( ATTRIBUTE_NAME ) 218 label = mini.getAttribute( ATTRIBUTE_NAME )
219 else: 219 else:
220 label = '' 220 label = ''
221 return msg.get_all_xml() 221 return msg().get_all_xml()
222 222
223 def is_unique( self, mini ): 223 def is_unique( self, mini ):
224 unique = mini.getAttribute( ATTRIBUTE_UNIQUE ) 224 unique = mini.getAttribute( ATTRIBUTE_UNIQUE )
225 val = 0 225 val = 0
226 try: 226 try:
270 """ 270 """
271 wx.Panel.__init__( self, frame, -1 ) 271 wx.Panel.__init__( self, frame, -1 )
272 self.handler = handler 272 self.handler = handler
273 self.frame = frame 273 self.frame = frame
274 274
275 self.map = open_rpg.get_component('map') 275 self.map = component.get('map')
276 names = self.buildList() 276 names = self.buildList()
277 # self.keys = self.list.keys() 277 # self.keys = self.list.keys()
278 # self.keys.sort() 278 # self.keys.sort()
279 279
280 280