Skip to content

Commit

Permalink
v0.15.12: Notification Class II
Browse files Browse the repository at this point in the history
+ Notifications:
++ Replaced all old notifications by the new notification class (NC)
+++ The old notification system is completely removed
++ Added more information to existing notifications
+++ For example most notifications now include the function, the window and the user input that is associated with the notification
++ The notification window now displays all information about a selected notification
++ The changes of ExceptionOutput are reverted. Instead NC can now handle Exceptions on its own.
+++ Thanks to this the exception handling has been reduced to one line in most cases while being more readable in the code and giving more information in the notification!
++ Advanced-Mode-Notifications that were send while advanced more was off are now always listed in the notification window.
++ Changed requirement for recent notifications to be included in the tooltip
+ The context menu code now lives in the HistoryWidget to keep the main window code clean
+ NoEvalParse changes:
++ The NoEvalParse option for the LaTeX view must be turned on in the dev tab in the option window
+++ It turns out that the new process still influences the main program which makes the calculator unreliable
++ The half-checked state now checks if the LaTeX version equals the normal version
+++ This ensures that sin(2*2*t*pi) doesn't return the LaTeX sin(2*t*pi) but instead sin(4*t*pi)
+++ The old behaviour (without this check) is now the behaviour of the unchecked state if the box in the dev tab is not checked
++ Improved the NoEvalParse script to work more reliable (That stuff behaves weird, dude!!!)
++ The NoEvalParse should now be compatible with other OS than Windows and Linux
+++ This means that everything (excluding library dependencies) should be OS independent
+ Added ans1, ans2 and ans3 to access the solution of the last three items of the calculator list
++ ans is no longer the last calculated solution but instead a synonyme for ans1
++ All ans are isolated in parentheses to enable multiplication of complex numbers
+ Cleaned up the overhead of the code execution window
  • Loading branch information
AstusRush committed Jan 13, 2020
1 parent db6bc70 commit 2a7076a
Show file tree
Hide file tree
Showing 9 changed files with 685 additions and 509 deletions.
590 changes: 184 additions & 406 deletions AMaDiA.py

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions AMaDiA_Files/AMaDiA_Classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


from AMaDiA_Files import AMaDiA_Functions as AF
from AMaDiA_Files.AMaDiA_Functions import common_exceptions, ExceptionOutput, sendNotification, NC
from AMaDiA_Files.AMaDiA_Functions import common_exceptions, ExceptionOutput, NC
from AMaDiA_Files import AMaDiA_ReplacementTables as ART


Expand Down Expand Up @@ -263,8 +263,7 @@ def ExecuteFlags(self,expr):
elif self.f_collect == None and QtWidgets.QApplication.instance().optionWindow.cb_F_collect.isChecked():
expr = sympy.collect(expr,AF.parse(QtWidgets.QApplication.instance().optionWindow.tf_F_collect.text()))
except common_exceptions :
error = ExceptionOutput(sys.exc_info())
sendNotification(2,"Could not collect term: "+error)
NC(2,"Could not collect term",exc=sys.exc_info(),func="AMaS.ExecuteFlags",input=self.Input).send()
try:
if self.f_cancel == True or self.f_cancel == None and QtWidgets.QApplication.instance().optionWindow.cb_F_cancel.isChecked():
expr = sympy.cancel(expr)
Expand Down Expand Up @@ -536,7 +535,7 @@ def Evaluate(self, Method=1):
elif Method==1:
return self.Evaluate_SymPy_old()
else:
sendNotification(1,"Invalid evaluate method number. Using standard method instead.")
NC(1,"Invalid evaluate method number. Using standard method instead.",func="AMaS.Evaluate",input=self.Input).send()
return self.Evaluate_SymPy_old()


