A better fix for the preferences dialog
This commit is contained in:
parent
f942d4ee43
commit
76f35aee85
|
@ -151,31 +151,6 @@ class Preferences(component.Component):
|
||||||
if self.iter_to_remove != None:
|
if self.iter_to_remove != None:
|
||||||
self.liststore.remove(self.iter_to_remove)
|
self.liststore.remove(self.iter_to_remove)
|
||||||
|
|
||||||
def _on_get_config(self, config):
|
|
||||||
log.debug("on_get_config: %s", config)
|
|
||||||
self.core_config = config
|
|
||||||
self.__wait_to_show -= 1
|
|
||||||
if not self.__wait_to_show:
|
|
||||||
self._show()
|
|
||||||
|
|
||||||
def _on_get_available_plugins(self, plugins):
|
|
||||||
self.all_plugins = plugins
|
|
||||||
self.__wait_to_show -= 1
|
|
||||||
if not self.__wait_to_show:
|
|
||||||
self._show()
|
|
||||||
|
|
||||||
def _on_get_enabled_plugins(self, plugins):
|
|
||||||
self.enabled_plugins = plugins
|
|
||||||
self.__wait_to_show -= 1
|
|
||||||
if not self.__wait_to_show:
|
|
||||||
self._show()
|
|
||||||
|
|
||||||
def _on_get_listen_port(self, port):
|
|
||||||
self.active_port = port
|
|
||||||
self.__wait_to_show -= 1
|
|
||||||
if not self.__wait_to_show:
|
|
||||||
self._show()
|
|
||||||
|
|
||||||
def show(self, page=None):
|
def show(self, page=None):
|
||||||
"""Page should be the string in the left list.. ie, 'Network' or 'Bandwidth'"""
|
"""Page should be the string in the left list.. ie, 'Network' or 'Bandwidth'"""
|
||||||
if page != None:
|
if page != None:
|
||||||
|
@ -187,14 +162,24 @@ class Preferences(component.Component):
|
||||||
# Update the preferences dialog to reflect current config settings
|
# Update the preferences dialog to reflect current config settings
|
||||||
self.core_config = {}
|
self.core_config = {}
|
||||||
if client.connected():
|
if client.connected():
|
||||||
# We use a counter to know when to show the dialog
|
def _on_get_config(config):
|
||||||
self.__wait_to_show = 4
|
self.core_config = config
|
||||||
client.core.get_config().addCallback(self._on_get_config)
|
client.core.get_available_plugins().addCallback(_on_get_available_plugins)
|
||||||
client.core.get_available_plugins().addCallback(self._on_get_available_plugins)
|
|
||||||
client.core.get_enabled_plugins().addCallback(self._on_get_enabled_plugins)
|
def _on_get_available_plugins(plugins):
|
||||||
client.core.get_listen_port().addCallback(self._on_get_listen_port)
|
self.all_plugins = plugins
|
||||||
# Force these calls and block until we've done them all
|
client.core.get_enabled_plugins().addCallback(_on_get_enabled_plugins)
|
||||||
client.force_call()
|
|
||||||
|
def _on_get_enabled_plugins(plugins):
|
||||||
|
self.enabled_plugins = plugins
|
||||||
|
client.core.get_listen_port().addCallback(_on_get_listen_port)
|
||||||
|
|
||||||
|
def _on_get_listen_port(port):
|
||||||
|
self.active_port = port
|
||||||
|
self._show()
|
||||||
|
|
||||||
|
# This starts a series of client.core requests prior to showing the window
|
||||||
|
client.core.get_config().addCallback(_on_get_config)
|
||||||
|
|
||||||
def _show(self):
|
def _show(self):
|
||||||
if self.core_config != {} and self.core_config != None:
|
if self.core_config != {} and self.core_config != None:
|
||||||
|
|
Loading…
Reference in New Issue