Example #1
0
def add_video_item(query, infolabels, total_items=0, icon='', image='', fanart='', replace_menu=True, menu=None, format=None, random_url=True, in_progress=False):
	if 'display' in infolabels: infolabels['title'] = infolabels['display']
	if not fanart:
		fanart = get_path() + '/fanart.jpg'
	if format is not None:
		text = format % infolabels['title']
	else:
		text = infolabels['title']
	if icon:
		image = vfs.join(ARTWORK, icon)
	listitem = xbmcgui.ListItem(text, iconImage=image, thumbnailImage=image)
	cast = infolabels.pop('cast', None)
	try:
		if cast is not None: listitem.setCast(cast)
	except: pass
	#watched = False
	#if 'playcount' in infolabels and int(infolabels['playcount']) > 0: watched = True 
	#if not watched and in_progress:
	#	listitem.setProperty('totaltime', '999999')
	#	listitem.setProperty('resumetime', "1")
	#	infolabels['playcount'] = 0
	listitem.setInfo('video', infolabels)
	listitem.setProperty('IsPlayable', 'true')
	if MC_NATIVE:
		listitem.setProperty('Master.Control', 'native')
	listitem.setProperty('fanart_image', fanart)
	if random_url: query['rand'] = random.random()
	if menu is None:
		menu = ContextMenu()
	menu.add("Addon Settings", {"mode": "addon_settings"}, script=True)
	listitem.addContextMenuItems(menu.get(), replaceItems=replace_menu)
	plugin_url = get_plugin_url(query)
	xbmcplugin.addDirectoryItem(HANDLE_ID, plugin_url, listitem, isFolder=False, totalItems=total_items)
Example #2
0
    def display(self):
        """show status bar"""

        self.win.erase()
        adir = self.app.act_pane.act_tab
        maxw = self.app.maxw
        if len(adir.selections) > 0:
            if maxw >= 45:
                size = 0
                for f in adir.selections:
                    size += adir.files[f][files.FT_SIZE]
                self.win.addstr('    %s bytes in %d files' % \
                                (num2str(size), len(adir.selections)))
        else:
            if maxw >= 80:
                self.win.addstr('File: %4d of %-4d' % \
                                (adir.file_i + 1, adir.nfiles))
                filename = adir.sorted[adir.file_i]
                if adir.vfs:
                    realpath = os.path.join(
                        vfs.join(self.app.act_pane.act_tab), filename)
                else:
                    realpath = files.get_realpath(
                        adir.path, filename,
                        adir.files[filename][files.FT_TYPE])
                path = (len(realpath)>maxw-35) and \
                    '~' + realpath[-(maxw-37):] or realpath
                self.win.addstr(0, 20, 'Path: ' + utils.encode(path))
        if maxw > 10:
            try:
                self.win.addstr(0, maxw - 8, 'F1=Help')
            except:
                pass
        self.win.refresh()
Example #3
0
File: lfm.py Project: langner/lfm
    def display(self):
        """show status bar"""

        self.win.erase()
        adir = self.app.act_pane.act_tab
        maxw = self.app.maxw
        if len(adir.selections) > 0:
            if maxw >= 45:
                size = 0
                for f in adir.selections:
                    size += adir.files[f][files.FT_SIZE]
                self.win.addstr('    %s bytes in %d files' % \
                                (num2str(size), len(adir.selections)))
        else:
            if maxw >= 80:
                self.win.addstr('File: %4d of %-4d' % \
                                (adir.file_i + 1, adir.nfiles))
                filename = adir.sorted[adir.file_i]
                if adir.vfs:
                    realpath = os.path.join(vfs.join(self.app.act_pane.act_tab),
                                            filename)
                else:
                    realpath = files.get_realpath(adir.path, filename,
                                                  adir.files[filename][files.FT_TYPE])
                path = (len(realpath)>maxw-35) and \
                    '~' + realpath[-(maxw-37):] or realpath
                self.win.addstr(0, 20, 'Path: ' + utils.encode(path))
        if maxw > 10:
            try:
                self.win.addstr(0, maxw-8, 'F1=Help')
            except:
                pass
        self.win.refresh()
