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 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 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 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 try: self.editor.resizeRowToContents() except TypeError: pass
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 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""" if self.is_ipyclient: return self.var_properties[name]['is_image'] else: return communicate(self._get_sock(), 'is_image("%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 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_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 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)