comparison orpg/mapper/miniatures.py @ 236:9230a33defd9 beta

Traipse Beta 'OpenRPG' {100616-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 (Closing/Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log 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. 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 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.
author sirebral
date Wed, 16 Jun 2010 03:06:20 -0500
parents dcae32e219f1
children
comparison
equal deleted inserted replaced
226:b29454610f36 236:9230a33defd9
342 self.isUpdated = False 342 self.isUpdated = False
343 return xml_str 343 return xml_str
344 else: return '' 344 else: return ''
345 345
346 def takedom(self, xml_dom): 346 def takedom(self, xml_dom):
347 self.id = xml_dom.getAttribute("id") 347 self.id = xml_dom.get("id")
348 if xml_dom.hasAttribute("posx"): self.pos.x = int(xml_dom.getAttribute("posx")) 348 if xml_dom.get("posx") != None: self.pos.x = int(xml_dom.get("posx"))
349 if xml_dom.hasAttribute("posy"): self.pos.y = int(xml_dom.getAttribute("posy")) 349 if xml_dom.get("posy") != None: self.pos.y = int(xml_dom.get("posy"))
350 if xml_dom.hasAttribute("heading"): self.heading = int(xml_dom.getAttribute("heading")) 350 if xml_dom.get("heading") != None: self.heading = int(xml_dom.get("heading"))
351 if xml_dom.hasAttribute("face"): self.face = int(xml_dom.getAttribute("face")) 351 if xml_dom.get("face") != None: self.face = int(xml_dom.get("face"))
352 if xml_dom.hasAttribute("path"): 352 if xml_dom.get("path") != None:
353 self.path = urllib.unquote(xml_dom.getAttribute("path")) 353 self.path = urllib.unquote(xml_dom.get("path"))
354 self.set_bmp(ImageHandler.load(self.path, 'miniature', self.id)) 354 self.set_bmp(ImageHandler.load(self.path, 'miniature', self.id))
355 if xml_dom.hasAttribute("locked"): 355 if xml_dom.get("locked") != None:
356 if xml_dom.getAttribute("locked") == '1' or xml_dom.getAttribute("locked") == 'True': self.locked = True 356 if xml_dom.get("locked") == '1' or xml_dom.get("locked") == 'True': self.locked = True
357 else: self.locked = False 357 else: self.locked = False
358 if xml_dom.hasAttribute("hide"): 358 if xml_dom.get("hide") != None:
359 if xml_dom.getAttribute("hide") == '1' or xml_dom.getAttribute("hide") == 'True': self.hide = True 359 if xml_dom.get("hide") == '1' or xml_dom.get("hide") == 'True': self.hide = True
360 else: self.hide = False 360 else: self.hide = False
361 if xml_dom.hasAttribute("label"): self.label = xml_dom.getAttribute("label") 361 if xml_dom.get("label") != None: self.label = xml_dom.get("label")
362 if xml_dom.hasAttribute("zorder"): self.zorder = int(xml_dom.getAttribute("zorder")) 362 if xml_dom.get("zorder") != None: self.zorder = int(xml_dom.get("zorder"))
363 if xml_dom.hasAttribute("align"): 363 if xml_dom.get("align") != None:
364 if xml_dom.getAttribute("align") == '1' or xml_dom.getAttribute("align") == 'True': self.snap_to_align = 1 364 if xml_dom.get("align") == '1' or xml_dom.get("align") == 'True': self.snap_to_align = 1
365 else: self.snap_to_align = 0 365 else: self.snap_to_align = 0
366 if xml_dom.hasAttribute("width"): self.width = int(xml_dom.getAttribute("width")) 366 if xml_dom.get("width") != None: self.width = int(xml_dom.get("width"))
367 if xml_dom.hasAttribute("height"): self.height = int(xml_dom.getAttribute("height")) 367 if xml_dom.get("height") != None: self.height = int(xml_dom.get("height"))
368 368
369 ##----------------------------- 369 ##-----------------------------
370 ## miniature layer 370 ## miniature layer
371 ##----------------------------- 371 ##-----------------------------
372 class miniature_layer(layer_base): 372 class miniature_layer(layer_base):
487 s += "</miniatures>" 487 s += "</miniatures>"
488 return s 488 return s
489 else: return "" 489 else: return ""
490 490
491 def layerTakeDOM(self, xml_dom): 491 def layerTakeDOM(self, xml_dom):
492 if xml_dom.hasAttribute('serial'): 492 if xml_dom.get('serial') != None:
493 self.serial_number = int(xml_dom.getAttribute('serial')) 493 self.serial_number = int(xml_dom.get('serial'))
494 children = xml_dom._get_childNodes() 494 children = xml_dom.getchildren()
495 for c in children: 495 for c in children:
496 action = c.getAttribute("action") 496 action = c.get("action")
497 id = c.getAttribute('id') 497 id = c.get('id')
498 if action == "del": 498 if action == "del":
499 mini = self.get_miniature_by_id(id) 499 mini = self.get_miniature_by_id(id)
500 if mini: self.miniatures.remove(mini); del mini 500 if mini: self.miniatures.remove(mini); del mini
501 elif action == "new": 501 elif action == "new":
502 pos = cmpPoint(int(c.getAttribute('posx')),int(c.getAttribute('posy'))) 502 pos = cmpPoint(int(c.get('posx')),int(c.get('posy')))
503 path = urllib.unquote(c.getAttribute('path')) 503 path = urllib.unquote(c.get('path'))
504 label = c.getAttribute('label') 504 label = c.get('label')
505 height = width = heading = face = snap_to_align = zorder = 0 505 height = width = heading = face = snap_to_align = zorder = 0
506 locked = hide = False 506 locked = hide = False
507 if c.hasAttribute('height'): height = int(c.getAttribute('height')) 507 if c.get('height') != None: height = int(c.get('height'))
508 if c.hasAttribute('width'): width = int(c.getAttribute('width')) 508 if c.get('width') != None: width = int(c.get('width'))
509 if c.getAttribute('locked') == 'True' or c.getAttribute('locked') == '1': locked = True 509 if c.get('locked') == 'True' or c.get('locked') == '1': locked = True
510 if c.getAttribute('hide') == 'True' or c.getAttribute('hide') == '1': hide = True 510 if c.get('hide') == 'True' or c.get('hide') == '1': hide = True
511 if c.getAttribute('heading'): heading = int(c.getAttribute('heading')) 511 if c.get('heading') != None: heading = int(c.get('heading'))
512 if c.hasAttribute('face'): face = int(c.getAttribute('face')) 512 if c.get('face') != None: face = int(c.get('face'))
513 if c.hasAttribute('align'): snap_to_align = int(c.getAttribute('align')) 513 if c.get('align') != None: snap_to_align = int(c.get('align'))
514 if c.getAttribute('zorder'): zorder = int(c.getAttribute('zorder')) 514 if c.get('zorder') != None: zorder = int(c.get('zorder'))
515 min = BmpMiniature(id, path, ImageHandler.load(path, 'miniature', id), pos, heading, 515 min = BmpMiniature(id, path, ImageHandler.load(path, 'miniature', id), pos, heading,
516 face, label, locked, hide, snap_to_align, zorder, width, height) 516 face, label, locked, hide, snap_to_align, zorder, width, height)
517 self.miniatures.append(min) 517 self.miniatures.append(min)
518 if c.hasAttribute('local') and c.getAttribute('local') == 'True' and os.path.exists(urllib.unquote(c.getAttribute('localPath'))): 518 if c.get('local') == 'True' and os.path.exists(urllib.unquote(c.get('localPath'))):
519 localPath = urllib.unquote(c.getAttribute('localPath')) 519 localPath = urllib.unquote(c.get('localPath'))
520 local = True 520 local = True
521 localTime = float(c.getAttribute('localTime')) 521 localTime = float(c.get('localTime'))
522 if localTime-time.time() <= 144000: 522 if localTime-time.time() <= 144000:
523 file = open(localPath, "rb") 523 file = open(localPath, "rb")
524 imgdata = file.read() 524 imgdata = file.read()
525 file.close() 525 file.close()
526 filename = os.path.split(localPath) 526 filename = os.path.split(localPath)