TanGentleman / KeyMaster

A comprehensive toolkit for python classes and easy to use scripts for logging, analyzing, and simulating keystrokes.
MIT License
1 stars 0 forks source link

Client facing Config object can be made simpler #48

Closed TanGentleman closed 9 months ago

TanGentleman commented 10 months ago

I think the set method should have good error handling and typechecking, be the exposed client function. This would eliminate the need for client-exposed attributes, which can be unpredictable with arbitrary types (Python!)

TanGentleman commented 10 months ago

I've experimented with both techniques, and honestly, really starting to prefer using a format like:

config = Config()
config.logfile = 'descriptive_name'
config.allow_newlines = False

listener = Collect(config)
simulator = Generate(config)

keys = listener.start_listener()
simulator.simulate_keystrokes(keys)

Compared to:

config = Config(logfile='name', allow_newlines=False)
...
or
```python
config = Config()
config.set(logfile='name', allow_newlines=False)

However, granular control without the need for a config object makes sense for many workflows.

logger = Collect()
logger.set_filename('name')
gen = Generate()
keys = gen.keystrokes_from_string("I can often perform most tasks without the need to declare a custom config object, but for something like allowing newlines, it might be the best practice for consistency.
TanGentleman commented 9 months ago

Though the attributes can be better organized and possibly renamed, the implementation is clean and functional now. Closing issue.