Check-in [ceba1060dd]
Overview
| Comment: | Fix dict error for new categories. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
ceba1060dd33121f13dd837f4ead972f |
| User & Date: | mario on 2018-12-21 23:03:16 |
| Other Links: | manifest | tags |
Context
|
2018-12-31
| ||
| 11:33 | Release as 2.2.1 check-in: 2877d4a4bb user: mario tags: trunk, 2.2.1 | |
|
2018-12-21
| ||
| 23:03 | Fix dict error for new categories. check-in: ceba1060dd user: mario tags: trunk | |
|
2018-12-18
| ||
| 22:40 | More mapping options in Radiotray hook. check-in: 2c8a7bf1a8 user: mario tags: trunk | |
Changes
Modified contrib/new_favourite_cat.py from [f1bb6d76fa] to [9d848c757e].
1 2 3 4 | # encoding: utf-8 # api: streamtuner2 # title: New favourite category # description: Introduces new bookmarks categories | | > | > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# encoding: utf-8
# api: streamtuner2
# title: New favourite category
# description: Introduces new bookmarks categories
# version: 0.3
# type: feature
# category: ui
# config: -
# priority: optional
#
# Adds a "New favourite category..." under Station > Extensions menu.
#
# · New categories will show up in the bookmarks channel under favourite.
# · Also adds a "Bookmark to > …" context submenu.
# · Still requires clicking/reloading the custom bookmark category.
# · DND between bookmark categories is not supported.
# · Subcategories can be removed (but requires exact name input).
#
# This is somewhat of a workaround. ST2 station lists are still unfit
# for bookmark management, because it wasn't a project goal as such.
#
from uikit import *
from config import *
#
class new_favourite_cat (object):
plugin = "new_favourite_cat"
|
| ︙ | ︙ | |||
28 29 30 31 32 33 34 |
uikit.add_menu([parent.extensions], "New favourite category…", self.win, insert=3)
self.create_submenu(parent)
self.update_submenu()
# show input window
def win(self, *w):
w = self.w = gtk.Dialog(
| | | | | | > > | | | < < < < > | > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
uikit.add_menu([parent.extensions], "New favourite category…", self.win, insert=3)
self.create_submenu(parent)
self.update_submenu()
# show input window
def win(self, *w):
w = self.w = gtk.Dialog(
'Bookmark category',
self.parent.win_streamtuner2,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_DELETE, gtk.RESPONSE_DELETE_EVENT, gtk.STOCK_NEW, gtk.RESPONSE_APPLY)
)
input = gtk.Entry(35)
w.vbox.pack_start(input)
log.UI(w.vbox.get_children())
w.show_all()
self.add(self.w, w.run(), input.get_text())
# add category
def add(self, w, r, title):
bm = self.parent.bookmarks
have = bm.streams.has_key(title)
w.destroy()
if r == gtk.RESPONSE_APPLY:
log.NEW(title)
if not have:
bm.streams[title] = []
elif r == gtk.RESPONSE_DELETE_EVENT:
if have:
bm.streams.pop(title, None)
else:
log.ERR_UI("unknown action", r)
self.update_submenu()
bm.update_categories()
bm.display_categories()
# craft Menu and two MenuItem parents
def create_submenu(self, parent):
self.submenu = gtk.Menu()
uikit.add_menu([parent.streammenu], insert=1, label="Bookmark to", stock=gtk.STOCK_INDENT, submenu=self.submenu)
uikit.add_menu([parent.streamactions], insert=3, label="Add bookmark to", stock=gtk.STOCK_INDENT, submenu=self.submenu)
# bookmark to > … submenu w/ custom categories
def update_submenu(self):
bmc = self.parent.bookmarks.categories
# clean menu items
for w in self.submenu.get_children():
self.submenu.remove(w)
# add fresh entries
if len(bmc) >= 2 and type(bmc[1]) is list:
for label in bmc[1]:
uikit.add_menu([self.submenu], label, lambda w,target=label: self.parent.bookmark(w, target))
self.submenu.show_all()
|