def notify(title,
           message,
           timeout=1500,
           image=vfs.join(get_path(), 'icon.png')):
    cmd = "XBMC.Notification(%s, %s, %s, %s)" % (
        title.encode('utf-8'), message.encode('utf-8'), timeout, image)
    xbmc.executebuiltin(cmd)
def add_video_item(query, infolabels, total_items=0, icon='', image='', fanart='', replace_menu=True, menu=None, format=None):
	if 'display' in infolabels: infolabels['title'] = infolabels['display']
	if not fanart:
		fanart = get_path() + '/fanart.jpg'
	if format is not None:
		text = format % infolabels['title']
	else:
		text = infolabels['title']
	if icon:
		image = vfs.join(ARTWORK, icon)		
	listitem = xbmcgui.ListItem(text, iconImage=image, thumbnailImage=image)
	cast = infolabels.pop('cast', None)
	try:
		if cast is not None: listitem.setCast(cast)
	except: pass
	listitem.setInfo('video', infolabels)
	listitem.setProperty('IsPlayable', 'true')
	listitem.setProperty('fanart_image', fanart)
	query['rand'] = random.random()
	if menu is None:
		menu = ContextMenu()
	menu.add("Addon Settings", {"mode": "addon_settings"}, script=True)
	listitem.addContextMenuItems(menu.get(), replaceItems=replace_menu)
	plugin_url = get_plugin_url(query)
	xbmcplugin.addDirectoryItem(HANDLE_ID, plugin_url, listitem, isFolder=False, totalItems=total_items)
Example #6
0
def add_menu_item(query,
                  infolabels,
                  total_items=0,
                  icon='',
                  image='',
                  fanart='',
                  replace_menu=True,
                  menu=None,
                  visible=True,
                  format=None,
                  in_progress=False):
    if 'display' in infolabels: infolabels['title'] = infolabels['display']
    if hasattr(visible, '__call__'):
        if visible() is False: return
    else:
        if visible is False: return

    if not fanart and 'fanart' in infolabels and infolabels['fanart']:
        fanart = infolabels['fanart']
    elif not fanart:
        fanart = get_path() + '/fanart.jpg'
    if format is not None:
        text = format % infolabels['title']
    else:
        text = infolabels['title']

    if icon:
        image = vfs.join(ARTWORK, icon)

    listitem = xbmcgui.ListItem(text, iconImage=image, thumbnailImage=image)
    cast = infolabels.pop('cast', None)
    try:
        if cast is not None: listitem.setCast(cast)
    except:
        pass
    watched = False
    if 'playcount' in infolabels and int(infolabels['playcount']) > 0:
        watched = True
    if not watched and in_progress:
        listitem.setProperty('totaltime', '999999')
        listitem.setProperty('resumetime', "1")
        infolabels['playcount'] = 0
    listitem.setInfo('video', infolabels)
    listitem.setProperty('IsPlayable', 'false')
    if MC_NATIVE:
        listitem.setProperty('Master.Control', 'native')
    listitem.setProperty('fanart_image', fanart)
    if menu is None:
        menu = ContextMenu()
    menu.add("Addon Settings", {"mode": "addon_settings"}, script=True)
    listitem.addContextMenuItems(menu.get(), replaceItems=replace_menu)
    plugin_url = get_plugin_url(query)
    xbmcplugin.addDirectoryItem(HANDLE_ID,
                                plugin_url,
                                listitem,
                                isFolder=True,
                                totalItems=total_items)
