• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python i18n._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中solaar.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _create_device_panel

def _create_device_panel():
	p = Gtk.Box.new(Gtk.Orientation.VERTICAL, 4)

	def _status_line(label_text):
		b = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 8)
		b.set_size_request(10, 28)

		b._label = Gtk.Label(label_text)
		b._label.set_alignment(0, 0.5)
		b._label.set_size_request(170, 10)
		b.pack_start(b._label, False, False, 0)

		b._icon = Gtk.Image()
		b.pack_start(b._icon, False, False, 0)

		b._text = Gtk.Label()
		b._text.set_alignment(0, 0.5)
		b.pack_start(b._text, True, True, 0)

		return b

	p._battery = _status_line(_("Battery"))
	p.pack_start(p._battery, False, False, 0)

	p._secure = _status_line(_("Wireless Link"))
	p._secure._icon.set_from_icon_name('dialog-warning', _INFO_ICON_SIZE)
	p.pack_start(p._secure, False, False, 0)

	p._lux = _status_line(_("Lighting"))
	p.pack_start(p._lux, False, False, 0)

	p._config = _config_panel.create()
	p.pack_end(p._config, False, False, 4)

	return p
开发者ID:3v1n0,项目名称:Solaar,代码行数:35,代码来源:window.py


示例2: _create_sbox

def _create_sbox(s):
	sbox = Gtk.HBox(homogeneous=False, spacing=6)
	sbox.pack_start(Gtk.Label(s.label), False, False, 0)

	spinner = Gtk.Spinner()
	spinner.set_tooltip_text(_("Working") + '...')

	failed = Gtk.Image.new_from_icon_name('dialog-warning', Gtk.IconSize.SMALL_TOOLBAR)
	failed.set_tooltip_text(_("Read/write operation failed."))

	if s.kind == _SETTING_KIND.toggle:
		control = _create_toggle_control(s)
		sbox.pack_end(control, False, False, 0)
	elif s.kind == _SETTING_KIND.choice:
		control = _create_choice_control(s)
		sbox.pack_end(control, False, False, 0)
	elif s.kind == _SETTING_KIND.range:
		control = _create_slider_control(s)
		sbox.pack_end(control, True, True, 0)
	else:
		raise NotImplemented

	control.set_sensitive(False)  # the first read will enable it
	sbox.pack_end(spinner, False, False, 0)
	sbox.pack_end(failed, False, False, 0)

	if s.description:
		sbox.set_tooltip_text(s.description)

	sbox.show_all()
	spinner.start()  # the first read will stop it
	failed.set_visible(False)

	return sbox
开发者ID:DJm00n,项目名称:Solaar,代码行数:34,代码来源:config_panel.py


示例3: _generate_tooltip_lines

def _generate_tooltip_lines():
	if not _devices_info:
		yield '<b>%s</b>: ' % NAME + _("no receiver")
		return

	yield '<b>%s</b>' % NAME
	yield ''

	for _ignore, number, name, status in _devices_info:
		if number is None:  # receiver
			continue

		p = status.to_string()
		if p:  # does it have any properties to print?
			yield '<b>%s</b>' % name
			if status:
				yield '\t%s' % p
			else:
				yield '\t%s <small>(' % p + _("offline") + ')</small>'
		else:
			if status:
				yield '<b>%s</b> <small>(' % name + _("no status") + ')</small>'
			else:
				yield '<b>%s</b> <small>(' % name + _("offline") + ')</small>'
		yield ''
开发者ID:DJm00n,项目名称:Solaar,代码行数:25,代码来源:tray.py


示例4: _create_buttons_box

