Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
_require('pyudev', 'python-pyudev')
# handle ^C in console
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
args = _parse_arguments()
if not args: return
if args.action:
# if any argument, run comandline and exit
return _cli.run(args.action, args.hidraw_path)
gi = _require('gi', 'python-gi')
gi.require_version('Gtk', '3.0')
_require('gi.repository.Gtk', 'gir1.2-gtk-3.0')
try:
import solaar.ui as ui
import solaar.listener as listener
listener.setup_scanner(ui.status_changed, ui.error_dialog)
import solaar.upower as _upower
if args.restart_on_wake_up:
_upower.watch(listener.start_all, listener.stop_all)
else:
_upower.watch(listener.ping_all)