-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from Integration-Automation/dev
Add save image on generation image
- Loading branch information
Showing
6 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ requires = ["setuptools>=61.0"] | |
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "frontengine" | ||
version = "0.0.42" | ||
name = "frontengine_dev" | ||
version = "0.0.44" | ||
authors = [ | ||
{ name = "JE-Chen", email = "[email protected]" }, | ||
] | ||
|
35 changes: 32 additions & 3 deletions
35
frontengine/show/image_generation/image_generation_show.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,43 @@ | ||
from PySide6.QtGui import QPixmap | ||
from PySide6.QtWidgets import QWidget, QLabel, QGridLayout | ||
from pathlib import Path | ||
|
||
import PySide6 | ||
from PySide6.QtGui import QPixmap, QAction, Qt | ||
from PySide6.QtWidgets import QWidget, QLabel, QGridLayout, QFileDialog, QMenu | ||
|
||
from frontengine.utils.multi_language.language_wrapper import language_wrapper | ||
|
||
|
||
class ImageGenerateShow(QWidget): | ||
|
||
def __init__(self, pixmap: QPixmap): | ||
def __init__(self, pixmap: QPixmap, title: str): | ||
super().__init__() | ||
self.setWindowTitle(title) | ||
self.pixmap = pixmap | ||
self.label = QLabel() | ||
self.label.setPixmap(pixmap) | ||
self.grid_layout = QGridLayout(self) | ||
self.grid_layout.setContentsMargins(0, 0, 0, 0) | ||
self.grid_layout.addWidget(self.label) | ||
self.setLayout(self.grid_layout) | ||
|
||
# Menubar | ||
self.menu = QMenu(self) | ||
self.save_image_action = QAction(language_wrapper.language_word_dict.get("save_generation_image")) | ||
self.save_image_action.triggered.connect(self.save_image) | ||
self.menu.addAction(self.save_image_action) | ||
|
||
def save_image(self): | ||
file_path = QFileDialog().getSaveFileName( | ||
parent=self, | ||
dir=str(Path.cwd()), | ||
filter="Images (*.png;*.jpg;*.webp)" | ||
)[0] | ||
file_path = Path(file_path) | ||
if file_path.is_file(): | ||
self.pixmap.save(str(file_path)) | ||
|
||
def mousePressEvent(self, event: PySide6.QtGui.QMouseEvent) -> None: | ||
if event.button() == Qt.MouseButton.RightButton: | ||
self.menu.move(self.x() + event.x(), self.y() + event.y()) | ||
self.menu.show() | ||
super().mousePressEvent(event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ requires = ["setuptools>=61.0"] | |
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "frontengine_dev" | ||
name = "frontengine" | ||
version = "0.0.43" | ||
authors = [ | ||
{ name = "JE-Chen", email = "[email protected]" }, | ||
|