def _create_buttons_box():
	bb = Gtk.ButtonBox(Gtk.Orientation.HORIZONTAL)
	bb.set_layout(Gtk.ButtonBoxStyle.END)

	bb._details = _new_button(None, 'dialog-information', _SMALL_BUTTON_ICON_SIZE,
					tooltip=_("Show Technical Details"), toggle=True, clicked=_update_details)
	bb.add(bb._details)
	bb.set_child_secondary(bb._details, True)
	bb.set_child_non_homogeneous(bb._details, True)

	def _pair_new_device(trigger):
		assert _find_selected_device_id() is not None
		receiver = _find_selected_device()
		assert receiver is not None
		assert bool(receiver)
		assert receiver.kind is None
		_action.pair(_window, receiver)

	bb._pair = _new_button(_("Pair new device"), 'list-add', clicked=_pair_new_device)
	bb.add(bb._pair)

	def _unpair_current_device(trigger):
		assert _find_selected_device_id() is not None
		device = _find_selected_device()
		assert device is not None
		assert bool(device)
		assert device.kind is not None
		_action.unpair(_window, device)

	bb._unpair = _new_button(_("Unpair"), 'edit-delete', clicked=_unpair_current_device)
	bb.add(bb._unpair)

	return bb
开发者ID:3v1n0,项目名称:Solaar,代码行数:33,代码来源:window.py


示例5: show

	def show(dev, reason=None, icon=None):
		"""Show a notification with title and text."""
		if available and Notify.is_initted():
			summary = dev.name

			# if a notification with same name is already visible, reuse it to avoid spamming
			n = _notifications.get(summary)
			if n is None:
				n = _notifications[summary] = Notify.Notification()

			if reason:
				message = reason
			elif dev.status is None:
				message = _("unpaired")
			elif bool(dev.status):
				message = dev.status.to_string() or _("connected")
			else:
				message = _("offline")

			# we need to use the filename here because the notifications daemon
			# is an external application that does not know about our icon sets
			icon_file = _icons.device_icon_file(dev.name, dev.kind) if icon is None \
						else _icons.icon_file(icon)

			n.update(summary, message, icon_file)
			urgency = Notify.Urgency.LOW if dev.status else Notify.Urgency.NORMAL
			n.set_urgency(urgency)

			try:
				# if _log.isEnabledFor(_DEBUG):
				# 	_log.debug("showing %s", n)
				n.show()
			except Exception:
				_log.exception("showing %s", n)
开发者ID:Lekensteyn,项目名称:Solaar,代码行数:34,代码来源:notify.py


示例6: create

def create(receiver):
    assert receiver is not None
    assert receiver.kind is None

    assistant = Gtk.Assistant()
    assistant.set_title(_("%(receiver_name)s: pair new device") % {"receiver_name": receiver.name})
    assistant.set_icon_name("list-add")

    assistant.set_size_request(400, 240)
    assistant.set_resizable(False)
    assistant.set_role("pair-device")

    page_intro = _create_page(
        assistant,
        Gtk.AssistantPageType.PROGRESS,
        _("Turn on the device you want to pair."),
        "preferences-desktop-peripherals",
        _("If the device is already turned on,\nturn if off and on again."),
    )
    spinner = Gtk.Spinner()
    spinner.set_visible(True)
    page_intro.pack_end(spinner, True, True, 24)

    assistant.connect("prepare", _prepare, receiver)
    assistant.connect("cancel", _finish, receiver)
    assistant.connect("close", _finish, receiver)

    return assistant
开发者ID:pwr,项目名称:Solaar,代码行数:28,代码来源:pair_window.py


示例7: _create

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"), (
						'Julien Danjou http://julien.danjou.info/blog/2012/logitech-unifying-upower',
						'Nestor Lopez Casado http://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28',
						))
	except TypeError:
		# gtk3 < ~3.6.4 has incorrect gi bindings
		import logging
		logging.exception("failed to fully create the about dialog")
	except:
		# the Gtk3 version may be too old, and the function does not exist
		import logging
		logging.exception("failed to fully create the about dialog")

	about.set_translator_credits('\n'.join((
					'gogo (croatian)',
					'Papoteur, David Geiger, Damien Lallement (français)',
					'Michele Olivo (italiano)',
					'Adrian Piotrowicz (polski)',
					'Drovetto, JrBenito (Portuguese-BR)',
					'Daniel Pavel (română)',
					'Daniel Zippert, Emelie Snecker (svensk)',
					'Dimitriy Ryazantcev (Russian)',
					)))

	about.set_website('http://pwr.github.io/Solaar/')
	about.set_website_label(NAME)

	about.connect('response', lambda x, y: x.hide())

	def _hide(dialog, event):
		dialog.hide()
		return True
	about.connect('delete-event', _hide)

	return about
