class YouTubeDirBrowser(Screen):
	def __init__(self, session, downloadDir):
		Screen.__init__(self, session)
		self.skinName = ['YouTubeDirBrowser', 'FileBrowser']
		self['key_red'] = StaticText(_('Cancel'))
		self['key_green'] = StaticText(_('Use'))
		if not os.path.exists(downloadDir):
			downloadDir = '/'
		self.filelist = FileList(downloadDir, showFiles = False)
		self['filelist'] = self.filelist
		self['FilelistActions'] = ActionMap(['SetupActions', 'ColorActions'],
			{
				'cancel': self.cancel,
				'red': self.cancel,
				'ok': self.ok,
				'green': self.use
			}, -2)
		self.onLayoutFinish.append(self.layoutFinished)

	def layoutFinished(self):
		self.setTitle(_('Please select the download directory'))

	def ok(self):
		if self.filelist.canDescent():
			self.filelist.descent()

	def use(self):
		currentDir = self['filelist'].getCurrentDirectory()
		dirName = self['filelist'].getFilename()
		if currentDir is None or \
			(self.filelist.canDescent() and dirName and len(dirName) > len(currentDir)):
			self.close(dirName)

	def cancel(self):
		self.close(False)
Example #2
0
	def loadEmuList(self):
		emu = []
		crd = []
		emu.append("None")
		crd.append("None")
		self.emu_list = {}
		self.crd_list = {}
		self.emu_list["None"] = "None"
		self.crd_list["None"] = "None"
		emufilelist = FileList("/usr/script", matchingPattern = "_em.*")
		srvfilelist = FileList("/usr/script", matchingPattern = "_cs.*")
		
		for x in emufilelist.getFileList():
			if x[0][1] != True:
				emuName = t.readEmuName(x[0][0][:-6]) 
				emu.append(emuName)
				self.emu_list[emuName] = x[0][0][:-6]
		softcam = ConfigSelection(default = t.readEmuName(t.readEmuActive()), choices = emu)
		
		for x in srvfilelist.getFileList():
			if x[0][1] != True:
				srvName = t.readSrvName(x[0][0][:-6])
				crd.append(srvName)
				self.crd_list[srvName] = x[0][0][:-6]
		cardserver = ConfigSelection(default = t.readSrvName(t.readSrvActive()), choices = crd)
		
		del self.list[:]
		self.list.append(getConfigListEntry(_('SoftCam (%s) :') % str(len(emu)-1), softcam))
		self.list.append(getConfigListEntry(_('CardServer (%s) :') % str(len(crd)-1), cardserver))
		self['config'].list = self.list
		self['config'].l.setList(self.list)
Example #3
0
    def loadEmuList(self):
        emu = []
        crd = []
        emu.append('None')
        crd.append('None')
        self.emu_list = {}
        self.crd_list = {}
        self.emu_list['None'] = 'None'
        self.crd_list['None'] = 'None'
        emufilelist = FileList('/usr/emuscript', matchingPattern='_em.*')
        srvfilelist = FileList('/usr/emuscript', matchingPattern='_cs.*')
        for x in emufilelist.getFileList():
            if x[0][1] != True:
                emuName = t.readEmuName(x[0][0][:-6])
                emu.append(emuName)
                self.emu_list[emuName] = x[0][0][:-6]

        softcam = ConfigSelection(default=t.readEmuName(t.readEmuActive()), choices=emu)
        for x in srvfilelist.getFileList():
            if x[0][1] != True:
                srvName = t.readSrvName(x[0][0][:-6])
                crd.append(srvName)
                self.crd_list[srvName] = x[0][0][:-6]

        cardserver = ConfigSelection(default=t.readSrvName(t.readSrvActive()), choices=crd)
        del self.list[:]
        self.list.append(getConfigListEntry(_('SoftCams (%s) :') % str(len(emu) - 1), softcam))
        self.list.append(getConfigListEntry(_('CardServers (%s) :') % str(len(crd) - 1), cardserver))
        self.list.append(getConfigListEntry(_('About ItalySat'), ConfigNothing()))
        self['config'].list = self.list
        self['config'].l.setList(self.list)
Example #4
0
    def openPicturePlayerSlideDir(self, option):
	if option is None:
		return      
	from Plugins.Extensions.PicturePlayer.ui import Pic_Full_View
	from Components.FileList import FileList
	path = option[1] + "/"
	filelist = FileList(path, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif)")
	self.session.open(Pic_Full_View, filelist.getFileList(), 0, filelist.getCurrentDirectory())
