UI improvements. screenshots sending update

This commit is contained in:
ingvar1995 2016-05-08 13:51:56 +03:00
parent 78c376a0b0
commit c6d832ae92
48 changed files with 50 additions and 33 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -117,16 +117,28 @@ class MainWindow(QtGui.QMainWindow):
self.messageEdit = MessageArea(Form, self)
self.messageEdit.setGeometry(QtCore.QRect(0, 5, 450, 70))
self.messageEdit.setObjectName("messageEdit")
self.screenshotButton = QtGui.QPushButton(Form)
class QRightClickButton(QtGui.QPushButton):
def __init__(self, parent):
super(QRightClickButton, self).__init__(parent)
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.RightButton:
self.emit(QtCore.SIGNAL("rightClicked()"))
else:
super(QRightClickButton, self).mousePressEvent(event)
self.screenshotButton = QRightClickButton(Form)
self.screenshotButton.setGeometry(QtCore.QRect(455, 5, 55, 70))
self.screenshotButton.setObjectName("screenshotButton")
self.fileTransferButton = QtGui.QPushButton(Form)
self.fileTransferButton.setGeometry(QtCore.QRect(510, 5, 55, 70))
self.fileTransferButton.setObjectName("fileTransferButton")
self.sendMessageButton = QtGui.QPushButton(Form)
self.sendMessageButton.setGeometry(QtCore.QRect(565, 5, 55, 70))
self.sendMessageButton.setObjectName("sendMessageButton")
self.sendMessageButton.clicked.connect(self.send_message)
pixmap = QtGui.QPixmap(curr_directory() + '/images/send.png')
icon = QtGui.QIcon(pixmap)
@ -135,7 +147,7 @@ class MainWindow(QtGui.QMainWindow):
pixmap = QtGui.QPixmap(curr_directory() + '/images/file.png')
icon = QtGui.QIcon(pixmap)
self.fileTransferButton.setIcon(icon)
self.fileTransferButton.setIconSize(QtCore.QSize(55, 70))
self.fileTransferButton.setIconSize(QtCore.QSize(30, 45))
pixmap = QtGui.QPixmap(curr_directory() + '/images/screenshot.png')
icon = QtGui.QIcon(pixmap)
self.screenshotButton.setIcon(icon)
@ -143,6 +155,9 @@ class MainWindow(QtGui.QMainWindow):
self.fileTransferButton.clicked.connect(self.send_file)
self.screenshotButton.clicked.connect(self.send_screenshot)
self.sendMessageButton.clicked.connect(self.send_message)
self.connect(self.screenshotButton, QtCore.SIGNAL("rightClicked()"), lambda: self.send_screenshot(True))
QtCore.QMetaObject.connectSlotsByName(Form)
def setup_left_bottom(self, Form):
@ -371,10 +386,12 @@ class MainWindow(QtGui.QMainWindow):
if name[0]:
self.profile.send_file(name[0])
def send_screenshot(self):
def send_screenshot(self, hide=False):
if self.profile.is_active_online(): # active friend exists and online
self.sw = ScreenShotWindow()
self.sw = ScreenShotWindow(self)
self.sw.show()
if hide:
self.hide()
def call(self):
if self.profile.is_active_online(): # active friend exists and online
@ -467,14 +484,19 @@ class MainWindow(QtGui.QMainWindow):
class ScreenShotWindow(QtGui.QWidget):
def __init__(self):
def __init__(self, parent):
super(ScreenShotWindow, self).__init__()
self.parent = parent
self.setMouseTracking(True)
self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
self.showFullScreen()
self.setWindowOpacity(0.5)
self.rubberband = QtGui.QRubberBand(QtGui.QRubberBand.Rectangle, None)
def closeEvent(self, *args):
if self.parent.isHidden():
self.parent.show()
def mousePressEvent(self, event):
self.origin = event.pos()
self.rubberband.setGeometry(QtCore.QRect(self.origin, QtCore.QSize()))
@ -495,16 +517,17 @@ class ScreenShotWindow(QtGui.QWidget):
self.rubberband.hide()
rect = self.rubberband.geometry()
print rect
p = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId(),
rect.x() + 4,
rect.y() + 4,
rect.width() - 8,
rect.height() - 8)
byte_array = QtCore.QByteArray()
buffer = QtCore.QBuffer(byte_array)
buffer.open(QtCore.QIODevice.WriteOnly)
p.save(buffer, 'PNG')
Profile.get_instance().send_screenshot(str(byte_array.data()))
if rect.width() and rect.height():
p = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId(),
rect.x() + 4,
rect.y() + 4,
rect.width() - 8,
rect.height() - 8)
byte_array = QtCore.QByteArray()
buffer = QtCore.QBuffer(byte_array)
buffer.open(QtCore.QIODevice.WriteOnly)
p.save(buffer, 'PNG')
Profile.get_instance().send_screenshot(str(byte_array.data()))
self.close()
def keyPressEvent(self, event):

