当前位置: 首页>>代码示例>>Python>>正文


Python view_container.ViewContainer类代码示例

本文整理汇总了Python中lollypop.view_container.ViewContainer的典型用法代码示例。如果您正苦于以下问题:Python ViewContainer类的具体用法?Python ViewContainer怎么用?Python ViewContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ViewContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self):
     """
         Init popover
     """
     ViewContainer.__init__(self, 1000)
     self.connect('destroy', self.__on_destroy)
     self.__track = Track()
开发者ID:blackjackshellac,项目名称:lollypop,代码行数:7,代码来源:view_artist_albums.py

示例2: __init__

 def __init__(self):
     """
         Init popover
     """
     ViewContainer.__init__(self, 1000)
     self.connect('destroy', self._on_destroy)
     self._current = (Type.NONE, Type.NONE)
开发者ID:oleastre,项目名称:lollypop,代码行数:7,代码来源:view_artist_albums.py

示例3: __init__

 def __init__(self, artist_id=None):
     """
         Init popover
     """
     ViewContainer.__init__(self, 1000)
     self.connect("destroy", self._on_destroy)
     self._artist_id = artist_id
开发者ID:kenden,项目名称:lollypop,代码行数:7,代码来源:view_artist_albums.py

示例4: __init__

 def __init__(self, artist_id=None):
     """
         Init popover
     """
     ViewContainer.__init__(self, 1000)
     self.connect('destroy', self._on_destroy)
     self._artist_id = artist_id
     self._on_screen_id = None
     self._signal1_id = Lp.player.connect("current-changed",
                                          self._update_content)
     if self._artist_id is None:
         self._signal2_id = Lp.player.connect("current-changed",
                                              self._update_content)
     else:
         self._signal2_id = None
开发者ID:sebfag,项目名称:lollypop,代码行数:15,代码来源:view_artist_albums.py

示例5: __init__

    def __init__(self):
        
        # Try to update db on start, will be done after list one poplating
        # finished
        self._need_to_update_db = True
        # Index will start at -VOLUMES
        self._devices = {}
        self._devices_index = Navigation.DEVICES
        self._show_genres = Objects.settings.get_value('show-genres')
        self._stack = ViewContainer(500)
        self._stack.show()

        self._setup_view()
        self._setup_scanner()

        self._list_one_restore = Navigation.POPULARS
        self._list_two_restore = Navigation.NONE
        if Objects.settings.get_value('save-state'):
            self._restore_view_state()

        # Volume manager
        self._vm = Gio.VolumeMonitor.get()
        self._vm.connect('mount-added', self._on_mount_added)
        self._vm.connect('mount-removed', self._on_mount_removed)

        Objects.playlists.connect("playlists-changed",
                                  self.update_lists)
开发者ID:horst3180,项目名称:lollypop,代码行数:27,代码来源:container.py

