def __init__(self, master=None):
     self._kspelement = None
     Treeview.__init__(self, master)
     self.pack(expand=1, fill='both')
     self['columns'] = self._columns
     self['show'] = 'headings'
     [self.heading(column, text=column) for column in self['columns']]
     self.bind('<Double-1>', self._callback)
Exemple #2
0
    def __init__(self, parent):
        '''
        Constructor
        '''
        Treeview.__init__(self, master=parent)

        self.cellDataObjects = {}

        self._createContextMenus()
        self._createColumns()
        self._bindCommands()
Exemple #3
0
 def __init__(self, parent, headers, data_source):
     Treeview.__init__(self, parent, columns=headers)
     self.parent = parent
     self.data_source = data_source
     self.data_dictionary = data_source.data
     self.headers = headers
     self.__create_headers()
     self.__insert_rows()
     self.selection_set('I001')
     self.current_item = 'I001'
     self.bind("<<TreeviewSelect>>", lambda e: self.on_select_record())
Exemple #4
0
 def __init__(self, master, lables, **kw):
     
     self.serversDict = {}
     self.scheduleList = []
     Treeview.__init__(*(self, master), **kw)
     self._lables = lables
     for i in lables:
         #self.heading(i, text = i)
         self.column(i, width = 150)
     self.column('#0',width = 40)
     #self.heading(0, image = self.checkedImage)
     #i = self.insert('', 'end',values = ('10.100.0.50','read','read','read'),tags = 'unchecked')
     #print(self.heading(column=0))
     #self.set('I001',0,value = self.checkedImage)
     self.bind('<Button 1>', self.checkHandler)
Exemple #5
0
    def __init__(self, master):
        Treeview.__init__(self, master, show='tree', selectmode='none',
                          style='flat.Treeview', padding=4)

        self.font = Font(self, font="TkDefaultFont 9")

        self.tag_configure('class', image='img_c')
        self.tag_configure('def', image='img_f')
        self.tag_configure('_def', image="img_hf")
        self.tag_configure('#', image='img_sep')
        self.tag_configure('cell', image='img_cell')
        self.callback = None
        self.cells = []

        self.bind('<1>', self._on_click)
        self.bind('<<TreeviewSelect>>', self._on_select)
Exemple #6
0
 def __init__(self, master=None, **kw):
     Treeview.__init__(self, master, style='Checkbox.Treeview', **kw)
     # style (make a noticeable disabled style)
     style = Style(self)
     style.map("Checkbox.Treeview",
               fieldbackground=[("disabled", '#E6E6E6')],
               foreground=[("disabled", 'gray40')],
               background=[("disabled", '#E6E6E6')])
     # checkboxes are implemented with pictures
     self.im_checked = PhotoImage(file=IM_CHECKED, master=self)
     self.im_unchecked = PhotoImage(file=IM_UNCHECKED, master=self)
     self.im_tristate = PhotoImage(file=IM_TRISTATE, master=self)
     self.tag_configure("unchecked", image=self.im_unchecked)
     self.tag_configure("tristate", image=self.im_tristate)
     self.tag_configure("checked", image=self.im_checked)
     # check / uncheck boxes on click
     self.bind("<Button-1>", self.box_click, True)
 def __init__(self, controller):
    Treeview.__init__(self, controller)
    
    self.controller = controller
    self.recentFile = controller.recentFile
    self.browseInitialDir = controller.browseInitialDir
    self.maxRecentVideos = controller.maxRecentVideos
    
    self.initLastFile()
    
    self['height'] = 10
    self['selectmode'] = 'browse'
    self['columns'] = ('lastOpen')
    self.column('#0', width=350, anchor='center')
    self.heading('#0', text='File')
    self.column('lastOpen', width=100, anchor='center')
    self.heading('lastOpen', text='Last play')
    
    self.bind("<Double-1>", self.playSelectedVideo)
    self.bind("<ButtonRelease-1>", self.selectVideo)
    def __init__(self, parent, headers, data_source):
        Treeview.__init__(self, parent, columns=headers)
        self.parent = parent
        self['show'] = 'headings'
        vsb = Scrollbar(parent, orient="vertical", command=self.yview)
        vsb.grid(row=5, column=3, sticky="ns")

        self.configure(yscrollcommand=vsb.set)

        self.data_source = data_source
        self.data_dictionary = data_source.data
        self.headers = headers
        self.__create_headers()
        self.__insert_rows()
        self.selection_set('I001')
        self.current_item = 'I001'
        self.bind("<<TreeviewSelect>>", lambda e: self.on_select_record())

        self.data_source.addListener(
            Listener(self, "<<next_record>>", lambda e: self.on_next_record()))
        self.data_source.addListener(
            Listener(self, "<<previous_record>>",
                     lambda e: self.on_previous_record()))
