| 1993 | |
| 1994 | |
| 1995 | class ViewTree(tkinter.Frame): |
| 1996 | def __init__(self, parent): |
| 1997 | tkinter.Frame.__init__(self, parent) |
| 1998 | if sys.version_info > (3, 0): |
| 1999 | self.viewTree = tkinter.ttk.Treeview(self, columns=['T'], height=35) |
| 2000 | else: |
| 2001 | self.viewTree = ttk.Treeview(self, columns=['T'], height=35) |
| 2002 | self.viewTree.column(0, width=20) |
| 2003 | self.viewTree.heading('#0', None, text='View', anchor=tkinter.W) |
| 2004 | self.viewTree.heading(0, None, text='T', anchor=tkinter.W) |
| 2005 | if sys.version_info > (3, 0): |
| 2006 | self.scrollbar = tkinter.ttk.Scrollbar(self, orient=tkinter.HORIZONTAL, command=self.__xscroll) |
| 2007 | else: |
| 2008 | self.scrollbar = ttk.Scrollbar(self, orient=tkinter.HORIZONTAL, command=self.__xscroll) |
| 2009 | self.viewTree.grid(row=1, rowspan=1, column=1, sticky=tkinter.N + tkinter.S) |
| 2010 | self.scrollbar.grid(row=2, rowspan=1, column=1, sticky=tkinter.E + tkinter.W) |
| 2011 | self.viewTree.configure(xscrollcommand=self.scrollbar.set) |
| 2012 | |
| 2013 | def __xscroll(self, *args): |
| 2014 | if DEBUG: |
| 2015 | print("__xscroll:", args, file=sys.stderr) |
| 2016 | self.viewTree.xview(*args) |
| 2017 | |
| 2018 | def insert(self, parent, index, iid=None, **kw): |
| 2019 | """Creates a new item and return the item identifier of the newly |
| 2020 | created item. |
| 2021 | |
| 2022 | parent is the item ID of the parent item, or the empty string |
| 2023 | to create a new top-level item. index is an integer, or the value |
| 2024 | end, specifying where in the list of parent's children to insert |
| 2025 | the new item. If index is less than or equal to zero, the new node |
| 2026 | is inserted at the beginning, if index is greater than or equal to |
| 2027 | the current number of children, it is inserted at the end. If iid |
| 2028 | is specified, it is used as the item identifier, iid must not |
| 2029 | already exist in the tree. Otherwise, a new unique identifier |
| 2030 | is generated.""" |
| 2031 | |
| 2032 | return self.viewTree.insert(parent, index, iid, **kw) |
| 2033 | |
| 2034 | def set(self, item, column=None, value=None): |
| 2035 | """With one argument, returns a dictionary of column/value pairs |
| 2036 | for the specified item. With two arguments, returns the current |
| 2037 | value of the specified column. With three arguments, sets the |
| 2038 | value of given column in given item to the specified value.""" |
| 2039 | |
| 2040 | return self.viewTree.set(item, column, value) |
| 2041 | |
| 2042 | def tag_bind(self, tagname, sequence=None, callback=None): |
| 2043 | if DEBUG: |
| 2044 | print('ViewTree.tag_bind(', tagname, ',', sequence, ',', callback, ')', file=sys.stderr) |
| 2045 | return self.viewTree.tag_bind(tagname, sequence, callback) |
| 2046 | |
| 2047 | |
| 2048 | class ViewDetails(tkinter.Frame): |
no outgoing calls
no test coverage detected