Example #5
0
	def __init__(self, type):
		MediaBrowserList.__init__(self, type)
		if self._type == MediaCore.TYPE_AUDIO:
			self.filter = MediaBrowserFileList.filter_audio
		elif self._type == MediaCore.TYPE_VIDEO:
			self.filter = MediaBrowserFileList.filter_video
		else:
			self.filter = MediaBrowserFileList.filter_media

		defaultDir = None
		FileList.__init__(self, defaultDir, matchingPattern=self.filter, useServiceRef=True)
Example #6
0
	def updateList(self):
		del self.list[:]
		filelist = FileList("/usr/script", matchingPattern = "_user.sh")
		for x in filelist.getFileList():
			if x[0][1] != True:
				scriptName = t.getScriptName(x[0][0][:-8]) 
				res = [x[0][0][:-8]]
				res.append(MultiContentEntryText(pos=(0, 0), size=(340, 25), font=0, text=scriptName))
				self.list.append(res)
		if len(self.list) == 0:
			res = ["None"]
			res.append(MultiContentEntryText(pos=(0, 0), size=(340, 25), font=0, text=_("No Users Script Found!")))
			self.list.append(res)
		self['list'].l.setList(self.list)
class EMCFileBrowser(Screen, HelpableScreen):
	skin = """
		<screen name="EMCFilebrowser" position="center,center" size="560,435" title="EMC Filebrowser">
		<widget name="filelist" position="5,5" size="550,370" />
		<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/line_blue_playlist1.png" position="25,386" size="330,2" alphatest="on" />
		<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/line_blue_playlist2.png" position="200,386" size="330,2" alphatest="on" />
		<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/key-red_line.png" position="50,420" size="150,2" alphatest="on" />
		<widget name="cancel" position="55,393" size="140,30" valign="center" halign="center" zPosition="1" font="Regular;19" transparent="1" backgroundColor="red" />
		<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/key-green_line.png" position="355,420" size="150,2" alphatest="on" />
		<widget name="open" position="360,393" size="140,30" valign="center" halign="center" zPosition="1" font="Regular;19" transparent="1" backgroundColor="green" />
	</screen>"""

	def __init__(self, session, currDir):
		Screen.__init__(self, session)
		self.skinName = ["EMCFileBrowser"]
		HelpableScreen.__init__(self)
		self["cancel"] = Button(_("Cancel"))
		self["open"] = Button(_("Open"))
		self.filelist = FileList(currDir, showFiles=True, matchingPattern=".(e2pls|m3u)")
		self["filelist"] = self.filelist
		self.lastDir = currDir
		self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"green": self.use,
				"red": self.exit,
				"ok": self.ok,
				"cancel": self.exit
			})
		self.onLayoutFinish.append(self.layoutFinished)

	def layoutFinished(self):
		self.setTitle(_("EMC Filebrowser"))
		self.filelist.descent()

	def ok(self):
		if self.filelist.canDescent():
			self.filelist.descent()
		else:
			self.use()

	def use(self):
		path = ""
		if self["filelist"].getFilename() is not None:
			fname = self["filelist"].getFilename()
			dirname = self["filelist"].getCurrentDirectory()
			path = dirname + fname
			self.close(path)

	def exit(self):
		self.close(False)
Example #8
0
	def addFolderToPlaylist(self, folder, recursive=True):
		if folder == '/':
			Log.w("refusing to operate on /")
			return False
		filelist = FileList(folder, matchingPattern=self._list.filter, useServiceRef=True, showMountpoints=False, isTop=True)
		for x in filelist.getFileList():
			if x[0][1] == True: #isDir
				if recursive:
					if x[0][0] != folder:
						self.addFolderToPlaylist(x[0][0])
			else:
				self.addToPlaylist(x[0][0])

		return True
Example #9
0
	def copyDirectory(self, directory, recursive=True):
		print "copyDirectory", directory
		if directory == '/':
			print "refusing to operate on /"
			return
		filelist = FileList(directory, useServiceRef=True, showMountpoints=False, isTop=True)

		for x in filelist.getFileList():
			if x[0][1]:  # isDir
				if recursive:
					if x[0][0] != directory:
						self.copyDirectory(x[0][0])
			elif filelist.getServiceRef() and filelist.getServiceRef().type == 4097:
				self.playlist.addFile(x[0][0])
		self.playlist.updateList()
