diff --git a/plugin/__init__.py b/plugin/__init__.py index 8f4debc..aecee5b 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -8,12 +8,14 @@ PluginLanguageDomain = "ShootYourScreen" PluginLanguagePath = "Extensions/ShootYourScreen/locale" + def localeInit(): lang = language.getLanguage()[:2] os.environ["LANGUAGE"] = lang print "[ShootYourScreen] set language to ", lang gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath)) + def _(txt): t = gettext.dgettext(PluginLanguageDomain, txt) if t == txt: @@ -21,5 +23,6 @@ def _(txt): t = gettext.gettext(txt) return t + localeInit() language.addCallback(localeInit) diff --git a/plugin/plugin.py b/plugin/plugin.py index f929a43..242df5a 100644 --- a/plugin/plugin.py +++ b/plugin/plugin.py @@ -41,6 +41,7 @@ config.plugins.shootyourscreen.picturesize = ConfigSelection(default="default", choices=[("default", _("Skin resolution")), ("-r 480", "480"), ("-r 576", "576"), ("-r 720", "720"), ("-r 1280", "1280"), ("-r 1920", "1920")]) config.plugins.shootyourscreen.timeout = ConfigSelection(default="3", choices=[("1", "1 sec"), ("3", "3 sec"), ("5", "5 sec"), ("10", "10 sec"), ("off", _("no message")), ("0", _("no timeout"))]) + def getPicturePath(): picturepath = config.plugins.shootyourscreen.path.value if picturepath.endswith('/'): @@ -55,6 +56,7 @@ def getPicturePath(): self.session.open(MessageBox, _("Sorry, your device for screenshots is not writeable.\n\nPlease choose another one."), MessageBox.TYPE_INFO, timeout=10) return picturepath + class getScreenshot: def __init__(self): self.ScreenshotConsole = Console() @@ -153,6 +155,7 @@ def getFilename(self): screenshotfile = picturepath + '/' + screenshottime + fileextension return screenshotfile + class ShootYourScreenConfig(Screen, ConfigListScreen): skin = """ @@ -251,15 +254,18 @@ def keyYellowConfirm(self, confirmed): config.plugins.shootyourscreen.timeout.setValue("3") self.save() + def autostart(reason, **kwargs): if kwargs.has_key("session") and reason == 0: print "[ShootYourScreen] start...." getScreenshot() + def startSetup(session, **kwargs): print "[ShootYourScreen] start configuration" session.open(ShootYourScreenConfig) + def Plugins(**kwargs): return [PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, fnc=autostart), PluginDescriptor(name="ShootYourScreen Setup", description=_("make Screenshots with your VU+"), where=[PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU], icon="shootyourscreen.png", fnc=startSetup)] diff --git a/setup_translate.py b/setup_translate.py index 692f001..a6a36d2 100644 --- a/setup_translate.py +++ b/setup_translate.py @@ -5,8 +5,10 @@ import glob import os + class build_trans(cmd.Command): description = 'Compile .po files into .mo files' + def initialize_options(self): pass @@ -33,11 +35,14 @@ def run(self): else: print "we got no domain -> no translation was compiled" + class build(_build): sub_commands = _build.sub_commands + [('build_trans', None)] + def run(self): _build.run(self) + cmdclass = { 'build': build, 'build_trans': build_trans,