Ejemplo n.º 1
0
 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])
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 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)
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
 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)