class _NoUsersFrame(tk.Frame):
    def __init__(self, controller, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
        self.controller = controller

        tk.Label(self,
                 text="NO HAY ALUMNOS",
                 font=tkFont.Font(family='Arial',
                                  size=30)).place(anchor=tk.CENTER,
                                                  relx=0.5,
                                                  rely=0.5)

        self.config(bg=config.BG)
        self.add_userbtn()

    def add_userbtn(self):
        text = TextProperties(fill="white",
                              text="+",
                              anchor="c",
                              font="Consolas 20")

        self.add_user = CircularButton(
            self, 28, config.COLOR, config.COLOR,
            lambda: self.controller.show("create_user"), text)

        self.add_user.place(anchor=tk.NW, x=286, y=HEIGHT - 56 - 81)
Esempio n. 2
0
class _NoFoldersFrame(tk.Frame):
    def __init__(self, controller, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
        self.controller = controller

        tk.Label(
            self,
            text="NO HAY CARPETAS",
            font=tkFont.Font(family='Arial', size=26)
        ).place(
            anchor=tk.CENTER,
            relx=0.5, rely=0.5
        )

        self.config(bg=config.BG)
        self.add_userbtn()

    def CreateFolder(self):
        self.wigdet = folder_widget(self)
        self.wigdet.set_text("Carpeta")
        self.wigdet.place(x=120, y=160)
        self.create_button = tk.Button(
            anchor=tk.CENTER,
            bg=config.BG,
            text="Crear",
            font=("Arial", 12),
            command=self.hide_widget

        )

        self.create_button.place(
            x=150, y=290
        )

    def hide_widget(self):
        temp = self.wigdet.get_text()
        self.wigdet.place_forget()
        self.create_button.place_forget()
        dic = {"title": temp, "notes": []}
        add_folder(dic)
        self.master.update()

    def add_userbtn(self):
        text = TextProperties(
            fill="black",
            text="+",
            anchor="c",
            font="Consolas 20"
        )

        self.add_user = CircularButton(
            self, 28,
            config.COLOR, config.COLOR,
            self.CreateFolder,
            text)

        self.add_user.place(
            anchor=tk.NW,
            x=286, y=HEIGHT-56-81
        )
class _BodyFrame(tk.Frame):
    def __init__(self, controller, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
        self.controller = controller

        self.config(bg=config.BG)
        self.add_userbtn()

        self.title_2 = tk.Label(self,
                                fg=config.COLOR,
                                bg=config.BG,
                                text="Personas",
                                font=("Arial", 14))

        self.title_2.place(anchor=tk.NW, x=18, y=14)

        self.user_list = tk.Frame(self, width=WIDTH, height=491, bg=config.BG)
        self.user_list.place(anchor=tk.NW, x=0, y=45)

    def update(self):
        for child in self.user_list.winfo_children():
            child.destroy()
        py = 0
        for user in data["users"]:
            card = UserInfoFrame(self.user_list, self.controller, py, user)
            card.place(anchor=tk.NW, x=0, y=py)
            py += 72

        self.add_userbtn()

    def add_userbtn(self):
        text = TextProperties(fill="white",
                              text="+",
                              anchor="c",
                              font="Consolas 20")

        self.add_user = CircularButton(
            self, 28, config.COLOR, config.COLOR,
            lambda: self.controller.show("create_user"), text)

        self.add_user.place(anchor=tk.NW, x=286, y=HEIGHT - 56 - 81)
Esempio n. 4
0
class NoteInfoFrame(tk.Frame):
    def __init__(self, master, controller, py, idx, data, *args, **kwargs):
        tk.Frame.__init__(self, master, width=360, height=72, *args, *kwargs)
        self.data = data[idx]
        self.controller = controller

        abc = tk.Label(master,
                       text=f"{self.data['title']}",
                       font=FONT16(),
                       bg=BG,
                       fg=FONT_COLOR)
        abc.place(anchor=tk.NW, x=81, y=16 + py)
        lbl = tk.Label(master,
                       text=f"{self.data['date']}",
                       font=FONT12(),
                       bg=BG,
                       fg=FONT_COLOR)
        lbl.place(anchor=tk.NW, x=81, y=38 + py)
        self.config(bg=BG)

        def delete_note():
            print(type(data))
            del data[idx]
            db.save_data()
            self.controller.show("notes_frame", no_update=True)

        text = TextProperties(fill="white",
                              text="x",
                              anchor="c",
                              font="Consolas 20")
        self.delete = CircularButton(self, 22, BAD_COLOR, BAD_COLOR,
                                     delete_note, text)
        self.delete.place(anchor=tk.NW, x=WIDTH - 48, y=12)

        lbl.bind("<ButtonRelease-1>", self._on_release)
        abc.bind("<ButtonRelease-1>", self._on_release)
        self.bind("<ButtonRelease-1>", self._on_release)

    def _on_release(self, e):
        self.controller.show("note_frame", self.data)
Esempio n. 5
0
class FolderInfoFrame(tk.Frame):
    def __init__(self, master, controller, py, idx, data, *args, **kwargs):
        tk.Frame.__init__(self, master, width=360, height=72, *args, *kwargs)
        self.icon = ImageTk.PhotoImage(
            Image.open("folder_icon.png").resize((44, 48)))
        self.data = data
        self.dummy = tk.Label(master, image=self.icon).place(anchor=tk.NW,
                                                             x=16,
                                                             y=12 + py)

        self.controller = controller

        abc = tk.Label(master,
                       text=data.get("title"),
                       font=FONT16(),
                       bg=BG,
                       fg=FONT_COLOR)
        abc.place(anchor=tk.NW, x=81, y=20 + py)

        def delete_folder():
            del db.data["note"][idx]
            db.save_data()
            controller.show("folder_list")

        text = TextProperties(fill="white",
                              text="x",
                              anchor="c",
                              font="Consolas 20")
        self.delete = CircularButton(self, 22, BAD_COLOR, BAD_COLOR,
                                     delete_folder, text)
        self.delete.place(anchor=tk.NW, x=WIDTH - 48, y=12)

        self.config(bg=BG)

        abc.bind("<ButtonRelease-1>", self._on_release)
        self.bind("<ButtonRelease-1>", self._on_release)

    def _on_release(self, e):
        self.controller.show("notes_frame", self.data)
Esempio n. 6
0
class _BodyFrame(tk.Frame):
    def __init__(self, controller, *args, **kwargs):
        tk.Frame.__init__(self, *args, **kwargs)
        self.controller = controller

        self.config(bg=config.BG)
        self.add_userbtn()

        self.title_2 = tk.Label(
            self,
            fg=config.FONT_COLOR, bg=config.BG,
            text="Personas",
            font=("Arial", 14))

        self.title_2.place(
            anchor=tk.NW,
            x=18, y=14
        )

        self.user_list = tk.Frame(self, width=WIDTH, height=491, bg=config.BG)
        self.user_list.place(
            anchor=tk.NW,
            x=0, y=45
        )

    def update(self):
        for child in self.user_list.winfo_children():
            child.destroy()
        py = 0
        for idx, folder in enumerate(data["note"]):
            card = FolderInfoFrame(self.user_list, self.controller, py, idx, folder)
            card.place(
                anchor=tk.NW,
                x=0, y=py
            )
            py += 72

        self.add_userbtn()

    def CreateFolder(self):
        self.wigdet = folder_widget(self)
        self.wigdet.set_text("Carpeta")
        self.wigdet.place(x=120, y=160)
        self.create_button = tk.Button(
            anchor=tk.CENTER,
            bg=config.BG,
            text="Crear",
            font=("Arial", 12),
            command=self.hide_widget

        )

        self.create_button.place(
            x=150, y=290
        )

    def hide_widget(self):
        temp = self.wigdet.get_text()
        self.wigdet.place_forget()
        self.create_button.place_forget()
        dic = {"title": temp, "notes": []}
        add_folder(dic)
        self.master.update()

    def add_userbtn(self):
        text = TextProperties(
            fill="black",
            text="+",
            anchor="c",
            font="Consolas 20"
        )

        self.add_user = CircularButton(
            self, 28,
            config.COLOR, config.COLOR,
            self.CreateFolder,
            text)

        self.add_user.place(
            anchor=tk.NW,
            x=286, y=HEIGHT-56-81
        )