def run(): """ Creates all the top-level assets for the application, sets things up and then runs the application. """ # The app object is the application running on your computer. app = QApplication(sys.argv) app.setStyleSheet(load_stylesheet('mu.css')) # Display a friendly "splash" icon. splash = QSplashScreen(load_pixmap('icon')) splash.show() # Create the "window" we'll be looking at. editor_window = Window() # Create the "editor" that'll control the "window". editor = Editor(view=editor_window) # Setup the window. editor_window.setup() editor.restore_session() # Connect the various buttons in the window to the editor. button_bar = editor_window.button_bar button_bar.connect("new", editor.new, "Ctrl+N") button_bar.connect("load", editor.load, "Ctrl+O") button_bar.connect("save", editor.save, "Ctrl+S") button_bar.connect("flash", editor.flash) button_bar.connect("repl", editor.toggle_repl) button_bar.connect("zoom-in", editor.zoom_in) button_bar.connect("zoom-out", editor.zoom_out) button_bar.connect("quit", editor.quit) # Finished starting up the application, so hide the splash icon. splash.finish(editor_window) # Stop the program after the application finishes executing. sys.exit(app.exec_())
def main(): # The app object is the application running on your computer. app = QApplication(sys.argv) app.setStyleSheet(load_stylesheet('mu.css')) # A splash screen is a logo that appears when you start up the application. # The image to be "splashed" on your screen is in the resources/images # directory. splash = QSplashScreen(load_pixmap('icon')) splash.show() # Make the editor with the Mu class defined above. the_editor = Mu() the_editor.show() the_editor.autosize_window() # Remove the splash when the_editor has finished setting itself up. splash.finish(the_editor) # Stop the program after the application finishes executing. sys.exit(app.exec_())
# The default font size. DEFAULT_FONT_SIZE = 14 # All editor windows use the same font if should_patch_osx_mojave_font(): # pragma: no cover logger.warn("Overriding built-in editor font due to Issue #552") FONT_NAME = "Monaco" else: # pragma: no cover FONT_NAME = "Source Code Pro" FONT_FILENAME_PATTERN = "SourceCodePro-{variant}.otf" FONT_VARIANTS = ("Bold", "BoldIt", "It", "Regular", "Semibold", "SemiboldIt") # Load the two themes from resources/css/[night|day].css # NIGHT_STYLE is a dark theme. NIGHT_STYLE = load_stylesheet('night.css') # DAY_STYLE is a light conventional theme. DAY_STYLE = load_stylesheet('day.css') # CONTRAST_STYLE is a high contrast theme. CONTRAST_STYLE = load_stylesheet('contrast.css') logger = logging.getLogger(__name__) class Font: """ Utility class that makes it easy to set font related values within the editor. """ _DATABASE = None
from PyQt5.QtGui import QKeySequence, QColor, QTextCursor, QFontDatabase from PyQt5.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs from PyQt5.QtSerialPort import QSerialPort from mu.contrib import microfs from mu.resources import load_icon, load_stylesheet, load_font_data #: The default font size. DEFAULT_FONT_SIZE = 14 #: All editor windows use the same font FONT_NAME = "Source Code Pro" FONT_FILENAME_PATTERN = "SourceCodePro-{variant}.otf" FONT_VARIANTS = ("Bold", "BoldIt", "It", "Regular", "Semibold", "SemiboldIt") # Load the two themes from resources/css/[night|day].css #: NIGHT_STYLE is a dark high contrast theme. NIGHT_STYLE = load_stylesheet('night.css') #: DAY_STYLE is a light conventional theme. DAY_STYLE = load_stylesheet('day.css') # Regular Expression for valid individual code 'words' RE_VALID_WORD = re.compile('^[A-Za-z0-9_-]*$') logger = logging.getLogger(__name__) class Font: """ Utility class that makes it easy to set font related values within the editor. """ _DATABASE = None
""" import logging from PyQt5.QtGui import QColor, QFontDatabase from mu.resources import load_stylesheet, load_font_data # The default font size. DEFAULT_FONT_SIZE = 14 # All editor windows use the same font FONT_NAME = "Source Code Pro" FONT_FILENAME_PATTERN = "SourceCodePro-{variant}.otf" FONT_VARIANTS = ("Bold", "BoldIt", "It", "Regular", "Semibold", "SemiboldIt") # Load the three themes from resources/css/[night|day|contrast].css # NIGHT_STYLE is a dark theme. NIGHT_STYLE = load_stylesheet("night.css") # DAY_STYLE is a light conventional theme. DAY_STYLE = load_stylesheet("day.css") # CONTRAST_STYLE is a high contrast theme. CONTRAST_STYLE = load_stylesheet("contrast.css") logger = logging.getLogger(__name__) class Font: """ Utility class that makes it easy to set font related values within the editor. """ _DATABASE = None
from PyQt5.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs from PyQt5.QtSerialPort import QSerialPort from mu.contrib import microfs from mu.resources import load_icon, load_stylesheet, load_font_data #: The default font size. DEFAULT_FONT_SIZE = 14 #: All editor windows use the same font FONT_NAME = "Source Code Pro" FONT_FILENAME_PATTERN = "SourceCodePro-{variant}.otf" FONT_VARIANTS = ("Bold", "BoldIt", "It", "Regular", "Semibold", "SemiboldIt") # Load the two themes from resources/css/[night|day].css #: NIGHT_STYLE is a dark high contrast theme. NIGHT_STYLE = load_stylesheet('night.css') #: DAY_STYLE is a light conventional theme. DAY_STYLE = load_stylesheet('day.css') logger = logging.getLogger(__name__) class Font: """ Utility class that makes it easy to set font related values within the editor. """ _DATABASE = None def __init__(self, color='black', paper='white', bold=False, italic=False):