예제 #1
0
    def __init__(self, parent, controller):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, controller)

        self._add_labels()
        self._add_buttons()
        tkinter_common.center_window(self)
    def __init__(self, parent, controller):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, controller)

        self._init_list()

        tkinter_common.center_window(self)
예제 #3
0
    def __init__(self, parent, names):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, None)

        self._initialize(names)
        exit_button = tkinter.Button(self, text='OK', command=self.destroy)
        exit_button.grid(row=1, column=0, sticky='news')

        tkinter_common.center_window(self)
예제 #4
0
    def __init__(self, parent, data, action_name, callback, start_row=0):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, None)

        def new_callback(data):
            callback(data)
            self.destroy()

        DataForm(self, data, action_name, new_callback, start_row)

        tkinter_common.center_window(self)
예제 #5
0
    def __init__(self, parent, controller, data, action_name, callback,
                 only_present=True, show_list=None):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, controller)

        self._data = data
        self._callback = callback
        self._action_name = action_name
        self._only_present = only_present
        self._show_list = show_list
        self._init_list()

        tkinter_common.center_window(self)
예제 #6
0
    def __init__(self, parent, data, term=False):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, None)

        ok_button = tkinter.Button(self, text='OK', command=(self.terminate if term else self.destroy))
        ok_button.grid(row=1, column=0, sticky='news')

        s = ttk.Style()
        s.configure('MyStyle.Treeview', rowheight=30)
        tree = ttk.Treeview(self, selectmode='none', columns=('Value',), show='tree', height=20, style='MyStyle.Treeview')
        fit(tree, data)
        tree.column('#0', width=width[0] * 20 + 10)
        tree.column('#1', width=width[1] * 20)
        tree.grid(row=0, column=0, sticky='news')

        tkinter_common.center_window(self)
예제 #7
0
    def __init__(self, parent, controller):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, controller)

        def do_login(data):
            if not self.controller.do_login(data['User name'],
                                            data['Password']):
                tkinter.messagebox.showerror('Error',
                                             'Invalid user name or password')
                self.terminate()
                return
            MainMenu(self.parent, self.controller)
            self.destroy()

        data = (('User name', 'str'), ('Password', 'hidden_str'))
        DataForm(self, data, 'Login', do_login, term=True)

        tkinter_common.center_window(self)
예제 #8
0
    def __init__(self, parent, controller):
        super().__init__(parent)
        tkinter_common.default_init(self, parent, controller)

        def do_register_patient(data):
            try:
                self.controller.do_register_patient(data)
            except Exception as e:
                tkinter.messagebox.showerror('Error', str(e))
            else:
                tkinter.messagebox.showinfo('Info', 'Patient successfully registered')
            self.destroy()

        data = (
            ('Name', 'str'),
            ('Birth date', 'date'),
            ('Address', 'str'),
            ('Phone number', 'phone'),
            ('Blood group', 'blood'),
            ('Other', 'astr')
        )
        DataForm(self, data, 'Register Patient', do_register_patient)

        tkinter_common.center_window(self)