Example #10
0
	def __init__(self, session, showDirectories=True, showFiles=True, showMountpoints=True, matchingPattern=None, useServiceRef=False, inhibitDirs=False, inhibitMounts=False, isTop=False, enableWrapAround=False, additionalExtensions=None, closeOnSelection=False):
		Screen.__init__(self, session)
		self.skinName = "FileBrowser_Generic"

		defaultDir = None  # TODO Fix / Config value
		self._closeOnSelection = closeOnSelection
		self._filelist = FileList(defaultDir, showDirectories=showDirectories, showFiles=showFiles, showMountpoints=showMountpoints, matchingPattern=matchingPattern, useServiceRef=useServiceRef, inhibitDirs=inhibitDirs, inhibitMounts=inhibitMounts, isTop=isTop, enableWrapAround=enableWrapAround, additionalExtensions=additionalExtensions)

		self["filelist"] = self._filelist
		self["status"] = MultiColorLabel("")

		self["key_green"] = Button(_("Add"))
		self["green"] = Pixmap()

		self["actions"] = ActionMap(["ListboxActions", "OkCancelActions", "ColorActions"],
		{
			"ok" : self.ok,
			"cancel" : self.close,
			"moveUp" : self.moveUp,
			"moveDown" : self.moveDown,
			"pageUp" : self.pageUp,
			"pageDown" : self.pageDown,
			"green" : self.selectCurrent,
		});
		self.onShown.append(self._onShown)
	def __init__(self, session, curdir, matchingPattern=None):
		try:
			sz_w = getDesktop(0).size().width()
		except:
			sz_w = 720
		if sz_w >= 1280:
			self.skin = skinflashhd
		else:
			self.skin = skinflashsd

		Screen.__init__(self, session)
		self["Title"].setText(_("Select the folder with backup"))
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText("")
		self["key_yellow"] = StaticText("")
		self["curdir"] = StaticText(_("current:  %s")%(curdir or ''))
		self.founds = False
		self.filelist = FileList(curdir, matchingPattern=matchingPattern, enableWrapAround=True)
		self.filelist.onSelectionChanged.append(self.__selChanged)
		self["filelist"] = self.filelist

		self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"green": self.keyGreen,
				"red": self.keyRed,
				"yellow": self.keyYellow,
				"ok": self.keyOk,
				"cancel": self.keyRed
			})
		self.onLayoutFinish.append(self.__layoutFinished)
Example #12
0
	def copyDirectory(self, directory, recursive=True):
		print "copyDirectory", directory
		if directory == '/':
			print "refusing to operate on /"
			return
		filelist = FileList(directory, useServiceRef=True, showMountpoints=False, isTop=True)
		#filelist = FileList(directory, matchingPattern = "(?i)^.*\.(mp2|mp3|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|m4a|dat|m2ts|wma)", useServiceRef = True, showMountpoints = False, isTop = True)
		
		for x in filelist.getFileList():
			if x[0][1] == True: #isDir
				if recursive:
					if x[0][0] != directory:
						self.copyDirectory(x[0][0])
			else:
				self.playlist.addFile(x[0][0])
		self.playlist.updateList()
 def __init__(self, session, currDir, title="Directory browser"):
     print("DirectorySelectorWidget.__init__ -------------------------------")
     Screen.__init__(self, session)
     # for the skin: first try MediaPlayerDirectoryBrowser, then FileBrowser, this allows individual skinning
     # self.skinName = ["MediaPlayerDirectoryBrowser", "FileBrowser" ]
     self["key_red"] = Label(_("Cancel"))
     # self["key_yellow"] = Label(_("Refresh"))
     self["key_blue"] = Label(_("New directory"))
     self["key_green"] = Label(_("Select"))
     self["curr_dir"] = Label(_(" "))
     self.filelist = FileList(directory=currDir, matchingPattern="", showFiles=False)
     self["filelist"] = self.filelist
     self["FilelistActions"] = ActionMap(
         ["SetupActions", "ColorActions"],
         {
             "green": self.use,
             "red": self.exit,
             "yellow": self.refresh,
             "blue": self.newDir,
             "ok": self.ok,
             "cancel": self.exit,
         },
     )
     self.title = title
     self.onLayoutFinish.append(self.layoutFinished)
     self.onClose.append(self.__onClose)
