Beispiel #1
0
    def check_fonts(self):
        if 'skin.estuary' == get_skin_name():
            raise FontManagerException(FontManagerException.INSTALL_NOT_NEEDED)

        if self.is_restart_needed():
            raise FontManagerException(FontManagerException.RESTART_NEEDED)

        if get_current_skin_path() != get_local_skin_path():
            if not self.is_writable():
                raise FontManagerException(
                    FontManagerException.INSTALL_NOT_NEEDED)
            raise FontManagerException(FontManagerException.INSTALL_NEEDED)

        else:
            if not os.path.isdir(get_local_skin_path()):
                raise FontManagerException(FontManagerException.INSTALL_NEEDED)
            for f in self._list_skin_font_files():
                self.__doc_cache.add(f)
            self.install_fonts()
Beispiel #2
0
    def is_restart_needed():
        # type: () -> bool
        current_skin_path = get_current_skin_path()
        local_skin_path = get_local_skin_path()

        if os.path.isdir(
                local_skin_path) and current_skin_path != local_skin_path:
            if is_invalid_local_skin():
                time_suffix = datetime.now().strftime('%Y%m%d%H%M%S')
                shutil.move(local_skin_path,
                            local_skin_path + '-skinutils-' + time_suffix)
                copy_skin_to_userdata(ask_user=False)
            return True
        return False
Beispiel #3
0
 def is_writable():
     # type: () -> bool
     skin_path = get_local_skin_path()
     return not os.access(skin_path,
                          os.W_OK) or not do_write_test(skin_path)