Beispiel #1
0
 def showThumbLand(self):
     picture = ""
     if self.land == "de":
         picture = pluginpath + "/uwz.png"
     else:
         picture = pluginpath + "/uwzat.png"
     picload = self.picload
     sc = AVSwitch().getFramebufferScale()
     picload.setPara((90, 40, sc[0], sc[1], 0, 0, '#ff000000'))
     l = picload.PictureData.get()
     del l[:]
     l.append(self.gotThumbLand)
     picload.startDecode(picture)
Beispiel #2
0
 def ShowPng(self, Data):
     if fileExists("/tmp/country.png"):
         self['countryPng'].instance.setPixmap(gPixmapPtr())
         self.scale = AVSwitch().getFramebufferScale()
         self.picload = ePicLoad()
         size = self['countryPng'].instance.size()
         self.picload.setPara((size.width(), size.height(), self.scale[0], self.scale[1], False, 1, "#00000000"))
         if self.picload.startDecode("/tmp/country.png", 0, 0, False) == 0:
             ptr = self.picload.getData()
             if ptr != None:
                 self['countryPng'].instance.setPixmap(ptr)
                 self['countryPng'].show()
                 del self.picload
Beispiel #3
0
	def changed(self, what):
		if not self.instance:
			return
		picname = ""
		sname = ""

		if what[0] != self.CHANGED_CLEAR:
			service = None
			if isinstance(self.source, ServiceEvent):
				service = self.source.getCurrentService()
			if service:
				sname = service.getPath()
			else:
				return
			picname = self.nameCache.get(sname, "")
			if picname == "":
				picname = self.findBackdrop(sname)[1]
			if picname == "":
				path = sname
				if service.toString().endswith == "..":
					path = config.movielist.last_videodir.value
				for ext in self.exts:
					p = os_path.dirname(path) + "/folder" + ext
					picname = os_path.exists(p) and p or ""
					if picname:
						break
			if picname != "":
				self.nameCache[sname] = picname
			if picname == self.picname:
				return
			self.picname = picname
			if picname != "" and os_path.exists(picname):
				sc = AVSwitch().getFramebufferScale()
				size = self.instance.size()
				self.picload = ePicLoad()
				self.picload.PictureData.get().append(self.showBackdropCallback)
				if self.picload:
					if ".bdp." in picname or ".backdrop." in picname:
						self.picload.setPara((size.width(), size.height(), sc[0], sc[1], False, 1, "#00000000"))
						if self.picload.startDecode(picname) != 0:
							del self.picload
					else:
						if self.scalecover == "1":
							fac = 1.5
							self.picload.setPara((size.width(), size.width() * fac, sc[0], sc[1], False, 1, "#00000000"))
							if self.picload.startDecode(picname) != 0:
								del self.picload
						else:
							self.instance.hide()
			else:
				self.instance.hide()
Beispiel #4
0
    def __init__(self, session, service, stopPlayer, chName, chURL, chIcon):
        Screen.__init__(self, session)
        InfoBarAudioSelection.__init__(self)
        InfoBarNotifications.__init__(self)

        isEmpty = lambda x: x is None or len(x) == 0 or x == "None"
        if isEmpty(chName): chName = "Unknown"
        if isEmpty(chURL):  chURL  = "Unknown"
        if isEmpty(chIcon): chIcon = "default.png"
        chIcon = "%s/icons/%s" % (PLUGIN_PATH, chIcon)
        self.session = session
        self.service = service
        self.stopPlayer = stopPlayer

        self.setTitle(chName)

        self["actions"] = ActionMap(["OkCancelActions", "InfobarSeekActions",
                                     "MediaPlayerActions", "MovieSelectionActions"], {
            "ok": self.doInfoAction,
            "cancel": self.doExit,
            "stop": self.doExit,
            "playpauseService": self.playpauseService,
        }, -2)

        self.__event_tracker = ServiceEventTracker(screen = self, eventmap = {
            iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged,
            iPlayableService.evStart: self.__serviceStarted,
            iPlayableService.evEOF: self.__evEOF,
            iPlayableService.evUser + 10: self.__evAudioDecodeError,
            iPlayableService.evUser + 11: self.__evVideoDecodeError,
            iPlayableService.evUser + 12: self.__evPluginError,
        })

        self.hidetimer = eTimer()
        self.hidetimer.timeout.get().append(self.doInfoAction)

        self.state = self.PLAYER_IDLE
        self.__seekableStatusChanged()

        self.onClose.append(self.__onClose)
        self.doPlay()

        self["channel_icon"] = Pixmap()
        self["channel_name"] = Label(chName)
        self["channel_uri"]  = Label(chURL)

        self.picload = ePicLoad()
        self.scale   = AVSwitch().getFramebufferScale()
        self.picload.PictureData.get().append(self.cbDrawChannelIcon)
        self.picload.setPara((35, 35, self.scale[0], self.scale[1], False, 0, "#00000000"))
        self.picload.startDecode(chIcon)
