Exemplo n.º 1
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        gtk.VBox.__init__(self, False, 0)

        self.perspectivs = {
            LEFT_PERSPECTIVE_NAVIGATION: controls.tabhelper,
            LEFT_PERSPECTIVE_RADIO: controls.radio.scroll,
            LEFT_PERSPECTIVE_VIRTUAL: controls.virtual.scroll,
            LEFT_PERSPECTIVE_INFO: controls.info_panel,
            LEFT_PERSPECTIVE_LASTFM: controls.lastfm_integration.scroll,
            LEFT_PERSPECTIVE_VK: controls.vk_integration.scroll
        }

        self.buttons = PerspectiveButtonControlls(self.activate_perspective,
                                                  controls)
        self.buttons.show_all()

        self.add_button = ButtonStockText(_("Add Folder(s) in tree"),
                                          gtk.STOCK_ADD)
        self.add_button.connect("clicked",
                                lambda *a: controls.tree.add_folder())

        self.pack_start(self.add_button, False, False)

        for widget in self.perspectivs.values():
            self.pack_start(widget, True, True)

        self.pack_start(controls.filter, False, False)
        self.pack_start(self.buttons, False, False)
Exemplo n.º 2
0
    def __init__(self, controls):
        super(FSPerspective, self).__init__()
        self.tabhelper = TabHelperControl(controls)
        self.vbox = Gtk.VBox(False, 0)

        self.add_button = ButtonStockText(_(" Add Folder(s) in tree"),
                                          Gtk.STOCK_ADD)
        self.add_button.connect(
            "clicked",
            lambda *a: self.tabhelper.get_current_tree().add_folder())

        self.vbox.pack_start(self.add_button, False, False, 0)
        self.vbox.pack_start(self.tabhelper, True, True)
        self.vbox.show_all()
Exemplo n.º 3
0
 def __init__(self, controls):
     FControl.__init__(self, controls)
     gtk.VBox.__init__(self, False, 0)
     
     self.perspectivs = {
                  LEFT_PERSPECTIVE_NAVIGATION:controls.tabhelper,
                  LEFT_PERSPECTIVE_RADIO:controls.radio.scroll,
                  LEFT_PERSPECTIVE_VIRTUAL:controls.virtual.scroll,
                  LEFT_PERSPECTIVE_INFO:controls.info_panel,
                  LEFT_PERSPECTIVE_LASTFM:controls.lastfm_integration.scroll,
                  LEFT_PERSPECTIVE_VK:controls.vk_integration.scroll
                                  
                  }
     
     self.buttons = PerspectiveButtonControlls(self.activate_perspective, controls)
     self.buttons.show_all()
     
     self.add_button = ButtonStockText(_("Add Folder(s) in tree"), gtk.STOCK_ADD)
     self.add_button.connect("clicked", lambda * a :controls.tree.add_folder())
     
     self.pack_start(self.add_button, False, False)
     
     for widget in self.perspectivs.values():
         self.pack_start(widget, True, True)
             
     self.pack_start(controls.filter, False, False)
     self.pack_start(self.buttons, False, False)
Exemplo n.º 4
0
    def __init__(self, controls):
        super(FSPerspective, self).__init__()
        self.tabhelper = TabHelperControl(controls)
        self.vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.add_button = ButtonStockText(_(" Add Folder(s) in tree"), "list-add")
        self.add_button.connect("clicked", lambda * a: self.tabhelper.get_current_tree().add_folder())

        self.vbox.pack_start(self.add_button, False, False, 0)
        self.vbox.pack_start(self.tabhelper, True, True, 0)
        self.vbox.show_all()
Exemplo n.º 5
0
    def __init__(self, controls):
        super(FSPerspective, self).__init__()
        self.tabhelper = TabHelperControl(controls)
        self.vbox = Gtk.VBox(False, 0)

        self.add_button = ButtonStockText(_(" Add Folder(s) in tree"), Gtk.STOCK_ADD)
        self.add_button.connect("clicked", lambda * a: self.tabhelper.get_current_tree().add_folder())

        self.vbox.pack_start(self.add_button, False, False, 0)
        self.vbox.pack_start(self.tabhelper, True, True)
        self.vbox.show_all()
