Ejemplo n.º 1
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Window.__init__(self, Gtk.WindowType.POPUP)

        self.set_position(Gtk.WindowPosition.MOUSE)
        self.connect("leave-notify-event", self.on_leave_window)
        Notify.init('Foobnix')
Ejemplo n.º 2
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Frame.__init__(self)

        self.set_label_widget(notetab_label(self.hide))
        self.set_label_align(1.0, 0.0)
        self.set_border_width(0)

        self.smallscree_area = AdvancedDrawingArea(controls)
        self.smallscree_area.action_function = self.on_full_screen

        self.add(self.smallscree_area)

        self.fullscrean_area = FullScreanArea(controls, self.on_small_screen)

        def modyfy_background():
            for state in (Gtk.StateType.NORMAL, Gtk.STATE_PRELIGHT,
                          Gtk.STATE_ACTIVE, Gtk.STATE_SELECTED,
                          Gtk.STATE_INSENSITIVE):
                self.smallscree_area.modify_bg(
                    state,
                    self.smallscree_area.get_colormap().alloc_color("black"))
                self.fullscrean_area.draw.modify_bg(
                    state,
                    self.fullscrean_area.get_colormap().alloc_color("black"))

        # TODO Fix it
        #GLib.idle_add(modyfy_background)

        self.output = None
        self.set_output(self.smallscree_area)
Ejemplo n.º 3
0
    def __init__(self, controls, seek_bar_movie=None):
        FControl.__init__(self, controls)
        self.seek_bar_movie = seek_bar_movie
        Gtk.Alignment.__init__(self, xalign=0.5, yalign=0.5, xscale=1.0, yscale=1.0)

        self.set_padding(padding_top=7, padding_bottom=7, padding_left=0, padding_right=7)

        self.tooltip = Gtk.Window(Gtk.WindowType.POPUP)
        self.tooltip.set_position(Gtk.WindowPosition.CENTER)
        self.tooltip_label = Gtk.Label.new(None)
        self.tooltip.add(self.tooltip_label)

        self.progressbar = Gtk.ProgressBar()
        self.progressbar.set_ellipsize(Pango.EllipsizeMode.END)
        self.progressbar.set_property("show-text", True)
        self.progressbar.set_text("00:00 / 00:00")
        try:
            self.progressbar.set_has_tooltip(True)
        except:
            #fix debian compability
            pass

        event = Gtk.EventBox()
        event.add(self.progressbar)
        event.connect("button-press-event", self.on_seek)
        event.connect("leave-notify-event", lambda *a: self.safe_hide_tooltip())
        event.connect("motion-notify-event", self.on_pointer_motion)
        self.add(event)
        self.show_all()
        self.tooltip.hide()
Ejemplo n.º 4
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.StatusIcon.__init__(self)
        self.hide()
        ImageBase.__init__(self, ICON_FOOBNIX, 150)

        self.popup_menu = PopupMenuWindow(self.controls)
        self.popup_volume_contol = PopupVolumeWindow(self.controls, self.popup_menu)

        self.connect("activate", self.on_activate)
        self.connect("popup-menu", self.on_popup_menu)

        try:
            self.set_has_tooltip(True)
            #self.set_tooltip("Foobnix music player")
            self.connect("query-tooltip", self.on_query_tooltip)
            self.connect("button-press-event", self.on_button_press)
            self.connect("scroll-event", self.on_scroll)
        except Exception as e:
            logging.warn("Tooltip doesn't work " + str(e))

        self.current_bean = FModel().add_artist("Artist").add_title("Title")
        self.tooltip_image = ImageBase(ICON_FOOBNIX, 75)

        self._previous_notify = None
Ejemplo n.º 5
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Window.__init__(self, Gtk.WindowType.POPUP)

        self.set_position(Gtk.WindowPosition.MOUSE)
        self.connect("leave-notify-event", self.on_leave_window)
        Notify.init('Foobnix')
Ejemplo n.º 6
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Box.__init__(self,
                         orientation=Gtk.Orientation.HORIZONTAL,
                         spacing=0)

        self.old_menu = MenuBarWidget(controls)

        self.pack_start(self.old_menu.widget, False, False, 0)

        self.new_menu_button = ImageButton("preferences-system",
                                           tooltip_text=_("Settings"))
        self.new_menu_button.connect("button-press-event",
                                     self.on_button_press)

        self.pack_start(self.new_menu_button, False, False, 0)
        self.pack_start(controls.playback, False, False, 0)
        self.pack_start(controls.os, False, False, 0)
        self.pack_start(controls.volume, False, False, 0)
        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
        self.pack_start(controls.record, False, False, 0)
        self.pack_start(controls.seek_bar, True, True, 0)
        """menu init"""
        menu = Popup()
        decorator = MenuStyleDecorator()
        MenuBarWidget(self.controls, menu)
        menu.add_separator()
        menu.add_item(_("Preferences"), "preferences-system",
                      self.controls.show_preferences)
        menu.add_separator()
        menu.add_item(_("Quit"), "application-exit", self.controls.quit)

        decorator.apply(menu)
        self.menu = menu
Ejemplo n.º 7
0
Archivo: top.py Proyecto: kagel/foobnix
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.HBox.__init__(self, False, 0)

        self.old_menu = MenuBarWidget(controls)


        self.pack_start(self.old_menu.widget, False, False, 0)

        self.new_menu_button = ImageButton("preferences-system", tooltip_text=_("Settings"))
        self.new_menu_button.connect("button-press-event", self.on_button_press)

        self.pack_start(self.new_menu_button, False, False, 0)
        self.pack_start(controls.playback, False, False, 0)
        self.pack_start(controls.os, False, False, 0)
        self.pack_start(controls.volume, False, False, 0)
        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
        self.pack_start(controls.record, False, False, 0)
        self.pack_start(controls.seek_bar, True, True, 0)

        """menu init"""
        menu = Popup()
        decorator = MenuStyleDecorator()
        MenuBarWidget(self.controls, menu)
        menu.add_separator()
        menu.add_item(_("Preferences"), "preferences-system", self.controls.show_preferences)
        menu.add_separator()
        menu.add_item(_("Quit"), "application-exit", self.controls.quit)

        decorator.apply(menu)
        self.menu = menu
Ejemplo n.º 8
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.HBox.__init__(self, False, 0)

        self.old_menu = MenuBarWidget(controls)

        self.pack_start(self.old_menu.widget, False, False, 0)

        self.new_menu_button = ImageButton(Gtk.STOCK_PREFERENCES)
        self.new_menu_button.connect("button-press-event",
                                     self.on_button_press)

        self.pack_start(self.new_menu_button, False, False, 0)
        self.pack_start(controls.playback, False, False, 0)
        self.pack_start(controls.os, False, False, 0)
        self.pack_start(controls.volume, False, False, 0)
        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
        self.pack_start(controls.record, False, False, 0)
        self.pack_start(controls.seek_bar, True, True, 0)
        """menu init"""
        menu = Popup()
        decorator = MenuStyleDecorator()
        MenuBarWidget(self.controls, menu)
        menu.add_separator()
        menu.add_item(_("Preferences"), Gtk.STOCK_PREFERENCES,
                      self.controls.show_preferences)
        menu.add_separator()
        menu.add_item(_("Quit"), Gtk.STOCK_QUIT, self.controls.quit)

        decorator.apply(menu)
        self.menu = menu
Ejemplo n.º 9
0
 def __init__(self, controls):
     FControl.__init__(self, controls)
     Gtk.HBox.__init__(self, False, 0)
     
     self.old_menu = MenuBarWidget(controls)
     
     
     self.pack_start(self.old_menu.widget, False, False, 0)
     
     self.new_menu_button = ImageButton(Gtk.STOCK_PREFERENCES)
     self.new_menu_button.connect("button-press-event", self.on_button_press)
     
     self.pack_start(self.new_menu_button, False, False, 0)
     self.pack_start(controls.playback, False, False, 0)
     self.pack_start(controls.os, False, False, 0)
     self.pack_start(controls.volume, False, False, 0)
     self.pack_start(Gtk.SeparatorToolItem(), False, False, 0)
     self.pack_start(controls.record, False, False, 0)
     self.pack_start(controls.seek_bar, True, True, 0)
     
     """menu init"""
     menu = Popup()
     decorator = MenuStyleDecorator()
     MenuBarWidget(self.controls, menu)
     menu.add_separator()        
     menu.add_item(_("Preferences"), Gtk.STOCK_PREFERENCES, self.controls.show_preferences)
     menu.add_separator()
     menu.add_item(_("Quit"), Gtk.STOCK_QUIT, self.controls.quit)
     
     decorator.apply(menu)
     self.menu = menu
Ejemplo n.º 10
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        controls = self.controls
        self.configs.append(MusicLibraryConfig(controls))
        self.configs.append(TabsConfig(controls))
        self.configs.append(LastFmConfig(controls))
        self.configs.append(TrayIconConfig(controls))
        self.configs.append(NetworkConfig(controls))

        try:
            """check keybinder installed, debian"""
            import gi
            gi.require_version('Keybinder', '3.0')
            from gi.repository import Keybinder  #@UnresolvedImport @UnusedImport
            from foobnix.preferences.configs.hotkey_conf import HotKeysConfig
            self.configs.append(HotKeysConfig(controls))
        except Exception as e:
            logging.warn("Keybinder not installed" + str(e))

        self.configs.append(OtherConfig(controls))

        self.label = None

        mainVBox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        ChildTopWindow.__init__(self, _("Preferences"), 900, 550)

        paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
        paned.set_position(250)

        def func():
            bean = self.navigation.get_selected_bean()
            if bean:
                self.populate_config_category(bean.text)

        self.navigation = SimpleListTreeControl(_("Categories"), controls,
                                                True)

        for plugin in self.configs:
            self.navigation.append(FDModel(plugin.name))

        self.navigation.set_left_click_func(func)

        paned.add1(self.navigation.scroll)

        cbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        for plugin in self.configs:
            cbox.pack_start(plugin.widget, False, True, 0)

        self._container = self.create_container(cbox)
        paned.add2(self._container)

        mainVBox.pack_start(paned, True, True, 0)
        mainVBox.pack_start(self.create_save_cancel_buttons(), False, False, 0)

        #self.add(mainVBox)
        GLib.idle_add(self.add, mainVBox)
Ejemplo n.º 11
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        """ set application stylesheet"""
        self.style_provider = Gtk.CssProvider()
        ## TODO: after moving style to resource - replace to load_from_file
        self.style_provider.load_from_data(foobnix_style)
        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(),
            self.style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
        )

        self.controls = controls
        bbox = Gtk.VBox(False, 0)
        notebox = Gtk.Overlay.new()
        notebox.add(controls.notetabs)
        notebox.add_overlay(controls.search_progress)

        bbox.pack_start(notebox, True, True, 0)
        #bbox.pack_start(controls.movie_window, False, False, 0)

        center_box = Gtk.VBox(False, 0)
        center_box.pack_start(controls.searchPanel, False, False, 0)
        center_box.pack_start(bbox, True, True, 0)

        self.hpaned_left = Gtk.HPaned()
        self.hpaned_left.connect("motion-notify-event", self.on_motion)

        self.hpaned_left.pack1(child=controls.perspectives, resize=True, shrink=True)
        self.hpaned_left.pack2(child=center_box, resize=True, shrink=True)

        self.hpaned_right = Gtk.HPaned()
        self.hpaned_right.connect("motion-notify-event", self.on_motion)
        self.hpaned_right.pack1(child=self.hpaned_left, resize=True, shrink=True)
        self.hpaned_right.pack2(child=controls.coverlyrics, resize=True, shrink=False)

        vbox = Gtk.VBox(False, 0)
        vbox.pack_start(controls.top_panel, False, False, 0)
        vbox.pack_start(self.hpaned_right, True, True, 0)
        vbox.pack_start(controls.statusbar, False, True, 0)
        vbox.show_all()

        self.hpaned_left.connect("button-press-event", self.on_border_press)
        self.hpaned_right.connect("button-press-event", self.on_border_press)
        self.hpaned_left.connect("button-release-event", self.on_border_release)
        self.hpaned_right.connect("button-release-event", self.on_border_release)
        self.id_handler_left = self.hpaned_left.connect("size-allocate", self.on_configure_hl_event)
        self.id_handler_right = self.hpaned_right.connect("size-allocate", self.on_configure_hr_event)

        self.hpaned_press_release_handler_blocked = False

        controls.main_window.connect("configure-event", self.on_configure_event)
        controls.main_window.add(vbox)
Ejemplo n.º 12
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        self.controls = controls
        """ set application stylesheet"""
        self.style_provider = Gtk.CssProvider()
        ## TODO: after moving style to resource - replace to load_from_file
        self.style_provider.load_from_data(foobnix_style)
        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(), self.style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

        self.controls = controls

        notebox = Gtk.Overlay.new()
        notebox.add(controls.notetabs)
        notebox.add_overlay(controls.search_progress)

        bbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        bbox.pack_start(notebox, True, True, 0)

        center_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        center_box.pack_start(controls.searchPanel, False, False, 0)
        center_box.pack_start(bbox, True, True, 0)

        self.hpaned_left = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
        self.hpaned_left.pack1(child=controls.perspectives.scroll,
                               resize=True,
                               shrink=False)
        self.hpaned_left.pack2(child=center_box, resize=True, shrink=True)

        self.hpaned_right = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
        self.hpaned_right.pack1(child=self.hpaned_left,
                                resize=True,
                                shrink=True)
        self.hpaned_right.pack2(child=controls.coverlyrics,
                                resize=True,
                                shrink=False)

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        vbox.pack_start(controls.top_panel, False, False, 0)
        vbox.pack_start(self.hpaned_right, True, True, 0)
        vbox.pack_start(controls.statusbar, False, True, 0)
        vbox.show_all()

        self.hpaned_left.connect("button-release-event",
                                 self.on_border_release)
        self.hpaned_right.connect("button-release-event",
                                  self.on_border_release)

        controls.main_window.connect("configure-event",
                                     self.on_configure_event)
        controls.main_window.add(vbox)
Ejemplo n.º 13
0
 def __init__(self, controls):
     Gtk.Notebook.__init__(self)
     FControl.__init__(self, controls)
     self.controls = controls
     self.set_properties("tab-expand", True)
     self.set_scrollable(True)
     self.save_lock = threading.Lock()
     self.connect("page-reordered", self.reorder_callback)
     add_button = ImageButton(Gtk.STOCK_ADD, func=self.on_add_button_click, size=Gtk.IconSize.BUTTON)
     add_button.show()
     add_button.get_image().set_size_request(24, 22)
     self.set_action_widget(add_button, Gtk.PackType.START)
     self.default_angle = 0
     self.navig = False if isinstance(self, NoteTabControl) else True