View File

@ -2,7 +2,7 @@ from PySide import QtCore, QtGui
from settings import *
from profile import Profile
from util import get_style, curr_directory
from widgets import CenteredWidget
from widgets import CenteredWidget, DataLabel
import pyaudio
@ -26,17 +26,12 @@ class AddContact(CenteredWidget):
self.tox_id.setGeometry(QtCore.QRect(50, 40, 471, 27))
self.tox_id.setObjectName("lineEdit")
self.label = QtGui.QLabel(self)
self.label.setGeometry(QtCore.QRect(30, 10, 80, 20))
self.error_label = QtGui.QLabel(self)
self.error_label.setGeometry(QtCore.QRect(120, 10, 400, 20))
self.label.setGeometry(QtCore.QRect(50, 10, 80, 20))
self.error_label = DataLabel(self)
self.error_label.setGeometry(QtCore.QRect(120, 10, 420, 20))
font = QtGui.QFont()
font.setPointSize(16)
font.setWeight(75)
font.setBold(True)
self.label.setFont(font)
font.setPointSize(12)
font.setBold(False)
font.setWeight(40)
font.setPointSize(10)
font.setWeight(30)
self.error_label.setFont(font)
self.error_label.setStyleSheet("QLabel { color: red; }")
self.label.setObjectName("label")
@ -48,6 +43,7 @@ class AddContact(CenteredWidget):
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.retranslateUi()
self.message_edit.setText('Hello! Add me to your contact list please')
QtCore.QMetaObject.connectSlotsByName(self)
def add_friend(self):
@ -57,8 +53,6 @@ class AddContact(CenteredWidget):
# request was successful
self.close()
else: # print error data
if len(send) > 40:
send = send[:40] + '...'
self.error_label.setText(send)
def retranslateUi(self):

View File

@ -796,7 +796,7 @@ class Profile(Contact, Singleton):
:return: True on success else error string
"""
try:
message = message or 'Add me to your contact list'
message = message or 'Hello! Add me to your contact list please'
if '@' in tox_id: # value like groupbot@toxme.io
tox_id = tox_dns(tox_id)
if tox_id is None:

0
src/styles/rc/Hmovetoolbar.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

0
src/styles/rc/Hsepartoolbar.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 172 B

After

Width:  |  Height:  |  Size: 172 B

0
src/styles/rc/Vmovetoolbar.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

0
src/styles/rc/Vsepartoolbar.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

0
src/styles/rc/branch_closed-on.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 147 B

0
src/styles/rc/branch_closed.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

0
src/styles/rc/branch_open-on.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 150 B

0
src/styles/rc/branch_open.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

BIN
src/styles/rc/checkbox_checked.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/styles/rc/checkbox_checked_disabled.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/styles/rc/checkbox_checked_focus.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 2.9 KiB

0
src/styles/rc/checkbox_indeterminate.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 493 B

After

Width:  |  Height:  |  Size: 493 B

0
src/styles/rc/checkbox_indeterminate_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 492 B

After

Width:  |  Height:  |  Size: 492 B

0
src/styles/rc/checkbox_indeterminate_focus.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 514 B

BIN
src/styles/rc/checkbox_unchecked.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/styles/rc/checkbox_unchecked_disabled.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/styles/rc/checkbox_unchecked_focus.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 2.8 KiB

0
src/styles/rc/close-hover.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 598 B

0
src/styles/rc/close-pressed.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 598 B

0
src/styles/rc/close.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 586 B

0
src/styles/rc/down_arrow.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

0
src/styles/rc/down_arrow_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

0
src/styles/rc/left_arrow.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

0
src/styles/rc/left_arrow_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

0
src/styles/rc/radio_checked.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 940 B

After

Width:  |  Height:  |  Size: 940 B

0
src/styles/rc/radio_checked_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 972 B

After

Width:  |  Height:  |  Size: 972 B

0
src/styles/rc/radio_checked_focus.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 933 B

After

Width:  |  Height:  |  Size: 933 B

0
src/styles/rc/radio_unchecked.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

0
src/styles/rc/radio_unchecked_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 760 B

0
src/styles/rc/radio_unchecked_focus.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 724 B

After

Width:  |  Height:  |  Size: 724 B

0
src/styles/rc/right_arrow.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

0
src/styles/rc/right_arrow_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

0
src/styles/rc/sizegrip.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 129 B

0
src/styles/rc/stylesheet-branch-end.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

0
src/styles/rc/stylesheet-branch-more.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

0
src/styles/rc/stylesheet-vline.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 239 B

0
src/styles/rc/transparent.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

0
src/styles/rc/undock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 578 B

0
src/styles/rc/up_arrow.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 158 B

0
src/styles/rc/up_arrow_disabled.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

File diff suppressed because one or more lines are too long