예제 #1
0
class ListManager(gtk.VBox):
    def __init__(self):
        gtk.VBox.__init__(self)
        
        main_align = gtk.Alignment()
        main_align.set_padding(0, 0, 1, 0)
        main_align.set(1, 1, 1, 1)
        
        # playlist
        self.tab_box = TabManager([local_search_tab])
        self.tab_box.connect("switch-tab", self.on_tab_box_switch_tab)
        main_align.add(self.tab_box)
        self.add(main_align)
        self.current_title = config.get("listmanager", "source", "")
        self.current_source = None
        
        Dispatcher.connect("add-source", self.on_dispatcher_add_source)
        Dispatcher.connect("remove-source", self.on_dispatcher_remove_source)
        Dispatcher.connect("switch-source", self.on_dispatcher_switch_source)
        Dispatcher.connect("ready", self.on_dispatcher_ready)
        
    def on_dispatcher_ready(self, widget):    
        if self.current_source:
            self.switch_source(self.current_source, True)
            restore_status = getattr(self.current_source.list_widget, "restore_status", None)
            if restore_status and callable(restore_status):
                restore_status()
        else:    
            try:
                local_search_tab.list_widget.restore_status()
            except Exception, e:
                print e
class ListManager(gtk.VBox):
    def __init__(self):
        gtk.VBox.__init__(self)
        
        main_align = gtk.Alignment()
        main_align.set_padding(0, 0, 1, 0)
        main_align.set(1, 1, 1, 1)
        
        # playlist
        self.tab_box = TabManager([local_search_tab])
        self.tab_box.connect("switch-tab", self.on_tab_box_switch_tab)
        main_align.add(self.tab_box)
        self.add(main_align)
        self.current_title = config.get("listmanager", "source", "")
        self.current_source = None
        
        Dispatcher.connect("add-source", self.on_dispatcher_add_source)
        Dispatcher.connect("remove-source", self.on_dispatcher_remove_source)
        Dispatcher.connect("switch-source", self.on_dispatcher_switch_source)
        if helper.NEED_RESTORE:
            Dispatcher.connect("ready", self.on_dispatcher_ready)
        
    def on_dispatcher_ready(self, widget):    
        if self.current_source:
            self.switch_source(self.current_source, True)
            restore_status = getattr(self.current_source.list_widget, "restore_status", None)
            if restore_status and callable(restore_status):
                # gobject.idle_add(restore_status)
                restore_status()
                
        else:    
            try:
                gobject.idle_add(local_search_tab.list_widget.restore_status)
            except Exception, e:
                print e
class ListManager(gtk.VBox):
    def __init__(self):
        gtk.VBox.__init__(self)
        
        main_align = gtk.Alignment()
        main_align.set_padding(0, 0, 1, 0)
        main_align.set(1, 1, 1, 1)
        
        # playlist
        self.tab_box = TabManager([local_search_tab])
        self.tab_box.connect("switch-tab", self.on_tab_box_switch_tab)
        main_align.add(self.tab_box)
        self.add(main_align)
        
        Dispatcher.connect("add-source", self.on_dispatcher_add_source)
        Dispatcher.connect("remove-source", self.on_dispatcher_remove_source)
        Dispatcher.connect("switch-source", self.on_dispatcher_switch_source)
        
    def on_tab_box_switch_tab(self, widget, item):    
        Dispatcher.emit("switch-browser", item, True)
        
    def manual_active_tab(self, widget, songs, tab_type):    
        self.tab_box.active_tab(tab_type)
        
    def on_dispatcher_add_source(self, widget, data):    
        self.tab_box.add_items([data], False)

    def on_dispatcher_remove_source(self, widget, data):    
        self.tab_box.remove_items([data])
        
    def on_dispatcher_switch_source(self, widget, data):    
        self.tab_box.active_item(data)
        Dispatcher.emit("switch-browser", data, False)
예제 #4
0
 def __init__(self):
     gtk.VBox.__init__(self)
     
     main_align = gtk.Alignment()
     main_align.set_padding(0, 0, 1, 0)
     main_align.set(1, 1, 1, 1)
     
     # playlist
     self.tab_box = TabManager([local_search_tab])
     self.tab_box.connect("switch-tab", self.on_tab_box_switch_tab)
     main_align.add(self.tab_box)
     self.add(main_align)
     self.current_title = config.get("listmanager", "source", "")
     self.current_source = None
     
     Dispatcher.connect("add-source", self.on_dispatcher_add_source)
     Dispatcher.connect("remove-source", self.on_dispatcher_remove_source)
     Dispatcher.connect("switch-source", self.on_dispatcher_switch_source)
     Dispatcher.connect("ready", self.on_dispatcher_ready)
 def __init__(self):
     gtk.VBox.__init__(self)
     
     main_align = gtk.Alignment()
     main_align.set_padding(0, 0, 1, 0)
     main_align.set(1, 1, 1, 1)
     
     # playlist
     self.tab_box = TabManager([local_search_tab])
     self.tab_box.connect("switch-tab", self.on_tab_box_switch_tab)
     main_align.add(self.tab_box)
     self.add(main_align)
     
     Dispatcher.connect("add-source", self.on_dispatcher_add_source)
     Dispatcher.connect("remove-source", self.on_dispatcher_remove_source)
     Dispatcher.connect("switch-source", self.on_dispatcher_switch_source)
 def __init__(self):
     gtk.VBox.__init__(self)
     
     main_align = gtk.Alignment()
     main_align.set_padding(0, 0, 1, 0)
     main_align.set(1, 1, 1, 1)
     
     # playlist
     self.tab_box = TabManager([local_search_tab])
     self.tab_box.connect("switch-tab", self.on_tab_box_switch_tab)
     main_align.add(self.tab_box)
     self.add(main_align)
     self.current_title = config.get("listmanager", "source", "")
     self.current_source = None
     
     Dispatcher.connect("add-source", self.on_dispatcher_add_source)
     Dispatcher.connect("remove-source", self.on_dispatcher_remove_source)
     Dispatcher.connect("switch-source", self.on_dispatcher_switch_source)
     if helper.NEED_RESTORE:
         Dispatcher.connect("ready", self.on_dispatcher_ready)