示例6: __init__

    def __init__(self, navigation_id):
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = navigation_id
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect("child-activated", self._on_album_activated)
        self._albumbox.set_max_children_per_line(100)
        self._albumbox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow)
        self._paned.pack2(self._context, True, False)
        height = Objects.settings.get_value(
                                         'paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Objects.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)
开发者ID:horst3180,项目名称:lollypop,代码行数:35,代码来源:view_album.py

示例7: __init__

    def __init__(self, album_id):
        Gtk.Popover.__init__(self)
        self._album_id = album_id

        self._stack = ViewContainer(1000)
        self._stack.show()

        builder = Gtk.Builder()
        builder.add_from_resource(
                    '/org/gnome/Lollypop/PopImages.ui')

        self._view = Gtk.FlowBox()
        self._view.set_selection_mode(Gtk.SelectionMode.NONE)
        self._view.connect("child-activated", self._on_activate)
        self._view.show()

        builder.get_object('viewport').add(self._view)

        self._widget = builder.get_object('widget')
        self._spinner = builder.get_object('spinner')
        self._not_found = builder.get_object('notfound')
        self._stack.add(self._spinner)
        self._stack.add(self._not_found)
        self._stack.add(self._widget)
        self._stack.set_visible_child(self._spinner)
        self.add(self._stack)
开发者ID:horst3180,项目名称:lollypop,代码行数:26,代码来源:popimages.py

示例8: __init__

    def __init__(self):
        """
            Init container
        """
        self._pulse_timeout = None
        # Index will start at -VOLUMES
        self._devices = {}
        self._devices_index = Type.DEVICES
        self._show_genres = Lp().settings.get_value('show-genres')
        self._stack = ViewContainer(500)
        self._stack.show()

        self._setup_view()
        self._setup_scanner()

        (list_one_ids, list_two_ids) = self._get_saved_view_state()
        if list_one_ids and list_one_ids[0] != Type.NONE:
            self._list_one.select_ids(list_one_ids)
        if list_two_ids and list_two_ids[0] != Type.NONE:
            self._list_two.select_ids(list_two_ids)

        # Volume manager
        self._vm = Gio.VolumeMonitor.get()
        self._vm.connect('mount-added', self._on_mount_added)
        self._vm.connect('mount-removed', self._on_mount_removed)
        for mount in self._vm.get_mounts():
            self._add_device(mount, False)

        Lp().playlists.connect('playlists-changed',
                               self._update_playlists)
开发者ID:ktkr3d,项目名称:lollypop,代码行数:30,代码来源:container.py

示例9: __init__

    def __init__(self):

        # Try to update db on start, will be done after list one populating
        # finished
        self._need_to_update_db = Lp.settings.get_value('auto-update') or\
            Lp.tracks.is_empty()
        # Index will start at -VOLUMES
        self._devices = {}
        self._devices_index = Type.DEVICES
        self._show_genres = Lp.settings.get_value('show-genres')
        self._stack = ViewContainer(500)
        self._stack.show()

        self._setup_view()
        self._setup_scanner()

        (list_one_id, list_two_id) = self._get_saved_view_state()
        self._list_one.select_id(list_one_id)
        self._list_two.select_id(list_two_id)

        # Volume manager
        self._vm = Gio.VolumeMonitor.get()
        self._vm.connect('mount-added', self._on_mount_added)
        self._vm.connect('mount-removed', self._on_mount_removed)

        Lp.playlists.connect('playlists-changed',
                             self._update_lists)
开发者ID:yoseforb,项目名称:lollypop,代码行数:27,代码来源:container.py

示例10: __init__

    def __init__(self):
        """
            Init container
        """
        # Index will start at -VOLUMES
        self._devices = {}
        self._devices_index = Type.DEVICES
        self._show_genres = Lp.settings.get_value('show-genres')
        self._stack = ViewContainer(500)
        self._stack.show()

        self._setup_view()
        self._setup_scanner()

        (list_one_id, list_two_id) = self._get_saved_view_state()
        self._list_one.select_id(list_one_id)
        self._list_two.select_id(list_two_id)

        # Volume manager
        self._vm = Gio.VolumeMonitor.get()
        self._vm.connect('mount-added', self._on_mount_added)
        self._vm.connect('mount-removed', self._on_mount_removed)

        Lp.playlists.connect('playlists-changed',
                             self._update_lists)
开发者ID:serkanalgur,项目名称:lollypop,代码行数:25,代码来源:container.py

示例11: __init__

    def __init__(self):
        Gtk.Popover.__init__(self)
        self._stack = ViewContainer(1000)
        self._stack.show()

        self._on_screen_id = None
        self.add(self._stack)

        Lp.player.connect("current-changed", self._update_content)
开发者ID:yoseforb,项目名称:lollypop,代码行数:9,代码来源:pop_albums.py

示例12: __init__

    def __init__(self, name, radios_manager):
        """
            Init Popover
            @param name as string
            @param radios_manager as RadiosManager
        """
        Gtk.Popover.__init__(self)
        self.connect('map', self._on_map)
        self.connect('unmap', self._on_unmap)
        self._name = name
        self._radios_manager = radios_manager
        self._start = 0
        self._orig_pixbufs = {}

        self._stack = ViewContainer(1000)
        self._stack.show()

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/RadioPopover.ui')
        builder.connect_signals(self)

        self._view = Gtk.FlowBox()
        self._view.set_selection_mode(Gtk.SelectionMode.NONE)
        self._view.connect('child-activated', self._on_activate)
        self._view.set_max_children_per_line(100)
        self._view.set_property('row-spacing', 10)
        self._view.show()

        builder.get_object('viewport').add(self._view)

        self._widget = builder.get_object('widget')
        self._logo = builder.get_object('logo')
        self._spinner = builder.get_object('spinner')
        self._not_found = builder.get_object('notfound')
        self._name_entry = builder.get_object('name')
        self._uri_entry = builder.get_object('uri')
        self._btn_add_modify = builder.get_object('btn_add_modify')
        self._stack.add(self._spinner)
        self._stack.add(self._not_found)
        self._stack.add(self._logo)
        self._stack.add(self._widget)
        self._stack.set_visible_child(self._widget)
        self.add(self._stack)

        if self._name == '':
            builder.get_object('btn_add_modify').set_label(_("Add"))
        else:
            builder.get_object('btn_add_modify').set_label(_("Modify"))
            builder.get_object('btn_delete').show()
            self._name_entry.set_text(self._name)
            uris = self._radios_manager.get_tracks(self._name)
            if len(uris) > 0:
                self._uri_entry.set_text(uris[0])
开发者ID:kenden,项目名称:lollypop,代码行数:53,代码来源:pop_radio.py

示例13: __init__

    def __init__(self, genre_id, is_compilation):
        """
            Init album view
            @param genre id as int
            @param is compilation as bool
        """
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = genre_id
        self._is_compilation = is_compilation
        self._albumsongs = None
        self._context_widget = None
        self._press_rect = None
        self._lazy_queue = []  # Widgets not initialized
        self._scroll_value = 0
        self._timeout_id = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect('child-activated', self._on_album_activated)
        self._albumbox.connect('button-press-event', self._on_button_press)
        self._albumbox.set_property('column-spacing', 5)
        self._albumbox.set_property('row-spacing', 5)
        self._albumbox.set_homogeneous(True)
        self._albumbox.set_max_children_per_line(1000)
        self._albumbox.show()

        self._viewport.set_property('valign', Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._scrolled.set_property('expand', True)
        self._scrolled.get_vadjustment().connect('value-changed',
                                                 self._on_value_changed)
        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolled, True, False)
        self._paned.pack2(self._context, False, False)
        height = Lp().settings.get_value('paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Lp().window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)
开发者ID:IxianPixel,项目名称:lollypop,代码行数:49,代码来源:view_albums.py

示例14: __init__

    def __init__(self, genre_ids, artist_ids):
        """
            Init album view
            @param genre ids as [int]
            @param artist ids as [int]
        """
        LazyLoadingView.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_ids = genre_ids
        self._artist_ids = artist_ids
        self._albumsongs = None
        self._context_widget = None
        self._press_rect = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect('child-activated', self._on_album_activated)
        self._albumbox.connect('button-press-event', self._on_button_press)
        self._albumbox.set_property('column-spacing', 5)
        self._albumbox.set_property('row-spacing', 5)
        self._albumbox.set_homogeneous(True)
        self._albumbox.set_max_children_per_line(1000)
        self._albumbox.show()

        self._viewport.set_property('valign', Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._scrolled.set_property('expand', True)
        self._scrolled.set_property('height-request', 10)
        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolled, True, False)
        self._paned.pack2(self._context, False, False)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)
开发者ID:coconutlulz,项目名称:lollypop,代码行数:40,代码来源:view_albums.py

示例15: AlbumView

class AlbumView(View):
    """
        Init album view ui with a scrolled flow box and a scrolled context view
        @param navigation id as int
    """
    def __init__(self, navigation_id):
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = navigation_id
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect("child-activated", self._on_album_activated)
        self._albumbox.set_max_children_per_line(100)
        self._albumbox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow)
        self._paned.pack2(self._context, True, False)
        height = Objects.settings.get_value(
                                         'paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Objects.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)

    """
        Populate albums, thread safe
        @param navigation id as int
    """
    def populate(self, navigation_id):
        sql = Objects.db.get_cursor()
        if self._genre_id == Navigation.ALL:
            albums = Objects.albums.get_ids(None, None, sql)
        elif self._genre_id == Navigation.POPULARS:
            albums = Objects.albums.get_populars(sql)
        elif self._genre_id == Navigation.RECENTS:
            albums = Objects.albums.get_recents(sql)
        elif self._genre_id == Navigation.COMPILATIONS:
            albums = Objects.albums.get_compilations(navigation_id,
                                                     sql)
        else:
            albums = Objects.albums.get_ids(None, self._genre_id, sql)
        GLib.idle_add(self._add_albums, albums)
        sql.close()

#######################
# PRIVATE             #
#######################
    """
        Return view children
        @return [AlbumWidget]
    """
    def _get_children(self):
        children = []
        for child in self._albumbox.get_children():
            for widget in child.get_children():
                children.append(widget)
        return children

    """
        populate context view
        @param album id as int
    """
    def _populate_context(self, album_id):
        size_group = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
        self._context_widget = AlbumDetailedWidget(album_id,
                                                   self._genre_id,
                                                   True,
                                                   True,
                                                   size_group)
        start_new_thread(self._context_widget.populate, ())
        self._context_widget.show()
        view = AlbumContextView(self._context_widget)
        view.show()
        self._context.add(view)
        self._context.set_visible_child(view)
        self._context.clean_old_views(view)

    """
        Save paned position
        @param paned as Gtk.Paned
        @param param as Gtk.Param
    """
    def _on_position_notify(self, paned, param):
#.........这里部分代码省略.........
开发者ID:horst3180,项目名称:lollypop,代码行数:101,代码来源:view_album.py


注:本文中的lollypop.view_container.ViewContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。