Mercurial > traipse_dev
comparison orpg/mapper/whiteboard.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 |
---|---|
44 class WhiteboardText: | 44 class WhiteboardText: |
45 def __init__(self, id, text_string, pos, style, pointsize, weight, color="#000000", log=None): | 45 def __init__(self, id, text_string, pos, style, pointsize, weight, color="#000000", log=None): |
46 self.scale = 1 | 46 self.scale = 1 |
47 self.r_h = RGBHex() | 47 self.r_h = RGBHex() |
48 self.selected = False | 48 self.selected = False |
49 self.text_string = text_string | 49 self.text_string = text_string.replace('"', '"').replace("'", ''') |
50 self.id = id | 50 self.id = id |
51 self.weight = int(weight) | 51 self.weight = int(weight) |
52 self.pointsize = int(pointsize) | 52 self.pointsize = int(pointsize) |
53 self.style = int(style) | 53 self.style = int(style) |
54 self.textcolor = color | 54 self.textcolor = color |
93 dc.SetUserScale(self.scale, self.scale) | 93 dc.SetUserScale(self.scale, self.scale) |
94 | 94 |
95 # Draw text | 95 # Draw text |
96 (w,x,y,z) = self.get_rect(dc) | 96 (w,x,y,z) = self.get_rect(dc) |
97 dc.SetFont(self.font) | 97 dc.SetFont(self.font) |
98 dc.DrawText(self.text_string, self.posx, self.posy) | 98 text_string = self.text_string.replace('"', '"').replace(''', "'") |
99 dc.DrawText(text_string, self.posx, self.posy) | |
99 dc.SetTextForeground(wx.Colour(0,0,0)) | 100 dc.SetTextForeground(wx.Colour(0,0,0)) |
100 | 101 |
101 def toxml(self, action="update"): | 102 def toxml(self, action="update"): |
102 if action == "del": | 103 if action == "del": |
103 xml_str = "<text action='del' id='" + str(self.id) + "'/>" | 104 xml_str = "<text action='del' id='" + str(self.id) + "'/>" |
117 self.isUpdated = False | 118 self.isUpdated = False |
118 return xml_str | 119 return xml_str |
119 else: return '' | 120 else: return '' |
120 | 121 |
121 def takedom(self, xml_dom): | 122 def takedom(self, xml_dom): |
122 self.text_string = xml_dom.getAttribute("text_string") | 123 self.text_string = xml_dom.get("text_string") |
123 self.id = xml_dom.getAttribute("id") | 124 self.id = xml_dom.get("id") |
124 if xml_dom.hasAttribute("posy"): self.posy = int(xml_dom.getAttribute("posy")) | 125 if xml_dom.get("posy") != None: self.posy = int(xml_dom.get("posy")) |
125 if xml_dom.hasAttribute("posx"): self.posx = int(xml_dom.getAttribute("posx")) | 126 if xml_dom.get("posx") != None: self.posx = int(xml_dom.get("posx")) |
126 if xml_dom.hasAttribute("weight"): | 127 if xml_dom.get("weight"): |
127 self.weight = int(xml_dom.getAttribute("weight")) | 128 self.weight = int(xml_dom.get("weight")) |
128 self.font.SetWeight(self.weight) | 129 self.font.SetWeight(self.weight) |
129 if xml_dom.hasAttribute("style"): | 130 if xml_dom.get("style") != None: |
130 self.style = int(xml_dom.getAttribute("style")) | 131 self.style = int(xml_dom.get("style")) |
131 self.font.SetStyle(self.style) | 132 self.font.SetStyle(self.style) |
132 if xml_dom.hasAttribute("pointsize"): | 133 if xml_dom.get("pointsize") != None: |
133 self.pointsize = int(xml_dom.getAttribute("pointsize")) | 134 self.pointsize = int(xml_dom.get("pointsize")) |
134 self.font.SetPointSize(self.pointsize) | 135 self.font.SetPointSize(self.pointsize) |
135 if xml_dom.hasAttribute("color") and xml_dom.getAttribute("color") != '': | 136 if xml_dom.get("color") != None and xml_dom.get("color") != '': |
136 self.textcolor = xml_dom.getAttribute("color") | 137 self.textcolor = xml_dom.get("color") |
137 if self.textcolor == '#0000000': self.textcolor = '#000000' | 138 if self.textcolor == '#0000000': self.textcolor = '#000000' |
138 | 139 |
139 class WhiteboardLine: | 140 class WhiteboardLine: |
140 def __init__(self, id, line_string, upperleft, lowerright, color="#000000", width=1, log=None): | 141 def __init__(self, id, line_string, upperleft, lowerright, color="#000000", width=1, log=None): |
141 self.scale = 1 | 142 self.scale = 1 |
229 xml_str += "/>" | 230 xml_str += "/>" |
230 if action == "new": return xml_str | 231 if action == "new": return xml_str |
231 return '' | 232 return '' |
232 | 233 |
233 def takedom(self, xml_dom): | 234 def takedom(self, xml_dom): |
234 self.line_string = xml_dom.getAttribute("line_string") | 235 self.line_string = xml_dom.get("line_string") |
235 self.id = xml_dom.getAttribute("id") | 236 self.id = xml_dom.get("id") |
236 if xml_dom.hasAttribute("upperleftx"): self.upperleft.x = int(xml_dom.getAttribute("upperleftx")) | 237 if xml_dom.get("upperleftx") != None: self.upperleft.x = int(xml_dom.get("upperleftx")) |
237 if xml_dom.hasAttribute("upperlefty"): self.upperleft.y = int(xml_dom.getAttribute("upperlefty")) | 238 if xml_dom.get("upperlefty") != None: self.upperleft.y = int(xml_dom.get("upperlefty")) |
238 if xml_dom.hasAttribute("lowerrightx"): self.lowerright.x = int(xml_dom.getAttribute("lowerrightx")) | 239 if xml_dom.get("lowerrightx") != None: self.lowerright.x = int(xml_dom.get("lowerrightx")) |
239 if xml_dom.hasAttribute("lowerrighty"): self.lowerright.y = int(xml_dom.getAttribute("lowerrighty")) | 240 if xml_dom.get("lowerrighty") != None: self.lowerright.y = int(xml_dom.get("lowerrighty")) |
240 if xml_dom.hasAttribute("color") and xml_dom.getAttribute("color") != '': | 241 if xml_dom.get("color") != None and xml_dom.get("color") != '': |
241 self.linecolor = xml_dom.getAttribute("color") | 242 self.linecolor = xml_dom.get("color") |
242 if self.linecolor == '#0000000': self.linecolor = '#000000' | 243 if self.linecolor == '#0000000': self.linecolor = '#000000' |
243 if xml_dom.hasAttribute("width"): self.linewidth = int(xml_dom.getAttribute("width")) | 244 if xml_dom.get("width") != None: self.linewidth = int(xml_dom.get("width")) |
244 | 245 |
245 ##----------------------------- | 246 ##----------------------------- |
246 ## whiteboard layer | 247 ## whiteboard layer |
247 ##----------------------------- | 248 ##----------------------------- |
248 class whiteboard_layer(layer_base): | 249 class whiteboard_layer(layer_base): |
367 def set_font(self, font): | 368 def set_font(self, font): |
368 self.font = font | 369 self.font = font |
369 | 370 |
370 def add_text(self, text_string, pos, style, pointsize, weight, color="#000000"): | 371 def add_text(self, text_string, pos, style, pointsize, weight, color="#000000"): |
371 id = 'text-' + self.canvas.session.get_next_id() | 372 id = 'text-' + self.canvas.session.get_next_id() |
372 text = WhiteboardText(id,text_string, pos, style, pointsize, weight, color) | 373 text = WhiteboardText(id, text_string, pos, style, pointsize, weight, color) |
373 self.texts.append(text) | 374 self.texts.append(text) |
374 xml_str = "<map><whiteboard>" | 375 xml_str = "<map><whiteboard>" |
375 xml_str += text.toxml("new") | 376 xml_str += text.toxml("new") |
376 xml_str += "</whiteboard></map>" | 377 xml_str += "</whiteboard></map>" |
377 self.canvas.frame.session.send(xml_str) | 378 self.canvas.frame.session.send(xml_str) |
414 s += "</whiteboard>" | 415 s += "</whiteboard>" |
415 return s | 416 return s |
416 else: return "" | 417 else: return "" |
417 | 418 |
418 def layerTakeDOM(self, xml_dom): | 419 def layerTakeDOM(self, xml_dom): |
419 serial_number = xml_dom.getAttribute('serial') | 420 serial_number = xml_dom.get('serial') |
420 if serial_number != "": self.serial_number = int(serial_number) | 421 if serial_number != None: self.serial_number = int(serial_number) |
421 children = xml_dom._get_childNodes() | 422 children = xml_dom.getchildren() |
422 for l in children: | 423 for l in children: |
423 nodename = l._get_nodeName() | 424 nodename = l.tag |
424 action = l.getAttribute("action") | 425 action = l.get("action") |
425 id = l.getAttribute('id') | 426 id = l.get('id') |
426 try: | 427 try: |
427 if self.serial_number < int(id.split('-')[2]): self.serial_number = int(id.split('-')[2]) | 428 if self.serial_number < int(id.split('-')[2]): self.serial_number = int(id.split('-')[2]) |
428 except: pass | 429 except: pass |
429 if action == "del": | 430 if action == "del": |
430 if nodename == 'line': | 431 if nodename == 'line': |
434 text = self.get_text_by_id(id) | 435 text = self.get_text_by_id(id) |
435 if text != None: self.texts.remove(text) | 436 if text != None: self.texts.remove(text) |
436 elif action == "new": | 437 elif action == "new": |
437 if nodename == "line": | 438 if nodename == "line": |
438 try: | 439 try: |
439 line_string = l.getAttribute('line_string') | 440 line_string = l.get('line_string') |
440 upperleftx = l.getAttribute('upperleftx') | 441 upperleftx = l.get('upperleftx') |
441 upperlefty = l.getAttribute('upperlefty') | 442 upperlefty = l.get('upperlefty') |
442 lowerrightx = l.getAttribute('lowerrightx') | 443 lowerrightx = l.get('lowerrightx') |
443 lowerrighty = l.getAttribute('lowerrighty') | 444 lowerrighty = l.get('lowerrighty') |
444 upperleft = wx.Point(int(upperleftx),int(upperlefty)) | 445 upperleft = wx.Point(int(upperleftx),int(upperlefty)) |
445 lowerright = wx.Point(int(lowerrightx),int(lowerrighty)) | 446 lowerright = wx.Point(int(lowerrightx),int(lowerrighty)) |
446 color = l.getAttribute('color') | 447 color = l.get('color') |
447 if color == '#0000000': color = '#000000' | 448 if color == '#0000000': color = '#000000' |
448 id = l.getAttribute('id') | 449 id = l.get('id') |
449 width = int(l.getAttribute('width')) | 450 width = int(l.get('width')) |
450 except: | 451 except: |
451 line_string = upperleftx = upperlefty = lowerrightx = lowerrighty = color = 0 | 452 line_string = upperleftx = upperlefty = lowerrightx = lowerrighty = color = 0 |
452 continue | 453 continue |
453 line = WhiteboardLine(id, line_string, upperleft, lowerright, color, width) | 454 line = WhiteboardLine(id, line_string, upperleft, lowerright, color, width) |
454 self.lines.append(line) | 455 self.lines.append(line) |
455 elif nodename == "text": | 456 elif nodename == "text": |
456 try: | 457 try: |
457 text_string = l.getAttribute('text_string') | 458 text_string = l.get('text_string') |
458 style = l.getAttribute('style') | 459 style = l.get('style') |
459 pointsize = l.getAttribute('pointsize') | 460 pointsize = l.get('pointsize') |
460 weight = l.getAttribute('weight') | 461 weight = l.get('weight') |
461 color = l.getAttribute('color') | 462 color = l.get('color') |
462 if color == '#0000000': color = '#000000' | 463 if color == '#0000000': color = '#000000' |
463 id = l.getAttribute('id') | 464 id = l.get('id') |
464 posx = l.getAttribute('posx') | 465 posx = l.get('posx') |
465 posy = l.getAttribute('posy') | 466 posy = l.get('posy') |
466 pos = wx.Point(0,0) | 467 pos = wx.Point(0,0) |
467 pos.x = int(posx) | 468 pos.x = int(posx) |
468 pos.y = int(posy) | 469 pos.y = int(posy) |
469 except: continue | 470 except: continue |
470 text = WhiteboardText(id, text_string, pos, style, pointsize, weight, color) | 471 text = WhiteboardText(id, text_string, pos, style, pointsize, weight, color) |