Skip to content

Commit

Permalink
Removing unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteMagic committed Feb 2, 2018
1 parent ac9d3e1 commit 5999e3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 98 deletions.
57 changes: 5 additions & 52 deletions gremlin/execution_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from abc import abstractmethod, ABCMeta
from collections import namedtuple
import copy
import logging

# from action_plugins.remap import Remap
from gremlin import actions, base_classes, common, error


Expand All @@ -42,34 +42,6 @@ def __init__(self, container):
"""
self.execution_graph = ContainerExecutionGraph(container)

# # Reorder containers such that if those containing remap actions are
# # executed last
# pre_containers = []
# post_containers = []
# for i, container in enumerate(input_item.containers):
# # Don't include virtual button based containers they are handled
# # separately
# if container.virtual_button:
# continue
# contains_remap = False
# for action_set in container.action_sets:
# for action in action_set:
# if isinstance(action, action_plugins.remap.Remap):
# contains_remap |= True
# if contains_remap:
# post_containers.append(i)
# else:
# pre_containers.append(i)
#
# ordered_containers = []
# for i in pre_containers:
# ordered_containers.append(input_item.containers[i])
# for i in post_containers:
# ordered_containers.append(input_item.containers[i])
#
# for container in ordered_containers:
# self.execution_graphs.append(ContainerExecutionGraph(container))

def __call__(self, event):
"""Executes the callback based on the event's content.
Expand All @@ -95,10 +67,10 @@ def __call__(self, event):
shared_value = copy.deepcopy(value)

if event == common.InputType.VirtualButton:
self.execution_graph.process_event(event, copy.deepcopy(value))
print("VIRTUAL BUTTON CODE PATH")
0 / 0
# TODO: remove this
# TODO: remove this at a future stage
logging.getLogger("system").error(
"Virtual button code path being used"
)
else:
self.execution_graph.process_event(event, shared_value)

Expand Down Expand Up @@ -329,25 +301,6 @@ def _build_graph(self, container):

self._create_transitions(sequence)

# def _create_virtual_button(self, container):
# """Creates a VirtualButton object for the provided container.
#
# :param container data to use in order to generate the VirtualButton
# """
# input_type = container.get_input_type()
# if input_type == common.InputType.JoystickAxis:
# return actions.AxisButton(
# container.virtual_button.lower_limit,
# container.virtual_button.upper_limit,
# container.virtual_button.direction
# )
# elif input_type == common.InputType.JoystickHat:
# return actions.HatButton(
# container.virtual_button.directions
# )
# else:
# raise error.GremlinError("Invalid virtual button provided")


class ActionSetExecutionGraph(AbstractExecutionGraph):

Expand Down
36 changes: 0 additions & 36 deletions gremlin/sendinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,39 +164,3 @@ def _send_input(*inputs):
cbSize = ctypes.c_int(ctypes.sizeof(_INPUT))

return ctypes.windll.user32.SendInput(nInputs, pInputs, cbSize)


# # for _ in range(10):
# # mouse_wheel(1)
# # time.sleep(0.2)
#
# # mouse_press(MouseButton.Back)
# # mouse_release(MouseButton.Back)
# # time.sleep(0.5)
# # mouse_press(MouseButton.Forward)
# # mouse_release(MouseButton.Forward)
#
# pps = 15
# step = 1.0
# delay = 1.0 / (pps / step)
#
# while delay < 0.01:
# step += 1.0
# delay = 1.0 / (pps / step)
#
# step = int(step)
# print(delay, step)
#
# # while rate < 0.01:
# # rate = 1.0 / pps
# # pps
# # print(rate)
# #amount = 1000 / 20
#
# # mouse_press(MouseButton.Left)
# t_start = time.time()
# while time.time() - t_start < 1:
# mouse_relative_motion(step, 0)
# time.sleep(delay)
# # mouse_release(MouseButton.Left)
#
10 changes: 0 additions & 10 deletions gremlin/windows_event_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,10 @@ def _process_event(self, n_code, w_param, l_param):
else:
print(w_param)

# print(button_id)
evt = MouseEvent(button_id, is_pressed, False)
for cb in self._callbacks:
cb(evt)

# Extract data from the message
# print(n_code, w_param)
# if l_param[2] is not None:
# # print(l_param[0], l_param[1], bin(l_param[2]))
# print(w_param, l_param[2] & (0x0001 << 16))
# #
# # 1 0000 0000 0000 0000
# # 10 0000 0000 0000 0000

# Pass the event on to the next callback in the chain
return ctypes.windll.user32.CallNextHookEx(
self.hook_id,
Expand Down

0 comments on commit 5999e3c

Please sign in to comment.