Exemple #1
0
 def clickRestoreFocus(self, point, template):
     #NOTE: we always double click. not realy necessary here
     si = Tc2Win32.SendInput()
     si.leftClickDouble(point, hwnd=self.hwnd)
     si.send(restoreCursor=False)
     # replayer gains focus, so we have to wait a bit and send another click to reactivate the table.
     si = Tc2Win32.SendInput()
     si.leftClickDouble(template.points['EmptySpace'], hwnd=self.hwnd)
     si.send(restoreCursor=Tc2Config.globalObject.settingsGlobal.
             restoreMousePosition())
Exemple #2
0
 def clickButton(self, point, template, hotkey, modifiers=None):
     #NOTE:
     # 1) checkboxes behave like tri state boxes when we send input. not when clicking them (weird)
     # 2) PostMessage(WM_LBUTTONDOWN,...) works for buttons but is not working for checkboxes
     # 3) SendInput() throws messages anonymously into the eent queue so we can not
     #    be shure the current foreground window is receiving the messages (race condition)
     # 4) there is no way we can check if our input triggered the desired effect
     # 5) we dont know when PS schows us buttons or checkboxes. bet box being
     #    visible gives us an indicator at times, but is useless for example if s.o. is all-in
     #TODO: have to rewrite InputEvent() to accept mouse and keyboard events
     modifiers = () if modifiers is None else modifiers
     si = Tc2Win32.SendInput()
     for vk in modifiers:
         si.keyDown(vk)
     si.leftClick(point, hwnd=self.hwnd)
     for vk in modifiers:
         si.keyUp(vk)
     si.send(restoreCursor=Tc2Config.globalObject.settingsGlobal.
             restoreMousePosition())
     # workaround to send double clicks. this handles checkboxes as expected but may trigger
     # accidental clicks on unrelated tables. we add an abitrary timeout to check if PS has thrown another
     # table to the foreground. no way to get this fail save, we have a race condition
     ##time.sleep( min(0.05, Tc2Win32.mouseDoubleClickTime()) )
     ##hwnd2 = Tc2Win32.windowForeground()
     ##if hwnd == hwnd2:
     ##	si.leftClick(point, hwnd=hwnd).send(restoreCursor=self.settingsGlobal.Tc2Config.globalObject.settingsGlobal.())
     Tc2Config.globalObject.feedbackMessage.emit(
         '%s: %s' % (template.name(), hotkey.action()))
     return
Exemple #3
0
 def handleHilightBet(self, hotkey, template, inputEvent):
     data = self.readData()
     if not data: return
     hwndBetBox = data['hwndBetBox']
     if not hwndBetBox: return
     if not data['betBoxIsVisible']: return
     point = QtCore.QPoint(2, 2)
     si = Tc2Win32.SendInput()
     si.leftClickDouble(point, hwnd=hwndBetBox)
     si.send(restoreCursor=Tc2Config.globalObject.settingsGlobal.
             restoreMousePosition())
     Tc2Config.globalObject.feedbackMessage.emit(
         '%s: %s' % (template.name(), hotkey.action()))
Exemple #4
0
 def handleAll_In(self, hotkey, template, inputEvent):
     data = self.readData()
     if not data: return
     if not data['hwndBetBox']: return
     if not data['betBoxIsVisible']: return
     point = self.point('BetSliderEnd', template)
     if point is None:
         return
     si = Tc2Win32.SendInput()
     si.leftClick(
         point, hwnd=self.hwnd).send(restoreCursor=Tc2Config.globalObject.
                                     settingsGlobal.restoreMousePosition())
     Tc2Config.globalObject.feedbackMessage.emit(
         '%s: %s' % (template.name(), hotkey.action()))