def option_changed(self, option, value): """Option has changed""" setattr(self, to_text_string(option), value) if not self.is_internal_shell: settings = self.get_view_settings() communicate(self._get_sock(), 'set_remote_view_settings()', settings=[settings])
def option_changed(self, option, value): """Option has changed""" setattr(self, to_text_string(option), value) if self.is_ipyclient: self.shellwidget.set_namespace_view_settings() self.refresh_table() else: settings = self.get_view_settings() communicate(self._get_sock(), 'set_remote_view_settings()', settings=[settings])
def refresh_table(self): """Refresh variable table""" if self.is_visible and self.isVisible(): if self.is_ipyclient: self.shellwidget.refresh_namespacebrowser() else: if self.shellwidget.is_running(): sock = self._get_sock() if sock is None: return try: communicate(sock, "refresh()") except socket.error: # Process was terminated before calling this method pass
def is_data_frame(self, name): """Return True if variable is a DataFrame""" if self.is_ipyclient: return self.var_properties[name]['is_data_frame'] else: return communicate(self._get_sock(), "isinstance(globals()['%s'], DataFrame)" % name)
def is_list(self, name): """Return True if variable is a list or a tuple""" if self.is_ipyclient: return self.var_properties[name]['is_list'] else: return communicate(self._get_sock(), 'isinstance(%s, (tuple, list))' % name)
def is_series(self, name): """Return True if variable is a Series""" if self.is_ipyclient: return self.var_properties[name]['is_series'] else: return communicate(self._get_sock(), "isinstance(globals()['%s'], Series)" % name)
def get_value(self, name): value = monitor_get_global(self._get_sock(), name) if value is None: if communicate(self._get_sock(), '%s is not None' % name): import pickle msg = to_text_string(_("Object <b>%s</b> is not picklable") % name) raise pickle.PicklingError(msg) return value
def get_value(self, name): value = monitor_get_global(self._get_sock(), name) if value is None: if communicate(self._get_sock(), '%s is not None' % name): import pickle msg = to_text_string( _("Object <b>%s</b> is not picklable") % name) raise pickle.PicklingError(msg) return value
def refresh_table(self): """Refresh variable table""" if self.is_visible and self.isVisible(): if self.is_internal_shell: # Internal shell wsfilter = self.get_internal_shell_filter('editable') self.editor.set_filter(wsfilter) interpreter = self.shellwidget.interpreter if interpreter is not None: self.editor.set_data(interpreter.namespace) self.editor.adjust_columns() elif self.shellwidget.is_running(): # import time; print >>STDOUT, time.ctime(time.time()), "Refreshing namespace browser" sock = self._get_sock() if sock is None: return try: communicate(sock, "refresh()") except socket.error: # Process was terminated before calling this method pass
def get_value(self, name): if self.is_ipyclient: value = self.shellwidget.get_value(name) # Reset temporal variable where value is saved to # save memory self.shellwidget._kernel_value = None else: value = monitor_get_global(self._get_sock(), name) if value is None: if communicate(self._get_sock(), '%s is not None' % name): import pickle msg = to_text_string(_("Object <b>%s</b> is not picklable") % name) raise pickle.PicklingError(msg) return value
def get_value(self, name): if self.is_ipyclient: value = self.shellwidget.get_value(name) # Reset temporal variable where value is saved to # save memory self.shellwidget._kernel_value = None else: value = monitor_get_global(self._get_sock(), name) if value is None: if communicate(self._get_sock(), '%s is not None' % name): import pickle msg = to_text_string( _("Object <b>%s</b> is not picklable") % name) raise pickle.PicklingError(msg) return value
def is_array(self, name): """Return True if variable is a NumPy array""" return communicate(self._get_sock(), 'is_array("%s")' % name)
def is_dict(self, name): """Return True if variable is a dictionary""" return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
def get_len(self, name): """Return sequence length""" return communicate(self._get_sock(), "len(%s)" % name)
def is_array(self, name): """Return True if variable is a NumPy array""" if self.is_ipyclient: return self.var_properties[name]['is_array'] else: return communicate(self._get_sock(), 'is_array("%s")' % name)
def is_series(self, name): """Return True if variable is a Series""" return communicate(self._get_sock(), "isinstance(globals()['%s'], Series)" % name)
def get_array_ndim(self, name): """Return array's ndim""" return communicate(self._get_sock(), "%s.ndim" % name)
def get_len(self, name): """Return sequence length""" if self.is_ipyclient: return self.var_properties[name]['len'] else: return communicate(self._get_sock(), "len(%s)" % name)
def is_data_frame(self, name): """Return True if variable is a DataFrame""" return communicate(self._get_sock(), "isinstance(globals()['%s'], DataFrame)" % name)
def get_array_shape(self, name): """Return array's shape""" if self.is_ipyclient: return self.var_properties[name]['array_shape'] else: return communicate(self._get_sock(), "%s.shape" % name)
def is_image(self, name): """Return True if variable is a PIL.Image image""" return communicate(self._get_sock(), 'is_image("%s")' % name)
def toggle_auto_refresh(self, state): """Toggle auto refresh state""" self.autorefresh = state if not self.setup_in_progress and not self.is_ipyclient: communicate(self._get_sock(), "set_monitor_auto_refresh(%r)" % state)
def is_dict(self, name): """Return True if variable is a dictionary""" if self.is_ipyclient: return self.var_properties[name]['is_dict'] else: return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
def get_array_shape(self, name): """Return array's shape""" return communicate(self._get_sock(), "%s.shape" % name)
def is_list(self, name): """Return True if variable is a list or a tuple""" return communicate(self._get_sock(), 'isinstance(%s, (tuple, list))' % name)
def is_image(self, name): """Return True if variable is a PIL.Image image""" if self.is_ipyclient: return self.var_properties[name]['is_image'] else: return communicate(self._get_sock(), 'is_image("%s")' % name)
def get_array_ndim(self, name): """Return array's ndim""" if self.is_ipyclient: return self.var_properties[name]['array_ndim'] else: return communicate(self._get_sock(), "%s.ndim" % name)
def toggle_auto_refresh(self, state): """Toggle auto refresh state""" self.autorefresh = state if not self.setup_in_progress and not self.is_internal_shell: communicate(self._get_sock(), "set_monitor_auto_refresh(%r)" % state)