-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Refactor inter-plugin callback handling #1332
Conversation
77d8bf6
to
1accd27
Compare
😠 Gonna kick out Python 3.6 soon-ish. 🏈 Edit: Worked around it by not introducing a Generic at all. Curious how long that'll hold... |
23cedca
to
eca0de7
Compare
eca0de7
to
eaa4984
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I could not understand what you were doing at first but figured it out. It is definitely an improvement over the callback, not sure how these will work out in the long run but we'll see 😄 .
In general ok just a couple questions and comments.
|
||
if ret is not None: | ||
args = ret | ||
def get_loaded_plugins(self, protocol: Type[_U]) -> Iterable[_U]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name because it does a bit more than just get loaded plugins, it get loaded plugins with a certain class. But I can't think of a better one...
elif isinstance(service, SerialService) and 'PPPSupport' in self.parent.Plugins.get_loaded(): | ||
if any(plugin.service_connect_handler(service, ok, err) | ||
for plugin in self.parent.Plugins.get_loaded_plugins(ServiceConnectHandler)): | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For alls these any() I find this very hard to read because the if continues on a new line.
Use mixins for dynamically defining functionality instead of dynamically adding it to / removing it from the AppletPlugin and dynamically calling it. PluginManager now only provides a convenience way of getting loaded plugins that are instances of a specific mixin and calls are done directly without any necessity for fancy call handling as the caller can do whatever it wants to do directly.
* Move logic from PowerManager.on_power_state_query into update_power_state. * Move logic from StatusIcon.on_power_state_changed into PowerManager.update_power_state, similar to what ShowConnected does. PowerManager depends on StatusIcons, so this is fine. * Drop PowerManager.on_power_state_change_requested which has no effect. * Drop SerialManager.rfcomm_connect_handler as its logic is already present in DBusService.connect_service.
eaa4984
to
a7ccce0
Compare
a7ccce0
to
2aa0378
Compare
Use mixins for dynamically defining functionality instead of dynamically adding it to / removing it from the AppletPlugin and dynamically calling it. PluginManager now only provides a convenience way of getting loaded plugins that are instances of a specific mixin and calls are done directly without any necessity for fancy call handling as the caller can do whatever it wants to do directly.
Depends on #1329 (due to many conflicting code locations) and currently does not work due to circular dependencies at least between StatusIcon and PowerManager.