comparison orpg/tools/predTextCtrl.py @ 183:0d9b746b5751 beta

Traipse Beta 'OpenRPG' {100115-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 (Beta) New Features: Added Bookmarks 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 New TrueDebug Class in orpg_log (See documentation for usage) Portable Mercurial Tip of the Day added, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added Dieroller structure from Core New DieRoller portability for odd Dice Added 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Included for Mythos roller also New Warhammer FRPG Die Roller (Special thanks to Puu-san for the support) New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Beta!) Fixes: Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fix to Whiteboard ID to prevent random line or text deleting. Fixes to Server, Remote Server, and Server GUI Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and now reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode Fix made Image Fetching. New fetching image and new failed image Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml
author sirebral
date Fri, 15 Jan 2010 23:01:42 -0600
parents ff48c2741fe7
children dcae32e219f1
comparison
equal deleted inserted replaced
172:8834425a85b0 183:0d9b746b5751
309 # Returns: None 309 # Returns: None
310 # 310 #
311 # Purpose: Constructor for predTextCtrl. Calls wx.TextCtrl.__init__ to get default init 311 # Purpose: Constructor for predTextCtrl. Calls wx.TextCtrl.__init__ to get default init
312 # behavior and then inits a LetterTree and captures the parent for later use in 312 # behavior and then inits a LetterTree and captures the parent for later use in
313 # passing events up the chain. 313 # passing events up the chain.
314 def __init__(self, parent, id = -1, value = "" , size = wx.DefaultSize, style = 0, name = "text",keyHook = None, validator=None): 314 def __init__(self, parent, id = -1, value = "", size = (30,30), style = 0, name = "text", keyHook = None, validator=None):
315 315
316 # Call super() for default behavior 316 # Call super() for default behavior
317 if validator: 317 if validator:
318 ExpandoTextCtrl.__init__(self, parent, id=id, value=value, size=size, style=style, name=name, validator=validator ) 318 ExpandoTextCtrl.__init__(self, parent, id=id, value=value, size=size, style=style, name=name, validator=validator )
319 else: 319 else:
320 ExpandoTextCtrl.__init__(self, parent, id=id, value=value, size=size, style=style, name=name) 320 ExpandoTextCtrl.__init__(self, parent, id=id, value=value, size=size, style=style, name=name)
321
321 322
322 self.tree = LetterTree # Instantiate a new LetterTree. 323 self.tree = LetterTree # Instantiate a new LetterTree.
323 # TODO: make name of word file an argument. 324 # TODO: make name of word file an argument.
324 self.parent = parent # Save parent for later use in passing KeyEvents 325 self.parent = parent # Save parent for later use in passing KeyEvents
325 self.cur = self.tree.rootNode # self.cur is a short cut placeholder for typing consecutive chars 326 self.cur = self.tree.rootNode # self.cur is a short cut placeholder for typing consecutive chars
425 # moving the insertion point to the spot directly afterwards is 426 # moving the insertion point to the spot directly afterwards is
426 # equivalent to acceptance. Without this, the next typed key would 427 # equivalent to acceptance. Without this, the next typed key would
427 # clobber the prediction. 428 # clobber the prediction.
428 429
429 return # Don't pass tab on in this case 430 return # Don't pass tab on in this case
430 elif event.GetKeyCode() == wx.WXK_RETURN and event.ShiftDown(): 431
431 logger.exception('Shift + Enter Not completed, 439, predtextCtrl', True) 432 elif event.GetKeyCode() == wx.WXK_RETURN: # We want to hook returns, so that we can update the word list
432 st = self.GetValue()
433 st += '<br />'
434 return
435
436 elif event.GetKeyCode() == wx.WXK_RETURN: # We want to hook returns, so that we can update the word list
437 st = self.GetValue() # Grab the text from the control 433 st = self.GetValue() # Grab the text from the control
438 newSt = "" # Init a buffer 434 newSt = "" # Init a buffer
439 # This block of code, by popular demand, changes the behavior of the control to ignore any prediction that 435 # This block of code, by popular demand, changes the behavior of the control to ignore any prediction that
440 # hasn't been "accepted" when the enter key is struck. 436 # hasn't been "accepted" when the enter key is struck.
441 (startSel,endSel) = self.GetSelection() # get the curren selection 437 (startSel,endSel) = self.GetSelection() # get the curren selection
442 438
443 # 439 #
444 # Start update 440 # Start update
445 # Changed the following to allow for more friendly behavior in 441 # Changed the following to allow for more friendly behavior in
446 # a multilined predTextCtrl. 442 # a multilined predTextCtrl.
447 # 443 #
448 # front = st[:startSel] # Slice off the text to the front of where we are 444 # front = st[:startSel] # Slice off the text to the front of where we are
449 # back = st[endSel:] # Slice off the text to the end from where we are 445 # back = st[endSel:] # Slice off the text to the end from where we are
450 # st = front + back # This expression creates a string that get rid of any selected text. 446 # st = front + back # This expression creates a string that get rid
447 # of any selected text.
451 # self.SetValue(st) 448 # self.SetValue(st)
452 449
453 self.Remove( startSel, endSel ) 450 self.Remove( startSel, endSel )
454 st = string.strip( self.GetValue() ) 451 st = string.strip( self.GetValue() )
455 # 452 #
468 # split it and to a LetterTree.incWord on the lowercase version of it. 465 # split it and to a LetterTree.incWord on the lowercase version of it.
469 # Reminder: incWord will increment the priority of existing words and add 466 # Reminder: incWord will increment the priority of existing words and add
470 # new ones 467 # new ones
471 for aWord in string.split(newSt): 468 for aWord in string.split(newSt):
472 self.tree.incWord(string.lower(aWord)) 469 self.tree.incWord(string.lower(aWord))
473 470 self.parent.OnChar(event) # Now that all of the words are added, pass the event and return
474 self.parent.OnChar(event) # Now that all of the words are added, pass the event and return
475 return 471 return
476 472
477 # We want to capture the right arrow key to fix a slight UI bug that occurs when one right arrows 473 # We want to capture the right arrow key to fix a slight UI bug that occurs when one right arrows
478 # out of a selection. I set the InsertionPoint to the beginning of the selection. When the default 474 # out of a selection. I set the InsertionPoint to the beginning of the selection. When the default
479 # right arrow event occurs, the selection goes away, but the cursor is in an unexpected location. 475 # right arrow event occurs, the selection goes away, but the cursor is in an unexpected location.