开发者ID:DJm00n,项目名称:Solaar,代码行数:55,代码来源:about.py


示例8: _check_encrypted

 def _check_encrypted(dev):
     if assistant.is_drawable():
         if device.status.get(_K.LINK_ENCRYPTED) == False:
             hbox.pack_start(Gtk.Image.new_from_icon_name("security-low", Gtk.IconSize.MENU), False, False, 0)
             hbox.pack_start(Gtk.Label(_("The wireless link is not encrypted") + "!"), False, False, 0)
             hbox.show_all()
         else:
             return True
开发者ID:pwr,项目名称:Solaar,代码行数:8,代码来源:pair_window.py


示例9: _create_menu

def _create_menu(quit_handler):
	menu = Gtk.Menu()

	# per-device menu entries will be generated as-needed

	no_receiver = Gtk.MenuItem.new_with_label(_("No Logitech receiver found"))
	no_receiver.set_sensitive(False)
	menu.append(no_receiver)
	menu.append(Gtk.SeparatorMenuItem.new())

	from .action import about, make
	menu.append(about.create_menu_item())
	menu.append(make('application-exit', _("Quit"), quit_handler, stock_id=Gtk.STOCK_QUIT).create_menu_item())
	del about, make

	menu.show_all()

	return menu
开发者ID:DJm00n,项目名称:Solaar,代码行数:18,代码来源:tray.py


示例10: unpair

def unpair(window, device):
	assert device
	assert device.kind is not None

	qdialog = Gtk.MessageDialog(window, 0,
								Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE,
								_("Unpair") + ' ' + device.name + ' ?')
	qdialog.set_icon_name('remove')
	qdialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
	qdialog.add_button(_("Unpair"), Gtk.ResponseType.ACCEPT)
	choice = qdialog.run()
	qdialog.destroy()
	if choice == Gtk.ResponseType.ACCEPT:
		receiver = device.receiver
		assert receiver
		device_number = device.number

		try:
			del receiver[device_number]
		except:
			# _log.exception("unpairing %s", device)
			error_dialog('unpair', device)
开发者ID:3v1n0,项目名称:Solaar,代码行数:22,代码来源:action.py


示例11: _update_receiver_panel

def _update_receiver_panel(receiver, panel, buttons, full=False):
	assert receiver

	devices_count = len(receiver)

	paired_text = _('No device paired.') if devices_count == 0 else ngettext('%(count)s paired device.', '%(count)s paired devices.', devices_count) % { 'count': devices_count }

	if(receiver.max_devices > 0):
		paired_text += '\n\n<small>%s</small>' % ngettext('Up to %(max_count)s device can be paired to this receiver.', 'Up to %(max_count)s devices can be paired to this receiver.', receiver.max_devices) % { 'max_count': receiver.max_devices }
	elif(devices_count > 0):
		paired_text += '\n\n<small>%s</small>' % _('Only one device can be paired to this receiver.')

	panel._count.set_markup(paired_text)

	is_pairing = receiver.status.lock_open
	if is_pairing:
		panel._scanning.set_visible(True)
		if not panel._spinner.get_visible():
			panel._spinner.start()
		panel._spinner.set_visible(True)
	else:
		panel._scanning.set_visible(False)
		if panel._spinner.get_visible():
			panel._spinner.stop()
		panel._spinner.set_visible(False)

	panel.set_visible(True)

	# b._insecure.set_visible(False)
	buttons._unpair.set_visible(False)

	may_pair = receiver.may_unpair and not is_pairing
	if may_pair and devices_count >= receiver.max_devices:
		online_devices = tuple(n for n in range(1, receiver.max_devices) if n in receiver and receiver[n].online)
		may_pair &= len(online_devices) < receiver.max_devices
	buttons._pair.set_sensitive(may_pair)
	buttons._pair.set_visible(True)
开发者ID:DJm00n,项目名称:Solaar,代码行数:37,代码来源:window.py


