def initialize(self): if self.dictObj != None: D("dictObj already initialized") return self.__class__.dictObj = natlink.DictObj() self.__class__.app = None self.__class__.ctrl = None # to be filled in getEditControl self.dictObj.setBeginCallback(self.onTextBegin) self.dictObj.setChangeCallback(self.onTextChange) # copy the W variables, taken from "windowparameters.py" W = windowparameters.PROGS[tester] if W: print('get windowsparamters from tester: %s' % tester) for k, v in list(W.items()): #print 'W: %s: %s'% (k, v) setattr(self, k, v) else: raise ValueError( "Cannot get windowsparameters dict for tester: %s" % tester) self.getEditControl() self.inOnTextChange = 0 # updated in updateState: self.lastSel = (0, 0) self.lastSelText = "" self.scratchinfo = [ ] # lists of undo info, [(selStart, selEnd), newText, (delStart, delEnd), oldText] self.scratchThatCommand = 0 self.nonFocusHndles = [] # for loosing focus self.hasFocus = -1 # is controlled from CmdsGrammar instance
def __init__(self, **args): """ **INPUTS** *none* """ self.deep_construct( VoiceDictBuffer, { 'underlying': natlink.DictObj(), 'was_activated': 0, 'activated': 0, 'dict_globally': 0, 'program_initiated': 0, 'window_handle': 0 }, args) self.underlying.setBeginCallback(self._on_begin) self.underlying.setChangeCallback(self._on_voice_change)
def initialize(self, hndle=None): if self.dictObj != None: D("dictObj already initialized") return self.__class__.dictObj = natlink.DictObj() Cwnd = win32ui.GetForegroundWindow() for i in range(15000, 16000): try: ctrl = Cwnd.GetDlgItem(i) # edit box except: pass else: D("got ctrl: %s: %s"% (i, ctrl)) self.__class__.ctrl = ctrl break else: D("could not find a ctrl") self.__class__.ctrl = None self.dictObj.setBeginCallback(self.onTextBegin) self.dictObj.setChangeCallback(self.onTextChange) self.dictObj.activate(hndle)
def initialize(self): if self.dictObj != None: D("dictObj already initialized") return self.__class__.dictObj = natlink.DictObj() #self.__class__.app = None #self.__class__.ctrl = None # to be filled in getEditControl self.dictObj.setBeginCallback(self.onTextBegin) self.dictObj.setChangeCallback(self.onTextChange) self.WindowsParameters = windowparameters.PROGS self.appNames = list(self.WindowsParameters.keys()) print('_enabledictation tries applications: %s' % self.appNames) self.activeApp = None #self.getEditControl() # updated in updateState: self.lastSel = (0, 0) self.lastSelText = "" self.prevHndle = None self.ctrl = None # hndle of the foreground control inside an application self.app = None # hndle of the current foreground application (from moduleInfo) self.dctactive = None
def initialize(self, dlg): self.dlg = dlg self.dictObj = natlink.DictObj() self.dictObj.setBeginCallback(dlg.onTextBegin) self.dictObj.setChangeCallback(dlg.onTextChange) self.dictObj.activate(dlg.GetSafeHwnd())