示例#1
0
文件: battery.py 项目: kiok46/plyer
def instance():
    import sys

    if whereis_exe("upower"):
        return LinuxBattery()
    sys.stderr.write("upower not found.")
    return Battery()
示例#2
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('sysctl'):
        return OSXCPU()
    sys.stderr.write('sysctl not found.')
    return CPU()
示例#3
0
文件: cpu.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('nproc'):
        return LinuxCPU()
    sys.stderr.write("nproc not found.")
    return CPU()
示例#4
0
文件: uniqueid.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
示例#5
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('ioreg'):
        return OSXBattery()
    sys.stderr.write("ioreg not found.")
    return Battery()
示例#6
0
文件: email.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('xdg-open'):
        return LinuxEmail()
    sys.stderr.write("xdg-open not found.")
    return Email()
示例#7
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('system_profiler'):
        return OSXBluetooth()
    sys.stderr.write("system_profiler not found.")
    return Bluetooth()
示例#8
0
文件: email.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('open'):
        return MacOSXEmail()
    sys.stderr.write("open not found.")
    return Email()
示例#9
0
文件: uniqueid.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
示例#10
0
文件: email.py 项目: Dmac500/Instabot
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('xdg-open'):
        return LinuxEmail()
    sys.stderr.write("xdg-open not found.")
    return Email()
示例#11
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('open'):
        return MacOSXEmail()
    sys.stderr.write("open not found.")
    return Email()
示例#12
0
文件: cpu.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('sysctl'):
        return OSXCPU()
    sys.stderr.write('sysctl not found.')
    return CPU()
示例#13
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
示例#14
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('nproc'):
        return LinuxCPU()
    sys.stderr.write("nproc not found.")
    return CPU()
示例#15
0
文件: battery.py 项目: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('upower'):
        return UPowerBattery()
    sys.stderr.write("upower not found.")

    if exists(join('/sys', 'class', 'power_supply', 'BAT0')):
        return LinuxBattery()
    return Battery()
示例#16
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('upower'):
        return UPowerBattery()
    sys.stderr.write("upower not found.")

    if exists(join('/sys', 'class', 'power_supply', 'BAT0')):
        return LinuxBattery()
    return Battery()
示例#17
0
def instance():
    import sys
    try:
        import dbus
        return NotifyDbus()
    except ImportError:
        msg = "python-dbus not installed. try: `sudo pip install python-dbus`."
        warnings.warn(msg)
    if whereis_exe('notify-send'):
        return NotifySendNotification()
    warnings.warn("notify-send not found.")
    return Notification()
示例#18
0
def instance():
    import sys
    try:
        import dbus
        return NotifyDbus()
    except ImportError:
        sys.stderr.write("python-dbus not installed. try:"
                         "`sudo pip install python-dbus`.")
    if whereis_exe('notify-send'):
        return NotifySendNotification()
    sys.stderr.write("notify-send not found.")
    return Notification()
示例#19
0
def instance():
    import sys
    try:
        import dbus
        return NotifyDbus()
    except ImportError:
        sys.stderr.write("python-dbus not installed. try:"
                         "`sudo pip install python-dbus`.")
    if whereis_exe('notify-send'):
        return NotifySendNotification()
    sys.stderr.write("notify-send not found.")
    return Notification()
示例#20
0
文件: wifi.py 项目: Dmac500/Instabot
def instance():
    import sys

    if whereis_exe('nmcli'):
        return NMCLIWifi()

    try:
        import wifi  # pylint: disable=unused-variable,unused-import
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")
        return Wifi()
    return LinuxWifi()
示例#21
0
文件: wifi.py 项目: kivy/plyer
def instance():
    import sys

    if whereis_exe('nmcli'):
        return NMCLIWifi()

    try:
        import wifi  # pylint: disable=unused-variable,unused-import
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")
        return Wifi()
    return LinuxWifi()
