Exemple #1
0
 def test_rotate(self):
     """Rotate image file."""
     with Image.open(self.filename) as im:
         orientation_before = im.size[0] < im.size[1]
     imageactions.rotate_file(self.files, 1)
     with Image.open(self.filename) as im:
         orientation_after = im.size[0] < im.size[1]
     self.assertNotEqual(orientation_before, orientation_after)
Exemple #2
0
 def test_rotate(self):
     """Rotate image file."""
     with Image.open(self.filename) as im:
         orientation_before = im.size[0] < im.size[1]
     imageactions.rotate_file(self.files, 1)
     with Image.open(self.filename) as im:
         orientation_after = im.size[0] < im.size[1]
     self.assertNotEqual(orientation_before, orientation_after)
Exemple #3
0
 def thread_for_simple_manipulations(self):
     """Rotate and flip image file in an extra thread."""
     to_remove = list(self.simple_manipulations.keys())
     for f in self.simple_manipulations:
         if self.simple_manipulations[f][0]:
             imageactions.rotate_file([f], self.simple_manipulations[f][0])
         if self.simple_manipulations[f][1]:
             imageactions.flip_file([f], True)
         if self.simple_manipulations[f][2]:
             imageactions.flip_file([f], False)
         if self.app["thumbnail"].toggled:
             self.app["thumbnail"].reload(f)
     for key in to_remove:
         del self.simple_manipulations[key]
Exemple #4
0
        def do_rotate_test(rotate_int):
            """Run the rotation test.

            Args:
                rotate_int: Number defining the rotation.
            """
            with Image.open(self.filename) as im:
                orientation_before = im.size[0] < im.size[1]
            imageactions.rotate_file(self.files, rotate_int)
            with Image.open(self.filename) as im:
                orientation_after = im.size[0] < im.size[1]
            if rotate_int in [1, 3]:
                self.assertNotEqual(orientation_before, orientation_after)
            elif rotate_int == 2:
                self.assertEqual(orientation_before, orientation_after)
Exemple #5
0
        def do_rotate_test(rotate_int):
            """Run the rotation test.

            Args:
                rotate_int: Number defining the rotation.
            """
            pb = GdkPixbuf.Pixbuf.new_from_file(self.filename)
            orientation_before = pb.get_width() < pb.get_height()
            imageactions.rotate_file(self.filename, rotate_int)
            pb = GdkPixbuf.Pixbuf.new_from_file(self.filename)
            orientation_after = pb.get_width() < pb.get_height()
            if rotate_int in [1, 3]:
                self.assertNotEqual(orientation_before, orientation_after)
            elif rotate_int == 2:
                self.assertEqual(orientation_before, orientation_after)
Exemple #6
0
 def _thread_for_apply(self):
     """Rotate and flip image file in an extra thread."""
     self.threads_running = True
     to_remove = list(self._changes.keys())
     for f in self._changes:
         if self._changes[f][0]:
             imageactions.rotate_file(f, self._changes[f][0])
         if self._changes[f][1]:
             imageactions.flip_file(f, True)
         if self._changes[f][2]:
             imageactions.flip_file(f, False)
     for key in to_remove:
         del self._changes[key]
     self.emit("applied-to-file", to_remove)
     self.threads_running = False
Exemple #7
0
    def thread_for_rotate(self, images, cwise):
        """Rotate all image files in an extra thread.

        Args:
            images: List of images to rotate.
            cwise: Rotate image 90 * cwise degrees.
        """
        try:
            # Finish older manipulate threads first
            while len(self.running_threads) > 1:
                self.running_threads[0].join()
            imageactions.rotate_file(images, cwise)
            if self.app["thumbnail"].toggled:
                for image in images:
                    self.app["thumbnail"].reload(
                        image, self.app.paths.index(image))
        except:
            self.app["statusbar"].err_message("Error: Rotation of file failed")
        self.running_threads.pop(0)
Exemple #8
0
    def thread_for_rotate(self, images, cwise):
        """Rotate all image files in an extra thread.

        Args:
            images: List of images to rotate.
            cwise: Rotate image 90 * cwise degrees.
        """
        try:
            # Finish older manipulate threads first
            while len(self.running_threads) > 1:
                self.running_threads[0].join()
            imageactions.rotate_file(images, cwise)
            if self.vimiv.thumbnail.toggled:
                for image in images:
                    self.vimiv.thumbnail.reload(image,
                                                self.vimiv.paths.index(image))
        except:
            self.vimiv.statusbar.err_message("Error: Rotation of file failed")
        self.running_threads.pop(0)