示例12: has_stopped

	def has_stopped(self):
		r, self.receiver = self.receiver, None
		assert r is not None
		if _log.isEnabledFor(_INFO):
			_log.info("%s: notifications listener has stopped", r)

		# because udev is not notifying us about device removal,
		# make sure to clean up in _all_listeners
		_all_listeners.pop(r.path, None)

		r.status = _("The receiver was unplugged.")
		if r:
			try:
				r.close()
			except:
				_log.exception("closing receiver %s" % r.path)
		self.status_changed_callback(r)  #, _status.ALERT.NOTIFICATION)
开发者ID:3v1n0,项目名称:Solaar,代码行数:17,代码来源:listener.py


示例13: _create_window_layout

def _create_window_layout():
	assert _tree is not None
	assert _details is not None
	assert _info is not None
	assert _empty is not None

	assert _tree.get_selection().get_mode() == Gtk.SelectionMode.SINGLE
	_tree.get_selection().connect('changed', _device_selected)

	tree_scroll = Gtk.ScrolledWindow()
	tree_scroll.add(_tree)
	tree_scroll.set_min_content_width(_tree.get_size_request()[0])
	tree_scroll.set_shadow_type(Gtk.ShadowType.IN)

	tree_panel = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
	tree_panel.set_homogeneous(False)
	tree_panel.pack_start(tree_scroll, True, True, 0)
	tree_panel.pack_start(_details, False, False, 0)

	panel = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 16)
	panel.pack_start(tree_panel, False, False, 0)
	panel.pack_start(_info, True, True, 0)
	panel.pack_start(_empty, True, True, 0)

	about_button = _new_button(_("About") + ' ' + NAME, 'help-about',
					icon_size=_SMALL_BUTTON_ICON_SIZE, clicked=_show_about_window)

	bottom_buttons_box = Gtk.ButtonBox(Gtk.Orientation.HORIZONTAL)
	bottom_buttons_box.set_layout(Gtk.ButtonBoxStyle.START)
	bottom_buttons_box.add(about_button)

	# solaar_version = Gtk.Label()
	# solaar_version.set_markup('<small>' + NAME + ' v' + VERSION + '</small>')
	# bottom_buttons_box.add(solaar_version)
	# bottom_buttons_box.set_child_secondary(solaar_version, True)

	vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 8)
	vbox.set_border_width(8)
	vbox.pack_start(panel, True, True, 0)
	vbox.pack_end(bottom_buttons_box, False, False, 0)
	vbox.show_all()

	_details.set_visible(False)
	_info.set_visible(False)
	return vbox
开发者ID:Lekensteyn,项目名称:Solaar,代码行数:45,代码来源:window.py


示例14: _create_receiver_panel

def _create_receiver_panel():
	p = Gtk.Box.new(Gtk.Orientation.VERTICAL, 4)

	p._count = Gtk.Label()
	p._count.set_padding(24, 0)
	p._count.set_alignment(0, 0.5)
	p.pack_start(p._count, True, True, 0)

	p._scanning = Gtk.Label(_("Scanning") + '...')
	p._spinner = Gtk.Spinner()

	bp = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 8)
	bp.pack_start(Gtk.Label(' '), True, True, 0)
	bp.pack_start(p._scanning, False, False, 0)
	bp.pack_end(p._spinner, False, False, 0)
	p.pack_end(bp, False, False, 0)

	return p
开发者ID:3v1n0,项目名称:Solaar,代码行数:18,代码来源:window.py


示例15: _pairing_succeeded

def _pairing_succeeded(assistant, receiver, device):
    assert device
    if _log.isEnabledFor(_DEBUG):
        _log.debug("%s success: %s", receiver, device)

    page = _create_page(assistant, Gtk.AssistantPageType.SUMMARY)

    header = Gtk.Label(_("Found a new device:"))
    header.set_alignment(0.5, 0)
    page.pack_start(header, False, False, 0)

    device_icon = Gtk.Image()
    icon_set = _icons.device_icon_set(device.name, device.kind)
    device_icon.set_from_icon_set(icon_set, Gtk.IconSize.LARGE)
    device_icon.set_alignment(0.5, 1)
    page.pack_start(device_icon, True, True, 0)

    device_label = Gtk.Label()
    device_label.set_markup("<b>%s</b>" % device.name)
    device_label.set_alignment(0.5, 0)
    page.pack_start(device_label, True, True, 0)

    hbox = Gtk.HBox(False, 8)
    hbox.pack_start(Gtk.Label(" "), False, False, 0)
    hbox.set_property("expand", False)
    hbox.set_property("halign", Gtk.Align.CENTER)
    page.pack_start(hbox, False, False, 0)

    def _check_encrypted(dev):
        if assistant.is_drawable():
            if device.status.get(_K.LINK_ENCRYPTED) == False:
                hbox.pack_start(Gtk.Image.new_from_icon_name("security-low", Gtk.IconSize.MENU), False, False, 0)
                hbox.pack_start(Gtk.Label(_("The wireless link is not encrypted") + "!"), False, False, 0)
                hbox.show_all()
            else:
                return True

    GLib.timeout_add(_STATUS_CHECK, _check_encrypted, device)

    page.show_all()

    assistant.next_page()
    assistant.commit()
