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


Python qltk.is_accel函数代码示例

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


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

示例1: __key_pressed

    def __key_pressed(self, widget, event):
        if qltk.is_accel(event, "Delete"):
            model, iter = self.__selected_playlists()
            if not iter:
                return False

            playlist = model[iter][0]
            dialog = ConfirmRemovePlaylistDialog(self, playlist)
            if dialog.run() == Gtk.ResponseType.YES:
                playlist.delete()
                model.get_model().remove(
                    model.convert_iter_to_child_iter(iter))
            return True
        elif qltk.is_accel(event, "F2"):
            model, iter = self.__selected_playlists()
            if iter:
                self._start_rename(model.get_path(iter))
            return True
        elif qltk.is_accel(event, "<Primary>I"):
            songs = self._get_playlist_songs()
            if songs:
                window = Information(self.library.librarian, songs, self)
                window.show()
            return True
        elif qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
            qltk.enqueue(self._get_playlist_songs())
            return True
        elif qltk.is_accel(event, "<alt>Return"):
            songs = self._get_playlist_songs()
            if songs:
                window = SongProperties(self.library.librarian, songs, self)
                window.show()
            return True
        return False
开发者ID:zsau,项目名称:quodlibet,代码行数:34,代码来源:main.py

示例2: __key_press

    def __key_press(self, songlist, event, librarian):
        rating_accels = [
            "<ctrl>%d" % i for i in range(min(10, config.RATINGS.number + 1))]

        if qltk.is_accel(event, *rating_accels):
            rating = int(chr(event.keyval)) * config.RATINGS.precision
            self.__set_rating(rating, self.get_selected_songs(), librarian)
            return True
        elif qltk.is_accel(event, "<ctrl>Return", "<ctrl>KP_Enter"):
            self.__enqueue(self.get_selected_songs())
            return True
        elif qltk.is_accel(event, "<control>F"):
            self.emit('start-interactive-search')
            return True
        elif qltk.is_accel(event, "<alt>Return"):
            songs = self.get_selected_songs()
            if songs:
                window = SongProperties(librarian, songs, parent=self)
                window.show()
            return True
        elif qltk.is_accel(event, "<control>I"):
            songs = self.get_selected_songs()
            if songs:
                window = Information(librarian, songs, self)
                window.show()
            return True
        return False
开发者ID:lebauce,项目名称:quodlibet,代码行数:27,代码来源:songlist.py

示例3: __key_press

 def __key_press(self, songlist, event, librarian):
     if qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
         self.__enqueue(self.get_selected_songs())
         return True
     elif qltk.is_accel(event, "<Primary>F"):
         self.emit('start-interactive-search')
         return True
     elif qltk.is_accel(event, "<Primary>Delete"):
         songs = self.get_selected_songs()
         if songs:
             trash_songs(self, songs, librarian)
         return True
     elif qltk.is_accel(event, "<alt>Return"):
         songs = self.get_selected_songs()
         if songs:
             window = SongProperties(librarian, songs, parent=self)
             window.show()
         return True
     elif qltk.is_accel(event, "<Primary>I"):
         songs = self.get_selected_songs()
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     return False
开发者ID:urielz,项目名称:quodlibet,代码行数:25,代码来源:songlist.py

示例4: __sb_key_pressed

 def __sb_key_pressed(self, entry, event):
     if (is_accel(event, "<Primary>Return") or
             is_accel(event, "<Primary>KP_Enter")):
         songs = app.window.songlist.get_songs()
         app.window.playlist.enqueue(songs)
         return True
     return False
开发者ID:zsau,项目名称:quodlibet,代码行数:7,代码来源:main.py

示例5: test_is_accel

    def test_is_accel(self):
        e = gtk.gdk.Event(gtk.gdk.KEY_RELEASE)
        self.failIf(qltk.is_accel(e, "a"))

        e = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
        e.keyval = 65293
        e.state =  gtk.gdk.CONTROL_MASK
        self.failUnless(qltk.is_accel(e, "<ctrl>Return"))
开发者ID:silkecho,项目名称:glowing-silk,代码行数:8,代码来源:test_qltk___init__.py

示例6: __key_press

 def __key_press(self, entry, event):
     if is_accel(event, "<Primary>z"):
         self.undo()
         return True
     elif is_accel(event, "<Primary><shift>z"):
         self.redo()
         return True
     return False
开发者ID:tintinyoung,项目名称:quodlibet,代码行数:8,代码来源:entry.py

示例7: __view_key_press_event

 def __view_key_press_event(self, view, event):
     if qltk.is_accel(event, "Delete"):
         self.__remove_tag(view, view)
         return Gdk.EVENT_STOP
     elif qltk.is_accel(event, "<Primary>s"):
         # Issue 697: allow Ctrl-s to save.
         self._save.emit('clicked')
         return Gdk.EVENT_STOP
     return Gdk.EVENT_PROPAGATE
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:9,代码来源:edittags.py

