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


Python qltk.selection_set_songs函数代码示例

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


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

示例1: test_drag_data_get

 def test_drag_data_get(self):
     b = self.bar
     song = AudioFile()
     song["~filename"] = fsnative(u"foo")
     sel = MockSelData()
     qltk.selection_set_songs(sel, [song])
     b._drag_data_get(None, None, sel, DND_QL, None)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_browsers_playlists.py

示例2: __drag_data_get

    def __drag_data_get(self, view, ctx, sel, tid, etime):
        songs = self.__get_selected_songs(sort=True)

        if tid == self.TARGET_INFO_QL:
            qltk.selection_set_songs(sel, songs)
        else:
            sel.set_uris([song("~uri") for song in songs])
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:7,代码来源:pane.py

示例3: __drag_data_get

    def __drag_data_get(self, view, ctx, sel, tid, etime):
        model, paths = self.get_selection().get_selected_rows()
        if tid == DND_QL:
            songs = [model[path][0] for path in paths
                     if model[path][0].can_add]
            if len(songs) != len(paths):
                qltk.ErrorMessage(
                    qltk.get_top_parent(self), _("Unable to copy songs"),
                    _("The files selected cannot be copied to other "
                      "song lists or the queue.")).run()
                Gdk.drag_abort(ctx, etime)
                return

            qltk.selection_set_songs(sel, songs)

            # DEM 2018/05/25: The below check is a deliberate repitition of
            # code in the drag-motion signal handler.  In MacOS/Quartz, the
            # context action is not propogated between event handlers for
            # drag-motion and drag-data-get using "ctx.get_actions()".  It is
            # unclear if this is a bug or expected behavior.  Regardless, the
            # context widget information is the same so identical behavior can
            # be achieved by simply using the same widget check as in the move
            # action.
            if Gtk.drag_get_source_widget(ctx) == self and \
                    not self.__force_copy:
                self.__drag_iters = list(map(model.get_iter, paths))
            else:
                self.__drag_iters = []
        else:
            uris = [model[path][0]("~uri") for path in paths]
            sel.set_uris(uris)
            self.__drag_iters = []
开发者ID:LudoBike,项目名称:quodlibet,代码行数:32,代码来源:songlist.py

示例4: test_selection_set_songs

    def test_selection_set_songs(self):
        song = AudioFile()
        song["~filename"] = fsnative(u"foo")
        sel = MockSelData()
        qltk.selection_set_songs(sel, [song])
        assert sel.data == fsn2bytes(fsnative(u"foo"), "utf-8")

        assert qltk.selection_get_filenames(sel) == [fsnative(u"foo")]
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:8,代码来源:test_qltk___init__.py

示例5: __drag_data_get

 def __drag_data_get(self, view, ctx, sel, tid, etime):
     model, iters = self.__view.get_selection().get_selected_rows()
     songs = []
     for iter in filter(lambda i: i, iters):
         songs += list(model[iter][0])
     if tid == 0:
         qltk.selection_set_songs(sel, songs)
     else:
         sel.set_uris([song("~uri") for song in songs])
开发者ID:brunob,项目名称:quodlibet,代码行数:9,代码来源:main.py

示例6: _drag_data_get

 def _drag_data_get(self, view, ctx, sel, tid, etime):
     model, iters = self.__view.get_selection().get_selected_rows()
     songs = []
     for itr in iters:
         if itr:
             songs += model[itr][0].songs
     if tid == 0:
         qltk.selection_set_songs(sel, songs)
     else:
         sel.set_uris([song("~uri") for song in songs])
开发者ID:zsau,项目名称:quodlibet,代码行数:10,代码来源:main.py

示例7: __drag_data_get

    def __drag_data_get(self, view, ctx, sel, tid, etime):
        model, paths = self.get_selection().get_selected_rows()
        if tid == DND_QL:
            songs = [model[path][0] for path in paths
                     if model[path][0].can_add]
            if len(songs) != len(paths):
                qltk.ErrorMessage(
                    qltk.get_top_parent(self), _("Unable to copy songs"),
                    _("The files selected cannot be copied to other "
                      "song lists or the queue.")).run()
                Gdk.drag_abort(ctx, etime)
                return

            qltk.selection_set_songs(sel, songs)
            if ctx.get_actions() & Gdk.DragAction.MOVE:
                self.__drag_iters = map(model.get_iter, paths)
            else:
                self.__drag_iters = []
        else:
            uris = [model[path][0]("~uri") for path in paths]
            sel.set_uris(uris)
            self.__drag_iters = []
开发者ID:lebauce,项目名称:quodlibet,代码行数:22,代码来源:songlist.py

示例8: __drag_data_get

    def __drag_data_get(self, view, ctx, sel, tid, etime):
        model, rows = view.get_selection().get_selected_rows()
        dirs = [model[row][0] for row in rows]
        for songs in self.__find_songs(view.get_selection()):
            pass
        if tid == self.TARGET_QL:
            cant_add = filter(lambda s: not s.can_add, songs)
            if cant_add:
                qltk.ErrorMessage(
                    qltk.get_top_parent(self), _("Unable to copy songs"),
                    _("The files selected cannot be copied to other "
                      "song lists or the queue.")).run()
                ctx.drag_abort(etime)
                return
            to_add = filter(self.__library.__contains__, songs)
            self.__add_songs(view, to_add)

            qltk.selection_set_songs(sel, songs)
        else:
            # External target (app) is delivered a list of URIS of songs
            uris = list({fsn2uri(dir) for dir in dirs})
            print_d("Directories to drop: %s" % dirs)
            sel.set_uris(uris)
开发者ID:faubiguy,项目名称:quodlibet,代码行数:23,代码来源:filesystem.py

示例9: __drag_data_get

 def __drag_data_get(self, view, ctx, sel, tid, etime):
     songs = self.__get_selected_songs()
     if tid == 1:
         qltk.selection_set_songs(sel, songs)
     else:
         sel.set_uris([song("~uri") for song in songs])
开发者ID:faubiguy,项目名称:quodlibet,代码行数:6,代码来源:main.py


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