Mercurial > traipse_dev
comparison orpg/mapper/grid.py @ 137:54446a995007 alpha
Traipse Alpha 'OpenRPG' {091018-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 Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
author | sirebral |
---|---|
date | Wed, 18 Nov 2009 19:57:52 -0600 |
parents | 449a8900f9ac |
children | 8e07c1a2c69b |
comparison
equal
deleted
inserted
replaced
136:b4e02e8cd314 | 137:54446a995007 |
---|---|
30 from base import * | 30 from base import * |
31 from isometric import * | 31 from isometric import * |
32 from miniatures import SNAPTO_ALIGN_CENTER | 32 from miniatures import SNAPTO_ALIGN_CENTER |
33 from miniatures import SNAPTO_ALIGN_TL | 33 from miniatures import SNAPTO_ALIGN_TL |
34 from math import floor | 34 from math import floor |
35 | |
36 from xml.etree.ElementTree import ElementTree, Element, tostring | |
35 | 37 |
36 # Grid mode constants | 38 # Grid mode constants |
37 GRID_RECTANGLE = 0 | 39 GRID_RECTANGLE = 0 |
38 GRID_HEXAGON = 1 | 40 GRID_HEXAGON = 1 |
39 GRID_ISOMETRIC = 2 | 41 GRID_ISOMETRIC = 2 |
59 self.unit_widest = 100 | 61 self.unit_widest = 100 |
60 self.unit_offset = 100 | 62 self.unit_offset = 100 |
61 #size_ratio is the size ajustment for Hex and ISO to make them more accurate | 63 #size_ratio is the size ajustment for Hex and ISO to make them more accurate |
62 self.size_ratio = 1.5 | 64 self.size_ratio = 1.5 |
63 self.snap = True | 65 self.snap = True |
64 self.color = wx.BLACK# = color.Get() | 66 self.color = wx.BLACK # = color.Get() |
65 #self.color = cmpColour(r,g,b) | 67 #self.color = cmpColour(r,g,b) |
66 self.r_h = RGBHex() | 68 self.r_h = RGBHex() |
67 self.mode = GRID_RECTANGLE | 69 self.mode = GRID_RECTANGLE |
68 self.line = LINE_NONE | 70 self.line = LINE_NONE |
69 # Keep logic for different modes in different functions | 71 # Keep logic for different modes in different functions |
385 dc.DrawLines(lineArray) | 387 dc.DrawLines(lineArray) |
386 dc.SetPen(wx.NullPen) | 388 dc.SetPen(wx.NullPen) |
387 # Disable pen/brush optimizations to prevent any odd effects elsewhere | 389 # Disable pen/brush optimizations to prevent any odd effects elsewhere |
388 | 390 |
389 def layerToXML(self,action = "update"): | 391 def layerToXML(self,action = "update"): |
390 xml_str = "<grid" | 392 xml = Element('grid') |
391 if self.color != None: | 393 if self.color != None: |
392 (red,green,blue) = self.color.Get() | 394 (red,green,blue) = self.color.Get() |
393 hexcolor = self.r_h.hexstring(red, green, blue) | 395 hexcolor = self.r_h.hexstring(red, green, blue) |
394 xml_str += " color='" + hexcolor + "'" | 396 xml.set('color', hexcolor) |
395 if self.unit_size != None: xml_str += " size='" + str(self.unit_size) + "'" | 397 if self.unit_size != None: xml.set('size', str(self.unit_size)) |
396 if self.iso_ratio != None: xml_str += " ratio='" + str(self.iso_ratio) + "'" | 398 if self.iso_ratio != None: xml.set('ratio', str(self.iso_ratio)) |
397 if self.snap != None: | 399 if self.snap != None: |
398 if self.snap: xml_str += " snap='1'" | 400 if self.snap: xml.set('snap', '1') |
399 else: xml_str += " snap='0'" | 401 else: xml.set('snap', '0') |
400 if self.mode != None: xml_str+= " mode='" + str(self.mode) + "'" | 402 if self.mode != None: xml.set('mode', str(self.mode)) |
401 if self.line != None: xml_str+= " line='" + str(self.line) + "'" | 403 if self.line != None: xml.set('line', str(self.line)) |
402 xml_str += "/>" | |
403 if (action == "update" and self.isUpdated) or action == "new": | 404 if (action == "update" and self.isUpdated) or action == "new": |
404 self.isUpdated = False | 405 self.isUpdated = False |
405 return xml_str | 406 return tostring(xml) |
406 else: return '' | 407 else: return '' |
407 | 408 |
408 def layerTakeDOM(self, xml_dom): | 409 def layerTakeDOM(self, xml_dom): |
409 if xml_dom.hasAttribute("color"): | 410 if xml_dom.get("color"): |
410 r,g,b = self.r_h.rgb_tuple(xml_dom.getAttribute("color")) | 411 r,g,b = self.r_h.rgb_tuple(xml_dom.get("color")) |
411 self.set_color(cmpColour(r,g,b)) | 412 self.set_color(cmpColour(r,g,b)) |
412 #backwards compatible with non-isometric map formated clients | 413 #backwards compatible with non-isometric map formated clients |
413 ratio = RATIO_DEFAULT | 414 ratio = RATIO_DEFAULT |
414 if xml_dom.hasAttribute("ratio"): ratio = xml_dom.getAttribute("ratio") | 415 if xml_dom.get("ratio"): ratio = xml_dom.get("ratio") |
415 if xml_dom.hasAttribute("mode"): | 416 if xml_dom.get("mode"): |
416 self.SetMode(int(xml_dom.getAttribute("mode"))) | 417 self.SetMode(int(xml_dom.get("mode"))) |
417 if xml_dom.hasAttribute("size"): | 418 if xml_dom.get("size"): |
418 self.unit_size = int(xml_dom.getAttribute("size")) | 419 self.unit_size = int(xml_dom.get("size")) |
419 self.unit_size_y = self.unit_size | 420 self.unit_size_y = self.unit_size |
420 if xml_dom.hasAttribute("snap"): | 421 if xml_dom.get("snap"): |
421 if (xml_dom.getAttribute("snap") == 'True') or (xml_dom.getAttribute("snap") == "1"): self.snap = True | 422 if (xml_dom.get("snap") == 'True') or (xml_dom.get("snap") == "1"): self.snap = True |
422 else: self.snap = False | 423 else: self.snap = False |
423 if xml_dom.hasAttribute("line"): | 424 if xml_dom.get("line"): |
424 self.SetLine(int(xml_dom.getAttribute("line"))) | 425 self.SetLine(int(xml_dom.get("line"))) |