示例#1
0
class RegisterWindow(TKUtils.Window()):
    def __init__(self, commands):
        super().__init__()

        self.commands = commands

        self.form = None

        self.title('Cadastrar Atividade')
        self.geometry('400x320')
        self.resizable(0, 0)

        self._create_form()

    def _create_form(self):
        commands = {}
        commands['submit'] = self.commands['submit_form']
        commands['cancel'] = self.commands['cancel_form']

        self.form = Form(master=self, commands=commands)

    def get_form(self):
        fields = {}

        fields['desc'] = self.form.desc_field['input'].get()
        fields['title'] = self.form.title_field['input'].get()

        return fields
示例#2
0
class ErrorWindow(TKUtils.Window()):
    def __init__(self, error):
        super().__init__()

        self.title('Janela de Erro')
        self.geometry(f'{len(error) * 16}x140')
        self.resizable(0, 0)

        self.error_msg = error

        self.container = None
        self.error_label = None
        self.confirm_button = None

        self._create_container()

    def _create_container(self):
        cnf = {}
        cnf['bd'] = 10

        self.container = TKUtils.get_container(master=self, cnf=cnf)

        self._create_error_label()
        self._create_confirm_button()

    def _create_error_label(self):
        cnf, pack = {}, {}

        cnf['text'] = self.error_msg
        cnf['fg'] = 'red'
        cnf['font'] = ('arial', 16, 'bold')

        pack['pady'] = 10

        self.error_label = TKUtils.get_label(master=self, cnf=cnf, pack=pack)

    def _create_confirm_button(self):
        cnf, pack = {}, {}

        cnf['text'] = 'OK'
        cnf['bg'] = 'green'
        cnf['command'] = self.destroy

        pack['pady'] = 25
        pack['side'] = 'bottom'

        self.confirm_button = TKUtils.get_button(master=self,
                                                 cnf=cnf,
                                                 pack=pack)
示例#3
0
class RaffleWindow(TKUtils.Window()):
    def __init__(self, student, activity):
        super().__init__()

        self.title('Grande Felizardo(a)')
        self.geometry(f'{len(student) * 18 + 100}x100')
        self.resizable(0, 0)

        self.student_name = student
        self.activity_title = activity

        self.container = None
        self.student_label = None
        self.activity_label = None
        self.confirm_button = None

        self._create_container()
        self._create_student_label()
        self._create_activity_label()

    def _create_container(self):
        self.container = TKUtils.get_container(master=self)

    def _create_student_label(self):
        cnf, pack = {}, {}

        cnf['text'] = f'Aluno: {self.student_name}'
        cnf['bd'] = 4
        cnf['fg'] = 'red'
        cnf['font'] = ('arial', 16, 'bold')

        self.student_label =\
            TKUtils.get_label(master=self.container, cnf=cnf, pack=pack)

    def _create_activity_label(self):
        cnf, pack = {}, {}

        cnf['text'] = f'Atividade: {self.activity_title}'
        cnf['bd'] = 4
        cnf['fg'] = 'blue'
        cnf['font'] = ('arial', 16, 'bold')

        self.activity_label =\
            TKUtils.get_label(master=self.container, cnf=cnf, pack=pack)
示例#4
0
class View(TKUtils.Window()):
    def __init__(self, controller):
        super().__init__()

        self.__controller = controller

        self.title('StuKi®')
        self.geometry('960x480')
        self.resizable(0, 0)

        TKUtils.set_icon(master=self, icon_name='icon')

        self.group = None
        self.navbar = None
        self.student = None
        self.activity = None

        self.error_window = None
        self.raffle_window = None

        self.active_container = ''

    def start(self):
        self._create_navbar()
        self.create_student_container()

        self.mainloop()

    def _create_navbar(self):
        commands = {}

        commands['group'] = self.__controller.navbar.group_button
        commands['student'] = self.__controller.navbar.student_button
        commands['activity'] = self.__controller.navbar.activity_button

        self.navbar = Navbar(master=self, commands=commands)

    def create_student_container(self):
        commands = {}

        commands['raffle'] = self.__controller.raffle_button

        controller = self.__controller.student
        self.student =\
            Student(master=self, controller=controller, commands=commands)

        self.active_container = 'student'

        self.__controller.student.mounted()

    def create_activity_container(self):
        commands = {}

        commands['raffle'] = self.__controller.raffle_button

        controller = self.__controller.activity
        self.activity =\
            Activity(master=self, controller=controller, commands=commands)

        self.active_container = 'activity'

        self.__controller.activity.mounted()

    def create_group_container(self):
        self.group = Group(master=self)
        self.active_container = 'group'

    def destroy_active_container(self):
        if self.active_container == 'student':
            self.student.destroy()
        elif self.active_container == 'activity':
            self.activity.destroy()
        elif self.active_container == 'group':
            self.group.destroy()

        self.active_container = ''

    def create_error_window(self, error):
        self.error_window = ErrorWindow(error=error)

    def create_raffle_window(self, student, activity):
        self.raffle_window = RaffleWindow(student=student, activity=activity)