diff --git a/spyderlib/plugins/ipythonconsole.py b/spyderlib/plugins/ipythonconsole.py index 465254d9ed2..f6997d16dff 100644 --- a/spyderlib/plugins/ipythonconsole.py +++ b/spyderlib/plugins/ipythonconsole.py @@ -882,7 +882,23 @@ def register_client(self, client, restart=False, give_focus=True): if kernel_widget is None: shellwidget.custom_interrupt_requested.connect( client.interrupt_message) - + + # Connect to our variable explorer + if kernel_widget is not None and self.variableexplorer is not None: + nsb = self.variableexplorer.current_widget() + # When the autorefresh button is active, our kernels + # start to consume more and more CPU during time + # Fix Issue 1450 + # ---------------- + # When autorefresh is off by default we need the next + # line so that kernels don't start to consume CPU + # Fix Issue 1595 + nsb.auto_refresh_button.setChecked(True) + nsb.auto_refresh_button.setChecked(False) + nsb.auto_refresh_button.setEnabled(False) + nsb.set_ipyclient(client) + client.set_namespacebrowser(nsb) + # If we are restarting the kernel we need to rename # the client tab and do no more from here on if restart: @@ -909,22 +925,6 @@ def register_client(self, client, restart=False, give_focus=True): control.set_inspector_enabled(CONF.get('inspector', 'connect/ipython_console')) - # Connect to our variable explorer - if kernel_widget is not None and self.variableexplorer is not None: - nsb = self.variableexplorer.current_widget() - # When the autorefresh button is active, our kernels - # start to consume more and more CPU during time - # Fix Issue 1450 - # ---------------- - # When autorefresh is off by default we need the next - # line so that kernels don't start to consume CPU - # Fix Issue 1595 - nsb.auto_refresh_button.setChecked(True) - nsb.auto_refresh_button.setChecked(False) - nsb.auto_refresh_button.setEnabled(False) - nsb.set_ipyclient(client) - client.set_namespacebrowser(nsb) - # Connect client to our history log if self.historylog is not None: self.historylog.add_history(client.history_filename) diff --git a/spyderlib/widgets/dicteditor.py b/spyderlib/widgets/dicteditor.py index 327e1ab7331..8fcc21c7d09 100644 --- a/spyderlib/widgets/dicteditor.py +++ b/spyderlib/widgets/dicteditor.py @@ -51,7 +51,7 @@ is_text_string, is_binary_string, getcwd, u) -LARGE_NROWS = 5000 +LARGE_NROWS = 100 def display_to_value(value, default_value, ignore_errors=True): @@ -117,7 +117,7 @@ def __setitem__(self, key, value): class ReadOnlyDictModel(QAbstractTableModel): """DictEditor Read-Only Table Model""" - ROWS_TO_LOAD = 200 + ROWS_TO_LOAD = 50 def __init__(self, parent, data, title="", names=False, truncate=True, minmax=False, remote=False): @@ -1289,9 +1289,9 @@ def setup(self, data, title='', readonly=False, width=500, constant = 121 row_height = 30 error_margin = 20 - height = constant + row_height*min([20, datalen]) + error_margin + height = constant + row_height*min([15, datalen]) + error_margin self.resize(width, height) - + self.setWindowTitle(self.widget.get_title()) self.setWindowIcon(icon) # Make the dialog act as a window diff --git a/spyderlib/widgets/externalshell/namespacebrowser.py b/spyderlib/widgets/externalshell/namespacebrowser.py index a562c6946bd..6b8b5e4e914 100644 --- a/spyderlib/widgets/externalshell/namespacebrowser.py +++ b/spyderlib/widgets/externalshell/namespacebrowser.py @@ -252,13 +252,22 @@ def option_changed(self, option, value): settings = self.get_view_settings() communicate(self._get_sock(), 'set_remote_view_settings()', settings=[settings]) - + def visibility_changed(self, enable): - """Notify the widget whether its container (the namespace browser + """Notify the widget whether its container (the namespace browser plugin is visible or not""" - self.is_visible = enable - if enable: - self.refresh_table() + # This is slowing down Spyder a lot if too much data is present in + # the Variable Explorer, and users give focus to it after being hidden. + # This also happens when the Variable Explorer is visible and users + # give focus to Spyder after using another application (like Chrome + # or Firefox). + # That's why we've decided to remove this feature + # Fixes Issue 2593 + # + # self.is_visible = enable + # if enable: + # self.refresh_table() + pass @Slot(bool) def toggle_auto_refresh(self, state):