comparison orpg/mapper/miniatures_handler.py @ 151:06f10429eedc alpha

Traipse Alpha '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 (Cleaning up for 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:15:49 -0600
parents 54446a995007
children 537a6bbac9bd
comparison
equal deleted inserted replaced
149:c2caca988a11 151:06f10429eedc
27 # 27 #
28 __version__ = "$Id: miniatures_handler.py,v 1.43 2007/12/07 20:39:50 digitalxero Exp $" 28 __version__ = "$Id: miniatures_handler.py,v 1.43 2007/12/07 20:39:50 digitalxero Exp $"
29 29
30 from base_handler import * 30 from base_handler import *
31 from min_dialogs import * 31 from min_dialogs import *
32 import thread 32 import thread, time, mimetypes, urllib, wx, os
33 import time 33
34 import mimetypes
35 import urllib
36
37 import wx
38 from grid import GRID_RECTANGLE 34 from grid import GRID_RECTANGLE
39 from grid import GRID_HEXAGON 35 from grid import GRID_HEXAGON
40 from grid import GRID_ISOMETRIC 36 from grid import GRID_ISOMETRIC
41 import os
42 37
43 from orpg.tools.orpg_settings import settings 38 from orpg.tools.orpg_settings import settings
44 39
45 from xml.etree.ElementTree import ElementTree, Element 40 from xml.etree.ElementTree import ElementTree, Element
46 from xml.etree.ElementTree import fromstring, tostring 41 from xml.etree.ElementTree import fromstring, tostring
199 dlg.ShowModal() 194 dlg.ShowModal()
200 dlg.Destroy() 195 dlg.Destroy()
201 self.canvas.layers['miniatures'].rollback_serial() 196 self.canvas.layers['miniatures'].rollback_serial()
202 self.canvas.send_map_data() 197 self.canvas.send_map_data()
203 self.canvas.Refresh(False) 198 self.canvas.Refresh(False)
204
205 199
206 def build_menu(self,label = "Miniature"): 200 def build_menu(self,label = "Miniature"):
207 base_layer_handler.build_menu(self,label) 201 base_layer_handler.build_menu(self,label)
208 self.main_menu.AppendSeparator() 202 self.main_menu.AppendSeparator()
209 self.main_menu.Append(SHOW_LABELS_TOOL, "&Show Labels", '', 1) 203 self.main_menu.Append(SHOW_LABELS_TOOL, "&Show Labels", '', 1)
312 if len(self.mini_rclick_menu_extra_items)>0: 306 if len(self.mini_rclick_menu_extra_items)>0:
313 self.min_menu.AppendSeparator() 307 self.min_menu.AppendSeparator()
314 for item in self.mini_rclick_menu_extra_items.items(): self.min_menu.Append(item[1], item[0]) 308 for item in self.mini_rclick_menu_extra_items.items(): self.min_menu.Append(item[1], item[0])
315 if len(self.background_rclick_menu_extra_items)>0: 309 if len(self.background_rclick_menu_extra_items)>0:
316 self.main_menu.AppendSeparator() 310 self.main_menu.AppendSeparator()
317 for item in self.background_rclick_menu_extra_items.items(): 311 for item in self.background_rclick_menu_extra_items.items(): self.main_menu.Append(item[1], item[0])
318 self.main_menu.Append(item[1], item[0])
319 312
320 def do_min_menu(self,pos): 313 def do_min_menu(self,pos):
321 self.canvas.PopupMenu(self.min_menu,pos) 314 self.canvas.PopupMenu(self.min_menu,pos)
322 315
323 def do_min_select_menu(self, min_list, pos): 316 def do_min_select_menu(self, min_list, pos):
618 y = dc.DeviceToLogicalY(y) 611 y = dc.DeviceToLogicalY(y)
619 (imgtype,j) = mimetypes.guess_type(filename) 612 (imgtype,j) = mimetypes.guess_type(filename)
620 postdata = urllib.urlencode({'filename':filename, 'imgdata':imgdata, 'imgtype':imgtype}) 613 postdata = urllib.urlencode({'filename':filename, 'imgdata':imgdata, 'imgtype':imgtype})
621 if self.settings.get_setting('LocalorRemote') == 'Remote': 614 if self.settings.get_setting('LocalorRemote') == 'Remote':
622 thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, filepath), {'pos':cmpPoint(x,y)}) 615 thread.start_new_thread(self.canvas.layers['miniatures'].upload, (postdata, filepath), {'pos':cmpPoint(x,y)})
623 else: 616 else: self.CherryPit(filepath, '')
624 self.CherryPit(filepath, '')
625 617
626 def on_tooltip_timer(self, *args): 618 def on_tooltip_timer(self, *args):
627 pos = args[0] 619 pos = args[0]
628 dc = wx.ClientDC(self.canvas) 620 dc = wx.ClientDC(self.canvas)
629 self.canvas.PrepareDC(dc) 621 self.canvas.PrepareDC(dc)
632 mini_list = self.getMiniListOrSelectedMini(pos) 624 mini_list = self.getMiniListOrSelectedMini(pos)
633 if len(mini_list) > 0: 625 if len(mini_list) > 0:
634 tooltip = mini_list[0].label 626 tooltip = mini_list[0].label
635 #self.canvas.SetToolTipString(mini_list[0].label) 627 #self.canvas.SetToolTipString(mini_list[0].label)
636 #Once set, it never unsets, so it sucks. 628 #Once set, it never unsets, so it sucks.
637 else: 629 else: self.canvas.SetToolTipString('')
638 self.canvas.SetToolTipString('')
639 630
640 def on_motion(self,evt): 631 def on_motion(self,evt):
641 if evt.Dragging() and evt.LeftIsDown(): 632 if evt.Dragging() and evt.LeftIsDown():
642 if self.canvas.drag is None and self.drag_mini is not None: 633 if self.canvas.drag is None and self.drag_mini is not None:
643 drag_bmp = self.drag_mini.bmp 634 drag_bmp = self.drag_mini.bmp