From 5b7ee5d3823a467ddf26cebae301c5c93f3ef1f1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 25 Sep 2014 08:34:20 +0200 Subject: [PATCH] More HACKING updates. --- doc/HACKING.asciidoc | 9 +++------ doc/TODO | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/doc/HACKING.asciidoc b/doc/HACKING.asciidoc index a8a31a356..8eb4bcc16 100644 --- a/doc/HACKING.asciidoc +++ b/doc/HACKING.asciidoc @@ -295,7 +295,7 @@ mainly intended for debugging. A new object can be registered by using +objreg.register(_name_, _object_[, scope=_scope_])+. An object should not be -registered twice. To update it, `update=True` has to been passed. +registered twice. To update it, `update=True` has to be given. An object can be retrieved by using +objreg.get(_name_[, scope=_scope_])+. The default scope is `global`. @@ -372,15 +372,12 @@ support a count which will be passed in the argument. If the function is a method of a class, the `@cmdutils.register` decorator needs to have an `instance=...` parameter which points to the (single/main) -instance of the class. Registering commands with multiple instances is not -supported. For an example on how to solve that problem, see -`qutebrowser.browser.command` which dispatches commands to the currently active -tab. +instance of the class. The `instance` parameter is the name of an object in the object registry, which then gets passed as the `self` parameter to the handler. The `scope` argument selects which object registry (global, per-tab, etc.) to use. See the -<> section for details. +<> section for details. There are also other arguments to customize the way the command is registered, see the class documentation for `register` in `qutebrowser.commands.utils` for diff --git a/doc/TODO b/doc/TODO index 1b19d56cf..e27d5f0cf 100644 --- a/doc/TODO +++ b/doc/TODO @@ -130,12 +130,11 @@ style enum/namedtuple). - Config init and some persistent objects should be moved out of QApplication. - Use separate logger for config -- Make more stuff private -- Don't keep references to parent QObjects! - Use unittest.Mock and especially unittest.patch more. - Use decorators for on_config_changed - Will also make it easier to implement section-changed handlers for :reload +- Check where using signals would be better than objreg.get. dwb keybindings to possibly implement =====================================