开发者ID:pwr,项目名称:Solaar,代码行数:43,代码来源:pair_window.py


示例16: _pairing_failed

def _pairing_failed(assistant, receiver, error):
    if _log.isEnabledFor(_DEBUG):
        _log.debug("%s fail: %s", receiver, error)

    assistant.commit()

    header = _("Pairing failed") + ": " + _(str(error)) + "."
    if "timeout" in str(error):
        text = _("Make sure your device is within range, and has a decent battery charge.")
    elif str(error) == "device not supported":
        text = _("A new device was detected, but it is not compatible with this receiver.")
    elif "many" in str(error):
        text = _("The receiver only supports %d paired device(s).")
    else:
        text = _("No further details are available about the error.")
    _create_page(assistant, Gtk.AssistantPageType.SUMMARY, header, "dialog-error", text)

    assistant.next_page()
    assistant.commit()
开发者ID:pwr,项目名称:Solaar,代码行数:19,代码来源:pair_window.py


示例17: _error_dialog

def _error_dialog(reason, object):
	_log.error("error: %s %s", reason, object)

	if reason == 'permissions':
		title = _("Permissions error")
		text = _("Found a Logitech Receiver (%s), but did not have permission to open it.") % object + \
				'\n\n' + \
				_("If you've just installed Solaar, try removing the receiver and plugging it back in.")
	elif reason == 'unpair':
		title = _("Unpairing failed")
		text = _("Failed to unpair %{device} from %{receiver}.").format(device=object.name, receiver=object.receiver.name) + \
				'\n\n' + \
				_("The receiver returned an error, with no further details.")
	else:
		raise Exception("ui.error_dialog: don't know how to handle (%s, %s)", reason, object)

	assert title
	assert text

	m = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, text)
	m.set_title(title)
	m.run()
	m.destroy()
开发者ID:Lekensteyn,项目名称:Solaar,代码行数:23,代码来源:__init__.py


示例18: _toggle_notifications

#
#
#

# def _toggle_notifications(action):
# 	if action.get_active():
# 		notify.init('Solaar')
# 	else:
# 		notify.uninit()
# 	action.set_sensitive(notify.available)
# toggle_notifications = make_toggle('notifications', 'Notifications', _toggle_notifications)


from .about import show_window as _show_about_window
from solaar import NAME
about = make('help-about', _("About") + ' ' + NAME, _show_about_window, stock_id=Gtk.STOCK_ABOUT)

#
#
#

from . import pair_window
def pair(window, receiver):
	assert receiver
	assert receiver.kind is None

	pair_dialog = pair_window.create(receiver)
	pair_dialog.set_transient_for(window)
	pair_dialog.set_destroy_with_parent(True)
	pair_dialog.set_modal(True)
	pair_dialog.set_type_hint(Gdk.WindowTypeHint.DIALOG)
开发者ID:3v1n0,项目名称:Solaar,代码行数:31,代码来源:action.py


示例19: _update_device_panel

