From 47954afc4c07f38409c58234e75e67e144a96ee7 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 25 Feb 2016 11:32:40 +0300 Subject: [PATCH] profile settings update --- src/mainscreen.py | 2 +- src/menu.py | 21 ++++++++++++++++----- src/notifications.py | 9 +++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/mainscreen.py b/src/mainscreen.py index dfe1be3..97ca21c 100644 --- a/src/mainscreen.py +++ b/src/mainscreen.py @@ -261,7 +261,7 @@ class MainWindow(QtGui.QMainWindow): self.a_c.show() def profile_settings(self): - self.p_s = ProfileSettings() + self.p_s = ProfileSettings(self.tox) self.p_s.show() def privacy_settings(self): diff --git a/src/menu.py b/src/menu.py index 28f2b4a..641747a 100644 --- a/src/menu.py +++ b/src/menu.py @@ -50,8 +50,9 @@ class AddContact(QtGui.QWidget): class ProfileSettings(QtGui.QWidget): """Form with profile settings such as name, status, TOX ID""" - def __init__(self): + def __init__(self, tox): super(ProfileSettings, self).__init__() + self.tox = tox self.initUI() def initUI(self): @@ -63,9 +64,11 @@ class ProfileSettings(QtGui.QWidget): self.nick = QtGui.QLineEdit(self) self.nick.setGeometry(QtCore.QRect(30, 60, 351, 27)) self.nick.setObjectName("nick") + self.nick.setText(self.tox.self_get_name()) self.status = QtGui.QLineEdit(self) self.status.setGeometry(QtCore.QRect(30, 130, 351, 27)) self.status.setObjectName("status") + self.status.setText(self.tox.self_get_status_message()) self.label = QtGui.QLabel(self) self.label.setGeometry(QtCore.QRect(50, 30, 91, 21)) font = QtGui.QFont() @@ -91,16 +94,20 @@ class ProfileSettings(QtGui.QWidget): self.label_3.setFont(font) self.label_3.setObjectName("label_3") self.tox_id = QtGui.QLabel(self) - self.tox_id.setGeometry(QtCore.QRect(10, 210, 91, 21)) + self.tox_id.setGeometry(QtCore.QRect(10, 210, self.width(), 21)) font = QtGui.QFont() - font.setPointSize(18) - font.setWeight(75) + font.setPointSize(12) + #font.setWeight(75) font.setBold(True) self.tox_id.setFont(font) self.tox_id.setObjectName("tox_id") + # TODO: copy TOX ID to self.tox_id + s = 'ID' + self.tox_id.setText(s) self.copyId = QtGui.QPushButton(self) self.copyId.setGeometry(QtCore.QRect(40, 250, 98, 31)) self.copyId.setObjectName("copyId") + self.copyId.clicked.connect(self.copy) self.comboBox = QtGui.QComboBox(self) self.comboBox.setGeometry(QtCore.QRect(30, 350, 211, 27)) self.comboBox.setObjectName("comboBox") @@ -120,10 +127,14 @@ class ProfileSettings(QtGui.QWidget): self.label.setText(QtGui.QApplication.translate("ProfileSettingsForm", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("ProfileSettingsForm", "Status:", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("ProfileSettingsForm", "TOX ID:", None, QtGui.QApplication.UnicodeUTF8)) - self.tox_id.setText(QtGui.QApplication.translate("ProfileSettingsForm", "TOX ID:", None, QtGui.QApplication.UnicodeUTF8)) self.copyId.setText(QtGui.QApplication.translate("ProfileSettingsForm", "Copy TOX ID", None, QtGui.QApplication.UnicodeUTF8)) self.tox_id_2.setText(QtGui.QApplication.translate("ProfileSettingsForm", "Language:", None, QtGui.QApplication.UnicodeUTF8)) + def copy(self): + clipboard = QtGui.QApplication.clipboard() + id = unicode(self.tox.self_get_public_key()) + clipboard.setText(id) + class NetworkSettings(QtGui.QWidget): """Network settings form: UDP, Ipv6 and proxy""" diff --git a/src/notifications.py b/src/notifications.py index 1b3db2c..9f621f1 100644 --- a/src/notifications.py +++ b/src/notifications.py @@ -1,13 +1,14 @@ from PySide import QtGui +from util import curr_directory # TODO: add sound notifications # TODO: add reaction om mouse move def tray_notification(title, text): if QtGui.QSystemTrayIcon.isSystemTrayAvailable(): - tray = QtGui.QSystemTrayIcon() + tray = QtGui.QSystemTrayIcon(QtGui.QIcon(curr_directory() + '/images/icon.png')) tray.setContextMenu(QtGui.QMenu()) tray.show() - if len(text) > 50: - text = text[:50] + '...' - tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 4000) + if len(text) > 30: + text = text[:30] + '...' + tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)