# Path: pyweed/gui/BaseDialog.py
# class BaseDialog(QtWidgets.QDialog):
#     def __init__(self, parent=None, *args, **kwargs):
#         # On non-Mac platforms, a dialog with a parent will always float above the parent. We want these
#         # windows to be independent, so in that case remove the parent.
#         # (We need the parent on Mac because it allows all windows to share a menu.)
#         if not IS_DARWIN:
#             parent = None
#         super(BaseDialog, self).__init__(parent=parent, *args, **kwargs)
#         # On Linux, dialogs don't have window controls, this can be fixed by turning off that window flag
#         if IS_LINUX:
#             self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.Dialog)


from PyQt5 import QtWidgets
from pyweed.gui.BaseDialog import BaseDialog
from logging import getLogger
    from qtconsole.rich_ipython_widget import RichIPythonWidget
    from qtconsole.inprocess import QtInProcessKernelManager
    import sys

:copyright:
    Mazama Science, IRIS
:license:
    GNU Lesser General Public License, Version 3
    (http://www.gnu.org/copyleft/lesser.html)
"""


LOGGER = getLogger(__name__)

try:

    class EmbedIPython(RichIPythonWidget):

        def __init__(self, **kwarg):
            super(RichIPythonWidget, self).__init__()
            self.kernel_manager = QtInProcessKernelManager()
            self.kernel_manager.start_kernel()
            self.kernel = self.kernel_manager.kernel
            self.kernel.gui = 'qt4'
            self.kernel.shell.push(kwarg)
            self.kernel_client = self.kernel_manager.client()
            self.kernel_client.start_channels()

except Exception as e:
    LOGGER.error("Failed to make IPython widget: %s", e)
    EmbedIPython = None



# Path: pyweed/gui/BaseDialog.py
# class BaseDialog(QtWidgets.QDialog):
#     def __init__(self, parent=None, *args, **kwargs):
#         # On non-Mac platforms, a dialog with a parent will always float above the parent. We want these
#         # windows to be independent, so in that case remove the parent.
#         # (We need the parent on Mac because it allows all windows to share a menu.)
#         if not IS_DARWIN:
#             parent = None
#         super(BaseDialog, self).__init__(parent=parent, *args, **kwargs)
#         # On Linux, dialogs don't have window controls, this can be fixed by turning off that window flag
#         if IS_LINUX:
#             self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.Dialog)


# Path: pyweed/gui/ConsoleDialog.py
from PyQt5 import QtWidgets
from pyweed.gui.BaseDialog import BaseDialog
from logging import getLogger
    from qtconsole.rich_ipython_widget import RichIPythonWidget
    from qtconsole.inprocess import QtInProcessKernelManager
    import sys


:copyright:
    Mazama Science, IRIS
:license:
    GNU Lesser General Public License, Version 3
    (http://www.gnu.org/copyleft/lesser.html)
"""


LOGGER = getLogger(__name__)

try:

    class EmbedIPython(RichIPythonWidget):

        def __init__(self, **kwarg):
            super(RichIPythonWidget, self).__init__()
            self.kernel_manager = QtInProcessKernelManager()
            self.kernel_manager.start_kernel()
            self.kernel = self.kernel_manager.kernel
            self.kernel.gui = 'qt4'
            self.kernel.shell.push(kwarg)
            self.kernel_client = self.kernel_manager.client()
            self.kernel_client.start_channels()

except Exception as e:
    LOGGER.error("Failed to make IPython widget: %s", e)
    EmbedIPython = None



class ConsoleDialog(BaseDialog):