Example #7
0
def multi_select(heading, options, selected=[]):
	from commoncore.basewindow import BaseWindow
	from commoncore.enum import enum
	CONTROLS = enum(CLOSE=82000, LIST=85001, TITLE=85005, CANCEL=85011, OK=85012)
	skin_path = vfs.join("special://home/addons", "script.module.commoncore/")
	class MultiSelect(BaseWindow):
		def __init__(self, *args, **kwargs):
			BaseWindow.__init__(self)
			self.return_val = []
	
		def onInit(self):
			for c in options:
				if type(c) is tuple:
					t,v = c
					liz = xbmcgui.ListItem(t, iconImage='')
					liz.setProperty("value", v)
				elif type(c) is list:
					t = c[0]
					v = c[1]
				else:
					t = c
					v = options.index(c)
				liz = xbmcgui.ListItem(t, iconImage='')
				liz.setProperty("value", str(v))
				if options.index(c) in selected:
					liz.setProperty("selected", "checked.png")
				self.getControl(CONTROLS.LIST).addItem(liz)
			self.getControl(CONTROLS.TITLE).setLabel(heading)
			self.setFocus(self.getControl(CONTROLS.LIST))
		
		def onClick(self, controlID):
			if controlID==CONTROLS.LIST:
				index = self.getControl(CONTROLS.LIST).getSelectedPosition()
				s = self.getControl(CONTROLS.LIST).getListItem(index).getProperty("selected") != ""
				if s:
					self.getControl(CONTROLS.LIST). getListItem(index).setProperty("selected", "")
				else:
					self.getControl(CONTROLS.LIST). getListItem(index).setProperty("selected", "checked.png")
	
			elif controlID in [ CONTROLS.CLOSE, CONTROLS.CANCEL]:
				self.close()
			elif controlID == CONTROLS.OK:
				for index in xrange(self.getControl(CONTROLS.LIST).size()):
					if self.getControl(CONTROLS.LIST).getListItem(index).getProperty("selected") != "":
						self.return_val.append(self.getControl(CONTROLS.LIST).getListItem(index).getProperty("value"))
				self.close()

	s = MultiSelect("multi_select.xml", skin_path)
	return s.show()
Example #8
0
def add_menu_item(query,
                  infolabels,
                  total_items=0,
                  icon='',
                  image='',
                  fanart='',
                  replace_menu=True,
                  menu=None,
                  visible=True,
                  format=None):
    if 'display' in infolabels: infolabels['title'] = infolabels['display']
    if hasattr(visible, '__call__'):
        if visible() is False: return
    else:
        if visible is False: return

    if not fanart:
        fanart = get_path() + '/fanart.jpg'
    if format is not None:
        text = format % infolabels['title']
    else:
        text = infolabels['title']

    if icon:
        image = vfs.join(ARTWORK, icon)

    listitem = xbmcgui.ListItem(text, iconImage=image, thumbnailImage=image)
    cast = infolabels.pop('cast', None)
    try:
        if cast is not None: listitem.setCast(cast)
    except:
        pass
    listitem.setInfo('video', infolabels)
    listitem.setProperty('IsPlayable', 'false')
    listitem.setProperty('fanart_image', fanart)
    if menu is None:
        menu = ContextMenu()
    menu.add("Torrent Manager", {"mode": "torrent_manager"}, script=True)
    menu.add("Addon Settings", {"mode": "addon_settings"}, script=True)
    listitem.addContextMenuItems(menu.get(), replaceItems=replace_menu)

    plugin_url = get_plugin_url(query)
    xbmcplugin.addDirectoryItem(HANDLE_ID,
                                plugin_url,
                                listitem,
                                isFolder=True,
                                totalItems=total_items)
