From 8ff4531f91292549a3caac5ea9d0772a8145982f Mon Sep 17 00:00:00 2001 From: limafresh Date: Tue, 29 Oct 2024 12:49:04 +0200 Subject: [PATCH] If the line is empty, a zero is added, an icon is added to the About window title --- pyproject.toml | 2 +- src/pyqulator/main.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7929437..e3ae9e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyqulator" -version = "1.7.1" +version = "1.8.0" dependencies = [ "PyQt6>=6.4.2", "sympy>=1.13.3", diff --git a/src/pyqulator/main.py b/src/pyqulator/main.py index 0921fab..fc7d2be 100644 --- a/src/pyqulator/main.py +++ b/src/pyqulator/main.py @@ -232,6 +232,8 @@ def log(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def sin(self): try: @@ -239,6 +241,8 @@ def sin(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def cos(self): try: @@ -246,6 +250,8 @@ def cos(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def tan(self): try: @@ -253,6 +259,8 @@ def tan(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def exp(self): try: @@ -260,6 +268,8 @@ def exp(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def pi(self): try: @@ -270,6 +280,8 @@ def pi(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def e(self): try: @@ -280,6 +292,8 @@ def e(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def procent(self): try: @@ -287,6 +301,8 @@ def procent(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def radical(self): try: @@ -294,6 +310,8 @@ def radical(self): self.current_line_result.setText(str(sqrt(res)).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") def square(self): try: @@ -301,6 +319,8 @@ def square(self): self.current_line_result.setText(str(res).rstrip("0").rstrip(".")) except Exception as e: QMessageBox.warning(self, "Error", str(e)) + if self.current_line_result.text() == "": + self.current_line_result.setText("0") # Journal functions def clear_journal(self): @@ -569,6 +589,7 @@ def show_about_program(self): """ self.about_msg.setText(msg_text) icon = QIcon.fromTheme("accessories-calculator") + self.about_msg.setWindowIcon(icon) self.about_msg.setIconPixmap(icon.pixmap(32, 32)) self.about_msg.exec()