Skip to content
Snippets Groups Projects
Commit fbea97bb authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Add IPython console plugin to workbench

Also fix minor style issues is messagedisplay.
Refs #21251
parent 844de0df
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
from __future__ import absolute_import
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QDockWidget, QWidget
from qtpy.QtWidgets import QDockWidget, QMainWindow, QWidget
class PluginWidget(QWidget):
......@@ -29,7 +29,9 @@ class PluginWidget(QWidget):
def __init__(self, main_window):
QWidget.__init__(self, main_window)
assert isinstance(main_window, QMainWindow)
self.dockwidget = None
self.main = main_window
# ----------------- Plugin API --------------------
......@@ -50,4 +52,13 @@ class PluginWidget(QWidget):
dock.setAllowedAreas(self.ALLOWED_AREAS)
dock.setFeatures(self.FEATURES)
dock.setWidget(self)
self.dockwidget = dock
return dock, self.LOCATION
def toggle_view(self, checked):
"""Toggle view visible or hidden"""
if checked:
self.dockwidget.show()
self.dockwidget.raise_()
else:
self.dockwidget.hide()
# This file is part of the mantid workbench.
#
# Copyright (C) 2017 mantidproject
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, unicode_literals)
# system imports
# third-party library imports
from mantidqt.widgets.ipythonconsole import InProcessIPythonConsole
from qtpy.QtWidgets import QVBoxLayout
# local package imports
from workbench.plugins.base import PluginWidget
class IPythonConsole(PluginWidget):
"""Provides an in-process IPython console"""
def __init__(self, parent):
super(IPythonConsole, self).__init__(parent)
# layout
self.console = InProcessIPythonConsole(self)
layout = QVBoxLayout()
layout.addWidget(self.console)
self.setLayout(layout)
# ----------------- Plugin API --------------------
def register_plugin(self):
self.main.add_dockwidget(self)
def get_plugin_title(self):
return "IPython"
......@@ -14,18 +14,20 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from __future__ import (absolute_import, unicode_literals)
# 3rdparty imports
from mantidqt.widgets.messagedisplay import MessageDisplay
from qtpy.QtWidgets import QHBoxLayout
# local imports
from workbench.plugins.base import PluginWidget
class LogMessageDisplay(PluginWidget):
def __init__(self, parent):
PluginWidget.__init__(self, parent)
super(LogMessageDisplay, self).__init__(parent)
# layout
self.display = MessageDisplay(parent)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment