Example #1
0
    def setup_editing_forms(self):
        self.variables = {}
        for row, field in enumerate(('name', 'time', 'page', 'cuenum', 'desc', 
            'sub_levels')):
            lab = Tk.Label(self, text=field, fg='white', bg='black')
            lab.grid(row=row, column=0, sticky='nsew')

            entryvar = Tk.StringVar()
            entry = Tk.Entry(self, fg='white', bg='black', 
                textvariable=entryvar, insertbackground='white',
                highlightcolor='red') # TODO this red/black is backwards
            entry.grid(row=row, column=1, sticky='nsew')

            self.variables[field] = entryvar

            def field_changed(x, y, z, field=field, entryvar=entryvar):
                if self.cue:
                    setattr(self.cue, field, entryvar.get())
                    if self.enable_callbacks and self.changed_callback:
                        self.changed_callback(self.cue)
                if field == 'name':
                    self.set_title()

            entryvar.trace('w', field_changed)
        self.columnconfigure(1, weight=1)
Example #2
0
 def fill_in_cue_info(self):
     self.enable_callbacks = 0
     for row, field in enumerate(('name', 'time', 'page', 'cuenum', 'desc', 
         'sub_levels')):
         text = ''
         if self.cue:
             try:
                 text = getattr(self.cue, field)
             except AttributeError:
                 pass
         self.variables[field].set(text)
     self.enable_callbacks = 1
Example #3
0
    def __init__(self, master, filename):
        CueList.__init__(self, filename)
        Tk.Frame.__init__(self, master, bg='black')
        self.fader = None
        
        self.edit_tl = Tk.Toplevel()
        self.editor = CueEditron(self.edit_tl, 
            changed_callback=self.cue_changed)
        self.editor.pack(fill='both', expand=1)

        def edit_cue(index):
            index = int(index)
            self.editor.set_cue_to_edit(self.cues[index])
            
        self.columns = ('name', 'time', 'page', 'cuenum', 'desc', 'sub_levels')
        self.scrolled_hlist = Tk.ScrolledHList(self,
            options='hlist.columns %d hlist.header 1' % len(self.columns))
        self.hlist = self.scrolled_hlist.hlist
        self.hlist.configure(fg='white', bg='black', 
            command=self.select_callback, browsecmd=edit_cue)
        self.hlist.bind("<4>", self.wheelscroll)
        self.hlist.bind("<5>", self.wheelscroll)
        self.scrolled_hlist.pack(fill='both', expand=1)

        boldfont = self.tk.call('tix', 'option', 'get', 
            'bold_font')
        header_style = Tk.DisplayStyle('text', refwindow=self,
            anchor='center', padx=8, pady=2, font=boldfont)

        for count, header in enumerate(self.columns):
            self.hlist.header_create(count, itemtype='text',
                text=header, style=header_style)

        self.cue_label_windows = {}
        for count, cue in enumerate(self.cues):
            self.display_cue(count, cue)
        self.update_cue_indicators()
        self.save_loop()
Example #4
0
    def cue_changed(self, cue):
        path = self.cues.index(cue)
        for col, header in enumerate(self.columns):
            try:
                text = getattr(cue, header)
            except AttributeError:
                text = ''

            if col == 0:
                self.cue_label_windows[path]['text'] = text
            else:
                self.hlist.item_configure(path, col, text=text)

        if cue in self.get_current_cues() and self.fader:
            self.fader.update_cue_cache()
            self.fader.reload_cue_times()
Example #5
0
    def display_cue(self, path, cue):
        for col, header in enumerate(self.columns):
            try:
                text = getattr(cue, header)
            except AttributeError:
                text = ''

            if col == 0:
                lab = Tk.Label(self.hlist, text=text, fg='white', bg='black')
                def select_and_highlight(event):
                    self.select_callback(path)
                    self.hlist.selection_clear()
                    self.hlist.selection_set(path)

                lab.bind("<Double-1>", select_and_highlight)
                self.hlist.add(path, itemtype='window', window=lab)
                self.cue_label_windows[path] = lab
            else:
                self.hlist.item_create(path, col, text=text)