Example #9
0
 def display(self):
     self.visible = True
     tab = self.app.act_pane.act_tab
     path = vfs.join(tab) if tab.vfs else tab.path
     l = self.app.maxw / 6 - 4
     if len(path) > l:
         path = '~' + path[-l - 1:]
     useridchar = '#' if os.getuid() == 0 else '$'
     self.win.erase()
     self.win.addstr('[%s]%s ' % (utils.encode(path), useridchar),
                     curses.color_pair(24) | curses.A_BOLD)
     self.win.refresh()
     le = len(path) + 4
     self.entry = messages.EntryLine(self.app.maxw - le + 4,
                                     1,
                                     self.app.maxh - 1,
                                     le,
                                     self.text,
                                     'cli',
                                     True,
                                     tab.path,
                                     cli=True)
     self.entry.pos = self.pos
     messages.cursor_show2()
     self.pwin.top()
     while True:
         ans = self.entry.manage_keys()
         if ans == -1:  # Ctrl-C
             self.text, self.pos = self.entry.text, self.entry.pos
             cmd = ''
             break
         elif ans == 10:  # return
             self.text, self.pos = '', 0
             cmd = self.entry.text.strip()
             break
     self.hide()
     if cmd != '':
         self.execute(cmd, tab)
         if len(messages.history['cli']) >= messages.MAX_HISTORY:
             messages.history['cli'].remove(messages.history['cli'][0])
         if messages.history['cli'].count(cmd) >= 1:
             messages.history['cli'].remove(cmd)
         messages.history['cli'].append(cmd)
Example #10
0
def add_video_item(query,
                   infolabels,
                   total_items=0,
                   icon='',
                   image='',
                   fanart='',
                   replace_menu=True,
                   menu=None,
                   format=None):
    if 'display' in infolabels: infolabels['title'] = infolabels['display']
    if not fanart:
        fanart = get_path() + '/fanart.jpg'
    if format is not None:
        text = format % infolabels['title']
    else:
        text = infolabels['title']
    if icon:
        image = vfs.join(ARTWORK, icon)
    listitem = xbmcgui.ListItem(text, iconImage=image, thumbnailImage=image)
    cast = infolabels.pop('cast', None)
    try:
        if cast is not None: listitem.setCast(cast)
    except:
        pass
    listitem.setInfo('video', infolabels)
    listitem.setProperty('IsPlayable', 'true')
    if MC_NATIVE:
        listitem.setProperty('Master.Control', 'native')
    listitem.setProperty('fanart_image', fanart)
    query['rand'] = random.random()
    if menu is None:
        menu = ContextMenu()
    menu.add("Addon Settings", {"mode": "addon_settings"}, script=True)
    listitem.addContextMenuItems(menu.get(), replaceItems=replace_menu)
    plugin_url = get_plugin_url(query)
    xbmcplugin.addDirectoryItem(HANDLE_ID,
                                plugin_url,
                                listitem,
                                isFolder=False,
                                totalItems=total_items)
Example #11
0
File: lfm.py Project: langner/lfm
 def display(self):
     self.visible = True
     tab = self.app.act_pane.act_tab
     path = vfs.join(tab) if tab.vfs else tab.path
     l = self.app.maxw/6 - 4
     if len(path) > l:
         path = '~'+ path[-l-1:]
     useridchar = '#' if os.getuid()==0 else '$'
     self.win.erase()
     self.win.addstr('[%s]%s ' % (utils.encode(path), useridchar),
                     curses.color_pair(24) | curses.A_BOLD)
     self.win.refresh()
     le = len(path) + 4
     self.entry = messages.EntryLine(self.app.maxw-le+4, 1, self.app.maxh-1, le,
                                     self.text, 'cli', True, tab.path, cli=True)
     self.entry.pos = self.pos
     messages.cursor_show2()
     self.pwin.top()
     while True:
         ans = self.entry.manage_keys()
         if ans == -1:           # Ctrl-C
             self.text, self.pos = self.entry.text, self.entry.pos
             cmd = ''
             break
         elif ans == 10:         # return
             self.text, self.pos = '', 0
             cmd = self.entry.text.strip()
             break
     self.hide()
     if cmd != '':
         self.execute(cmd, tab)
         if len(messages.history['cli']) >= messages.MAX_HISTORY:
             messages.history['cli'].remove(messages.history['cli'][0])
         if messages.history['cli'].count(cmd) >= 1:
             messages.history['cli'].remove(cmd)
         messages.history['cli'].append(cmd)
Example #12
0
def handel_error(title, message, timeout=3000):
	image=vfs.join(ARTWORK, 'error.png')
	cmd = "XBMC.Notification(%s, %s, %s, %s)" % (title.encode('utf-8'), message.encode('utf-8'), timeout, image)
	xbmc.executebuiltin(cmd)
	sys.exit()
Example #13
0
def notify(title, message, timeout=1500, image=vfs.join(get_path(), 'icon.png')):
	cmd = "XBMC.Notification(%s, %s, %s, %s)" % (title.encode('utf-8'), message.encode('utf-8'), timeout, image)
	xbmc.executebuiltin(cmd)
Example #14
0
pickle = _pickle.dumps
mode='main'
args = {}
__dispatcher = {}
__args = {}
__kwargs = {}

addon = xbmcaddon.Addon()
__get_setting = addon.getSetting
__set_setting = addon.setSetting
show_settings = addon.openSettings
sleep = xbmc.sleep
get_condition_visiblity = xbmc.getCondVisibility

PLATFORM = sys.platform
ARTWORK = vfs.join(addon.getAddonInfo('path').decode('utf-8'), 'resources/artwork')
def unpickle(pickled):
	try:
		return _pickle.loads(pickled)
	except TypeError:
		return _pickle.loads(str(pickled))

def save_data(file, data, format='pickle', compress=False):
	if format == 'pickle':
		if compress:
			data =  zlib.compress(pickle(data))
		else:
			data = pickle(data)
		vfs.write_file(file, data, mode='b')
	else:
		data = json.dumps(data)
Example #15
0
File: lfm.py Project: langner/lfm
    def display_files(self):
        tab = self.act_tab
        self.win.erase()

        # calculate pane width, height and vertical start position
        w = self.dims[1]
        if self.mode != PANE_MODE_FULL:
            h, y = self.maxh-5, 2
        else:
            h, y = self.maxh-2, 0

        # headers
        if self.mode != PANE_MODE_FULL:
            if self == self.app.act_pane:
                self.win.attrset(curses.color_pair(5))
                attr = curses.color_pair(6) | curses.A_BOLD
            else:
                self.win.attrset(curses.color_pair(2))
                attr = curses.color_pair(2)
            path = tab.vfs and vfs.join(tab) or tab.path
            path = (len(path)>w-5) and '~' + path[-w+5:] or path
            self.win.box()
            self.win.addstr(0, 2, utils.encode(path), attr)
            self.win.addstr(1, 1,
                            'Name'.center(self.pos_col1-2)[:self.pos_col1-2],
                            curses.color_pair(2) | curses.A_BOLD)
            self.win.addstr(1, self.pos_col1+2, 'Size',
                            curses.color_pair(2) | curses.A_BOLD)
            self.win.addstr(1, self.pos_col2+5, 'Date',
                            curses.color_pair(2) | curses.A_BOLD)
        else:
            if tab.nfiles > h:
                self.win.vline(0, w-1, curses.ACS_VLINE, h)

        # files
        for i in xrange(tab.file_z - tab.file_a + 1):
            filename = tab.sorted[i+tab.file_a]
            # get file info
            res = files.get_fileinfo_dict(tab.path, filename,
                                          tab.files[filename])
            # get file color
            if tab.selections.count(filename):
                attr = curses.color_pair(10) | curses.A_BOLD
            else:
                if self.app.prefs.options['color_files']:
                    attr = self.get_filetypecolorpair(filename, tab.files[filename][files.FT_TYPE])
                else:
                    attr = curses.color_pair(2)
            # show
            if self.mode == PANE_MODE_FULL:
                buf = tab.get_fileinfo_str_long(res, w)
                self.win.addstr(i, 0, utils.encode(buf), attr)
            else:
                buf = tab.get_fileinfo_str_short(res, w, self.pos_col1)
                self.win.addstr(i+2, 1, utils.encode(buf), attr)

        # vertical separators
        if self.mode != PANE_MODE_FULL:
            self.win.vline(1, self.pos_col1, curses.ACS_VLINE, self.dims[0]-2)
            self.win.vline(1, self.pos_col2, curses.ACS_VLINE, self.dims[0]-2)

        # vertical scroll bar
        y0, n = self.__calculate_scrollbar_dims(h, tab.nfiles, tab.file_i)
        self.win.vline(y+y0, w-1, curses.ACS_CKBOARD, n)
        if tab.file_a != 0:
            self.win.vline(y, w-1, '^', 1)
            if (n == 1) and (y0 == 0):
                self.win.vline(y+1, w-1, curses.ACS_CKBOARD, n)
        if tab.nfiles  > tab.file_a + h:
            self.win.vline(h+y-1, w-1, 'v', 1)
            if (n == 1) and (y0 == h-1):
                self.win.vline(h+y-2, w-1, curses.ACS_CKBOARD, n)

        self.win.refresh()
