From e6dbf8e081385e02eabb0573ef3f9dab4b4d09f6 Mon Sep 17 00:00:00 2001 From: Georges Khaznadar Date: Sun, 21 Jan 2024 11:27:13 +0100 Subject: [PATCH 1/2] update to comply with Python3 novelties --- pyqode/core/api/code_edit.py | 6 - pyqode/core/api/folding.py | 1 - pyqode/core/cache.py | 7 - pyqode/core/managers/file.py | 5 - pyqode/core/panels/folding.py | 14 +- pyqode/core/panels/global_checker.py | 6 +- pyqode/python/backend/workers.py | 2 +- pyqode/qt/__init__.py | 5 +- requirements.txt | 1 - src/algo/worker.py | 2 +- src/forms/mainwindow.py | 11 +- src/lang/de.ts | 226 ++++++++--------- src/lang/es.ts | 220 ++++++++-------- src/lang/fr.ts | 366 +++++++++++++-------------- src/lang/it.ts | 230 ++++++++--------- src/lang/translator.py | 5 +- src/lang/zh-CN.ts | 226 ++++++++--------- 17 files changed, 655 insertions(+), 678 deletions(-) diff --git a/pyqode/core/api/code_edit.py b/pyqode/core/api/code_edit.py index 36a2e5d..5036e2c 100644 --- a/pyqode/core/api/code_edit.py +++ b/pyqode/core/api/code_edit.py @@ -1,14 +1,8 @@ """ This module contains the base code editor widget. """ -from __future__ import print_function import os import sys -try: - from future.builtins import str, super -except: - # not availabe on python 3.2 (but not needed) - pass import logging import platform from pyqode.core import icons diff --git a/pyqode/core/api/folding.py b/pyqode/core/api/folding.py index 19342a9..ea9a15f 100644 --- a/pyqode/core/api/folding.py +++ b/pyqode/core/api/folding.py @@ -2,7 +2,6 @@ This module contains the code folding API. """ -from __future__ import print_function import logging import sys from pyqode.core.api.utils import TextBlockHelper diff --git a/pyqode/core/cache.py b/pyqode/core/cache.py index 4bb9e2b..70fbd41 100644 --- a/pyqode/core/cache.py +++ b/pyqode/core/cache.py @@ -22,13 +22,6 @@ import logging from pyqode.qt import QtCore -try: - from future.builtins import open - from future.builtins import str -except: - pass # python 3.2 not supported - - class Cache(object): """ Provides an easy acces to the cache by exposing some wrapper properties diff --git a/pyqode/core/managers/file.py b/pyqode/core/managers/file.py index 26972d1..144ca89 100644 --- a/pyqode/core/managers/file.py +++ b/pyqode/core/managers/file.py @@ -2,11 +2,6 @@ This module contains the file helper implementation """ -try: - from future.builtins import open - from future.builtins import str -except: - pass # python 3.2 not supported import locale import logging import mimetypes diff --git a/pyqode/core/panels/folding.py b/pyqode/core/panels/folding.py index cc43cd2..8e8128c 100644 --- a/pyqode/core/panels/folding.py +++ b/pyqode/core/panels/folding.py @@ -211,7 +211,7 @@ def on_install(self, editor): def sizeHint(self): """ Returns the widget size hint (based on the editor font size) """ fm = QtGui.QFontMetricsF(self.editor.font()) - size_hint = QtCore.QSize(fm.height(), fm.height()) + size_hint = QtCore.QSize(int(fm.height()), int(fm.height())) if size_hint.width() > 16: size_hint.setWidth(16) return size_hint @@ -332,12 +332,12 @@ def merged_colors(colorA, colorB, factor): colorA = QtGui.QColor(colorA) colorB = QtGui.QColor(colorB) tmp = colorA - tmp.setRed((tmp.red() * factor) / maxFactor + - (colorB.red() * (maxFactor - factor)) / maxFactor) - tmp.setGreen((tmp.green() * factor) / maxFactor + - (colorB.green() * (maxFactor - factor)) / maxFactor) - tmp.setBlue((tmp.blue() * factor) / maxFactor + - (colorB.blue() * (maxFactor - factor)) / maxFactor) + tmp.setRed(int((tmp.red() * factor) / maxFactor + + (colorB.red() * (maxFactor - factor)) / maxFactor)) + tmp.setGreen(int((tmp.green() * factor) / maxFactor + + (colorB.green() * (maxFactor - factor)) / maxFactor)) + tmp.setBlue(int((tmp.blue() * factor) / maxFactor + + (colorB.blue() * (maxFactor - factor)) / maxFactor)) return tmp pal = QtWidgets.QApplication.instance().palette() diff --git a/pyqode/core/panels/global_checker.py b/pyqode/core/panels/global_checker.py index ad5a86e..e0cd0d8 100644 --- a/pyqode/core/panels/global_checker.py +++ b/pyqode/core/panels/global_checker.py @@ -53,9 +53,9 @@ def _draw_visible_area(self, painter): end = self.editor.visible_blocks[-1][-1] rect = QtCore.QRect() rect.setX(0) - rect.setY(start.blockNumber() * self.get_marker_height()) - rect.setWidth(self.sizeHint().width()) - rect.setBottom(end.blockNumber() * self.get_marker_height()) + rect.setY(int(start.blockNumber() * self.get_marker_height())) + rect.setWidth(int(self.sizeHint().width())) + rect.setBottom(int(end.blockNumber() * self.get_marker_height())) if self.editor.background.lightness() < 128: c = self.editor.background.darker(150) else: diff --git a/pyqode/python/backend/workers.py b/pyqode/python/backend/workers.py index b1adbc7..f3504d0 100644 --- a/pyqode/python/backend/workers.py +++ b/pyqode/python/backend/workers.py @@ -176,7 +176,7 @@ def run_pep8(request_data): PYFLAKES_ERROR_MESSAGES = [ messages.DoctestSyntaxError, - messages.ReturnWithArgsInsideGenerator, + messages.ReturnOutsideFunction, messages.UndefinedExport, messages.UndefinedName, messages.UndefinedLocal diff --git a/pyqode/qt/__init__.py b/pyqode/qt/__init__.py index 086ff6c..650f1ff 100644 --- a/pyqode/qt/__init__.py +++ b/pyqode/qt/__init__.py @@ -84,7 +84,10 @@ def setup_apiv2(): if sys.version_info[0] == 2: logging.getLogger(__name__).debug( 'setting up SIP API to version 2') - import sip + try: + from PyQt5 import sip + except: + import sip try: sip.setapi("QString", 2) sip.setapi("QVariant", 2) diff --git a/requirements.txt b/requirements.txt index 981f42d..8a281c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ altgraph==0.15 autopep8==1.3.5 cycler==0.10.0 docutils==0.14 -future==0.16.0 jedi==0.11.1 kiwisolver==1.0.1 macholib==1.9 diff --git a/src/algo/worker.py b/src/algo/worker.py index 3c6e985..b0b8710 100644 --- a/src/algo/worker.py +++ b/src/algo/worker.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time import typing -from collections import Iterable +from collections.abc import Iterable from typing import * from algo.stmts import * diff --git a/src/forms/mainwindow.py b/src/forms/mainwindow.py index a255ed6..2816941 100644 --- a/src/forms/mainwindow.py +++ b/src/forms/mainwindow.py @@ -622,7 +622,7 @@ def python_input(prompt="", globals=None, locals=None, unsafe=False): def python_print_error(msg, end="\n"): ExecState.current_output += util.html.color_span(msg, "red") + end - if not AppState.mode_python: + if not AppState.mode_python and ExecState.worker is not None: set_current_line(ExecState.worker.last, True) update_output() @@ -840,7 +840,7 @@ def handler_Step(): show_error() finally: plot_update() - if ExecState.worker.finished: + if ExecState.worker is not None and ExecState.worker.finished: GuiState.ui.actionRun.setDisabled(False) if not ExecState.stop_flag: end_output() @@ -849,9 +849,10 @@ def handler_Step(): ExecState.running = False GuiState.ui.actionDebug.setDisabled(False) GuiState.ui.actionStep.setDisabled(False) - GuiState.ui.actionNew.setDisabled(not ExecState.worker.finished) - GuiState.ui.actionOpen.setDisabled(not ExecState.worker.finished) - GuiState.ui.actionStop.setEnabled(not ExecState.worker.finished) + if ExecState.worker is not None: + GuiState.ui.actionNew.setDisabled(not ExecState.worker.finished) + GuiState.ui.actionOpen.setDisabled(not ExecState.worker.finished) + GuiState.ui.actionStop.setEnabled(not ExecState.worker.finished) def handler_Debug(): diff --git a/src/lang/de.ts b/src/lang/de.ts index 9f1206d..fc47ede 100644 --- a/src/lang/de.ts +++ b/src/lang/de.ts @@ -31,7 +31,7 @@ p, li { white-space: pre-wrap; } <li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Windows icons under CC-BY 3.0 license - <a href="http://www.fatcow.com/free-icons"><span style=" text-decoration: underline; color:#0000ff;">(c) Fatcow Web Hosting</span></a></li></ul> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Special thanks :</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, physics and computer science teacher, whose lessons and modesty were a big help during the development</li> -<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> +<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">plz give us a good grade</p></body></html> @@ -229,22 +229,22 @@ p, li { white-space: pre-wrap; } AlgoCallStmt - + Call function Funktion aufrufen - + <html><head/><body><p>Calls the function with the specified arguments.</p><p>The argument list must consist of a comma-separated list of arguments.</p></body></html> - + Function: Funktion: - + Arguments: Parameter: @@ -252,17 +252,17 @@ p, li { white-space: pre-wrap; } AlgoCommentStmt - + Comment Kommentar - + <html><head/><body><p>A comment has no effect whatsoever on the execution of the program.</p><p>It can contain anything.</p></body></html> - + Comment: Kommentar: @@ -270,22 +270,22 @@ p, li { white-space: pre-wrap; } AlgoDefineStmt - + Define variable Variable definieren - + <html><head/><body><p>Assigns the specified value to the variable.</p><p>If the variable does not exist in the current scope or in any parent scope, it will be created in the current scope.</p></body></html> - + Value: - + Variable: Variable: @@ -293,22 +293,22 @@ p, li { white-space: pre-wrap; } AlgoDisplayStmt - + Display value Wert anzeigen - + <html><head/><body><p>Displays a value in the output window. </p><p>The value can be of any type, it will be automatically converted to a textual representation.</p></body></html> - + Value: - + Followed by a line break Einen Zeilenumbruch einfügen @@ -316,37 +316,37 @@ p, li { white-space: pre-wrap; } AlgoForStmt - + FOR loop FÜR Schleife - + <html><head/><body><p>Executes the instructions for all values of the variable in the specified range.</p><p>At each iteration, the variable will be incremented by the step which is defaulted to 1. </p><p>The bounds are inclusive.</p></body></html> - + From: Von: - + To: Bis: - + Step: Schrittweite: - + Variable: Variable: - + Custom step Benutzerdefiniert Schrittweite @@ -354,22 +354,22 @@ p, li { white-space: pre-wrap; } AlgoFuncStmt - + Define function Funktion definieren - + <html><head/><body><p>Creates a custom function. The parameters must be a comma-separated list of identifiers.</p><p>A function may or may not return a value, it can very well only &quot;do&quot; things without ever giving a result. Such a function can be called using the CALL statement.</p></body></html> - + Function: Funktion: - + Parameters: Parameter: @@ -377,42 +377,42 @@ p, li { white-space: pre-wrap; } AlgoGFuncStmt - + Plot function Plotten einer Funktion - + <html><head/><body><p>Draws the curve of the function on the specified interval.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Start: - + Step: Schrittweite: - + Function: Funktion: - + Variable: Variable: - + Color: Farbe: - + End: @@ -420,37 +420,37 @@ p, li { white-space: pre-wrap; } AlgoGLineStmt - + Plot line Plotten einer Linie - + <html><head/><body><p>Draws a line with the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + End Y: - + End X: - + Start X: - + Start Y: - + Color: Farbe: @@ -458,27 +458,27 @@ p, li { white-space: pre-wrap; } AlgoGPointStmt - + Plot point Plotten eines Punktes - + <html><head/><body><p>Draws a point at the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Color: Farbe: - + X: X: - + Y: Y: @@ -486,42 +486,42 @@ p, li { white-space: pre-wrap; } AlgoGWindowStmt - + Set window Einstellen des Grafikfensters - + Max Y: Max Y: - + Min Y: Min Y: - + Min X: Min X: - + Max X: Max X: - + Grad X: - + Grad Y: - + <html><head/><body><p>Changes the size of the plot window canvas. For Grad, 0 means automatic.</p></body></html> @@ -529,17 +529,17 @@ p, li { white-space: pre-wrap; } AlgoIfStmt - + IF block - + <html><head/><body><p>Checks if the specified condition is true.</p><p>The block will only be executed if the condition is true, otherwise the program will continue with the instruction following the block.</p></body></html> - + Condition: @@ -547,32 +547,32 @@ p, li { white-space: pre-wrap; } AlgoInputStmt - + Read user input Benutzereingaben lesen - + <html><head/><body><p>Asks the user for a value and assigns it to the specified variable.</p><p>Optionally, a message can be displayed. <span style=" font-weight:600;">Warning</span>: the message is an expression, thus if you want to display text you need to enclose everything inside quotes.</p></body></html> - + Display a message Eine Nachricht anzeigen - + Message: - + Variable: Variable: - + Text @@ -580,22 +580,22 @@ p, li { white-space: pre-wrap; } AlgoReturnStmt - + Return Zurückgeben - + <html><head/><body><p>Exits the current function and optionally passes a value to the caller.</p></body></html> - + Value: - + Return a value @@ -603,17 +603,17 @@ p, li { white-space: pre-wrap; } AlgoSleepStmt - + Wait Warten - + <html><head/><body><p>Waits for the specified amount of time (in <span style=" font-weight:600;">seconds</span>).</p></body></html> - + Duration: @@ -621,22 +621,22 @@ p, li { white-space: pre-wrap; } AlgoStopStmt - + Breakpoint Haltepunkt - + <html><head/><body><p>Pauses the program until &quot;Run&quot; or &quot;Debug&quot; is pressed.</p></body></html> - + Message: - + Display a message Eine Nachricht anzeigen @@ -644,17 +644,17 @@ p, li { white-space: pre-wrap; } AlgoWhileStmt - + WHILE loop SOLANGE Schleife - + <html><head/><body><p>Executes the instructions while the condition is true.</p><p>As soon as the condition is false, the program continues with the instruction following the block.</p></body></html> - + Condition: @@ -664,18 +664,18 @@ p, li { white-space: pre-wrap; } Unknown color: {color} - Unbekannte Farbe: {color} + Unbekannte Farbe: {color} Unknown variable type: {type} - Unbekannter Variablentyp: {type} + Unbekannter Variablentyp: {type} CalcWindow - + Calculator Rechner @@ -688,131 +688,131 @@ p, li { white-space: pre-wrap; } ChangeThemeWindow - + Edit theme - + Block: - + Comment: Kommentar: - + Keyword: - + Literal: - + Window: - + Shadow: - + Button: - + Button Text: - + Disabled Button Text: - + Bright Text: - + Disabled Highlight: - + Highlight: - + Highlighted Text: - + Link: - + Disabled Highlighted Text: - + Alternate Base: - + Base: - + Window Text: - + Dark: - + Disabled Text: - + Tool Tip Text: - + Text: - + Tool Tip Base: - + Disabled Window Text : @@ -1556,12 +1556,12 @@ Window Text : Type mismatch for argument #{idx} '{arg}' (expected {exp}) - Typenkonflikt für Parameter #{idx} '{arg}' (erwartet {exp}) + Typenkonflikt für Parameter #{idx} '{arg}' (erwartet {exp}) Invalid unary operator '{op}' - Ungültiger unärer Operator '{op}' + Ungültiger unärer Operator '{op}' @@ -1611,13 +1611,13 @@ Window Text : Invalid binary operator '{op}' for '{left}' and '{right}' - Ungültiger binärer Operator '{op}' für '{left}' und '{right}' + Ungültiger binärer Operator '{op}' für '{left}' und '{right}' HelpWindow - + Help Contents Hilfethemen @@ -1650,7 +1650,7 @@ Window Text : InlineCodeDialog - + Expression editor Ausdrucks-Editor @@ -2340,7 +2340,7 @@ please choose another file path. Expected token ({type}) '{val}' - Token erwartet ({type}) '{val}' + Token erwartet ({type}) '{val}' @@ -2355,7 +2355,7 @@ please choose another file path. Unexpected token ({type}) '{val}' - Unerwarteter Token ({type}) '{val}' + Unerwarteter Token ({type}) '{val}' diff --git a/src/lang/es.ts b/src/lang/es.ts index bb4800f..55792fc 100644 --- a/src/lang/es.ts +++ b/src/lang/es.ts @@ -31,7 +31,7 @@ p, li { white-space: pre-wrap; } <li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Windows icons under CC-BY 3.0 license - <a href="http://www.fatcow.com/free-icons"><span style=" text-decoration: underline; color:#0000ff;">(c) Fatcow Web Hosting</span></a></li></ul> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Special thanks :</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, physics and computer science teacher, whose lessons and modesty were a big help during the development</li> -<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> +<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">plz give us a good grade</p></body></html> @@ -229,22 +229,22 @@ p, li { white-space: pre-wrap; } AlgoCallStmt - + Call function Llamada a una función - + <html><head/><body><p>Calls the function with the specified arguments.</p><p>The argument list must consist of a comma-separated list of arguments.</p></body></html> - + Function: - + Arguments: @@ -252,17 +252,17 @@ p, li { white-space: pre-wrap; } AlgoCommentStmt - + Comment Comentario - + <html><head/><body><p>A comment has no effect whatsoever on the execution of the program.</p><p>It can contain anything.</p></body></html> - + Comment: @@ -270,22 +270,22 @@ p, li { white-space: pre-wrap; } AlgoDefineStmt - + Define variable Definir variable - + <html><head/><body><p>Assigns the specified value to the variable.</p><p>If the variable does not exist in the current scope or in any parent scope, it will be created in the current scope.</p></body></html> - + Value: - + Variable: @@ -293,22 +293,22 @@ p, li { white-space: pre-wrap; } AlgoDisplayStmt - + Display value Visualizar valor - + <html><head/><body><p>Displays a value in the output window. </p><p>The value can be of any type, it will be automatically converted to a textual representation.</p></body></html> - + Value: - + Followed by a line break Añadir un salto de línea @@ -316,37 +316,37 @@ p, li { white-space: pre-wrap; } AlgoForStmt - + FOR loop Bucle PARA - + <html><head/><body><p>Executes the instructions for all values of the variable in the specified range.</p><p>At each iteration, the variable will be incremented by the step which is defaulted to 1. </p><p>The bounds are inclusive.</p></body></html> - + From: De: - + To: A: - + Step: - + Variable: - + Custom step @@ -354,22 +354,22 @@ p, li { white-space: pre-wrap; } AlgoFuncStmt - + Define function Definir una función - + <html><head/><body><p>Creates a custom function. The parameters must be a comma-separated list of identifiers.</p><p>A function may or may not return a value, it can very well only &quot;do&quot; things without ever giving a result. Such a function can be called using the CALL statement.</p></body></html> - + Function: - + Parameters: @@ -377,42 +377,42 @@ p, li { white-space: pre-wrap; } AlgoGFuncStmt - + Plot function Trazar una función - + <html><head/><body><p>Draws the curve of the function on the specified interval.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Start: - + Step: - + Function: - + Variable: - + Color: Color: - + End: @@ -420,37 +420,37 @@ p, li { white-space: pre-wrap; } AlgoGLineStmt - + Plot line Trazar una línea - + <html><head/><body><p>Draws a line with the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + End Y: - + End X: - + Start X: - + Start Y: - + Color: Color: @@ -458,27 +458,27 @@ p, li { white-space: pre-wrap; } AlgoGPointStmt - + Plot point Trazar un punto - + <html><head/><body><p>Draws a point at the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Color: Color: - + X: X: - + Y: Y: @@ -486,42 +486,42 @@ p, li { white-space: pre-wrap; } AlgoGWindowStmt - + Set window Configurar la ventana del gráfico - + Max Y: Máx Y: - + Min Y: Mín Y: - + Min X: Mín X: - + Max X: Máx X: - + Grad X: - + Grad Y: - + <html><head/><body><p>Changes the size of the plot window canvas. For Grad, 0 means automatic.</p></body></html> @@ -529,17 +529,17 @@ p, li { white-space: pre-wrap; } AlgoIfStmt - + IF block - + <html><head/><body><p>Checks if the specified condition is true.</p><p>The block will only be executed if the condition is true, otherwise the program will continue with the instruction following the block.</p></body></html> - + Condition: @@ -547,32 +547,32 @@ p, li { white-space: pre-wrap; } AlgoInputStmt - + Read user input Leer la entrada del usuario - + <html><head/><body><p>Asks the user for a value and assigns it to the specified variable.</p><p>Optionally, a message can be displayed. <span style=" font-weight:600;">Warning</span>: the message is an expression, thus if you want to display text you need to enclose everything inside quotes.</p></body></html> - + Display a message Mostrar un mensaje - + Message: - + Variable: - + Text @@ -580,22 +580,22 @@ p, li { white-space: pre-wrap; } AlgoReturnStmt - + Return - + <html><head/><body><p>Exits the current function and optionally passes a value to the caller.</p></body></html> - + Value: - + Return a value @@ -603,17 +603,17 @@ p, li { white-space: pre-wrap; } AlgoSleepStmt - + Wait - + <html><head/><body><p>Waits for the specified amount of time (in <span style=" font-weight:600;">seconds</span>).</p></body></html> - + Duration: @@ -621,22 +621,22 @@ p, li { white-space: pre-wrap; } AlgoStopStmt - + Breakpoint Punto de ruptura - + <html><head/><body><p>Pauses the program until &quot;Run&quot; or &quot;Debug&quot; is pressed.</p></body></html> - + Message: - + Display a message Mostrar un mensaje @@ -644,17 +644,17 @@ p, li { white-space: pre-wrap; } AlgoWhileStmt - + WHILE loop - + <html><head/><body><p>Executes the instructions while the condition is true.</p><p>As soon as the condition is false, the program continues with the instruction following the block.</p></body></html> - + Condition: @@ -664,18 +664,18 @@ p, li { white-space: pre-wrap; } Unknown color: {color} - Color desconocido: {color} + Color desconocido: {color} Unknown variable type: {type} - Tipo de variable desconocido: {type} + Tipo de variable desconocido: {type} CalcWindow - + Calculator Calculadora @@ -688,131 +688,131 @@ p, li { white-space: pre-wrap; } ChangeThemeWindow - + Edit theme - + Block: - + Comment: - + Keyword: - + Literal: - + Window: - + Shadow: - + Button: - + Button Text: - + Disabled Button Text: - + Bright Text: - + Disabled Highlight: - + Highlight: - + Highlighted Text: - + Link: - + Disabled Highlighted Text: - + Alternate Base: - + Base: - + Window Text: - + Dark: - + Disabled Text: - + Tool Tip Text: - + Text: - + Tool Tip Base: - + Disabled Window Text : @@ -1617,7 +1617,7 @@ Window Text : HelpWindow - + Help Contents Contenido de la Ayuda @@ -1650,7 +1650,7 @@ Window Text : InlineCodeDialog - + Expression editor Editor de expresiones @@ -2339,7 +2339,7 @@ please choose another file path. Expected token ({type}) '{val}' - Token esperado ({type}) '{val}' + Token esperado ({type}) '{val}' @@ -2354,7 +2354,7 @@ please choose another file path. Unexpected token ({type}) '{val}' - Token inesperado ({type}) '{val}' + Token inesperado ({type}) '{val}' diff --git a/src/lang/fr.ts b/src/lang/fr.ts index 1fb2f71..360dcb2 100644 --- a/src/lang/fr.ts +++ b/src/lang/fr.ts @@ -31,20 +31,20 @@ p, li { white-space: pre-wrap; } <li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Windows icons under CC-BY 3.0 license - <a href="http://www.fatcow.com/free-icons"><span style=" text-decoration: underline; color:#0000ff;">(c) Fatcow Web Hosting</span></a></li></ul> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Special thanks :</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, physics and computer science teacher, whose lessons and modesty were a big help during the development</li> -<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> +<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">plz give us a good grade</p></body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">Turing {version}</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Canal de développement : </span>{channel} <br /><br />Logiciel libre et multi-plateforme d'aide à l'apprentissage de l'algorithmique et de la programmation informatique. <br /><br /><span style=" font-weight:600;">Copyright &copy; 2018 l'équipe Turing (Léo Joly, Tom Niget)</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Canal de développement : </span>{channel} <br /><br />Logiciel libre et multi-plateforme d'aide à l'apprentissage de l'algorithmique et de la programmation informatique. <br /><br /><span style=" font-weight:600;">Copyright &copy; 2018 l'équipe Turing (Léo Joly, Tom Niget)</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ce logiciel est distribué sous la licence MIT et utilise le framework <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">Qt</span></a> / <a href="https://riverbankcomputing.com/software/pyqt/"><span style=" text-decoration: underline; color:#0000ff;">pyQt</span></a>.</li> <li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Spé ISN &gt; Spé maths</li> <li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Icônes Windows sous licence CC-BY 3.0 - <a href="http://www.fatcow.com/free-icons"><span style=" text-decoration: underline; color:#0000ff;">&copy; Fatcow Web Hosting</span></a></li></ul> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Remerciements :</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, professeur de physique et d'informatique, dont les cours et la modestie ont été d'une aide incontournable pendant le développement</li> -<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, sans qui ce projet n'existerait pas</li></ul> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, professeur de physique et d'informatique, dont les cours et la modestie ont été d'une aide incontournable pendant le développement</li> +<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, sans qui ce projet n'existerait pas</li></ul> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">svp mettez nous pas une mauvaise note</p></body></html> @@ -150,7 +150,7 @@ p, li { white-space: pre-wrap; } The following errors occured while parsing the expression: - Les erreurs suivantes sont survenues lors de l'analyse de l'expression : + Les erreurs suivantes sont survenues lors de l'analyse de l'expression : @@ -243,22 +243,22 @@ p, li { white-space: pre-wrap; } AlgoCallStmt - + <html><head/><body><p>Calls the function with the specified arguments.</p><p>The argument list must consist of a comma-separated list of arguments.</p></body></html> <html><head/><body><p>Appelle la fonction avec les arguments spécifiés.</p><p>Les arguments doivent être séparés par des virgules.</p></body></html> - + Function: Fonction : - + Arguments: Arguments : - + Call function Appeler fonction @@ -266,17 +266,17 @@ p, li { white-space: pre-wrap; } AlgoCommentStmt - + Comment Commentaire - + <html><head/><body><p>A comment has no effect whatsoever on the execution of the program.</p><p>It can contain anything.</p></body></html> - <html><head/><body><p>Un commentaire n'a absolument aucun effet sur l'exécution du programme.</p><p>Il peut contenir n'importe quoi.</p></body></html> + <html><head/><body><p>Un commentaire n'a absolument aucun effet sur l'exécution du programme.</p><p>Il peut contenir n'importe quoi.</p></body></html> - + Comment: Commentaire : @@ -284,22 +284,22 @@ p, li { white-space: pre-wrap; } AlgoDefineStmt - + <html><head/><body><p>Assigns the specified value to the variable.</p><p>If the variable does not exist in the current scope or in any parent scope, it will be created in the current scope.</p></body></html> - <html><head/><body><p>Assigne la valeur spécifiée à la variable.</p><p>Si la variable n'existe pas dans le champ actuel ou dans un quelconque champ parent, elle sera créée dans le champ actuel.</p></body></html> + <html><head/><body><p>Assigne la valeur spécifiée à la variable.</p><p>Si la variable n'existe pas dans le champ actuel ou dans un quelconque champ parent, elle sera créée dans le champ actuel.</p></body></html> - + Value: Valeur : - + Variable: Variable : - + Define variable Définir variable @@ -307,22 +307,22 @@ p, li { white-space: pre-wrap; } AlgoDisplayStmt - + Display value Afficher valeur - + <html><head/><body><p>Displays a value in the output window. </p><p>The value can be of any type, it will be automatically converted to a textual representation.</p></body></html> - <html><head/><body><p>Affiche une valeur dans ̊la fenêtre de sortie. </p><p>La valeur peut être de n'importe quel type, elle sera de toute façon convertie en une représentation textuelle appropriée.</p></body></html> + <html><head/><body><p>Affiche une valeur dans ̊la fenêtre de sortie. </p><p>La valeur peut être de n'importe quel type, elle sera de toute façon convertie en une représentation textuelle appropriée.</p></body></html> - + Value: Valeur : - + Followed by a line break Ajouter un retour à la ligne @@ -330,37 +330,37 @@ p, li { white-space: pre-wrap; } AlgoForStmt - + <html><head/><body><p>Executes the instructions for all values of the variable in the specified range.</p><p>At each iteration, the variable will be incremented by the step which is defaulted to 1. </p><p>The bounds are inclusive.</p></body></html> - <html><head/><body><p>Exécute une instruction pour toutes les valeurs de la variable dans l'intervalle spécifié.</p><p>À chaque itération, la variable est incrémentée du pas spécifié (1 par défaut). </p><p>Les bornes sont inclusives.</p></body></html> + <html><head/><body><p>Exécute une instruction pour toutes les valeurs de la variable dans l'intervalle spécifié.</p><p>À chaque itération, la variable est incrémentée du pas spécifié (1 par défaut). </p><p>Les bornes sont inclusives.</p></body></html> - + From: De : - + To: À : - + Step: Pas : - + Variable: Variable : - + Custom step Pas personnalisé - + FOR loop Boucle POUR @@ -368,22 +368,22 @@ p, li { white-space: pre-wrap; } AlgoFuncStmt - + <html><head/><body><p>Creates a custom function. The parameters must be a comma-separated list of identifiers.</p><p>A function may or may not return a value, it can very well only &quot;do&quot; things without ever giving a result. Such a function can be called using the CALL statement.</p></body></html> <html><head/><body><p>Définit une fonction personnalisée. Les paramètres doivent être séparés par des virgules.</p><p>Une fonction peut renvoyer ou non une valeur, elle peut très bien simplement exécuter des instructions sans donner de résultat. Une telle fonction peut être appelée en utilisant une instruction APPELER.</p></body></html> - + Function: Fonction : - + Parameters: Paramètres : - + Define function Définir fonction @@ -391,42 +391,42 @@ p, li { white-space: pre-wrap; } AlgoGFuncStmt - + Plot function Tracer une fonction - + <html><head/><body><p>Draws the curve of the function on the specified interval.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - <html><head/><body><p>Dessine la courbe représentative de la fonction sur l'intervalle spécifié.</p><p>La couleur doit être une chaîne de caractères contenant le nom de la couleur ou la valeur RGB hexadécimale.</p></body></html> + <html><head/><body><p>Dessine la courbe représentative de la fonction sur l'intervalle spécifié.</p><p>La couleur doit être une chaîne de caractères contenant le nom de la couleur ou la valeur RGB hexadécimale.</p></body></html> - + Start: Début : - + Step: Pas : - + Function: Fonction : - + Variable: Variable : - + Color: Couleur : - + End: Fin : @@ -434,37 +434,37 @@ p, li { white-space: pre-wrap; } AlgoGLineStmt - + Plot line Dessiner une ligne - + <html><head/><body><p>Draws a line with the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> <html><head/><body><p>Dessine une ligne avec les coordonnées spécifiées.</p><p>La couleur doit être une chaîne de caractères contenant le nom de la couleur ou la valeur RGB hexadécimale.</p></body></html> - + End Y: Y arrivée : - + End X: X arrivée : - + Start X: X début : - + Start Y: Y début : - + Color: Couleur : @@ -472,27 +472,27 @@ p, li { white-space: pre-wrap; } AlgoGPointStmt - + Plot point Dessiner un point - + <html><head/><body><p>Draws a point at the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> <html><head/><body><p>Dessine un point aux coordonnées spécifiées.</p><p>La couleur doit être une chaîne de caractères contenant le nom de la couleur ou la valeur RGB hexadécimale.</p></body></html> - + Color: Couleur : - + X: X : - + Y: Y : @@ -500,42 +500,42 @@ p, li { white-space: pre-wrap; } AlgoGWindowStmt - + Max Y: Y max : - + Min Y: Y min : - + Min X: X min : - + Max X: X max : - + Grad X: X grad : - + Grad Y: Y grad : - + Set window Définir le repère - + <html><head/><body><p>Changes the size of the plot window canvas. For Grad, 0 means automatic.</p></body></html> <html><head/><body><p>Définit la taille du repère et de la fenêtre du graphique. Pour Grad, 0 signifie automatique.</p></body></html> @@ -543,17 +543,17 @@ p, li { white-space: pre-wrap; } AlgoIfStmt - + Condition: Condition : - + <html><head/><body><p>Checks if the specified condition is true.</p><p>The block will only be executed if the condition is true, otherwise the program will continue with the instruction following the block.</p></body></html> - <html><head/><body><p>Vérifie si la condition spécifiée est vraie.</p><p>Le bloc sera exécuté uniquement si la condition est vraie, le cas échéant l'exécution du programme continuera à l'instruction suivant le bloc.</p></body></html> + <html><head/><body><p>Vérifie si la condition spécifiée est vraie.</p><p>Le bloc sera exécuté uniquement si la condition est vraie, le cas échéant l'exécution du programme continuera à l'instruction suivant le bloc.</p></body></html> - + IF block Bloc SI @@ -561,32 +561,32 @@ p, li { white-space: pre-wrap; } AlgoInputStmt - + Display a message Afficher un message - + Message: Message : - + Variable: Variable : - + <html><head/><body><p>Asks the user for a value and assigns it to the specified variable.</p><p>Optionally, a message can be displayed. <span style=" font-weight:600;">Warning</span>: the message is an expression, thus if you want to display text you need to enclose everything inside quotes.</p></body></html> - <html><head/><body><p>Demande à l'utilisateur de saisir une variable, puis assigne cette valeur à la variable spécifiée.</p><p>Optionnellement, un message peut être affiché. <span style=" font-weight:600;">Attention</span> : le message est une expression, ainsi si vous souhaitez afficher du texte il faut mettre le tout entre guillemets.</p></body></html> + <html><head/><body><p>Demande à l'utilisateur de saisir une variable, puis assigne cette valeur à la variable spécifiée.</p><p>Optionnellement, un message peut être affiché. <span style=" font-weight:600;">Attention</span> : le message est une expression, ainsi si vous souhaitez afficher du texte il faut mettre le tout entre guillemets.</p></body></html> - + Read user input Saisir entrée utilisateur - + Text Texte @@ -594,22 +594,22 @@ p, li { white-space: pre-wrap; } AlgoReturnStmt - + <html><head/><body><p>Exits the current function and optionally passes a value to the caller.</p></body></html> <html><head/><body><p>Sort de la fonction actuelle et renvoie optionnellement une valeur au code appelant.</p></body></html> - + Value: Valeur : - + Return a value Renvoyer une valeur - + Return Renvoyer @@ -617,17 +617,17 @@ p, li { white-space: pre-wrap; } AlgoSleepStmt - + Wait Attendre - + <html><head/><body><p>Waits for the specified amount of time (in <span style=" font-weight:600;">seconds</span>).</p></body></html> - <html><head/><body><p>Suspend l'exécution du programme pendant la durée spécifiée (en <span style=" font-weight:600;">secondes</span>).</p></body></html> + <html><head/><body><p>Suspend l'exécution du programme pendant la durée spécifiée (en <span style=" font-weight:600;">secondes</span>).</p></body></html> - + Duration: Durée : @@ -635,22 +635,22 @@ p, li { white-space: pre-wrap; } AlgoStopStmt - + Breakpoint - Point d'arrêt + Point d'arrêt - + <html><head/><body><p>Pauses the program until &quot;Run&quot; or &quot;Debug&quot; is pressed.</p></body></html> - <html><head/><body><p>Suspend l'exécution du programme jusqu'à ce que l'utilisateur clique sur &quot;Exécuter&quot; or &quot;Déboguer&quot;.</p></body></html> + <html><head/><body><p>Suspend l'exécution du programme jusqu'à ce que l'utilisateur clique sur &quot;Exécuter&quot; or &quot;Déboguer&quot;.</p></body></html> - + Message: Message : - + Display a message Afficher un message @@ -658,17 +658,17 @@ p, li { white-space: pre-wrap; } AlgoWhileStmt - + <html><head/><body><p>Executes the instructions while the condition is true.</p><p>As soon as the condition is false, the program continues with the instruction following the block.</p></body></html> - <html><head/><body><p>Exécute les instructions tant que la condition est vraie.</p><p>Aussitôt que la condition est fausse, l'exécution du programme continue avec l'instruction suivant le bloc.</p></body></html> + <html><head/><body><p>Exécute les instructions tant que la condition est vraie.</p><p>Aussitôt que la condition est fausse, l'exécution du programme continue avec l'instruction suivant le bloc.</p></body></html> - + Condition: Condition : - + WHILE loop Boucle TANT QUE @@ -678,18 +678,18 @@ p, li { white-space: pre-wrap; } Unknown variable type: {type} - Type de variable inconnu : {type} + Type de variable inconnu : {type} Unknown color: {color} - Couleur inconnue : {color} + Couleur inconnue : {color} CalcWindow - + Calculator Calculatrice @@ -702,134 +702,134 @@ p, li { white-space: pre-wrap; } ChangeThemeWindow - + Edit theme Modifier le thème - + Block: Bloc : - + Comment: Commentaire : - + Keyword: Mot-clé : - + Literal: Valeur : - + Window: Fenêtre : - + Shadow: Ombre : - + Button: Bouton : - + Button Text: Texte de bouton : - + Disabled Button Text: Texte de bouton désactivé : - + Bright Text: Texte clair : - + Disabled Highlight: Surligné désactivé : - + Highlight: Surligné : - + Highlighted Text: Texte surligné : - + Link: Lien : - + Disabled Highlighted Text: Texte surligné désactivé : - + Alternate Base: Base alternative : - + Base: Base : - + Window Text: Texte de fenêtre : - + Dark: Sombre : - + Disabled Text: Texte désactivé : - + Tool Tip Text: - Texte d'infobulle : + Texte d'infobulle : - + Text: Texte : - + Tool Tip Base: - Base d'infobulle : + Base d'infobulle : - + Disabled Window Text : Texte de fenêtre @@ -841,7 +841,7 @@ désactivé : Rounds {{num}} to the nearest integer / (if specified) to {{prec}} decimals. - Arrondit {{num}} à l'entier le plus proche / (si spécifié) à {{prec}} décimales. + Arrondit {{num}} à l'entier le plus proche / (si spécifié) à {{prec}} décimales. @@ -911,12 +911,12 @@ désactivé : Returns the argument (or phase) of {{x}}. - Calcule l'argument (ou phase) de {{x}}. + Calcule l'argument (ou phase) de {{x}}. Returns a list containing the polar coordinates of {{x}}, respectively the modulus (radius) and argument (angle). - Renvoie une liste contenant les coordonnées polaires de {{x}}, respectivement le module (rayon) et l'argument (angle). + Renvoie une liste contenant les coordonnées polaires de {{x}}, respectivement le module (rayon) et l'argument (angle). @@ -951,52 +951,52 @@ désactivé : Returns the area of the triangle with the specified side lengths. - Calcule l'aire du triangle ayant les longueurs de côtés spécifiées. + Calcule l'aire du triangle ayant les longueurs de côtés spécifiées. Returns the area of the triangle with the specified base and height. - Calcule l'aire du triangle ayant une base de longueur {{base}} et une hauteur de longueur {{height}}. + Calcule l'aire du triangle ayant une base de longueur {{base}} et une hauteur de longueur {{height}}. Returns the area of the square with the specified {{side}} length. - Calcule l'aire du carré de côté {{side}}. + Calcule l'aire du carré de côté {{side}}. Returns the area of the rectangle with side lengths {{s1}} and {{s2}}. - Calcule l'aire du rectangle de côtés {{s1}} et {{s2}}. + Calcule l'aire du rectangle de côtés {{s1}} et {{s2}}. Returns the area of the trapezoid with sides {{a}} and {{b}} and height {{height}}. - Calcule l'aire du trapèze de côtés {{a}} et {{b}} et de longueur {{height}}. + Calcule l'aire du trapèze de côtés {{a}} et {{b}} et de longueur {{height}}. Returns the area of the circle with the specified {{radius}}. - Calcule l'aire du disque de rayon {{radius}}. + Calcule l'aire du disque de rayon {{radius}}. Returns the area of the ellipse with radii {{r1}} and {{r2}}. - Calcule l'aire de l'ellipse ayant pour rayons {{r1}} et {{r2}}. + Calcule l'aire de l'ellipse ayant pour rayons {{r1}} et {{r2}}. Returns the area of the parallelogram with the specified {{base}} and {{height}}. - Calcule l'aire du parallélogramme ayant une base de longueur {{base}} et une hauteur de longueur {{height}}. + Calcule l'aire du parallélogramme ayant une base de longueur {{base}} et une hauteur de longueur {{height}}. Returns the area of the circle sector with the specified {{radius}} and {{angle}}. - Calcule l'aire du secteur de disque de rayon {{radius}} et d'angle {{angle}}. + Calcule l'aire du secteur de disque de rayon {{radius}} et d'angle {{angle}}. Returns the area of the regular polygon with the specified number of {{sides}} and side {{length}}. - Calcule l'aire du polygone régulier à {{sides}} côtés de longueur individuelle {{length}}. + Calcule l'aire du polygone régulier à {{sides}} côtés de longueur individuelle {{length}}. @@ -1081,12 +1081,12 @@ désactivé : Returns the error function at {{x}}. - Calcule la fonction d'erreur à {{x}}. + Calcule la fonction d'erreur à {{x}}. Returns the complementary error function at {{x}}. - Calcule la fonction d'erreur complémentaire à {{x}}. + Calcule la fonction d'erreur complémentaire à {{x}}. @@ -1101,12 +1101,12 @@ désactivé : Returns a slice of the specified list, from index {{start}} (inclusive) to either index {{end}} (exclusive) or the end of the list. - Renvoie une tranche de {{lst}} de l'indice {{start}} (inclus), à l'indice {{end}} (exclus) si spécifié ou à la fin de la liste. + Renvoie une tranche de {{lst}} de l'indice {{start}} (inclus), à l'indice {{end}} (exclus) si spécifié ou à la fin de la liste. Returns the population standard deviation of {{lst}}. - Calcule l'écart-type de {{lst}}. + Calcule l'écart-type de {{lst}}. @@ -1116,12 +1116,12 @@ désactivé : Returns the sample standard deviation of {{lst}}. - Calcule l'écart-type de l'échantillon {{lst}}. + Calcule l'écart-type de l'échantillon {{lst}}. Returns the sample variance of {{lst}}. - Calcule la variance de l'échantillon {{lst}}. + Calcule la variance de l'échantillon {{lst}}. @@ -1131,47 +1131,47 @@ désactivé : Converts angle {{x}} from radians to degrees. - Convertit l'angle {{x}} des radians vers les degrés. + Convertit l'angle {{x}} des radians vers les degrés. Converts angle {{x}} from degrees to radians. - Convertit l'angle {{x}} des degrés vers les radians. + Convertit l'angle {{x}} des degrés vers les radians. Returns the arc sine of {{x}}. - Calcule l'arc sinus de {{x}}. + Calcule l'arc sinus de {{x}}. Returns the arc cosine of {{x}}. - Calcule l'arc cosinus de {{x}}. + Calcule l'arc cosinus de {{x}}. Returns the arc tangent of {{x}}. - Calcule l'arc tangente de {{x}}. + Calcule l'arc tangente de {{x}}. Returns the arc tangent of {{y}} / {{x}}. - Calcule l'arc tangente de {{y}} / {{x}}. + Calcule l'arc tangente de {{y}} / {{x}}. Returns the inverse hyperbolic sine of {{x}}. - Calcule l'arc sinus hyperbolique de {{x}}. + Calcule l'arc sinus hyperbolique de {{x}}. Returns the inverse hyperbolic cosine of {{x}}. - Calcule l'arc cosinus hyperbolique de {{x}}. + Calcule l'arc cosinus hyperbolique de {{x}}. Returns the inverse hyperbolic tangent of {{x}}. - Calcule l'arc tangente hyperbolique de {{x}}. + Calcule l'arc tangente hyperbolique de {{x}}. @@ -1221,12 +1221,12 @@ désactivé : Returns the exsecant of {{x}}. - Calcule l'exsécante de {{x}}. + Calcule l'exsécante de {{x}}. Returns the excosecant of {{x}}. - Calcule l'excosécante de {{x}}. + Calcule l'excosécante de {{x}}. @@ -1251,32 +1251,32 @@ désactivé : Returns the inverse secant of {{x}}. - Calcule l'arc sécante de {{x}}. + Calcule l'arc sécante de {{x}}. Returns the inverse cosecant of {{x}}. - Calcule l'arc cosécante de {{x}}. + Calcule l'arc cosécante de {{x}}. Returns the inverse cotangent of {{x}}. - Calcule l'arc tangente de {{x}}. + Calcule l'arc tangente de {{x}}. Returns the inverse hyperbolic secant of {{x}}. - Calcule l'arc sécante hyperbolique de {{x}}. + Calcule l'arc sécante hyperbolique de {{x}}. Returns the inverse hyperbolic cosecant of {{x}}. - Calcule l'arc cosécante hyperbolique de {{x}}. + Calcule l'arc cosécante hyperbolique de {{x}}. Returns the inverse hyperbolic cotangent of {{x}}. - Calcule l'arc cotangente hyperbolique de {{x}}. + Calcule l'arc cotangente hyperbolique de {{x}}. @@ -1306,27 +1306,27 @@ désactivé : Returns the haversed sine of {{x}}. - Calcule l'haversine de {{x}}. + Calcule l'haversine de {{x}}. Returns the haversed cosine of {{x}}. - Calcule l'havercosine de {{x}}. + Calcule l'havercosine de {{x}}. Returns the hacoversed sine of {{x}}. - Calcule l'hacoversine de {{x}}. + Calcule l'hacoversine de {{x}}. Returns the hacoversed cosine of {{x}}. - Calcule l'hacovercosine de {{x}}. + Calcule l'hacovercosine de {{x}}. Returns the hypotenuse / Euclidean norm of the vector ({{x}}, {{y}}). - Calcule l'hypoténuse / la norme euclidienne du vecteur ({{x}}, {{y}}). + Calcule l'hypoténuse / la norme euclidienne du vecteur ({{x}}, {{y}}). @@ -1401,7 +1401,7 @@ désactivé : Returns the integral of {{func}} from {{a}} to {{b}} (optional number of steps: {{steps}}). - Calcule l'intégrale de {{a}} à {{b}} de {{func}} (facultatif : nombre d'étapes {{steps}}). + Calcule l'intégrale de {{a}} à {{b}} de {{func}} (facultatif : nombre d'étapes {{steps}}). @@ -1411,7 +1411,7 @@ désactivé : Returns the {{n}}-th Euler number. - Calcule le {{n}}-ième nombre d'Euler. + Calcule le {{n}}-ième nombre d'Euler. @@ -1446,7 +1446,7 @@ désactivé : Returns the number of elements in {{T}}. - Renvoie le nombre d'élements de {{T}}. + Renvoie le nombre d'élements de {{T}}. @@ -1466,12 +1466,12 @@ désactivé : Returns the inverse of the error function at {{y}}. - Calcule la fonction d'erreur inverse à {{y}}. + Calcule la fonction d'erreur inverse à {{y}}. Returns the inverse of the complementary error function at {{y}}. - Calcule la fonction d'erreur complémentaire inverse à {{y}}. + Calcule la fonction d'erreur complémentaire inverse à {{y}}. @@ -1539,7 +1539,7 @@ désactivé : Argument count mismatch (expected {exp}, got {act}) - Nombre d'arguments invalides (attendu : {exp}, reçu : {act}) + Nombre d'arguments invalides (attendu : {exp}, reçu : {act}) @@ -1559,7 +1559,7 @@ désactivé : Index '{idx}' too big for array - Indice '{idx}' trop grand pour la liste + Indice '{idx}' trop grand pour la liste @@ -1569,7 +1569,7 @@ désactivé : Invalid unary operator '{op}' - Opérateur unaire invalide '{op}' + Opérateur unaire invalide '{op}' @@ -1584,7 +1584,7 @@ désactivé : Invalid value type for {val} and operator '{op}' - Type de valeur invalide pour {val} et l'opérateur '{op}' + Type de valeur invalide pour {val} et l'opérateur '{op}' @@ -1594,7 +1594,7 @@ désactivé : Operator '{op}' not allowed for value type {type} - Opérateur '{op}' non autorisé pour le type de valeur {type} + Opérateur '{op}' non autorisé pour le type de valeur {type} @@ -1604,7 +1604,7 @@ désactivé : Invalid binary operator '{op}' for '{left}' and '{right}' - Opérateur binaire '{op}' invalide pour '{left}' et '{right}' + Opérateur binaire '{op}' invalide pour '{left}' et '{right}' @@ -1619,23 +1619,23 @@ désactivé : Trying to multiply List by non-integer ({val}) - Tentative de multiplication d'une List par un non-entier ({val}) + Tentative de multiplication d'une List par un non-entier ({val}) Type mismatch for argument #{idx} '{arg}' (expected {exp}) - Type incorrect pour l'argument #{idx} '{arg}' (attendu : {exp}) + Type incorrect pour l'argument #{idx} '{arg}' (attendu : {exp}) Array access target must be of array type - La cible d'un accès de liste doit être une liste + La cible d'un accès de liste doit être une liste HelpWindow - + Help Contents Bibliothèque @@ -2349,7 +2349,7 @@ veuillez choisir un chemin vers un autre fichier. Expected token ({type}) '{val}' - Jeton attendu ({type}) '{val}' + Jeton attendu ({type}) '{val}' @@ -2359,7 +2359,7 @@ veuillez choisir un chemin vers un autre fichier. Unexpected token ({type}) '{val}' - Jeton ({type}) '{val}' inattendu + Jeton ({type}) '{val}' inattendu @@ -2379,7 +2379,7 @@ veuillez choisir un chemin vers un autre fichier. Unexpected token ({type}) '{val}' after end of expression - Jeton ({type}) '{val}' inattendu après la fin de l'expression + Jeton ({type}) '{val}' inattendu après la fin de l'expression diff --git a/src/lang/it.ts b/src/lang/it.ts index 10e162a..e9046d6 100644 --- a/src/lang/it.ts +++ b/src/lang/it.ts @@ -31,7 +31,7 @@ p, li { white-space: pre-wrap; } <li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Windows icons under CC-BY 3.0 license - <a href="http://www.fatcow.com/free-icons"><span style=" text-decoration: underline; color:#0000ff;">(c) Fatcow Web Hosting</span></a></li></ul> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Special thanks :</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, physics and computer science teacher, whose lessons and modesty were a big help during the development</li> -<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> +<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">plz give us a good grade</p></body></html> @@ -229,22 +229,22 @@ p, li { white-space: pre-wrap; } AlgoCallStmt - + Call function Chiamare una funzione - + <html><head/><body><p>Calls the function with the specified arguments.</p><p>The argument list must consist of a comma-separated list of arguments.</p></body></html> - + Function: - + Arguments: @@ -252,17 +252,17 @@ p, li { white-space: pre-wrap; } AlgoCommentStmt - + Comment Commenta - + <html><head/><body><p>A comment has no effect whatsoever on the execution of the program.</p><p>It can contain anything.</p></body></html> - + Comment: @@ -270,22 +270,22 @@ p, li { white-space: pre-wrap; } AlgoDefineStmt - + Define variable Definire la variabile - + <html><head/><body><p>Assigns the specified value to the variable.</p><p>If the variable does not exist in the current scope or in any parent scope, it will be created in the current scope.</p></body></html> - + Value: - + Variable: @@ -293,60 +293,60 @@ p, li { white-space: pre-wrap; } AlgoDisplayStmt - + Display value Visualizzazione valore - + <html><head/><body><p>Displays a value in the output window. </p><p>The value can be of any type, it will be automatically converted to a textual representation.</p></body></html> - + Value: - + Followed by a line break - Aggiungere un'interruzione di linea + Aggiungere un'interruzione di linea AlgoForStmt - + FOR loop - + <html><head/><body><p>Executes the instructions for all values of the variable in the specified range.</p><p>At each iteration, the variable will be incremented by the step which is defaulted to 1. </p><p>The bounds are inclusive.</p></body></html> - + From: - + To: - + Step: - + Variable: - + Custom step @@ -354,22 +354,22 @@ p, li { white-space: pre-wrap; } AlgoFuncStmt - + Define function Definire una funzione - + <html><head/><body><p>Creates a custom function. The parameters must be a comma-separated list of identifiers.</p><p>A function may or may not return a value, it can very well only &quot;do&quot; things without ever giving a result. Such a function can be called using the CALL statement.</p></body></html> - + Function: - + Parameters: @@ -377,42 +377,42 @@ p, li { white-space: pre-wrap; } AlgoGFuncStmt - + Plot function Tracciare una funzione - + <html><head/><body><p>Draws the curve of the function on the specified interval.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Start: - + Step: - + Function: - + Variable: - + Color: Colore: - + End: @@ -420,37 +420,37 @@ p, li { white-space: pre-wrap; } AlgoGLineStmt - + Plot line Tracciare una linea - + <html><head/><body><p>Draws a line with the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + End Y: - + End X: - + Start X: - + Start Y: - + Color: Colore: @@ -458,27 +458,27 @@ p, li { white-space: pre-wrap; } AlgoGPointStmt - + Plot point Tracciare un punto - + <html><head/><body><p>Draws a point at the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Color: Colore: - + X: Y: - + Y: Y: @@ -486,42 +486,42 @@ p, li { white-space: pre-wrap; } AlgoGWindowStmt - + Set window Impostare la finestra del grafico - + Max Y: Max Y: - + Min Y: Min Y: - + Min X: Min Y: - + Max X: Max X: - + Grad X: - + Grad Y: - + <html><head/><body><p>Changes the size of the plot window canvas. For Grad, 0 means automatic.</p></body></html> @@ -529,17 +529,17 @@ p, li { white-space: pre-wrap; } AlgoIfStmt - + IF block - + <html><head/><body><p>Checks if the specified condition is true.</p><p>The block will only be executed if the condition is true, otherwise the program will continue with the instruction following the block.</p></body></html> - + Condition: @@ -547,32 +547,32 @@ p, li { white-space: pre-wrap; } AlgoInputStmt - + Read user input - Lettura dei dati immessi dall'utente + Lettura dei dati immessi dall'utente - + <html><head/><body><p>Asks the user for a value and assigns it to the specified variable.</p><p>Optionally, a message can be displayed. <span style=" font-weight:600;">Warning</span>: the message is an expression, thus if you want to display text you need to enclose everything inside quotes.</p></body></html> - + Display a message Visualizzare un messaggio - + Message: - + Variable: - + Text @@ -580,22 +580,22 @@ p, li { white-space: pre-wrap; } AlgoReturnStmt - + Return - + <html><head/><body><p>Exits the current function and optionally passes a value to the caller.</p></body></html> - + Value: - + Return a value @@ -603,17 +603,17 @@ p, li { white-space: pre-wrap; } AlgoSleepStmt - + Wait - + <html><head/><body><p>Waits for the specified amount of time (in <span style=" font-weight:600;">seconds</span>).</p></body></html> - + Duration: @@ -621,22 +621,22 @@ p, li { white-space: pre-wrap; } AlgoStopStmt - + Breakpoint Punto di interruzione - + <html><head/><body><p>Pauses the program until &quot;Run&quot; or &quot;Debug&quot; is pressed.</p></body></html> - + Message: - + Display a message Visualizzare un messaggio @@ -644,17 +644,17 @@ p, li { white-space: pre-wrap; } AlgoWhileStmt - + WHILE loop - + <html><head/><body><p>Executes the instructions while the condition is true.</p><p>As soon as the condition is false, the program continues with the instruction following the block.</p></body></html> - + Condition: @@ -664,18 +664,18 @@ p, li { white-space: pre-wrap; } Unknown color: {color} - Colore sconosciuto: {color} + Colore sconosciuto: {color} Unknown variable type: {type} - Tipo di variabile sconosciuto: {type} + Tipo di variabile sconosciuto: {type} CalcWindow - + Calculator Calcolatrice @@ -688,131 +688,131 @@ p, li { white-space: pre-wrap; } ChangeThemeWindow - + Edit theme - + Block: - + Comment: - + Keyword: - + Literal: - + Window: - + Shadow: - + Button: - + Button Text: - + Disabled Button Text: - + Bright Text: - + Disabled Highlight: - + Highlight: - + Highlighted Text: - + Link: - + Disabled Highlighted Text: - + Alternate Base: - + Base: - + Window Text: - + Dark: - + Disabled Text: - + Tool Tip Text: - + Text: - + Tool Tip Base: - + Disabled Window Text : @@ -878,12 +878,12 @@ Window Text : Returns the largest integer less than or equal to {{num}}. - Riporta l'intero più grande meno grande o uguale a {{num}}. + Riporta l'intero più grande meno grande o uguale a {{num}}. Returns the smallest integer greater than or equal to {{num}}. - Riporta l'intero più piccolo maggiore o uguale a {{num}}. + Riporta l'intero più piccolo maggiore o uguale a {{num}}. @@ -903,7 +903,7 @@ Window Text : Returns the argument (or phase) of {{x}}. - Riporta l'argomento di {{x}}. + Riporta l'argomento di {{x}}. @@ -1617,7 +1617,7 @@ Window Text : HelpWindow - + Help Contents Sommario Guida @@ -1650,7 +1650,7 @@ Window Text : InlineCodeDialog - + Expression editor Editor espressioni @@ -2339,7 +2339,7 @@ please choose another file path. Expected token ({type}) '{val}' - Token previsto ({type}) '{val}' + Token previsto ({type}) '{val}' @@ -2354,7 +2354,7 @@ please choose another file path. Unexpected token ({type}) '{val}' - Token imprevisto ({type}) '{val}' + Token imprevisto ({type}) '{val}' diff --git a/src/lang/translator.py b/src/lang/translator.py index cba6c95..00909e6 100644 --- a/src/lang/translator.py +++ b/src/lang/translator.py @@ -2,7 +2,10 @@ import importlib import os -import sip +try: + from PyQt5 import sip +except: + import sip import sys import types from typing import List, Tuple diff --git a/src/lang/zh-CN.ts b/src/lang/zh-CN.ts index b8d2bdd..c5e543b 100644 --- a/src/lang/zh-CN.ts +++ b/src/lang/zh-CN.ts @@ -31,7 +31,7 @@ p, li { white-space: pre-wrap; } <li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Windows icons under CC-BY 3.0 license - <a href="http://www.fatcow.com/free-icons"><span style=" text-decoration: underline; color:#0000ff;">(c) Fatcow Web Hosting</span></a></li></ul> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Special thanks :</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://twitter.com/davR74130"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">David Roche</span></a>, physics and computer science teacher, whose lessons and modesty were a big help during the development</li> -<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> +<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Alan Turing</span>, without whom the computer you're looking at wouldn't be a thing</li></ul> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">plz give us a good grade</p></body></html> @@ -229,22 +229,22 @@ p, li { white-space: pre-wrap; } AlgoCallStmt - + Call function - + <html><head/><body><p>Calls the function with the specified arguments.</p><p>The argument list must consist of a comma-separated list of arguments.</p></body></html> - + Function: - + Arguments: @@ -252,17 +252,17 @@ p, li { white-space: pre-wrap; } AlgoCommentStmt - + Comment 注释/取消注释 - + <html><head/><body><p>A comment has no effect whatsoever on the execution of the program.</p><p>It can contain anything.</p></body></html> - + Comment: @@ -270,22 +270,22 @@ p, li { white-space: pre-wrap; } AlgoDefineStmt - + Define variable - + <html><head/><body><p>Assigns the specified value to the variable.</p><p>If the variable does not exist in the current scope or in any parent scope, it will be created in the current scope.</p></body></html> - + Value: - + Variable: @@ -293,22 +293,22 @@ p, li { white-space: pre-wrap; } AlgoDisplayStmt - + Display value - + <html><head/><body><p>Displays a value in the output window. </p><p>The value can be of any type, it will be automatically converted to a textual representation.</p></body></html> - + Value: - + Followed by a line break @@ -316,37 +316,37 @@ p, li { white-space: pre-wrap; } AlgoForStmt - + FOR loop - + <html><head/><body><p>Executes the instructions for all values of the variable in the specified range.</p><p>At each iteration, the variable will be incremented by the step which is defaulted to 1. </p><p>The bounds are inclusive.</p></body></html> - + From: - + To: - + Step: - + Variable: - + Custom step @@ -354,22 +354,22 @@ p, li { white-space: pre-wrap; } AlgoFuncStmt - + Define function - + <html><head/><body><p>Creates a custom function. The parameters must be a comma-separated list of identifiers.</p><p>A function may or may not return a value, it can very well only &quot;do&quot; things without ever giving a result. Such a function can be called using the CALL statement.</p></body></html> - + Function: - + Parameters: @@ -377,42 +377,42 @@ p, li { white-space: pre-wrap; } AlgoGFuncStmt - + Plot function - + <html><head/><body><p>Draws the curve of the function on the specified interval.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Start: - + Step: - + Function: - + Variable: - + Color: - + End: @@ -420,37 +420,37 @@ p, li { white-space: pre-wrap; } AlgoGLineStmt - + Plot line - + <html><head/><body><p>Draws a line with the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + End Y: - + End X: - + Start X: - + Start Y: - + Color: @@ -458,27 +458,27 @@ p, li { white-space: pre-wrap; } AlgoGPointStmt - + Plot point - + <html><head/><body><p>Draws a point at the specified coordinates.</p><p>The color must be a string containing the color name or RGB hex string.</p></body></html> - + Color: - + X: - + Y: @@ -486,42 +486,42 @@ p, li { white-space: pre-wrap; } AlgoGWindowStmt - + Set window - + Max Y: - + Min Y: - + Min X: - + Max X: - + Grad X: - + Grad Y: - + <html><head/><body><p>Changes the size of the plot window canvas. For Grad, 0 means automatic.</p></body></html> @@ -529,17 +529,17 @@ p, li { white-space: pre-wrap; } AlgoIfStmt - + IF block - + <html><head/><body><p>Checks if the specified condition is true.</p><p>The block will only be executed if the condition is true, otherwise the program will continue with the instruction following the block.</p></body></html> - + Condition: @@ -547,32 +547,32 @@ p, li { white-space: pre-wrap; } AlgoInputStmt - + Read user input - + <html><head/><body><p>Asks the user for a value and assigns it to the specified variable.</p><p>Optionally, a message can be displayed. <span style=" font-weight:600;">Warning</span>: the message is an expression, thus if you want to display text you need to enclose everything inside quotes.</p></body></html> - + Display a message - + Message: - + Variable: - + Text @@ -580,22 +580,22 @@ p, li { white-space: pre-wrap; } AlgoReturnStmt - + Return - + <html><head/><body><p>Exits the current function and optionally passes a value to the caller.</p></body></html> - + Value: - + Return a value @@ -603,17 +603,17 @@ p, li { white-space: pre-wrap; } AlgoSleepStmt - + Wait - + <html><head/><body><p>Waits for the specified amount of time (in <span style=" font-weight:600;">seconds</span>).</p></body></html> - + Duration: @@ -621,22 +621,22 @@ p, li { white-space: pre-wrap; } AlgoStopStmt - + Breakpoint - + <html><head/><body><p>Pauses the program until &quot;Run&quot; or &quot;Debug&quot; is pressed.</p></body></html> - + Message: - + Display a message @@ -644,38 +644,28 @@ p, li { white-space: pre-wrap; } AlgoWhileStmt - + WHILE loop - + <html><head/><body><p>Executes the instructions while the condition is true.</p><p>As soon as the condition is false, the program continues with the instruction following the block.</p></body></html> - + Condition: Algobox - - - Unknown color: {color} - - - - - Unknown variable type: {type} - - CalcWindow - + Calculator 计算器 @@ -688,131 +678,131 @@ p, li { white-space: pre-wrap; } ChangeThemeWindow - + Edit theme - + Block: - + Comment: - + Keyword: - + Literal: - + Window: - + Shadow: - + Button: - + Button Text: - + Disabled Button Text: - + Bright Text: - + Disabled Highlight: - + Highlight: - + Highlighted Text: - + Link: - + Disabled Highlighted Text: - + Alternate Base: - + Base: - + Window Text: - + Dark: - + Disabled Text: - + Tool Tip Text: - + Text: - + Tool Tip Base: - + Disabled Window Text : @@ -1617,7 +1607,7 @@ Window Text : HelpWindow - + Help Contents 帮助目录 @@ -1650,7 +1640,7 @@ Window Text : InlineCodeDialog - + Expression editor 表达式编辑器 @@ -2339,7 +2329,7 @@ please choose another file path. Expected token ({type}) '{val}' - 需要的符号({type}) '{val}' + 需要的符号({type}) '{val}' @@ -2354,7 +2344,7 @@ please choose another file path. Unexpected token ({type}) '{val}' - 意外的令牌({type}) '{val}' + 意外的令牌({type}) '{val}' From 22d8d02fe43ade3c7405e85872b3699a2ba361a8 Mon Sep 17 00:00:00 2001 From: Georges Khaznadar Date: Sat, 9 Nov 2024 18:03:09 +0100 Subject: [PATCH 2/2] changes which include most of changes made for Turing's debian package --- requirements.txt | 1 + src/algo/backends/texas.py | 224 +++++++++--------- src/algo/stmts/CallStmt.py | 2 +- src/forms/help.py | 4 +- src/forms/inline_code_editor.py | 4 +- src/forms/mainwindow.py | 27 +-- src/forms/ui_mainwindow.ui | 6 +- src/lang/de.ts | 320 ++++++++++++------------- src/lang/es.ts | 332 +++++++++++++------------- src/lang/fr.ts | 362 ++++++++++++++--------------- src/lang/it.ts | 334 +++++++++++++------------- src/lang/zh-CN.ts | 331 +++++++++++++------------- src/maths/nodes/ArrayAccessNode.py | 2 +- src/maths/nodes/AstNode.py | 16 +- src/maths/nodes/BinOpNode.py | 6 +- src/maths/nodes/StringNode.py | 2 +- src/maths/parser.py | 2 +- src/project.pro | 203 ++++++++-------- src/tools/docgen.py | 6 +- 19 files changed, 1079 insertions(+), 1105 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8a281c5..981f42d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ altgraph==0.15 autopep8==1.3.5 cycler==0.10.0 docutils==0.14 +future==0.16.0 jedi==0.11.1 kiwisolver==1.0.1 macholib==1.9 diff --git a/src/algo/backends/texas.py b/src/algo/backends/texas.py index 512068b..59cf1a5 100644 --- a/src/algo/backends/texas.py +++ b/src/algo/backends/texas.py @@ -4,10 +4,10 @@ from algo.stmts import * from maths.nodes import * from maths.parser import quick_parse as parse -from util import pairwise +from util import lstreplace, pairwise tokens = { - # 'unused': [[0x00]], +# 'unused': [[0x00]], '►DMS': [[0x01]], '►Dec': [[0x02]], '►Frac': [[0x03]], @@ -21,7 +21,7 @@ '°': [[0x0B]], '⁻¹': [[0x0C]], '²': [[0x0D]], - 'ᵀ': [[0x0E]], # matrix transpose + 'ᵀ': [[0x0E]], # matrix transpose '³': [[0x0F]], '(': [[0x10]], ')': [[0x11]], @@ -45,13 +45,13 @@ 'seq(': [[0x23]], 'fnInt(': [[0x24]], 'nDeriv(': [[0x25]], - # 'unused': [[0x26]], +# 'unused': [[0x26]], 'fMin(': [[0x27]], 'fMax(': [[0x28]], ' ': [[0x29]], '"': [[0x2A]], ',': [[0x2B]], - 'ii': [[0x2C], "i"], # imaginary unit + 'ii': [[0x2C], "i"], # imaginary unit '!': [[0x2D]], 'CubicReg ': [[0x2E]], 'QuartReg ': [[0x2F]], @@ -66,7 +66,7 @@ '8': [[0x38]], '9': [[0x39]], '.': [[0x3A]], - 'ᴇ': [[0x3B]], # exponent + 'ᴇ': [[0x3B]], # exponent ' or ': [[0x3C]], ' xor ': [[0x3D]], ':': [[0x3E]], @@ -99,14 +99,14 @@ 'Y': [[0x59]], 'Z': [[0x5A]], 'θ': [[0x5B]], - # '2-byte': [[0x5C]], Matrices - # '2-byte': [[0x5D]], Lists - # '2-byte': [[0x5E]], Equations +# '2-byte': [[0x5C]], Matrices +# '2-byte': [[0x5D]], Lists +# '2-byte': [[0x5E]], Equations 'prgm': [[0x5F]], - # '2-byte': [[0x60]], Pictures - # '2-byte': [[0x61]], GDBs - # '2-byte': [[0x62]], Statistics - # '2-byte': [[0x63]], Window and Finance +# '2-byte': [[0x60]], Pictures +# '2-byte': [[0x61]], GDBs +# '2-byte': [[0x62]], Statistics +# '2-byte': [[0x63]], Window and Finance 'Radian': [[0x64]], 'Degree': [[0x65]], 'Normal': [[0x66]], @@ -133,7 +133,7 @@ 'IndpntAsk': [[0x7B]], 'DependAuto': [[0x7C]], 'DependAsk': [[0x7D]], - # '2-byte': [[0x7E]], Graph Format +# '2-byte': [[0x7E]], Graph Format '□': [[0x7F]], '﹢': [[0x80]], '·': [[0x81]], @@ -177,7 +177,7 @@ 'Tangent(': [[0xA7]], 'DrawInv ': [[0xA8]], 'DrawF ': [[0xA9]], - # '2-byte': [[0xAA]], Strings +# '2-byte': [[0xAA]], Strings 'rand': [[0xAB]], 'π_const': [[0xAC], "π"], 'getKey': [[0xAD]], @@ -194,7 +194,7 @@ 'not(': [[0xB8]], 'iPart(': [[0xB9]], 'fPart(': [[0xBA]], - # '2-byte': [[0xBB]], Miscellaneous +# '2-byte': [[0xBB]], Miscellaneous '√(': [[0xBC]], '³√(': [[0xBD]], 'ln(': [[0xBE]], @@ -246,7 +246,7 @@ 'Plot1(': [[0xEC]], 'Plot2(': [[0xED]], 'Plot3(': [[0xEE]], - # 'TI-84+(C(S)E)': [[0xEF]], TI-84+ +# 'TI-84+(C(S)E)': [[0xEF]], TI-84+ '^': [[0xF0]], '×√': [[0xF1]], '1-Var Stats ': [[0xF2]], @@ -313,7 +313,7 @@ 'r₄': [[0x5E, 0x43]], 'r₅': [[0x5E, 0x44]], 'r₆': [[0x5E, 0x45]], - 'u_': [[0x5E, 0x80]], # sequences todo + 'u_': [[0x5E, 0x80]], # sequences todo 'v_': [[0x5E, 0x81]], 'w_': [[0x5E, 0x82]], @@ -354,7 +354,7 @@ 'Str0': [[0xAA, 0x09]], # Statistics - # 'internal use only': [[0x62, 0x00]], +# 'internal use only': [[0x62, 0x00]], 'RegEq': [[0x62, 0x01]], 'n_stat': [[0x62, 0x02], "n"], 'x̄': [[0x62, 0x03]], @@ -423,7 +423,7 @@ 'Yscl': [[0x63, 0x03]], 'u(nMin)': [[0x63, 0x04]], 'v(nMin)': [[0x63, 0x05]], - 'u(n-1)_wnd': [[0x63, 0x06], "u(n-1)"], # TI-82 compatibility + 'u(n-1)_wnd': [[0x63, 0x06], "u(n-1)"], # TI-82 compatibility 'v(n-1)_wnd': [[0x63, 0x07], "v(n-1)"], 'Zu(nMin)': [[0x63, 0x08]], 'Zv(nMin)': [[0x63, 0x09]], @@ -589,14 +589,14 @@ 'ANOVA(': [[0xBB, 0x59]], 'ModBoxplot': [[0xBB, 0x5A]], 'NormProbPlot': [[0xBB, 0x5B]], - # 'unused': [[0xBB, 0x5C]], - # 'unused': [[0xBB, 0x5D]], - # 'unused': [[0xBB, 0x5E]], - # 'unused': [[0xBB, 0x5F]], - # 'unused': [[0xBB, 0x60]], - # 'unused': [[0xBB, 0x61]], - # 'unused': [[0xBB, 0x62]], - # 'unused': [[0xBB, 0x63]], +# 'unused': [[0xBB, 0x5C]], +# 'unused': [[0xBB, 0x5D]], +# 'unused': [[0xBB, 0x5E]], +# 'unused': [[0xBB, 0x5F]], +# 'unused': [[0xBB, 0x60]], +# 'unused': [[0xBB, 0x61]], +# 'unused': [[0xBB, 0x62]], +# 'unused': [[0xBB, 0x63]], 'G-T': [[0xBB, 0x64]], 'ZoomFit': [[0xBB, 0x65]], 'DiagnosticOn': [[0xBB, 0x66]], @@ -623,7 +623,7 @@ 'è': [[0xBB, 0x7B]], 'ê': [[0xBB, 0x7C]], 'ë': [[0xBB, 0x7D]], - # 'unused': [[0xBB, 0x7E]], +# 'unused': [[0xBB, 0x7E]], 'Ì': [[0xBB, 0x7F]], 'Î': [[0xBB, 0x80]], 'Ï': [[0xBB, 0x81]], @@ -667,7 +667,7 @@ 'π': [[0xBB, 0xA7]], 'ρ': [[0xBB, 0xA8]], 'Σ': [[0xBB, 0xA9]], - # 'unused': [[0xBB, 0xAA]], +# 'unused': [[0xBB, 0xAA]], 'φ': [[0xBB, 0xAB]], 'Ω': [[0xBB, 0xAC]], 'p^_sym': [[0xBB, 0xAD]], @@ -684,7 +684,7 @@ 'i': [[0xBB, 0xB8]], 'j': [[0xBB, 0xB9]], 'k': [[0xBB, 0xBA]], - # 'unused': [[0xBB, 0xBB]], +# 'unused': [[0xBB, 0xBB]], 'l': [[0xBB, 0xBC]], 'm': [[0xBB, 0xBD]], 'n': [[0xBB, 0xBE]], @@ -736,23 +736,23 @@ '→_arr': [[0xBB, 0xEC]], '↑_arr': [[0xBB, 0xED]], '↓_arr': [[0xBB, 0xEE]], - # 'unused': [[0xBB, 0xEF]], +# 'unused': [[0xBB, 0xEF]], 'x_sym': [[0xBB, 0xF0]], '∫': [[0xBB, 0xF1]], '↑_sym': [[0xBB, 0xF2]], '↓_sym': [[0xBB, 0xF3]], '√': [[0xBB, 0xF4]], '[=]': [[0xBB, 0xF5]], - # '': [[0xBB, 0xF6]], - # '': [[0xBB, 0xF7]], - # '': [[0xBB, 0xF8]], - # '': [[0xBB, 0xF9]], - # '': [[0xBB, 0xFA]], - # '': [[0xBB, 0xFB]], - # '': [[0xBB, 0xFC]], - # '': [[0xBB, 0xFD]], - # '': [[0xBB, 0xFE]], - # '': [[0xBB, 0xFF]], +# '': [[0xBB, 0xF6]], +# '': [[0xBB, 0xF7]], +# '': [[0xBB, 0xF8]], +# '': [[0xBB, 0xF9]], +# '': [[0xBB, 0xFA]], +# '': [[0xBB, 0xFB]], +# '': [[0xBB, 0xFC]], +# '': [[0xBB, 0xFD]], +# '': [[0xBB, 0xFE]], +# '': [[0xBB, 0xFF]], # TI-84+ 'setDate(': [[0xEF, 0x00]], @@ -786,23 +786,23 @@ 'ZFrac1/8': [[0xEF, 0x1C]], 'ZFrac1/10': [[0xEF, 0x1D]], 'mathprintbox': [[0xEF, 0x1E]], - # '': [[0xEF, 0x1F]], - # '': [[0xEF, 0x20]], - # '': [[0xEF, 0x21]], - # '': [[0xEF, 0x22]], - # '': [[0xEF, 0x23]], - # '': [[0xEF, 0x24]], - # '': [[0xEF, 0x25]], - # '': [[0xEF, 0x26]], - # '': [[0xEF, 0x27]], - # '': [[0xEF, 0x28]], - # '': [[0xEF, 0x29]], - # '': [[0xEF, 0x2A]], - # '': [[0xEF, 0x2B]], - # '': [[0xEF, 0x2C]], - # '': [[0xEF, 0x2D]], - # '': [[0xEF, 0x2E]], - # '': [[0xEF, 0x2F]], +# '': [[0xEF, 0x1F]], +# '': [[0xEF, 0x20]], +# '': [[0xEF, 0x21]], +# '': [[0xEF, 0x22]], +# '': [[0xEF, 0x23]], +# '': [[0xEF, 0x24]], +# '': [[0xEF, 0x25]], +# '': [[0xEF, 0x26]], +# '': [[0xEF, 0x27]], +# '': [[0xEF, 0x28]], +# '': [[0xEF, 0x29]], +# '': [[0xEF, 0x2A]], +# '': [[0xEF, 0x2B]], +# '': [[0xEF, 0x2C]], +# '': [[0xEF, 0x2D]], +# '': [[0xEF, 0x2E]], +# '': [[0xEF, 0x2F]], '►n/d◄►Un/d': [[0xEF, 0x30]], '►F◄►D': [[0xEF, 0x31]], 'remainder(': [[0xEF, 0x32]], @@ -817,9 +817,9 @@ 'DEC': [[0xEF, 0x3B]], 'FRAC': [[0xEF, 0x3C]], 'FRAC-APPROX': [[0xEF, 0x3D]], - # '': [[0xEF, 0x3E]], - # '': [[0xEF, 0x3F]], - # '': [[0xEF, 0x40]], +# '': [[0xEF, 0x3E]], +# '': [[0xEF, 0x3F]], +# '': [[0xEF, 0x40]], 'BLUE': [[0xEF, 0x41]], 'RED': [[0xEF, 0x42]], 'BLACK': [[0xEF, 0x43]], @@ -847,43 +847,43 @@ 'Image0': [[0xEF, 0x59]], 'Gridline ': [[0xEF, 0x5A]], 'BackgroundOn ': [[0xEF, 0x5B]], - # '': [[0xEF, 0x5C]], - # '': [[0xEF, 0x5D]], - # '': [[0xEF, 0x5E]], - # '': [[0xEF, 0x5F]], - # '': [[0xEF, 0x60]], - # '': [[0xEF, 0x61]], - # '': [[0xEF, 0x62]], - # '': [[0xEF, 0x63]], +# '': [[0xEF, 0x5C]], +# '': [[0xEF, 0x5D]], +# '': [[0xEF, 0x5E]], +# '': [[0xEF, 0x5F]], +# '': [[0xEF, 0x60]], +# '': [[0xEF, 0x61]], +# '': [[0xEF, 0x62]], +# '': [[0xEF, 0x63]], 'BackgroundOff': [[0xEF, 0x64]], 'GraphColor(': [[0xEF, 0x65]], - # '': [[0xEF, 0x66]], +# '': [[0xEF, 0x66]], 'TextColor(': [[0xEF, 0x67]], 'Asm84CPrgm': [[0xEF, 0x68]], - # '': [[0xEF, 0x69]], +# '': [[0xEF, 0x69]], 'DetectAsymOn': [[0xEF, 0x6A]], 'DetectAsymOff': [[0xEF, 0x6B]], 'BorderColor ': [[0xEF, 0x6C]], - # '': [[0xEF, 0x6D]], - # '': [[0xEF, 0x6E]], - # '': [[0xEF, 0x6F]], - # '': [[0xEF, 0x70]], - # '': [[0xEF, 0x71]], - # '': [[0xEF, 0x72]], +# '': [[0xEF, 0x6D]], +# '': [[0xEF, 0x6E]], +# '': [[0xEF, 0x6F]], +# '': [[0xEF, 0x70]], +# '': [[0xEF, 0x71]], +# '': [[0xEF, 0x72]], 'tinydotplot': [[0xEF, 0x73]], 'Thin': [[0xEF, 0x74]], 'Dot-Thin': [[0xEF, 0x75]], - # '': [[0xEF, 0x76]], - # '': [[0xEF, 0x77]], - # '': [[0xEF, 0x78]], +# '': [[0xEF, 0x76]], +# '': [[0xEF, 0x77]], +# '': [[0xEF, 0x78]], 'PlySmth2': [[0xEF, 0x79]], 'Asm84CEPrgm': [[0xEF, 0x7A]], - # '': [[0xEF, 0x7B]], - # '': [[0xEF, 0x7C]], - # '': [[0xEF, 0x7D]], - # '': [[0xEF, 0x7E]], - # '': [[0xEF, 0x7F]], - # '': [[0xEF, 0x80]], +# '': [[0xEF, 0x7B]], +# '': [[0xEF, 0x7C]], +# '': [[0xEF, 0x7D]], +# '': [[0xEF, 0x7E]], +# '': [[0xEF, 0x7F]], +# '': [[0xEF, 0x80]], 'QuartilesSetting…': [[0xEF, 0x81]], 'u(n-2)': [[0xEF, 0x82]], 'v(n-2)': [[0xEF, 0x83]], @@ -908,27 +908,24 @@ 'Wait ': [[0xEF, 0x96]], 'toString(': [[0xEF, 0x97]], 'eval': [[0xEF, 0x98]], - # '': [[0xEF, 0x99]], - # '': [[0xEF, 0x9A]], - # '': [[0xEF, 0x9B]], - # '': [[0xEF, 0x9C]], - # '': [[0xEF, 0x9D]], - # '': [[0xEF, 0x9E]], - # '': [[0xEF, 0x9F]], +# '': [[0xEF, 0x99]], +# '': [[0xEF, 0x9A]], +# '': [[0xEF, 0x9B]], +# '': [[0xEF, 0x9C]], +# '': [[0xEF, 0x9D]], +# '': [[0xEF, 0x9E]], +# '': [[0xEF, 0x9F]], } - def linify(lst): if lst: return lst + ["\n"] return [] - def paren(lst): return ["("] + lst + [")"] - def listjoin(args, sep): res = [] @@ -941,7 +938,6 @@ def listjoin(args, sep): return res - def convert_color(node): colors = [ 'BLUE', @@ -1028,11 +1024,9 @@ def convert_node(node): print("unimpl node %s" % type(node)) - def convert_block(block): return [tok for a, b in pairwise(block) for tok in convert_stmt(a, b)] - def convert_stmt(stmt, next=None): if isinstance(stmt, AssignStmt): return convert_node(stmt.value) + ["→"] + convert_node(stmt.variable) @@ -1130,7 +1124,6 @@ def convert_stmt(stmt, next=None): print("unimpl stmt %s" % type(stmt)) - def stringify(toklst): res = "" @@ -1143,33 +1136,31 @@ def stringify(toklst): return res - def binify(toklst): if toklst: return [bin for tok in toklst for bin in tokens[tok][0]] return [] - def package(name, data): entry = struct.pack(" List[str]: - return [self.to_node().python()] + return ["(%s)(%s)" % (self.function.python(), ", ".join(x.python() for x in self.arguments))] def to_node(self): return CallNode(self.function, self.arguments) diff --git a/src/forms/help.py b/src/forms/help.py index 2447e79..cae4b4c 100644 --- a/src/forms/help.py +++ b/src/forms/help.py @@ -44,8 +44,8 @@ def on_item_select(self): category, function = maths.lib.find_function(current.statusTip(0)) name, args, desc = function[:3] - desc = re.sub(r"{{(\w+)\}\}", "\g<1>", escape(desc)) - desc = re.sub(r"//(\w+)//", "\g<1>", desc) + desc = re.sub(r"{{(\w+)\}\}", r"\g<1>", escape(desc)) + desc = re.sub(r"//(\w+)//", r"\g<1>", desc) html = util.html.centered("

%s

" % maths.lib.docs.get_func_def_html(function)) diff --git a/src/forms/inline_code_editor.py b/src/forms/inline_code_editor.py index d64d701..9c25cee 100644 --- a/src/forms/inline_code_editor.py +++ b/src/forms/inline_code_editor.py @@ -73,8 +73,8 @@ def load_funcs(self): lay.addWidget(label_func) label_desc = QLabel() - desc = re.sub(r"{{(\w+)\}\}", "\g<1>", html.escape(f[2])) - desc = re.sub(r"//(\w+)//", "\g<1>", desc) + desc = re.sub(r"{{(\w+)\}\}", r"\g<1>", html.escape(f[2])) + desc = re.sub(r"//(\w+)//", r"\g<1>", desc) label_desc.setText(desc) diff --git a/src/forms/mainwindow.py b/src/forms/mainwindow.py index 2816941..4ba2613 100644 --- a/src/forms/mainwindow.py +++ b/src/forms/mainwindow.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -from util.profiler import pf_point, pf_end - import html import json import os @@ -34,7 +32,6 @@ from util import theming, show_error from util.widgets import * - translate = QCoreApplication.translate @@ -141,8 +138,6 @@ class ExecState(): keyword_html = lambda: '' % theming.algo_colors[2] red_html = lambda: '' % theming.algo_colors[3] -label_format = " %s" + " " * 10 - def sleep(duration): begin = datetime.datetime.now() @@ -264,8 +259,7 @@ def article_fetch(language): import urllib.request from xml.etree import ElementTree - response = urllib.request.urlopen( - urllib.request.Request("https://turingapp.ml/%s/feed/" % language, headers={'User-Agent': 'Mozilla/5.0'})) + response = urllib.request.urlopen(urllib.request.Request("https://turingapp.ml/%s/feed/" % language, headers={'User-Agent': 'Mozilla/5.0'})) xml = ElementTree.fromstring(response.read()) result = [] @@ -408,7 +402,8 @@ def refresh_buttons_status(): "Replace", "Run", "Step", - "ConvertToPython" + "ConvertToPython", + "ConvertToPseudocode" ]: get_action(c).setEnabled(active_code) @@ -1106,7 +1101,7 @@ def handler_Open(whichDir=""): """ sel_file, _ = QFileDialog.getOpenFileName( GuiState.window, translate("MainWindow", "Open"), - whichDir or "", + whichDir, ";;".join(GuiState.filters.values())) if not sel_file: @@ -1495,7 +1490,7 @@ def gen_func(item): txt.dclicked.connect(algo_double_click) item.lbl = txt GuiState.ui.treeWidget.setItemWidget(item, 0, txt) - + GuiState.ui.treeWidget.header().setSectionResizeMode(QHeaderView.ResizeToContents) return txt @@ -1506,8 +1501,7 @@ def get_item_html(html, data=""): item.setFont(0, GuiState.ui.treeWidget.font()) lbl = get_item_label(item) lbl.setFont(item.font(0)) - lbl.setText(label_format % html) - item.setSizeHint(0, lbl.sizeHint()) + lbl.setText(' %s' % html) GuiState.ui.treeWidget.setItemWidget(item, 0, lbl) @@ -1517,7 +1511,7 @@ def get_item_html(html, data=""): def refresh_algo_text(): for item, stmt in GuiState.item_map.values(): lbl = get_item_label(item) - lbl.setText(label_format % str_stmt(stmt)) + lbl.setText(' %s' % str_stmt(stmt)) def add_display(): @@ -2327,8 +2321,6 @@ def init_ui(): load_languages() - GuiState.ui.treeWidget.header().setSectionResizeMode(QHeaderView.ResizeToContents) - GuiState.algo_base_font = GuiState.ui.treeWidget.font() recent_init_actions() @@ -2493,7 +2485,6 @@ def autosave_clear(): def clean_exit(): autosave_clear() GuiState.code_editor.backend.stop() - pf_end() sys.exit() @@ -2506,9 +2497,7 @@ def version_check(): import urllib.request import re - result = json.load(urllib.request.urlopen( - urllib.request.Request("https://api.github.com/repos/TuringApp/Turing/releases/latest", - headers={'User-Agent': 'Mozilla/5.0'}))) + result = json.load(urllib.request.urlopen(urllib.request.Request("https://api.github.com/repos/TuringApp/Turing/releases/latest", headers={'User-Agent': 'Mozilla/5.0'}))) if result and type(result) == dict and "tag_name" in result: version = re.findall(r"[\d.]+", result["tag_name"])[0] diff --git a/src/forms/ui_mainwindow.ui b/src/forms/ui_mainwindow.ui index 5b4c588..f046a74 100644 --- a/src/forms/ui_mainwindow.ui +++ b/src/forms/ui_mainwindow.ui @@ -174,9 +174,6 @@ true - - false - 1 @@ -784,6 +781,7 @@ + @@ -1654,4 +1652,4 @@ p, li { white-space: pre-wrap; } - + \ No newline at end of file diff --git a/src/lang/de.ts b/src/lang/de.ts index fc47ede..47e2b98 100644 --- a/src/lang/de.ts +++ b/src/lang/de.ts @@ -4,26 +4,26 @@ AboutWindow - + About Turing Über Turing - + Program Programm - + License Lizenz - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Turing {version}</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Release channel : </span>{channel} <br /><br />Free and open-source software to assist the learning of algorithms and programming. <br /><br /><span style=" font-weight:600;">Copyright (c) 2018 the Turing development team (Léo Joly, Tom Niget)</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This software is distributed under the terms of the MIT license and makes use of the <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">Qt</span></a> / <a href="https://riverbankcomputing.com/software/pyqt/"><span style=" text-decoration: underline; color:#0000ff;">pyQt</span></a>. frameworks.</li> @@ -39,97 +39,97 @@ p, li { white-space: pre-wrap; } Algo - + [k]BREAK[/k] [k]VERLASSEN[/k] - + [k]CONTINUE[/k] [k]FORTSETZEN[/k] - + [b]ELSE[/b] [b]SONST[/b] - + [b]WHILE[/b] [c]{cond}[/c] [b]SOLANGE[/b] [c]{cond}[/c] - + [b]IF[/b] [c]{cond}[/c] [b]WENN[/b] [c]{cond}[/c] - + [k]DECLARE[/k] [c]{var}[/c] [k]DEKLARIEREN[/k] [c]{var}[/c] - + [k]CALL[/k] [c]{code}[/c] [k]AUFRUFEN[/k] [c]{code}[/c] - + [b]FOR[/b] [c]{var}[/c] [b]FROM[/b] [c]{begin}[/c] [b]TO[/b] [c]{end}[/c] {step} [b]FÜR[/b] [c]{var}[/c] [b]VON[/b] [c]{begin}[/c] [b]BIS[/b] [c]{end}[/c] {step} - + ([b]STEP[/b] [c]{step}[/c]) ([b]SCHRITTWEITE[/b] [c]{step}[/c]) - + [b]FUNCTION[/b] [c]{func}({args})[/c] [b]FUNKTION[/b] [c]{func}({args})[/c] - + [k]RETURN[/k] [c]{val}[/c] [k]ZURÜCKGEBEN[/k] [c]{val}[/c] - + [k]STOP[/k] [c]{val}[/c] [k]UNTERBRECHEN[/k] [c]{val}[/c] - + [k]WAIT[/k] [c]{val}[/c] [k]SECONDS[/k] [k]WARTEN[/k] [c]{val}[/c] [k]SEKUNDEN[/k] - + [k]CLEAR PLOT[/k] - + [k]DRAW LINE[/k] [c]{color}[/c] [k]FROM[/k] ([c]{start_x}[/c]; [c]{start_y}[/c]) [k]TO[/k] ([c]{end_x}[/c]; [c]{end_y}[/c]) - + [k]DRAW POINT[/k] [c]{color}[/c] [k]AT[/k] ([c]{x}[/c]; [c]{y}[/c]) - + [k]PLOT FUNCTION[/k] [c]{color}[/c] [i]f[/i]({var}) = [c]{expr}[/c] [k]FROM[/k] [c]{begin}[/c] [k]TO[/k] [c]{end}[/c] [k]STEP[/k] [c]{step}[/c] - + [b]PROGRAM[/b] [b]PROGRAMM[/b] - + [i]empty[/i] [i]frei[/i] @@ -201,27 +201,27 @@ p, li { white-space: pre-wrap; } - + [k]SET WINDOW[/k] [i]Xmin=[/i][c]{x_min}[/c] [i]Xmax=[/i][c]{x_max}[/c] [i]Ymin=[/i][c]{y_min}[/c] [i]Ymax=[/i][c]{y_max}[/c] [i]Xgrad=[/i][c]{x_grad}[/c] [i]Ygrad=[/i][c]{y_grad}[/c] - + [k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c] - + [k]DISPLAY[/k] [c]{val}[/c] {newline} - + [k]INPUT[/k] [c]{prompt}[/c] [k]TO[/k] [c]{var}[/c] {text} - + [c]{var}[/c] [k]&#129128;[/k] [c]{value}[/c] @@ -1658,663 +1658,663 @@ Window Text : MainWindow - + Home Start - + Pseudocode Pseudocode - + Duplicate Line shorter - + Delete Line - + Edit Line - + Zoom in Vergrößern - + Zoom out Verkleinern - + Reset zoom Standardgröße - + Basic Basisch - + Breakpoint Haltepunkt - + Read user INPUT BENUTZEREINGABEN lesen - + DISPLAY value - + Comment Kommentar - + Wait Warten - + Blocks - + WHILE loop SOLANGE Schleife - + ELSE block - + FOR loop FÜR Schleife - + IF block - + CONTINUE - + BREAK VERLASSEN - + Functions Funktionen - + CALL function Funktion AUFRUFEN - + Define FUNCTION - + RETURN ZURÜCKGEBEN - + Plot - + Set window Grafikfensters - + Clear plot - + Draw point Plotten Punktes - + Draw line Plotten Linie - + Plot function Plotten Funktion - + Code - + &File &Datei - + &Edit &Bearbeiten - + &Help - &Hilfe + - + &View &Ansicht - + Change theme - + Change style - + &Program - + &Tools &Werkzeuge - + Toolbar Symbolleiste - + Output - + Clear Output - + Save Output - + Print Output - + New Neu - + Open Öffnen - + Save Speichern - + Save As Speichern unter - + Exit Beenden - + Save All Alle speichern - + Undo Rückgängig - + Redo Wiederherstellen - + Cut Ausschneiden - + Copy Kopieren - + Paste Einfügen - + Quick Start Schnellstart - + Help Contents Hilfethemen - + About Turing Über Turing - + Show toolbar Symbolleiste anzeigen - + Examples Beispiele - + Print Ausgeben - + Find Suchen - + Replace Ersetzen - + Calculator Rechner - + Clear Löschen - + Select All Alles auswählen - + Run Ausführen - + Step-by-step - + Show toolbar text - + Convert to Python - + Convert to pseudocode - + Duplicate Line - + Indent Zeileneinzug vergrößern - + Unindent Zeileneinzug verkleinern - + Go To Line Gehe zu Zeile - + Find Previous Rückwärts suchen - + Find Next Weitersuchen - + Stop Beenden - + Debug Debuggen - + Send Feedback Feedback senden - + Do you really want to exit? All unsaved changes will be lost. Möchten Sie wirklich beenden? Alle nicht gespeicherten Änderungen gehen verloren. - + Turing - {file} (unsaved) Turing - {file} (geändert) - + Turing - {file} Turing - {file} - + Turing - New File Turing - Unbenannt - + Input: Eingeben: - + end of output - + end of output [{time}] - + Breakpoint: Haltepunkt: - + program interrupted - + Syntax error ({type}) at line {line}, offset {off}: - + Save output Ausgabedaten speichern - + Text files (*.txt) Textdateien (*.txt) - + Do you really want to create a new file? All unsaved changes will be lost. - + Advanced Erweitert - + Folding Faltung - + Collapse Reduzieren - + Expand Erweitern - + Collapse all Alle reduzieren - + Expand all Alle erweitern - + Select word - + Select extended word - + Matched select - + Select line - + Select Auswahl - + Regex Reguläre Ausdrücke - + Match case Groß-/Kleinschreibung beachten - + Whole words Übereinstimmung mit ganzem Wort - + In Selection - + 0 matches 0 Treffer - + Replace All Alle ersetzen - + {num} matches {num} Treffer - + Program file (*.py *.tr *.alg) - + Python file (*.py) Python Dateien (*.py) - + Turing program (*.tr) - + Algobox file (*.alg) Algobox Dateien (*.alg) - + A new version of Turing is available. Would you like to download it? - + A modified file has been automatically saved. Would you like to recover it? - + Zoom Zoom - + Edit theme - + Settings Einstellungen - + Use arrow notation - + ASSIGN variable - + Recent files Header Zuletzt verwendet - + Recent articles Header - + Recent files Menu Zuletzt verwendet - + Load recent articles - + Check for updates - + You are about to choose an example file from the `examples` directory. To guess what examples are, you can guess from the file names. - + You are not allowed to write to {}, please choose another file path. diff --git a/src/lang/es.ts b/src/lang/es.ts index 55792fc..0b569b4 100644 --- a/src/lang/es.ts +++ b/src/lang/es.ts @@ -4,26 +4,26 @@ AboutWindow - + About Turing Acerca de Turing - + Program - + License Licencia - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Turing {version}</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Release channel : </span>{channel} <br /><br />Free and open-source software to assist the learning of algorithms and programming. <br /><br /><span style=" font-weight:600;">Copyright (c) 2018 the Turing development team (Léo Joly, Tom Niget)</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This software is distributed under the terms of the MIT license and makes use of the <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">Qt</span></a> / <a href="https://riverbankcomputing.com/software/pyqt/"><span style=" text-decoration: underline; color:#0000ff;">pyQt</span></a>. frameworks.</li> @@ -39,104 +39,104 @@ p, li { white-space: pre-wrap; } Algo - + [k]BREAK[/k] - + [k]CONTINUE[/k] - + [b]ELSE[/b] - + [b]WHILE[/b] [c]{cond}[/c] - + [b]IF[/b] [c]{cond}[/c] - + [k]DECLARE[/k] [c]{var}[/c] - + [k]CALL[/k] [c]{code}[/c] - + [b]FOR[/b] [c]{var}[/c] [b]FROM[/b] [c]{begin}[/c] [b]TO[/b] [c]{end}[/c] {step} - + ([b]STEP[/b] [c]{step}[/c]) - + [b]FUNCTION[/b] [c]{func}({args})[/c] - + [k]RETURN[/k] [c]{val}[/c] - + [k]STOP[/k] [c]{val}[/c] - + [k]WAIT[/k] [c]{val}[/c] [k]SECONDS[/k] - + [k]CLEAR PLOT[/k] - + [k]DRAW LINE[/k] [c]{color}[/c] [k]FROM[/k] ([c]{start_x}[/c]; [c]{start_y}[/c]) [k]TO[/k] ([c]{end_x}[/c]; [c]{end_y}[/c]) - + [k]DRAW POINT[/k] [c]{color}[/c] [k]AT[/k] ([c]{x}[/c]; [c]{y}[/c]) - + [k]PLOT FUNCTION[/k] [c]{color}[/c] [i]f[/i]({var}) = [c]{expr}[/c] [k]FROM[/k] [c]{begin}[/c] [k]TO[/k] [c]{end}[/c] [k]STEP[/k] [c]{step}[/c] - + [b]PROGRAM[/b] - + [i]empty[/i] Variable {var} = - Variable {var} = + @@ -201,27 +201,27 @@ p, li { white-space: pre-wrap; } - + [k]SET WINDOW[/k] [i]Xmin=[/i][c]{x_min}[/c] [i]Xmax=[/i][c]{x_max}[/c] [i]Ymin=[/i][c]{y_min}[/c] [i]Ymax=[/i][c]{y_max}[/c] [i]Xgrad=[/i][c]{x_grad}[/c] [i]Ygrad=[/i][c]{y_grad}[/c] - + [k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c] - + [k]DISPLAY[/k] [c]{val}[/c] {newline} - + [k]INPUT[/k] [c]{prompt}[/c] [k]TO[/k] [c]{var}[/c] {text} - + [c]{var}[/c] [k]&#129128;[/k] [c]{value}[/c] @@ -1591,7 +1591,7 @@ Window Text : and - y + @@ -1652,668 +1652,668 @@ Window Text : Expression editor - Editor de expresiones + MainWindow - + Home - + Pseudocode - + Duplicate Line shorter - + Delete Line - + Edit Line - + Zoom in Aumentar zoom - + Zoom out Disminuir zoom - + Reset zoom Restaurar - + Basic Básico - + Breakpoint Punto de ruptura - + Read user INPUT - + DISPLAY value - + Comment Comentario - + Wait - + Blocks - + WHILE loop - + ELSE block - + FOR loop Bucle PARA - + IF block - + CONTINUE - + BREAK - + Functions - + CALL function - + Define FUNCTION - + RETURN - + Plot - + Set window - Ventana del gráfico + Configurar la ventana del gráfico - + Clear plot - + Draw point Trazar punto - + Draw line Trazar línea - + Plot function Trazar función - + Code - + &File &Archivo - + &Edit &Editar - + &Help - &Ayuda + - + &View &Vista - + Change theme - + Change style - + &Program - + &Tools &Herramientas - + Toolbar - + Output - + Clear Output - + Save Output - + Print Output - + New Nuevo - + Open Abrir - + Save Guardar - + Save As Guardar como - + Exit Salir - + Save All Guardar todo - + Undo Deshacer - + Redo Rehacer - + Cut Cortar - + Copy Copiar - + Paste Pegar - + Quick Start - Inicio rápido + - + Help Contents Ayuda - + About Turing Acerca de Turing - + Show toolbar - Mostrar barra de herramientas + - + Examples - + Print Imprimir - + Find Buscar - + Replace Reemplazar - + Calculator Calculadora - + Clear - + Select All Seleccionar todo - + Run Ejecutar - + Step-by-step - + Show toolbar text - + Convert to Python - + Convert to pseudocode - + Duplicate Line - + Indent Aumentar guion de línea - + Unindent Reducir guion de línea - + Go To Line - + Find Previous Buscar anterior - + Find Next Buscar siguiente - + Stop - + Debug - + Send Feedback - + Do you really want to exit? All unsaved changes will be lost. - + Turing - {file} (unsaved) - + Turing - {file} Turing - {file} - + Turing - New File - + Input: - + end of output - + end of output [{time}] - + Breakpoint: - + program interrupted - + Syntax error ({type}) at line {line}, offset {off}: - + Save output - + Text files (*.txt) - + Do you really want to create a new file? All unsaved changes will be lost. - + Advanced - + Folding - + Collapse - + Expand - + Collapse all - + Expand all - + Select word - + Select extended word - + Matched select - + Select line - + Select - + Regex Expresión regular - + Match case Coincidir MAYÚSCULAS/minúsculas - + Whole words Solo palabras completas - + In Selection - + 0 matches - + Replace All - + {num} matches - + Program file (*.py *.tr *.alg) - + Python file (*.py) - + Turing program (*.tr) - + Algobox file (*.alg) - + A new version of Turing is available. Would you like to download it? - + A modified file has been automatically saved. Would you like to recover it? - + Zoom Zoom - + Edit theme - + Settings Ajustes - + Use arrow notation - + ASSIGN variable - + Recent files Header Archivos recientes - + Recent articles Header - + Recent files Menu Archivos recientes - + Load recent articles - + Check for updates - + You are about to choose an example file from the `examples` directory. To guess what examples are, you can guess from the file names. - + You are not allowed to write to {}, please choose another file path. diff --git a/src/lang/fr.ts b/src/lang/fr.ts index 360dcb2..2abf8e8 100644 --- a/src/lang/fr.ts +++ b/src/lang/fr.ts @@ -4,26 +4,26 @@ AboutWindow - + About Turing À propos de Turing - + Program Programme - + License Licence - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Turing {version}</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Release channel : </span>{channel} <br /><br />Free and open-source software to assist the learning of algorithms and programming. <br /><br /><span style=" font-weight:600;">Copyright (c) 2018 the Turing development team (Léo Joly, Tom Niget)</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This software is distributed under the terms of the MIT license and makes use of the <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">Qt</span></a> / <a href="https://riverbankcomputing.com/software/pyqt/"><span style=" text-decoration: underline; color:#0000ff;">pyQt</span></a>. frameworks.</li> @@ -58,90 +58,90 @@ p, li { white-space: pre-wrap; } BREAK can only be used inside a loop - SORTIR ne peut être utilisé qu'à l'intérieur d'une boucle + SORTIR ne peut être utilisé qu'à l'intérieur d'une boucle CONTINUE can only be used inside a loop - CONTINUER ne peut être utilisé qu'à l'intérieur d'une boucle + CONTINUER ne peut être utilisé qu'à l'intérieur d'une boucle RETURN can only be used inside a function - RENVOYER ne peut être utilisé qu'à l'intérieur d'une fonction + RENVOYER ne peut être utilisé qu'à l'intérieur d'une fonction Unknown statement type: {type} - Type d'instruction inconnu : {type} + Type d'instruction inconnu : {type} ELSE can only be used after an IF block - SINON ne peut être utilisé qu'immédiatement après un bloc SI + SINON ne peut être utilisé qu'immédiatement après un bloc SI - + [k]CONTINUE[/k] [k]CONTINUER[/k] - + [b]ELSE[/b] [b]SINON[/b] - + [b]WHILE[/b] [c]{cond}[/c] [b]TANT QUE[/b] [c]{cond}[/c] - + [b]IF[/b] [c]{cond}[/c] [b]SI[/b] [c]{cond}[/c] - + [k]RETURN[/k] [c]{val}[/c] [k]RENVOYER[/k] [c]{val}[/c] - + [k]DECLARE[/k] [c]{var}[/c] [k]DÉCLARER[/k] [c]{var}[/c] - + [k]CALL[/k] [c]{code}[/c] [k]APPELER[/k] [c]{code}[/c] - + [b]FUNCTION[/b] [c]{func}({args})[/c] [b]FONCTION[/b] [c]{func}({args})[/c] - + [b]PROGRAM[/b] [b]ALGORITHME[/b] - + [k]BREAK[/k] [k]SORTIR[/k] - + [b]FOR[/b] [c]{var}[/c] [b]FROM[/b] [c]{begin}[/c] [b]TO[/b] [c]{end}[/c] {step} [b]POUR[/b] [c]{var}[/c] [b]DE[/b] [c]{begin}[/c] [b]À[/b] [c]{end}[/c] {step} - + ([b]STEP[/b] [c]{step}[/c]) ([b]PAS[/b] [c]{step}[/c]) - + [i]empty[/i] [i]vide[/i] @@ -167,75 +167,75 @@ p, li { white-space: pre-wrap; } Array access target must be of array type - La cible d'un accès de liste doit être une liste + La cible d'un accès de liste doit être une liste Index '{idx}' too big for array - Indice '{idx}' trop grand pour la liste + Indice '{idx}' trop grand pour la liste Assignment target must be either variable or array item - La cible d'une affectation doit être une variable ou un élément de liste + La cible d'une affectation doit être une variable ou un élément de liste Invalid assignment target (must be either variable or array item): {name} - Cible d'affectation invalide (doit être une variable ou un élément de liste) : {name} + Cible d'affectation invalide (doit être une variable ou un élément de liste) : {name} - + [k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c] [k]VARIABLE[/k] [c]{var}[/c] [k]PREND LA VALEUR[/b] [c]{value}[/c] - + [k]CLEAR PLOT[/k] [k]EFFACER GRAPHIQUE[/k] - + [k]DRAW LINE[/k] [c]{color}[/c] [k]FROM[/k] ([c]{start_x}[/c]; [c]{start_y}[/c]) [k]TO[/k] ([c]{end_x}[/c]; [c]{end_y}[/c]) [k]DESSINER LIGNE[/k] [c]{color}[/c] [k]DE[/k] ([c]{start_x}[/c]; [c]{start_y}[/c]) [k]À[/k] ([c]{end_x}[/c]; [c]{end_y}[/c]) - + [k]DRAW POINT[/k] [c]{color}[/c] [k]AT[/k] ([c]{x}[/c]; [c]{y}[/c]) [k]DESSINER POINT[/k] [c]{color}[/c] [k]À[/k] ([c]{x}[/c]; [c]{y}[/c]) - + [k]SET WINDOW[/k] [i]Xmin=[/i][c]{x_min}[/c] [i]Xmax=[/i][c]{x_max}[/c] [i]Ymin=[/i][c]{y_min}[/c] [i]Ymax=[/i][c]{y_max}[/c] [i]Xgrad=[/i][c]{x_grad}[/c] [i]Ygrad=[/i][c]{y_grad}[/c] [k]DÉFINIR REPÈRE[/k] [i]Xmin=[/i][c]{x_min}[/c] [i]Xmax=[/i][c]{x_max}[/c] [i]Ymin=[/i][c]{y_min}[/c] [i]Ymax=[/i][c]{y_max}[/c] [i]Xgrad=[/i][c]{x_grad}[/c] [i]Ygrad=[/i][c]{y_grad}[/c] - + [k]STOP[/k] [c]{val}[/c] [k]STOP[/k] [c]{val}[/c] - + [k]PLOT FUNCTION[/k] [c]{color}[/c] [i]f[/i]({var}) = [c]{expr}[/c] [k]FROM[/k] [c]{begin}[/c] [k]TO[/k] [c]{end}[/c] [k]STEP[/k] [c]{step}[/c] [k]TRACER FONCTION[/k] [c]{color}[/c] [i]f[/i]({var}) = [c]{expr}[/c] [k]DE[/k] [c]{begin}[/c] [k]À[/k] [c]{end}[/c] [k]PAS[/k] [c]{step}[/c] - + [k]WAIT[/k] [c]{val}[/c] [k]SECONDS[/k] [k]ATTENDRE[/k] [c]{val}[/c] [k]SECONDES[/k] - + [k]DISPLAY[/k] [c]{val}[/c] {newline} [k]AFFICHER[/k] [c]{val}[/c] {newline} - + [k]INPUT[/k] [c]{prompt}[/c] [k]TO[/k] [c]{var}[/c] {text} [k]SAISIR[/k] [c]{var}[/c] {text} - + [c]{var}[/c] [k]&#129128;[/k] [c]{value}[/c] [c]{var}[/c] [k]&#129128;[/k] [c]{value}[/c] @@ -1668,679 +1668,679 @@ désactivé : InlineCodeDialog - + Expression editor - Éditeur d'expression + Éditeur d'expression MainWindow - + Home Accueil - + &File &Fichier - + &Edit &Édition - + &Help &Aide - + &View &Affichage - + &Program &Programme - + &Tools O&utils - + Output Sortie - + New Nouveau - + Open Ouvrir - + Save Enregistrer - + Save As Enregistrer sous - + Exit Quitter - + Save All Enregistrer tout - + Undo Annuler - + Redo Rétablir - + Cut Couper - + Copy Copier - + Paste Coller - + Quick Start Tutoriel rapide - + Help Contents Bibliothèque - + About Turing À propos de Turing - + Show toolbar - Barre d'outils + Barre d'outils - + Examples Exemples - + Print Imprimer - + Find Rechercher - + Replace Remplacer - + Calculator Calculatrice - + Clear Effacer - + Select All Sélectionner tout - + Run Exécuter - + Step-by-step Pas-à-pas - + Show toolbar text Texte des boutons - + Convert to Python Convertir en Python - + Convert to pseudocode Convertir en pseudocode - + Do you really want to exit? All unsaved changes will be lost. Voulez-vous vraiment quitter ? Toutes les modifications non sauvegardées seront perdues. - + Toolbar - Barre d'outils + Barre d'outils - + Pseudocode Algorithme - + Code Code - + end of output - fin de l'exécution + fin de l'exécution - + Input: Saisir : - + Syntax error ({type}) at line {line}, offset {off}: Erreur de syntaxe ({type}) à la ligne {line}, caractère {off} : - + Indent - Augmenter l'indentation + Augmenter l'indentation - + Unindent - Réduire l'indentation + Réduire l'indentation - + Duplicate Line Dupliquer la ligne - + Go To Line Aller à la ligne - + Find Previous Rechercher précédent - + Find Next Rechercher suivant - + Change theme Changer de thème - + Change style Changer de style - + Clear Output Effacer la sortie - + Save Output Enregistrer la sortie - + Print Output Imprimer la sortie - + FOR loop Boucle POUR - + WHILE loop Boucle TANT QUE - + IF block Bloc SI - + ELSE block Bloc SINON - + BREAK SORTIR - + CONTINUE CONTINUER - + Stop Arrêter - + Comment Commentaire - + program interrupted algorithme interrompu - + end of output [{time}] - fin de l'exécution [{time}] + fin de l'exécution [{time}] - + Python file (*.py) Fichier Python (*.py) - + Turing program (*.tr) Algorithme Turing (*.tr) - + Algobox file (*.alg) Algorithme Algobox (*.alg) - + Define FUNCTION Définir FONCTION - + CALL function APPELER fonction - + RETURN RENVOYER - + Read user INPUT SAISIR une entrée - + DISPLAY value AFFICHER valeur - + Turing - New File Turing - Sans titre - + Turing - {file} (unsaved) Turing - {file} (modifié) - + Turing - {file} Turing - {file} - + Debug Déboguer - + Program file (*.py *.tr *.alg) Fichier de programme (*.py *.tr *.alg) - + Clear plot Effacer graphique - + Draw point Dessiner point - + Draw line Dessiner ligne - + Plot Graphique - + Set window Définir le repère - + Save output Enregistrer la sortie - + Text files (*.txt) Fichiers texte (*.txt) - + Do you really want to create a new file? All unsaved changes will be lost. Voulez-vous vraiment créer un nouveau fichier ? Toutes les modifications non sauvegardées seront perdues. - + Send Feedback Un commentaire ? - + A new version of Turing is available. Would you like to download it? Une nouvelle version de Turing est disponible. Voulez-vous la télécharger ? - + Breakpoint - Point d'arrêt + Point d'arrêt - + Breakpoint: - Point d'arrêt : + Point d'arrêt : - + Zoom in Agrandir - + Zoom out Réduire - + Reset zoom Par défaut - + Advanced Avancé - + Delete Line Supprimer - + Edit Line Modifier - + Duplicate Line shorter Dupliquer - + Folding Plan - + Collapse Réduire - + Expand Étendre - + Expand all Tout étendre - + Select word Sélectionner le mot - + Select extended word Sélectionner le mot étendu - + Matched select Sélectionner le résultat - + Select line Sélectionner la ligne - + Select Sélection - + Collapse all Tout réduire - + Regex Expression régulière - + Match case Respecter la casse - + Whole words Mot entier - + In Selection Dans la sélection - + 0 matches 0 correspondances - + Replace All Remplacer tout - + Basic Basique - + Blocks Blocs - + Functions Fonctions - + Plot function Tracer fonction - + Wait Attendre - + {num} matches {num} correspondances - + A modified file has been automatically saved. Would you like to recover it? Un fichier modifié a été enregistré automatiquement. Souhaitez-vous le récupérer ? - + Zoom Zoom - + Edit theme Modifier le thème - + Settings Options - + Use arrow notation Utiliser la notation fléchée - + ASSIGN variable AFFECTER variable - + Recent files Header Fichiers récents - + Recent articles Header Articles récents - + Recent files Menu Récents - + Load recent articles Charger les articles récents - + Check for updates Vérifier les mises à jour - + You are about to choose an example file from the `examples` directory. To guess what examples are, you can guess from the file names. - Vous allez choisir un fichier d'exemple -depuis le répertoire « examples ». Pour devinece qu'il y a + Vous allez choisir un fichier d'exemple +depuis le répertoire « examples ». Pour devinece qu'il y a dans les fichiers, fiez-vous à leurs noms. - + You are not allowed to write to {}, please choose another file path. - Vous n'êtes pas autorisé à écrire dans {}, + Vous n'êtes pas autorisé à écrire dans {}, veuillez choisir un chemin vers un autre fichier. diff --git a/src/lang/it.ts b/src/lang/it.ts index e9046d6..fcb0afa 100644 --- a/src/lang/it.ts +++ b/src/lang/it.ts @@ -4,26 +4,26 @@ AboutWindow - + About Turing - + Program - + License - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Turing {version}</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Release channel : </span>{channel} <br /><br />Free and open-source software to assist the learning of algorithms and programming. <br /><br /><span style=" font-weight:600;">Copyright (c) 2018 the Turing development team (Léo Joly, Tom Niget)</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This software is distributed under the terms of the MIT license and makes use of the <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">Qt</span></a> / <a href="https://riverbankcomputing.com/software/pyqt/"><span style=" text-decoration: underline; color:#0000ff;">pyQt</span></a>. frameworks.</li> @@ -39,104 +39,104 @@ p, li { white-space: pre-wrap; } Algo - + [k]BREAK[/k] - + [k]CONTINUE[/k] - + [b]ELSE[/b] - + [b]WHILE[/b] [c]{cond}[/c] - + [b]IF[/b] [c]{cond}[/c] - + [k]DECLARE[/k] [c]{var}[/c] - + [k]CALL[/k] [c]{code}[/c] - + [b]FOR[/b] [c]{var}[/c] [b]FROM[/b] [c]{begin}[/c] [b]TO[/b] [c]{end}[/c] {step} - + ([b]STEP[/b] [c]{step}[/c]) - + [b]FUNCTION[/b] [c]{func}({args})[/c] - + [k]RETURN[/k] [c]{val}[/c] - + [k]STOP[/k] [c]{val}[/c] - + [k]WAIT[/k] [c]{val}[/c] [k]SECONDS[/k] - + [k]CLEAR PLOT[/k] - + [k]DRAW LINE[/k] [c]{color}[/c] [k]FROM[/k] ([c]{start_x}[/c]; [c]{start_y}[/c]) [k]TO[/k] ([c]{end_x}[/c]; [c]{end_y}[/c]) - + [k]DRAW POINT[/k] [c]{color}[/c] [k]AT[/k] ([c]{x}[/c]; [c]{y}[/c]) - + [k]PLOT FUNCTION[/k] [c]{color}[/c] [i]f[/i]({var}) = [c]{expr}[/c] [k]FROM[/k] [c]{begin}[/c] [k]TO[/k] [c]{end}[/c] [k]STEP[/k] [c]{step}[/c] - + [b]PROGRAM[/b] - + [i]empty[/i] Variable {var} = - Variabile {var} = + @@ -201,27 +201,27 @@ p, li { white-space: pre-wrap; } - + [k]SET WINDOW[/k] [i]Xmin=[/i][c]{x_min}[/c] [i]Xmax=[/i][c]{x_max}[/c] [i]Ymin=[/i][c]{y_min}[/c] [i]Ymax=[/i][c]{y_max}[/c] [i]Xgrad=[/i][c]{x_grad}[/c] [i]Ygrad=[/i][c]{y_grad}[/c] - + [k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c] - + [k]DISPLAY[/k] [c]{val}[/c] {newline} - + [k]INPUT[/k] [c]{prompt}[/c] [k]TO[/k] [c]{var}[/c] {text} - + [c]{var}[/c] [k]&#129128;[/k] [c]{value}[/c] @@ -1591,7 +1591,7 @@ Window Text : and - e + @@ -1652,668 +1652,668 @@ Window Text : Expression editor - Editor espressioni + MainWindow - + Home - + Pseudocode - + Duplicate Line shorter - + Delete Line - + Edit Line - + Zoom in Ingrandisci testo - + Zoom out Riduci testo - + Reset zoom Reimposta - + Basic - + Breakpoint Punto di interruzione - + Read user INPUT - + DISPLAY value - + Comment Commenta - + Wait - + Blocks - + WHILE loop - + ELSE block - + FOR loop - + IF block - + CONTINUE - + BREAK - + Functions - + CALL function - + Define FUNCTION - + RETURN - + Plot - + Set window - Finestra del grafico + Impostare la finestra del grafico - + Clear plot - + Draw point Tracciare punto - + Draw line Tracciare linea - + Plot function Tracciare funzione - + Code - + &File &File - + &Edit &Modifica - + &Help - &Guida + - + &View &Visualizza - + Change theme - + Change style - + &Program - + &Tools &Strumenti - + Toolbar - + Output - + Clear Output - + Save Output - + Print Output - + New Nuovo - + Open Apri - + Save Salva - + Save As Salva come - + Exit Esci - + Save All Salva tutto - + Undo Annulla - + Redo Ripristina - + Cut Taglia - + Copy Copia - + Paste Incolla - + Quick Start - Guida introduttiva + - + Help Contents Sommario Guida - + About Turing - + Show toolbar - Mostra barra degli strumenti + - + Examples - + Print Stampa - + Find Trova - + Replace Sostituisci - + Calculator Calcolatrice - + Clear - + Select All Seleziona tutto - + Run Esegui - + Step-by-step - + Show toolbar text - + Convert to Python - + Convert to pseudocode - + Duplicate Line - + Indent Inserisci tabulazione - + Unindent Rimuovi tabulazione - + Go To Line - + Find Previous Trova precedente - + Find Next Trova successivo - + Stop - + Debug - + Send Feedback - + Do you really want to exit? All unsaved changes will be lost. - + Turing - {file} (unsaved) - + Turing - {file} Turing - {file} - + Turing - New File - + Input: - + end of output - + end of output [{time}] - + Breakpoint: - + program interrupted - + Syntax error ({type}) at line {line}, offset {off}: - + Save output - + Text files (*.txt) - + Do you really want to create a new file? All unsaved changes will be lost. - + Advanced - + Zoom Zoom - + Folding - + Collapse - + Expand - + Collapse all - + Expand all - + Select word - + Select extended word - + Matched select - + Select line - + Select - + Regex Espressione regolare - + Match case - L'evidenziazione è case-sensitive + L'evidenziazione è case-sensitive - + Whole words Identifica solo parole intere - + In Selection - + 0 matches - + Replace All - + {num} matches - + Program file (*.py *.tr *.alg) - + Python file (*.py) - + Turing program (*.tr) - + Algobox file (*.alg) - + A new version of Turing is available. Would you like to download it? - + A modified file has been automatically saved. Would you like to recover it? - + Edit theme - + Settings Impostazioni - + Use arrow notation - + ASSIGN variable - + Recent files Header File recenti - + Recent articles Header - + Recent files Menu File recenti - + Load recent articles - + Check for updates - + You are about to choose an example file from the `examples` directory. To guess what examples are, you can guess from the file names. - + You are not allowed to write to {}, please choose another file path. diff --git a/src/lang/zh-CN.ts b/src/lang/zh-CN.ts index c5e543b..fc6dbd6 100644 --- a/src/lang/zh-CN.ts +++ b/src/lang/zh-CN.ts @@ -4,26 +4,26 @@ AboutWindow - + About Turing 关于Turing - + Program - + License - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Turing {version}</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Release channel : </span>{channel} <br /><br />Free and open-source software to assist the learning of algorithms and programming. <br /><br /><span style=" font-weight:600;">Copyright (c) 2018 the Turing development team (Léo Joly, Tom Niget)</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This software is distributed under the terms of the MIT license and makes use of the <a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">Qt</span></a> / <a href="https://riverbankcomputing.com/software/pyqt/"><span style=" text-decoration: underline; color:#0000ff;">pyQt</span></a>. frameworks.</li> @@ -39,97 +39,97 @@ p, li { white-space: pre-wrap; } Algo - + [k]BREAK[/k] - + [k]CONTINUE[/k] - + [b]ELSE[/b] - + [b]WHILE[/b] [c]{cond}[/c] - + [b]IF[/b] [c]{cond}[/c] - + [k]DECLARE[/k] [c]{var}[/c] - + [k]CALL[/k] [c]{code}[/c] - + [b]FOR[/b] [c]{var}[/c] [b]FROM[/b] [c]{begin}[/c] [b]TO[/b] [c]{end}[/c] {step} - + ([b]STEP[/b] [c]{step}[/c]) - + [b]FUNCTION[/b] [c]{func}({args})[/c] - + [k]RETURN[/k] [c]{val}[/c] - + [k]STOP[/k] [c]{val}[/c] - + [k]WAIT[/k] [c]{val}[/c] [k]SECONDS[/k] - + [k]CLEAR PLOT[/k] - + [k]DRAW LINE[/k] [c]{color}[/c] [k]FROM[/k] ([c]{start_x}[/c]; [c]{start_y}[/c]) [k]TO[/k] ([c]{end_x}[/c]; [c]{end_y}[/c]) - + [k]DRAW POINT[/k] [c]{color}[/c] [k]AT[/k] ([c]{x}[/c]; [c]{y}[/c]) - + [k]PLOT FUNCTION[/k] [c]{color}[/c] [i]f[/i]({var}) = [c]{expr}[/c] [k]FROM[/k] [c]{begin}[/c] [k]TO[/k] [c]{end}[/c] [k]STEP[/k] [c]{step}[/c] - + [b]PROGRAM[/b] - + [i]empty[/i] @@ -201,27 +201,27 @@ p, li { white-space: pre-wrap; } - + [k]SET WINDOW[/k] [i]Xmin=[/i][c]{x_min}[/c] [i]Xmax=[/i][c]{x_max}[/c] [i]Ymin=[/i][c]{y_min}[/c] [i]Ymax=[/i][c]{y_max}[/c] [i]Xgrad=[/i][c]{x_grad}[/c] [i]Ygrad=[/i][c]{y_grad}[/c] - + [k]VARIABLE[/k] [c]{var}[/c] [k]TAKES VALUE[/k] [c]{value}[/c] - + [k]DISPLAY[/k] [c]{val}[/c] {newline} - + [k]INPUT[/k] [c]{prompt}[/c] [k]TO[/k] [c]{var}[/c] {text} - + [c]{var}[/c] [k]&#129128;[/k] [c]{value}[/c] @@ -659,9 +659,6 @@ p, li { white-space: pre-wrap; } - - Algobox - CalcWindow @@ -1581,7 +1578,7 @@ Window Text : and - + @@ -1642,668 +1639,668 @@ Window Text : Expression editor - 表达式编辑器 + MainWindow - + Home - + Pseudocode - + Duplicate Line shorter - + Delete Line - + Edit Line - + Zoom in 放大 - + Zoom out 缩小 - + Reset zoom 恢复默认缩放 - + Basic - + Breakpoint - + Read user INPUT - + DISPLAY value - + Comment 注释/取消注释 - + Wait - + Blocks - + WHILE loop - + ELSE block - + FOR loop - + IF block - + CONTINUE - + BREAK - + Functions - + CALL function - + Define FUNCTION - + RETURN - + Plot - + Set window - + Clear plot - + Draw point - + Draw line - + Plot function - + Code - + &File 文件(&F) - + &Edit 编辑(&E) - + &Help - 帮助(&H) + - + &View 视图(&V) - + Change theme - + Change style - + &Program - + &Tools 工具(&O) - + Toolbar - + Output - + Clear Output - + Save Output - + Print Output - + New 新建 - + Open 打开 - + Save 保存 - + Save As 另存为 - + Exit 退出 - + Save All 全部保存 - + Undo 撤消 - + Redo 恢复 - + Cut 剪切 - + Copy 复制 - + Paste 粘贴 - + Quick Start - 快速入门 + - + Help Contents 帮助目录 - + About Turing 关于Turing - + Show toolbar - 显示工具栏 + - + Examples - + Print 打印 - + Find 查找 - + Replace 替换 - + Calculator 计算器 - + Clear - + Select All 全选 - + Run 运行 - + Step-by-step - + Show toolbar text - + Convert to Python - + Convert to pseudocode - + Duplicate Line - + Indent 插入制表符 - + Unindent 删除制表符 - + Go To Line - + Find Previous 查找上一个 - + Find Next 查找下一个 - + Stop - + Debug - + Send Feedback - + Do you really want to exit? All unsaved changes will be lost. - + Turing - {file} (unsaved) - + Turing - {file} Turing - {file} - + Turing - New File - + Input: - + end of output - + end of output [{time}] - + Breakpoint: - + program interrupted - + Syntax error ({type}) at line {line}, offset {off}: - + Save output - + Text files (*.txt) - + Do you really want to create a new file? All unsaved changes will be lost. - + Advanced - + Folding - + Collapse - + Expand - + Collapse all - + Expand all - + Select word - + Select extended word - + Matched select - + Select line - + Select - + Regex 正则表达式 - + Match case 区分大小写 - + Whole words 仅匹配完整词 - + In Selection - + 0 matches 0次匹配 - + Replace All - + {num} matches {num}次匹配 - + Program file (*.py *.tr *.alg) - + Python file (*.py) - + Turing program (*.tr) - + Algobox file (*.alg) - + A new version of Turing is available. Would you like to download it? - + A modified file has been automatically saved. Would you like to recover it? - + Zoom 缩放 - + Edit theme - + Settings - + Use arrow notation - + ASSIGN variable - + Recent files Header 近期文件 - + Recent articles Header - + Recent files Menu 近期文件 - + Load recent articles - + Check for updates - + You are about to choose an example file from the `examples` directory. To guess what examples are, you can guess from the file names. - + You are not allowed to write to {}, please choose another file path. diff --git a/src/maths/nodes/ArrayAccessNode.py b/src/maths/nodes/ArrayAccessNode.py index 61f6fd2..7d8cd99 100644 --- a/src/maths/nodes/ArrayAccessNode.py +++ b/src/maths/nodes/ArrayAccessNode.py @@ -26,7 +26,7 @@ def code(self, bb=False) -> str: self.array.code_fix(bb), self.index.code(bb)) def python(self) -> str: - return "%s[%s]" % (protectExpr(self.array.python()), self.index.python()) + return "(%s)[%s]" % (self.array.python(), self.index.python()) def children(self) -> List["AstNode"]: return [self.array, self.index] diff --git a/src/maths/nodes/AstNode.py b/src/maths/nodes/AstNode.py index 0702f00..fd6a18c 100644 --- a/src/maths/nodes/AstNode.py +++ b/src/maths/nodes/AstNode.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -from shlex import shlex # lexer module for shell-mode expressions from typing import List - +from shlex import shlex # lexer module for shell-mode expressions class AstNode: """Base node class""" @@ -26,7 +25,6 @@ def children(self) -> List["AstNode"]: def flatten(self) -> List["AstNode"]: return [self] + self.children() - def isSimple(s): """ @ param s a string which may be a left or a right operand @@ -34,11 +32,10 @@ def isSimple(s): when it is enclosed in parentheses or when it contains a single toke, according to shlex """ - return len(list(shlex(s))) == 1 or \ - (s[0] == '(' and s[-1] == ')') or \ - (s[0] == '{' and s[-1] == '}') or \ - (s[0] == '[' and s[-1] == ']') - + return len(list(shlex(s)))==1 or \ + (s[0]=='(' and s[-1]==')') or \ + (s[0]=='{' and s[-1]=='}') or \ + (s[0]=='[' and s[-1]==']') def protectExpr(s): """ @@ -47,4 +44,5 @@ def protectExpr(s): """ if isSimple(s): return s - return '(' + s + ')' + return '('+s+')' + diff --git a/src/maths/nodes/BinOpNode.py b/src/maths/nodes/BinOpNode.py index ed34d37..7f03059 100644 --- a/src/maths/nodes/BinOpNode.py +++ b/src/maths/nodes/BinOpNode.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import maths.parser import util.html -from .AstNode import * from .IdentifierNode import * from .NumberNode import * +from .AstNode import * from .StringNode import StringNode @@ -86,8 +86,8 @@ def python(self) -> str: elif type(right) == StringNode and type(left) != StringNode: left_py = "str(%s)" % left_py - return "%s %s %s" % \ - (protectExpr(left_py), op_fix, protectExpr(right_py)) + return "(%s %s %s)" % \ + (protectExpr(left_py), op_fix, protectExpr(right_py)) def children(self) -> List["AstNode"]: return [self.left, self.right] diff --git a/src/maths/nodes/StringNode.py b/src/maths/nodes/StringNode.py index 5c10886..34b7557 100644 --- a/src/maths/nodes/StringNode.py +++ b/src/maths/nodes/StringNode.py @@ -25,4 +25,4 @@ def code(self, bb=False) -> str: return '"%s"' % repr(self.value)[1:-1] def python(self) -> str: - return "%r" % self.value + return "%r" % protectExpr(self.value) diff --git a/src/maths/parser.py b/src/maths/parser.py index 5ba6999..c2fccb6 100644 --- a/src/maths/parser.py +++ b/src/maths/parser.py @@ -538,7 +538,7 @@ def beautify(self): prev1 = (typ, val) # remove double whitespaces - return re.sub("\s\s+", " ", result) + return re.sub(r"\s\s+", " ", result) def quick_parse(expr: str) -> nodes.AstNode: diff --git a/src/project.pro b/src/project.pro index 7a3bc67..43771d4 100644 --- a/src/project.pro +++ b/src/project.pro @@ -7,157 +7,156 @@ RESOURCES += \ turing.qrc SOURCES += \ - turing_rc.py \ editor_backend.py \ main.py \ - algo\__tests__.py \ + turing_rc.py \ algo\worker.py \ algo\__init__.py \ + algo\__tests__.py \ algo\backends\texas.py \ algo\backends\__init__.py \ - algo\stmts\FuncStmt.py \ + algo\frontends\algobox.py \ + algo\frontends\__init__.py \ algo\stmts\AssignStmt.py \ - algo\stmts\GPointStmt.py \ + algo\stmts\BaseStmt.py \ + algo\stmts\BlockStmt.py \ + algo\stmts\BreakStmt.py \ + algo\stmts\CallStmt.py \ + algo\stmts\CommentStmt.py \ + algo\stmts\ContinueStmt.py \ algo\stmts\DisplayStmt.py \ - algo\stmts\__init__.py \ algo\stmts\ElseStmt.py \ - algo\stmts\CallStmt.py \ - algo\stmts\BlockStmt.py \ - algo\stmts\InputStmt.py \ + algo\stmts\ForStmt.py \ + algo\stmts\FuncStmt.py \ algo\stmts\GClearStmt.py \ + algo\stmts\GFuncStmt.py \ algo\stmts\GLineStmt.py \ - algo\stmts\ContinueStmt.py \ - algo\stmts\ForStmt.py \ - algo\stmts\BaseStmt.py \ - algo\stmts\SleepStmt.py \ + algo\stmts\GPointStmt.py \ algo\stmts\GWindowStmt.py \ algo\stmts\IfStmt.py \ + algo\stmts\InputStmt.py \ + algo\stmts\ReturnStmt.py \ + algo\stmts\SleepStmt.py \ algo\stmts\StopStmt.py \ algo\stmts\WhileStmt.py \ - algo\stmts\BreakStmt.py \ - algo\stmts\ReturnStmt.py \ - algo\stmts\CommentStmt.py \ - algo\stmts\GFuncStmt.py \ - algo\frontends\algobox.py \ - algo\frontends\__init__.py \ - forms\ui_alg_sleep.py \ - forms\alg_func.py \ + algo\stmts\__init__.py \ + forms\about.py \ + forms\alg_call.py \ + forms\alg_comment.py \ forms\alg_define.py \ - forms\alg_gline.py \ - forms\calculator.py \ - forms\ui_inline_code.py \ - forms\ui_alg_comment.py \ - forms\ui_alg_gline.py \ - forms\__init__.py \ - forms\ui_alg_for.py \ + forms\alg_display.py \ forms\alg_for.py \ + forms\alg_func.py \ + forms\alg_gfunc.py \ + forms\alg_gline.py \ + forms\alg_gpoint.py \ + forms\alg_gwindow.py \ + forms\alg_if.py \ + forms\alg_input.py \ + forms\alg_return.py \ forms\alg_sleep.py \ - forms\ui_alg_call.py \ - forms\w_inline_code.py \ - forms\ui_alg_return.py \ - forms\inline_code_dialog.py \ forms\alg_stop.py \ - forms\alg_comment.py \ - forms\alg_gpoint.py \ + forms\alg_while.py \ + forms\calculator.py \ forms\changtheme.py \ + forms\help.py \ + forms\inline_code_dialog.py \ + forms\inline_code_editor.py \ forms\mainwindow.py \ - forms\alg_while.py \ forms\ui_about.py \ - forms\ui_mainwindow.py \ - forms\alg_gwindow.py \ + forms\ui_alg_call.py \ + forms\ui_alg_comment.py \ + forms\ui_alg_define.py \ + forms\ui_alg_display.py \ + forms\ui_alg_for.py \ + forms\ui_alg_func.py \ + forms\ui_alg_gfunc.py \ + forms\ui_alg_gline.py \ forms\ui_alg_gpoint.py \ - forms\ui_changtheme.py \ - forms\ui_alg_input.py \ forms\ui_alg_gwindow.py \ - forms\ui_alg_gfunc.py \ - forms\ui_alg_func.py \ - forms\alg_return.py \ - forms\about.py \ forms\ui_alg_if.py \ - forms\ui_calculator.py \ - forms\ui_alg_display.py \ - forms\inline_code_editor.py \ - forms\alg_if.py \ + forms\ui_alg_input.py \ + forms\ui_alg_return.py \ + forms\ui_alg_sleep.py \ forms\ui_alg_stop.py \ forms\ui_alg_while.py \ - forms\alg_display.py \ - forms\alg_call.py \ + forms\ui_calculator.py \ + forms\ui_changtheme.py \ forms\ui_help.py \ - forms\alg_input.py \ - forms\ui_alg_define.py \ - forms\alg_gfunc.py \ - forms\help.py \ + forms\ui_inline_code.py \ + forms\ui_mainwindow.py \ + forms\w_inline_code.py \ + forms\__init__.py \ + lang\translator.py \ + lang\__init__.py \ maths\evaluator.py \ maths\parser.py \ maths\__init__.py \ maths\__tests__.py \ - maths\nodes\UnaryOpNode.py \ - maths\nodes\NumberNode.py \ - maths\nodes\ListNode.py \ - maths\nodes\ArrayAccessNode.py \ - maths\nodes\IdentifierNode.py \ - maths\nodes\LambdaNode.py \ - maths\nodes\BinOpNode.py \ - maths\nodes\AstNode.py \ - maths\nodes\__init__.py \ - maths\nodes\StringNode.py \ - maths\nodes\CallNode.py \ - maths\lib\stats.py \ - maths\lib\geom.py \ - maths\lib\const.py \ maths\lib\algobox.py \ - maths\lib\physics.py \ + maths\lib\basic.py \ maths\lib\cast.py \ + maths\lib\const.py \ maths\lib\docs.py \ - maths\lib\basic.py \ + maths\lib\geom.py \ + maths\lib\physics.py \ + maths\lib\stats.py \ maths\lib\trig.py \ maths\lib\__init__.py \ - tools\docgen.py \ + maths\nodes\ArrayAccessNode.py \ + maths\nodes\AstNode.py \ + maths\nodes\BinOpNode.py \ + maths\nodes\CallNode.py \ + maths\nodes\IdentifierNode.py \ + maths\nodes\LambdaNode.py \ + maths\nodes\ListNode.py \ + maths\nodes\NumberNode.py \ + maths\nodes\StringNode.py \ + maths\nodes\UnaryOpNode.py \ + maths\nodes\__init__.py \ + tests\chat.py \ + tests\framework.py \ + tests\__init__.py \ tools\build.py \ + tools\docgen.py \ tools\progen.py \ - util\log.py \ util\code.py \ - util\widgets.py \ - util\undoredo.py \ - util\theming.py \ - util\math.py \ - util\profiler.py \ util\html.py \ - util\__init__.py \ - lang\__init__.py \ - lang\translator.py \ - tests\framework.py \ - tests\chat.py \ - tests\__init__.py + util\log.py \ + util\math.py \ + util\theming.py \ + util\undoredo.py \ + util\widgets.py \ + util\__init__.py FORMS += \ - forms\ui_help.ui \ + forms\ui_about.ui \ + forms\ui_alg_call.ui \ + forms\ui_alg_comment.ui \ forms\ui_alg_define.ui \ - forms\ui_calculator.ui \ - forms\ui_alg_if.ui \ - forms\ui_alg_while.ui \ forms\ui_alg_display.ui \ - forms\ui_alg_stop.ui \ - forms\ui_alg_input.ui \ - forms\ui_alg_gwindow.ui \ - forms\ui_alg_gfunc.ui \ + forms\ui_alg_for.ui \ forms\ui_alg_func.ui \ - forms\ui_about.ui \ - forms\ui_alg_gpoint.ui \ - forms\ui_changtheme.ui \ - forms\ui_mainwindow.ui \ - forms\ui_alg_comment.ui \ + forms\ui_alg_gfunc.ui \ forms\ui_alg_gline.ui \ - forms\ui_alg_call.ui \ - forms\w_inline_code.ui \ + forms\ui_alg_gpoint.ui \ + forms\ui_alg_gwindow.ui \ + forms\ui_alg_if.ui \ + forms\ui_alg_input.ui \ forms\ui_alg_return.ui \ - forms\ui_alg_for.ui \ + forms\ui_alg_sleep.ui \ + forms\ui_alg_stop.ui \ + forms\ui_alg_while.ui \ + forms\ui_calculator.ui \ + forms\ui_changtheme.ui \ + forms\ui_help.ui \ forms\ui_inline_code.ui \ - forms\ui_alg_sleep.ui + forms\ui_mainwindow.ui \ + forms\w_inline_code.ui TRANSLATIONS += \ - lang\it.ts \ - lang\fr.ts \ - lang\zh-CN.ts \ lang\de.ts \ - lang\es.ts \ No newline at end of file + lang\es.ts \ + lang\fr.ts \ + lang\it.ts \ + lang\zh-CN.ts \ No newline at end of file diff --git a/src/tools/docgen.py b/src/tools/docgen.py index 8d4cd43..a8ad834 100644 --- a/src/tools/docgen.py +++ b/src/tools/docgen.py @@ -50,8 +50,8 @@ def doc_funcs(): args += "" # replace {{x}} by `x` for markdown - desc = re.sub(r"{{(\w+)\}\}", "`\g<1>`", function[2]) - desc = re.sub(r"//(\w+)//", "*\g<1>*", desc) + desc = re.sub(r"{{(\w+)\}\}", r"`\g<1>`", function[2]) + desc = re.sub(r"//(\w+)//", r"*\g<1>*", desc) result += "|%s|%s|%s|\n" % (name, args, desc) @@ -91,7 +91,7 @@ def doc_consts(): # add unit unit = " (%s)" % constant[3].replace("*", "·") - desc = re.sub(r"//(\w+)//", "*\g<1>*", desc) + desc = re.sub(r"//(\w+)//", r"*\g<1>*", desc) result += "|`%s`|%s|*%s* - %s%s|\n" % (name, value, symbol, desc, unit)