diff --git a/PyQt-Plotter-Dialog/plotter_dialog/__main__.py b/PyQt-Plotter-Dialog/plotter_dialog/__main__.py index 3a5f405..f88bdb6 100644 --- a/PyQt-Plotter-Dialog/plotter_dialog/__main__.py +++ b/PyQt-Plotter-Dialog/plotter_dialog/__main__.py @@ -12,38 +12,9 @@ def main(): variables = [chr(ord("a") + i) for i in range(10)] - functions = [ - "abs", - "acos", - "acosh", - "acot", - "asin", - "asinh", - "atan", - "avg", - "cos", - "cosh", - "cot", - "exp", - "lg", - "ln", - "log2", - "max", - "min", - "prod", - "sgn", - "sin", - "sinh", - "sqrt", - "sum", - "tanh", - "tan", - ] - dlg = PlotterDialog( - variable_full_names={key: key.upper() for key in variables}, - function_full_names={key: key.upper() for key in functions}, variable_values={key: np.sort(np.random.random(10)) * 10 for key in variables}, + variable_full_names={key: key.upper() for key in variables}, ) dlg.show() diff --git a/PyQt-Plotter-Dialog/plotter_dialog/constants.py b/PyQt-Plotter-Dialog/plotter_dialog/constants.py new file mode 100644 index 0000000..60d356c --- /dev/null +++ b/PyQt-Plotter-Dialog/plotter_dialog/constants.py @@ -0,0 +1,27 @@ +FUNCTION_NAMES = { + "sin": "Синус", + "cos": "Косинус", + "tan": "Тангенс", + "cot": "Котангенс", + "abs": "Модуль", + "exp": "Экспонента (e^x)", + "sqrt": "Квадратный корень", + "ln": "Натуральный логарифм", + "lg": "Десятичный логарифм", + "log2": "Двоичный логарифм", + "sgn": "Знак", + "asin": "Арксинус", + "acos": "Арккосинус", + "atan": "Арктангенс", + "acot": "Арккотангенс", + "sinh": "Гиперболический синус", + "cosh": "Гиперболический косинус", + "tanh": "Гиперболический тангенс", + "acosh": "Гиперболический арккосинус", + "asinh": "Гиперболический арксинус", + "sum": "Сумма", + "prod": "Произведение", + "min": "Минимум", + "avg": "Среднее", + "max": "Максимум", +} diff --git a/PyQt-Plotter-Dialog/plotter_dialog/dialog.py b/PyQt-Plotter-Dialog/plotter_dialog/dialog.py index 4880a64..29a510b 100644 --- a/PyQt-Plotter-Dialog/plotter_dialog/dialog.py +++ b/PyQt-Plotter-Dialog/plotter_dialog/dialog.py @@ -14,6 +14,7 @@ from PyQt5.QtWidgets import ( import numpy as np from .button_group import ButtonGroup +from .constants import FUNCTION_NAMES from .graph_requester import GraphRequester from parser import Parser @@ -26,9 +27,9 @@ class PlotterDialog(QDialog): def __init__( self, - variable_full_names: dict[str, str], - function_full_names: dict[str, str], - variable_values: dict[str, np.ndarray], + variable_values: dict[str, np.ndarray] = {}, + variable_full_names: dict[str, str] = {}, + function_full_names: dict[str, str] = FUNCTION_NAMES, ): super().__init__() @@ -44,7 +45,6 @@ class PlotterDialog(QDialog): scrollWidget = QWidget() - # self.scroll.setFrameShape(QFrame.NoFrame) self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.inputs_layout = QVBoxLayout() # лаяут первой трети