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 = '******' + 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 __init__(self, ui=None, bookmarks=None, tags=None, paths=['.']): """Initialize FM.""" Actions.__init__(self) SignalDispatcher.__init__(self) if ui is None: self.ui = UI() else: self.ui = ui self.start_paths = paths self.directories = dict() self.log = deque(maxlen=1000) 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() try: self.username = pwd.getpwuid(os.geteuid()).pw_name except Exception: self.username = '******' + str(os.geteuid()) self.hostname = socket.gethostname() self.home_path = os.path.expanduser('~') self.log.appendleft('ranger {0} started! Process ID is {1}.'.format( __version__, os.getpid())) self.log.appendleft('Running on Python ' + sys.version.replace('\n', '')) mimetypes.knownfiles.append(os.path.expanduser('~/.mime.types')) mimetypes.knownfiles.append(self.relpath('data/mime.types')) self.mimetypes = mimetypes.MimeTypes()