comparison plugins/xxmouse-zoom.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 d86e762a994f
children
comparison
equal deleted inserted replaced
182:4b2884f29a72 227:81d0bfd5e800
17 self.author = 'Tyler Starke (Prof. Ebral)' 17 self.author = 'Tyler Starke (Prof. Ebral)'
18 self.help = 'This plugin allows users to zoom their map with super ease. Hold Ctrl or Cmd and scroll your mouse ' 18 self.help = 'This plugin allows users to zoom their map with super ease. Hold Ctrl or Cmd and scroll your mouse '
19 self.help += 'wheel and the map will zoom in or out. And FAST too! \n' 19 self.help += 'wheel and the map will zoom in or out. And FAST too! \n'
20 self.help += 'This plugin is designed for Grumpy Goblin and Ornery Orc.' 20 self.help += 'This plugin is designed for Grumpy Goblin and Ornery Orc.'
21 21
22 def plugin_menu(self):
23 self.menu = wx.Menu()
24 self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On')
25 self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle)
26 self.toggle.Check(True)
27
28 def plugin_toggle(self, evt):
29 if self.toggle.IsChecked() == False: self.canvas.Disconnect(-1, -1, wx.wxEVT_MOUSEWHEEL)
30 if self.toggle.IsChecked() == True:
31 self.canvas.Bind(wx.EVT_MOUSEWHEEL, self.MouseWheel)
32
22 def plugin_enabled(self): 33 def plugin_enabled(self):
23 try: self.canvas = component.get('map').canvas 34 try: self.canvas = component.get('map').canvas
24 except: self.canvas = open_rpg.get_component('map').canvas 35 except: self.canvas = open_rpg.get_component('map').canvas
25 self.canvas.Bind(wx.EVT_MOUSEWHEEL, self.MouseWheel) 36 self.canvas.Bind(wx.EVT_MOUSEWHEEL, self.MouseWheel)
26 37
27 def MouseWheel(self, evt): 38 def MouseWheel(self, evt):
28 if evt.CmdDown(): 39 if evt.CmdDown():
29 print evt.GetWheelRotation()
30 if evt.GetWheelRotation() > 0: self.canvas.on_zoom_in(None) 40 if evt.GetWheelRotation() > 0: self.canvas.on_zoom_in(None)
31 elif evt.GetWheelRotation() < 0: self.canvas.on_zoom_out(None) 41 elif evt.GetWheelRotation() < 0: self.canvas.on_zoom_out(None)
32 else: pass 42 else: pass
33 else: self.canvas.on_scroll(evt) 43 else: self.canvas.on_scroll(evt)
34 44
35 def plugin_disabled(self): 45 def plugin_disabled(self):
36 self.canvas.Disconnect(-1, -1, wx.wxEVT_MOUSEWHEEL) 46 try: self.canvas.Disconnect(-1, -1, wx.wxEVT_MOUSEWHEEL)
47 except: pass
37 48