Beispiel #5
0
    def changed(self, what):
        if not self.instance:
            return
        else:
            picname = ''
            sname = ''
            if what[0] != self.CHANGED_CLEAR:
                service = None
                if isinstance(self.source, ServiceEvent):
                    service = self.source.getCurrentService()
                else:
                    if isinstance(self.source, CurrentService):
                        service = self.source.getCurrentServiceReference()
                    if service:
                        sname = service.getPath()
                    else:
                        return
                    picname = self.nameCache.get(sname, '')
                    if picname == '':
                        picname = self.findCover(sname)[1]
                    if picname == '':
                        path = sname
                        if service.toString().endswith == '..':
                            path = config.movielist.last_videodir.value
                        for ext in self.exts:
                            p = os_path.dirname(path) + '/folder' + ext
                            picname = os_path.exists(p) and p or ''
                            if picname:
                                break

                    if picname != '':
                        self.nameCache[sname] = picname
                    if picname == self.picname:
                        return
                self.picname = picname
                if picname != '' and os_path.exists(picname):
                    sc = AVSwitch().getFramebufferScale()
                    size = self.instance.size()
                    self.picload = ePicLoad()
                    self.picload.PictureData.get().append(
                        self.showCoverCallback)
                    if self.picload:
                        self.picload.setPara(
                            (size.width(), size.height(), sc[0], sc[1], False,
                             1, '#00000000'))
                        if self.picload.startDecode(picname) != 0:
                            del self.picload
                else:
                    self.instance.hide()
            return
            return
    def __init__(self, session, args=None):
        Screen.__init__(self, session)
        self.session = session
        self.Scale = AVSwitch().getFramebufferScale()
        self.PicLoad = ePicLoad()
        self["helperimage"] = Pixmap()
        self["helpertext"] = Label()
        self["resulttext"] = Label()

        self["titleText"] = StaticText("")
        self["titleText"].setText(_("Weather settings"))

        self["cancelBtn"] = StaticText("")
        self["cancelBtn"].setText(_("Cancel"))

        self["saveBtn"] = StaticText("")
        self["saveBtn"].setText(_("Save"))

        self["defaultsBtn"] = StaticText("")
        self["defaultsBtn"].setText(_("Defaults"))

        self["checkBtn"] = StaticText("")
        self["checkBtn"].setText(_("Check ID"))

        self.check_enable = False
        self.checkTimer = eTimer()
        self.checkTimer.callback.append(self.readCheckFile)

        ConfigListScreen.__init__(self,
                                  self.getMenuItemList(),
                                  session=session,
                                  on_change=self.changedEntry)

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "DirectionActions", "InputActions",
                "ColorActions", "VirtualKeyboardActions"
            ], {
                "left": self.keyLeft,
                "down": self.keyDown,
                "up": self.keyUp,
                "right": self.keyRight,
                "red": self.exit,
                "green": self.save,
                "yellow": self.defaults,
                "blue": self.checkID,
                "showVirtualKeyboard": self.checkIDmy,
                "ok": self.checkIDmy,
                "cancel": self.exit
            }, -1)
        self.onLayoutFinish.append(self.UpdatePicture)