Exemple #9
0
 def __init__(self, master, columns=1, tree=True, headings=True):
     """
     columns: int, or len(columns): Number of columns; default: 1
     iter(columns): Iterator of dict() objects; optional. Elements may
         also be strings, equivalent to the "heading" value. Keys:
             "heading": Optional
             "width": Optional"""
     
     try:
         self.nontree_columns = len(columns)
     except TypeError:
         if isinstance(columns, Iterable):
             columns = tuple(columns)
             self.nontree_columns = len(columns)
         else:
             self.nontree_columns = columns
             columns = cycle((dict(),))
     
     show = list()
     self.tree_shown = tree
     if self.tree_shown:
         show.append("tree")
         self.nontree_columns -= 1
     if headings:
         show.append("headings")
     
     self.nontree_columns = range(self.nontree_columns)
     Treeview.__init__(self, master, show=show,
         columns=tuple(self.nontree_columns))
     
     self.heading_font = nametofont("TkHeadingFont")
     self.heading_space = "\N{EN QUAD}"
     self.space_size = self.heading_font.measure(self.heading_space)
     self.text_font = nametofont("TkTextFont")
     
     self.auto_width = list()
     for (key, value) in zip(self.columns(), columns):
         if isinstance(value, str):
             value = dict(heading=value)
         
         if headings:
             try:
                 heading = value["heading"]
             except LookupError:
                 pass
             else:
                 self.heading(key, text=heading)
         
         try:
             width = value["width"]
         except LookupError:
             auto = True
             
             if headings:
                 text = self.heading(key, option="text")
                 text += self.heading_space
                 width = self.heading_font.measure(text)
         
         else:
             auto = False
             
             try:
                 (width, unit) = width
             except TypeError:
                 unit = self.FIGURE
             width *= self.text_font.measure(unit)
             width += self.space_size
         
         self.auto_width.append(auto)
         width = max(width, self.column(key, option="minwidth"))
         stretch = value.get("stretch", False)
         self.column(key, stretch=stretch, width=width)
     
     self.bind("<End>", self.end)
Exemple #10
0
 def __init__(self, master, columns=1, tree=True, headings=True):
     """
     columns: int, or len(columns): Number of columns; default: 1
     iter(columns): Iterator of dict() objects; optional. Elements may
         also be strings, equivalent to the "heading" value. Keys:
             "heading": Optional
             "width": Optional"""
     
     try:
         self.nontree_columns = len(columns)
     except TypeError:
         if isinstance(columns, Iterable):
             columns = tuple(columns)
             self.nontree_columns = len(columns)
         else:
             self.nontree_columns = columns
             columns = cycle((dict(),))
     
     show = list()
     self.tree_shown = tree
     if self.tree_shown:
         show.append("tree")
         self.nontree_columns -= 1
     if headings:
         show.append("headings")
     
     self.nontree_columns = range(self.nontree_columns)
     Treeview.__init__(self, master, show=show,
         columns=tuple(self.nontree_columns))
     
     self.heading_font = nametofont("TkHeadingFont")
     self.heading_space = "\N{EN QUAD}"
     self.space_size = self.heading_font.measure(self.heading_space)
     self.text_font = nametofont("TkTextFont")
     
     self.auto_width = list()
     for (key, value) in zip(self.columns(), columns):
         if isinstance(value, str):
             value = dict(heading=value)
         
         if headings:
             try:
                 heading = value["heading"]
             except LookupError:
                 pass
             else:
                 self.heading(key, text=heading)
         
         try:
             width = value["width"]
         except LookupError:
             auto = True
             
             if headings:
                 text = self.heading(key, option="text")
                 text += self.heading_space
                 width = self.heading_font.measure(text)
         
         else:
             auto = False
             
             try:
                 (width, unit) = width
             except TypeError:
                 unit = self.FIGURE
             width *= self.text_font.measure(unit)
             width += self.space_size
         
         self.auto_width.append(auto)
         width = max(width, self.column(key, option="minwidth"))
         stretch = value.get("stretch", False)
         self.column(key, stretch=stretch, width=width)
     
     self.bind("<End>", self.end)
Exemple #11
0
 def __init__(self, container, **kw):
     Treeview.__init__(self, container, **kw)
     ScrollWrapper.__init__(self, container)