# Path: mu/i18n.py
# def set_language(language_code, localedir=localedir):
# 
# Path: mu/interface/themes.py
# class Font:
#     """
#     Utility class that makes it easy to set font related values within the
#     editor.
#     """
# 
#     _DATABASE = None
# 
#     def __init__(
#         self, color="#181818", paper="#FEFEF7", bold=False, italic=False
#     ):
#         self.color = color
#         self.paper = paper
#         self.bold = bold
#         self.italic = italic
# 
#     @classmethod
#     def get_database(cls):
#         """
#         Create a font database and load the MU builtin fonts into it.
#         This is a cached classmethod so the font files aren't re-loaded
#         every time a font is refereced
#         """
#         if cls._DATABASE is None:
#             cls._DATABASE = QFontDatabase()
#             for variant in FONT_VARIANTS:
#                 filename = FONT_FILENAME_PATTERN.format(variant=variant)
#                 font_data = load_font_data(filename)
#                 cls._DATABASE.addApplicationFontFromData(font_data)
#         return cls._DATABASE
# 
#     def load(self, size=DEFAULT_FONT_SIZE):
#         """
#         Load the font from the font database, using the correct size and style
#         """
#         return Font.get_database().font(FONT_NAME, self.stylename, size)
# 
#     @property
#     def stylename(self):
#         """
#         Map the bold and italic boolean flags here to a relevant
#         font style name.
#         """
#         if self.bold:
#             if self.italic:
#                 return "Semibold Italic"
#             return "Semibold"
#         if self.italic:
#             return "Italic"
#         return "Regular"
# 
# DEFAULT_FONT_SIZE = 14
# 
# Path: mu/interface/themes.py
# DAY_STYLE = load_stylesheet("day.css")
# 
# NIGHT_STYLE = load_stylesheet("night.css")
# 
# CONTRAST_STYLE = load_stylesheet("contrast.css")


import sys
import os
import re
import platform
import logging
import signal
import string
import bisect
import os.path
import codecs
from PyQt5.QtCore import (
    Qt,
    QProcess,
    QProcessEnvironment,
    pyqtSignal,
    QTimer,
    QUrl,
)
from collections import deque
from PyQt5.QtWidgets import (
    QMessageBox,
    QTextEdit,
    QFrame,
    QListWidget,
    QGridLayout,
    QLabel,
    QMenu,
    QTreeView,
)
from PyQt5.QtGui import (
    QKeySequence,
    QTextCursor,
    QCursor,
    QPainter,
    QDesktopServices,
    QStandardItem,
)
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from ..i18n import language_code
from mu.interface.themes import Font, DEFAULT_FONT_SIZE
from mu.interface.themes import DAY_STYLE, NIGHT_STYLE, CONTRAST_STYLE
    from PyQt5.QtChart import QChart, QLineSeries, QChartView, QValueAxis
    "s": 10,
    "m": 14,
    "l": 16,
    "xl": 18,
    "xxl": 24,
    "xxxl": 28,
}


class JupyterREPLPane(RichJupyterWidget):
    """
    REPL = Read, Evaluate, Print, Loop.

    Displays a Jupyter iPython session.
    """

    on_append_text = pyqtSignal(bytes)

    def __init__(self, theme="day", parent=None):
        super().__init__(parent)
        self.set_theme(theme)
        self.console_height = 10

    def _append_plain_text(self, text, *args, **kwargs):
        """
        Ensures appended text is emitted as a signal with associated bytes.
        """
        super()._append_plain_text(text, *args, **kwargs)
        self.on_append_text.emit(text.encode("utf-8"))


# Path: mu/i18n.py
# def set_language(language_code, localedir=localedir):
# 
# Path: mu/interface/themes.py
# class Font:
#     """
#     Utility class that makes it easy to set font related values within the
#     editor.
#     """
# 
#     _DATABASE = None
# 
#     def __init__(
#         self, color="#181818", paper="#FEFEF7", bold=False, italic=False
#     ):
#         self.color = color
#         self.paper = paper
#         self.bold = bold
#         self.italic = italic
# 
#     @classmethod
#     def get_database(cls):
#         """
#         Create a font database and load the MU builtin fonts into it.
#         This is a cached classmethod so the font files aren't re-loaded
#         every time a font is refereced
#         """
#         if cls._DATABASE is None:
#             cls._DATABASE = QFontDatabase()
#             for variant in FONT_VARIANTS:
#                 filename = FONT_FILENAME_PATTERN.format(variant=variant)
#                 font_data = load_font_data(filename)
#                 cls._DATABASE.addApplicationFontFromData(font_data)
#         return cls._DATABASE
# 
#     def load(self, size=DEFAULT_FONT_SIZE):
#         """
#         Load the font from the font database, using the correct size and style
#         """
#         return Font.get_database().font(FONT_NAME, self.stylename, size)
# 
#     @property
#     def stylename(self):
#         """
#         Map the bold and italic boolean flags here to a relevant
#         font style name.
#         """
#         if self.bold:
#             if self.italic:
#                 return "Semibold Italic"
#             return "Semibold"
#         if self.italic:
#             return "Italic"
#         return "Regular"
# 
# DEFAULT_FONT_SIZE = 14
# 
# Path: mu/interface/themes.py
# DAY_STYLE = load_stylesheet("day.css")
# 
# NIGHT_STYLE = load_stylesheet("night.css")
# 
# CONTRAST_STYLE = load_stylesheet("contrast.css")


# Path: mu/interface/panes.py
import sys
import os
import re
import platform
import logging
import signal
import string
import bisect
import os.path
import codecs
from PyQt5.QtCore import (
    Qt,
    QProcess,
    QProcessEnvironment,
    pyqtSignal,
    QTimer,
    QUrl,
)
from collections import deque
from PyQt5.QtWidgets import (
    QMessageBox,
    QTextEdit,
    QFrame,
    QListWidget,
    QGridLayout,
    QLabel,
    QMenu,
    QTreeView,
)
from PyQt5.QtGui import (
    QKeySequence,
    QTextCursor,
    QCursor,
    QPainter,
    QDesktopServices,
    QStandardItem,
)
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from ..i18n import language_code
from mu.interface.themes import Font, DEFAULT_FONT_SIZE
from mu.interface.themes import DAY_STYLE, NIGHT_STYLE, CONTRAST_STYLE
    from PyQt5.QtChart import QChart, QLineSeries, QChartView, QValueAxis

    "s": 10,
    "m": 14,
    "l": 16,
    "xl": 18,
    "xxl": 24,
    "xxxl": 28,
}


class JupyterREPLPane(RichJupyterWidget):
    """
    REPL = Read, Evaluate, Print, Loop.

    Displays a Jupyter iPython session.
    """

    on_append_text = pyqtSignal(bytes)

    def __init__(self, theme="day", parent=None):
        super().__init__(parent)
        self.set_theme(theme)
        self.console_height = 10

    def _append_plain_text(self, text, *args, **kwargs):
        """
        Ensures appended text is emitted as a signal with associated bytes.
        """
        super()._append_plain_text(text, *args, **kwargs)
        self.on_append_text.emit(text.encode("utf-8"))


    def set_font_size(self, new_size=DEFAULT_FONT_SIZE):