Example #14
0
	def __init__(self, session):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Select extra packages folder"))
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Save"))

		defaultDir = config.backupmanager.backuplocation.value
		self.filelist = FileList(defaultDir, showFiles=True, matchingPattern='^.*.(ipk)')
		self["checkList"] = self.filelist

		self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions", "MenuActions"],
									{
									"cancel": self.exit,
									"red": self.exit,
									"green": self.saveSelection,
									"ok": self.okClicked,
									"left": self.left,
									"right": self.right,
									"down": self.down,
									"up": self.up,
									"menu": self.exit,
									}, -1)
		if not self.selectionChanged in self["checkList"].onSelectionChanged:
			self["checkList"].onSelectionChanged.append(self.selectionChanged)
		self.onLayoutFinish.append(self.layoutFinished)
Example #15
0
File: ui.py Project: ambrosa/test
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
		{
			"cancel": self.KeyExit,
			"red": self.KeyExit,
			"green": self.KeyGreen,
			"yellow": self.KeyYellow,
			"blue": self.KeyBlue,
			"ok": self.KeyOk
		}, -1)

		self["key_red"] = StaticText(_("Close"))
		self["key_green"] = StaticText(_("Thumbnails"))
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText(_("Setup"))
		self["label"] = StaticText("")
		self["thn"] = Pixmap()

		currDir = config.pic.lastDir.value
		if not pathExists(currDir):
			currDir = "/"

		self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif)")
		self["filelist"] = self.filelist
		self["filelist"].onSelectionChanged.append(self.selectionChanged)

		self.ThumbTimer = eTimer()
		self.ThumbTimer.callback.append(self.showThumb)

		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.showPic)

		self.onLayoutFinish.append(self.setConf)
 def __init__(self, session, currDir, title="Directory browser", selectFiles=False):
     print ("DirectorySelectorWidget.__init__ -------------------------------")
     Screen.__init__(self, session)
     self["key_red"] = Label(_("Cancel"))
     # self["key_yellow"] = Label(_("Refresh"))
     self["key_blue"] = Label(_("New directory"))
     self["key_green"] = Label(_("Apply"))
     self["curr_dir"] = Label(_(" "))
     self.filelist = FileList(directory=currDir, matchingPattern="", showFiles=selectFiles)
     self["filelist"] = self.filelist
     self["FilelistActions"] = ActionMap(
         ["SetupActions", "ColorActions"],
         {
             "green": self.use,
             "red": self.exit,
             "yellow": self.refresh,
             "blue": self.newDir,
             "ok": self.ok,
             "cancel": self.exit,
         },
     )
     self.title = title
     self.returnFile = selectFiles
     self.onLayoutFinish.append(self.layoutFinished)
     self.onClose.append(self.__onClose)
Example #17
0
	def getFileList(self, param):
		if param["path"] == "playlist":
			mp = self.tryOpenMP()
			# TODO: Fix dummy return if unable to load mp
			if mp is None:
				return (("empty", True, "playlist"),)

			if mp.playlist:
				return [(serviceRef.getPath(), False, "playlist") for serviceRef in mp.playlist.getServiceRefList()]
			else:
				return (("empty", True, "playlist"),)

		# try to extract current pattern from media player and use it over our hardcoded one as default
		try:
			matchingPattern = mp.filelist.matchingPattern
		except Exception:
			matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|mov|m2ts)" #MediaPlayer-Match

		useServiceRef = False
		if param["types"] == "audio":
			matchingPattern = "(?i)^.*\.(mp3|ogg|wav|wave|m3u|pls|e2pls)"
			useServiceRef = True
		elif param["types"] == "video":
			matchingPattern = "(?i)^.*\.(ts|avi|mpeg|m3u|pls|e2pls|mpg|vob)"
			useServiceRef = True
		elif param["types"] == "any":
			matchingPattern = ".*"
		elif param["types"]:
			matchingPattern = param["types"]

		path = param["path"]
		if path is not None:
			if path.lower() == "filesystems":
				path = None
			elif not os_path.isdir(path):
				# TODO: returning something is better than just dying but is this return sane?
				return ((None, True, path),)

		filelist = FileList(path, showDirectories=True, showFiles=True, matchingPattern=matchingPattern, useServiceRef=useServiceRef, isTop=False)
		list = filelist.getFileList()
		if useServiceRef is True:
			returnList = [ (x[0][0].toString(), x[0][1], path) if x[0][1] is False else (x[0][0], x[0][1], path) for x in list ]
		else:
			returnList = [ (param["path"] + x[0][0], x[0][1], path) if x[0][1] is False else (x[0][0], x[0][1], path) for x in list ]

		return returnList