Exemplo n.º 6
0
class PerspectiveControls(FControl, gtk.VBox, LoadSave):
    def __init__(self, controls):
        FControl.__init__(self, controls)
        gtk.VBox.__init__(self, False, 0)

        self.perspectivs = {
            LEFT_PERSPECTIVE_NAVIGATION: controls.tabhelper,
            LEFT_PERSPECTIVE_RADIO: controls.radio.scroll,
            LEFT_PERSPECTIVE_VIRTUAL: controls.virtual.scroll,
            LEFT_PERSPECTIVE_INFO: controls.info_panel,
            LEFT_PERSPECTIVE_LASTFM: controls.lastfm_integration.scroll,
            LEFT_PERSPECTIVE_VK: controls.vk_integration.scroll
        }

        self.buttons = PerspectiveButtonControlls(self.activate_perspective,
                                                  controls)
        self.buttons.show_all()

        self.add_button = ButtonStockText(_("Add Folder(s) in tree"),
                                          gtk.STOCK_ADD)
        self.add_button.connect("clicked",
                                lambda *a: controls.tree.add_folder())

        self.pack_start(self.add_button, False, False)

        for widget in self.perspectivs.values():
            self.pack_start(widget, True, True)

        self.pack_start(controls.filter, False, False)
        self.pack_start(self.buttons, False, False)

    def show_add_button(self):
        self.add_button.show()

    def hide_add_button(self):
        self.add_button.hide()

    def activate_perspective(self, name):
        for widget in self.perspectivs.values():
            widget.hide()
        FC().left_perspective = name
        self.perspectivs[name].show()

        if name in (LEFT_PERSPECTIVE_INFO, LEFT_PERSPECTIVE_VK,
                    LEFT_PERSPECTIVE_LASTFM):
            self.controls.filter.hide()
        else:
            self.controls.filter.show()

    def activate_perspective_key(self, name):
        self.buttons.activate_button(name)

    def on_load(self):
        self.activate_perspective(LEFT_PERSPECTIVE_NAVIGATION)

    def on_save(self):
        pass
Exemplo n.º 7
0
class FSPerspective(BasePerspective, Filterable):
    def __init__(self, controls):
        super(FSPerspective, self).__init__()
        self.tabhelper = TabHelperControl(controls)
        self.vbox = Gtk.VBox(False, 0)

        self.add_button = ButtonStockText(_(" Add Folder(s) in tree"),
                                          Gtk.STOCK_ADD)
        self.add_button.connect(
            "clicked",
            lambda *a: self.tabhelper.get_current_tree().add_folder())

        self.vbox.pack_start(self.add_button, False, False, 0)
        self.vbox.pack_start(self.tabhelper, True, True)
        self.vbox.show_all()

    def get_tabhelper(self):
        ## temporary duplicate for get_widget()
        return self.tabhelper

    @idle_task
    def hide_add_button(self):
        self.add_button.hide()

    @idle_task
    def show_add_button(self):
        self.add_button.show()

    def get_id(self):
        return "fs"

    def get_icon(self):
        return Gtk.STOCK_HARDDISK

    def get_name(self):
        return _("Music")

    def get_tooltip(self):
        return _("Music Navigation (Alt+1)")

    def get_widget(self):
        return self.vbox

    ## LoadSave implementation
    def on_load(self):
        self.tabhelper.on_load()

    def on_save(self):
        self.tabhelper.on_save()

    ## Filterable implementation
    def filter_by_file(self, value):
        self.tabhelper.get_current_tree().filter_by_file(value)

    def filter_by_folder(self, value):
        self.tabhelper.get_current_tree().filter_by_folder(value)
Exemplo n.º 8
0
class PerspectiveControls(FControl, gtk.VBox, LoadSave):
    def __init__(self, controls):
        FControl.__init__(self, controls)
        gtk.VBox.__init__(self, False, 0)
        
        self.perspectivs = {
                     LEFT_PERSPECTIVE_NAVIGATION:controls.tabhelper,
                     LEFT_PERSPECTIVE_RADIO:controls.radio.scroll,
                     LEFT_PERSPECTIVE_VIRTUAL:controls.virtual.scroll,
                     LEFT_PERSPECTIVE_INFO:controls.info_panel,
                     LEFT_PERSPECTIVE_LASTFM:controls.lastfm_integration.scroll,
                     LEFT_PERSPECTIVE_VK:controls.vk_integration.scroll
                                     
                     }
        
        self.buttons = PerspectiveButtonControlls(self.activate_perspective, controls)
        self.buttons.show_all()
        
        self.add_button = ButtonStockText(_("Add Folder(s) in tree"), gtk.STOCK_ADD)
        self.add_button.connect("clicked", lambda * a :controls.tree.add_folder())
        
        self.pack_start(self.add_button, False, False)
        
        for widget in self.perspectivs.values():
            self.pack_start(widget, True, True)
                
        self.pack_start(controls.filter, False, False)
        self.pack_start(self.buttons, False, False)
    
    def show_add_button(self):
        self.add_button.show()
    
    def hide_add_button(self):
        self.add_button.hide()
    
    def activate_perspective(self, name):
        for widget in self.perspectivs.values():
            widget.hide()
        FC().left_perspective = name
        self.perspectivs[name].show()
        
        if name in (LEFT_PERSPECTIVE_INFO,LEFT_PERSPECTIVE_VK,LEFT_PERSPECTIVE_LASTFM):
            self.controls.filter.hide()
        else:
            self.controls.filter.show()
            
        
   
    def activate_perspective_key(self, name):
        self.buttons.activate_button(name)
    
    def on_load(self):  
        self.activate_perspective(LEFT_PERSPECTIVE_NAVIGATION)
        
    def on_save(self):
        pass