Ejemplo n.º 14
0
    def __init__(self, controls):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
        FControl.__init__(self, controls)

        adjustment = Gtk.Adjustment(value=1, lower=0, upper=self.MAX_VALUE, step_incr=0, page_incr=0, page_size=0)
        self.volume_scale = Gtk.HScale(adjustment=adjustment)
        self.volume_scale.connect("value-changed", self.on_value_changed)
        self.volume_scale.connect("scroll-event", self.on_scroll_event)
        self.volume_scale.connect("button-press-event", self.on_volume_change)
        self.volume_scale.set_size_request(200, -1)
        self.volume_scale.set_digits(1)
        self.volume_scale.set_draw_value(False)

        self.pack_start(self.volume_scale, False, False, 0)

        self.show_all()
Ejemplo n.º 15
0
    def __init__(self, controls):
        Gtk.HBox.__init__(self, False, 0)
        FControl.__init__(self, controls)

        adjustment = Gtk.Adjustment(value=1, lower=0, upper=self.MAX_VALUE, step_incr=0, page_incr=0, page_size=0)
        self.volume_scale = Gtk.HScale(adjustment=adjustment)
        self.volume_scale.connect("value-changed", self.on_value_changed)
        self.volume_scale.connect("scroll-event", self.on_scroll_event)
        self.volume_scale.connect("button-press-event", self.on_volume_change)
        self.volume_scale.set_size_request(200, -1)
        self.volume_scale.set_digits(1)
        self.volume_scale.set_draw_value(False)

        self.pack_start(self.volume_scale, False, False, 0)

        self.show_all()
Ejemplo n.º 16
0
 def __init__(self, controls):
     Gtk.Notebook.__init__(self)
     FControl.__init__(self, controls)
     self.controls = controls
     self.set_properties("tab-expand", True)
     self.set_scrollable(True)
     self.save_lock = threading.Lock()
     self.connect("page-reordered", self.reorder_callback)
     add_button = ImageButton(Gtk.STOCK_ADD,
                              func=self.on_add_button_click,
                              size=Gtk.IconSize.BUTTON)
     add_button.show()
     add_button.get_image().set_size_request(24, 22)
     self.set_action_widget(add_button, Gtk.PackType.START)
     self.default_angle = 0
     self.navig = False if isinstance(self, NoteTabControl) else True
Ejemplo n.º 17
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL)

        self.set_title("Foobnix " + FOOBNIX_VERSION)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(True)
        self.connect("window-state-event", self.on_change_state)
        self.connect("delete-event", self.hide_window)
        self.connect("key-press-event", self.on_key_press)
        try:
            self.set_icon_name(const.ICON_FOOBNIX_NAME)
        except TypeError as e:
            logging.error(str(e))

        self.set_opacity(FC().window_opacity)
        self.iconified = False
Ejemplo n.º 18
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        self.controls = controls
        """ set application stylesheet"""
        self.style_provider = Gtk.CssProvider()
        ## TODO: after moving style to resource - replace to load_from_file
        self.style_provider.load_from_data(foobnix_style)
        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(),
            self.style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
        )

        self.controls = controls

        notebox = Gtk.Overlay.new()
        notebox.add(controls.notetabs)
        notebox.add_overlay(controls.search_progress)

        bbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        bbox.pack_start(notebox, True, True, 0)

        center_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        center_box.pack_start(controls.searchPanel, False, False, 0)
        center_box.pack_start(bbox, True, True, 0)

        self.hpaned_left = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
        self.hpaned_left.pack1(child=controls.perspectives.scroll, resize=True, shrink=False)
        self.hpaned_left.pack2(child=center_box, resize=True, shrink=True)

        self.hpaned_right = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL)
        self.hpaned_right.pack1(child=self.hpaned_left, resize=True, shrink=True)
        self.hpaned_right.pack2(child=controls.coverlyrics, resize=True, shrink=False)

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        vbox.pack_start(controls.top_panel, False, False, 0)
        vbox.pack_start(self.hpaned_right, True, True, 0)
        vbox.pack_start(controls.statusbar, False, True, 0)
        vbox.show_all()

        self.hpaned_left.connect("button-release-event", self.on_border_release)
        self.hpaned_right.connect("button-release-event", self.on_border_release)

        controls.main_window.connect("configure-event", self.on_configure_event)
        controls.main_window.add(vbox)
Ejemplo n.º 19
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        box.hide()
        box.pack_start(self.tabs_mode(), False, True, 0)
        box.pack_start(self.dirs(), False, True, 0)
        box.pack_start(self.formats(), False, True, 0)

        self.widget = box
        uhbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        ulabel = Gtk.Label.new(_("Update library on start (more slow) "))
        self.update_on_start = Gtk.CheckButton.new()

        uhbox.pack_start(ulabel, False, True, 0)
        uhbox.pack_start(self.update_on_start, False, False, 0)
        box.pack_start(uhbox, False, True, 0)
        box.pack_start(self.gap(), False, True, 0)
Ejemplo n.º 20
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL)

        self.set_title("Foobnix " + FOOBNIX_VERSION)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(True)
        self.connect("window-state-event", self.on_change_state)
        self.connect("delete-event", self.hide_window)
        self.connect("key-press-event", self.on_key_press)
        try:
            self.set_icon_from_file(
                get_foobnix_resourse_path_by_name(const.ICON_FOOBNIX))
        except TypeError as e:
            logging.error(str(e))

        self.set_opacity(FC().window_opacity)
        self.iconified = False
Ejemplo n.º 21
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        box.hide()
        box.pack_start(self.tabs_mode(), False, True, 0)
        box.pack_start(self.dirs(), False, True, 0)
        box.pack_start(self.formats(), False, True, 0)

        self.widget = box
        uhbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        ulabel = Gtk.Label.new(_("Update library on start (more slow) "))
        self.update_on_start = Gtk.CheckButton.new()

        uhbox.pack_start(ulabel, False, True, 0)
        uhbox.pack_start(self.update_on_start, False, False, 0)
        box.pack_start(uhbox, False, True, 0)
        box.pack_start(self.gap(), False, True, 0)
Ejemplo n.º 22
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        box = Gtk.VBox(False, 0)
        box.hide()
        box.pack_start(self.tabs_mode(), False, True, 0)
        box.pack_start(self.dirs(), False, True, 0)
        box.pack_start(self.formats(), False, True, 0)

        self.widget = box
        uhbox = Gtk.HBox()
        ulabel = Gtk.Label(_("Update library on start (more slow) "))
        self.update_on_start = Gtk.CheckButton()

        uhbox.pack_start(ulabel, False, True, 0)
        uhbox.pack_start(self.update_on_start, False, False, 0)
        box.pack_start(uhbox, False, True, 0)
        box.pack_start(self.gap(), False, True, 0)
Ejemplo n.º 23
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        box = Gtk.VBox(False, 0)
        box.hide()
        box.pack_start(self.tabs_mode(), False, True, 0)
        box.pack_start(self.dirs(), False, True, 0)
        box.pack_start(self.formats(), False, True, 0)

        self.widget = box
        uhbox = Gtk.HBox()
        ulabel = Gtk.Label(_("Update library on start (more slow) "))
        self.update_on_start = Gtk.CheckButton()

        uhbox.pack_start(ulabel, False, True, 0)
        uhbox.pack_start(self.update_on_start, False, False, 0)
        box.pack_start(uhbox, False, True, 0)
        box.pack_start(self.gap(), False, True, 0)
Ejemplo n.º 24
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        controls = self.controls
        self.configs.append(MusicLibraryConfig(controls))
        self.configs.append(TabsConfig(controls))
        self.configs.append(LastFmConfig(controls))
        self.configs.append(TrayIconConfig(controls))
        self.configs.append(NetworkConfig(controls))

        try:
            """check keybinder installed, debian"""
            import gi
            gi.require_version('Keybinder', '3.0')
            from gi.repository import Keybinder  #@UnresolvedImport @UnusedImport
            from foobnix.preferences.configs.hotkey_conf import HotKeysConfig
            self.configs.append(HotKeysConfig(controls))
        except Exception, e:
            logging.warn("Keybinder not installed" + str(e))
Ejemplo n.º 25
0
    def __init__(self, controls):
        FControl.__init__(self, controls)

        controls = self.controls
        self.configs.append(MusicLibraryConfig(controls))
        self.configs.append(TabsConfig(controls))
        self.configs.append(LastFmConfig(controls))
        self.configs.append(TrayIconConfig(controls))
        self.configs.append(NetworkConfig(controls))

        try:
            """check keybinder installed, debian"""
            import gi
            gi.require_version('Keybinder', '3.0')
            from gi.repository import Keybinder #@UnresolvedImport @UnusedImport
            from foobnix.preferences.configs.hotkey_conf import HotKeysConfig
            self.configs.append(HotKeysConfig(controls))
        except Exception, e:
            logging.warn("Keybinder not installed" + str(e))
Ejemplo n.º 26
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.StatusIcon.__init__(self)
        self.hide()
        ImageBase.__init__(self, ICON_FOOBNIX, 150)

        self.popup_menu = PopupMenuWindow(self.controls)
        self.popup_volume_contol = PopupVolumeWindow(self.controls, self.popup_menu)

        self.connect("activate", self.on_activate)
        self.connect("popup-menu", self.on_popup_menu)

        try:
            self.set_has_tooltip(True)
            #self.set_tooltip("Foobnix music player")
            self.connect("query-tooltip", self.on_query_tooltip)
            self.connect("button-press-event", self.on_button_press)
            self.connect("scroll-event", self.on_scroll)
        except Exception, e:
            logging.warn("Tooltip doesn't work " + str(e))
Ejemplo n.º 27
0
    def __init__(self, controls):
        FilterTreeControls.__init__(self, controls)

        FTreeModel.__init__(self)
        FControl.__init__(self, controls)

        self.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
        self.set_enable_tree_lines(True)

        """model config"""
        self.model = MyTreeStore(*FTreeModel().types())

        """filter config"""
        self.filter_model = self.model.filter_new()
        self.filter_model.set_visible_column(self.visible[0])
        self.set_model(self.filter_model)

        """connectors"""
        self.connect("button-press-event", self.on_button_press)
        self.connect("key-release-event", self.on_key_release)
        self.connect("row-expanded", self.on_row_expanded)
        self.connect('button_press_event', self.on_multi_button_press)
        self.connect('button_release_event', self.on_multi_button_release)

        self.count_index = 0

        self.set_reorderable(False)
        self.set_headers_visible(False)

        self.ellipsize_render = Gtk.CellRendererText.new()
        self.ellipsize_render.set_property('ellipsize', Pango.EllipsizeMode.END)

        self.set_type_plain()

        self.active_UUID = -1

        self.defer_select = False

        self.scroll = Gtk.ScrolledWindow()
        self.scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.scroll.add(self)
Ejemplo n.º 28
0
    def __init__(self, controls):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=0)
        FControl.__init__(self, controls)
        self.controls = controls

        label = Gtk.Label.new(None)
        label.set_markup("<b>%s:</b>" % _("Search music online"))
        """default search function"""
        self.search_function = self.controls.search_top_tracks
        self.buttons = []

        self.pack_start(self.search_line(), False, False, 0)

        #self.pack_start(controls.search_progress, False, False, 0)

        self.show_all()
        """search on enter"""
        for button in self.buttons:
            button.connect("key-press-event", self.on_search_key_press)
        """only one button active"""
        OneActiveToggledButton(self.buttons)
Ejemplo n.º 29
0
    def __init__(self, controls):
        FilterTreeControls.__init__(self, controls)

        FTreeModel.__init__(self)
        FControl.__init__(self, controls)

        self.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
        self.set_enable_tree_lines(True)
        """model config"""
        self.model = MyTreeStore(*FTreeModel().types())
        """filter config"""
        self.filter_model = self.model.filter_new()
        self.filter_model.set_visible_column(self.visible[0])
        self.set_model(self.filter_model)
        """connectors"""
        self.connect("button-press-event", self.on_button_press)
        self.connect("key-release-event", self.on_key_release)
        self.connect("row-expanded", self.on_row_expanded)
        self.connect('button_press_event', self.on_multi_button_press)
        self.connect('button_release_event', self.on_multi_button_release)

        self.count_index = 0

        self.set_reorderable(False)
        self.set_headers_visible(False)

        self.ellipsize_render = Gtk.CellRendererText.new()
        self.ellipsize_render.set_property('ellipsize',
                                           Pango.EllipsizeMode.END)

        self.set_type_plain()

        self.active_UUID = -1

        self.defer_select = False

        self.scroll = Gtk.ScrolledWindow()
        self.scroll.set_policy(Gtk.PolicyType.AUTOMATIC,
                               Gtk.PolicyType.AUTOMATIC)
        self.scroll.add(self)
Ejemplo n.º 30
0
    def __init__(self, controls, callback):
        self.callback = callback
        FControl.__init__(self, controls)
        ChildTopWindow.__init__(self, _("Equalizer"))

        self.combo = Gtk.ComboBoxText.new_with_entry()
        self.combo.connect("changed", self.on_combo_change)

        self.eq_lines = []
        for label in EQUALIZER_LABLES:
            self.eq_lines.append(EqLine(label, self.on_callback))

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        lbox.show()

        lbox.pack_start(self.top_row(), False, False, 0)
        lbox.pack_start(self.middle_lines_box(), False, False, 0)

        self.add(lbox)

        self.models = []
        self.default_models = []
Ejemplo n.º 31
0
    def __init__(self, controls, callback):
        self.callback = callback
        FControl.__init__(self, controls)
        ChildTopWindow.__init__(self, _("Equalizer"))

        self.combo = Gtk.ComboBoxText.new_with_entry()
        self.combo.connect("changed", self.on_combo_change)

        self.eq_lines = []
        for label in EQUALIZER_LABLES:
            self.eq_lines.append(EqLine(label, self.on_callback))

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        lbox.show()

        lbox.pack_start(self.top_row(), False, False, 0)
        lbox.pack_start(self.middle_lines_box(), False, False, 0)

        self.add(lbox)

        self.models = []
        self.default_models = []
Ejemplo n.º 32
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0)

        self.old_menu = MenuBarWidget(controls)

        self.pack_start(self.old_menu.widget, False, False, 0)

        menu_icon = "open-menu"
        if not icon_exists("open-menu"):
            menu_icon = "open-menu-symbolic"
        if not icon_exists("open-menu-symbolic"):
            menu_icon = "application-menu"

        self.new_menu_button = ImageButton(menu_icon, tooltip_text=_("Menu"))
        self.new_menu_button.connect("button-press-event", self.on_button_press)

        self.pack_start(self.new_menu_button,        False, False, 0)
        self.pack_start(controls.playback,           False, False, 0)
        self.pack_start(controls.os,                 False, False, 0)
        self.pack_start(controls.volume,             False, False, 0)
        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
        self.pack_start(controls.record,             False, False, 0)
        self.pack_start(controls.seek_bar,            True,  True, 0)

        """menu init"""
        menu = Popup()
        decorator = MenuStyleDecorator()
        MenuBarWidget(self.controls, menu)
        menu.add_separator()

        pref_icon = "gtk-preferences" if icon_exists("gtk-preferences") else "preferences-system"
        menu.add_item(_("Preferences"), pref_icon, self.controls.show_preferences)
        menu.add_separator()
        menu.add_item(_("Quit"), "application-exit", self.controls.quit)

        decorator.apply(menu)
        self.menu = menu
Ejemplo n.º 33
0
    def __init__(self, controls, seek_bar_movie=None):
        FControl.__init__(self, controls)
        self.seek_bar_movie = seek_bar_movie
        Gtk.Alignment.__init__(self,
                               xalign=0.5,
                               yalign=0.5,
                               xscale=1.0,
                               yscale=1.0)

        self.set_padding(padding_top=7,
                         padding_bottom=7,
                         padding_left=0,
                         padding_right=7)

        self.tooltip = Gtk.Window(Gtk.WindowType.POPUP)
        self.tooltip.set_position(Gtk.WindowPosition.CENTER)
        self.tooltip_label = Gtk.Label.new(None)
        self.tooltip.add(self.tooltip_label)

        self.progressbar = Gtk.ProgressBar()
        self.progressbar.set_ellipsize(Pango.EllipsizeMode.END)
        self.progressbar.set_property("show-text", True)
        self.progressbar.set_text("00:00 / 00:00")
        try:
            self.progressbar.set_has_tooltip(True)
        except:
            #fix debian compability
            pass

        event = Gtk.EventBox()
        event.add(self.progressbar)
        event.connect("button-press-event", self.on_seek)
        event.connect("leave-notify-event",
                      lambda *a: self.safe_hide_tooltip())
        event.connect("motion-notify-event", self.on_pointer_motion)
        self.add(event)
        self.show_all()
        self.tooltip.hide()
Ejemplo n.º 34
0
    def __init__(self, controls):
        Gtk.VBox.__init__(self, False, 0)
        FControl.__init__(self, controls)
        self.controls = controls

        label = Gtk.Label()
        label.set_markup("<b>%s:</b>" % _("Search music online"))

        """default search function"""
        self.search_function = self.controls.search_top_tracks
        self.buttons = []

        self.pack_start(self.search_line(), False, False, 0)

        #self.pack_start(controls.search_progress, False, False, 0)

        self.show_all()
        """search on enter"""
        for button in self.buttons:
            button.connect("key-press-event", self.on_search_key_press)

        """only one button active"""
        OneActiveToggledButton(self.buttons)
Ejemplo n.º 35
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.Frame.__init__(self)

        self.set_label_widget(notetab_label(self.hide))
        self.set_label_align(1.0, 0.0)
        self.set_border_width(0)

        self.smallscree_area = AdvancedDrawingArea(controls)
        self.smallscree_area.action_function = self.on_full_screen

        self.add(self.smallscree_area)

        self.fullscrean_area = FullScreanArea(controls, self.on_small_screen)

        def modyfy_background():
            for state in (Gtk.StateType.NORMAL, Gtk.STATE_PRELIGHT, Gtk.STATE_ACTIVE, Gtk.STATE_SELECTED, Gtk.STATE_INSENSITIVE):
                self.smallscree_area.modify_bg(state, self.smallscree_area.get_colormap().alloc_color("black"))
                self.fullscrean_area.draw.modify_bg(state, self.fullscrean_area.get_colormap().alloc_color("black"))
        # TODO Fix it
        #GLib.idle_add(modyfy_background)

        self.output = None
        self.set_output(self.smallscree_area)
Ejemplo n.º 36
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        LoadSave.__init__(self)

        self.eq_view = EqWindow(controls, self.on_eq_chaged)
        self.eq_view.hide()
Ejemplo n.º 37
0
    def __init__(self, controls, parent=None):
        FControl.__init__(self, controls)
        """TOP menu constructor"""

        decorator = MenuStyleDecorator()
        if not parent:
            parent = TopMenuBar()

        top = parent
        """File"""
        file = top.add_submenu(_("File"))
        file.add_image_item(_("Add File(s)"), "folder-open",
                            self.controls.on_add_files)
        file.add_image_item(_("Add Folder(s)"), "folder-open",
                            self.controls.on_add_folders)
        file.add_image_item(
            _("Save Playlist As"), "document-save-as",
            lambda: self.controls.notetabs.on_save_playlist(
                self.controls.notetabs.get_current_tree().scroll))
        file.separator()
        file.add_image_item(_("Quit"), "application-exit", self.controls.quit)
        """View"""
        view = top.add_submenu(_("View"))
        view.set_no_show_all(True)
        self.view_music_tree = view.add_check_item(
            _("Left Panel"),
            FC().is_view_music_tree_panel)
        self.view_music_tree.connect(
            "activate",
            lambda w: controls.layout.set_visible_musictree_panel(w.get_active(
            )))

        self.view_search_panel = view.add_check_item(_("Search Panel"),
                                                     FC().is_view_search_panel)
        self.view_search_panel.connect(
            "activate",
            lambda w: controls.layout.set_visible_search_panel(w.get_active()))

        self.view_cover_lyrics = view.add_check_item(
            _("Cover & Lyrics Panel"),
            FC().is_view_coverlyrics_panel)
        self.view_cover_lyrics.connect(
            "activate", lambda w: controls.layout.
            set_visible_coverlyrics_panel(w.get_active()))

        separator1 = view.separator()  #@UnusedVariable
        view.add_image_item(_("Equalizer"), "view-media-equalizer",
                            self.controls.eq.show)
        view.add_image_item(_("Download Manager"), "go-down",
                            self.controls.dm.show)
        separator2 = view.separator()
        preferences_item = view.add_image_item(_("Preferences"),
                                               "preferences-system",
                                               self.controls.show_preferences)
        """if new style menu - remove preferences from View"""
        if not isinstance(parent, TopMenuBar):
            separator2.hide()
            preferences_item.hide()
        """Playback"""
        playback = top.add_submenu(_("Playback"))

        def set_random(flag=True):
            FC().is_order_random = flag
            logging.debug("set random" + str(flag))
            controls.os.on_load()

        """Playback - Order"""
        order = playback.add_text_item(_("Order"), sub_menu=True)
        playback_radio_group = []
        self.playback_order_linear = order.add_radio_item(
            _("Linear"), playback_radio_group, not FC().is_order_random)
        self.playback_order_random = order.add_radio_item(
            _("Random"), playback_radio_group,
            FC().is_order_random)

        self.playback_order_linear.connect("activate",
                                           lambda w: set_random(False))
        self.playback_order_random.connect("activate",
                                           lambda w: set_random(True))
        """Playback - Repeat"""
        repeat = playback.add_text_item(_("Repeat"), sub_menu=True)
        repeat_radio_group = []
        self.lopping_all = repeat.add_radio_item(
            _("All"), repeat_radio_group,
            FC().repeat_state == const.REPEAT_ALL)
        self.lopping_single = repeat.add_radio_item(
            _("Single"), repeat_radio_group,
            FC().repeat_state == const.REPEAT_SINGLE)
        self.lopping_disable = repeat.add_radio_item(
            _("Disable"), repeat_radio_group,
            FC().repeat_state == const.REPEAT_NO)

        def repeat_all():
            FC().repeat_state = const.REPEAT_ALL
            logging.debug("set repeat_all")
            controls.os.on_load()

        def repeat_single():
            FC().repeat_state = const.REPEAT_SINGLE
            logging.debug("set repeat_single")
            controls.os.on_load()

        def repeat_no():
            FC().repeat_state = const.REPEAT_NO
            logging.debug("set repeat_no")
            controls.os.on_load()

        self.lopping_all.connect("activate", lambda *a: repeat_all())
        self.lopping_single.connect("activate", lambda *a: repeat_single())
        self.lopping_disable.connect("activate", lambda *a: repeat_no())
        """Playlist View"""
        #playlist = playback.add_text_item("Playlist")
        #self.playlist_plain = playlist.add_radio_item("Plain (normal style)", None, FC().playlist_type == const.PLAYLIST_PLAIN)
        #self.playlist_tree = playlist.add_radio_item("Tree (apollo style)", self.playlist_plain , FC().playlist_type == const.PLAYLIST_TREE)

        #self.playlist_plain.connect("activate", lambda w: w.get_active() and controls.set_playlist_plain())
        #self.playlist_tree.connect("activate", lambda w: w.get_active() and controls.set_playlist_tree())
        """Help"""
        help = top.add_submenu(_("Help"))
        help.add_image_item(_("About"), "help-about", self.show_about)
        help.separator()
        help.add_image_item(
            _("Project page"), "applications-internet",
            lambda *a: open_link_in_browser(
                _("http://www.foobnix.com/news/eng")))
        help.add_image_item(
            _("Issue report"), "dialog-warning",
            lambda *a: open_link_in_browser(
                "http://code.google.com/p/foobnix/issues/list"))
        help.separator()
        help.add_image_item(
            _("Donate Participate"), "help-donate",
            lambda *a: open_link_in_browser(
                _("http://www.foobnix.com/donate/eng")))

        #help.add_image_item("Help", "help-contents")

        #top.decorate()

        decorator.apply(top)
        decorator.apply(file)
        decorator.apply(view)
        decorator.apply(playback)
        decorator.apply(repeat)
        decorator.apply(order)
        decorator.apply(help)

        self.widget = top

        self.on_load()
Ejemplo n.º 38
0
 def __init__(self, controls):
     Gtk.Statusbar.__init__(self)
     FControl.__init__(self, controls)
     self.show()
     self.get_children()[0].set_shadow_type(Gtk.ShadowType.NONE)
Ejemplo n.º 39
0
    def __init__(self, controls, parent=None):
        FControl.__init__(self, controls)
        """TOP menu constructor"""

        decorator = MenuStyleDecorator()
        if not parent:
            parent = TopMenuBar()

        top = parent

        """File"""
        file = top.add_submenu(_("File"))
        file.add_image_item(_("Add File(s)"), Gtk.STOCK_OPEN, self.controls.on_add_files)
        file.add_image_item(_("Add Folder(s)"), Gtk.STOCK_OPEN, self.controls.on_add_folders)
        file.add_image_item(_("Save Playlist As"), Gtk.STOCK_SAVE_AS,
                            lambda: self.controls.notetabs.on_save_playlist(self.controls.notetabs.get_current_tree().scroll))
        file.separator()
        file.add_image_item(_("Quit"), Gtk.STOCK_QUIT, self.controls.quit)

        """View"""
        view = top.add_submenu(_("View"))
        view.set_no_show_all(True)
        self.view_music_tree = view.add_check_item(_("Left Panel"), FC().is_view_music_tree_panel)
        self.view_music_tree.connect("activate", lambda w: controls.layout.set_visible_musictree_panel(w.get_active()))

        self.view_search_panel = view.add_check_item(_("Search Panel"), FC().is_view_search_panel)
        self.view_search_panel.connect("activate", lambda w: controls.layout.set_visible_search_panel(w.get_active()))

        self.view_cover_lyrics = view.add_check_item(_("Cover & Lyrics Panel"), FC().is_view_coverlyrics_panel)
        self.view_cover_lyrics.connect("activate", lambda w: controls.layout.set_visible_coverlyrics_panel(w.get_active()))

        separator1 = view.separator() #@UnusedVariable
        view.add_image_item(_("Equalizer"), None, self.controls.eq.show)
        view.add_image_item(_("Download Manager"), None, self.controls.dm.show)
        separator2 = view.separator()
        preferences_item = view.add_image_item(_("Preferences"), Gtk.STOCK_PREFERENCES, self.controls.show_preferences)

        """if new style menu - remove preferences from View"""
        if not isinstance(parent, TopMenuBar):
            separator2.hide()
            preferences_item.hide()

        """Playback"""
        playback = top.add_submenu(_("Playback"))

        def set_random(flag=True):
            FC().is_order_random = flag
            logging.debug("set random" + str(flag))
            controls.os.on_load()

        """Playback - Order"""
        order = playback.add_text_item(_("Order"))
        playback_radio_group = []
        self.playback_order_linear = order.add_radio_item(_("Linear"), playback_radio_group, not FC().is_order_random)
        self.playback_order_linear.connect("activate", lambda w: set_random(False))

        self.playback_order_random = order.add_radio_item(_("Random"), playback_radio_group, FC().is_order_random)
        self.playback_order_random.connect("activate", lambda w: set_random(True))

        """Playback - Repeat"""
        repeat = playback.add_text_item(_("Repeat"))
        repeat_radio_group = []
        self.lopping_all = repeat.add_radio_item(_("All"), repeat_radio_group, FC().repeat_state == const.REPEAT_ALL)
        self.lopping_single = repeat.add_radio_item(_("Single"), repeat_radio_group, FC().repeat_state == const.REPEAT_SINGLE)
        self.lopping_disable = repeat.add_radio_item(_("Disable"), repeat_radio_group, FC().repeat_state == const.REPEAT_NO)

        def repeat_all():
            FC().repeat_state = const.REPEAT_ALL
            logging.debug("set repeat_all")
            controls.os.on_load()


        def repeat_sigle():
            FC().repeat_state = const.REPEAT_SINGLE
            logging.debug("set repeat_sigle")
            controls.os.on_load()

        def repeat_no():
            FC().repeat_state = const.REPEAT_NO
            logging.debug("set repeat_no")
            controls.os.on_load()

        self.lopping_all.connect("activate", lambda * a:repeat_all())
        self.lopping_single.connect("activate", lambda * a:repeat_sigle())
        self.lopping_disable.connect("activate", lambda * a:repeat_no())

        """Playlist View"""
        #playlist = playback.add_text_item("Playlist")
        #self.playlist_plain = playlist.add_radio_item("Plain (normal style)", None, FC().playlist_type == const.PLAYLIST_PLAIN)
        #self.playlist_tree = playlist.add_radio_item("Tree (apollo style)", self.playlist_plain , FC().playlist_type == const.PLAYLIST_TREE)

        #self.playlist_plain.connect("activate", lambda w: w.get_active() and controls.set_playlist_plain())
        #self.playlist_tree.connect("activate", lambda w: w.get_active() and controls.set_playlist_tree())

        """Help"""
        help = top.add_submenu(_("Help"))
        help.add_image_item(_("About"), Gtk.STOCK_ABOUT, self.show_about)
        help.separator()
        help.add_text_item(_("Project page"), lambda * a:open_link_in_browser(_("http://www.foobnix.com/news/eng")), None, False)
        help.add_image_item(_("Issue report"), Gtk.STOCK_DIALOG_WARNING, lambda * a:open_link_in_browser("http://code.google.com/p/foobnix/issues/list"))
        help.separator()
        help.add_image_item(_("Donate Participate"), Gtk.STOCK_DIALOG_QUESTION, lambda * a:open_link_in_browser(_("http://www.foobnix.com/donate/eng")))

        #help.add_image_item("Help", Gtk.STOCK_HELP)

        #top.decorate()

        decorator.apply(top)
        decorator.apply(file)
        decorator.apply(view)
        decorator.apply(playback)
        decorator.apply(repeat)
        decorator.apply(order)
        decorator.apply(help)

        self.widget = top

        self.on_load()
Ejemplo n.º 40
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        LoadSave.__init__(self)

        self.eq_view = EqWindow(controls, self.on_eq_chaged)
        self.eq_view.hide()
Ejemplo n.º 41
0
 def __init__(self, controls):
     FControl.__init__(self, controls)
     thread.start_new_thread(self.lazy_init, (True, ))
Ejemplo n.º 42
0
    def __init__(self, controls):
        Gtk.Frame.__init__(self)
        FControl.__init__(self, controls)

        self.album_label = Gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)

        self.empty = TextArea()

        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current,
                                                arg=self.best_songs, func1=self.show_best_songs)

        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current,
                                             arg=self.artists, func1=self.show_similar_artists)

        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current,
                                            arg=self.tracks, func1=self.show_similar_tracks)

        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current,
                                          arg=self.tags, func1=self.show_similar_tags)

        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current,
                                            arg=self.lyrics, func1=self.show_similar_lyrics)

        """wiki"""
        wBox = Gtk.VBox()
        wiki_title = _("About Artist")
        self.wiki = TextArea()

        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)

        """info"""
        self.last_fm_label = Gtk.LinkButton("http://www.last.fm", "Last.Fm")
        self.wiki_label = Gtk.LinkButton("http://www.wikipedia.org", "Wikipedia")
        info_line = HBoxDecoratorTrue(self.last_fm_label, self.wiki_label)
        info_frame = FrameDecorator(_("Info"), info_line, 0.5, 0.5)

        """downloads"""
        self.exua_label = Gtk.LinkButton("http://www.ex.ua", "EX.ua")
        self.rutracker_label = Gtk.LinkButton("http://rutracker.org", "Rutracker")
        dm_line = HBoxDecoratorTrue(self.exua_label, self.rutracker_label)
        dm_frame = FrameDecorator(_("Downloads"), dm_line, 0.5, 0.5)

        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)

        wBox.pack_start(HBoxDecoratorTrue(info_frame, dm_frame), False, False, 0)
        wBox.pack_start(self.wiki, True, True, 0)

        wBox.scroll = wBox

        self.vpaned_small = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        """image and similar artists"""
        ibox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]

        for l_widget in self.left_widget:
            lbox.pack_start(l_widget.line_title, True, True, 0)

        ibox.pack_start(self.image, False, False, 0)
        ibox.pack_start(lbox, True, True, 0)

        """image and similar artists"""
        sbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        for l_widget in self.left_widget:
            sbox.pack_start(l_widget.scroll, True, True, 0)

        sbox.pack_end(self.empty.scroll, True, True, 0)

        self.vpaned_small.pack_start(ibox, False, False, 0)
        self.vpaned_small.pack_start(sbox, True, True, 0)

        self.add(self.vpaned_small)

        self.bean = None
        self.info_cache = InfoCache()
        self.update_lock = threading.Lock()
        self.clear()
Ejemplo n.º 43
0
    def __init__(self, controls):
        Gtk.Frame.__init__(self)
        FControl.__init__(self, controls)

        self.album_label = Gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)

        self.empty = TextArea()

        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current,
                                                arg=self.best_songs, func1=self.show_best_songs)

        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current,
                                             arg=self.artists, func1=self.show_similar_artists)

        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current,
                                            arg=self.tracks, func1=self.show_similar_tracks)

        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current,
                                          arg=self.tags, func1=self.show_similar_tags)

        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current,
                                            arg=self.lyrics, func1=self.show_similar_lyrics)

        """wiki"""
        wBox = Gtk.VBox()
        wiki_title = _("About Artist")
        self.wiki = TextArea()

        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)

        """info"""
        info_frame = Gtk.Frame(label=_("Info"))

        self.last_fm_label = Gtk.LinkButton("http://www.last.fm", "Last.Fm")
        self.wiki_label = Gtk.LinkButton("http://www.wikipedia.org", "Wikipedia")

        info_line = HBoxDecoratorTrue(self.last_fm_label, self.wiki_label)
        info_frame.add(info_line)

        """downloads"""
        dm_frame = Gtk.Frame(label=_("Downloads"))

        self.exua_label = Gtk.LinkButton("http://www.ex.ua", "EX.ua")
        self.rutracker_label = Gtk.LinkButton("http://rutracker.org", "Rutracker")

        dm_line = HBoxDecoratorTrue(self.exua_label, self.rutracker_label)
        dm_frame.add(dm_line)

        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)

        wBox.pack_start(HBoxDecoratorTrue(info_frame, dm_frame), False, False, 0)
        wBox.pack_start(self.wiki, True, True, 0)

        wBox.scroll = wBox

        self.vpaned_small = Gtk.VBox(False, 0)

        """image and similar artists"""
        ibox = Gtk.HBox(False, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)

        lbox = Gtk.VBox(False, 0)

        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]

        for l_widget in self.left_widget:
            lbox.pack_start(l_widget.line_title, True, True, 0)

        ibox.pack_start(self.image, False, False, 0)
        ibox.pack_start(lbox, True, True, 0)

        """image and similar artists"""
        sbox = Gtk.VBox(False, 0)

        for l_widget in self.left_widget:
            sbox.pack_start(l_widget.scroll, True, True, 0)

        sbox.pack_end(self.empty.scroll, True, True, 0)

        self.vpaned_small.pack_start(ibox, False, False, 0)
        self.vpaned_small.pack_start(sbox, True, True, 0)

        self.add(self.vpaned_small)

        self.bean = None
        self.info_cache = InfoCache()
        self.update_lock = threading.Lock()
        self.clear()
Ejemplo n.º 44
0
 def __init__(self, controls):
     FControl.__init__(self, controls)
     thread.start_new_thread(self.lazy_init, (True,) )
Ejemplo n.º 45
0
    def __init__(self, controls, parent=None):
        FControl.__init__(self, controls)
        """TOP menu constructor"""

        decorator = MenuStyleDecorator()
        if not parent:
            parent = TopMenuBar()

        top = parent

        """File"""
        file = top.add_submenu(_("File"))
        file.add_image_item(_("Add File(s)"),      "folder-open",      self.controls.on_add_files)
        file.add_image_item(_("Add Folder(s)"),    "folder-open",      self.controls.on_add_folders)
        file.add_image_item(_("Save Playlist As"), "document-save-as", lambda: self.controls.notetabs.on_save_playlist(
            self.controls.notetabs.get_current_tree().scroll))
        file.separator()
        file.add_image_item(_("Quit"),             "application-exit", self.controls.quit)

        """View"""
        view = top.add_submenu(_("View"))
        view.set_no_show_all(True)
        self.view_music_tree = view.add_check_item(_("Left Panel"), FC().is_view_music_tree_panel)
        self.view_music_tree.connect("activate", lambda w: controls.layout.set_visible_musictree_panel(w.get_active()))

        self.view_search_panel = view.add_check_item(_("Search Panel"), FC().is_view_search_panel)
        self.view_search_panel.connect("activate", lambda w: controls.layout.set_visible_search_panel(w.get_active()))

        self.view_cover_lyrics = view.add_check_item(_("Cover & Lyrics Panel"), FC().is_view_coverlyrics_panel)
        self.view_cover_lyrics.connect("activate", lambda w: controls.layout.set_visible_coverlyrics_panel(w.get_active()))

        equalizer_icon = "view-media-equalizer" if icon_exists("view-media-equalizer") else "format-justify-right"
        view.add_image_item(_("Equalizer"),        equalizer_icon, self.controls.eq.show)
        view.add_image_item(_("Download Manager"), "go-down",      self.controls.dm.show)
        separator = view.separator()

        pref_icon = "gtk-preferences" if icon_exists("gtk-preferences") else "preferences-system"
        preferences_item = view.add_image_item(_("Preferences"), pref_icon, self.controls.show_preferences)

        """if new style menu - remove preferences from View"""
        if not isinstance(parent, TopMenuBar):
            separator.hide()
            preferences_item.hide()

        """Playback"""
        playback = top.add_submenu(_("Playback"))

        def set_random(flag=True):
            FC().is_order_random = flag
            logging.debug("set random" + str(flag))
            controls.os.on_load()

        """Playback - Order"""
        order = playback.add_text_item(_("Order"), sub_menu=True)
        playback_radio_group = []
        self.playback_order_linear = order.add_radio_item(_("Linear"), playback_radio_group, not FC().is_order_random)
        self.playback_order_random = order.add_radio_item(_("Random"), playback_radio_group, FC().is_order_random)

        self.playback_order_linear.connect("activate", lambda w: set_random(False))
        self.playback_order_random.connect("activate", lambda w: set_random(True))

        """Playback - Repeat"""
        repeat = playback.add_text_item(_("Repeat"), sub_menu=True)
        repeat_radio_group = []
        self.lopping_all     = repeat.add_radio_item(_("All"),     repeat_radio_group, FC().repeat_state == const.REPEAT_ALL)
        self.lopping_single  = repeat.add_radio_item(_("Single"),  repeat_radio_group, FC().repeat_state == const.REPEAT_SINGLE)
        self.lopping_disable = repeat.add_radio_item(_("Disable"), repeat_radio_group, FC().repeat_state == const.REPEAT_NO)

        def repeat_all():
            FC().repeat_state = const.REPEAT_ALL
            logging.debug("set repeat_all")
            controls.os.on_load()

        def repeat_single():
            FC().repeat_state = const.REPEAT_SINGLE
            logging.debug("set repeat_single")
            controls.os.on_load()

        def repeat_no():
            FC().repeat_state = const.REPEAT_NO
            logging.debug("set repeat_no")
            controls.os.on_load()

        self.lopping_all    .connect("activate", lambda * a:repeat_all())
        self.lopping_single .connect("activate", lambda * a:repeat_single())
        self.lopping_disable.connect("activate", lambda * a:repeat_no())

        """Playlist View"""
        #playlist = playback.add_text_item("Playlist")
        #self.playlist_plain = playlist.add_radio_item("Plain (normal style)", None, FC().playlist_type == const.PLAYLIST_PLAIN)
        #self.playlist_tree = playlist.add_radio_item("Tree (apollo style)", self.playlist_plain , FC().playlist_type == const.PLAYLIST_TREE)

        #self.playlist_plain.connect("activate", lambda w: w.get_active() and controls.set_playlist_plain())
        #self.playlist_tree.connect("activate", lambda w: w.get_active() and controls.set_playlist_tree())

        """Help"""
        help = top.add_submenu(_("Help"))
        help.add_image_item(_("About"), "help-about", self.show_about)
        help.separator()
        help.add_image_item(_("Project page"), "applications-internet", lambda * a:open_link_in_browser(_("http://www.foobnix.com")))
        help.add_image_item(_("Issue report"), "dialog-warning", lambda * a:open_link_in_browser("https://github.com/foobnix/foobnix/issues"))
        help.separator()
        help.add_image_item(_("Donate Participate"), "help-donate", lambda * a:open_link_in_browser(_("http://foobnix.com/en/faq.html#/faq4")))

        #help.add_image_item("Help", "help-contents")

        #top.decorate()

        decorator.apply(top)
        decorator.apply(file)
        decorator.apply(view)
        decorator.apply(playback)
        decorator.apply(repeat)
        decorator.apply(order)
        decorator.apply(help)

        self.widget = top

        self.on_load()
Ejemplo n.º 46
0
 def __init__(self, controls):
     FControl.__init__(self, controls)
     self.status = MediaPlayerStatus()
Ejemplo n.º 47
0
    def __init__(self, controls):
        FControl.__init__(self, controls)
        """ set application stylesheet"""
        self.style_provider = Gtk.CssProvider()
        ## TODO: after moving style to resource - replace to load_from_file
        self.style_provider.load_from_data(foobnix_style)
        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(), self.style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

        self.controls = controls
        bbox = Gtk.VBox(False, 0)
        notebox = Gtk.Overlay.new()
        notebox.add(controls.notetabs)
        notebox.add_overlay(controls.search_progress)

        bbox.pack_start(notebox, True, True, 0)
        #bbox.pack_start(controls.movie_window, False, False, 0)

        center_box = Gtk.VBox(False, 0)
        center_box.pack_start(controls.searchPanel, False, False, 0)
        center_box.pack_start(bbox, True, True, 0)

        self.hpaned_left = Gtk.HPaned()
        self.hpaned_left.connect("motion-notify-event", self.on_motion)

        self.hpaned_left.pack1(child=controls.perspectives,
                               resize=True,
                               shrink=True)
        self.hpaned_left.pack2(child=center_box, resize=True, shrink=True)

        self.hpaned_right = Gtk.HPaned()
        self.hpaned_right.connect("motion-notify-event", self.on_motion)
        self.hpaned_right.pack1(child=self.hpaned_left,
                                resize=True,
                                shrink=True)
        self.hpaned_right.pack2(child=controls.coverlyrics,
                                resize=True,
                                shrink=False)

        vbox = Gtk.VBox(False, 0)
        vbox.pack_start(controls.top_panel, False, False, 0)
        vbox.pack_start(self.hpaned_right, True, True, 0)
        vbox.pack_start(controls.statusbar, False, True, 0)
        vbox.show_all()

        self.hpaned_left.connect("button-press-event", self.on_border_press)
        self.hpaned_right.connect("button-press-event", self.on_border_press)
        self.hpaned_left.connect("button-release-event",
                                 self.on_border_release)
        self.hpaned_right.connect("button-release-event",
                                  self.on_border_release)
        self.id_handler_left = self.hpaned_left.connect(
            "size-allocate", self.on_configure_hl_event)
        self.id_handler_right = self.hpaned_right.connect(
            "size-allocate", self.on_configure_hr_event)

        self.hpaned_press_release_handler_blocked = False

        controls.main_window.connect("configure-event",
                                     self.on_configure_event)
        controls.main_window.add(vbox)
Ejemplo n.º 48
0
 def __init__(self, controls):
     FControl.__init__(self, controls)
     self.status = MediaPlayerStatus()