예제 #1
0
def test_backup_directories(mock_gtk_version):
    migration.backup()
    gtk_name = "vimiv-gtk-backup"
    for directory in (
        xdg.user_config_dir(gtk_name),
        xdg.user_cache_dir(gtk_name),
        xdg.user_data_dir(gtk_name),
    ):
        assert os.path.isdir(directory)
예제 #2
0
    def __init__(self, fail_pixmap: QPixmap, large: bool = True):
        super().__init__()
        self.large = large
        # Thumbnail creation should take no longer than 1 s
        self.pool.setExpiryTimeout(1000)

        directory = os.path.join(xdg.user_cache_dir(), "thumbnails")
        self.directory = (os.path.join(directory, "large")
                          if large else os.path.join(directory, "normal"))
        self.fail_directory = os.path.join(directory, "fail",
                                           f"vimiv-{vimiv.__version__}")
        xdg.makedirs(self.directory, self.fail_directory)
        self.fail_pixmap = fail_pixmap
예제 #3
0
    def __init__(self, large: bool = True):
        super().__init__()
        self.large = large
        # Thumbnail creation should take no longer than 1 s
        self.pool.setExpiryTimeout(1000)

        directory = os.path.join(xdg.user_cache_dir(), "thumbnails")
        self.directory = (
            os.path.join(directory, "large")
            if large
            else os.path.join(directory, "normal")
        )
        self.fail_directory = os.path.join(
            directory, "fail", "vimiv-%s" % (vimiv.__version__)
        )
        os.makedirs(self.directory, exist_ok=True)
        os.makedirs(self.fail_directory, exist_ok=True)
        self.fail_pixmap = pixmap_creater.error_thumbnail()
        # The signature is Callable[[], None] but this is actually a signal
        # Issue opened: https://github.com/stlehmann/PyQt5-stubs/issues/4
        QCoreApplication.instance().aboutToQuit.connect(self._on_quit)  # type: ignore