Mercurial > traipse_dev
diff orpg/mapper/whiteboard.py @ 152:6081bdc2b8d5 beta
Traipse Beta '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 (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:16:35 -0600 |
parents | e842a5f1b775 |
children | d263c8ff4d7c |
line wrap: on
line diff
--- a/orpg/mapper/whiteboard.py Tue Nov 24 17:18:40 2009 -0600 +++ b/orpg/mapper/whiteboard.py Wed Nov 25 06:16:35 2009 -0600 @@ -121,10 +121,8 @@ def takedom(self, xml_dom): self.text_string = xml_dom.getAttribute("text_string") self.id = xml_dom.getAttribute("id") - if xml_dom.hasAttribute("posy"): - self.posy = int(xml_dom.getAttribute("posy")) - if xml_dom.hasAttribute("posx"): - self.posx = int(xml_dom.getAttribute("posx")) + if xml_dom.hasAttribute("posy"): self.posy = int(xml_dom.getAttribute("posy")) + if xml_dom.hasAttribute("posx"): self.posx = int(xml_dom.getAttribute("posx")) if xml_dom.hasAttribute("weight"): self.weight = int(xml_dom.getAttribute("weight")) self.font.SetWeight(self.weight) @@ -175,11 +173,9 @@ oldicords = (int(stcords[0]),int(stcords[1])) for coordinate_string_counter in range(1, len(coords)): stcords = coords[coordinate_string_counter].split(",") - if stcords[0] == "": - return False + if stcords[0] == "": return False icords = (int(stcords[0]),int(stcords[1])) - if orpg.mapper.map_utils.proximity_test(oldicords,icords,pt,12): - return True + if orpg.mapper.map_utils.proximity_test(oldicords,icords,pt,12): return True oldicords = icords return False @@ -237,20 +233,14 @@ def takedom(self, xml_dom): self.line_string = xml_dom.getAttribute("line_string") self.id = xml_dom.getAttribute("id") - if xml_dom.hasAttribute("upperleftx"): - self.upperleft.x = int(xml_dom.getAttribute("upperleftx")) - if xml_dom.hasAttribute("upperlefty"): - self.upperleft.y = int(xml_dom.getAttribute("upperlefty")) - if xml_dom.hasAttribute("lowerrightx"): - self.lowerright.x = int(xml_dom.getAttribute("lowerrightx")) - if xml_dom.hasAttribute("lowerrighty"): - self.lowerright.y = int(xml_dom.getAttribute("lowerrighty")) + if xml_dom.hasAttribute("upperleftx"): self.upperleft.x = int(xml_dom.getAttribute("upperleftx")) + if xml_dom.hasAttribute("upperlefty"): self.upperleft.y = int(xml_dom.getAttribute("upperlefty")) + if xml_dom.hasAttribute("lowerrightx"): self.lowerright.x = int(xml_dom.getAttribute("lowerrightx")) + if xml_dom.hasAttribute("lowerrighty"): self.lowerright.y = int(xml_dom.getAttribute("lowerrighty")) if xml_dom.hasAttribute("color") and xml_dom.getAttribute("color") != '': self.linecolor = xml_dom.getAttribute("color") - if self.linecolor == '#0000000': - self.linecolor = '#000000' - if xml_dom.hasAttribute("width"): - self.linewidth = int(xml_dom.getAttribute("width")) + if self.linecolor == '#0000000': self.linecolor = '#000000' + if xml_dom.hasAttribute("width"): self.linewidth = int(xml_dom.getAttribute("width")) ##----------------------------- ## whiteboard layer @@ -299,14 +289,12 @@ def get_line_by_id(self, id): for line in self.lines: - if str(line.id) == str(id): - return line + if str(line.id) == str(id): return line return None def get_text_by_id(self, id): for text in self.texts: - if str(text.id) == str(id): - return text + if str(text.id) == str(id): return text return None def del_line(self, line): @@ -327,17 +315,14 @@ self.canvas.Refresh(True) def del_all_lines(self): - for i in xrange(len(self.lines)): - self.del_line(self.lines[0]) - print self.lines + for i in xrange(len(self.lines)): self.del_line(self.lines[0]) def del_text(self, text): xml_str = "<map><whiteboard>" xml_str += text.toxml("del") xml_str += "</whiteboard></map>" self.canvas.frame.session.send(xml_str) - if text: - self.texts.remove(text) + if text: self.texts.remove(text) self.canvas.Refresh(True) def layerDraw(self, dc): @@ -347,8 +332,7 @@ def hit_test_text(self, pos, dc): list_of_texts_matching = [] if self.canvas.layers['fog'].use_fog == 1: - if self.canvas.frame.session.role != "GM": - return list_of_texts_matching + if self.canvas.frame.session.role != "GM": return list_of_texts_matching for m in self.texts: if m.hit_test(pos,dc): list_of_texts_matching.append(m) return list_of_texts_matching @@ -356,8 +340,7 @@ def hit_test_lines(self, pos, dc): list_of_lines_matching = [] if self.canvas.layers['fog'].use_fog == 1: - if self.canvas.frame.session.role != "GM": - return list_of_lines_matching + if self.canvas.frame.session.role != "GM": return list_of_lines_matching for m in self.lines: if m.hit_test(pos): list_of_lines_matching.append(m) return list_of_lines_matching @@ -368,10 +351,8 @@ self.canvas.PrepareDC( dc ) dc.SetUserScale(scale,scale) line_list = self.hit_test_lines(pt,dc) - if line_list: - return line_list[0] - else: - return None + if line_list: return line_list[0] + else: return None def setcolor(self, color): r,g,b = color.Get() @@ -412,8 +393,7 @@ points = x.split(",") x1 = int(points[0]) y1 = int(points[1]) - if x2 != -999: - dc.DrawLine(x2,y2,x1,y1) + if x2 != -999: dc.DrawLine(x2,y2,x1,y1) x2 = x1 y2 = y1 dc.SetPen(wx.NullPen) @@ -422,9 +402,9 @@ def layerToXML(self, action="update"): """ format """ white_string = "" - if self.lines: + if self.lines: for l in self.lines: white_string += l.toxml(action) - if self.texts: + if self.texts: for l in self.texts: white_string += l.toxml(action) if len(white_string): s = "<whiteboard" @@ -433,8 +413,7 @@ s += white_string s += "</whiteboard>" return s - else: - return "" + else: return "" def layerTakeDOM(self, xml_dom): serial_number = xml_dom.getAttribute('serial') @@ -485,8 +464,7 @@ pos = wx.Point(0,0) pos.x = int(posx) pos.y = int(posy) - except: - continue + except: continue text = WhiteboardText(id, text_string, pos, style, pointsize, weight, color) self.texts.append(text) else: