/usr/share/pyshared/spyderlib/plugins/ipython.py is in python-spyderlib 2.1.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # -*- coding: utf-8 -*-
#
# Copyright © 2011 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""IPython v0.11+ Plugin"""
from spyderlib.qt.QtGui import QHBoxLayout
# Local imports
from spyderlib.widgets.ipython import IPythonApp
from spyderlib.plugins import SpyderPluginWidget
class IPythonPlugin(SpyderPluginWidget):
"""Find in files DockWidget"""
CONF_SECTION = 'ipython'
def __init__(self, parent, connection_file, kernel_widget, kernel_name):
super(IPythonPlugin, self).__init__(parent)
self.connection_file = connection_file
self.kernel_widget = kernel_widget
self.kernel_name = kernel_name
self.ipython_widget = None
# Initialize plugin
self.initialize_plugin()
def toggle(self, state):
"""Toggle widget visibility"""
if self.dockwidget:
self.dockwidget.setVisible(state)
#------ SpyderPluginWidget API ---------------------------------------------
def get_plugin_title(self):
"""Return widget title"""
return "IPython (%s) - Experimental!" % self.kernel_name
def get_focus_widget(self):
"""
Return the widget to give focus to when
this plugin's dockwidget is raised on top-level
"""
return self.ipython_widget._control
def get_plugin_actions(self):
"""Return a list of actions related to plugin"""
return []
def register_plugin(self):
"""Register plugin in Spyder's main window"""
argv = ['--existing']+[self.connection_file]
iapp = self.main.ipython_app
if iapp is None:
self.main.ipython_app = iapp = IPythonApp()
iapp.initialize_all_except_qt(argv=argv)
iapp.parse_command_line(argv=argv)
self.ipython_widget = iapp.new_frontend_from_existing()
layout = QHBoxLayout()
layout.addWidget(self.ipython_widget)
self.setLayout(layout)
self.main.add_dockwidget(self)
def refresh_plugin(self):
"""Refresh widget"""
pass
def closing_plugin(self, cancelable=False):
"""Perform actions before parent main window is closed"""
return True
|