Esempio n. 1
0
    def __init__(self, name, desc, icon, table_name, level1_set, level2_set, level3_set, game_options={}, **kwargs):
        """
        Parametry:
            @name - nazwa zadania
            @desc - opis zadania (do wyświetlenia w menu)
            @icon - ikonka zadania (do wyświetlenia w menu)

            @level1_set - plik zawierający listę możliwych kart do rozlosowania na 1 poziomie
            @level2_set - plik zawierający listę możliwych kart do rozlosowania na 2 poziomie
            @level3_set - plik zawierający listę możliwych kart do rozlosowania na 3 poziomie

            @game_options - dodatkowe parametry gry (np. tryb zaznaczania kart, długoś czasu wyświetlania chmurki z wyrazem, itp)
        """
        Exercise.__init__(self, name=name, desc=desc, icon=icon, table_name=table_name, **kwargs)

        # Level Chooser
        lc = GenericLevelChooser(name=CH_SCREEN, title=name)

        lc.back_bt.bind(on_release=lambda bt: self.back_to_menu())

        game_options['table_name'] = table_name

        lc.level_1_bt.bind(on_release=lambda bt: self.launch_level(level_number=1, rows=3, cols=4, cards_set=level1_set, level_icon="res/icons/star1.png", **game_options))
        lc.level_2_bt.bind(on_release=lambda bt: self.launch_level(level_number=2, rows=4, cols=5, cards_set=level2_set, level_icon="res/icons/star2.png", **game_options))
        lc.level_3_bt.bind(on_release=lambda bt: self.launch_level(level_number=3, rows=5, cols=6, cards_set=level3_set, level_icon="res/icons/star3.png", **game_options))

        lc.stats_bt.bind(on_release=lambda bt: self.open_statistics())

        self.sm.add_widget(lc)
Esempio n. 2
0
    def get_exercise(self, exercise):
        r = requests.get("%sexercises/%d.json" % (self.server, exercise),
            headers=self.auth,
            params={"api_version": 7})

        data = self.extract_json(r)

        if not "error" in data:
            course = Course(int(data["course_id"]), data["course_name"])
            exercise = Exercise(course, int(data["exercise_id"]), data["exercise_name"])
            exercise.setDownloaded()
            exercise.setDeadline(data["deadline"], data["deadline"])
            return exercise

        v.log(-1, "Could not find exercise %d" % exercise)
        return None
Esempio n. 3
0
    def generate(self, line, lang1, lang2, category):
        """Generate exercises from the given line"""
        line = self.set_tag(line)
        exercices = []
        parts = self.get_words(line)
        for i in xrange(0, len(parts)):
            if len(parts[i]) > 0 and parts[i][0] == self.marks()[0]:
                question = ''.join(parts[:i])
                question = question + Exercise.placeholder()
                question = question + ''.join(parts[i + 1:])
                question = question.replace(self.marks()[0], '')
                answer = parts[i][1:]
                exercices.append(
                    Exercise('', question, answer, lang1, lang1,
                             category, self.tag))

        return exercices
Esempio n. 4
0
    def get_course(self, course):
        if type(course) == int:
            id = course
        else:
            id = course.id
        r = requests.get("%scourses/%d.json" % (self.server, id),
            headers=self.auth,
            params={"api_version": 7})

        data = self.extract_json(r)
        
        newcourse = Course(int(data["course"]["id"]), data["course"]["name"])
        for i in data["course"]["exercises"]:
            tmp = Exercise(newcourse, int(i["id"]), i["name"])
            tmp.setDeadline(i["deadline_description"], i["deadline"])
            tmp.attempted = i["attempted"]
            tmp.completed = i["completed"]
            tmp.setDownloaded()
            newcourse.exercises.append(tmp)

        return newcourse
Esempio n. 5
0
 def add(self):
     quest = input('Podaj swoje zadanie do zrobienia ')
     zadanie = Exercise(quest)
     self.zadania.append(zadanie)
     self.print()
Esempio n. 6
0
# Once you have defined all of your custom types, go to main.py, import the classes you need, and implement the following logic.

from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student

# Create 4, or more, exercises.

exercise_one = Exercise("dragon_dog", "javascript")
exercise_two = Exercise("chicken_monkey", "python")
exercise_three = Exercise("fish_bird", "SQL")
exercise_four = Exercise("koala_cat", "HTML")

# Create 3, or more, cohorts.

cohort_one = Cohort("Cohort 1")
cohort_two = Cohort("Cohort 2")
cohort_three = Cohort("Cohort 3")

# Create 4, or more, students and assign them to one of the cohorts.

student_one = Student("Harry", "Potter", "@TheChosenOne", cohort_three)
student_two = Student("Lavendar", "Brown", "@LavvyB", cohort_three)
student_three = Student("Herminone", "Granger", "@BookLover23", cohort_two)
student_four = Student("Percy", "Weasley", "@IloveRules", cohort_one)