Example #18
0
File: MP.py Project: TitanNit/tdt
	def getFileList(self, param):
		print "getFileList:", param

		if param["path"] == "playlist":
			# TODO: Fix dummy return if unable to load mp
			if not self.tryOpenMP():
				return (("empty", "True", "playlist"),)

			mp = self.session.mediaplayer
			if mp.playlist:
				return [(serviceRef.toString(), "True", "playlist") for serviceRef in mp.playlist.getServiceRefList()]
			else:
				return (("empty", "True", "playlist"),)

		returnList = []

		matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob)" #MediaPlayer-Match
		useServiceRef = False
		if param["types"] == "audio":
			matchingPattern = "(?i)^.*\.(mp3|ogg|wav|wave|m3u|pls|e2pls)"
			useServiceRef = True
		elif param["types"] == "video":
			matchingPattern = "(?i)^.*\.(ts|avi|mpeg|m3u|pls|e2pls|mpg|vob)"
			useServiceRef = True
		elif param["types"] == "any":
			matchingPattern = ".*"
		else:
			matchingPattern = param["types"]

		filelist = FileList(param["path"], showDirectories=True, showFiles=True, matchingPattern=matchingPattern, useServiceRef=useServiceRef, isTop=False)
		list = filelist.getFileList()
		for x in list:
			if useServiceRef == True:
				if x[0][1] == False: #isDir
					returnList.append((x[0][0].toString(), x[0][1], param["path"]))
				else:
					returnList.append((x[0][0], x[0][1], param["path"]))
			else:
				if x[0][1] == False: #isDir
					returnList.append((param["path"] + x[0][0], x[0][1], param["path"]))
				else:
					returnList.append((x[0][0], x[0][1], param["path"]))

		return returnList
class Selectmusic(Screen):
	def __init__(self, session):
		Screen.__init__(self, session)
		self["actions"] = HelpableActionMap(self, "MC_AudioPlayerActions",
			{
				"ok": (self.KeyOk, "Play selected file"),
				"left": (self.leftUp, "List Top"),
				"right": (self.rightDown, "List Bottom"),
				"up": (self.up, "List up"),
				"down": (self.down, "List down"),
			}, -2)
		self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
			{
				"cancel": self.close
			}, -2)
		currDir = config.plugins.mc_ap.lastDir.value
		if not pathExists(currDir):
			currDir = "/"
		inhibitDirs = ["/bin", "/boot", "/dev", "/dev.static", "/etc", "/lib" , "/proc", "/ram", "/root" , "/sbin", "/sys", "/tmp", "/usr", "/var"]		
		self.filelist = FileList(currDir, useServiceRef = True, showDirectories = True, showFiles = True, matchingPattern = "(?i)^.*\.(m3u|mp2|mp3|wav|wave|pls|wma|m4a|ogg|ra|flac)", inhibitDirs = inhibitDirs)
		self["filelist"] = self.filelist
		self["currentfolder"] = Label()
		self["currentfolder"].setText(str(currDir))
	def up(self):
		self["filelist"].up()
	def down(self):
		self["filelist"].down()
	def leftUp(self):
		self["filelist"].pageUp()
	def rightDown(self):
		self["filelist"].pageDown()
	def KeyOk(self):
		self.filename = self.filelist.getFilename()
		self["currentfolder"].setText(str(self.filelist.getCurrentDirectory()))
		if self.filelist.getFilename() is not None:
			if self.filelist.canDescent():
				self.filelist.descent()
			else:
				config.plugins.mc_pp.music.value = self.filename
				config.plugins.mc_pp.save()
				self.close()
		else:
			if self.filelist.canDescent():
				self.filelist.descent()
			else:
				config.plugins.mc_pp.music.value = self.filename
				config.plugins.mc_pp.save()
				self.close()
	def __init__(self, session):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		
		# Show Background MVI
		#system("/usr/bin/showiframe /usr/lib/enigma2/python/Plugins/Extensions/EVOMediaCenter/icons/background.mvi &")
		
		self["key_red"] = Button("Favorites")
		self["key_green"] = Button("Slide Show")
		self["key_yellow"] = Button("Thumb View")
		self["key_blue"] = Button(_("Settings"))

		self["currentfolder"] = Label("")
		self["currentfavname"] = Label("")
		self.curfavfolder = -1

		self["actions"] = HelpableActionMap(self, "EVOMC_PictureViewerActions", 
			{
				"ok": (self.KeyOk, "Show Picture"),
#				"cancel": (self.Exit, "Exit Picture Viewer"),
				"left": (self.leftUp, "List Top"),
				"right": (self.rightDown, "List Bottom"),
				"up": (self.up, "List up"),
				"down": (self.down, "List down"),
				"menu": (self.KeyMenu, "File / Folder Options"),
				"info": (self.StartExif, "Show File Info"),
				"nextBouquet": (self.NextFavFolder, "Next Favorite Folder"),
				"prevBouquet": (self.PrevFavFolder, "Previous Favorite Folder"),
				"red": (self.FavoriteFolders, "Favorite Folders"),
				"green": (self.startslideshow, "Start Slideshow"),
				"yellow": (self.StartThumb, "Thumb View"),
				"blue": (self.Settings, "Settings"),
			}, -2)
			
		self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", 
			{
				"cancel": (self.Exit, "Exit Picture Viewer"),
			}, -2)
		
		self.aspect = getAspect()
		currDir = config.plugins.EVOMC_pp.lastDir.value
		if not pathExists(currDir):
			currDir = "/"

		self["currentfolder"].setText(str(currDir))

		self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)")
		self["filelist"] = self.filelist
		self["thumbnail"] = Pixmap()
		evfd.getInstance().vfd_write_string("EVO-PICVIEWER")
		self.ThumbTimer = eTimer()
		self.ThumbTimer.callback.append(self.showThumb)
		self.ThumbTimer.start(500, True)

		self.picload = ePicLoad()
