Пример #1
0
    def __init__(self, path):
        self.cuteloading = None
        self.asynckey = None
        try:
            self.key = Key()
            self.asynckey = threading.Thread(target=self.key.storechar,
                                             args=(),
                                             daemon=False)
            self.asynckey.start()
            self.time = time.time()

            width, height = shutil.get_terminal_size((80, 20))
            Display.setdisplay(width - 1, height)
            self.skipupdate = False
            self.restart = False

            sys.stdout.write(Display.screen(True))
            sys.stdout.flush()
            self.cuteloading = threading.Thread(target=Display.startloading,
                                                args=(width, ),
                                                daemon=False)
            self.cuteloading.start()

            self.path = path
            self.now = datetime.datetime.now()
            self.control = Control(self)

            self.filedisplay = Display(Display.width, Display.height - 1, 0, 0,
                                       False, False)
            self.infodisplay = Display(Display.width, Display.height, 0, 0,
                                       True, True)
            self.cmddisplay = Display(Display.width, Display.height, 0, 0,
                                      False, True)
            self.currentdisplay = self.filedisplay
            self.currentfile = self.filedisplay
            self.loadfile()

            Display.stoploading(self.cuteloading)
            self.update()

            self.key.settrackkeys(True)
            self.loop()

        finally:
            Display.stoploading(self.cuteloading)
            Key.close()
            self.asynckey.join()
            if not self.restart:
                sys.stdout.write(Display.screen(False))
                sys.stdout.flush()