Example #1
0
def instance():
    import sys

    if whereis_exe("upower"):
        return LinuxBattery()
    sys.stderr.write("upower not found.")
    return Battery()
Example #2
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('sysctl'):
        return OSXCPU()
    sys.stderr.write('sysctl not found.')
    return CPU()
Example #3
0
File: cpu.py Project: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('nproc'):
        return LinuxCPU()
    sys.stderr.write("nproc not found.")
    return CPU()
Example #4
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
Example #5
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('ioreg'):
        return OSXBattery()
    sys.stderr.write("ioreg not found.")
    return Battery()
Example #6
0
File: email.py Project: 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()
Example #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()
Example #8
0
File: email.py Project: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('open'):
        return MacOSXEmail()
    sys.stderr.write("open not found.")
    return Email()
Example #9
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
Example #10
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('xdg-open'):
        return LinuxEmail()
    sys.stderr.write("xdg-open not found.")
    return Email()
Example #11
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('open'):
        return MacOSXEmail()
    sys.stderr.write("open not found.")
    return Email()
Example #12
0
File: cpu.py Project: kivy/plyer
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('sysctl'):
        return OSXCPU()
    sys.stderr.write('sysctl not found.')
    return CPU()
Example #13
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
Example #14
0
def instance():
    '''
    Instance for facade proxy.
    '''
    import sys
    if whereis_exe('nproc'):
        return LinuxCPU()
    sys.stderr.write("nproc not found.")
    return CPU()
Example #15
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()
Example #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()
Example #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()
Example #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()
Example #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()
Example #20
0
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()
Example #21
0
File: wifi.py Project: 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()
Example #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()
Example #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()
Example #24
0
def instance():
    import sys
    if whereis_exe('pactl'):
        return VolumeSet()
    sys.stderr.write("pactl not found.")
    return Volume()
Example #25
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
Example #26
0
def instance():
    if whereis_exe('screencapture'):
        return OSXScreenshot()
    else:
        return Screenshot()
Example #27
0
def instance():
    if whereis_exe('say'):
        return NativeSayTextToSpeech()
    elif whereis_exe('espeak'):
        return EspeakTextToSpeech()
    return TTS()
Example #28
0
def instance():
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
Example #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()
Example #31
0
def instance():
    if whereis_exe('notify-send'):
        return NotifySendNotification()
    return Notification()
Example #32
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXBattery()
    sys.stderr.write("ioreg not found.")
    return Battery()
Example #33
0
def instance():
    if whereis_exe('nmcli'):
        return NMCLIWifi()

    return LinuxWifi()
Example #34
0
def instance():
    import sys
    if whereis_exe('nproc'):
        return LinuxProcessors()
    sys.stderr.write("nproc not found.")
    return Processors()
Example #35
0
def instance():
    if whereis_exe('xwd'):
        return LinuxScreenshot()
    else:
        return Screenshot()
Example #36
0
def instance():
    if whereis_exe('espeak'):
        return WindowsTextToSpeech()
    return TTS()
Example #37
0
def instance():
    if whereis_exe('espeak'):
        return EspeakTextToSpeech()
    elif whereis_exe('flite'):
        return FlitetextToSpeech()
    return TTS()
Example #38
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
Example #39
0
def instance():
    if whereis_exe('espeak.exe'):
        return EspeakTextToSpeech()
    return TTS()
Example #40
0
def instance():
    import sys
    if whereis_exe('nproc'):
        return LinuxProcessors()
    sys.stderr.write("nproc not found.")
    return Processors()
Example #41
0
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()
Example #44
0
def instance():
    if whereis_exe('screencapture'):
        return OSXScreenshot()
    else:
        return Screenshot()