Skip to content

Commit

Permalink
Merge from 2.3: Fix for issues #2593 and #2517
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Aug 23, 2015
2 parents 26c5565 + 5fdca68 commit 3f0f76e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
34 changes: 17 additions & 17 deletions spyderlib/plugins/ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions spyderlib/widgets/dicteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
19 changes: 14 additions & 5 deletions spyderlib/widgets/externalshell/namespacebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3f0f76e

Please sign in to comment.