当前位置: 首页>>代码示例>>Python>>正文


Python Status.register方法代码示例

本文整理汇总了Python中i3pystatus.Status.register方法的典型用法代码示例。如果您正苦于以下问题:Python Status.register方法的具体用法?Python Status.register怎么用?Python Status.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在i3pystatus.Status的用法示例。


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

示例1: test_missing_required_shows_error

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
def test_missing_required_shows_error():
    """ Ensure that when an a required module parameter is missing an error is shown in the bar. """
    status = Status(standalone=False)
    status.register("text")
    assert len(status.modules) > 0
    assert status.modules[0].output is not None
    assert "ConfigMissingError" in status.modules[0].output['full_text']
开发者ID:Arvedui,项目名称:i3pystatus,代码行数:9,代码来源:test_core_modules.py

示例2: test_invalid_module_kwarg_shows_error

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
def test_invalid_module_kwarg_shows_error():
    """ Ensure that when an invalid module kwarg is passed an error is shown in the bar. """
    status = Status(standalone=False)
    status.register("text", foo='bar')
    assert len(status.modules) > 0
    assert status.modules[0].output is not None
    assert "ConfigKeyError" in status.modules[0].output['full_text']
开发者ID:Arvedui,项目名称:i3pystatus,代码行数:9,代码来源:test_core_modules.py

示例3: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status
from i3pystatus.mail import imap

status = Status(standalone=True)


status.register("pulseaudio",
    format="♪ {volume_bar}",
    multi_colors=True,
    color_unmuted='#00ff00',
    vertical_bar_width=2,
    bar_type='vertical')

status.register("clock",
    format="%a %d %b %I:%M:%S",)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")

# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
    format="{temp:.0f}°C",)

# The battery monitor has many formatting options, see README for details
# This would look like this:
# Discharging 6h:51m
开发者ID:lupin3rd,项目名称:dotfiles,代码行数:33,代码来源:pystatus.py

示例4: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
#!/bin/env python
import subprocess
from i3pystatus import Status

status = Status(standalone=True)

green="#1A8C01"
white="#FFFFFF"
purple="#D175FF"
red="#FF6600"
blue="#4581DD"
yellow="#DDDD11"

#Clock
status.register("clock", format="%a %d %R", color=white)

#Battery
status.register("battery",
    color=yellow, charging_color=purple, full_color=green, critical_color=red,
    format="❤: {percentage:02.0f}%", interval=1)

# CPU temperature
status.register("temp", color=white, format="{temp:.0f}°C")

# CPU usage (text)
# status.register("cpu_usage", format="▣ CPU: {usage_cpu1:02}% {usage_cpu1:02}% {usage_cpu2:02}% {usage_cpu3:02}%", interval=1)
status.register("cpu_usage", format="▣: {usage:02.0f}%", interval=1)

# RAM
status.register("mem", color=blue, format="≣: {percent_used_mem:02.0f}%", interval=1)
开发者ID:StanislavNikolov,项目名称:dotfiles,代码行数:32,代码来源:status.py

示例5: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
                format="%a %-d %b %X",)

status.register("weather",
                location_code="GMXX0007",
                colorize=True,
                interval=20,
                format="{current_temp} / {current_wind}",
                )

# Shows pulseaudio default sink volume
#
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",
                format="♪{volume}",)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")
status.register("mem",
开发者ID:coderiot,项目名称:dotfiles,代码行数:33,代码来源:bar.py

示例6: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
    format="%a %-d %b %X KW%V",)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")

# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
    format="{temp:.0f}°C",)

# The battery monitor has many formatting options, see README for details

# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
开发者ID:Grimmoire,项目名称:Ivory-Dotfiles,代码行数:33,代码来源:i3pystatus.py

示例7: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
darkgreen   = "#9acbad"
yellow      = "#abb773"
darkyellow  = "#c5cba4"
blue        = "#7865c5"
darkblue    = "#a396d9"
magenta     = "#bb65b6"
darkmagenta = "#cf96cf"
cyan        = "#68a8c5"
darkcyan    = "#9ac1d9"
white       = "#f1edfb"
darkwhite   = "#f1edfb"
background  = "#133B47"

status = Status(standalone=True)

status.register("clock",
    format="%a %-d %b %X",)




# status.register("battery",
#     format="{status} {percentage:.0f}% {remaining:%E%hh:%Mm}",
#     alert=True,
#     alert_percentage=5,
#     color=white,
#     critical_color=red,
#     charging_color=yellow,
#     full_color=white,
#     status={
#         "DIS": "DIS",
#         "CHR": "CHR",
开发者ID:hidekin,项目名称:dotfiles,代码行数:34,代码来源:i3pystatusconfig.py

示例8: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess
from i3pystatus import Status

status = Status(standalone=True)

# Shows pulseaudio default sink volume
#
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",
    format=" {volume}",
    format_muted="       ")

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
    format=" %a %-d %b %X KW%V",)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")

# Shows disk usage of /
# Format:
# 42/128G [86G]
status.register("disk",
    path="/",
    format=" {avail}G",)
开发者ID:notmatti,项目名称:dotfiles,代码行数:32,代码来源:pystatus.py

