def __init__(self): super().__init__() self._grade_setting = Setting.get(GradeSetting) self._builder = GradeCountDataBuilder() self.n_row = self._grade_setting.length() self._grades = self._grade_setting.get_all_grades()
def _setup_editors(self): directory = Setting.get(FileSetting).content_path self.path_manager.directory = directory self._repo.set_filepath(self.path_manager.filepath) self.sector_editor.load_sectors(self._repo) self.editor.load_problems(self._repo) self.editor.change_to_state(EditingProblemsEditor())
def _setup_dependencies(self, dependency: DependencyService): self._dependency = dependency self._path_manager = self._dependency.get(ContentsPathManager) self._IO = self._dependency.get(OldProblemIO) self._viewer = self._dependency.get(OldProblemViewer) directory = self._path_manager.history_dir self._IO.set_dir(directory) self._viewer.set_dir_IO(self._IO) self._colour_setting = Setting.get(ColourSetting)
def _make_new_problem(self, row: int, col: int): # return a new problem with new auto increment id _id = self._editor.next_id _grade = Setting.get(GradeSetting).get_grade(row) _hold = str(_grade).split(' ')[0] _sector = self._dependency.get(SectorEditor).get_sector(col) return Problem(_id, RIC(1, 1, 1), _grade, _hold, _sector, (), '', date.today(), 'on')
def set_new_directory(self, directory: str = '') -> None: if directory == '': return if directory != Setting.get(FileSetting).content_path: Setting.update(FileSetting, directory)
def __init__(self, dependency: DependencyService): self._setup_dependencies(dependency) data = Setting.get(FileSetting).content_path self.model = BottomStationModel(dynamic_data=data) # load model self.view = BottomStation(self, self.model) # load view self._connect_other()
def __init__(self, sector_editor: SectorEditor): super().__init__() self._grade_setting = Setting.get(GradeSetting) self._sector_setting = sector_editor self._builder = ProblemCellDataBuilder(sector_editor)
def __init__(self): super().__init__() self.static_data = InfoCellData.default() self.aim = Setting.get(GradeSetting).get_total_aim() self.counts = 0
def default() -> InfoCellData: setting = Setting.get(ColourSetting) bg_colour = setting.get_bg_colour('default') text_colour = setting.get_text_colour('default') return InfoCellData(bg_colour, text_colour)
def __init__(self): self._setting = Setting.get(ColourSetting)
def default(): colour = Setting.get(ColourSetting).get_bg_colour('default_light') return WorkStaticData(colour)
def __init__(self): super().__init__() self.builder = GradeCellDataBuilder() self.grade_setting = Setting.get(GradeSetting) self.n_row = self.grade_setting.length()
def __init__(self): self._grade_setting = Setting.get(GradeSetting) self._colour_setting = Setting.get(ColourSetting)
def __init__(self): self.grade_setting = Setting.get(GradeSetting)
def __init__(self): self._setting = Setting.get(ColourSetting) self._builder = ProblemListCellDataBuilder()
def _on_file_setting_changed(self, class_type: type) -> None: if class_type == FileSetting: value = Setting.get(FileSetting).content_path if self.model.dynamic_data != value: self.model.dynamic_data = value
def __init__(self, sector_editor: SectorEditor): self.sector_setting = sector_editor self.colour_setting = Setting.get(ColourSetting)
def _setup_dependencies(self, dependency: DependencyService): self._dependency = dependency self._editor = self._dependency.get(ProblemsEditor) self._history = self._dependency.get(ProblemsEditorHistory) self._colour_setting = Setting.get(ColourSetting)
class FilterViewStaticData(NamedTuple): width: int = 276 bg_colour: Colour = Setting.get(ColourSetting).get_bg_colour('default') text_colour: Colour = Setting.get(ColourSetting).get_text_colour('default')
def __init__(self, sector_editor: SectorEditor): self._grade_setting = Setting.get(GradeSetting) self._colour_setting = Setting.get(ColourSetting) self._sector_setting = sector_editor