Mercurial > traipse_dev
comparison orpg/mapper/miniatures_handler.py @ 137:54446a995007 alpha
Traipse Alpha 'OpenRPG' {091018-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 Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
author | sirebral |
---|---|
date | Wed, 18 Nov 2009 19:57:52 -0600 |
parents | 9314d63c0941 |
children | 06f10429eedc |
comparison
equal
deleted
inserted
replaced
136:b4e02e8cd314 | 137:54446a995007 |
---|---|
418 # before getting the oldz to test | 418 # before getting the oldz to test |
419 # Save the selected minis current z-order | 419 # Save the selected minis current z-order |
420 oldz = self.sel_rmin.zorder | 420 oldz = self.sel_rmin.zorder |
421 # Make sure the mini isn't sticky front or back | 421 # Make sure the mini isn't sticky front or back |
422 if (oldz != MIN_STICKY_BACK) and (oldz != MIN_STICKY_FRONT): | 422 if (oldz != MIN_STICKY_BACK) and (oldz != MIN_STICKY_FRONT): |
423 ## print "old z-order = " + str(oldz) | |
424 self.sel_rmin.zorder -= 1 | 423 self.sel_rmin.zorder -= 1 |
425 # Re-collapse to normalize | 424 # Re-collapse to normalize |
426 # Note: only one update (with the final values) will be sent | 425 # Note: only one update (with the final values) will be sent |
427 self.canvas.layers['miniatures'].collapse_zorder() | 426 self.canvas.layers['miniatures'].collapse_zorder() |
428 | 427 |
432 # minis - 1. If this isn't the case, then execute | 431 # minis - 1. If this isn't the case, then execute |
433 # a self.canvas.layers['miniatures'].collapse_zorder() | 432 # a self.canvas.layers['miniatures'].collapse_zorder() |
434 # before getting the oldz to test | 433 # before getting the oldz to test |
435 # Save the selected minis current z-order | 434 # Save the selected minis current z-order |
436 oldz = self.sel_rmin.zorder | 435 oldz = self.sel_rmin.zorder |
437 ## print "old z-order = " + str(oldz) | |
438 self.sel_rmin.zorder += 1 | 436 self.sel_rmin.zorder += 1 |
439 | 437 |
440 # Re-collapse to normalize | 438 # Re-collapse to normalize |
441 # Note: only one update (with the final values) will be sent | 439 # Note: only one update (with the final values) will be sent |
442 self.canvas.layers['miniatures'].collapse_zorder() | 440 self.canvas.layers['miniatures'].collapse_zorder() |
450 # Save the selected minis current z-order | 448 # Save the selected minis current z-order |
451 oldz = self.sel_rmin.zorder | 449 oldz = self.sel_rmin.zorder |
452 | 450 |
453 # Make sure the mini isn't sticky front or back | 451 # Make sure the mini isn't sticky front or back |
454 if (oldz != MIN_STICKY_BACK) and (oldz != MIN_STICKY_FRONT): | 452 if (oldz != MIN_STICKY_BACK) and (oldz != MIN_STICKY_FRONT): |
455 ## print "old z-order = " + str(oldz) | |
456 # The new z-order will be one more than the last index | 453 # The new z-order will be one more than the last index |
457 newz = len(self.canvas.layers['miniatures'].miniatures) | 454 newz = len(self.canvas.layers['miniatures'].miniatures) |
458 ## print "new z-order = " + str(newz) | |
459 self.sel_rmin.zorder = newz | 455 self.sel_rmin.zorder = newz |
460 # Re-collapse to normalize | 456 # Re-collapse to normalize |
461 # Note: only one update (with the final values) will be sent | 457 # Note: only one update (with the final values) will be sent |
462 self.canvas.layers['miniatures'].collapse_zorder() | 458 self.canvas.layers['miniatures'].collapse_zorder() |
463 | 459 |
469 # before getting the oldz to test | 465 # before getting the oldz to test |
470 # Save the selected minis current z-order | 466 # Save the selected minis current z-order |
471 oldz = self.sel_rmin.zorder | 467 oldz = self.sel_rmin.zorder |
472 # Make sure the mini isn't sticky front or back | 468 # Make sure the mini isn't sticky front or back |
473 if (oldz != MIN_STICKY_BACK) and (oldz != MIN_STICKY_FRONT): | 469 if (oldz != MIN_STICKY_BACK) and (oldz != MIN_STICKY_FRONT): |
474 ## print "old z-order = " + str(oldz) | |
475 | 470 |
476 # Since 0 is the lowest in a normalized order, be one less | 471 # Since 0 is the lowest in a normalized order, be one less |
477 newz = -1 | 472 newz = -1 |
478 ## print "new z-order = " + str(newz) | |
479 self.sel_rmin.zorder = newz | 473 self.sel_rmin.zorder = newz |
480 # Re-collapse to normalize | 474 # Re-collapse to normalize |
481 # Note: only one update (with the final values) will be sent | 475 # Note: only one update (with the final values) will be sent |
482 self.canvas.layers['miniatures'].collapse_zorder() | 476 self.canvas.layers['miniatures'].collapse_zorder() |
483 | 477 |
484 elif id == MIN_FRONTBACK_UNLOCK: | 478 elif id == MIN_FRONTBACK_UNLOCK: |
485 #print "Unlocked/ unstickified..." | |
486 if self.sel_rmin.zorder == MIN_STICKY_BACK: self.sel_rmin.zorder = MIN_STICKY_BACK + 1 | 479 if self.sel_rmin.zorder == MIN_STICKY_BACK: self.sel_rmin.zorder = MIN_STICKY_BACK + 1 |
487 elif self.sel_rmin.zorder == MIN_STICKY_FRONT: self.sel_rmin.zorder = MIN_STICKY_FRONT - 1 | 480 elif self.sel_rmin.zorder == MIN_STICKY_FRONT: self.sel_rmin.zorder = MIN_STICKY_FRONT - 1 |
488 elif id == MIN_LOCK_BACK: self.sel_rmin.zorder = MIN_STICKY_BACK | 481 elif id == MIN_LOCK_BACK: self.sel_rmin.zorder = MIN_STICKY_BACK |
489 elif id == MIN_LOCK_FRONT: self.sel_rmin.zorder = MIN_STICKY_FRONT | 482 elif id == MIN_LOCK_FRONT: self.sel_rmin.zorder = MIN_STICKY_FRONT |
490 # Pretty much, we always want to refresh when we go through here | 483 # Pretty much, we always want to refresh when we go through here |
495 self.canvas.send_map_data() | 488 self.canvas.send_map_data() |
496 | 489 |
497 def on_miniature(self, evt): | 490 def on_miniature(self, evt): |
498 session = self.canvas.frame.session | 491 session = self.canvas.frame.session |
499 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER) and (session.use_roles()): | 492 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER) and (session.use_roles()): |
500 print session.my_role() | |
501 self.infoPost("You must be either a player or GM to use the miniature Layer") | 493 self.infoPost("You must be either a player or GM to use the miniature Layer") |
502 return | 494 return |
503 min_url = self.min_url.GetValue() | 495 min_url = self.min_url.GetValue() |
504 # build url | 496 # build url |
505 if min_url == "" or min_url == "http://": return | 497 if min_url == "" or min_url == "http://": return |
506 if min_url[:7] != "http://" : min_url = "http://" + min_url | 498 if min_url[:7] != "http://" : min_url = "http://" + min_url |
507 # make label | 499 # make label |
508 if self.auto_label: print 'auto-label' | |
509 if not self.auto_label: print 'False' | |
510 if self.auto_label and min_url[-4:-3] == '.': | 500 if self.auto_label and min_url[-4:-3] == '.': |
511 start = min_url.rfind("/") + 1 | 501 start = min_url.rfind("/") + 1 |
512 min_label = min_url[start:len(min_url)-4] | 502 min_label = min_url[start:len(min_url)-4] |
513 if self.use_serial: | 503 if self.use_serial: |
514 min_label = '%s %d' % ( min_label, self.canvas.layers['miniatures'].next_serial() ) | 504 min_label = '%s %d' % ( min_label, self.canvas.layers['miniatures'].next_serial() ) |
515 else: min_label = "" | 505 else: min_label = "" |
516 if self.min_url.FindString(min_url) == -1: self.min_url.Append(min_url) | 506 if self.min_url.FindString(min_url) == -1: self.min_url.Append(min_url) |
517 try: | 507 try: |
518 id = 'mini-' + self.canvas.frame.session.get_next_id() | 508 id = 'mini-' + self.canvas.frame.session.get_next_id() |
519 # make the new mini appear in top left of current viewable map | 509 # make the new mini appear in top left of current viewable map |
520 print id | |
521 dc = wx.ClientDC(self.canvas) | 510 dc = wx.ClientDC(self.canvas) |
522 self.canvas.PrepareDC(dc) | 511 self.canvas.PrepareDC(dc) |
523 dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) | 512 dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) |
524 x = dc.DeviceToLogicalX(0) | 513 x = dc.DeviceToLogicalX(0) |
525 y = dc.DeviceToLogicalY(0) | 514 y = dc.DeviceToLogicalY(0) |
526 self.canvas.layers['miniatures'].add_miniature(id, min_url, pos=cmpPoint(x,y), label=min_label) | 515 self.canvas.layers['miniatures'].add_miniature(id, min_url, pos=cmpPoint(x,y), label=min_label) |
527 except: | 516 except: |
528 # When there is an exception here, we should be decrementing the serial_number for reuse!! | 517 # When there is an exception here, we should be decrementing the serial_number for reuse!! |
529 unablemsg= "Unable to load/resolve URL: " + min_url + " on resource \"" + min_label + "\"!!!\n\n" | 518 unablemsg= "Unable to load/resolve URL: " + min_url + " on resource \"" + min_label + "\"!!!\n\n" |
530 #print unablemsg | |
531 dlg = wx.MessageDialog(self,unablemsg, 'Url not found',wx.ICON_EXCLAMATION) | 519 dlg = wx.MessageDialog(self,unablemsg, 'Url not found',wx.ICON_EXCLAMATION) |
532 dlg.ShowModal() | 520 dlg.ShowModal() |
533 dlg.Destroy() | 521 dlg.Destroy() |
534 self.canvas.layers['miniatures'].rollback_serial() | 522 self.canvas.layers['miniatures'].rollback_serial() |
535 self.canvas.send_map_data() | 523 self.canvas.send_map_data() |
769 def infoPost(self, message): | 757 def infoPost(self, message): |
770 component.get("chat").InfoPost(message) | 758 component.get("chat").InfoPost(message) |
771 | 759 |
772 def role_is_gm_or_player(self): | 760 def role_is_gm_or_player(self): |
773 session = self.canvas.frame.session | 761 session = self.canvas.frame.session |
774 print session.my_role(), session.ROLE_GM | |
775 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER) and (session.use_roles()): | 762 if (session.my_role() != session.ROLE_GM) and (session.my_role() != session.ROLE_PLAYER) and (session.use_roles()): |
776 print 'role is gm or player' | |
777 self.infoPost("You must be either a player or GM to use the miniature Layer") | 763 self.infoPost("You must be either a player or GM to use the miniature Layer") |
778 return False | 764 return False |
779 return True | 765 return True |
780 | 766 |
781 def role_is_gm(self): | 767 def role_is_gm(self): |