예제 #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])
예제 #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)
예제 #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)
예제 #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)
예제 #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
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)