Пример #1
0
    def notify_dbus(self, option):
        from .options import OptionItem
        for location in self.locations:
            value = option.value
            if isinstance(option, OptionItem):
                signal = 'CONFIG_CHANGED'
            else:
                signal = 'CONFIG_EXTRA_CHANGED'
                if option.no_submit:
                    value = None

            message = SignalMessage(self.dbus_path, self.dbus_ns, signal)
            signature = 'ssv'
            if isinstance(value, dict) and not len(value):
                # emptry dicts can't be detected
                signature = 'a{ss}'
            elif isinstance(value, (tuple, list)) and not len(value):
                # empty lists can't be detected, so we assume
                # list of strings
                signature = "ssas"

            message.append(workspace_name(),
                           option.name,
                           value,
                           signature=signature)
            location[0].send_message(message)
Пример #2
0
    def notify_dbus(self, option):
        from .options import OptionItem
        for location in self.locations:
            value = option.value
            if isinstance(option, OptionItem):
                signal = 'CONFIG_CHANGED'
            else:
                signal = 'CONFIG_EXTRA_CHANGED'
                if option.no_submit:
                    value = None

            message = SignalMessage(self.dbus_path,
                                    self.dbus_ns,
                                    signal)
            signature = 'ssv'
            if isinstance(value, dict) and not len(value):
                # emptry dicts can't be detected
                signature = 'a{ss}'
            elif isinstance(value, (tuple, list)) and not len(value):
                # empty lists can't be detected, so we assume
                # list of strings
                signature = "ssas"

            message.append(workspace_name(),
                           option.name,
                           value,
                           signature=signature)
            location[0].send_message(message)
Пример #3
0
    def get_instance_status(self):

        return dumps({
            'pid': os.getpid(),
            'workspace': workspace_name(),
            'buffers': self.svc.boss.cmd('buffer', 'get_buffer_names'),
            'project': getattr(
                self.svc.boss.cmd('project','get_current_project'),
                'name', ''),
            }, indent=2)
Пример #4
0
    def on_config_changed(self, workspace, name, value, sender=None):
        if sender == BUS.get_unique_name():
            return
        try:
            opt = self.get_option(str(name))
        except KeyError as e:
            return

        if (opt.workspace and workspace_name() == workspace) or \
           not opt.workspace:

            self.set_value(name, value, save=False, dbus_notify=False)
Пример #5
0
 def update_title(self, document=None):
     if self._title_template is None:
         self._title_template = string.Template(self.opt('window_title'))
     if document is None:
         document = self.boss.cmd('buffer', 'get_current')
     
     subs = {'basename': document.basename or _('New Document'),
             'filepath': document.filename or _('New Document'),
             'directory': document.directory or '',
             'workspace': workspace_name(),
             'project_path': document.project and document.project.data_dir or '',
             'project_name': document.project_name
            }
     
     self.window.set_title(self._title_template.safe_substitute(subs))
Пример #6
0
 def create_ui(self):
     console = Console(locals=self.svc.get_local_dict(),
                       banner=_("PIDA Shell. Keep breathing."),
                       use_rlcompleter=False)
     sw = gtk.ScrolledWindow()
     sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     sw.add(console)
     sw.show_all()
     self.add_main_widget(sw)
     for path in (py.path.local(__file__).dirpath() / "manholerc.py",
                  home() / "manhole.rc",
                  home() / ("manhole.%s.rc" % workspace_name())):
         if path.check():
             #console.do_raw_input(line)
             console.execfile(str(path))
Пример #7
0
class DbusOptionsManagerReal(Object):
    __dbus_mapping = {
        bool: 'b',
        str: 's',
        unicode: 's',
        int: 'i',
        long: 'x',
        float: 'd',
        list: 'as',
        file: 's',
        Font: 's',
    }

    dbus_no_activate = ()

    def __init__(self, service):
        self.svc = service
        path = DBUS_PATH(service.get_name(), self.dbus_path)
        ns = DBUS_NS(service.get_name(), self.dbus_path)
        self.dbus_ns = ns
        self.dbus_path = path
        Object.__init__(self, BUS_NAME, path)
        self.config_match = BUS.add_signal_receiver(
                                self.on_config_changed, 'CONFIG_CHANGED',
                                ns, None, path, sender_keyword='sender')
        self.config_extra_match = BUS.add_signal_receiver(
                                self.on_config_changed_extra,
                                'CONFIG_EXTRA_CHANGED',
                                ns, None, path, sender_keyword='sender')

    def unload(self):
        self.config_match.remove()
        self.config_extra_match.remove()
        self.remove_from_connection()

    def on_config_changed(self, workspace, name, value, sender=None):
        if sender == BUS.get_unique_name():
            return
        try:
            opt = self.get_option(str(name))
        except KeyError, e:
            return
        from .options import ExtraOptionItem
        if (opt.workspace and workspace_name() == workspace) or \
           not opt.workspace:

            self.set_value(name, value, save=False, dbus_notify=False)
Пример #8
0
    def update_title(self, document=None):
        if self._title_template is None:
            self._title_template = string.Template(self.opt('window_title'))
        if document is None:
            document = self.boss.cmd('buffer', 'get_current')

        subs = {
            'basename': document.basename or _('New Document'),
            'filepath': document.filename or _('New Document'),
            'directory': document.directory or '',
            'workspace': workspace_name(),
            'project_path': document.project and document.project.data_dir
            or '',
            'project_name': document.project_name
        }

        self.window.set_title(self._title_template.safe_substitute(subs))
Пример #9
0
 def state_config(self):
     return settings_dir().join('workspaces', workspace_name(), "window.state.json")
Пример #10
0
 def state_config(self):
     return settings_dir().join('workspaces', workspace_name(),
                                "window.state.json")
Пример #11
0
def prio_path():
    return environment.settings_dir().join(
        'workspaces', environment.workspace_name(),
        'language_extra_plugin_priorities.json')
Пример #12
0
 def get_workspace_name(self):
     return workspace_name()
Пример #13
0
        except KeyError, e:
            return
        from .options import ExtraOptionItem
        if (opt.workspace and workspace_name() == workspace) or \
           not opt.workspace:

            self.set_value(name, value, save=False, dbus_notify=False)

    def on_config_changed_extra(self, workspace, name, value, sender=None):
        if sender == BUS.get_unique_name():
            return
        try:
            opt = self.get_extra_option(str(name))
        except KeyError, e:
            return
        if (opt.workspace and workspace_name() == workspace) or \
           not opt.workspace:
            if opt.no_submit:
                opt.dirty = True
            else:
                self.set_extra_value(name, value, save=False, dbus_notify=False)

    def notify_dbus(self, option):
        from .options import OptionItem
        for location in self.locations:
            value = option.value
            if isinstance(option, OptionItem):
                signal = 'CONFIG_CHANGED'
            else:
                signal = 'CONFIG_EXTRA_CHANGED'
                if option.no_submit: