Added default functions and their names layout in PlotterDialog

This commit is contained in:
Dmitriy Shishkov 2023-10-29 19:08:04 +03:00
parent e2b9025bc5
commit 02f17d2e51
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
3 changed files with 32 additions and 34 deletions

View File

@ -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()

View File

@ -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": "Максимум",
}

View File

@ -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() # лаяут первой трети