def _update_device_panel(device, panel, buttons, full=False):
	assert device
	is_online = bool(device.online)
	panel.set_sensitive(is_online)

	battery_level = device.status.get(_K.BATTERY_LEVEL)
	if battery_level is None:
		icon_name = _icons.battery()
		panel._battery._icon.set_sensitive(False)
		panel._battery._icon.set_from_icon_name(icon_name, _INFO_ICON_SIZE)
		panel._battery._text.set_sensitive(True)
		panel._battery._text.set_markup('<small>%s</small>' % _("unknown"))
	else:
		charging = device.status.get(_K.BATTERY_CHARGING)
		icon_name = _icons.battery(battery_level, charging)
		panel._battery._icon.set_from_icon_name(icon_name, _INFO_ICON_SIZE)
		panel._battery._icon.set_sensitive(True)

		if isinstance(battery_level, _NamedInt):
			text = _(str(battery_level))
		else:
			text = '%d%%' % battery_level
		if is_online:
			if charging:
				text += ' <small>(%s)</small>' % _("charging")
		else:
			text += ' <small>(%s)</small>' % _("last known")
		panel._battery._text.set_sensitive(is_online)
		panel._battery._text.set_markup(text)

	if is_online:
		not_secure = device.status.get(_K.LINK_ENCRYPTED) == False
		if not_secure:
			panel._secure._text.set_text(_("not encrypted"))
			panel._secure._icon.set_from_icon_name('security-low', _INFO_ICON_SIZE)
			panel._secure.set_tooltip_text(_TOOLTIP_LINK_INSECURE)
		else:
			panel._secure._text.set_text(_("encrypted"))
			panel._secure._icon.set_from_icon_name('security-high', _INFO_ICON_SIZE)
			panel._secure.set_tooltip_text(_TOOLTIP_LINK_SECURE)
		panel._secure._icon.set_visible(True)
	else:
		panel._secure._text.set_markup('<small>%s</small>' % _("offline"))
		panel._secure._icon.set_visible(False)
		panel._secure.set_tooltip_text('')

	if is_online:
		light_level = device.status.get(_K.LIGHT_LEVEL)
		if light_level is None:
			panel._lux.set_visible(False)
		else:
			panel._lux._icon.set_from_icon_name(_icons.lux(light_level), _INFO_ICON_SIZE)
			panel._lux._text.set_text('%d %s' % (light_level, _("lux")))
			panel._lux.set_visible(True)
	else:
		panel._lux.set_visible(False)

	buttons._pair.set_visible(False)
	buttons._unpair.set_sensitive(device.receiver.may_unpair)
	buttons._unpair.set_visible(True)

	panel.set_visible(True)

	if full:
		_config_panel.update(device, is_online)
开发者ID:3v1n0,项目名称:Solaar,代码行数:65,代码来源:window.py


示例20: _details_items

		def _details_items(device, read_all=False):
			# If read_all is False, only return stuff that is ~100% already
			# cached, and involves no HID++ calls.

			if device.kind is None:
				yield (_("Path"), device.path)
				# 046d is the Logitech vendor id
				yield (_("USB id"), '046d:' + device.product_id)

				if read_all:
					yield (_("Serial"), device.serial)
				else:
					yield (_("Serial"), '...')

			else:
				# yield ('Codename', device.codename)
				yield (_("Index"), device.number)
				yield (_("Wireless PID"), device.wpid)
				hid_version = device.protocol
				yield (_("Protocol"), 'HID++ %1.1f' % hid_version if hid_version else 'unknown')
				if read_all and device.polling_rate:
					yield (_("Polling rate"), '%d ms (%dHz)' % (device.polling_rate, 1000 // device.polling_rate))

				if read_all or not device.online:
					yield (_("Serial"), device.serial)
				else:
					yield (_("Serial"), '...')

			if read_all:
				for fw in list(device.firmware):
					yield ('  ' + _(str(fw.kind)), (fw.name + ' ' + fw.version).strip())
			elif device.kind is None or device.online:
				yield ('  %s' % _("Firmware"), '...')

			flag_bits = device.status.get(_K.NOTIFICATION_FLAGS)
			if flag_bits is not None:
				flag_names = ('(%s)' % _("none"),) if flag_bits == 0 else _hidpp10.NOTIFICATION_FLAG.flag_names(flag_bits)
				yield (_("Notifications"), ('\n%15s' % ' ').join(flag_names))
开发者ID:3v1n0,项目名称:Solaar,代码行数:38,代码来源:window.py



注:本文中的solaar.i18n._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python application.url_for函数代码示例发布时间:2022-05-27
下一篇:
Python util.get_download_context函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap