# 需要导入模块: import locale [as 别名]
# 或者: from locale import gettext [as 别名]
def get_file_items(self, window, files):
# lightweight filter on file type and extension
if not any(f.is_directory() or f.get_name().endswith(VIDEO_EXTENSIONS) for f in files):
return
# create subliminal menu
subliminal_menuitem = Nautilus.MenuItem(name='SubliminalMenu::Subliminal', label='Subliminal')
sub_menus = Nautilus.Menu()
subliminal_menuitem.set_submenu(sub_menus)
# create choose submenu on single file
if len(files) == 1 and not files[0].is_directory():
choose_menuitem = Nautilus.MenuItem(name='SubliminalSubMenu::Choose', label=_('Choose subtitles'))
choose_menuitem.connect('activate', self.choose_callback, files)
sub_menus.append_item(choose_menuitem)
# create download submenu
download_menuitem = Nautilus.MenuItem(name='SubliminalSubMenu::Download', label=_('Download subtitles'))
download_menuitem.connect('activate', self.download_callback, files)
sub_menus.append_item(download_menuitem)
# create configure submenu
configure_menuitem = Nautilus.MenuItem(name='SubliminalSubMenu::Configure', label=_('Configure...'))
configure_menuitem.connect('activate', self.config_callback)
sub_menus.append_item(configure_menuitem)
return subliminal_menuitem,