-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from Integration-Automation/dev
Dev
- Loading branch information
Showing
20 changed files
with
287 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
51 changes: 51 additions & 0 deletions
51
je_editor/pyside_ui/main_ui/ipython_widget/rich_jupyter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import IPython | ||
from IPython.lib import guisupport | ||
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel | ||
|
||
from je_editor.utils.multi_language.multi_language_wrapper import language_wrapper | ||
|
||
if TYPE_CHECKING: | ||
from je_editor.pyside_ui.main_ui.main_editor import EditorMain | ||
|
||
|
||
class IpythonWidget(QWidget): | ||
def __init__(self, main_window: EditorMain): | ||
super().__init__() | ||
self.grid_layout = QGridLayout() | ||
self.ipython_enable = False | ||
try: | ||
from qtconsole.inprocess import QtInProcessKernelManager | ||
from qtconsole.rich_jupyter_widget import RichJupyterWidget | ||
app = guisupport.get_app_qt4() | ||
kernel_manager = QtInProcessKernelManager() | ||
kernel_manager.start_kernel() | ||
kernel = kernel_manager.kernel | ||
kernel.gui = "qt" | ||
kernel_client = kernel_manager.client() | ||
kernel_client.start_channels() | ||
control = RichJupyterWidget() | ||
control.kernel_manager = kernel_manager | ||
control.kernel_client = kernel_client | ||
|
||
def stop(): | ||
kernel_client.stop_channels() | ||
kernel_manager.shutdown_kernel() | ||
self.close() | ||
|
||
control.exit_requested.connect(stop) | ||
self.show_widget = control | ||
self.grid_layout.addWidget(self.show_widget, 0, 0, -1, -1) | ||
guisupport.start_event_loop_qt4(app) | ||
except ImportError: | ||
self.ipython_enable = False | ||
self.show_widget = QLabel(language_wrapper.language_word_dict.get("please_install_qtcontsole_label")) | ||
self.grid_layout.addWidget(self.show_widget) | ||
|
||
self.setLayout(self.grid_layout) | ||
|
||
def close(self): | ||
super().close() |
Oops, something went wrong.