Expand Down Expand Up @@ -616,7 +615,7 @@ def Evaluate_SymPy_old(self):
try:
classification = sympy.classify_ode(ParsedInput)
print("ODE Classification:\n",classification)
sendNotification(3,"ODE Classification:\n"+str.join("\n",classification))
NC(3,"ODE Classification:\n"+str.join("\n",classification),func="AMaS.Evaluate_SymPy_old",input=self.Input).send()
except common_exceptions:
Error = ExceptionOutput(sys.exc_info())
try:
Expand All @@ -640,8 +639,7 @@ def Evaluate_SymPy_old(self):
else:
j = sympy.solve(ji,AF.parse(QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text()),dict=True,simplify=self.f_simplify)
except common_exceptions:
Error = ExceptionOutput(sys.exc_info())
sendNotification(2,"Could not solve for "+QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text()+"\n"+Error)
NC(2,"Could not solve for "+QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text(),exc=sys.exc_info(),func="AMaS.Evaluate_SymPy_old",input=self.Input).send()
if self.f_simplify==None:
j = sympy.solve(ji,dict=True,simplify=QtWidgets.QApplication.instance().optionWindow.cb_F_simplify.isChecked())
else:
Expand Down Expand Up @@ -687,7 +685,7 @@ def Evaluate_SymPy_old(self):
ans = sympy.solve(ans,AF.parse(QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text()),dict=True,simplify=self.f_simplify)
except common_exceptions:
Error = ExceptionOutput(sys.exc_info())
sendNotification(2,"Could not solve for "+QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text()+"\n"+Error)
NC(2,"Could not solve for "+QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text(),exc=sys.exc_info(),func="AMaS.Evaluate_SymPy_old",input=self.Input).send()
if self.f_simplify==None:
ans = sympy.solve(ans,dict=True,simplify=QtWidgets.QApplication.instance().optionWindow.cb_F_simplify.isChecked())
else:
Expand Down Expand Up @@ -752,7 +750,7 @@ def Evaluate_SymPy_old(self):
try:
classification = sympy.classify_ode(ParsedInput)
print("ODE Classification:\n",classification)
sendNotification(3,"ODE Classification:\n"+str.join("\n",classification))
NC(3,"ODE Classification:\n"+str.join("\n",classification),func="AMaS.Evaluate_SymPy_old",input=self.Input).send()
except common_exceptions:
Error = ExceptionOutput(sys.exc_info())
ansF = self.ExecuteFlags(ans)
Expand All @@ -778,7 +776,7 @@ def Evaluate_SymPy_old(self):
ans_S = sympy.solve(ans,AF.parse(QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text()),dict=True,simplify=self.f_simplify)
except common_exceptions:
Error = ExceptionOutput(sys.exc_info())
sendNotification(2,"Could not solve for "+QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text()+"\n"+Error)
NC(2,"Could not solve for "+QtWidgets.QApplication.instance().optionWindow.tf_F_solveFor.text(),exc=sys.exc_info(),func="AMaS.Evaluate_SymPy_old",input=self.Input).send()
if self.f_simplify==None:
ans_S = sympy.solve(ans,dict=True,simplify=QtWidgets.QApplication.instance().optionWindow.cb_F_simplify.isChecked())
else:
Expand Down Expand Up @@ -814,6 +812,11 @@ def Evaluate_SymPy_old(self):
self.Equation = AF.number_shaver(self.Equation)
self.Solution = AF.number_shaver(self.Solution)
self.ConvertToLaTeX_Equation()

#self.Solution = AF.AstusParseInverse(self.Solution, True) # TODO: Inverse Parse the solution.
# This currently breaks everything with E notation and probably much more when working with "ans".
# The way of only converting the displayed Equation works does not have this problem.
# The reason the Solution should be inverse-parsed is to give the user a prettier solution to copy.

if self.Solution == "Fail":
return Error
Expand Down Expand Up @@ -870,7 +873,7 @@ def Solve_ODE_Version_1(self):
equation = parse_expr(equation,local_dict=self.Variables)
classification = sympy.classify_ode(equation)
print("ODE Classification:\n",classification)
sendNotification(3,"ODE Classification:\n"+str.join("\n",classification))
NC(3,"ODE Classification:\n"+str.join("\n",classification),func="AMaS.Solve_ODE_Version_1",input=self.Input).send()
ics = {}
for i in Input:
f,y=i.split("=")
Expand Down
Loading

0 comments on commit 2a7076a

Please sign in to comment.