def return_to_course(self) -> None: """returns to the course screen""" def yes_func(): self.clear_fields() utils.switch_screen(self, 'course_view_screen', 'right') if self._assignment is not None: str_pts_rec = '' if self._assignment.pts_rec is None else str( self._assignment.pts_rec) if self._name != self._assignment.name or self.ids.checkbox_graded.active != self._assignment.is_graded( ) or self._pts_rec != str_pts_rec or self._pts_total != str( self._assignment.pts_total ) or self.ids.cat_spinner.text != self._course.get_cateogry_from_assign( self._assignment).name: utils.yesno_popup( 'Are you sure you want to go back? This assignment will not be updated.', yes_func) else: yes_func() elif self._name == '' and self._pts_rec == '' and self._pts_total == '' and self.ids.checkbox_graded.active: utils.switch_screen(self, 'course_view_screen', 'right') else: utils.yesno_popup( 'Are you sure you want to go back? This assignment will not be added.', yes_func)
def return_to_course(self) -> None: """returns to the course screen""" def yes_func(): self.clear_fields() utils.switch_screen(self, 'course_view_screen', 'right') if self._name == '': utils.switch_screen(self, 'course_view_screen', 'right') else: utils.yesno_popup( 'Are you sure you want to go back? This category will not be added to the course.', yes_func)
def return_to_course(self) -> None: """switches back to the course screen""" def yes_func(): self._course.categories = self._org_categories utils.SCREENS['course_view_screen'].init(self._course) utils.SCREENS['schedule_screen']._schedule.save() utils.switch_screen(self, 'course_view_screen', 'right') self.clear_fields() utils.yesno_popup( 'Are you sure you want to go back? Any changes made will not be saved.', yes_func)
def delete_schedule(self) -> None: """delete the schedule from the schedule list after confirming deletion""" def yes_func(): try: schedule_loader.delete_schedule(self._schedule.name) except utils.ScheduleDeleteError as e: utils.default_popup(f'{e.message}\nTry reloading the schedule and then deleting it.') else: utils.SCREENS['home_screen'].remove_schedule(self._schedule.name) self._schedule = None utils.switch_screen(self, 'home_screen', 'right') utils.yesno_popup(f'Are you sure you want to delete "{self._schedule.name}"?', yes_func)
def del_button_func(*args): def yes_func(): self._course.del_category(c) print('removing', c.name) utils.SCREENS[ 'schedule_screen']._schedule.projected_gpa = utils.SCREENS[ 'schedule_screen']._schedule._calc_projected_gpa() utils.SCREENS[ 'schedule_screen']._schedule.projected_gpa = utils.SCREENS[ 'schedule_screen']._schedule.save() self.ids.cat_edit_box.remove_widget(fl) self.update_cat_box_height() utils.yesno_popup( f'Are you sure you want to delete "{c.name}"? Any assignments left in the category will also be removed.', yes_func)
def back(self) -> None: if (self._schedule is not None and self._name == self._schedule.name and self._gpa == str(self._schedule.current_gpa) and self._units == str(self._schedule.current_units)): self._clear_text_fields() utils.switch_screen(self, 'schedule_screen', 'right') return elif (self._name == '' and self._gpa == '' and self._units == ''): utils.switch_screen( self, 'home_screen', 'right') # if no changes have been made, then slide back else: def yes_func(): self._clear_text_fields() utils.switch_screen( self, 'home_screen', 'right' ) # if changes have been made make sure they meant to go back utils.yesno_popup( 'Are you sure you want to go back? This schedule will not be saved.', yes_func)