Exemple #1
0
 def option_changed(self, option, value):
     """Option has changed"""
     setattr(self, unicode(option), value)
     if not self.is_internal_shell:
         settings = self.get_view_settings()
         communicate(self._get_sock(),
                     'set_remote_view_settings()', settings=[settings])
Exemple #2
0
 def set_autorefresh_timeout(self, interval):
     if self.introspection_socket is not None:
         try:
             communicate(self.introspection_socket,
                         "set_monitor_timeout(%d)" % interval)
         except socket.error:
             pass
Exemple #3
0
 def set_autorefresh_timeout(self, interval):
     if self.introspection_socket is not None:
         try:
             communicate(self.introspection_socket,
                         "set_monitor_timeout(%d)" % interval)
         except socket.error:
             pass
Exemple #4
0
 def set_introspection_socket(self, introspection_socket):
     self.introspection_socket = introspection_socket
     if self.namespacebrowser is not None:
         settings = self.namespacebrowser.get_view_settings()
         communicate(introspection_socket,
                     'set_remote_view_settings()',
                     settings=[settings])
Exemple #5
0
 def option_changed(self, option, value):
     """Option has changed"""
     setattr(self, unicode(option), value)
     if not self.is_internal_shell:
         settings = self.get_view_settings()
         communicate(self._get_sock(),
                     'set_remote_view_settings()',
                     settings=[settings])
Exemple #6
0
 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 = unicode(_("Object <b>%s</b> is not picklable") % name)
             raise pickle.PicklingError(msg)
     return value
Exemple #7
0
 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 = unicode(_("Object <b>%s</b> is not picklable") % name)
             raise pickle.PicklingError(msg)
     return value
Exemple #8
0
 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                
Exemple #9
0
 def ask_monitor(self, command, settings=[]):
     sock = self.externalshell.introspection_socket
     if sock is None:
         return
     try:
         return communicate(sock, command, settings=settings)
     except socket.error:
         # Process was just closed
         pass
     except MemoryError:
         # Happens when monitor is not ready on slow machines
         pass
Exemple #10
0
 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
Exemple #11
0
 def ask_monitor(self, command, settings=[]):
     sock = self.externalshell.introspection_socket
     if sock is None:
         return
     try:
         return communicate(sock, command, settings=settings)
     except socket.error:
         # Process was just closed            
         pass
     except MemoryError:
         # Happens when monitor is not ready on slow machines
         pass
Exemple #12
0
    def send_to_process(self, text):
        if not self.is_running():
            return

        if not isinstance(text, basestring):
            text = unicode(text)
        if self.install_qt_inputhook and self.introspection_socket is not None:
            communicate(self.introspection_socket,
                        "toggle_inputhook_flag(True)")
#            # Socket-based alternative (see input hook in sitecustomize.py):
#            while self.local_server.hasPendingConnections():
#                self.local_server.nextPendingConnection().write('go!')
        if text.startswith(('%', '!')):
            text = 'evalsc(r"%s")\n' % text
        if not text.endswith('\n'):
            text += '\n'
        self.process.write(locale_codec.fromUnicode(text))
        self.process.waitForBytesWritten(-1)

        # Eventually write prompt faster (when hitting Enter continuously)
        # -- necessary/working on Windows only:
        if os.name == 'nt':
            self.write_error()
Exemple #13
0
    def send_to_process(self, text):
        if not self.is_running():
            return
            
        if not isinstance(text, basestring):
            text = unicode(text)
        if self.install_qt_inputhook and self.introspection_socket is not None:
            communicate(self.introspection_socket,
                        "toggle_inputhook_flag(True)")
#            # Socket-based alternative (see input hook in sitecustomize.py):
#            while self.local_server.hasPendingConnections():
#                self.local_server.nextPendingConnection().write('go!')
        if text.startswith(('%', '!')):
            text = 'evalsc(r"%s")\n' % text
        if not text.endswith('\n'):
            text += '\n'
        self.process.write(locale_codec.fromUnicode(text))
        self.process.waitForBytesWritten(-1)
        
        # Eventually write prompt faster (when hitting Enter continuously)
        # -- necessary/working on Windows only:
        if os.name == 'nt':
            self.write_error()
Exemple #14
0
 def is_array(self, name):
     """Return True if variable is a NumPy array"""
     return communicate(self._get_sock(), 'is_array("%s")' % name)
Exemple #15
0
 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)
Exemple #16
0
 def keyboard_interrupt(self):
     if self.introspection_socket is not None:
         communicate(self.introspection_socket, "thread.interrupt_main()")
Exemple #17
0
 def keyboard_interrupt(self):
     if self.introspection_socket is not None:
         communicate(self.introspection_socket, "thread.interrupt_main()")
Exemple #18
0
 def get_array_shape(self, name):
     """Return array's shape"""
     return communicate(self._get_sock(), "%s.shape" % name)
Exemple #19
0
 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)
Exemple #20
0
 def is_array(self, name):
     """Return True if variable is a NumPy array"""
     return communicate(self._get_sock(), 'is_array("%s")' % name)
Exemple #21
0
 def is_dict(self, name):
     """Return True if variable is a dictionary"""
     return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
Exemple #22
0
 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)
Exemple #23
0
 def get_len(self, name):
     """Return sequence length"""
     return communicate(self._get_sock(), "len(%s)" % name)
Exemple #24
0
 def is_dict(self, name):
     """Return True if variable is a dictionary"""
     return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
Exemple #25
0
 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)
Exemple #26
0
 def is_image(self, name):
     """Return True if variable is a PIL.Image image"""
     return communicate(self._get_sock(), 'is_image("%s")' % name)
Exemple #27
0
 def get_len(self, name):
     """Return sequence length"""
     return communicate(self._get_sock(), "len(%s)" % name)
Exemple #28
0
 def get_array_shape(self, name):
     """Return array's shape"""
     return communicate(self._get_sock(), "%s.shape" % name)
Exemple #29
0
 def is_image(self, name):
     """Return True if variable is a PIL.Image image"""
     return communicate(self._get_sock(), 'is_image("%s")' % name)
Exemple #30
0
 def get_array_ndim(self, name):
     """Return array's ndim"""
     return communicate(self._get_sock(), "%s.ndim" % name)
Exemple #31
0
 def get_array_ndim(self, name):
     """Return array's ndim"""
     return communicate(self._get_sock(), "%s.ndim" % name)
Exemple #32
0
 def set_introspection_socket(self, introspection_socket):
     self.introspection_socket = introspection_socket
     if self.namespacebrowser is not None:
         settings = self.namespacebrowser.get_view_settings()
         communicate(introspection_socket,
                     'set_remote_view_settings()', settings=[settings])