Exemplo n.º 1
0
    def __init__(self, parent, controller, current_frame, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.controller = controller

        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)

        sidebar = Sidebar(parent=self, controller=controller)
        sidebar.grid(column=0, row=0, columnspan=1, rowspan=1, sticky="ns")

        content = tk.Frame(self)
        content.grid(column=1, row=0, columnspan=3, rowspan=3, sticky="nesw")
        content.grid_rowconfigure(0, weight=1)
        content.grid_columnconfigure(0, weight=1)

        self.frames = {}
        # this will contain all frames so they will be available
        # to raise
        for F in (
                HomeView,
                LexiconListView,
                CreateReportView,
                CreateLexiconView,
                ReportListView,
                ReportView,
                CorpusListView,
                CreateCorpusView,
        ):
            page_name = F.__name__
            frame = F(parent=content, controller=controller)
            self.frames[page_name] = frame
            frame.grid(row=0, column=0, sticky="nsew")
        current_frame.subscribe(self.update_current_frame)
Exemplo n.º 2
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.configure(bg=theme.background_color)

        self.selected_lexicon = util.Observable(None)
        self.lexicon_names = []

        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(1, weight=1)

        self.listbox = common.Listbox(
            self,
            exportselection=0,
        )
        self.listbox.bind("<<ListboxSelect>>",
                          self.on_select)  # select lexicon

        self.listbox.grid(column=0, row=1, sticky="nesw")

        top_frame = tk.Frame(self)
        top_frame.configure(bg=theme.background_color_accent)
        top_frame.grid(column=0, row=0, sticky="ew")
        top_frame.grid_columnconfigure(0, minsize=100, weight=1)
        top_frame.grid_columnconfigure(1, minsize=100, weight=1)
        top_frame.grid_columnconfigure(2, minsize=100, weight=1)
        top_frame.grid_rowconfigure(0, minsize=100, weight=1)

        self.open_button = common.Button(
            top_frame,
            self.open_lexicon,
            "Edit Selected",
        )
        self.open_button.grid(column=0, row=0)

        create_lexicon_button = common.Button(top_frame, self.create_lexicon,
                                              "New lexicon")
        create_lexicon_button.grid(column=1, row=0)

        self.delete_button = common.Button(
            master=top_frame,
            command=lambda: self.controller.delete_lexicon(
                self.selected_lexicon.get()),
            text="Delete Selected",
        )
        self.delete_button.grid(column=2, row=0)

        scrollbar = tk.Scrollbar(self)
        scrollbar.grid(column=1, row=1, sticky="ns")

        self.listbox.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.listbox.yview)

        self.controller.lexica.subscribe(self.update_listbox)
        self.selected_lexicon.subscribe(self.update_common)
Exemplo n.º 3
0
def main():
    global LARGE_FONT, realpositive, port
    LARGE_FONT = ("Verdana", 12)
    x, y = 648, 520
    #root = tk.Tk()
    root = ThemedTk(theme="adapta")
    realpositive = tk.IntVar()
    port = tk.StringVar()
    global startpage, synthesis, darlington, pageThree, transferFunction
    startpage = tk.Frame(root)
    synthesis = tk.Frame(root)
    darlington = tk.Frame(root)
    pageThree = tk.Frame(root)
    transferFunction = tk.Frame(root)
    for frame in (startpage, synthesis, darlington, pageThree,
                  transferFunction):
        frame.grid(row=0, column=0, sticky='news')
    StartPage()
    Synthesisframe()
    Darlingtonframe()
    PageThreeframe()
    TransferFunctionframe()
    root.update_idletasks()  # Update "requested size" from geometry manager
    a, a0 = str(x), x / 2
    b, b0 = str(y), y / 2
    root.geometry("+%d+%d" % ((root.winfo_screenwidth() / 2) - a0,
                              (root.winfo_screenheight() / 3) - b0))
    root.deiconify()
    root.resizable(width=False, height=False)
    menubar = tk.Menu(root)
    filemenu = tk.Menu(menubar, tearoff=0)
    filemenu.add_command(label="Tutorial", command=toturial)
    filemenu.add_command(label="About", command=About)
    filemenu.add_command(label="Exit", command=root.destroy)
    menubar.add_cascade(label="MENU", menu=filemenu)
    root.config(menu=menubar)
    root.title("LC & RC Filter")
    root.bind('<Escape>', lambda e: root.destroy())
    root.protocol("WM_DELETE_WINDOW", root.iconify)
    raise_frame(startpage)
    root.mainloop()
Exemplo n.º 4
0
    def __init__(self, parent: tk.Frame, controller: "App"):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        self.configure(bg=theme.background_color)

        self.selected_report = util.Observable[Optional[str]](None)
        self.report_names: List[str] = []

        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(1, weight=1)

        self.listbox = common.Listbox(
            self,
            exportselection=0,
        )
        self.listbox.bind("<<ListboxSelect>>", self.on_select)  # select report

        self.listbox.grid(column=0, row=1, sticky="nesw")

        top_frame = tk.Frame(self)
        top_frame.configure(bg=theme.background_color_accent)
        top_frame.grid(column=0, row=0, sticky="ew")
        top_frame.grid_columnconfigure(0, minsize=100, weight=1)
        top_frame.grid_columnconfigure(1, minsize=100, weight=1)
        top_frame.grid_columnconfigure(2, minsize=100, weight=1)
        top_frame.grid_rowconfigure(0, minsize=100, weight=1)

        self.open_button = common.Button(
            top_frame,
            self.open_report,
            "Open Selected",
        )
        self.open_button.grid(column=0, row=0)

        create_report_button = common.Button(top_frame, self.create_report,
                                             "New Report")
        create_report_button.grid(column=1, row=0)

        self.delete_button = common.Button(
            master=top_frame,
            command=self.delete_report,
            text="Delete Selected",
        )
        self.delete_button.grid(column=2, row=0)

        scrollbar = tk.Scrollbar(self)
        scrollbar.grid(column=1, row=1, sticky="ns")

        self.listbox.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.listbox.yview)

        self.controller.reports.subscribe(self.update_listbox)
        self.selected_report.subscribe(self.update_common)