Example #16
0
def multi_select(heading, options, selected=[]):
    from commoncore.basewindow import BaseWindow
    from commoncore.enum import enum
    CONTROLS = enum(CLOSE=82000,
                    LIST=85001,
                    TITLE=85005,
                    CANCEL=85011,
                    OK=85012)
    skin_path = vfs.join("special://home/addons", "script.module.commoncore/")

    class MultiSelect(BaseWindow):
        def __init__(self, *args, **kwargs):
            BaseWindow.__init__(self)
            self.return_val = []

        def onInit(self):
            for c in options:
                if type(c) is tuple:
                    t, v = c
                    liz = xbmcgui.ListItem(t, iconImage='')
                    liz.setProperty("value", v)
                elif type(c) is list:
                    t = c[0]
                    v = c[1]
                else:
                    t = c
                    v = options.index(c)
                liz = xbmcgui.ListItem(t, iconImage='')
                liz.setProperty("value", str(v))
                if options.index(c) in selected:
                    liz.setProperty("selected", "checked.png")
                self.getControl(CONTROLS.LIST).addItem(liz)
            self.getControl(CONTROLS.TITLE).setLabel(heading)
            self.setFocus(self.getControl(CONTROLS.LIST))

        def onClick(self, controlID):
            if controlID == CONTROLS.LIST:
                index = self.getControl(CONTROLS.LIST).getSelectedPosition()
                s = self.getControl(CONTROLS.LIST).getListItem(
                    index).getProperty("selected") != ""
                if s:
                    self.getControl(
                        CONTROLS.LIST).getListItem(index).setProperty(
                            "selected", "")
                else:
                    self.getControl(
                        CONTROLS.LIST).getListItem(index).setProperty(
                            "selected", "checked.png")

            elif controlID in [CONTROLS.CLOSE, CONTROLS.CANCEL]:
                self.close()
            elif controlID == CONTROLS.OK:
                for index in xrange(self.getControl(CONTROLS.LIST).size()):
                    if self.getControl(CONTROLS.LIST).getListItem(
                            index).getProperty("selected") != "":
                        self.return_val.append(
                            self.getControl(CONTROLS.LIST).getListItem(
                                index).getProperty("value"))
                self.close()

    s = MultiSelect("multi_select.xml", skin_path)
    return s.show()
Example #17
0
def handel_error(title, message, timeout=3000):
    image = vfs.join(ARTWORK, 'error.png')
    cmd = "XBMC.Notification(%s, %s, %s, %s)" % (
        title.encode('utf-8'), message.encode('utf-8'), timeout, image)
    xbmc.executebuiltin(cmd)
    sys.exit()
Example #18
0

mode = 'main'
args = {}
__dispatcher = {}
__kargs = {}

addon = xbmcaddon.Addon()
__get_setting = addon.getSetting
__set_setting = addon.setSetting
show_settings = addon.openSettings
open_settings = show_settings
sleep = xbmc.sleep
get_condition_visiblity = xbmc.getCondVisibility
PLATFORM = sys.platform
ARTWORK = vfs.join(
    addon.getAddonInfo('path').decode('utf-8'), 'resources/artwork')