Exemplo n.º 9
0
class FSPerspective(BasePerspective, Filterable):

    def __init__(self, controls):
        super(FSPerspective, self).__init__()
        self.tabhelper = TabHelperControl(controls)
        self.vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.add_button = ButtonStockText(_(" Add Folder(s) in tree"), "list-add")
        self.add_button.connect("clicked", lambda * a: self.tabhelper.get_current_tree().add_folder())

        self.vbox.pack_start(self.add_button, False, False, 0)
        self.vbox.pack_start(self.tabhelper, True, True, 0)
        self.vbox.show_all()

    def get_tabhelper(self):
        ## temporary duplicate for get_widget()
        return self.tabhelper

    @idle_task
    def hide_add_button(self):
        self.add_button.hide()

    @idle_task
    def show_add_button(self):
        self.add_button.show()

    def get_id(self):
        return "fs"

    def get_icon(self):
        return "drive-harddisk"

    def get_name(self):
        return _("Music")

    def get_tooltip(self):
        return _("Music Navigation (Alt+1)")

    def get_widget(self):
        return self.vbox

    ## LoadSave implementation
    def on_load(self):
        self.tabhelper.on_load()

    def on_save(self):
        self.tabhelper.on_save()

    ## Filterable implementation
    def filter_by_file(self, value):
        self.tabhelper.get_current_tree().filter_by_file(value)

    def filter_by_folder(self, value):
        self.tabhelper.get_current_tree().filter_by_folder(value)
Exemplo n.º 10
0
class PerspectiveControls(FControl, gtk.VBox, LoadSave):
    def __init__(self, controls):
        FControl.__init__(self, controls)
        gtk.VBox.__init__(self, False, 0)
        
        self.perspectivs = {
                     LEFT_PERSPECTIVE_NAVIGATION:controls.tabhelper,
                     LEFT_PERSPECTIVE_RADIO:controls.radio.scroll,
                     LEFT_PERSPECTIVE_MY_RADIO:controls.my_radio.scroll,
                     LEFT_PERSPECTIVE_VIRTUAL:controls.virtual.scroll,
                     LEFT_PERSPECTIVE_INFO:controls.info_panel,
                     LEFT_PERSPECTIVE_LASTFM:controls.lastfm_integration.scroll,
                     LEFT_PERSPECTIVE_VK:controls.vk_integration.scroll
                     }
        self.switch_radio_button = gtk.Button()
        self.switch_radio_button.connect("clicked", lambda *a: self.on_radio_buttons_click()) 
        self.buttons = PerspectiveButtonControlls(self.activate_perspective, controls)
        self.buttons.show_all()
        
        self.add_button = ButtonStockText(_(" Add Folder(s) in tree"), gtk.STOCK_ADD)
        self.add_button.connect("clicked", lambda * a :controls.tabhelper.get_current_tree().add_folder())
        
        self.switch_radio_button = gtk.Button()
        self.switch_radio_button.connect("clicked", lambda *a: self.on_radio_buttons_click())        
         
        self.pack_start(self.add_button, False, False)
        
        for widget in self.perspectivs.values():
            self.pack_start(widget, True, True)
        self.pack_start(self.switch_radio_button, False, False)
        self.pack_start(controls.filter, False, False)
        self.pack_start(self.buttons, False, False)
    
    def show_add_button(self):
        self.add_button.show()
    
    def hide_add_button(self):
        self.add_button.hide()
    
    def activate_perspective(self, name):
        for widget in self.perspectivs.values():
            widget.hide()
        FC().left_perspective = name
        self.perspectivs[name].show()
        
        if name in (LEFT_PERSPECTIVE_INFO,LEFT_PERSPECTIVE_LASTFM):
            self.controls.filter.hide()
        else:
            self.controls.filter.show()

        if name in (LEFT_PERSPECTIVE_RADIO,LEFT_PERSPECTIVE_MY_RADIO):
            self.switch_radio_button.set_label(self.perspectivs[name]
                                               .get_child().switcher_label)
            self.switch_radio_button.show()
        else:
            self.switch_radio_button.hide()
        
        analytics.action("PERSPECTIVE_"+name);
            
    def on_radio_buttons_click(self):
        for name in self.perspectivs.keys():
            if self.perspectivs[name].get_visible():
                if name == LEFT_PERSPECTIVE_RADIO:
                    perspective_name = LEFT_PERSPECTIVE_MY_RADIO
                    FC().is_my_radio_active = True
                elif name == LEFT_PERSPECTIVE_MY_RADIO:
                    perspective_name = LEFT_PERSPECTIVE_RADIO
                    FC().is_my_radio_active = False
                break
        self.activate_perspective(perspective_name)
        self.switch_radio_button.set_label(self.perspectivs[perspective_name]
                                           .get_child().switcher_label)
   
    def activate_perspective_key(self, name):
        self.buttons.activate_button(name)
        
    def activate_radio_perspective(self):
        if FC().is_my_radio_active:
            self.activate_perspective(LEFT_PERSPECTIVE_MY_RADIO)
        else:
            self.activate_perspective(LEFT_PERSPECTIVE_RADIO)
    
    def on_load(self):  
        self.activate_perspective(LEFT_PERSPECTIVE_NAVIGATION)
        
        
    def on_save(self):
        pass