cohort_one.cohort_students.extend([student_four])
cohort_two.cohort_students.extend([student_three])
cohort_three.cohort_students.extend([student_one, student_two])
Esempio n. 7
0
from exercise import Exercise
from cohort import Cohort
from NSSPerson import Student
from NSSPerson import Instructor

# Creating Exercises
student_exercise = Exercise('Student Exercise', 'Python')
petting_zoo = Exercise('Petting Zoo', 'Python')
kandy_korner = Exercise('Kandy Korner', 'Javascript')
daily_journal = Exercise('Daily Journal', 'Javascript')

# Creating Cohorts
cohort_40 = Cohort('cohort 40')
cohort_41 = Cohort('cohort 41')
cohort_42 = Cohort('cohort 42')

# Creating Students
ronnie = Student('Ronald', 'Lankford', 'ronnielankford', 'cohort 40')
geoff = Student('Geoff', 'Slater', 'mynamegeoff', 'cohort 41')
mark = Student('Mark', 'Kagoan', 'markymark', 'cohort 40')
shae = Student('Shae', 'Choate', 'shadeofshae', 'cohort 42')

# Creating Instructors
joe = Instructor('Joe', 'Shepherd', 'joe', 'dad jokes', 'cohort 40')
bry = Instructor('Bryan', 'Nilsen', 'bry', 'dad jokes', 'cohort 41')
madi = Instructor('Madi', 'Peper', 'madi', 'dad jokes', 'cohort 42')

# Assigning Instructors to Cohorts
cohort_40.assign_instructor(joe)
cohort_41.assign_instructor(bry)
cohort_42.assign_instructor(madi)
Esempio n. 8
0
def build_exercise_sample():
    exercise1 = Exercise()
    exercise1.name = 'squats'
    return exercise1
Esempio n. 9
0
import services
from exercise import Exercise

auth = services.Authentication()
# comment something something

db = services.Database()
ex = Exercise()


class Bot:

    email = ''
    password = ''
    user_data = {
        'name': '',
        'age': '',
        'gender': '',
    }

    @staticmethod
    def greet_user(greet, user_name):
        print('Bot - Greet User')
        print(greet, user_name)

    def ask_auth_mode(self):
        print('Bot - Auth Mode User')
        user_choice = input(
            'Do u want to login or register ? 1 == login, 0 == register \n')

        if int(user_choice) == 1:
Esempio n. 10
0
from student import Student
from exercise import Exercise
from instructor import Instructor
from cohort import Cohort

daily_journal = Exercise("Daily Journal", "Javascript")
frontend_capstone = Exercise("Frontend Capstone", "React")
car_dealership = Exercise("Car Dealership Challenge", "Javascript")
nutshell = Exercise("Nutshell", "Javascript")

c40 = Cohort("Day Cohort 40")
c19 = Cohort("Evening Cohort 19")
c38 = Cohort("Day Cohort 38")

zach = Student("Zach", "Nicholson", "@zachattack")
ronnie = Student("Ronnie", "Lankford", "@m0t0cr0ssg0d")
kaleb = Student("Kaleb", "Moran", "@ssbmDWAIN")
tanner = Student("Tanner", "Brainard", "@bigBRAINbigBUCKS")

joe = Instructor("Joe", "Shepherd", "@morningjoe", "Infinite patience")
bryan = Instructor("Bryan", "Nielsen", "@fathercomedy", "Dad jokes")
sage = Instructor("Sage", "Klein", "@fallensoldierRIP", "Humor & Figma?")

c40.addStudents(zach, kaleb)
c38.addStudents(ronnie, tanner)
c19.addStudents(zach, ronnie, kaleb, tanner)

c40.addInstructors(joe, bryan, sage)
c38.addInstructors(joe, bryan)
c19.addInstructors(sage)
Esempio n. 11
0
 def __init__(self, uicurses=None, dic_data=None):
     self.required = ["text", "BPM", "words"] 
     Exercise.__init__(self, uicurses, dic_data)
     if "encoding" not in self:
         self.encoding=locale.getpreferredencoding()
Esempio n. 12
0
 def __init__(self, uicurses=None, dic_data=None):
     self.required = ["text", "BPM", "words"] 
     Exercise.__init__(self, uicurses, dic_data)
Esempio n. 13
0
"""
Test of Topic class with related Question and Exercise
"""

from topic import Topic
from exercise import Exercise
from topicSet import TopicSet
import json

print "Test for Topic..."

mainTopic = Topic("Simple Topic A", 3600)
mainTopic.addTheory("Simple theory about the Topic A of the Subject.")
mainTopic.addTheory("Complex theory about the Topic A of the Subject.")
ex0 = Exercise("Notes for Exercise 0")
ex0.addQuestion("Question 0.1", ["1"], [1.0])
ex1 = Exercise("Notes for Exercise 1")
ex1.addQuestion("Question 1.1", ["one", "two", "three", "four"], [0.0, 0.2, 1, "0.5"])
ex1.addQuestion("Question 1.2", ["one", "two"], [1.0]).addQuestion(
    "Question 1.3", [1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 0.3, 0.4]
)
ex2 = Exercise("Notes for Exercise 2")
ex2.addQuestion("Question 2.1", ["1", "2", "3"], [0.0, 1.0])
ex3 = Exercise("Notes for Exercise 3")
ex4 = Exercise("Notes for Exercise 4")
ex4.addQuestion("Question 4.1", ["1"], [1.0, 0.0])
ex5 = Exercise("Notes for Exercise 5")
ex6 = Exercise("Notes for Exercise 6")
ex7 = Exercise("Notes for Exercise 7")

