def frame_family(root): """Frame for the parent and child document items.""" # Configure grid frame = ttk.Frame(root, **kw_f) frame.rowconfigure(0, weight=0) frame.rowconfigure(1, weight=1) frame.rowconfigure(2, weight=0) frame.rowconfigure(3, weight=1) frame.columnconfigure(0, weight=1) # Place widgets widget.Label(frame, text="Linked To:").grid(row=0, column=0, sticky=tk.W, **kw_gp) self.text_parents = widget.noUserInput_init( widget.Text(frame, width=width_text, wrap=tk.WORD)) self.text_parents_hyperlink = utilTkinter.HyperlinkManager( self.text_parents) self.text_parents.grid(row=1, column=0, **kw_gsp) widget.Label(frame, text="Linked From:").grid(row=2, column=0, sticky=tk.W, **kw_gp) self.text_children = widget.noUserInput_init( widget.Text(frame, width=width_text, wrap=tk.WORD)) self.text_children_hyperlink = utilTkinter.HyperlinkManager( self.text_children) self.text_children.grid(row=3, column=0, **kw_gsp) return frame
def frame_document(root): """Frame for current document's outline and items.""" # Configure grid frame = ttk.Frame(root, **kw_f) frame.rowconfigure(0, weight=0) frame.rowconfigure(1, weight=5) frame.rowconfigure(2, weight=0) frame.rowconfigure(3, weight=0) frame.columnconfigure(0, weight=0) frame.columnconfigure(1, weight=0) frame.columnconfigure(2, weight=0) frame.columnconfigure(3, weight=0) frame.columnconfigure(4, weight=1) frame.columnconfigure(5, weight=1) @_log def treeview_outline_treeviewselect(event): """Handle selecting an item in the tree view.""" if self.ignore: return thewidget = event.widget curselection = thewidget.selection() if curselection: uid = curselection[0] self.stringvar_item.set(uid) @_log def treeview_outline_delete(event): # pylint: disable=W0613 """Handle deleting an item in the tree view.""" if self.ignore: return self.remove() # Place widgets widget.Label(frame, text="Outline:").grid(row=0, column=0, columnspan=4, sticky=tk.W, **kw_gp) widget.Label(frame, text="Items:").grid(row=0, column=4, columnspan=2, sticky=tk.W, **kw_gp) c_columnId = ("Id",) self.treeview_outline = widget.TreeView(frame, columns=c_columnId) # pylint: disable=W0201 for col in c_columnId: self.treeview_outline.heading(col, text=col) # Add a Vertical scrollbar to the Treeview Outline treeview_outline_verticalScrollBar = widget.ScrollbarV(frame, command=self.treeview_outline.yview) treeview_outline_verticalScrollBar.grid(row=1, column=0, columnspan=1, **kw_gs) self.treeview_outline.configure(yscrollcommand=treeview_outline_verticalScrollBar.set) self.treeview_outline.bind("<<TreeviewSelect>>", treeview_outline_treeviewselect) self.treeview_outline.bind("<Delete>", treeview_outline_delete) self.treeview_outline.grid(row=1, column=1, columnspan=3, **kw_gsp) self.text_items = widget.noUserInput_init(widget.Text(frame, width=width_text, wrap=tk.WORD)) self.text_items.grid(row=1, column=4, columnspan=2, **kw_gsp) self.text_items_hyperlink = utilTkinter.HyperlinkManager(self.text_items) # pylint: disable=W0201 widget.Button(frame, text="<", width=0, command=self.left).grid(row=2, column=0, sticky=tk.EW, padx=(2, 0)) widget.Button(frame, text="v", width=0, command=self.down).grid(row=2, column=1, sticky=tk.EW) widget.Button(frame, text="^", width=0, command=self.up).grid(row=2, column=2, sticky=tk.EW) widget.Button(frame, text=">", width=0, command=self.right).grid(row=2, column=3, sticky=tk.EW, padx=(0, 2)) widget.Button(frame, text="Add Item", command=self.add).grid(row=2, column=4, sticky=tk.W, **kw_gp) widget.Button(frame, text="Remove Selected Item", command=self.remove).grid(row=2, column=5, sticky=tk.E, **kw_gp) return frame