示例#1
0
def add_distributed_notifications(nsd_config):
    dist_center = NSDistributedNotificationCenter.defaultCenter()
    for event in nsd_config:
        event_config = nsd_config[event]
        add_distributed_notification(event, event_config, dist_center)
    
    log_list("Listening for these NSDistributedNotifications: %s", nsd_config.keys())
示例#2
0
def add_distributed_notifications(nsd_config):
    dist_center = NSDistributedNotificationCenter.defaultCenter()
    for event in nsd_config:
        event_config = nsd_config[event]
        add_distributed_notification(event, event_config, dist_center)

    log_list("Listening for these NSDistributedNotifications: %s",
             nsd_config.keys())
示例#3
0
def do_relaunch(command, context=None, **kwargs):
    # command=process name
    # kwargs["config"]["event_data"]=original event
    # kwargs["config"]["event_config"]=original event_config
    event=kwargs["config"]["event"]
    event_config=kwargs["config"]["event_config"]
    if 'user_info' in kwargs:
        if 'NSApplicationName' in kwargs['user_info']:
            if kwargs['user_info']['NSApplicationName'] == event_config["process"]:
                logging.info("%s: reloading handler %s" % (context, event))
                dist_center = NSDistributedNotificationCenter.defaultCenter()
                add_distributed_notification(event, event_config, dist_center)
示例#4
0
def do_relaunch(command, context=None, **kwargs):
    # command=process name
    # kwargs["config"]["event_data"]=original event
    # kwargs["config"]["event_config"]=original event_config
    event = kwargs["config"]["event"]
    event_config = kwargs["config"]["event_config"]
    if 'user_info' in kwargs:
        if 'NSApplicationName' in kwargs['user_info']:
            if kwargs['user_info']['NSApplicationName'] == event_config[
                    "process"]:
                logging.info("%s: reloading handler %s" % (context, event))
                dist_center = NSDistributedNotificationCenter.defaultCenter()
                add_distributed_notification(event, event_config, dist_center)