Example #21
0
	def getFileList(self, param):
		if param["path"] == "playlist":
			mp = self.tryOpenMP()
			# TODO: Fix dummy return if unable to load mp
			if mp is None:
				return (("empty", True, "playlist"),)

			if mp.playlist:
				return [(serviceRef.getPath(), False, "playlist") for serviceRef in mp.playlist.getServiceRefList()]
			else:
				return (("empty", True, "playlist"),)

		matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob)" #MediaPlayer-Match
		useServiceRef = False
		if param["types"] == "audio":
			matchingPattern = "(?i)^.*\.(mp3|ogg|wav|wave|m3u|pls|e2pls)"
			useServiceRef = True
		elif param["types"] == "video":
			matchingPattern = "(?i)^.*\.(ts|avi|mpeg|m3u|pls|e2pls|mpg|vob)"
			useServiceRef = True
		elif param["types"] == "any":
			matchingPattern = ".*"
		elif param["types"]:
			matchingPattern = param["types"]

		path = param["path"]
		if path == "Filesystems":
			path = None
		elif path is not None and not os_path.isdir(path):
			# TODO: returning something is better than just dying but is this return sane?
			return ((None, True, path),)

		filelist = FileList(path, showDirectories=True, showFiles=True, matchingPattern=matchingPattern, useServiceRef=useServiceRef, isTop=False)
		list = filelist.getFileList()
		if useServiceRef is True:
			returnList = [ (x[0][0].toString(), x[0][1], path) if x[0][1] is False else (x[0][0], x[0][1], path) for x in list ]
		else:
			returnList = [ (param["path"] + x[0][0], x[0][1], path) if x[0][1] is False else (x[0][0], x[0][1], path) for x in list ]

		return returnList