mainTopic.addExercise(ex0).addExercise(ex1).addExercise(ex2).addExercise(ex3)
Esempio n. 14
0
from exercise import Exercise
from student import Student
from cohort import Cohort
from instructor import Instructor

kennel = Exercise("Pet Kennel", "React")
studentExercises = Exercise("Student Exercises", "Python")
nutshell = Exercise("Nutshell", "JavaScript")
celebTribute = Exercise("Celebrity Tribute", "HTML + CSS")

c38 = Cohort("C38")
c37 = Cohort("C37")
c39 = Cohort("C39")

landon = Student("Landon", "Morgan", "@landon")
mike = Student("Mike", "Prince", "@mike")
michael = Student("Michael", "Clark", "@michael")
cody = Student("Cody", "Murdock", "@cody")
dingo = Student("Dingo", "LastName", "@dingo")

c38.add_person(landon)
c38.add_person(mike)
c37.add_person(michael)
c39.add_person(cody)
c39.add_person(dingo)

kristen = Instructor("Kristen", "Norris", "@kristen")
jisie = Instructor("Jisie", "David", "@jisie")
chase = Instructor("Chase", "Fite", "@chase")

c37.add_person(kristen)
Esempio n. 15
0
from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student
from nssperson import NSSPerson

daily_journal = Exercise("Daily Journal", "Javascript")
student_exercises = Exercise("Student Exercises", "Python")
perennial = Exercise("Capstone", "React")
nutshell = Exercise("Nutshell", "Javascript")

cohort_38 = Cohort("Cohort 38")
cohort_37 = Cohort("Cohort 37")
cohort_24 = Cohort("Cohort 24")
cohort_9 = Cohort("Evening Cohort 9")

bjork_g = Student("Bjork", "Guðmundsdóttir", "@bjorkg", cohort_9)
kate_bush = Student("Kate", "Bush", "@wutheringheights", cohort_38)
kurt_cobain = Student("Kurt", "Cobain", "@nirvana", cohort_37)
billy_holiday = Student("Billy", "Holiday", "@gloomybilly", cohort_24)

thom_yorke = Instructor("Thom", "Yorke", "@thomyorke", cohort_9)
elizabeth_fraiser = Instructor("Elizabeth", "Frasier", "@pearlydewdropsdrop",
                               cohort_38)
billy_corgan = Instructor("Billy", "Corgan", "@patrick", cohort_24)
bilinda_butcher = Instructor("Bilinda", "Butcher", "@bilindab", cohort_37)

bilinda_butcher.assign_exercise(kurt_cobain, perennial)
billy_corgan.assign_exercise(billy_holiday, nutshell)
elizabeth_fraiser.assign_exercise(kate_bush, student_exercises)
thom_yorke.assign_exercise(bjork_g, daily_journal)
Esempio n. 16
0
from student import Student
from instructor import Instructor
from cohort import Cohort
from exercise import Exercise

# Create 4, or more, exercises.
exercise_one = Exercise("Urban Planner", "Python")
exercise_two = Exercise("Chicken Monkey", "JavaScript")
exercise_three = Exercise("Daily Journal", "JavaScript")
exercise_four = Exercise("Celebrity Tribute", "HTML")
exercise_five = Exercise("Pizza Joint", "Python")
# print(exercise_five)

# Create 3, or more, cohorts.
C36 = Cohort("Day Cohort 36")
E11 = Cohort("Evening Cohort 11")
C34 = Cohort("Day Cohort 34")
# print(C34)

# Create 4, or more, students and assign them to one of the cohorts.
student_one = Student("Sam", "Pita", "sampita", "C36")
student_two = Student("Melody", "Stern", "melodystern", "C36")
student_three = Student("Sarah", "Fleming", "sarahfleming", "C34")
student_four = Student("John", "Snow", "winteriscoming", "E11")
# print(student_four)

# Challenge: Create a list of students. Add all of the student instances to it.
studentsArray = [student_one, student_two, student_three, student_four]

# Create 3, or more, instructors and assign them to one of the cohorts.
instructor_one = Instructor("Jisie", "David", "jisiedavid", "C36",
Esempio n. 17
0
                             "10 laps around house, 1 mile")

curl_counter = Challenge("curl_counter", "counter",
                         "Do as many curls as you can, no time limit", 1)
'''
Exercises

Ex.           Exercise("name", min, max, low_threshold, high_threshold, multiplier=1, yoga=False, style="num", unit="rep", challenges=list())
'''

