Skip to content

Commit

Permalink
add_editor unique names problem solved
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-martinr committed Jan 5, 2022
1 parent 2247837 commit c1ae8b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/pycture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def add_editor(self, image: QImage = None, name: str = "", editor: Editor = None
name = name + "+" + extension

if editor:
editor.setWindowTitle(name)
self.editors[name] = editor
else:
self.editors[name] = Editor(self, image, name)
Expand Down
9 changes: 7 additions & 2 deletions src/pycture/commands/edit_commands/rotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ def __init__(self, parent: QWidget):
}

def apply_rotation(self, editor_title, interpolation_technique, angle):
image, title = self.get_active_image_and_title(self.main_window)
editor = self.main_window.editors.get(editor_title)
image = editor.get_image()
title = editor.windowTitle()

rotated_image = image.rotate(
angle, self.interpolation_techniques[interpolation_technique])

str_angle = str(angle).replace(".", "'")
self.main_window.add_editor(editor=Editor(
self.main_window, rotated_image, title + f' rotated {angle}º'))
self.main_window, rotated_image, title + f' rotated {str_angle}º'))

def execute(self, main_window: QMainWindow):
# Open dialog
Expand Down

0 comments on commit c1ae8b2

Please sign in to comment.