Skip to content

Commit

Permalink
updated table connections in server.py. It turns out pickling didn't …
Browse files Browse the repository at this point in the history
…work as expected
  • Loading branch information
ZSchweyk committed May 11, 2022
1 parent cafa873 commit ff515a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions Server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datetime import datetime, timedelta
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.urls import url_encode
import pickle

from flask_forms import *
from useful_functions import *
Expand Down Expand Up @@ -177,21 +178,19 @@ def equations(user_flast, eq_num=1):
user_id = session["user_id"]
user = Users.query.filter_by(id=user_id).first()
args = request.args
print(args)
# the default parameter ensures that if the argument can't be converted into an int, it defaults to 1.
eq_num = args.get("eq_num", default=eq_num, type=int)
print("Equation Number:", eq_num)

if form.validate_on_submit():
print("Call draw_equation method to draw!")
rows = Equations.query.filter_by(id=user.id).all()
equation = rows[eq_num - 1].equation

if not is_connected_to_table:
print("CREATING A TABLE OBJECT!!!")
table = ConferenceSandTable()
is_connected_to_table = True

try:
flash("Drawing... Close this to stop.")
table.home()
info = table.draw_equation(
equation,
Expand All @@ -202,7 +201,6 @@ def equations(user_flast, eq_num=1):
)
except Exception as e:
print(e)
pass

print("About to redirect back to this page...")
return redirect(url_for("equations", user_flast=session["flast"], eq_num=eq_num))
Expand Down
Empty file added Server/table_object.object
Empty file.
2 changes: 1 addition & 1 deletion Table/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
table = ConferenceSandTable()
try:
table.home()
table.draw_equation("4 * sin(4 * theta)", 1*pi, theta_speed=.6, scale_factor=1, sleep=.005)
table.draw_equation("4 * sin(4 * theta)", 2*pi, theta_speed=.6, scale_factor=1, sleep=.005)
# angle = pi/4
# for i in range(10):
# print(i+1)
Expand Down

0 comments on commit ff515a1

Please sign in to comment.