some updates - rubberband and callbacks

This commit is contained in:
ingvar1995 2016-05-29 16:49:00 +03:00
parent 02507ab8b4
commit b6d13166bc
3 changed files with 22 additions and 3 deletions

View file

@ -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

View file

@ -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():

View file

@ -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()