示例8: __key_press

 def __key_press(self, songlist, event, librarian):
     if event.string in ['0', '1', '2', '3', '4']:
         rating = min(1.0, int(event.string) * util.RATING_PRECISION)
         self.__set_rating(rating, self.get_selected_songs(), librarian)
         return True
     elif qltk.is_accel(event, "<ctrl>Return") or \
         qltk.is_accel(event, "<ctrl>KP_Enter"):
         self.__enqueue(self.get_selected_songs())
         return True
     elif qltk.is_accel(event, "<control>F"):
         self.emit('start-interactive-search')
         return True
     return False
开发者ID:silkecho,项目名称:glowing-silk,代码行数:13,代码来源:songlist.py

示例9: __key_pressed

 def __key_pressed(self, widget, event, librarian):
     if qltk.is_accel(event, "<Primary>I"):
         songs = self.__get_selected_songs()
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     elif qltk.is_accel(event, "<alt>Return"):
         songs = self.__get_selected_songs()
         if songs:
             window = SongProperties(librarian, songs, self)
             window.show()
         return True
     return False
开发者ID:pfps,项目名称:quodlibet,代码行数:14,代码来源:main.py

示例10: test_is_accel

    def test_is_accel(self):
        e = Gdk.Event.new(Gdk.EventType.KEY_RELEASE)
        self.failIf(qltk.is_accel(e, "a"))

        e = Gdk.Event.new(Gdk.EventType.KEY_PRESS)
        e.keyval = Gdk.KEY_Return
        e.state = Gdk.ModifierType.CONTROL_MASK
        self.failUnless(qltk.is_accel(e, "<ctrl>Return"))

        e = Gdk.Event.new(Gdk.EventType.KEY_PRESS)
        e.keyval = Gdk.KEY_Return
        e.state = Gdk.ModifierType.CONTROL_MASK
        self.failUnless(qltk.is_accel(e, "a", "<ctrl>Return"))
        self.failUnless(qltk.is_accel(e, "<ctrl>Return", "b"))
        self.failIf(qltk.is_accel(e, "a", "b"))
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:15,代码来源:test_qltk___init__.py

示例11: __key_pressed

 def __key_pressed(self, widget, event):
     # alt+X switches to page X
     for i in xrange(self.get_n_pages()):
         if is_accel(event, "<alt>%d" % (i + 1)):
             self.set_current_page(i)
             return True
     return False
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:7,代码来源:x.py

示例12: __key_pressed

    def __key_pressed(self, player, event):
        if not player.song:
            return

        def seek_relative(seconds):
            current = player.get_position()
            current += seconds * 1000
            current = min(player.song("~#length") * 1000 -1, current)
            current = max(0, current)
            player.seek(current)

        if qltk.is_accel(event, "<alt>Right"):
            seek_relative(10)
            return True
        elif qltk.is_accel(event, "<alt>Left"):
            seek_relative(-10)
            return True
开发者ID:silkecho,项目名称:glowing-silk,代码行数:17,代码来源:quodlibetwindow.py

示例13: _on_key_press

    def _on_key_press(self, widget, event):
        is_dialog = self.get_type_hint() == Gdk.WindowTypeHint.DIALOG

        if (is_dialog and is_accel(event, "Escape")) or (not is_dialog and is_accel(event, "<Primary>w")):
            # Do not close the window if we edit a Gtk.CellRendererText.
            # Focus the treeview instead.
            if isinstance(self.get_focus(), Gtk.Entry) and isinstance(self.get_focus().get_parent(), Gtk.TreeView):
                self.get_focus().get_parent().grab_focus()
                return Gdk.EVENT_PROPAGATE
            self.close()
            return Gdk.EVENT_STOP

        if not is_dialog and is_accel(event, "F11"):
            self.toggle_fullscreen()
            return Gdk.EVENT_STOP

        return Gdk.EVENT_PROPAGATE
开发者ID:faubiguy,项目名称:quodlibet,代码行数:17,代码来源:window.py

示例14: __key_pressed

    def __key_pressed(self, widget, event):
        if qltk.is_accel(event, "Delete"):
            model, iter = self.__selected_playlists()
            if not iter:
                return False

            playlist = model[iter][0]
            dialog = ConfirmRemovePlaylistDialog(self, playlist)
            if dialog.run() == Gtk.ResponseType.YES:
                playlist.delete()
                model.get_model().remove(
                    model.convert_iter_to_child_iter(iter))
            return True
        elif qltk.is_accel(event, "F2"):
            model, iter = self.__selected_playlists()
            if iter:
                self._start_rename(model.get_path(iter))
            return True
        return False
开发者ID:Muges,项目名称:quodlibet,代码行数:19,代码来源:main.py

示例15: do_key_press_event

 def do_key_press_event(self, event):
     if is_accel(event, "space", "KP_Space"):
         selection = self.get_selection()
         fmodel, fiter = selection.get_selected()
         plugin = fmodel.get_value(fiter)
         if plugin.can_enable:
             self._emit_toggled(fmodel.get_path(fiter),
                                not plugin_enabled(plugin))
         self.get_model().iter_changed(fiter)
     else:
         Gtk.TreeView.do_key_press_event(self, event)
开发者ID:elfalem,项目名称:quodlibet,代码行数:11,代码来源:pluginwin.py


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