Beispiel #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])
Beispiel #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
Beispiel #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
Beispiel #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])
Beispiel #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])
Beispiel #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
Beispiel #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
Beispiel #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                
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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()
Beispiel #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()
Beispiel #14
0
 def is_array(self, name):
     """Return True if variable is a NumPy array"""
     return communicate(self._get_sock(), 'is_array("%s")' % name)
Beispiel #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)
Beispiel #16
0
 def keyboard_interrupt(self):
     if self.introspection_socket is not None:
         communicate(self.introspection_socket, "thread.interrupt_main()")
Beispiel #17
0
 def keyboard_interrupt(self):
     if self.introspection_socket is not None:
         communicate(self.introspection_socket, "thread.interrupt_main()")
Beispiel #18
0
 def get_array_shape(self, name):
     """Return array's shape"""
     return communicate(self._get_sock(), "%s.shape" % name)
Beispiel #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)
Beispiel #20
0
 def is_array(self, name):
     """Return True if variable is a NumPy array"""
     return communicate(self._get_sock(), 'is_array("%s")' % name)
Beispiel #21
0
 def is_dict(self, name):
     """Return True if variable is a dictionary"""
     return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
Beispiel #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)
Beispiel #23
0
 def get_len(self, name):
     """Return sequence length"""
     return communicate(self._get_sock(), "len(%s)" % name)
Beispiel #24
0
 def is_dict(self, name):
     """Return True if variable is a dictionary"""
     return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
Beispiel #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)
Beispiel #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)
Beispiel #27
0
 def get_len(self, name):
     """Return sequence length"""
     return communicate(self._get_sock(), "len(%s)" % name)
Beispiel #28
0
 def get_array_shape(self, name):
     """Return array's shape"""
     return communicate(self._get_sock(), "%s.shape" % name)
Beispiel #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)
Beispiel #30
0
 def get_array_ndim(self, name):
     """Return array's ndim"""
     return communicate(self._get_sock(), "%s.ndim" % name)
Beispiel #31
0
 def get_array_ndim(self, name):
     """Return array's ndim"""
     return communicate(self._get_sock(), "%s.ndim" % name)
Beispiel #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])