Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@
from os import environ as os_environ
import gettext


def localeInit():
localedir = resolveFilename(SCOPE_PLUGINS, "Extensions/RefreshBouquet/locale")
gettext.bindtextdomain('RefreshBouquet', localedir )
gettext.bindtextdomain('RefreshBouquet', localedir)


def _(txt):
t = gettext.dgettext("RefreshBouquet", txt)
if t == txt:
t = gettext.gettext(txt)
return t


def ngettext(singular, plural, n):
t = gettext.dngettext('RefreshBouquet', singular, plural, n)
if t in (singular, plural):
t = gettext.ngettext(singular, plural, n)
return t


localeInit()
language.addCallback(localeInit)
7 changes: 4 additions & 3 deletions plugin/managebq.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from ui import MySelectionList
from ui import setIcon


class refreshBouquetManageDeletedBouquets(Screen):
skin = """
<screen name="refreshBouquetManageDeletedBouquets" position="center,center" size="560,410" title="refreshBouquet - manage deleted bouquets">
Expand Down Expand Up @@ -67,7 +68,7 @@ def __init__(self, session):
nr = 0
for x in os.listdir(E2):
if x.startswith("userbouquet") and x.endswith(".del"):
data.addSelection(self.fileName(x), "%s/%s" % (E2,x), nr, False)
data.addSelection(self.fileName(x), "%s/%s" % (E2, x), nr, False)
nr += 1
self.list = data
self.list.sort()
Expand Down Expand Up @@ -98,7 +99,7 @@ def removeCurrentEntries(self):
text = _("Are you sure to remove %s selected deleted bouquets?") % marked
else:
text = _("Are you sure to remove deleted userbouquet?\n\n%s") % self.fileName(self["config"].getCurrent()[0][1])
self.session.openWithCallback(self.removeFromSource, MessageBox, text, MessageBox.TYPE_YESNO, default=False )
self.session.openWithCallback(self.removeFromSource, MessageBox, text, MessageBox.TYPE_YESNO, default=False)

def removeFromSource(self, answer):
if answer == True:
Expand All @@ -119,7 +120,7 @@ def restoreCurrentEntries(self):
text = _("Are you sure to restore %s selected deleted bouquets?") % marked
else:
text = _("Are you sure to restore deleted userbouquet?\n\n%s") % self.fileName(self["config"].getCurrent()[0][1])
self.session.openWithCallback(self.restoreSelected, MessageBox, text, MessageBox.TYPE_YESNO, default=False )
self.session.openWithCallback(self.restoreSelected, MessageBox, text, MessageBox.TYPE_YESNO, default=False)

def restoreSelected(self, answer):
if answer == True:
Expand Down
16 changes: 9 additions & 7 deletions plugin/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# for localized messages
# for localized messages
from . import _
#
# Refresh Bouqurt - Plugin E2 for OpenPLi
Expand All @@ -21,10 +21,11 @@
from Components.config import ConfigSubsection, config, ConfigYesNo

config.plugins.refreshbouquet = ConfigSubsection()
config.plugins.refreshbouquet.channel_context_menu = ConfigYesNo(default = True)
config.plugins.refreshbouquet.channel_context_menu = ConfigYesNo(default=True)

plugin_path = None


def main(session, servicelist=None, **kwargs):
import Screens.InfoBar
Servicelist = servicelist or Screens.InfoBar.InfoBar.instance.servicelist
Expand All @@ -33,12 +34,13 @@ def main(session, servicelist=None, **kwargs):
import ui
session.openWithCallback(ui.closed, ui.refreshBouquet, Servicelist, currentBouquet)

def Plugins(path,**kwargs):

def Plugins(path, **kwargs):
global plugin_path
plugin_path = path
name= _("RefreshBouquet")
descr=_("Actualize services in bouquets")
list = [PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon = "refreshbouquet.png", needsRestart = False, fnc=main)]
name = _("RefreshBouquet")
descr = _("Actualize services in bouquets")
list = [PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_PLUGINMENU, icon="refreshbouquet.png", needsRestart=False, fnc=main)]
if config.plugins.refreshbouquet.channel_context_menu.value:
list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_CHANNEL_CONTEXT_MENU, needsRestart = False, fnc=main))
list.append(PluginDescriptor(name=name, description=descr, where=PluginDescriptor.WHERE_CHANNEL_CONTEXT_MENU, needsRestart=False, fnc=main))
return list
13 changes: 7 additions & 6 deletions plugin/rbbmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from plugin import plugin_path
from ui import E2, cfg, MySelectionList


class refreshBouquetRbbManager(Screen):
skin = """
<screen name="refreshBouquetRbbManager" position="center,center" size="560,417" title="RefreshBouquet - rbb files">
Expand Down Expand Up @@ -81,7 +82,7 @@ def __init__(self, session):
def menu(self):
buttons = []
menu = []
menu.append((_("Copy predefined 'rbb' file(s) to list"),0))
menu.append((_("Copy predefined 'rbb' file(s) to list"), 0))
self.session.openWithCallback(self.menuCallback, ChoiceBox, title=_("Select action:"), list=menu, keys=buttons)

def style(self):
Expand All @@ -96,7 +97,7 @@ def menuCallback(self, choice):
if os.path.exists(dir_src):
for filename in os.listdir(dir_src):
if filename.endswith('.rbb'):
copy2( dir_src + filename, E2)
copy2(dir_src + filename, E2)
self.reloadList()

def reloadList(self):
Expand All @@ -105,7 +106,7 @@ def reloadList(self):
nr = 0
for x in os.listdir(E2):
if x.endswith(".rbb"):
self.list.addSelection(x, "%s/%s" % (E2,x), nr, False)
self.list.addSelection(x, "%s/%s" % (E2, x), nr, False)
nr += 1
self.list.sort()
self["config"] = self.list
Expand All @@ -127,7 +128,7 @@ def renameCallback(name):
msg = ""
try:
path = self["config"].getCurrent()[0][1]
newpath = "%s/%s.rbb" % (E2,name)
newpath = "%s/%s.rbb" % (E2, name)
os.rename(path, newpath)
self.reloadList()
return
Expand All @@ -143,10 +144,10 @@ def renameCallback(name):
traceback.print_exc()
msg = _("Error") + '\n' + str(e)
if msg:
self.session.open(MessageBox, msg, type = MessageBox.TYPE_ERROR, timeout = 5)
self.session.open(MessageBox, msg, type=MessageBox.TYPE_ERROR, timeout=5)
if self["config"].getCurrent():
name = self["config"].getCurrent()[0][0].split('.')[0]
self.session.openWithCallback(renameCallback, VirtualKeyBoard, title = _("Rename"), text = name)
self.session.openWithCallback(renameCallback, VirtualKeyBoard, title=_("Rename"), text=name)

def remove(self):
def callbackErase(answer):
Expand Down
Loading