Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The instance of default appModule needs to be easy accessible #316

Closed
nvaccessAuto opened this issue Jan 1, 2010 · 6 comments
Closed

The instance of default appModule needs to be easy accessible #316

nvaccessAuto opened this issue Jan 1, 2010 · 6 comments
Labels
Milestone

Comments

@nvaccessAuto
Copy link

Reported by aleksey_s on 2009-05-15 16:28
Help on the appModuleHandler says, that @var appModuleHandler.default holds the instance of default appModule, but it isn't so.

steps to reproduce

  • Open NVDA console
  • Type: ```
    import appModuleHandler
    appModuleHandler.default
## Actual results

Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'default'


p.s. I need access to default appModule to bind scripts at runtime for SynthDriver additional settings.
@nvaccessAuto
Copy link
Author

Comment 1 by jteh on 2009-05-16 06:27
Having access to the default appModule isn't actually that useful anymore. It is not a separate level like it used to be. Instead, all appModules subclass it, so you would need to bind your scripts to each appModule as it is used. It seems we need an actual global level for scripts.

@nvaccessAuto
Copy link
Author

Comment 2 by aleksey_s (in reply to comment 1) on 2009-05-16 07:08
Replying to jteh:

Having access to the default appModule isn't actually that useful anymore.

Don't sure. explanation follows.

It is not a separate level like it used to be. Instead, all appModules subclass it, so you would need to bind your scripts to each appModule as it is used.

What a painfull solution :)

It seems we need an actual global level for scripts.

Making yet another level willl not simplify things. Why we can't modify the default appModule class? then modifications/bindings will affect each appModule, as it is subclass of default. So accessing default appModule is actually needed.

@nvaccessAuto
Copy link
Author

Comment 3 by jteh (in reply to comment 2) on 2009-05-17 00:05
Replying to aleksey_s:

Making yet another level willl not simplify things.

Why not? Also, note that the default appModule used to be another level, so we're basically just reintroducing something we removed, bt using it for a different purpose.

Why we can't modify the default appModule class ? then modifications/bindings will affect each appModule, as it is subclass of default.

This actually isn't true. When you bind a key on a subclass, the keyMap dict is copied, so you only get the bindings from the default appModule class at the time the copy occurred. We might be able to work around this by modifying the code to search all bases for scripts. I still believe reintroducing another level is probably the more correct solution; this one is pretty hacky.

So accessing default appModule is actually needed.

Previously, appModuleHandler.default accessed the instance of the default appModule. You're talking about the class, which is a rather different thing; there is no longer an instance of the default appModule. Btw, you can access the class via appModuleHandler._default.AppModule, but this is pretty evil. :)

@nvaccessAuto
Copy link
Author

Comment 4 by aleksey_s (in reply to comment 3) on 2009-05-17 07:11
Replying to jteh:

Why not? Also, note that the default appModule used to be another level, so we're basically just reintroducing something we removed, bt using it for a different purpose.

Ok then, why we removed it earlier? :-)

Why we can't modify the default appModule class ? then modifications/bindings will affect each appModule, as it is subclass of default.

This actually isn't true. When you bind a key on a subclass, the keyMap dict is copied, so you only get the bindings from the default appModule class at the time the copy occurred. We might be able to work around this by modifying the code to search all bases for scripts. I still believe reintroducing another level is probably the more correct solution; this one is pretty hacky.

Agree. I've just suggested approach, which will not affect all existing appModules. If we'll reintroduce global level, appModules will be not subclasses of default.

So accessing default appModule is actually needed.

there is no longer an instance of the default appModule.

I've just nodiced this when revieved appModuleHandler.

Btw, you can access the class via appModuleHandler._default.AppModule, but this is pretty evil. :)

Sure.

So target of this ticket is feature to dynamically bind/unbind scripts on global level as well as another levels.

@nvaccessAuto
Copy link
Author

Comment 5 by mdcurran on 2011-04-06 01:54
Default appModule no longer exists.
However, globalCommands.GlobalCommands is probably what you want.
Changes:
State: closed

@nvaccessAuto
Copy link
Author

Comment 6 by jteh on 2011-04-07 04:10
You should use global plugins to bind global scripts.
Changes:
Milestone changed from None to 2011.1

@nvaccessAuto nvaccessAuto added this to the 2011.1 milestone Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant