Skip to content

Commit

Permalink
Merge pull request #3 from sandstorm12/dev
Browse files Browse the repository at this point in the history
Config life support is limited
  • Loading branch information
sandstorm12 authored Sep 27, 2021
2 parents ffd7798 + d13c8a7 commit fa2a106
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ controllerpy

## Urgent issues and futures
1. Add a list of used libraries to the main readme.
2. Make config file custom and createable from cli.


## Issues and futures
Expand Down
12 changes: 6 additions & 6 deletions controllerpy
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ControllerPy(object):
DEFAULT_MAX_SCROLL_SPEED = 2
DEFAULT_DEAD_PERCENTAGE = .0001

CONFIG_PATH = "config.yaml"
CONFIG_NAME = "config.yaml"

def __init__(self):
self.event_counter = 0
Expand All @@ -32,19 +32,19 @@ class ControllerPy(object):
self._load_parameters()

def _load_parameters(self):
if os.path.exists(self.CONFIG_PATH):
if os.path.exists(self.CONFIG_NAME):
print("Loading parameters from config.yaml...")
with open(self.CONFIG_PATH, 'r') as yaml_file:
with open(self.CONFIG_NAME, 'r') as yaml_file:
config = yaml.safe_load(yaml_file)

self.mouse_sensitivity = config["mouse_sensitivity"]
self.scroll_sensitivity = config["scroll_sensitivity"]
self.dead_zone = config["dead_zone"]
else:
print("Using default parameters...")
self.mouse_sensitivity = DEFAULT_MAX_MOUSE_SPEED
self.scroll_sensitivity = DEFAULT_MAX_SCROLL_SPEED
self.dead_zone = DEFAULT_DEAD_PERCENTAGE
self.mouse_sensitivity = self.DEFAULT_MAX_MOUSE_SPEED
self.scroll_sensitivity = self.DEFAULT_MAX_SCROLL_SPEED
self.dead_zone = self.DEFAULT_DEAD_PERCENTAGE

def _initialize_joystick(self):
joysticks = []
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read_requirements(path='./requirements.txt'):

setup(
name="ControllerPy",
version="0.2.2",
version="0.2.3",
author="Hamid Mohammadi",
author_email="sandstormeatwo@gmail.com",
description="Control mouse and keyboard input using a controller",
Expand Down

0 comments on commit fa2a106

Please sign in to comment.