示例#22
0
def instance():
    import sys
    try:
        import dbus
        return NotifyDbus()
    except ImportError:
        msg = ("The Python dbus package is not installed.\n"
               "Try installing it with your distribution's package manager, "
               "it is usually called python-dbus or python3-dbus, but you "
               "might have to try dbus-python instead, e.g. when using pip.")
        warnings.warn(msg)
    if whereis_exe('notify-send'):
        return NotifySendNotification()
    warnings.warn("notify-send not found.")
    return Notification()
示例#23
0
def instance():
    '''
    Instance for facade proxy.
    '''
    try:
        import dbus  # pylint: disable=unused-variable,unused-import
        return NotifyDbus()
    except ImportError:
        msg = ("The Python dbus package is not installed.\n"
               "Try installing it with your distribution's package manager, "
               "it is usually called python-dbus or python3-dbus, but you "
               "might have to try dbus-python instead, e.g. when using pip.")
        warnings.warn(msg)

    if whereis_exe('notify-send'):
        return NotifySendNotification()
    warnings.warn("notify-send not found.")
    return Notification()
示例#24
0
文件: volume.py 项目: salil-gtm/plyer
def instance():
    import sys
    if whereis_exe('pactl'):
        return VolumeSet()
    sys.stderr.write("pactl not found.")
    return Volume()
示例#25
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
示例#26
0
文件: screenshot.py 项目: kivy/plyer
def instance():
    if whereis_exe('screencapture'):
        return OSXScreenshot()
    else:
        return Screenshot()
示例#27
0
def instance():
    if whereis_exe('say'):
        return NativeSayTextToSpeech()
    elif whereis_exe('espeak'):
        return EspeakTextToSpeech()
    return TTS()
示例#28
0
def instance():
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
示例#29
0
def instance():
    import sys
    if whereis_exe('open'):
        return MacOSXEmail()
    sys.stderr.write("open not found.")
    return Email()
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXBattery()
    sys.stderr.write("ioreg not found.")
    return Battery()
示例#31
0
def instance():
    if whereis_exe('notify-send'):
        return NotifySendNotification()
    return Notification()
示例#32
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXBattery()
    sys.stderr.write("ioreg not found.")
    return Battery()
示例#33
0
def instance():
    if whereis_exe('nmcli'):
        return NMCLIWifi()

    return LinuxWifi()
示例#34
0
文件: processors.py 项目: kivy/plyer
def instance():
    import sys
    if whereis_exe('nproc'):
        return LinuxProcessors()
    sys.stderr.write("nproc not found.")
    return Processors()
示例#35
0
def instance():
    if whereis_exe('xwd'):
        return LinuxScreenshot()
    else:
        return Screenshot()
示例#36
0
def instance():
    if whereis_exe('espeak'):
        return WindowsTextToSpeech()
    return TTS()
示例#37
0
文件: tts.py 项目: Dmac500/Instabot
def instance():
    if whereis_exe('espeak'):
        return EspeakTextToSpeech()
    elif whereis_exe('flite'):
        return FlitetextToSpeech()
    return TTS()
示例#38
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
示例#39
0
def instance():
    if whereis_exe('espeak.exe'):
        return EspeakTextToSpeech()
    return TTS()
示例#40
0
def instance():
    import sys
    if whereis_exe('nproc'):
        return LinuxProcessors()
    sys.stderr.write("nproc not found.")
    return Processors()
示例#41
0
文件: email.py 项目: ach5910/KivyApp
def instance():
    import sys
    if whereis_exe('xdg-open'):
        return LinuxEmail()
    sys.stderr.write("xdg-open not found.")
    return Email()
def instance():
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
def instance():
    import sys
    if whereis_exe('upower'):
        return LinuxBattery()
    sys.stderr.write("upower not found.")
    return Battery()
示例#44
0
def instance():
    if whereis_exe('screencapture'):
        return OSXScreenshot()
    else:
        return Screenshot()