pez2001 / razer_chroma_drivers

A collection of Linux drivers for Razer Chroma devices, it supports all lighting modes and includes a daemon for advanced effects + gui configuration app
GNU General Public License v2.0
231 stars 30 forks source link

Quick fix to previous GUI changes. #94

Closed lah7 closed 8 years ago

lah7 commented 8 years ago

My bad. This fix is for my last set of changes (#90) by correcting the start-up code for the tray - which automatically turned macro settings on, due to my misunderstanding of bool() (which was always returning true).

I wondered why the hot keys and sleep key stopped working, that happens when macro keys are activated.

terricain commented 8 years ago

Ok cool, I take it you tested this thoroughly

... just saying ;)

lah7 commented 8 years ago

... just saying ;)

I did my best, mistakes happen, time is limited. I find that remark slightly disrespectful. :unamused:

Since commit 917d74e6274801ce77a7c985bc8bcea2ef26c7b0, data had switched from being stored as a boolean to a string, due to how JSON is being read/saved and passed around. We'll need to be careful of that.

917d74e6274801ce77a7c985bc8bcea2ef26c7b0 Preferences with booleans now back to using strings for best compatibility with JavaScript.

terricain commented 8 years ago

No disrespect was intended.

terricain commented 8 years ago

Since commit 917d74e, data had switched from being stored as a boolean to a string, due to how JSON is being read/saved and passed around

Why can't we use normal booleans? Json.loads() will convert 'true' -> True automatically, etc...

lah7 commented 8 years ago

Originally, that was the plan, and setting index[test] = True would save as a boolean true to JSON (not 'true'). Due to how these on/off states get passed around, in some places they end up as a string (possibly JS → Python and/or via Python → JS execute_script), so it was easier to cut corners and simply use strings throughout. JavaScript's true and Python's True introduce some problems.

The preferences module (and commands?) would need additional code / checks for converting booleans if desired later, but I see little gain at this point. It works fine as strings, even if that's not the correct way to do it.

terricain commented 8 years ago

Ahh, yes if JS ↔ Python is going on then that would make sense. Ideally it would be nice to convert back to True but as you said it is little gain at the moment, just would of been nice is all ;).

We can always go through and refactor things later.