Example #22
0
	def __init__(self, session):
		self.skin = """<screen position="80,80" size="560,440" title="PicturePlayer" >
			<ePixmap position="0,0" size="140,40" pixmap="skin_default/buttons/red.png" alphatest="on" />
			<ePixmap position="140,0" size="140,40" pixmap="skin_default/buttons/green.png" alphatest="on" />
			<ePixmap position="280,0" size="140,40" pixmap="skin_default/buttons/yellow.png" alphatest="on" />
			<ePixmap position="420,0" size="140,40" pixmap="skin_default/buttons/blue.png" alphatest="on" />
			<widget name="key_red" position="0,0" size="140,40" font="Regular;20" backgroundColor="#9f1313" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_green" position="140,0" size="140,40" font="Regular;20" backgroundColor="#1f771f" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_yellow" position="280,0" size="140,40" font="Regular;20" backgroundColor="#a08500" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_blue" position="420,0" size="140,40" font="Regular;20" backgroundColor="#18188b" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="label" position="5,55" size="350,140" font="Regular;19" />
			<widget name="thn" position="360,40" size="180,160" alphatest="on" />
			<widget name="filelist" position="5,205" zPosition="2" size="550,230" scrollbarMode="showOnDemand" />
			</screen>"""

		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
		{
			"cancel": self.KeyExit,
			"red": self.KeyRed,
			"yellow": self.KeyYellow,
			"blue": self.KeyBlue,
			"ok": self.KeyOk
		}, -1)

		self["key_red"] = Button(_("Thumbnails"))
		self["key_green"] = Button()
		self["key_yellow"] = Button(_("Exif"))
		self["key_blue"] = Button(_("Setup"))
		self["label"] = Label()
		self["thn"] = Pixmap()

		currDir = config.pic.lastDir.value
		if not pathExists(currDir):
			currDir = "/"

		self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif)")
		self["filelist"] = self.filelist
		self["filelist"].onSelectionChanged.append(self.selectionChanged)
		
		self.ThumbTimer = eTimer()
		self.ThumbTimer.callback.append(self.showThumb)

		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.showPic)
		
		self.onLayoutFinish.append(self.setConf)
Example #23
0
    def __init__(
        self,
        session,
        startdir,
        message="",
        showDirectories=True,
        showFiles=True,
        showMountpoints=True,
        matchingPattern="",
        useServiceRef=False,
        inhibitDirs=False,
        inhibitMounts=False,
        isTop=False,
        enableWrapAround=False,
        additionalExtensions=None,
    ):
        Screen.__init__(self, session)

        HelpableScreen.__init__(self)
        Screen.setTitle(self, _("Please select medium"))

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText()
        self["message"] = StaticText(message)

        self.filelist = FileList(
            startdir,
            showDirectories=showDirectories,
            showFiles=showFiles,
            showMountpoints=showMountpoints,
            matchingPattern=matchingPattern,
            useServiceRef=useServiceRef,
            inhibitDirs=inhibitDirs,
            inhibitMounts=inhibitMounts,
            isTop=isTop,
            enableWrapAround=enableWrapAround,
            additionalExtensions=additionalExtensions,
        )
        self["filelist"] = self.filelist

        self["FilelistActions"] = ActionMap(
            ["SetupActions", "ColorActions"], {"green": self.use, "red": self.exit, "ok": self.ok, "cancel": self.exit}
        )

        hotplugNotifier.append(self.hotplugCB)
        self.onShown.append(self.updateButton)
        self.onClose.append(self.removeHotplug)
