From c66e1df0cf87ca8e8170bcf1014545d75dcb7e95 Mon Sep 17 00:00:00 2001 From: martincuinet Date: Fri, 19 Nov 2021 14:44:10 +0100 Subject: [PATCH 1/2] Update comment.py --- qtazu/widgets/comment.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/qtazu/widgets/comment.py b/qtazu/widgets/comment.py index 0c06a99..85391fe 100644 --- a/qtazu/widgets/comment.py +++ b/qtazu/widgets/comment.py @@ -69,14 +69,11 @@ def dropEvent(self, event): class CommentWidget(QtWidgets.QDialog): """A CG-Wire comment widget - This includes the ability to take Screenshots from the widget by default, to disable use `set_allow_screenshot(False)` - If you are using this Widget in another interface that has its own submit button then use `set_button_visibility(False)` and trigger `submit()` from your surrounding widget. - """ StatusRole = QtCore.Qt.UserRole + 1 @@ -210,10 +207,8 @@ def set_close_on_submit(self, value): def set_thumbnail_visible(self, value): """Set thumbnail visibility - Disabling this also implicitly disables the screenshot feature since screenshotting is only possible by clicking the thumbnail. - """ self.thumbnail_label.setVisible(value) self.thumbnail.setVisible(value) @@ -225,11 +220,9 @@ def set_button_visible(self, value): def set_attachment(self, path): """Set the attachment. - Args: path (str): This should be a valid path that can be used as preview attachment for the comment. - """ assert os.path.exists(path), \ "Attachment path does not exist: %s" % path @@ -357,10 +350,7 @@ def submit(self): comment_text = self.comment.toPlainText() # Submit comment - comment = gazu.task.add_comment(task, - status, - comment=comment_text) - log.info("Submitted comment: %s", comment) + # Upload preview and attach to comment has_preview = bool(self._attachment) @@ -369,12 +359,19 @@ def submit(self): assert os.path.exists(filepath), \ "File does not exist: %s" % filepath - preview = gazu.task.add_preview(task, comment, filepath) - log.info("Submitted preview: %s", preview) + comment = gazu.task.add_comment(task, + status, + comment=comment_text, + attachments=[filepath]) + log.info("Submitted comment: %s", comment) # Clear the attachment self._attachment = None - + else: + comment = gazu.task.add_comment(task, + status, + comment=comment_text) + log.info("Submitted comment: %s", comment) if self._close_on_submit: # Close after submission for now to avoid confusion # todo: if not closing add message that submission succeeded @@ -391,4 +388,4 @@ def submit(self): screenshot = ScreenshotWidget() screenshot.set_button_visible(False) screenshot.set_allow_screenshot(False) - screenshot.set_thumbnail_visible(False) + screenshot.set_thumbnail_visible(False) \ No newline at end of file From d9f7c44932c282554ff7d158a129bbaaab914c4c Mon Sep 17 00:00:00 2001 From: martincuinet Date: Fri, 19 Nov 2021 14:47:24 +0100 Subject: [PATCH 2/2] Update screenmarquee.py --- qtazu/widgets/screenmarquee.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qtazu/widgets/screenmarquee.py b/qtazu/widgets/screenmarquee.py index 9b1bdf8..1bf8e93 100644 --- a/qtazu/widgets/screenmarquee.py +++ b/qtazu/widgets/screenmarquee.py @@ -3,6 +3,7 @@ import os from Qt import QtCore, QtGui, QtWidgets +from PyQt5.QtGui import QPixmap, QScreen class ScreenMarquee(QtWidgets.QDialog): @@ -128,7 +129,10 @@ def showEvent(self, event): self._fit_screen_geometry() # Start fade in animation - fade_anim = QtCore.QPropertyAnimation(self, b"_opacity_anim_prop", self) + property = "_opacity_anim_prop" + encoded_property = property.encode() + byte_array = bytearray(encoded_property) + fade_anim = QtCore.QPropertyAnimation(self, byte_array , self) fade_anim.setStartValue(self._opacity) fade_anim.setEndValue(50) fade_anim.setDuration(200) @@ -169,8 +173,9 @@ def get_desktop_pixmap(rect): QtGui.QPixmap: Captured pixmap image """ + screen = QtWidgets.QApplication.primaryScreen() desktop = QtWidgets.QApplication.desktop() - pixmap = QtGui.QPixmap.grabWindow(desktop.winId(), + pixmap = screen.grabWindow(desktop.winId(), rect.x(), rect.y(), rect.width(),