def __init__(self, master, catalog, path): tk.Frame.__init__(self, master) self.master = master self.tree = ttk.Treeview(self, columns=('owner', 'size', 'modification time')) ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview) xsb = ttk.Scrollbar(self, orient='horizontal', command=self.tree.xview) self.tree.configure(yscroll=ysb.set, xscroll=xsb.set) self.tree.heading('#0', text='path', anchor='w') self.tree.heading('owner', text='owner', anchor='w') self.tree.heading('size', text='size', anchor='w') self.tree.heading('modification time', text='modification time', anchor='w') self.tree.bind('<<TreeviewOpen>>', self.open_cb) self.tree.grid(row=0, column=0, sticky='nsew') ysb.grid(row=0, column=1, sticky='ns') xsb.grid(row=1, column=0, sticky='ew') self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.grid(sticky='nsew') self._set_context_menu() self.set_connection(catalog, path)
def __init__(self, master, cfg): tk.Frame.__init__(self, master) self.master = master self.cfg = cfg columns = ('catalog type', 'path', 'default connection') self.tree = ttk.Treeview(self, columns=columns, selectmode='browse') ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview) xsb = ttk.Scrollbar(self, orient='horizontal', command=self.tree.xview) self.tree.configure(yscroll=ysb.set, xscroll=xsb.set) self.tree.heading('#0', text='name', anchor='w') self.tree.heading('catalog type', text='catalog type', anchor='w') self.tree.heading('path', text='path', anchor='w') self.tree.heading('default connection', text='default connection', anchor='w') self.tree.grid(row=0, column=0, sticky='nsew') ysb.grid(row=0, column=1, sticky='ns') xsb.grid(row=1, column=0, sticky='ew') butbox = tk.Frame(self) butbox.grid(row=0, column=2, sticky='ns') self.newbut = tk.Button(butbox, text='Add', command=self.add) self.newbut.grid(row=0, column=0, sticky='ew') self.removebut = tk.Button(butbox, text='Remove', command=self.remove, state=tk.DISABLED) self.removebut.grid(row=1, column=0, sticky='ew') self.editbut = tk.Button(butbox, text='Edit', command=self.edit, state=tk.DISABLED) self.editbut.grid(row=2, column=0, sticky='ew') self.dupbut = tk.Button(butbox, text='Duplicate', command=self.duplicate, state=tk.DISABLED) self.dupbut.grid(row=3, column=0, sticky='ew') self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.grid(sticky='nsew') self.tree.bind('<<TreeviewSelect>>', self.selchanged) self.insert_connections()
def __init__(self, master): tk.Frame.__init__(self, master) self.master = master self.root_path = '' self.catalog = None self.path = None self.columns = [ 'user', 'size', 'nreplicas', 'mtime', ] self.navigation_bar = navbar.NavigationBar(self, self.root_path, self.set_path) self.navigation_bar.refresh_but.config(command=self.refresh) self.navigation_bar.grid(row=0, columnspan=2, sticky='ew') self.tree = ttk.Treeview(self, columns=self.columns) ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview) xsb = ttk.Scrollbar(self, orient='horizontal', command=self.tree.xview) self.tree.configure(yscroll=ysb.set, xscroll=xsb.set) for c in ['#0'] + self.columns: cd = self.columns_def[c] self.tree.heading(c, text=cd.text, anchor=cd.anchor) self.tree.bind('<<TreeviewOpen>>', self.open_cb) self.tree.grid(row=1, column=0, sticky='nsew') ysb.grid(row=1, column=1, sticky='ns') xsb.grid(row=2, column=0, sticky='ew') self.rowconfigure(1, weight=1) self.columnconfigure(0, weight=1) self._set_context_menu()
def __init__(self, dialog, parent, app, player, **kw): ttk.Frame.__init__(self, parent) # self.dialog = dialog self.app = app self.CHAR_H = self.dialog.font_metrics['linespace'] self.CHAR_W = self.dialog.tkfont.measure('M') # self.player = player self.sort_by = 'name' self.tree_items = [] self.tree_tabs = None self.games = {} # tree_itemid: gameid # frame = ttk.Frame(self) frame.pack(fill='both', expand=True, padx=10, pady=10) vsb = ttk.Scrollbar(frame) vsb.grid(row=0, column=1, sticky='ns') self.tree = ttk.Treeview(frame, columns=self.COLUMNS, selectmode='browse') self.tree.grid(row=0, column=0, sticky='nsew') self.tree.config(yscrollcommand=vsb.set) vsb.config(command=self.tree.yview) frame.rowconfigure(0, weight=1) frame.columnconfigure(0, weight=1) hsb = ttk.Scrollbar(frame, orient='horizontal') hsb.grid(row=1, column=0, sticky='ew') self.tree.config(xscrollcommand=hsb.set) hsb.config(command=self.tree.xview) bind(self.tree, '<<TreeviewSelect>>', self.treeviewSelected) # self.formatter = TreeFormatter(self.app, self.tree, self, self.dialog.heading_tkfont, self.CHAR_W, self.CHAR_H) self.createHeader(player) bind(self.tree, '<Map>', self.mapEvent)