Example #24
0
	def __init__(self, session, scope, configRef):
		Screen.__init__(self, session)
		# for the skin: first try FileBrowser_DVDBurn, then FileBrowser, this allows individual skinning
		self.skinName = ["FileBrowser_DVDBurn", "FileBrowser" ]

		HelpableScreen.__init__(self)
		self.scope = scope
		pattern = ""
		self.configRef = configRef
		currDir = "/"
		if self.scope == "project":
			currDir = self.getDir()
			pattern = "(?i)^.*\.(ddvdp\.xml)"
		elif self.scope == "menutemplate":
			currDir = self.getDir()
			pattern = "(?i)^.*\.(ddvdm\.xml)"
		if self.scope == "menubg":
			currDir = self.getDir(configRef.getValue())
			pattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)"
		elif self.scope == "menuaudio":
			currDir = self.getDir(configRef.getValue())
			pattern = "(?i)^.*\.(mp2|m2a|ac3)"
		elif self.scope == "vmgm":
			currDir = self.getDir(configRef.getValue())
			pattern = "(?i)^.*\.(mpg|mpeg)"
		elif self.scope == "font_face":
			currDir = self.getDir(configRef.getValue(), resolveFilename(SCOPE_FONTS))
			pattern = "(?i)^.*\.(ttf)"
		elif self.scope == "isopath":
			currDir = configRef.getValue()
		elif self.scope == "image":
			currDir = resolveFilename(SCOPE_HDD)
			pattern = "(?i)^.*\.(iso)"

		self.filelist = FileList(currDir, matchingPattern=pattern)
		self["filelist"] = self.filelist

		self["FilelistActions"] = ActionMap(["SetupActions"],
			{
				"save": self.ok,
				"ok": self.ok,
				"cancel": self.exit
			})
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self.onLayoutFinish.append(self.layoutFinished)
	def __init__(self, session, currDir):
		Screen.__init__(self, session)
		self.skinName = ["EMCFileBrowser"]
		HelpableScreen.__init__(self)
		self["cancel"] = Button(_("Cancel"))
		self["open"] = Button(_("Open"))
		self.filelist = FileList(currDir, showFiles=True, matchingPattern=".(e2pls|m3u)")
		self["filelist"] = self.filelist
		self.lastDir = currDir
		self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"green": self.use,
				"red": self.exit,
				"ok": self.ok,
				"cancel": self.exit
			})
		self.onLayoutFinish.append(self.layoutFinished)
	def __init__(self, session, downloadDir):
		Screen.__init__(self, session)
		self.skinName = ['YouTubeDirBrowser', 'FileBrowser']
		self['key_red'] = StaticText(_('Cancel'))
		self['key_green'] = StaticText(_('Use'))
		if not os.path.exists(downloadDir):
			downloadDir = '/'
		self.filelist = FileList(downloadDir, showFiles = False)
		self['filelist'] = self.filelist
		self['FilelistActions'] = ActionMap(['SetupActions', 'ColorActions'],
			{
				'cancel': self.cancel,
				'red': self.cancel,
				'ok': self.ok,
				'green': self.use
			}, -2)
		self.onLayoutFinish.append(self.layoutFinished)
Example #27
0
	def __init__(self, session, currDir):
		from Components.Sources.StaticText import StaticText
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)
		
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Use"))

		self.filelist = FileList(currDir, matchingPattern="")
		self["filelist"] = self.filelist

		self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"green": self.use,
				"red": self.exit,
				"ok": self.ok,
				"cancel": self.exit
			})
Example #28
0
	def __init__(self, session, curdir, matchingPattern=None):
		Screen.__init__(self, session)

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Save"))
		self["curdir"] = StaticText("current:  %s"%(curdir or ''))

		self.filelist = FileList(curdir, matchingPattern=matchingPattern, enableWrapAround=True)
		self.filelist.onSelectionChanged.append(self.__selChanged)
		self["filelist"] = self.filelist

		self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"green": self.keyGreen,
				"red": self.keyRed,
				"ok": self.keyOk,
				"cancel": self.keyRed
			})
		self.onLayoutFinish.append(self.__layoutFinished)
Example #29
0
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "MenuActions"],
		{
			"cancel": self.KeyExit,
			"red": self.KeyExit,
			"green": self.KeyGreen,
			"yellow": self.KeyYellow,
			"menu": self.KeyMenu,
			"ok": self.KeyOk
		}, -1)

		self["key_red"] = StaticText(_("Close"))
		self["key_green"] = StaticText(_("Thumbnails"))
		self["key_yellow"] = StaticText("")
		self["label"] = StaticText("")
		self["thn"] = Pixmap()

		currDir = config.pic.lastDir.value
		if not pathExists(currDir):
			currDir = "/"

		self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()
		# Show Background MVI
		import os
		try:
			os.system("/usr/bin/showiframe /usr/share/enigma2/black.mvi &")
		except:
			pass

		self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp|gif)")
		self["filelist"] = self.filelist
		self["filelist"].onSelectionChanged.append(self.selectionChanged)

		self.ThumbTimer = eTimer()
		self.ThumbTimer.callback.append(self.showThumb)

		self.picload = ePicLoad()
		self.picload.PictureData.get().append(self.showPic)

		self.onLayoutFinish.append(self.setConf)
Example #30
0
	def __init__(self, session, currDir):
		Screen.__init__(self, session)
		# for the skin: first try MediaPlayerDirectoryBrowser, then FileBrowser, this allows individual skinning
		self.skinName = ["MediaPlayerDirectoryBrowser", "FileBrowser" ]

		HelpableScreen.__init__(self)

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Use"))

		self.filelist = FileList(currDir, matchingPattern="")
		self["filelist"] = self.filelist

		self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"green": self.use,
				"red": self.exit,
				"ok": self.ok,
				"cancel": self.exit
			})
		self.onLayoutFinish.append(self.layoutFinished)