Skip to content

Commit

Permalink
Merge pull request #42 from LoLei/feature/sync-etc
Browse files Browse the repository at this point in the history
Add code submitted by @GM-Script-Writer-62850
  • Loading branch information
LoLei committed Jan 21, 2021
2 parents be7bf3a + cf8d59f commit 783f3f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
30 changes: 13 additions & 17 deletions razer_cli/razer_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = "Lorenz Leitner"
__version__ = "1.4.0"
__version__ = "1.5.0"
__license__ = "GPL-3.0"

# Libraries
Expand Down Expand Up @@ -80,12 +80,7 @@ def set_color(color):
sys.stdout.write(str(g) + " ")
sys.stdout.write(str(b) + "\n")

rgb = []
rgb.append(r)
rgb.append(g)
rgb.append(b)

return rgb
return [r, g, b]


def get_effects_of_device(device):
Expand Down Expand Up @@ -120,7 +115,7 @@ def list_devices(device_manager):

if (args.list_devices_long):
print(" capabilities: {}".format(device.capabilities))
if (args.list_devices_long_human):
elif (args.list_devices_long_human):
print(" capabilities:")
for i in device.capabilities:
print(" ", i, "=", device.capabilities[i])
Expand Down Expand Up @@ -376,16 +371,18 @@ def read_args():
dest='brightness',
action="store")

parser.add_argument("--sync",
help="sync lighting effects to all supported "
"Razer products",
action="store_true")

global args
args = parser.parse_args()

if len(sys.argv) <= 1:
parser.print_help()
sys.exit(1)

if args.verbose:
print("Starting Razer colors script...")


def main():
""" Main entry point of the app """
Expand All @@ -397,15 +394,10 @@ def main():
# Create a DeviceManager. This is used to get specific devices
device_manager = DeviceManager()

if (args.list_devices or args.list_devices_long or
args.list_devices_long_human):
list_devices(device_manager)

# Disable daemon effect syncing.
# Without this, the daemon will try to set the lighting effect to every
# device.
# TODO: Could be enabled as flag
device_manager.sync_effects = False
device_manager.sync_effects = args.sync

# Do below only if dry run is not specified
if args.automatic or args.effect or args.color:
Expand All @@ -428,6 +420,10 @@ def main():
if args.brightness:
set_brightness(device_manager)

if (args.list_devices or args.list_devices_long or
args.list_devices_long_human):
list_devices(device_manager)


if __name__ == "__main__":
""" This is executed when run from the command line - obsolete """
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="razer-cli",
version="1.4.0",
version="1.5.0",
author="Lorenz Leitner",
author_email="lrnz.ltnr@gmail.com",
description="Control Razer devices from the command line",
Expand Down

0 comments on commit 783f3f7

Please sign in to comment.