#Strength
push_ups = Exercise("Push Ups",
                    5,
                    20,
                    7,
                    11,
                    challenges=[
                        push_up_stopwatch_10, push_up_stopwatch_15,
                        push_up_stopwatch_20, push_up_counter_30s,
                        push_up_counter_1m
                    ])
push_up_planks = Exercise("Push Up Plank", 3, 10, 4, 6)
planks = Exercise("Plank",
                  30,
                  120,
                  30,
                  60,
                  multiplier=30,
                  style="time",
                  unit="sec")
jumping_jacks = Exercise("Jumping Jacks", 10, 50, 25, 40, multiplier=5)
mountain_climbers = Exercise("Mountain Climbers", 10, 40, 15, 25)
Esempio n. 18
0
from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student

nutshell = Exercise('nutshell', 'JavaScript')
reactnutshell = Exercise('reactshell', 'react')
bangazon = Exercise('bangazon', 'C#/.Net')
trestlebridge = Exercise('TrestleBridge Farms', 'C#')

cohort1 = Cohort('Day Cohort 37')
cohort2 = Cohort('Day Cohort 38')
cohort3 = Cohort('Evening Cohort 13')

student1 = Student('james', 'Nitz', 'jnitz')
student2 = Student('Slick', 'bigman', 'slickyb')
student3 = Student('kevin', 'penny', 'keveloper')
student4 = Student('slab', 'onDeck', 'bruh')

mo = Instructor('mo', 'money', 'Moooo', 'smart')
willy = Instructor('willy', 'metcalf', 'wizzle', 'raves')
william = Instructor('William', 'green', 'wgreen', 'being late')

cohort1.students.append(student1)
cohort2.students.append(student2)
cohort3.students.append(student3)
cohort3.students.append(student4)

cohort1.instructors.append(mo)
cohort2.instructors.append(willy)
cohort3.instructors.append(william)
Esempio n. 19
0
#list exercises and affected muscles
from exercise import Exercise
from muscle import MuscleRole

for exercise in Exercise.all():
  print exercise.name + ": "
  for mrk in exercise.muscles:
    mr = MuscleRole.get(mrk)
    print mr.muscle.name
Esempio n. 20
0
from student import Student
from instructor import Instructor
from cohort import Cohort
from exercise import Exercise

# The learning objective of this exercise is to practice creating instances of custom types that you defined with class, establishing the relationships between them, and practicing basic data structures in Python.

# Create 4, or more, exercises.
exercise1 = Exercise("Exercise 1", "HTML")
exercise2 = Exercise("Exercise 2", "JavaScript")
exercise3 = Exercise("Exercise 3", "React")
exercise4 = Exercise("Exercise 4", "Python")

# Create 3, or more, cohorts.
cohort41 = Cohort("Cohort 41")
cohort42 = Cohort("Cohort 42")
cohort43 = Cohort("Cohort 43")

# Create 4, or more, students and assign them to one of the cohorts.
student1 = Student("Fynley", "Wiggins", "wigginslack")
student2 = Student("Vikki","Vaillancourt","vikkislack")
student3 = Student("Jimmy", "John", "jimmieJsSlack")
student4 = Student("John", "Smith", "jsmithslack")

cohort41.students.append(student1)
cohort42.students.append(student2)
cohort42.students.append(student3)
cohort43.students.append(student4)

# Create 3, or more, instructors and assign them to one of the cohorts.
instructor1 = Instructor("Joey", "Joe", "jojoslack")
Esempio n. 21
0
from exercise import Exercise

GENDER = "male"
WEIGHT = 95  # Kg
HEIGHT = 180  # cm
AGE = 26

workout = Exercise(gender=GENDER, weight=WEIGHT, height=HEIGHT, age=AGE)


def main():

    query = input("Enter the exercise you just had: ")

    workout.post_new_row(query)


if __name__ == '__main__':
    main()
from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student

nutshell = Exercise("nutshell", "Javascript")
reactnutshell = Exercise("reactnutshell", "react")
bangazon = Exercise("bangazon", "C#/.Net")
trestlebridge = Exercise("Trestlebridge Farms", "C#")

cohort35 = Cohort("Day Cohort 35")
cohort36 = Cohort("Day Cohort 36")
cohort37 = Cohort("Day Cohort 37")
cohort38 = Cohort("Day Cohort 38")

student1 = Student("Taylor", "Carroll", "taylorhc")
student2 = Student("Sage", "Klein", "sagey")
student3 = Student("Keith", "Potempa", "kpotempa")
student4 = Student("Nate", "Vogel", "nvogel")

mo = Instructor("mo", "mo", "itsmo", "Backend C#")
madi = Instructor("Madi", "Pepper", "peppers", "Beat Saber")
brenda = Instructor("Brenda", "Long", "blong", "UX/UI")

mo.assign_exercise(student1, nutshell)
mo.assign_exercise(student1, reactnutshell)
mo.assign_exercise(student2, bangazon)
mo.assign_exercise(student3, trestlebridge)
mo.assign_exercise(student4, trestlebridge)

