Exemplo n.º 1
0
def instance():
    import sys

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

    return LinuxWifi()
Exemplo n.º 34
0
def instance():
    import sys
    if whereis_exe('nproc'):
        return LinuxProcessors()
    sys.stderr.write("nproc not found.")
    return Processors()
Exemplo n.º 35
0
def instance():
    if whereis_exe('xwd'):
        return LinuxScreenshot()
    else:
        return Screenshot()
Exemplo n.º 36
0
def instance():
    if whereis_exe('espeak'):
        return WindowsTextToSpeech()
    return TTS()
Exemplo n.º 37
0
def instance():
    if whereis_exe('espeak'):
        return EspeakTextToSpeech()
    elif whereis_exe('flite'):
        return FlitetextToSpeech()
    return TTS()
Exemplo n.º 38
0
def instance():
    import sys
    if whereis_exe('ioreg'):
        return OSXUniqueID()
    sys.stderr.write("ioreg not found.")
    return UniqueID()
Exemplo n.º 39
0
def instance():
    if whereis_exe('espeak.exe'):
        return EspeakTextToSpeech()
    return TTS()
Exemplo n.º 40
0
def instance():
    import sys
    if whereis_exe('nproc'):
        return LinuxProcessors()
    sys.stderr.write("nproc not found.")
    return Processors()
Exemplo n.º 41
0
def instance():
    import sys
    if whereis_exe('xdg-open'):
        return LinuxEmail()
    sys.stderr.write("xdg-open not found.")
    return Email()
Exemplo n.º 42
0
def instance():
    import sys
    if whereis_exe('lshw'):
        return LinuxUniqueID()
    sys.stderr.write("lshw not found.")
    return UniqueID()
Exemplo n.º 43
0
def instance():
    import sys
    if whereis_exe('upower'):
        return LinuxBattery()
    sys.stderr.write("upower not found.")
    return Battery()
Exemplo n.º 44
0
def instance():
    if whereis_exe('screencapture'):
        return OSXScreenshot()
    else:
        return Screenshot()