From b6d13166bc323ff59187d0f9d1d27c03ff1c7b0b Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 29 May 2016 16:49:00 +0300 Subject: [PATCH] some updates - rubberband and callbacks --- src/callbacks.py | 3 ++- src/mainscreen.py | 4 ++-- src/widgets.py | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index aa89016..f354998 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -171,7 +171,8 @@ def tox_file_recv(window, tray): if not window.isActiveWindow(): friend = profile.get_friend_by_number(friend_number) if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY']: - invoke_in_main_thread(tray_notification, 'File from ' + friend.name, file_name, tray, window) + file_from = QtGui.QApplication.translate("Callback", "File from", None, QtGui.QApplication.UnicodeUTF8) + invoke_in_main_thread(tray_notification, file_from + ' ' + friend.name, file_name, tray, window) if settings['sound_notifications'] and profile.status != TOX_USER_STATUS['BUSY']: sound_notification(SOUND_NOTIFICATION['FILE_TRANSFER']) else: # AVATAR diff --git a/src/mainscreen.py b/src/mainscreen.py index 4ed5b3b..104f327 100644 --- a/src/mainscreen.py +++ b/src/mainscreen.py @@ -3,7 +3,7 @@ from menu import * from profile import * from list_items import * -from widgets import QRightClickButton +from widgets import QRightClickButton, RubberBand import plugin_support @@ -523,7 +523,7 @@ class ScreenShotWindow(QtGui.QWidget): self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) self.showFullScreen() self.setWindowOpacity(0.5) - self.rubberband = QtGui.QRubberBand(QtGui.QRubberBand.Rectangle, None) + self.rubberband = RubberBand() def closeEvent(self, *args): if self.parent.isHidden(): diff --git a/src/widgets.py b/src/widgets.py index 238070d..5d310b0 100644 --- a/src/widgets.py +++ b/src/widgets.py @@ -27,6 +27,7 @@ class CenteredWidget(QtGui.QWidget): class QRightClickButton(QtGui.QPushButton): + def __init__(self, parent): super(QRightClickButton, self).__init__(parent) @@ -35,3 +36,20 @@ class QRightClickButton(QtGui.QPushButton): self.emit(QtCore.SIGNAL("rightClicked()")) else: super(QRightClickButton, self).mousePressEvent(event) + + +class RubberBand(QtGui.QRubberBand): + + def __init__(self): + super(RubberBand, self).__init__(QtGui.QRubberBand.Rectangle, None) + self.setPalette(QtGui.QPalette(QtCore.Qt.transparent)) + self.pen = QtGui.QPen(QtCore.Qt.blue, 4) + self.pen.setStyle(QtCore.Qt.SolidLine) + self.painter = QtGui.QPainter() + + def paintEvent(self, event): + + self.painter.begin(self) + self.painter.setPen(self.pen) + self.painter.drawRect(event.rect()) + self.painter.end()