当前位置: 首页>>代码示例>>Python>>正文


Python Bookmarks.enable_saving_backtick_bookmark方法代码示例

本文整理汇总了Python中ranger.container.bookmarks.Bookmarks.enable_saving_backtick_bookmark方法的典型用法代码示例。如果您正苦于以下问题:Python Bookmarks.enable_saving_backtick_bookmark方法的具体用法?Python Bookmarks.enable_saving_backtick_bookmark怎么用?Python Bookmarks.enable_saving_backtick_bookmark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ranger.container.bookmarks.Bookmarks的用法示例。


在下文中一共展示了Bookmarks.enable_saving_backtick_bookmark方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FM

# 需要导入模块: from ranger.container.bookmarks import Bookmarks [as 别名]
# 或者: from ranger.container.bookmarks.Bookmarks import enable_saving_backtick_bookmark [as 别名]
class FM(Actions,  # pylint: disable=too-many-instance-attributes
         SignalDispatcher):
    input_blocked = False
    input_blocked_until = 0
    mode = 'normal'  # either 'normal' or 'visual'.
    search_method = 'ctime'

    _previous_selection = None
    _visual_reverse = False
    _visual_pos_start = None
    _visual_move_cycles = None

    def __init__(self, ui=None, bookmarks=None, tags=None, paths=None):
        """Initialize FM."""
        Actions.__init__(self)
        SignalDispatcher.__init__(self)
        self.ui = ui if ui is not None else UI()
        self.start_paths = paths if paths is not None else ['.']
        self.directories = dict()
        self.bookmarks = bookmarks
        self.current_tab = 1
        self.tabs = {}
        self.tags = tags
        self.restorable_tabs = deque([], ranger.MAX_RESTORABLE_TABS)
        self.py3 = sys.version_info >= (3, )
        self.previews = {}
        self.default_linemodes = deque()
        self.loader = Loader()
        self.copy_buffer = set()
        self.do_cut = False
        self.metadata = MetadataManager()
        self.image_displayer = None
        self.run = None
        self.rifle = None
        self.thistab = None

        try:
            self.username = pwd.getpwuid(os.geteuid()).pw_name
        except KeyError:
            self.username = 'uid:' + str(os.geteuid())
        self.hostname = socket.gethostname()
        self.home_path = os.path.expanduser('~')

        mimetypes.knownfiles.append(os.path.expanduser('~/.mime.types'))
        mimetypes.knownfiles.append(self.relpath('data/mime.types'))
        self.mimetypes = mimetypes.MimeTypes()

    def initialize(self):
        """If ui/bookmarks are None, they will be initialized here."""

        self.tabs = dict((n + 1, Tab(path)) for n, path in enumerate(self.start_paths))
        tab_list = self.get_tab_list()
        if tab_list:
            self.current_tab = tab_list[0]
            self.thistab = self.tabs[self.current_tab]
        else:
            self.current_tab = 1
            self.tabs[self.current_tab] = self.thistab = Tab('.')

        if not ranger.args.clean and os.path.isfile(self.confpath('rifle.conf')):
            rifleconf = self.confpath('rifle.conf')
        else:
            rifleconf = self.relpath('config/rifle.conf')
        self.rifle = Rifle(rifleconf)
        self.rifle.reload_config()

        def set_image_displayer():
            if self.image_displayer:
                self.image_displayer.quit()
            self.image_displayer = self._get_image_displayer()
        set_image_displayer()
        self.settings.signal_bind('setopt.preview_images_method', set_image_displayer,
                                  priority=settings.SIGNAL_PRIORITY_AFTER_SYNC)

        self.settings.signal_bind(
            'setopt.preview_images',
            lambda signal: signal.fm.previews.clear(),
        )

        if ranger.args.clean:
            self.tags = TagsDummy("")
        elif self.tags is None:
            self.tags = Tags(self.datapath('tagged'))

        if self.bookmarks is None:
            if ranger.args.clean:
                bookmarkfile = None
            else:
                bookmarkfile = self.datapath('bookmarks')
            self.bookmarks = Bookmarks(
                bookmarkfile=bookmarkfile,
                bookmarktype=Directory,
                autosave=self.settings.autosave_bookmarks)
            self.bookmarks.load()
            self.bookmarks.enable_saving_backtick_bookmark(
                self.settings.save_backtick_bookmark)

        self.ui.setup_curses()
        self.ui.initialize()

#.........这里部分代码省略.........
开发者ID:phantasea,项目名称:ranger,代码行数:103,代码来源:fm.py


注:本文中的ranger.container.bookmarks.Bookmarks.enable_saving_backtick_bookmark方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。