How to use the solaar.__version__ function in solaar

To help you get started, we’ve selected a few solaar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pwr-Solaar / Solaar / lib / solaar / gtk.py View on Github external
def _parse_arguments():
	import argparse
	arg_parser = argparse.ArgumentParser(prog=NAME.lower())
	arg_parser.add_argument('-d', '--debug', action='count', default=0,
							help='print logging messages, for debugging purposes (may be repeated for extra verbosity)')
	arg_parser.add_argument('-D', '--hidraw', action='store', dest='hidraw_path', metavar='PATH',
							help='unifying receiver to use; the first detected receiver if unspecified. Example: /dev/hidraw2')
	arg_parser.add_argument('--restart-on-wake-up', action='store_true',
							help='restart Solaar on sleep wake-up (experimental)')
	arg_parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__)
	arg_parser.add_argument('--help-actions', action='store_true',
							help='print help for the optional actions')
	arg_parser.add_argument('action', nargs=argparse.REMAINDER, choices=_cli.actions,
							help='optional actions to perform')

	args = arg_parser.parse_args()

	if args.help_actions:
		_cli.print_help()
		return

	import logging
	if args.debug > 0:
		log_level = logging.WARNING - 10 * args.debug
		log_format='%(asctime)s,%(msecs)03d %(levelname)8s [%(threadName)s] %(name)s: %(message)s'
		logging.basicConfig(level=max(log_level, logging.DEBUG), format=log_format, datefmt='%H:%M:%S')
github pwr-Solaar / Solaar / lib / solaar / cli.py View on Github external
def _parse_arguments():
	from argparse import ArgumentParser
	arg_parser = ArgumentParser(prog=NAME.lower())
	arg_parser.add_argument('-d', '--debug', action='count', default=0,
							help='print logging messages, for debugging purposes (may be repeated for extra verbosity)')
	arg_parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__)
	arg_parser.add_argument('-D', '--hidraw', action='store', dest='hidraw_path', metavar='PATH',
					help='unifying receiver to use; the first detected receiver if unspecified. Example: /dev/hidraw2')

	subparsers = arg_parser.add_subparsers(title='commands')

	sp = subparsers.add_parser('show', help='show information about paired devices')
	sp.add_argument('device', nargs='?', default='all',
					help='device to show information about; may be a device number (1..6), a device serial, '
						'at least 3 characters of a device\'s name, "receiver", or "all" (the default)')
	sp.add_argument('-v', '--verbose', action='store_true',
					help='print all available information about the inspected device(s)')
	sp.set_defaults(cmd=show_devices)

	sp = subparsers.add_parser('config', help='read/write device-specific settings',
								epilog='Please note that configuration only works on active devices.')
	sp.add_argument('device',
github pwr-Solaar / Solaar / lib / solaar / configuration.py View on Github external
loaded_configuration = {}
		try:
			with open(_file_path, 'r') as config_file:
				loaded_configuration = _json_load(config_file)
		except:
			_log.error("failed to load from %s", _file_path)

		# loaded_configuration.update(_configuration)
		_configuration.clear()
		_configuration.update(loaded_configuration)

	if _log.isEnabledFor(_DEBUG):
		_log.debug("load => %s", _configuration)

	_cleanup(_configuration)
	_configuration[_KEY_VERSION] = __version__
	return _configuration
github pwr-Solaar / Solaar / lib / solaar / ui / about.py View on Github external
def _create():
	about = Gtk.AboutDialog()

	about.set_program_name(NAME)
	about.set_version(__version__)
	about.set_comments(_("Shows status of devices connected\nthrough wireless Logitech receivers."))

	about.set_logo_icon_name(NAME.lower())

	about.set_copyright('© 2012-2013 Daniel Pavel')
	about.set_license_type(Gtk.License.GPL_2_0)

	about.set_authors(('Daniel Pavel http://github.com/pwr',))
	try:
		about.add_credit_section(_("GUI design"), ('Julien Gascard', 'Daniel Pavel'))
		about.add_credit_section(_("Testing"), (
						'Douglas Wagner',
						'Julien Gascard',
						'Peter Wu http://www.lekensteyn.nl/logitech-unifying.html',
						))
		about.add_credit_section(_("Logitech documentation"), (
github pwr-Solaar / Solaar / lib / solaar / ui / action.py View on Github external
def _show_about_window(action):
	about = Gtk.AboutDialog()

	about.set_icon_name(_NAME.lower())
	about.set_program_name(_NAME)
	about.set_logo_icon_name(_NAME.lower())
	about.set_version(__version__)
	about.set_comments('Shows status of devices connected\nto a Logitech Unifying Receiver.')

	about.set_copyright(b'\xC2\xA9'.decode('utf-8') + ' 2012 Daniel Pavel')
	about.set_license_type(Gtk.License.GPL_2_0)

	about.set_authors(('Daniel Pavel http://github.com/pwr',))
	try:
		about.add_credit_section('GUI Design', ('Julien Gascard',))
		about.add_credit_section('Testing', ('Douglas Wagner', 'Julien Gascard'))
		about.add_credit_section('Technical specifications\nprovided by',
						('Julien Danjou http://julien.danjou.info/blog/2012/logitech-unifying-upower',))
	except TypeError:
		# gtk3 < 3.6 has incorrect gi bindings
		pass
	except:
		# is the Gtk3 version too old?
github pwr-Solaar / Solaar / lib / solaar / configuration.py View on Github external
def _load():
	if _path.isfile(file_path):
		loaded_configuration = {}
		try:
			with open(file_path, 'r') as config_file:
				loaded_configuration = _json_load(config_file)
		except:
			logging.error("failed to load configuration from %s", file_path)

		# loaded_configuration.update(_configuration)
		_configuration.clear()
		_configuration.update(loaded_configuration)

	_configuration['_Solaar'] = __version__
	return _configuration