Beispiel #7
0
 def __init__(self, session, args=None, picPath=None):
     self.skin_lines = []
     Screen.__init__(self, session)
     self.session = session
     self.picPath = picPath
     self.Scale = AVSwitch().getFramebufferScale()
     self.PicLoad = ePicLoad()
     self['helperimage'] = Pixmap()
     list = []
     list.append(
         getConfigListEntry(_('Clock Widget'),
                            config.plugins.MyMetrix.InfobarClockWidget))
     list.append(
         getConfigListEntry(_('Info Widget'),
                            config.plugins.MyMetrix.InfobarInfoWidget))
     list.append(
         getConfigListEntry(_('Weather Widget'),
                            config.plugins.MyMetrix.InfobarWeatherWidget))
     list.append(
         getConfigListEntry(_('Health Widget'),
                            config.plugins.MyMetrix.InfobarHealthWidget))
     list.append(
         getConfigListEntry(_('Style'),
                            config.plugins.MyMetrix.InfobarStyle))
     list.append(
         getConfigListEntry(_('Channel name'),
                            config.plugins.MyMetrix.InfobarShowChannelname))
     list.append(
         getConfigListEntry(_('Show tuner info'),
                            config.plugins.MyMetrix.InfobarTunerInfo))
     list.append(
         getConfigListEntry(_('Show resolution info'),
                            config.plugins.MyMetrix.InfobarResolutionInfo))
     list.append(
         getConfigListEntry(_('Show crypt info'),
                            config.plugins.MyMetrix.InfobarCryptInfo))
     ConfigListScreen.__init__(self, list)
     self['actions'] = ActionMap(
         [
             'OkCancelActions', 'DirectionActions', 'InputActions',
             'ColorActions'
         ], {
             'left': self.keyLeft,
             'down': self.keyDown,
             'up': self.keyUp,
             'right': self.keyRight,
             'red': self.exit,
             'cancel': self.save
         }, -1)
     self.onLayoutFinish.append(self.UpdateComponents)
Beispiel #8
0
    def __init__(self, session, picPath = None):
        Screen.__init__(self, session)
        self.picPath = picPath
        self.Scale = AVSwitch().getFramebufferScale()
        self.PicLoad = ePicLoad()
        self["picture"] = Pixmap()
        self["myActionMap"] = ActionMap(["SetupActions"],
        {
            "ok": self.cancel,
            "cancel": self.cancel
        }, -1)

        self.PicLoad.PictureData.get().append(self.DecodePicture)
        self.onLayoutFinish.append(self.ShowPicture)
Beispiel #9
0
	def switchAspectRatio(self, direction=1):
		if len(self.enabledaspects) < 2:
			return
		iAVSwitch = AVSwitch()
		aspectnum = iAVSwitch.getAspectRatioSetting()
		try:
			localaspectnum = self.enabledaspects.index(aspectnum)
		except ValueError:
			localaspectnum = 0
		newaspectnum = self.enabledaspects[(localaspectnum + direction) % len(self.enabledaspects)]
		iAVSwitch.setAspectRatio(newaspectnum)
		config.av.aspectratio.setValue(ASPECT[newaspectnum])
		if config.plugins.GBAspectRatioSwitch.showmsg.value:
			Notifications.AddPopup(text=ASPECTMSG[ASPECT[newaspectnum]], type=MessageBox.TYPE_INFO, timeout=2, id='GBAspectRatioSwitch')
