示例#1
0
文件: __init__.py 项目: pbx/kupfer
def _extend_path():
    # Inside a function to not leak variables to module namespace
    import os
    from kupfer import config
    from kupfer import pretty

    if not config.has_capability("CUSTOM_PLUGINS"):
        return

 # Add plugins in data directories
    __path__.extend(config.get_data_dirs("plugins"))

    # Add .zip files in plugins directories
    for directory in list(__path__):
        try:
            filenames = os.listdir(directory)
        except OSError, error:
            pretty.print_error(__name__, error)
            continue
        zipnames = [f for f in filenames if f.endswith(".zip")]
        if zipnames:
            pretty.print_debug(__name__, "Adding", directory, zipnames)
        __path__.extend(os.path.join(directory, z) for z in zipnames)
示例#2
0
文件: __init__.py 项目: guns/kupfer
def _extend_path():
    # Inside a function to not leak variables to module namespace
    import os
    from kupfer import config
    from kupfer import pretty

    if not config.has_capability("CUSTOM_PLUGINS"):
        return

    # Add plugins in data directories
    __path__.extend(config.get_data_dirs("plugins"))

    # Add .zip files in plugins directories
    for directory in list(__path__):
        try:
            filenames = os.listdir(directory)
        except OSError as error:
            pretty.print_error(__name__, error)
            continue
        zipnames = [f for f in filenames if f.endswith(".zip")]
        if zipnames:
            pretty.print_debug(__name__, "Adding", directory, zipnames)
        __path__.extend(os.path.join(directory, z) for z in zipnames)
示例#3
0
	def should_use_cache(self):
		return config.has_capability("CACHE")
示例#4
0
def allows_keybinder():
    return config.has_capability("KEYBINDER") and not is_wayland()
示例#5
0
import gi
from gi.repository import GObject

from kupfer import pretty
from kupfer import config

KEYBINDING_DEFAULT = 1
KEYBINDING_MAGIC = 2

KEYRANGE_RESERVED = (3, 0x1000)
KEYRANGE_TRIGGERS = (0x1000, 0x2000)

Keybinder = None
if config.has_capability("KEYBINDER"):
    try:
        gi.require_version("Keybinder", "3.0")
    except ValueError:
        pretty.print_debug(__name__, "Keybinder 3.0 not available in gi")
    else:
        from gi.repository import Keybinder
        Keybinder.init()
else:
    pretty.print_debug(__name__, "Keybinder disabled")

_keybound_object = None


def GetKeyboundObject():
    """Get the shared instance"""
    global _keybound_object
    if not _keybound_object:
示例#6
0
def allows_keybinder():
    return config.has_capability("KEYBINDER") and not is_wayland()
示例#7
0
文件: sources.py 项目: guns/kupfer
 def should_use_cache(cls):
     return config.has_capability("CACHE")