Mercurial > traipse_dev
comparison orpg/gametree/nodehandlers/forms.py @ 141:2ffc5de126c8 alpha
Traipse Alpha 'OpenRPG' {091123-01}
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 | Mon, 23 Nov 2009 12:19:56 -0600 |
parents | fe4dc5817d5e |
children | 06f10429eedc |
comparison
equal
deleted
inserted
replaced
139:8e07c1a2c69b | 141:2ffc5de126c8 |
---|---|
379 """ | 379 """ |
380 def __init__(self,xml,tree_node): | 380 def __init__(self,xml,tree_node): |
381 node_handler.__init__(self,xml,tree_node) | 381 node_handler.__init__(self,xml,tree_node) |
382 self.list = self.xml.find('list') | 382 self.list = self.xml.find('list') |
383 self.options = self.list.findall('option') | 383 self.options = self.list.findall('option') |
384 if self.list.get("send_button") == "": | 384 if self.list.get("send_button") == "": self.list.set("send_button","0") |
385 self.list.set("send_button","0") | 385 if self.list.get("hide_title") == "": self.list.set("hide_title","0") |
386 if self.list.get("hide_title") == "": | 386 if self.list.get("raw_mode") == "": self.list.set("raw_mode","0") |
387 self.list.set("hide_title","0") | |
388 | 387 |
389 def get_design_panel(self,parent): | 388 def get_design_panel(self,parent): |
390 return listbox_edit_panel(parent,self) | 389 return listbox_edit_panel(parent,self) |
391 | 390 |
392 def get_use_panel(self,parent): | 391 def get_use_panel(self,parent): |
398 def set_type(self,type): | 397 def set_type(self,type): |
399 self.list.set("type",str(type)) | 398 self.list.set("type",str(type)) |
400 | 399 |
401 def is_hide_title(self): | 400 def is_hide_title(self): |
402 return int(self.list.get("hide_title", 0)) | 401 return int(self.list.get("hide_title", 0)) |
402 | |
403 def is_raw_send(self): | |
404 return int(self.list.get("raw_mode",0)) | |
403 | 405 |
404 # single selection methods | 406 # single selection methods |
405 def get_selected_node(self): | 407 def get_selected_node(self): |
406 for opt in self.options: | 408 for opt in self.options: |
407 if opt.get("selected") == "1": return opt | 409 if opt.get("selected") == "1": return opt |
408 return None | 410 return None |
409 | 411 |
410 def get_selected_index(self): | 412 def get_selected_index(self): |
411 i = 0 | 413 i = 0 |
412 for opt in self.options: | 414 for opt in self.options: |
413 if opt.get("selected") == "1": | 415 if opt.get("selected") == "1": return i |
414 return i | |
415 i += 1 | 416 i += 1 |
416 return 0 | 417 return 0 |
417 | 418 |
418 def get_selected_text(self): | 419 def get_selected_text(self): |
419 node = self.get_selected_node() | 420 node = self.get_selected_node() |
420 if node: | 421 if node: return node.text |
421 return node.text | 422 else: return "" |
422 else: | |
423 return "" | |
424 | |
425 | 423 |
426 # mult selection methods | 424 # mult selection methods |
427 def get_selections(self): | 425 def get_selections(self): |
428 opts = [] | 426 opts = [] |
429 for opt in self.options: | 427 for opt in self.options: |
430 if opt.get("selected") == "1": | 428 if opt.get("selected") == "1": opts.append(opt) |
431 opts.append(opt) | |
432 return opts | 429 return opts |
433 | 430 |
434 def get_selections_text(self): | 431 def get_selections_text(self): |
435 opts = [] | 432 opts = [] |
436 for opt in self.options: | 433 for opt in self.options: |
437 if opt.get("selected") == "1": | 434 if opt.get("selected") == "1": opts.append(opt.text) |
438 opts.append(opt.text) | |
439 return opts | 435 return opts |
440 | 436 |
441 def get_selections_index(self): | 437 def get_selections_index(self): |
442 opts = [] | 438 opts = [] |
443 i = 0 | 439 i = 0 |
444 for opt in self.options: | 440 for opt in self.options: |
445 if opt.get("selected") == "1": | 441 if opt.get("selected") == "1": opts.append(i) |
446 opts.append(i) | |
447 i += 1 | 442 i += 1 |
448 return opts | 443 return opts |
449 | 444 |
450 # setting selection method | 445 # setting selection method |
451 def set_selected_node(self,index,selected=1): | 446 def set_selected_node(self,index,selected=1): |
452 if self.get_type() != L_CHECK: | 447 if self.get_type() != L_CHECK: self.clear_selections() |
453 self.clear_selections() | |
454 self.options[index].set("selected", str(bool2int(selected))) | 448 self.options[index].set("selected", str(bool2int(selected))) |
455 | 449 |
456 def clear_selections(self): | 450 def clear_selections(self): |
457 for opt in self.options: | 451 for opt in self.options: opt.set("selected","0") |
458 opt.set("selected","0") | |
459 | 452 |
460 # misc methods | 453 # misc methods |
461 def get_options(self): | 454 def get_options(self): |
462 opts = [] | 455 opts = [] |
463 for opt in self.options: opts.append(opt.text) | 456 for opt in self.options: opts.append(opt.text) |
497 text += comma.join(opts) | 490 text += comma.join(opts) |
498 return text | 491 return text |
499 | 492 |
500 def get_value(self): | 493 def get_value(self): |
501 return "\n".join(self.get_selections_text()) | 494 return "\n".join(self.get_selections_text()) |
495 | |
496 def on_send_to_chat(self, evt): | |
497 txt = self.get_selected_text() | |
498 txt = self.chat.ParseMap(txt, self.xml) | |
499 if not self.is_raw_send(): | |
500 self.chat.ParsePost(self.tohtml(), True, True) | |
501 return 1 | |
502 actionlist = self.get_selections_text() | |
503 for line in actionlist: | |
504 line = self.chat.ParseMap(line, self.xml) | |
505 if(line != ""): | |
506 if line[0] != "/": ## it's not a slash command | |
507 self.chat.ParsePost(line, True, True) | |
508 else: | |
509 action = line | |
510 self.chat.chat_cmds.docmd(action) | |
511 return 1 | |
502 | 512 |
503 | 513 |
504 F_LIST = wx.NewId() | 514 F_LIST = wx.NewId() |
505 F_SEND = wx.NewId() | 515 F_SEND = wx.NewId() |
506 | 516 |
518 if type == L_DROP: | 528 if type == L_DROP: |
519 self.list = wx.ComboBox(self, F_LIST, cur_opt, choices=opts, style=wx.CB_READONLY) | 529 self.list = wx.ComboBox(self, F_LIST, cur_opt, choices=opts, style=wx.CB_READONLY) |
520 if self.list.GetSize()[0] > 200: | 530 if self.list.GetSize()[0] > 200: |
521 self.list.Destroy() | 531 self.list.Destroy() |
522 self.list = wx.ComboBox(self, F_LIST, cur_opt, size=(200, -1), choices=opts, style=wx.CB_READONLY) | 532 self.list = wx.ComboBox(self, F_LIST, cur_opt, size=(200, -1), choices=opts, style=wx.CB_READONLY) |
523 elif type == L_LIST: | 533 elif type == L_LIST: self.list = wx.ListBox(self,F_LIST,choices=opts) |
524 self.list = wx.ListBox(self,F_LIST,choices=opts) | 534 elif type == L_RADIO: self.list = wx.RadioBox(self,F_LIST,label,choices=opts,majorDimension=3) |
525 elif type == L_RADIO: | |
526 self.list = wx.RadioBox(self,F_LIST,label,choices=opts,majorDimension=3) | |
527 elif type == L_CHECK: | 535 elif type == L_CHECK: |
528 self.list = wx.CheckListBox(self,F_LIST,choices=opts) | 536 self.list = wx.CheckListBox(self,F_LIST,choices=opts) |
529 self.set_checks() | 537 self.set_checks() |
530 | 538 |
531 for i in handler.get_selections_text(): | 539 for i in handler.get_selections_text(): |
532 if type == L_DROP: | 540 if type == L_DROP: self.list.SetValue( i ) |
533 self.list.SetValue( i ) | 541 else: self.list.SetStringSelection( i ) |
534 else: | 542 if type == L_DROP: sizer = wx.BoxSizer(wx.HORIZONTAL) |
535 self.list.SetStringSelection( i ) | 543 else: sizer = wx.BoxSizer(wx.VERTICAL) |
536 | |
537 if type == L_DROP: | |
538 sizer = wx.BoxSizer(wx.HORIZONTAL) | |
539 | |
540 else: | |
541 sizer = wx.BoxSizer(wx.VERTICAL) | |
542 | 544 |
543 if type != L_RADIO: | 545 if type != L_RADIO: |
544 sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND) | 546 sizer.Add(wx.StaticText(self, -1, label+": "), 0, wx.EXPAND) |
545 sizer.Add(wx.Size(5,0)) | 547 sizer.Add(wx.Size(5,0)) |
546 | 548 |
555 self.SetAutoLayout(True) | 557 self.SetAutoLayout(True) |
556 self.Fit() | 558 self.Fit() |
557 | 559 |
558 parent.SetSize(self.GetBestSize()) | 560 parent.SetSize(self.GetBestSize()) |
559 | 561 |
560 if type == L_DROP: | 562 if type == L_DROP: self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST) |
561 self.Bind(wx.EVT_COMBOBOX, self.on_change, id=F_LIST) | 563 elif type == L_LIST: self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST) |
562 elif type == L_LIST: | 564 elif type == L_RADIO: self.Bind(wx.EVT_RADIOBOX, self.on_change, id=F_LIST) |
563 self.Bind(wx.EVT_LISTBOX, self.on_change, id=F_LIST) | 565 elif type == L_CHECK:self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, id=F_LIST) |
564 elif type == L_RADIO: | |
565 self.Bind(wx.EVT_RADIOBOX, self.on_change, id=F_LIST) | |
566 elif type == L_CHECK: | |
567 self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, id=F_LIST) | |
568 | |
569 | |
570 self.type = type | 566 self.type = type |
571 | |
572 | 567 |
573 def on_change(self,evt): | 568 def on_change(self,evt): |
574 self.handler.set_selected_node(self.list.GetSelection()) | 569 self.handler.set_selected_node(self.list.GetSelection()) |
575 | 570 |
576 def on_check(self,evt): | 571 def on_check(self,evt): |
577 for i in xrange(self.list.GetCount()): | 572 for i in xrange(self.list.GetCount()): self.handler.set_selected_node(i, bool2int(self.list.IsChecked(i))) |
578 self.handler.set_selected_node(i, bool2int(self.list.IsChecked(i))) | |
579 | 573 |
580 def set_checks(self): | 574 def set_checks(self): |
581 for i in self.handler.get_selections_index(): | 575 for i in self.handler.get_selections_index(): self.list.Check(i) |
582 self.list.Check(i) | |
583 | |
584 | 576 |
585 | 577 |
586 BUT_ADD = wx.NewId() | 578 BUT_ADD = wx.NewId() |
587 BUT_REM = wx.NewId() | 579 BUT_REM = wx.NewId() |
588 BUT_EDIT = wx.NewId() | 580 BUT_EDIT = wx.NewId() |
603 self.type_radios = wx.RadioBox(self,F_TYPE,"List Type",choices=opts) | 595 self.type_radios = wx.RadioBox(self,F_TYPE,"List Type",choices=opts) |
604 self.type_radios.SetSelection(handler.get_type()) | 596 self.type_radios.SetSelection(handler.get_type()) |
605 | 597 |
606 self.send_button = wx.CheckBox(self, F_SEND_BUTTON, " Send Button") | 598 self.send_button = wx.CheckBox(self, F_SEND_BUTTON, " Send Button") |
607 self.send_button.SetValue(handler.has_send_button()) | 599 self.send_button.SetValue(handler.has_send_button()) |
600 | |
601 self.raw_send = wx.CheckBox(self, F_RAW_SEND, " Send as Macro") | |
602 self.raw_send.SetValue(handler.is_raw_send()) | |
608 | 603 |
609 self.hide_title = wx.CheckBox(self, F_NO_TITLE, " Hide Title") | 604 self.hide_title = wx.CheckBox(self, F_NO_TITLE, " Hide Title") |
610 self.hide_title.SetValue(handler.is_hide_title()) | 605 self.hide_title.SetValue(handler.is_hide_title()) |
611 | 606 |
612 but_sizer = wx.BoxSizer(wx.HORIZONTAL) | 607 but_sizer = wx.BoxSizer(wx.HORIZONTAL) |
621 sizer.Add(wx.Size(10,10)) | 616 sizer.Add(wx.Size(10,10)) |
622 sizer.Add(self.type_radios, 0, wx.EXPAND) | 617 sizer.Add(self.type_radios, 0, wx.EXPAND) |
623 sizer.Add(wx.Size(10,10)) | 618 sizer.Add(wx.Size(10,10)) |
624 sizer.Add(self.send_button, 0 , wx.EXPAND) | 619 sizer.Add(self.send_button, 0 , wx.EXPAND) |
625 sizer.Add(self.hide_title, 0, wx.EXPAND) | 620 sizer.Add(self.hide_title, 0, wx.EXPAND) |
621 sizer.Add(self.raw_send, 0, wx.EXPAND) | |
626 sizer.Add(wx.Size(10,10)) | 622 sizer.Add(wx.Size(10,10)) |
627 sizer.Add(wx.StaticText(self, -1, "Options:"), 0, wx.EXPAND) | 623 sizer.Add(wx.StaticText(self, -1, "Options:"), 0, wx.EXPAND) |
628 sizer.Add(self.listbox,1,wx.EXPAND); | 624 sizer.Add(self.listbox,1,wx.EXPAND); |
629 sizer.Add(but_sizer,0,wx.EXPAND) | 625 sizer.Add(but_sizer,0,wx.EXPAND) |
630 | 626 |
638 self.Bind(wx.EVT_BUTTON, self.on_remove, id=BUT_REM) | 634 self.Bind(wx.EVT_BUTTON, self.on_remove, id=BUT_REM) |
639 self.Bind(wx.EVT_BUTTON, self.on_add, id=BUT_ADD) | 635 self.Bind(wx.EVT_BUTTON, self.on_add, id=BUT_ADD) |
640 self.Bind(wx.EVT_RADIOBOX, self.on_type, id=F_TYPE) | 636 self.Bind(wx.EVT_RADIOBOX, self.on_type, id=F_TYPE) |
641 self.Bind(wx.EVT_CHECKBOX, self.on_hide_button, id=F_NO_TITLE) | 637 self.Bind(wx.EVT_CHECKBOX, self.on_hide_button, id=F_NO_TITLE) |
642 self.Bind(wx.EVT_CHECKBOX, self.on_send_button, id=F_SEND_BUTTON) | 638 self.Bind(wx.EVT_CHECKBOX, self.on_send_button, id=F_SEND_BUTTON) |
639 self.Bind(wx.EVT_CHECKBOX, self.on_raw_button, id=F_RAW_SEND) | |
643 | 640 |
644 def on_type(self,evt): | 641 def on_type(self,evt): |
645 self.handler.set_type(evt.GetInt()) | 642 self.handler.set_type(evt.GetInt()) |
646 | 643 |
647 def on_add(self,evt): | 644 def on_add(self,evt): |
683 def on_send_button(self,evt): | 680 def on_send_button(self,evt): |
684 self.handler.list.set("send_button", str( bool2int(evt.Checked()) )) | 681 self.handler.list.set("send_button", str( bool2int(evt.Checked()) )) |
685 | 682 |
686 def on_hide_button(self,evt): | 683 def on_hide_button(self,evt): |
687 self.handler.list.set("hide_title", str( bool2int(evt.Checked()) )) | 684 self.handler.list.set("hide_title", str( bool2int(evt.Checked()) )) |
685 | |
686 def on_raw_button(self,evt): | |
687 self.handler.list.set("raw_mode",str(bool2int(evt.Checked()))) | |
688 | 688 |
689 | 689 |
690 ############################### | 690 ############################### |
691 ## link image handlers | 691 ## link image handlers |
692 ############################### | 692 ############################### |