try:
    HANDLE_ID = int(sys.argv[1])
    ADDON_URL = sys.argv[0]
    PLUGIN_URL = sys.argv[0] + sys.argv[2]
except:
    HANDLE_ID = -1
    ADDON_URL = 'plugin://%s' % addon.getAddonInfo('name')
    PLUGIN_URL = 'plugin://%s' % addon.getAddonInfo('name')


def exit():
    sys.exit()


def get_addon(addon_id):
Example #19
0
    def display_files(self):
        tab = self.act_tab
        self.win.erase()

        # calculate pane width, height and vertical start position
        w = self.dims[1]
        if self.mode != PANE_MODE_FULL:
            h, y = self.maxh - 5, 2
        else:
            h, y = self.maxh - 2, 0

        # headers
        if self.mode != PANE_MODE_FULL:
            if self == self.app.act_pane:
                self.win.attrset(curses.color_pair(5))
                attr = curses.color_pair(6) | curses.A_BOLD
            else:
                self.win.attrset(curses.color_pair(2))
                attr = curses.color_pair(2)
            path = tab.vfs and vfs.join(tab) or tab.path
            path = (len(path) > w - 5) and '~' + path[-w + 5:] or path
            self.win.box()
            self.win.addstr(0, 2, utils.encode(path), attr)
            self.win.addstr(
                1, 1, 'Name'.center(self.pos_col1 - 2)[:self.pos_col1 - 2],
                curses.color_pair(2) | curses.A_BOLD)
            self.win.addstr(1, self.pos_col1 + 2, 'Size',
                            curses.color_pair(2) | curses.A_BOLD)
            self.win.addstr(1, self.pos_col2 + 5, 'Date',
                            curses.color_pair(2) | curses.A_BOLD)
        else:
            if tab.nfiles > h:
                self.win.vline(0, w - 1, curses.ACS_VLINE, h)

        # files
        for i in xrange(tab.file_z - tab.file_a + 1):
            filename = tab.sorted[i + tab.file_a]
            # get file info
            res = files.get_fileinfo_dict(tab.path, filename,
                                          tab.files[filename])
            # get file color
            if tab.selections.count(filename):
                attr = curses.color_pair(10) | curses.A_BOLD
            else:
                if self.app.prefs.options['color_files']:
                    attr = self.get_filetypecolorpair(
                        filename, tab.files[filename][files.FT_TYPE])
                else:
                    attr = curses.color_pair(2)
            # show
            if self.mode == PANE_MODE_FULL:
                buf = tab.get_fileinfo_str_long(res, w)
                self.win.addstr(i, 0, utils.encode(buf), attr)
            else:
                buf = tab.get_fileinfo_str_short(res, w, self.pos_col1)
                self.win.addstr(i + 2, 1, utils.encode(buf), attr)

        # vertical separators
        if self.mode != PANE_MODE_FULL:
            self.win.vline(1, self.pos_col1, curses.ACS_VLINE,
                           self.dims[0] - 2)
            self.win.vline(1, self.pos_col2, curses.ACS_VLINE,
                           self.dims[0] - 2)

        # vertical scroll bar
        y0, n = self.__calculate_scrollbar_dims(h, tab.nfiles, tab.file_i)
        self.win.vline(y + y0, w - 1, curses.ACS_CKBOARD, n)
        if tab.file_a != 0:
            self.win.vline(y, w - 1, '^', 1)
            if (n == 1) and (y0 == 0):
                self.win.vline(y + 1, w - 1, curses.ACS_CKBOARD, n)
        if tab.nfiles > tab.file_a + h:
            self.win.vline(h + y - 1, w - 1, 'v', 1)
            if (n == 1) and (y0 == h - 1):
                self.win.vline(h + y - 2, w - 1, curses.ACS_CKBOARD, n)

        self.win.refresh()