示例9: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
	format="%a %-d %b %X",
	color="#9a875f")

status.register("weather",
	location_code="GMXX0007")


# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
# status.register("load")

# Shows your CPU temperature, if you have a Intel CPU
#status.register("temp",
#    format="{temp:.0f}°C",)

# The battery monitor has many formatting options, see README for 
# details

# This would look like this, when discharging (or charging)
开发者ID:monkeyape,项目名称:dotfiles_archbook,代码行数:33,代码来源:status.py

示例10: __len__

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
    def __len__(self):
        return len(self._data.keys())


# Load settings from ``$HOME/.i3/local_settings.json
my_settings = MySettings()


# Initialize i3pystatus instance
status = Status(standalone=True)

# Displays clock like this: # Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
                format=" %Y-%m-%d %H:%M KW%V ",
                on_leftclick='gsimplecal',
)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load",
                format=" {avg1},{avg5},{avg15},{tasks} ",)

# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
                format="{temp:.0f}°C",)

status.register("cpu_usage_graph",
)

status.register("mem",
开发者ID:abrade,项目名称:configuration,代码行数:33,代码来源:i3pystatus_config.py

示例11: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
    format="%a %-d %b %X",)

# Shows your CPU temperature, if you have a Intel CPU
# status.register("temp",
#     format="{temp:.0f}°C",)

status.register("cpu_usage",
    format="{usage:02}%",)
# The battery monitor has many formatting options, see README for details

# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
status.register("battery",
    format="{status} {consumption:.0f}W {percentage_design:.0f}% {remaining:%E%hh:%Mm}",
开发者ID:sharkdp,项目名称:config-files,代码行数:33,代码来源:i3pystatus.conf.py

示例12: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
from i3pystatus_custom_modules import CustomBackupsMonitor
from i3pystatus import Status

status = Status(standalone=True)

status.register("clock",
    format="%Y-%m-%d %H:%M:%S",)

status.register("pomodoro",
                sound="~/dotfiles/scripts/fire-pager.wav",)

# Shows pulseaudio default sink volume
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",
                format="♪: {volume}%",)

status.register("backlight",
    format="* {brightness}/{max_brightness}",
    interval=2,
    )

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load",
    critical_limit=4,
    format="{avg1} {tasks}",
                )

# Shows your CPU temperature, if you have a Intel CPU
# status.register("temp",
    # format="{temp:.0f}°C",)
开发者ID:mxlian,项目名称:dotfiles,代码行数:33,代码来源:i3pystatus.conf.py

示例13: glob

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
#!/usr/bin/env python3

import os
from subprocess import run
from glob import glob

import netifaces
from i3pystatus import Status

terminal = 'gnome-terminal'

is_notebook = os.path.isdir('/proc/acpi/battery/') or glob('/sys/class/power_supply/BAT*')

status = Status(interval=1)
status.register('clock', format='%X')
status.register('clock', format='%a %-d %b W%V', interval=30)
#status.register('temp', format='{temp:.0f}°C')

if is_notebook:
	batfmt = 'Bat: {status}{percentage:.2f}% {remaining:%E%hh:%Mm}'
	status.register('battery', format=batfmt, alert=True, alert_percentage=10, status={'DIS': '↓', 'CHR': '↑', 'FULL': ''})

status.register('pulseaudio', format='♪{volume}')
status.register('load', format='{avg1} {avg5} {avg15}', on_leftclick=f'{terminal} -e "htop --sort-key=PERCENT_CPU"')
status.register('mem', format='Mem: {percent_used_mem:.2f}%', on_leftclick=f'{terminal} -e "htop --sort-key=PERCENT_MEM"')

ifaces = netifaces.interfaces()
ifaces = sorted(ifaces, key=len)
lan1 = next(( i for i in ifaces if i.startswith('enp')), None)
if lan1:
    status.register('network', interface=lan1,
开发者ID:gvalkov,项目名称:dotfiles,代码行数:33,代码来源:statusbar.py

示例14: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
#!/usr/bin/python3
from i3pystatus import Status
import locale
locale.setlocale(locale.LC_ALL, 'nb_NO.UTF-8')

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
                format="%a %d.%m %H:%M",
                interval = 5)

# The battery monitor has many formatting options, see README for details

# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
#status.register("battery",
#                format="{status} [{consumption:.1f}W ]{percentage:.0f}%[ {remaining:%E%hh:%Mm}]",
#    alert=True,
#    alert_percentage=5,
#    status={
#        "DIS": "↓",
#        "CHR": "↑",
#        "FULL": "⚡"
开发者ID:trondarild,项目名称:dotfiles,代码行数:33,代码来源:i3py.py

示例15: Status

# 需要导入模块: from i3pystatus import Status [as 别名]
# 或者: from i3pystatus.Status import register [as 别名]
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status
from i3pystatus import mpd

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
    format="%a %-d %b %X Week %V",)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
#status.register("load")

# Shows your CPU temperature, if you have a Intel CPU
#status.register("temp",
 #   format="{temp:.0f}°C",)

# The battery monitor has many formatting options, see README for details

# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
开发者ID:Zephilinox,项目名称:dotfiles,代码行数:33,代码来源:.i3pystatus.py


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