students = []
Esempio n. 23
0
from student import Student
from instructor import Instructor
from cohort import Cohort
from exercise import Exercise

exercise1 = Exercise("High", "CSS") 
exercise2 = Exercise("Low", "HTML") 
exercise3 = Exercise("Mid", "JavaScript") 
exercise4 = Exercise("Expert", "Python") 

cohort1 = Cohort("Cohort 101")
cohort2 = Cohort("Cohort 100")
cohort3 = Cohort("Cohort 99")

student1 = Student("Slim", "Pickens", "SlimPick", "Cohort 100")
student2 = Student("Luke", "Jackson", "LJ", "Cohort 99")
student3 = Student("Martin", "Riggs", "Lethal_Weapon", "Cohort 101")
student4 = Student("Roger", "Murtaugh", "Too_Old", "Cohort 101")

instructor1 = Instructor("Jisie", "David", "JD", "Cohort 101", "JavaScript")
instructor2 = Instructor("Chase", "Fite", "CF", "Cohort 100", "Python")
instructor3 = Instructor("Kristen", "Norris", "KN", "Cohort 99", "HTML")

instructor1.assign(student3, exercise1)
instructor1.assign(student3, exercise2)
instructor1.assign(student4, exercise1)
instructor1.assign(student4, exercise2)
instructor2.assign(student1, exercise3)
instructor2.assign(student1, exercise4)
instructor3.assign(student2, exercise1)
instructor3.assign(student2, exercise4)
Esempio n. 24
0
from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student

cthulu = Exercise("Cthulu", "Vanilla JavaScript")
kandy_korner = Exercise("Kandy Korner", "React")
glassdale = Exercise("Glassdale", "Vanilla JavaScript")
critters = Exercise("Critters and Croquettes", "Python")

exercises = [cthulu, kandy_korner, glassdale, critters]

c37 = Cohort("Cohort day 37")
c40 = Cohort("Cohort day 40")
c41 = Cohort("Cohort day 41 ")

dwight = Student("Dwight", "Schrutte", "beet_farmer", c37)
reptar = Student("King", "Reptar", "king_of_dinosaurs", c40)
puig = Student("Yasiel", "Puig", "fear_of_commitment", c41)
capn = Student("Captain", "Crunch", "simply_the_best", c40)

tony = Instructor("Tony", "Perez", "HoFer", "long bombs", c37)
count = Instructor("Count", "von Count", "1234", "counting ah ah ah", c40)
andre = Instructor("Andre", "3000", "BoB", "Ice Cold", c41)

