comparison orpg/tools/predTextCtrl.py @ 167:5c9a118476b2 alpha

Traipse Alpha 'OpenRPG' {091210-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 (Keeping up with 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 Added 7th Sea die roller method; 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)]. Includes support for Mythos roller 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 Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and no reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice
author sirebral
date Thu, 10 Dec 2009 10:53:33 -0600
parents dc74dca250d1
children ff19dd30064b
comparison
equal deleted inserted replaced
166:eef2463cd441 167:5c9a118476b2
377 # from that point to insert. Otherwise, it returns the whole thing, due to begin being 377 # from that point to insert. Otherwise, it returns the whole thing, due to begin being
378 # initialized to 0 378 # initialized to 0
379 379
380 begin = 0 380 begin = 0
381 for offset in range(insert - 1): 381 for offset in range(insert - 1):
382 if st[-(offset + 2)] not in string.letters: 382 if st[-(offset + 2)] not in string.ascii_letters:
383 begin = insert - (offset + 1) 383 begin = insert - (offset + 1)
384 break 384 break
385 return st[begin:insert] 385 return st[begin:insert]
386 386
387 387
458 458
459 # this loop will walk through every character in st and add it to 459 # this loop will walk through every character in st and add it to
460 # newSt if it's a letter. If it's not a letter, (e.g. a comma or 460 # newSt if it's a letter. If it's not a letter, (e.g. a comma or
461 # hyphen) a space is added to newSt in it's place. 461 # hyphen) a space is added to newSt in it's place.
462 for ch in st: 462 for ch in st:
463 if ch not in string.letters: 463 if ch not in string.ascii_letters:
464 newSt += " " 464 newSt += " "
465 else: 465 else:
466 newSt += ch 466 newSt += ch
467 # Now that we've got a string of just letter sequences (words) and spaces 467 # Now that we've got a string of just letter sequences (words) and spaces
468 # split it and to a LetterTree.incWord on the lowercase version of it. 468 # split it and to a LetterTree.incWord on the lowercase version of it.
492 return 492 return
493 else: 493 else:
494 # Handle any other non-ascii events by calling parent's OnChar() 494 # Handle any other non-ascii events by calling parent's OnChar()
495 self.parent.OnChar(event) #Call super.OnChar to get default behavior 495 self.parent.OnChar(event) #Call super.OnChar to get default behavior
496 return 496 return
497 elif asciiKey in string.letters: 497 elif asciiKey in string.ascii_letters:
498 # This is the real meat and potatoes of predTextCtrl. This is where most of the 498 # This is the real meat and potatoes of predTextCtrl. This is where most of the
499 # wx.TextCtrl logic is changed. 499 # wx.TextCtrl logic is changed.
500 (startSel,endSel) = self.GetSelection() # get the curren selection 500 (startSel,endSel) = self.GetSelection() # get the curren selection
501 st = self.GetValue() # and the text in the control 501 st = self.GetValue() # and the text in the control
502 front = st[:startSel] # Slice off the text to the front of where we are 502 front = st[:startSel] # Slice off the text to the front of where we are
509 # were sliced. 509 # were sliced.
510 510
511 insert = startSel + 1 # creates an int that denotes where the new InsertionPoint 511 insert = startSel + 1 # creates an int that denotes where the new InsertionPoint
512 # should be. 512 # should be.
513 curWord = "" # Assume there's a problem with finding the curWord 513 curWord = "" # Assume there's a problem with finding the curWord
514 if (len(back) == 0) or (back[0] not in string.letters): # We should only insert a prediction if we are typing 514 if (len(back) == 0) or (back[0] not in string.ascii_letters): # We should only insert a prediction if we are typing
515 # at the end of a word, not in the middle. There are 515 # at the end of a word, not in the middle. There are
516 # three cases: we are typing at the end of the string or 516 # three cases: we are typing at the end of the string or
517 # we are typing in the middle of the string and the next 517 # we are typing in the middle of the string and the next
518 # char is NOT a letter or we are typing in the middle of the 518 # char is NOT a letter or we are typing in the middle of the
519 # string and the next char IS a letter. Only the former two 519 # string and the next char IS a letter. Only the former two