From 879c209d64f0c139706e5cb73b1c4c95ec532004 Mon Sep 17 00:00:00 2001 From: hbui <hong-phuc.bui@htwsaar.de> Date: Mon, 22 Jul 2024 13:12:21 +0200 Subject: [PATCH] * remove print * change main layout --- num-int/src/numint/guimain.py | 2 num-int/src/numint/mainwindow.ui | 348 +++++++++++++++++++++++++------------------------ num-int/src/numint/ui_mainwindow.py | 15 + num-int/src/numint/expression_transformer.py | 1 4 files changed, 187 insertions(+), 179 deletions(-) diff --git a/num-int/src/numint/expression_transformer.py b/num-int/src/numint/expression_transformer.py index dbc2308..dc25c6a 100644 --- a/num-int/src/numint/expression_transformer.py +++ b/num-int/src/numint/expression_transformer.py @@ -8,7 +8,6 @@ def add(self, left, right) -> str: result = f"{left} + {right}" - print(result) return result def sub(self, left, right) -> str: diff --git a/num-int/src/numint/guimain.py b/num-int/src/numint/guimain.py index f16cd6c..44ef1ee 100644 --- a/num-int/src/numint/guimain.py +++ b/num-int/src/numint/guimain.py @@ -45,7 +45,7 @@ (a, b) = (parse_value(start), parse_value(end)) if epsilon is not None and len(epsilon.strip()) > 0: eps = parse_value(epsilon) - print(f"plot {fn_expr}, {a}, {b}, epsilon = {eps}") + print(f"plot f(x) = {fn_expr}, {a}, {b}, epsilon = {eps}") (self.x, self.y, *_) = numint_epsilon(f, a, b, eps) self._update_plot_eps() else: diff --git a/num-int/src/numint/mainwindow.ui b/num-int/src/numint/mainwindow.ui index 2909f6d..5698c70 100644 --- a/num-int/src/numint/mainwindow.ui +++ b/num-int/src/numint/mainwindow.ui @@ -6,206 +6,210 @@ <rect> <x>0</x> <y>0</y> - <width>1390</width> - <height>971</height> + <width>1411</width> + <height>889</height> </rect> </property> <property name="windowTitle"> <string>Riemann Sum</string> </property> <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> - <layout class="QVBoxLayout" name="verticalLayout"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QGroupBox" name="functionInfo"> - <property name="title"> - <string>Angabe der Funktion</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label_start"> - <property name="text"> - <string>Funktion f(x) = </string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="function"> - <property name="text"> - <string>x ** 2</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_fn"> - <property name="text"> - <string>start</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="startValue"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_end"> - <property name="text"> - <string>end</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="endValue"> - <property name="text"> - <string>4</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <widget class="QGroupBox" name="functionInfo"> + <property name="title"> + <string>Angabe der Funktion</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label_start"> + <property name="text"> + <string>Funktion f(x) = </string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="function"> + <property name="text"> + <string>x ** 2</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_fn"> + <property name="text"> + <string>start</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="startValue"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_end"> + <property name="text"> + <string>end</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="endValue"> + <property name="text"> + <string>4</string> + </property> + </widget> + </item> + </layout> + </widget> </item> <item> - <widget class="QPushButton" name="plotBtn"> - <property name="text"> - <string>Ok</string> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="plotBtn"> + <property name="text"> + <string>Ok</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QPlainTextEdit" name="plainTextEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <family>Noto Mono</family> + </font> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="plainText"> + <string>Die Funktion f(x) kann eine belibige Kombination von arithmetischen Operationen und Python mathematische Funktion in Modul math sein. Einige Beispiele sind: + +x ** 2 +x ** 3 +tan(radians(x))</string> </property> </widget> </item> </layout> </item> <item> - <widget class="QPlainTextEdit" name="plainTextEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QGroupBox" name="breakRule"> + <property name="title"> + <string>Abbuchkriterium</string> </property> - <property name="font"> - <font> - <family>Noto Mono</family> - </font> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="plainText"> - <string>Die Funktion f(x) kann eine belibige Kombination von arithmetischen Operationen und Python mathematische Funktion in Modul math sein. Einige Beispiele sind: - -x ** 2 -x ** 3 -tan(radians(x))</string> - </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Maximum Differenz ziwschen Link- und Recht-Summe</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="espilon"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Anzahl der Sektionen</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="section"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>8</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> </widget> </item> </layout> </item> <item> - <widget class="QGroupBox" name="breakRule"> - <property name="title"> - <string>Abbuchkriterium</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Maximum Differenz ziwschen Link- und Recht-Summe</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLineEdit" name="espilon"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Anzahl der Sektionen</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLineEdit" name="section"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>8</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="plotBox"> <property name="enabled"> <bool>true</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -222,7 +226,7 @@ <rect> <x>0</x> <y>0</y> - <width>1390</width> + <width>1411</width> <height>22</height> </rect> </property> diff --git a/num-int/src/numint/ui_mainwindow.py b/num-int/src/numint/ui_mainwindow.py index ff1a693..d567d79 100644 --- a/num-int/src/numint/ui_mainwindow.py +++ b/num-int/src/numint/ui_mainwindow.py @@ -24,10 +24,12 @@ def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") - MainWindow.resize(1390, 971) + MainWindow.resize(1411, 889) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") - self.verticalLayout_2 = QVBoxLayout(self.centralwidget) + self.horizontalLayout_4 = QHBoxLayout(self.centralwidget) + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.verticalLayout_2 = QVBoxLayout() self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") @@ -151,21 +153,24 @@ self.verticalLayout_2.addWidget(self.breakRule) + + self.horizontalLayout_4.addLayout(self.verticalLayout_2) + self.plotBox = QGroupBox(self.centralwidget) self.plotBox.setObjectName(u"plotBox") self.plotBox.setEnabled(True) - sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) + sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.plotBox.sizePolicy().hasHeightForWidth()) self.plotBox.setSizePolicy(sizePolicy2) - self.verticalLayout_2.addWidget(self.plotBox) + self.horizontalLayout_4.addWidget(self.plotBox) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 1390, 22)) + self.menubar.setGeometry(QRect(0, 0, 1411, 22)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") -- Gitblit v1.10.0-SNAPSHOT