c37.students.extend([
    dwight,
])
c40.students.extend([reptar, capn])
c41.students.extend([
    puig,
Esempio n. 25
0
from student import Student
from instructor import Instructor
from cohort import Cohort
from exercise import Exercise

# Exercises

product_cards = Exercise('Product Cards', 'CSS')
sorting_hat = Exercise('Sorting Hat', 'JavaScript')
tamagotchi = Exercise('Tamagotchi', 'Sass')
pet_adoption = Exercise('Pet Adoption', 'JavaScript')
mushroom_picker = Exercise('Mushroom Picker', 'JavaScript')
sports_roster = Exercise('Sports Roster', 'JavaScript')
kandy_korner = Exercise('Kandy Korner', 'JavaScript')
stocks_report = Exercise('Stocks Report', 'Python')
cash_to_coins = Exercise('Cash To Coins', 'Python')
coins_to_cash = Exercise('Coins To Cash', 'Python')

exercises = [
    product_cards, sorting_hat, tamagotchi, kandy_korner, stocks_report,
    cash_to_coins, coins_to_cash, pet_adoption, mushroom_picker, sports_roster
]

# Cohorts

evening_cohort_10 = Cohort('E10')
evening_cohort_11 = Cohort('E11')
day_cohort_40 = Cohort('C40')

cohorts = [evening_cohort_10, evening_cohort_11, day_cohort_40]
Esempio n. 26
0
from student import Student
from exercise import Exercise
from cohort import Cohort
from instructor import Instructor

# Create 4, or more, exercises.
# Create 3, or more, cohorts.
# Create 4, or more, students and assign them to one of the cohorts.
# Create 3, or more, instructors and assign them to one of the cohorts.
# Have each instructor assign 2 exercises to each of the students.

#Exercises
packages = Exercise("Packages", "Python")
classes = Exercise("Classes", "Python")
functions = Exercise("Functions", "Python")
operators = Exercise("Operators", "Python")

#Cohorts
cohort39 = Cohort("Cohort39")
cohort40 = Cohort("Cohort40")
cohort41 = Cohort("Cohort41")

#Students
felipe = Student("Felipe", "Moura", "Felipe", cohort40, packages)
daniel = Student("Daniel", "Meza", "Danim", cohort40, functions)
zane = Student("Zane", "Smith", "Zzane", cohort39, operators)
roxxane = Student("Roxxane", "Smith", "Roxx", cohort41, operators)

#Instructors
bryan = Instructor("Brian", "Smith","Bry", cohort40, "superdance")
joe = Instructor("Joe", "Jojo","joes", cohort41, "dad's jokes")
Esempio n. 27
0
class Window(QWidget):

    keys = {Qt.Key_Left: "left", Qt.Key_Right: "right", Qt.Key_Down: "equal", Qt.Key_Space: "skip"}

    def __init__(self):
        super().__init__()

        # Create window at center of the display.
        display_geometry = QDesktopWidget().availableGeometry()
        window_size = display_geometry.size() / 2
        dx, dy = window_size.width(), window_size.height()

        display_geometry = QDesktopWidget().availableGeometry()
        display_center = display_geometry.center()
        x = display_center.x() - dx / 2
        y = display_center.y() - dy / 2
        self.setGeometry(int(x), int(y), dx, dy)
        self.setFixedSize(dx, dy)

        # Initialize statistic and exercise result variable.
        self.exercise = Exercise(num_shapes=2)
        self.statistics = pd.DataFrame(columns=["time", "is_correct", "pressed", "solution"])

        # Set window properties.
        self.setWindowTitle('eligo_reactions')
        self.show()

    def paintEvent(self, e) -> None:
        super(Window, self).paintEvent(e)

        # If the time is running the previous task has not been solved, so do not update
        # the window's content. Only if the timer is None
        if self.exercise.task is None:
            self.exercise.new_task()
            logging.debug(self.exercise)

        shapes_dict, shapes_task, task_description, operation = self.exercise.task
        self.draw_legend(shapes_dict)
        self.draw_exercise(task_description, task_count=self.exercise.counter)
        self.draw_task(shapes_task, operation=operation)

    def keyPressEvent(self, a0: QKeyEvent) -> None:
        if a0.key() not in self.keys.keys():
            return

        time_needed = self.exercise.time_needed()
        key_pressed = self.keys[a0.key()]
        is_correct = (key_pressed == self.exercise.solution)
        statistic = {"time": time_needed, "is_correct": is_correct,
                     "pressed": key_pressed, "solution": self.exercise.solution}
        self.statistics = self.statistics.append(statistic, ignore_index=True)

        self.exercise.reset_task()
        self.update()

    def closeEvent(self, a0: QCloseEvent) -> None:
        logging.info("--- Statistics ---")
        logging.info(self.statistics)
        logging.info(self.statistics.mean())

    ################################################################################
    # Drawing ######################################################################
    ################################################################################
    def draw_exercise(self, task_description: str, task_count: int):
        window_size = self.get_size()
        text = f"Exercise {task_count}\nWelche Seite ist {task_description}?"

        painter = QPainter()
        painter.begin(self)
        painter.setFont(QFont('Times', 35))
        painter.drawText(QRect(0, 0, window_size[0], window_size[1] / 6), Qt.AlignCenter | Qt.AlignCenter, text)
        painter.end()

    def draw_task(self, task: typing.List[typing.List[Shape]], operation: str, size: int = 30):
        window_size = self.get_size()
        num_sides = len(task)

        for s, shapes_s in enumerate(task):
            x0 = window_size[0] / num_sides / 2 * (1 + 2 * s)
            num_shapes = len(shapes_s)

            for n, shape in enumerate(shapes_s):
                x = int(x0 + size * 2 * (n - num_shapes + 1))
                y = int(window_size[1] / 3)
                painter = shape.draw(window=self, position=(x, y), size=size)

                if n < num_shapes - 1:
                    painter.begin(self)
                    painter.setFont(QFont('Times', 35))
                    painter.drawText(QRect(x + size, y, size, size), Qt.AlignLeft | Qt.AlignCenter, operation)
                    painter.end()

    def draw_legend(self, shape_dict: typing.List[Shape]):
        window_size = self.get_size()
        size = int(window_size[0] / (len(shape_dict) * 2 + 2))

        for n, shape in enumerate(shape_dict):
            x = int(size * (1 + n * 2))
            y = int(window_size[1] / 4 * 3)
            painter = shape.draw(window=self, position=(x, y), size=size)

            painter.begin(self)
            painter.drawText(QRect(x, y + size, size, size), Qt.AlignLeft | Qt.AlignCenter, f"{shape.data}")
            painter.end()

    ################################################################################
    # Window Geometry ##############################################################
    ################################################################################
    def get_size(self) -> typing.Tuple[int, int]:
        return self.geometry().width(), self.geometry().height()

    def get_position(self) -> typing.Tuple[int, int]:
        return self.geometry().x(), self.geometry().y()
Esempio n. 28
0
from exercise import Exercise
from student import Student
from instructor import Instructor
from cohort import Cohort

# creating exercises
journal = Exercise("Daily Journal", "JavaScript")
nutshell = Exercise("Nutshell", "JavaScript")
cash_coins = Exercise("Cash to Coins", "Python")
kennel = Exercise("Kennel", "React")

# creating Cohorts
C36 = Cohort("C36")
E9 = Cohort("E9")
C37 = Cohort("C37")

# creating students
John = Student("John", "Long", "John Long", C36.name)
Holden = Student("Holden", "Parker", "Holden Parker", C37.name)
Anonymous = Student("Mister", "Anonymous", "This Anon Works", E9.name)
Jeremiah = Student("Jeremiah", "Bell", "Jeremiah Bell", C36.name)

#creating instructors
Joe = Instructor("Joe", "Shepherd", "Joe Shepherd", "Making Python Fun!", C36.name)
Brenda = Instructor("Brenda", "Long", "Brenda Long", "Dancing to funny videos", E9.name)
Steve = Instructor("Steve", "Brownlee", "Steve Brownlee", "Blogging", C37.name)

C36.add_instructor(Joe)
C37.add_instructor(Steve)
E9.add_instructor(Brenda)
Esempio n. 29
0
zordon = Instructor("Zordon", "Redacted", "itsMorphinTime1", "turning children to solders")
alpha5 = Instructor("Alpha5", "Robot", "betterThenZordon", "caretaker")
rita = Instructor("Rita", "Repulsa", "moon4thewin", "making people bigger")

ninety_three = Cohort("Cohort 93")
ninety_three.add_students(billy)
ninety_three.add_students(kim)
ninety_three.add_instructors(zordon)
ninety_four = Cohort("Cohort 94")
ninety_four.add_students(tommy)
ninety_four.add_students(jason)
ninety_four.add_instructors(alpha5)
ninety_five = Cohort("Cohort 95")
ninety_five.add_students(zack)
ninety_five.add_students(trini)
ninety_five.add_instructors(rita)

puddy_buddy = Exercise("Puddy Buddy", "JavaScript")
morphin_time = Exercise("Morphin Time", "HTML/CSS")
calling_zords = Exercise("Call your Zords instructions", "JSON server")
megazord_formation = Exercise("Form the Megazord", "Python")


zordon.assign_exercise(puddy_buddy, ninety_three)
zordon.assign_exercise(megazord_formation, ninety_three)
alpha5.assign_exercise(morphin_time, ninety_four)
alpha5.assign_exercise(calling_zords, ninety_four)
rita.assign_exercise(puddy_buddy, ninety_five)
rita.assign_exercise(morphin_time, ninety_five)

print(tommy.last_name)
Esempio n. 30
0
 def test(self):
     Exercise.test(self)
     print("Cardio")
     print(self.type)
Esempio n. 31
0
from student import Student
from cohort import Cohort
from instructor import Instructor
from exercise import Exercise

bank_heist = Exercise("Bank Heist", "CSharp")
martins_aquarium = Exercise("Martin's Aquarium", "JavaScript")
bangazon = Exercise("Bangazon", "Python")
kennels = Exercise("Kennels", "React")

cohort_36 = Cohort("Day Cohort 36")
cohort_37 = Cohort("Day Cohort 37")
cohort_39 = Cohort("Day Cohort 39")

holden = Student()
holden.first_name = "Holden"
holden.last_name = "Parker"
holden.slack_handle = "@holdenp"
holden.cohort = cohort_37
daniel = Student()
daniel.first_name = "Daniel"
daniel.last_name = "Fuqua"
daniel.slack_handle = "@danielf"
daniel.cohort = cohort_39
trey = Student()
trey.first_name = "Trey"
trey.last_name = "Suiter"
trey.slack_handle = "@treys"
trey.cohort = cohort_36
willy = Student()
willy.first_name = "Willy"
Esempio n. 32
0
from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student

#Create 4 Exercises
student_exercises = Exercise("Student Exercises", "Python")
react_nutshell = Exercise("React Nutshell", "React")
celeb_tribute = Exercise("Celebrity Tribute", "HTML")
petting_zoo = Exercise("Critters and Croquettes", "Python")

#Create 3 Cohorts
c40 = Cohort("Cohort 40")
c50 = Cohort("Cohort 50")
c9001 = Cohort("Cohort 9001")

#Create 4 students
eli_lavoie = Student("Eli", "Lavoie", "elijah-lavoie", "Cohort 40")
ryuji = Student("Ryuji", "Sakamoto", "for-realsies", "Cohort 40")
samo = Student("Sam", "Thomas", "sam-tha-wize", "Cohort 50")
goku = Student("Son", "Goku", "over9k", "Cohort 9001")

#Assign students to cohorts
c40.students.append(eli_lavoie)
c40.students.append(ryuji)
c50.students.append(samo)
c9001.students.append(goku)

#Create 3 instructors
igor = Instructor("Igor", "???", "velvetroom", "Cohort 40", "rehabilitation")
bobby = Instructor("Robert", "Pierson", "warped-thinker", "Cohort 50", "good music")
Esempio n. 33
0
from student import Student
from exercise import Exercise
from cohort import Cohort
from instructor import Instructor

#create exercises
exercise1 = Exercise("do something", "python")
exercise2 = Exercise("do anything", "python")
exercise3 = Exercise("make something", "python")
exercise4 = Exercise("make anything", "python")

#create cohorts
cohort36 = Cohort("Cohort 36")
cohort35 = Cohort("Cohort 35")
cohort37 = Cohort("Cohort 37")

#create students
ryan1 = Student("Ryan", "Cunningham", "rc1")
ryan2 = Student("Ryan", "Bishop", "rb1")
ryan3 = Student("Ryan", "Crawley", "rc2")
sullivan = Student("Sully", "Pierce", "sp1")

#assign students
cohort36.add_student(ryan1)
cohort36.add_student(ryan2)
cohort36.add_student(ryan3)
cohort36.add_student(sullivan)

#create instructors
joe = Instructor("Joe", "Shepherd", "js1", "funny")
jisie = Instructor("Jisie", "David", "jd1", "good at instructing")
Esempio n. 34
0
from cohort import Cohort
from exercise import Exercise
from instructor import Instructor
from student import Student

exercise1 = Exercise('Hello World JS', 'Javascript')
exercise2 = Exercise('Hello World RoR', 'Ruby on Rails')
exercise3 = Exercise('Hello World C', 'C#')
exercise4 = Exercise('Hello World J', 'Java')

cohort32 = Cohort('Day 32')
cohort9 = Cohort('Evening 9')
cohort33 = Cohort('Day 33')

Jim = Student('Jim', 'Bloom', 'JimBloom')
John = Student('John', 'Johner', 'Johnnnyyy')
Janger = Student('Jang', 'Er', 'JangerMan')
James = Student('James', 'Smith', 'Fauhs')

cohort32.add_student(Jim)
cohort33.add_student(John)
cohort9.add_student(Janger)
cohort33.add_student(James)

Sally = Instructor('Sally', 'Flemming', 'SalFlem', 'Farting')
Larry = Instructor('Larry', 'Yrral', 'Larrrr', 'Fencing')
Lu = Instructor('Lu', 'LJ', 'Plre', 'Swimming')

cohort32.add_instructor(Sally)
cohort33.add_instructor(Larry)
cohort9.add_instructor(Lu)
Esempio n. 35
0
 def test(self):
     Exercise.test(self)
     print("Exercise Class")
     print(self.instructor)
     print(self.type)
Esempio n. 36
0
    def __init__(self,duration=10, bodyGroup='Total Body', instructor='Unknown', classType='Spin Class'):

        Exercise.__init__(self, duration, bodyGroup)
        self.instructor = instructor
        self.type = classType
Esempio n. 37
0
from student import Student
from cohort import Cohort
from instructor import Instructor
from exercise import Exercise

# Create 4 exercises or more
daily_journal_one = Exercise("Daily Journal", "CSS")
chicken_monkey_js = Exercise("chickenMonkey", "JavaScript")
city_planner = Exercise("City Planner", "Python")
these_area_a_few_of_my_favorite_things = Exercise("These are a few of my favorite things", "JavaScript")


# Create 3 cohorts
c36 = Cohort("Day Cohort 36")
c37 = Cohort("Day Cohort 37")
c38 = Cohort("Day Cohort 38") 

# Create 4, or more, students and assign them to one of the cohorts.
bito = Student("Bito", "Mann")
erin = Student("Erin", "Polley")
jack = Student("Jack", "Parsons")
matt = Student("Matt", "Blagg")

c36.students.extend([bito, jack, matt])

# Create 3, or more, instructors and assign them to one of the cohorts.
andy = Instructor("Andy", "Collins")
bryan = Instructor("Bryan", "Nilson")
jisie = Instructor("Jisie", "David")
 def __init__(self, uicurses=None, dic_data=None):
     self.required = ["BPM", "duration"]
     Exercise.__init__(self, uicurses, dic_data)
Esempio n. 39
0
import csv
import random
from student import Student
from instructor import Instructor
from cohort import Cohort
from exercise import Exercise

exercises = [
    Exercise("Advanced Divs", "HTML"),
    Exercise("Setting the Lists: The Python Dictionary", "Python"),
    Exercise("Getting a Date()", "Javascript"),
    Exercise("Props to the Component", "Javascript"),
    Exercise("Snake Case for Dummies", "Python"),
    Exercise("Varied Variables", "Javascript"),
    Exercise("Apple Pie vs. Apple.py", "Python"),
    Exercise("Pip Pip Hooray", "Python"),
    Exercise("Oh No What Have I Done", "Javascript"),
    Exercise("Making Ugly Less Ugly", "CSS"),
    Exercise("Imports/Exports: Tariffs Explained", "C#"),
    Exercise("Tuplepocalypse", "Python"),
    Exercise("Stop Creating Data", "Python"),
    Exercise("Mocking Students", "C#"),
    Exercise("Comprehending Comprehensions", "Python"),
]


def import_people(cohort, role):
    people = []

    with open(f"data/c{cohort}_{role}.csv") as csv_file:
        csv_reader = csv.reader(csv_file, delimiter=",")