comparison orpg/mapper/whiteboard_handler.py @ 227:81d0bfd5e800 alpha

Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order 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
author sirebral
date Sat, 12 Jun 2010 03:50:37 -0500
parents 06f10429eedc
children
comparison
equal deleted inserted replaced
182:4b2884f29a72 227:81d0bfd5e800
19 # 19 #
20 # File: mapper/whiteboard_hander.py 20 # File: mapper/whiteboard_hander.py
21 # Author: OpenRPG Team 21 # Author: OpenRPG Team
22 # Maintainer: 22 # Maintainer:
23 # Version: 23 # Version:
24 # $Id: whiteboard_handler.py,v 1.37 2007/03/09 14:11:56 digitalxero Exp $ 24 # $Id: whiteboard_handler.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: Whiteboard layer handler 26 # Description: Whiteboard layer handler
27 # 27 #
28 __version__ = "$Id: whiteboard_handler.py,v 1.37 2007/03/09 14:11:56 digitalxero Exp $" 28 __version__ = "$Id: whiteboard_handler.py,v Traipse 'Ornery-Orc' prof.ebral Exp $"
29 29
30 from base_handler import * 30 from base_handler import *
31 from math import floor, sqrt 31 from math import floor, sqrt
32 32
33 class whiteboard_handler(base_layer_handler): 33 class whiteboard_handler(base_layer_handler):
55 self.temp_edge1 = None 55 self.temp_edge1 = None
56 self.temp_edge2 = None 56 self.temp_edge2 = None
57 57
58 def build_ctrls(self): 58 def build_ctrls(self):
59 base_layer_handler.build_ctrls(self) 59 base_layer_handler.build_ctrls(self)
60 self.color_button = wx.Button(self, wx.ID_ANY, "Pen Color", style=wx.BU_EXACTFIT) 60 self.color_button = createMaskedButton(self, dir_struct["icon"]+'draw.png',
61 'Pen Color', wx.ID_ANY, '#bdbdbd',
62 wx.BITMAP_TYPE_PNG)
61 self.color_button.SetBackgroundColour(wx.BLACK) 63 self.color_button.SetBackgroundColour(wx.BLACK)
62 self.color_button.SetForegroundColour(wx.WHITE) 64 self.color_button.SetForegroundColour(wx.WHITE)
63 self.drawmode_ctrl = wx.Choice(self, wx.ID_ANY, choices = ["Freeform", "Polyline","Text", "Cone", "Circle"]) 65 self.drawmode_ctrl = wx.Choice(self, wx.ID_ANY, choices = ["Freeform", "Polyline","Text", "Cone", "Circle"])
64 self.drawmode_ctrl.SetSelection(0) #always start showing "Freeform" 66 self.drawmode_ctrl.SetSelection(0) #always start showing "Freeform"
65 self.radius = wx.TextCtrl(self, wx.ID_ANY, size=(32,-1) ) 67 self.radius = wx.TextCtrl(self, wx.ID_ANY, size=(32,-1) )
66 self.radius.SetValue("15") 68 self.radius.SetValue("15")
67 self.live_refresh = wx.CheckBox(self, wx.ID_ANY, " Live Refresh") 69 self.live_refresh = wx.CheckBox(self, wx.ID_ANY, " Dynamic")
68 self.live_refresh.SetValue(True) 70 self.live_refresh.SetValue(True)
69 self.widthList= wx.Choice(self, wx.ID_ANY, size= wx.Size(40, 20), 71 self.widthList= wx.Choice(self, wx.ID_ANY, size= wx.Size(40, 20),
70 choices=['1','2','3','4','5','6','7','8','9','10']) 72 choices=['1','2','3','4','5','6','7','8','9','10'])
71 self.widthList.SetSelection(0) 73 self.widthList.SetSelection(0)
72 self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Line Width: "),0,wx.ALIGN_CENTER) 74 self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Line Width: "),0,wx.ALIGN_CENTER)
76 self.sizer.Add(self.drawmode_ctrl, 0, wx.EXPAND) 78 self.sizer.Add(self.drawmode_ctrl, 0, wx.EXPAND)
77 self.sizer.Add(wx.StaticText(self, -1, " Radius: "), 0, wx.ALIGN_CENTER|wx.ALL, 3) 79 self.sizer.Add(wx.StaticText(self, -1, " Radius: "), 0, wx.ALIGN_CENTER|wx.ALL, 3)
78 self.sizer.Add(self.radius, 0, wx.EXPAND|wx.ALL, 2) 80 self.sizer.Add(self.radius, 0, wx.EXPAND|wx.ALL, 2)
79 self.sizer.Add(wx.Size(10,25)) 81 self.sizer.Add(wx.Size(10,25))
80 self.sizer.Add(self.live_refresh, 0, wx.EXPAND) 82 self.sizer.Add(self.live_refresh, 0, wx.EXPAND)
81 self.sizer.Add(wx.Size(20,25)) 83 self.sizer.Add(wx.Size(10,25))
82 self.sizer.Add(self.color_button, 0, wx.EXPAND) 84 self.sizer.Add(self.color_button, 0, wx.EXPAND)
83 self.sizer.Add(wx.Size(20,25)) 85 self.sizer.Add(wx.Size(20,25))
84 self.Bind(wx.EVT_MOTION, self.on_motion) 86 self.Bind(wx.EVT_MOTION, self.on_motion)
85 self.Bind(wx.EVT_CHOICE, self.check_draw_mode, self.drawmode_ctrl) 87 self.Bind(wx.EVT_CHOICE, self.check_draw_mode, self.drawmode_ctrl)
86 self.Bind(wx.EVT_BUTTON, self.on_pen_color, self.color_button) 88 self.Bind(wx.EVT_BUTTON, self.on_pen_color, self.color_button)
752 self.canvas.Refresh(False) 754 self.canvas.Refresh(False)
753 return 755 return
754 pos = self.get_snapped_to_logical_pos(evt) 756 pos = self.get_snapped_to_logical_pos(evt)
755 size = self.canvas.layers['grid'].unit_size #60 757 size = self.canvas.layers['grid'].unit_size #60
756 radius = int(int(self.radius.GetValue())/5) 758 radius = int(int(self.radius.GetValue())/5)
757 center = wx.Point(pos.x, pos.y+size*radius) 759 center = wx.Point(pos.x, pos.y)
758 curve = self.calculate_circle(center, radius, size) 760 curve = self.calculate_circle(center, radius, size)
759 if(self.temp_circle): 761 if self.temp_circle:
760 self.canvas.layers['whiteboard'].del_temp_line(self.temp_circle) 762 self.canvas.layers['whiteboard'].del_temp_line(self.temp_circle)
761 self.selected = None 763 self.selected = None
762 self.temp_circle = self.canvas.layers['whiteboard'].add_temp_line(curve) 764 self.temp_circle = self.canvas.layers['whiteboard'].add_temp_line(curve)
763 self.drawing = True 765 self.drawing = True
764 self.canvas.Refresh(True) 766 self.canvas.Refresh(True)