def doAlternativeClick(self, className, num): """instead of click perform another (keystrokes) action """ if className == "TaskListThumbnailWnd": taskbarPosition = monitorfunctions.get_taskbar_position() # notices changes on the fly! # which way to scroll through a stack of taskbar buttons: initialKeys = dict(left='{down}', top='{right}', right='{left}{down}', bottom='{right}') scrollKeys = dict(left='down', top='right', right='down', bottom='right') try: initial = initialKeys[taskbarPosition] scrollKey = scrollKeys[taskbarPosition] except KeyError: print 'key not found "taskbarPosition": %s'% taskbarPosition return # go to first of popup windows (depending on taskbar location) action(initial) if num and num != '0': action('{%s %s}'% (scrollKey, num)) action('{enter}') else: print 'should not call doAlternativeClick for className: %s'% className
def doAlternativeClick(self, className, num): """instead of click perform another (keystrokes) action if self.doTasksWithWindowsKey, do this with repeated winkey clicks """ taskNum = self.lastTaskCount if isinstance(num, basestring): num = int(num) if className == "TaskListThumbnailWnd": #print 'tasks, doAlternative click: %s'% num if self.doTasksWithWindowsKey: if not (taskNum and self.winkeyDown): print 'cannot complete windows command: taskNum: %s, winkeyDown: %s' % ( taskNum, self.winkeyDown) self.cancelMode() return if num > 1: keystr = str(taskNum) for i in range(num - 1): actions.do_SSK(keystr) elif num < 0: num2 = -num keystr = '{shift+%s}' % taskNum for i in range(num2): actions.do_SSK(keystr) self.cancelMode() return # mode with mouse on taskbar position: taskbarPosition = monitorfunctions.get_taskbar_position( ) # notices changes on the fly! # which way to scroll through a stack of taskbar buttons: initialKeys = dict(left='{down}', top='{right}', right='{left}{down}', bottom='{right}') scrollKeys = dict(left='down', top='right', right='down', bottom='right') initialKeysReverse = dict(right='{left}', bottom='{left}', left='{right}', top='{left}') scrollKeysReverse = dict(right='up', bottom='left', left='up', top='left') try: if num > 0: initial = initialKeys[taskbarPosition] scrollKey = scrollKeys[taskbarPosition] elif num < 0: initial = initialKeysReverse[taskbarPosition] scrollKey = scrollKeysReverse[taskbarPosition] num = -num else: raise ValueError( "_tasks, doAlternativeClick, number may NOT be 0") except KeyError: print 'key not found "taskbarPosition": %s' % taskbarPosition return # go to first of popup windows (depending on taskbar location) #print 'taskbarPosition: %s'% taskbarPosition #print 'initial: %s, scroll: %s'% (initial[1:], scrollKey) action(initial) if num > 1: num -= 1 action('{%s %s}' % (scrollKey, num)) action('{enter}') else: print 'should not call doAlternativeClick for className: %s' % className
def doAlternativeClick(self, className, num): """instead of click perform another (keystrokes) action if self.doTasksWithWindowsKey, do this with repeated winkey clicks """ taskNum = self.lastTaskCount if isinstance(num, basestring): num = int(num) if className == "TaskListThumbnailWnd": #print 'tasks, doAlternative click: %s'% num if self.doTasksWithWindowsKey: if not (taskNum and self.winkeyDown): print 'cannot complete windows command: taskNum: %s, winkeyDown: %s'% (taskNum, self.winkeyDown) self.cancelMode() return if num > 1: keystr = str(taskNum) for i in range(num-1): actions.do_SSK(keystr) elif num < 0: num2 = -num keystr = '{shift+%s}'% taskNum for i in range(num2): actions.do_SSK(keystr) self.cancelMode() return # mode with mouse on taskbar position: taskbarPosition = monitorfunctions.get_taskbar_position() # notices changes on the fly! # which way to scroll through a stack of taskbar buttons: initialKeys = dict(left='{down}', top='{right}', right='{left}{down}', bottom='{right}') scrollKeys = dict(left='down', top='right', right='down', bottom='right') initialKeysReverse = dict(right='{left}', bottom='{left}', left='{right}', top='{left}') scrollKeysReverse = dict(right='up', bottom='left', left='up', top='left') try: if num > 0: initial = initialKeys[taskbarPosition] scrollKey = scrollKeys[taskbarPosition] elif num < 0: initial = initialKeysReverse[taskbarPosition] scrollKey = scrollKeysReverse[taskbarPosition] num = -num else: raise ValueError("_tasks, doAlternativeClick, number may NOT be 0") except KeyError: print 'key not found "taskbarPosition": %s'% taskbarPosition return # go to first of popup windows (depending on taskbar location) #print 'taskbarPosition: %s'% taskbarPosition #print 'initial: %s, scroll: %s'% (initial[1:], scrollKey) action(initial) if num > 1: num -= 1 action('{%s %s}'% (scrollKey, num)) action('{enter}') else: print 'should not call doAlternativeClick for className: %s'% className