Mercurial > traipse
comparison orpg/mapper/whiteboard_handler.py @ 18:97265586402b ornery-orc
Traipse 'OpenRPG' {090827-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:
Update Manager is now in version 0.8. While not every button works, users can now browse the different revisions and their different changesets. The code has been refined some with feature from Core added to it. A Crash report is now created if the users software crashes. Update Manager has been moved to the Traipse Suite menu item, and a Debug Console as been added as well.
author | sirebral |
---|---|
date | Thu, 27 Aug 2009 01:04:43 -0500 |
parents | 211ac836b6a0 |
children | ff154cf3350c |
comparison
equal
deleted
inserted
replaced
17:265b987cce4f | 18:97265586402b |
---|---|
66 self.radius = wx.TextCtrl(self, wx.ID_ANY, size=(32,-1) ) | 66 self.radius = wx.TextCtrl(self, wx.ID_ANY, size=(32,-1) ) |
67 self.radius.SetValue("15") | 67 self.radius.SetValue("15") |
68 self.live_refresh = wx.CheckBox(self, wx.ID_ANY, " Live Refresh") | 68 self.live_refresh = wx.CheckBox(self, wx.ID_ANY, " Live Refresh") |
69 self.live_refresh.SetValue(True) | 69 self.live_refresh.SetValue(True) |
70 self.widthList= wx.Choice(self, wx.ID_ANY, size= wx.Size(40, 20), | 70 self.widthList= wx.Choice(self, wx.ID_ANY, size= wx.Size(40, 20), |
71 choices=['1','2','3','4','5','6','7','8','9','10']) | 71 choices=['1','2','3','4','5','6','7','8','9','10']) |
72 self.widthList.SetSelection(0) #always start showing "1" | 72 self.widthList.SetSelection(0) |
73 self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Line Width: "),0,wx.ALIGN_CENTER) | 73 self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Line Width: "),0,wx.ALIGN_CENTER) |
74 self.sizer.Add(self.widthList, 0, wx.EXPAND) | 74 self.sizer.Add(self.widthList, 0, wx.EXPAND) |
75 self.sizer.Add(wx.Size(10,25)) | 75 self.sizer.Add(wx.Size(10,25)) |
76 self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Drawing Mode: "),0,wx.ALIGN_CENTER) | 76 self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Drawing Mode: "),0,wx.ALIGN_CENTER) |
77 self.sizer.Add(self.drawmode_ctrl, 0, wx.EXPAND) | 77 self.sizer.Add(self.drawmode_ctrl, 0, wx.EXPAND) |
102 self.txt_boxer.Add(self.txt_static,0,wx.EXPAND) | 102 self.txt_boxer.Add(self.txt_static,0,wx.EXPAND) |
103 self.txt_boxer.Add(wx.Size(10,10)) | 103 self.txt_boxer.Add(wx.Size(10,10)) |
104 self.txt_boxer.Add(self.text_control,1,wx.EXPAND) | 104 self.txt_boxer.Add(self.text_control,1,wx.EXPAND) |
105 self.point_boxer = wx.BoxSizer(wx.HORIZONTAL) | 105 self.point_boxer = wx.BoxSizer(wx.HORIZONTAL) |
106 self.point_static = wx.StaticText(self.text_properties_dialog, -1, "Text Size: ") | 106 self.point_static = wx.StaticText(self.text_properties_dialog, -1, "Text Size: ") |
107 self.point_control = wx.SpinCtrl(self.text_properties_dialog, wx.ID_ANY, value = "12", | 107 self.point_control = wx.SpinCtrl(self.text_properties_dialog, |
108 min = 1, initial = 12, name = "Font Size: ") | 108 wx.ID_ANY, value = "12", |
109 min = 1, initial = 12, | |
110 name = "Font Size: ") | |
109 self.point_boxer.Add(self.point_static,1,wx.EXPAND) | 111 self.point_boxer.Add(self.point_static,1,wx.EXPAND) |
110 self.point_boxer.Add(wx.Size(10,10)) | 112 self.point_boxer.Add(wx.Size(10,10)) |
111 self.point_boxer.Add(self.point_control,0,wx.EXPAND) | 113 self.point_boxer.Add(self.point_control,0,wx.EXPAND) |
112 self.text_color_control = wx.Button(self.text_properties_dialog, wx.ID_ANY, "TEXT COLOR",style=wx.BU_EXACTFIT) | 114 self.text_color_control = wx.Button(self.text_properties_dialog, wx.ID_ANY, "TEXT COLOR",style=wx.BU_EXACTFIT) |
113 self.weight_control = wx.RadioBox(self.text_properties_dialog, wx.ID_ANY, "Weight", choices = ["Normal","Bold"]) | 115 self.weight_control = wx.RadioBox(self.text_properties_dialog, wx.ID_ANY, "Weight", choices = ["Normal","Bold"]) |
259 self.canvas.layers['whiteboard'].setwidth(width) | 261 self.canvas.layers['whiteboard'].setwidth(width) |
260 | 262 |
261 def undo_line(self,evt): | 263 def undo_line(self,evt): |
262 session = self.canvas.frame.session | 264 session = self.canvas.frame.session |
263 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): | 265 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): |
264 self.top_frame.openrpg.get_component("chat").InfoPost("You must be a GM to use this feature") | 266 self.top_frame.openrpg.get("chat").InfoPost("You must be a GM to use this feature") |
265 return | 267 return |
266 self.canvas.layers['whiteboard'].undo_line() | 268 self.canvas.layers['whiteboard'].undo_line() |
267 dc = self.create_dc() | 269 dc = self.create_dc() |
268 self.un_highlight(dc) | 270 self.un_highlight(dc) |
269 self.selected = None | 271 self.selected = None |
270 del dc | 272 del dc |
271 | 273 |
272 def delete_all_lines(self,evt): | 274 def delete_all_lines(self,evt): |
273 session = self.canvas.frame.session | 275 session = self.canvas.frame.session |
274 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): | 276 if (session.my_role() != session.ROLE_GM) and (session.use_roles()): |
275 open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature") | 277 component.get("chat").InfoPost("You must be a GM to use this feature") |
276 return | 278 return |
277 dlg = wx.MessageDialog(self, "Are you sure you want to delete all lines?","Delete All Lines",wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) | 279 dlg = wx.MessageDialog(self, |
280 "Are you sure you want to delete all lines?","Delete All Lines", | |
281 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) | |
278 if dlg.ShowModal() != wx.ID_YES: return | 282 if dlg.ShowModal() != wx.ID_YES: return |
279 self.canvas.layers['whiteboard'].del_all_lines() | 283 self.canvas.layers['whiteboard'].del_all_lines() |
280 dc = self.create_dc() | 284 dc = self.create_dc() |
281 self.un_highlight(dc) | 285 self.un_highlight(dc) |
282 self.selected = None | 286 self.selected = None |
434 else: | 438 else: |
435 #have enough points to create valid line | 439 #have enough points to create valid line |
436 #check to role to make sure user can draw at all.... | 440 #check to role to make sure user can draw at all.... |
437 session = self.canvas.frame.session | 441 session = self.canvas.frame.session |
438 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 442 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
439 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 443 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
440 self.canvas.Refresh(False) | 444 self.canvas.Refresh(False) |
441 else: line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright) | 445 else: line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright) |
442 #resetting variables for next line | 446 #resetting variables for next line |
443 self.upperleft.x = self.upperleft.y = 0 | 447 self.upperleft.x = self.upperleft.y = 0 |
444 self.lowerright.x = self.lowerright.y = 0 | 448 self.lowerright.x = self.lowerright.y = 0 |
470 else: | 474 else: |
471 #have enough points to create valid line | 475 #have enough points to create valid line |
472 #check to role to make sure user can draw at all.... | 476 #check to role to make sure user can draw at all.... |
473 session = self.canvas.frame.session | 477 session = self.canvas.frame.session |
474 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 478 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
475 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 479 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
476 self.canvas.Refresh(False) | 480 self.canvas.Refresh(False) |
477 else: line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright) | 481 else: line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright) |
478 #resetting variables for next line | 482 #resetting variables for next line |
479 self.upperleft.x = self.upperleft.y = 0 | 483 self.upperleft.x = self.upperleft.y = 0 |
480 self.lowerright.x = self.lowerright.y = 0 | 484 self.lowerright.x = self.lowerright.y = 0 |
532 | 536 |
533 # moved original on_motion to this function | 537 # moved original on_motion to this function |
534 # to allow alternate drawing method to be used | 538 # to allow alternate drawing method to be used |
535 # 05-09-2003 Snowdog | 539 # 05-09-2003 Snowdog |
536 def freeform_motion(self, evt): | 540 def freeform_motion(self, evt): |
537 # if not self.drawing: | 541 #if not self.drawing: |
538 # return | 542 # return |
539 scale = self.canvas.layers['grid'].mapscale | 543 scale = self.canvas.layers['grid'].mapscale |
540 dc = wx.ClientDC( self.canvas ) | 544 dc = wx.ClientDC( self.canvas ) |
541 self.canvas.PrepareDC( dc ) | 545 self.canvas.PrepareDC( dc ) |
542 dc.SetUserScale(scale,scale) | 546 dc.SetUserScale(scale,scale) |
543 pos = evt.GetLogicalPosition(dc) | 547 pos = evt.GetLogicalPosition(dc) |
564 def on_freeform_left_up(self,evt): | 568 def on_freeform_left_up(self,evt): |
565 if self.drawing == True: | 569 if self.drawing == True: |
566 self.drawing = False | 570 self.drawing = False |
567 session = self.canvas.frame.session | 571 session = self.canvas.frame.session |
568 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 572 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
569 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 573 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
570 self.canvas.Refresh(False) | 574 self.canvas.Refresh(False) |
571 return | 575 return |
572 #self.id +=1 | 576 #self.id +=1 |
573 line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright) | 577 line = self.canvas.layers['whiteboard'].add_line(self.line_string,self.upperleft,self.lowerright) |
574 dc = self.create_dc() | 578 dc = self.create_dc() |
582 self.lowerright.x = self.lowerright.y = 0 | 586 self.lowerright.x = self.lowerright.y = 0 |
583 | 587 |
584 def on_text_left_down(self, evt): | 588 def on_text_left_down(self, evt): |
585 session = self.canvas.frame.session | 589 session = self.canvas.frame.session |
586 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 590 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
587 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 591 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
588 self.canvas.Refresh(False) | 592 self.canvas.Refresh(False) |
589 return | 593 return |
590 scale = self.canvas.layers['grid'].mapscale | 594 scale = self.canvas.layers['grid'].mapscale |
591 dc = wx.ClientDC( self.canvas ) | 595 dc = wx.ClientDC( self.canvas ) |
592 self.canvas.PrepareDC( dc ) | 596 self.canvas.PrepareDC( dc ) |
616 del dc | 620 del dc |
617 | 621 |
618 def on_text_right_down(self, evt, dc): | 622 def on_text_right_down(self, evt, dc): |
619 session = self.canvas.frame.session | 623 session = self.canvas.frame.session |
620 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 624 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
621 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 625 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
622 self.canvas.Refresh(False) | 626 self.canvas.Refresh(False) |
623 return | 627 return |
624 pos = evt.GetLogicalPosition(dc) | 628 pos = evt.GetLogicalPosition(dc) |
625 test_text = self.canvas.layers['whiteboard'].hit_test_text(pos, dc) | 629 test_text = self.canvas.layers['whiteboard'].hit_test_text(pos, dc) |
626 if len(test_text) > 0: | 630 if len(test_text) > 0: |
630 self.do_text_menu('right') | 634 self.do_text_menu('right') |
631 | 635 |
632 def on_start_cone(self, evt): | 636 def on_start_cone(self, evt): |
633 session = self.canvas.frame.session | 637 session = self.canvas.frame.session |
634 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 638 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
635 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 639 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
636 self.canvas.Refresh(False) | 640 self.canvas.Refresh(False) |
637 return | 641 return |
638 self.cone_start = self.get_snapped_to_logical_pos(evt) | 642 self.cone_start = self.get_snapped_to_logical_pos(evt) |
639 self.drawing = True | 643 self.drawing = True |
640 | 644 |
746 self.canvas.Refresh(True) | 750 self.canvas.Refresh(True) |
747 | 751 |
748 def draw_temporary_circle(self, evt): | 752 def draw_temporary_circle(self, evt): |
749 session = self.canvas.frame.session | 753 session = self.canvas.frame.session |
750 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): | 754 if (session.my_role() != session.ROLE_GM) and (session.my_role()!=session.ROLE_PLAYER) and (session.use_roles()): |
751 open_rpg.get_component("chat").InfoPost("You must be either a player or GM to use this feature") | 755 component.get("chat").InfoPost("You must be either a player or GM to use this feature") |
752 self.canvas.Refresh(False) | 756 self.canvas.Refresh(False) |
753 return | 757 return |
754 pos = self.get_snapped_to_logical_pos(evt) | 758 pos = self.get_snapped_to_logical_pos(evt) |
755 size = self.canvas.layers['grid'].unit_size #60 | 759 size = self.canvas.layers['grid'].unit_size #60 |
756 radius = int(int(self.radius.GetValue())/5) | 760 radius = int(int(self.radius.GetValue())/5) |