Beispiel #10
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.skinName = "Standby"
        self.avswitch = AVSwitch()

        print "enter standby"

        self["actions"] = ActionMap(["StandbyActions"], {
            "power": self.Power,
            "discrete_on": self.Power
        }, -1)

        globalActionMap.setEnabled(False)

        self.standbyTimeUnknownTimer = eTimer()

        #mute adc
        self.setMute()

        self.paused_service = None
        self.prev_running_service = None

        if self.session.current_dialog:
            if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
                if localtime(
                        time()
                ).tm_year > 1970 and self.session.nav.getCurrentlyPlayingServiceOrGroup(
                ):
                    self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup(
                    )
                    self.session.nav.stopService()
                else:
                    self.standbyTimeUnknownTimer.callback.append(
                        self.stopService)
                    self.standbyTimeUnknownTimer.startLongTimer(60)
            elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
                self.paused_service = self.session.current_dialog
                self.paused_service.pauseService()
        if self.session.pipshown:
            from Screens.InfoBar import InfoBar
            InfoBar.instance and hasattr(
                InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()

        #set input to vcr scart
        if SystemInfo["ScartSwitch"]:
            self.avswitch.setInput("SCART")
        else:
            self.avswitch.setInput("AUX")
        self.onFirstExecBegin.append(self.__onFirstExecBegin)
        self.onClose.append(self.__onClose)
Beispiel #11
0
	def __init__(self, session, args = None, picPath = None):
		self.config_lines = []
		Screen.__init__(self, session)
		self.session = session
		self.bootlogosourcepath = "/usr/lib/enigma2/python/Plugins/Extensions/BootlogoMod/logos/"
		self.picPath = picPath
		self.Scale = AVSwitch().getFramebufferScale()
		self.PicLoad = ePicLoad()
		self["bootlogomodhelperimage"] = Pixmap()
		list = []
		list.append(getConfigListEntry(_("Select Bootlogo:"), config.plugins.BootlogoMod.active))
		ConfigListScreen.__init__(self, list)
		self["actions"] = ActionMap(["OkCancelActions","DirectionActions", "InputActions", "ColorActions"], {"left": self.keyLeft,"down": self.keyDown,"up": self.keyUp,"right": self.keyRight,"red": self.exit,"yellow": self.reboot, "blue": self.showInfo, "green": self.save,"cancel": self.exit}, -1)
		self.onLayoutFinish.append(self.UpdatePicture)
Beispiel #12
0
	def __init__(self, session, whatPic = None):
		self.skin = ShowMe.skin
		Screen.__init__(self, session)
		self.whatPic = whatPic
		self.EXscale = (AVSwitch().getFramebufferScale())
		self.EXpicload = ePicLoad()
		self["Picture"] = Pixmap()
		self["actions"] = ActionMap(["WizardActions"],
		{
			"ok": self.close,
			"back": self.close
		}, -1)
		self.EXpicload.PictureData.get().append(self.DecodeAction)
		self.onLayoutFinish.append(self.Show_Picture)
	def loadPixmap(self, widget, path):
		sc = AVSwitch().getFramebufferScale()
		size = self[widget].instance.size()
		self.picload = ePicLoad()
		self.picload_conn = None
		try:
			self.picload_conn = self.picload.PictureData.connect( boundFunction(self.loadPixmapCallback, widget) )
		except:
			self.picload_conn = True
			self.picload.PictureData.get().append( boundFunction(self.loadPixmapCallback, widget) )
		if self.picload and self.picload_conn:
			self.picload.setPara((size.width(), size.height(), sc[0], sc[1], False, 1, "#00000000")) # Background dynamically
			if self.picload.startDecode(path) != 0:
				del self.picload
 def __init__(self, session, prvScreen):
     self.skin = prvScreen
     Screen.__init__(self, session)
     self.session = session
     self.whatPic = "/tmp/standbild.jpg"
     self.EXscale = (AVSwitch().getFramebufferScale())
     self.EXpicload = ePicLoad()
     self["Picture"] = Pixmap()
     self["actions"] = ActionMap(["WizardActions"], {
         "ok": self.SavePic,
         "back": self.close,
     }, -1)
     self.EXpicload.PictureData.get().append(self.DecodeAction)
     self.onLayoutFinish.append(self.Show_Picture)
Beispiel #15
0
    def __init__(self,
                 session,
                 path,
                 name="",
                 author="",
                 version="",
                 description=""):
        Screen.__init__(self, session)
        self.session = session
        self.picPath = path + "/preview.png"
        self.Scale = AVSwitch().getFramebufferScale()
        self.PicLoad = ePicLoad()
        self["helperimage"] = Pixmap()

        self.path = path
        self.configpath = self.path + '/config.cfg'
        self.xml = parse(path + "/data.xml")

        #Read config file
        self.skinpartconfig = ConfigParser.RawConfigParser()
        self.skinpartconfig.read(self.configpath)

        self.listnames = []
        self.list = []
        self.getTargetScreens()
        self.list.append(getConfigListEntry(" "))
        self.listnames.append(["-", "-"])
        self.movingOptions()
        self.list.append(getConfigListEntry(" "))
        self.listnames.append(["-", "-"])
        self.getVariables()

        ConfigListScreen.__init__(self, self.list)

        self["itemname"] = Label(name)
        self["author"] = Label(author)
        self["date"] = Label(version)
        self["description"] = Label(description)

        self.UpdatePicture()

        self["actions"] = ActionMap([
            "OkCancelActions", "DirectionActions", "InputActions",
            "ColorActions"
        ], {
            "red": self.exit,
            "green": self.saveConfig,
            "cancel": self.saveConfig
        }, -1)
Beispiel #16
0
	def __init__(self, session, service, cbServiceCommand, chName, chURL, chIcon):
		Screen.__init__(self, session)
		InfoBarNotifications.__init__(self)

		isEmpty = lambda x: x is None or len(x)==0 or x == 'None'
		if isEmpty(chName): chName = 'Unknown'
		if isEmpty(chURL):  chURL  = 'Unknown'
		if isEmpty(chIcon): chIcon = 'default.png'
		chIcon = '%s/icons/%s'%(PLUGIN_PATH,chIcon)
		self.session = session
		self.service = service
		self.cbServiceCommand = cbServiceCommand
		self["actions"] = ActionMap(["OkCancelActions", "InfobarSeekActions", "MediaPlayerActions", "MovieSelectionActions"], {
			"ok": self.doInfoAction,
			"cancel": self.doExit,
			"stop": self.doExit,
			"playpauseService": self.playpauseService,
		}, -2)

		self.__event_tracker = ServiceEventTracker(screen = self, eventmap = {
			iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged,
			iPlayableService.evStart: self.__serviceStarted,
			iPlayableService.evEOF: self.__evEOF,
		})

		self.hidetimer = eTimer()
		self.hidetimer.timeout.get().append(self.doInfoAction)

		self.state = self.PLAYER_PLAYING
		self.lastseekstate = self.PLAYER_PLAYING
		self.__seekableStatusChanged()
	
		self.onClose.append(self.__onClose)
		self.doPlay()

		self['channel_icon'] = Pixmap()
		self['channel_name'] = Label(chName)
		self['channel_uri']  = Label(chURL)

		self.picload = ePicLoad()
		self.scale   = AVSwitch().getFramebufferScale()
		self.picload.PictureData.get().append(self.cbDrawChannelIcon)
		print self.scale[0]
		print self.scale[1]
		self.picload.setPara((35, 35, self.scale[0], self.scale[1], False, 0, "#00000000"))
		self.picload.startDecode(chIcon)

		self.bypassExit = False
		self.cbServiceCommand(('docommand',self.doCommand))
Beispiel #17
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.avswitch = AVSwitch()

        if boxtype == 'gb800se' or boxtype == 'gb800solo' or boxtype == 'gb800ue':
            self.forled = readled()
            if self.forled[0] == 'True':
                self.ledenable = 1
            else:
                self.ledenable = 0

        print "enter standby"

        self["actions"] = ActionMap(["StandbyActions"], {
            "power": self.Power,
            "discrete_on": self.Power
        }, -1)

        globalActionMap.setEnabled(False)

        #mute adc
        self.setMute()

        self.paused_service = None
        self.prev_running_service = None
        if self.session.current_dialog:
            if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS:
                #get currently playing service reference
                self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference(
                )
                #stop actual played dvb-service
                self.session.nav.stopService()
            elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES:
                self.paused_service = self.session.current_dialog
                self.paused_service.pauseService()

        #set input to vcr scart
        if SystemInfo["ScartSwitch"]:
            self.avswitch.setInput("SCART")
        else:
            self.avswitch.setInput("AUX")
        self.onFirstExecBegin.append(self.__onFirstExecBegin)
        self.onClose.append(self.__onClose)

        if boxtype == 'gb800se' or boxtype == 'gb800solo' or boxtype == 'gb800ue':
            self.sign = 0
            self.zaPrik = eTimer()
            self.zaPrik.timeout.get().append(self.vrime)
            self.zaPrik.start(1, 1)
    def reloadData(self, photo):
        if photo is None:
            return
        self.photo = photo
        unk = _("unknown")

        # camera
        if photo.exif.make and photo.exif.model:
            camera = '%s %s' % (photo.exif.make.text, photo.exif.model.text)
        elif photo.exif.make:
            camera = photo.exif.make.text
        elif photo.exif.model:
            camera = photo.exif.model.text
        else:
            camera = unk
        self['camera'].text = _("Camera: %s") % (camera, )

        title = photo.title.text.encode('utf-8') if photo.title.text else unk
        self.setTitle(_("eCasa: %s") % (title))
        self['title'].text = _("Title: %s") % (title, )
        summary = strip_readable(photo.summary.text).replace(
            '\n\nView Photo', '').encode('utf-8') if photo.summary.text else ''
        self['summary'].text = summary
        if photo.media and photo.media.keywords and photo.media.keywords.text:
            keywords = photo.media.keywords.text
            # TODO: find a better way to handle this
            if len(keywords) > 50:
                keywords = keywords[:47] + "..."
        else:
            keywords = unk
        self['keywords'].text = _("Keywords: %s") % (keywords, )

        try:
            real_w = int(photo.media.content[0].width)
            real_h = int(photo.media.content[0].heigth)
        except Exception as e:
            our_print(
                "EcasaPicture.__init__: illegal w/h values, using max size!")
            size = getDesktop(0).size()
            real_w = size.width()
            real_h = size.height()

        sc = AVSwitch().getFramebufferScale()
        self.picload.setPara(
            (real_w, real_h, sc[0], sc[1], False, 1, '#ff000000'))

        # NOTE: no need to start an extra thread for this, twisted is "parallel" enough in this case
        self.api.downloadPhoto(photo).addCallbacks(self.cbDownload,
                                                   self.ebDownload)
 def selectionChanged(self):
     self["poster"].hide()
     current = self["list"].l.getCurrentSelection()
     if current:
         try:
             movie = current[1]
             self["description"].setText("%s - %s\n\n%s" % (str(movie['name']), str(movie['released']), str(movie['overview'])))
             jpg_file = "/tmp/preview.jpg"
             cover_url = movie['images'][0]['cover']
             urllib.urlretrieve (cover_url, jpg_file)
             sc = AVSwitch().getFramebufferScale()
             self.picload.setPara((self["poster"].instance.size().width(), self["poster"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000"))
             self.picload.startDecode(jpg_file)
         except Exception, e:
             print e
Beispiel #20
0
 def displayPixmap(self, pixmap, path):
     #print("MDC: PixmapDisplay: displayPixmap: path: %s" % path)
     self.pixmap = pixmap
     if path is not None and self.picload_conn is None:
         scale = AVSwitch().getFramebufferScale()
         size = self.pixmap.instance.size()
         #print("MDC: PixmapDisplay: displayPixmap: size: %s, %s, scale: %s, %s" % (size.width(), size.height(), scale[0], scale[1]))
         self.pixmap.instance.setPixmap(gPixmapPtr())
         self.picload_conn = self.picload.PictureData.connect(
             self.displayPixmapCallback)
         _filename, ext = os.path.splitext(path)
         setJPEG = 2 if ext == '.jpg' or ext == '.jpeg' else 1
         self.picload.setPara((size.width(), size.height(), scale[0],
                               scale[1], False, setJPEG, "#ff000000"))
         self.picload.startDecode(path, True)
 def postWidgetCreate(self, instance):
     for (attrib, value) in self.skinAttributes:
         if attrib == "size":
             x, y = value.split(',')
             self._scaleSize = eSize(int(x), int(y))
         elif attrib == "pixmap":
             self.iconFileName = value
             if not self.iconFileName.startswith('/'):
                 self.iconFileName = resolveFilename(
                     SCOPE_CURRENT_SKIN, self.iconFileName)
     sc = AVSwitch().getFramebufferScale()
     self._aspectRatio = eSize(sc[0], sc[1])
     self.picload.setPara(
         (self._scaleSize.width(), self._scaleSize.height(), sc[0], sc[1],
          True, 2, '#ff000000'))
Beispiel #22
0
	def switchAspectRatio(self, direction=1):
		if len(self.enabledaspects) < 2:
			return
		iAVSwitch = AVSwitch()
		aspectnum = iAVSwitch.getAspectRatioSetting()
		try:
			localaspectnum = self.enabledaspects.index(aspectnum)
		except ValueError:
			localaspectnum = 0
		newaspectnum = self.enabledaspects[(localaspectnum + direction) % len(self.enabledaspects)]
		iAVSwitch.setAspectRatio(newaspectnum)
		config.av.aspectratio.setValue(ASPECT[newaspectnum])
		if config.plugins.AspectRatioSwitch.showmsg.value:
			Notifications.AddPopup(text=_("Aspect ratio switched from:\n   %s\nto:\n   %s") % (ASPECTMSG[ASPECT[aspectnum]], ASPECTMSG[ASPECT[newaspectnum]]), type=MessageBox.TYPE_INFO, timeout=5, id='AspectRatioSwitch')
			print pluginPrintname, "Aspect ratio switched from %d - %s to %d - %s" % (aspectnum, ASPECT[aspectnum], newaspectnum, ASPECT[newaspectnum])
Beispiel #23
0
 def showpng(self):
     scale = AVSwitch().getFramebufferScale()
     width = 750
     height = 400
     if HD.width() > 1280:
         width = 1300
         height = 693
     self.picload = ePicLoad()
     if self.picload:
         self.picload.setPara(
             [width, height, scale[0], scale[1], 0, 1, "FF000000"])
         self.picload.startDecode(png_tmp, 0, 0, False)
     png = self.picload.getData()
     if png is not None:
         self["image"].instance.setPixmap(png)
Beispiel #24
0
	def getPreview(self):
		try:
			f = urllib.urlopen(self.package["screenshot"])
			data = f.read()
			f.close()
			tmp = self.package["screenshot"].split(".")
			localfile = "/tmp/preview.%s" % tmp[len(tmp)-1]
			f2 = open(localfile , "w")
			f2.write(data)
			f2.close()
			sc = AVSwitch().getFramebufferScale()
			self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000"))
			self.picload.startDecode(localfile)
		except Exception, ex:
			print ex
Beispiel #25
0
 def setAspect(self, aspect):
     map = {
         0: '4_3_letterbox',
         1: '4_3_panscan',
         2: '16_9',
         3: '16_9_always',
         4: '16_10_letterbox',
         5: '16_10_panscan',
         6: '16_9_letterbox'
     }
     config.av.aspectratio.setValue(map[aspect])
     try:
         AVSwitch().setAspectRatio(aspect)
     except:
         pass
 def showCover(self):
     service = self.playlist[self.playcount]
     path = service.getPath()
     jpgpath = getPosterPath(path)
     if not os.path.exists(jpgpath):
         self["Cover"].hide()
     else:
         sc = AVSwitch().getFramebufferScale()  # Maybe save during init
         size = self["Cover"].instance.size()
         if self.picload:
             self.picload.setPara(
                 (size.width(), size.height(), sc[0], sc[1], False, 1,
                  config.EMC.movie_cover_background.value
                  ))  # Background dynamically
             self.picload.startDecode(jpgpath)
Beispiel #27
0
 def ShowCover(self):
     if fileExists("/tmp/captcha.jpg"):
         print "vorhanden.."
         self['coverArt'].instance.setPixmap(None)
         self.scale = AVSwitch().getFramebufferScale()
         self.picload = ePicLoad()
         size = self['coverArt'].instance.size()
         self.picload.setPara((size.width(), size.height(), self.scale[0],
                               self.scale[1], False, 1, "#FF000000"))
         if self.picload.startDecode("/tmp/captcha.jpg", 0, 0, False) == 0:
             ptr = self.picload.getData()
             if ptr != None:
                 self['coverArt'].instance.setPixmap(ptr.__deref__())
                 self['coverArt'].show()
                 del self.picload
Beispiel #28
0
	def setPictureLoadPara(self):
		sc = AVSwitch().getFramebufferScale()
		self.pictureLoad.setPara([
			self["image"].instance.size().width(),
			self["image"].instance.size().height(),
			sc[0],
			sc[1],
			0,
			int(config.pic.resize.value),
			'#00000000'
		])
		self["icon"].hide()
		if not config.pic.infoline.value:
			self["message"].setText("")
		self.startDecode()
Beispiel #29
0
def autostart(reason, **kwargs):
	#STANDARD beim Systemstart	
	global aspect_ratio_switch
	if reason == 0: # startup
		keymappath = "/usr/share/enigma2/keymap.xml"
		if os.path.exists(keymappath):
			keymapfile = open(keymappath, "r")
			keymaptext = keymapfile.read()
			keymapfile.close()
			changed = False
			if '<key id="KEY_CHANNELUP" mapto="openServiceList" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_CHANNELUP" mapto="openServiceList" flags="m" />', '<key id="KEY_CHANNELUP" mapto="openServiceList" flags="b" />')
				changed = True
			if '<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="m" />', '<key id="KEY_CHANNELDOWN" mapto="openServiceList" flags="b" />')
				changed = True
			if '<key id="KEY_VIDEO" mapto="showMovies" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_VIDEO" mapto="showMovies" flags="m" />', '<key id="KEY_VIDEO" mapto="showMovies" flags="b" />')
				changed = True
			if '<key id="KEY_RADIO" mapto="showRadio" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('key id="KEY_RADIO" mapto="showRadio" flags="m" />', 'key id="KEY_RADIO" mapto="showRadio" flags="b" />')
				changed = True
			if '<key id="KEY_HELP" mapto="displayHelp" flags="m" />' in keymaptext:
				keymaptext = keymaptext.replace('<key id="KEY_HELP" mapto="displayHelp" flags="m" />', '<key id="KEY_HELP" mapto="displayHelp" flags="b" />')
				changed = True
			if changed:
				print pluginPrintname, "Preparing keymap.xml..."
				keymapfile = open(keymappath, "w")
				keymapfile.write(keymaptext)
				keymapfile.close()
				keymapparser.removeKeymap(keymappath)
				keymapparser.readKeymap(keymappath)
		iAVSwitch = AVSwitch()
		if config.plugins.AspectRatioSwitch.autostart_ratio_enabled.value:
			iAVSwitch.setAspectRatio(int(config.plugins.AspectRatioSwitch.autostart_ratio.value))
			config.av.aspectratio.setValue(ASPECT[int(config.plugins.AspectRatioSwitch.autostart_ratio.value)])
			print pluginPrintname, "startup, keymap =", config.plugins.AspectRatioSwitch.keymap
			print pluginPrintname, "Initially set to:", ASPECT[int(config.plugins.AspectRatioSwitch.autostart_ratio.value)]	
		else:
			print pluginPrintname, "Initiation disabled"

		if config.plugins.AspectRatioSwitch.enabled.value and aspect_ratio_switch is None:
			aspect_ratio_switch = AspectRatioSwitch()
			aspect_ratio_switch.enable()
	elif reason == 1:
		print pluginPrintname, "shutdown"
		if aspect_ratio_switch is not None:
			aspect_ratio_switch.disable()
Beispiel #30
0
    def __init__(self, session, args=None):
        Screen.__init__(self, session)
        self.session = session
        self.Scale = AVSwitch().getFramebufferScale()
        self.PicLoad = ePicLoad()
        self["helperimage"] = Pixmap()
        self["helpertext"] = Label()

        self["titleText"] = StaticText("")
        self["titleText"].setText(_("Skinpart settings"))

        self["cancelBtn"] = StaticText("")
        self["cancelBtn"].setText(_("Cancel"))

        self["saveBtn"] = StaticText("")
        self["saveBtn"].setText(_("Save"))

        self["defaultsBtn"] = StaticText("")
        self["defaultsBtn"].setText(_("Defaults"))

        self["zoomBtn"] = StaticText("")
        self["zoomBtn"].setText(_("Zoom"))

        self.linkGlobalSkinParts()
        self.getSkinParts()

        ConfigListScreen.__init__(self,
                                  self.getMenuItemList(),
                                  session=session,
                                  on_change=self.selectionChanged)

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "DirectionActions", "InputActions",
                "ColorActions"
            ], {
                "left": self.keyLeft,
                "down": self.keyDown,
                "up": self.keyUp,
                "right": self.keyRight,
                "red": self.exit,
                "green": self.save,
                "blue": self.zoom,
                "yellow": self.defaults,
                "cancel": self.exit
            }, -1)

        self.onLayoutFinish.append(self.UpdatePicture)