profile settings update

This commit is contained in:
ingvar1995 2016-02-25 11:32:40 +03:00
parent 632412c345
commit 47954afc4c
3 changed files with 22 additions and 10 deletions

View File

@ -261,7 +261,7 @@ class MainWindow(QtGui.QMainWindow):
self.a_c.show() self.a_c.show()
def profile_settings(self): def profile_settings(self):
self.p_s = ProfileSettings() self.p_s = ProfileSettings(self.tox)
self.p_s.show() self.p_s.show()
def privacy_settings(self): def privacy_settings(self):

View File

@ -50,8 +50,9 @@ class AddContact(QtGui.QWidget):
class ProfileSettings(QtGui.QWidget): class ProfileSettings(QtGui.QWidget):
"""Form with profile settings such as name, status, TOX ID""" """Form with profile settings such as name, status, TOX ID"""
def __init__(self): def __init__(self, tox):
super(ProfileSettings, self).__init__() super(ProfileSettings, self).__init__()
self.tox = tox
self.initUI() self.initUI()
def initUI(self): def initUI(self):
@ -63,9 +64,11 @@ class ProfileSettings(QtGui.QWidget):
self.nick = QtGui.QLineEdit(self) self.nick = QtGui.QLineEdit(self)
self.nick.setGeometry(QtCore.QRect(30, 60, 351, 27)) self.nick.setGeometry(QtCore.QRect(30, 60, 351, 27))
self.nick.setObjectName("nick") self.nick.setObjectName("nick")
self.nick.setText(self.tox.self_get_name())
self.status = QtGui.QLineEdit(self) self.status = QtGui.QLineEdit(self)
self.status.setGeometry(QtCore.QRect(30, 130, 351, 27)) self.status.setGeometry(QtCore.QRect(30, 130, 351, 27))
self.status.setObjectName("status") self.status.setObjectName("status")
self.status.setText(self.tox.self_get_status_message())
self.label = QtGui.QLabel(self) self.label = QtGui.QLabel(self)
self.label.setGeometry(QtCore.QRect(50, 30, 91, 21)) self.label.setGeometry(QtCore.QRect(50, 30, 91, 21))
font = QtGui.QFont() font = QtGui.QFont()
@ -91,16 +94,20 @@ class ProfileSettings(QtGui.QWidget):
self.label_3.setFont(font) self.label_3.setFont(font)
self.label_3.setObjectName("label_3") self.label_3.setObjectName("label_3")
self.tox_id = QtGui.QLabel(self) 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 = QtGui.QFont()
font.setPointSize(18) font.setPointSize(12)
font.setWeight(75) #font.setWeight(75)
font.setBold(True) font.setBold(True)
self.tox_id.setFont(font) self.tox_id.setFont(font)
self.tox_id.setObjectName("tox_id") 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 = QtGui.QPushButton(self)
self.copyId.setGeometry(QtCore.QRect(40, 250, 98, 31)) self.copyId.setGeometry(QtCore.QRect(40, 250, 98, 31))
self.copyId.setObjectName("copyId") self.copyId.setObjectName("copyId")
self.copyId.clicked.connect(self.copy)
self.comboBox = QtGui.QComboBox(self) self.comboBox = QtGui.QComboBox(self)
self.comboBox.setGeometry(QtCore.QRect(30, 350, 211, 27)) self.comboBox.setGeometry(QtCore.QRect(30, 350, 211, 27))
self.comboBox.setObjectName("comboBox") 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.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_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.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.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)) 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): class NetworkSettings(QtGui.QWidget):
"""Network settings form: UDP, Ipv6 and proxy""" """Network settings form: UDP, Ipv6 and proxy"""

View File

@ -1,13 +1,14 @@
from PySide import QtGui from PySide import QtGui
from util import curr_directory
# TODO: add sound notifications # TODO: add sound notifications
# TODO: add reaction om mouse move # TODO: add reaction om mouse move
def tray_notification(title, text): def tray_notification(title, text):
if QtGui.QSystemTrayIcon.isSystemTrayAvailable(): if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
tray = QtGui.QSystemTrayIcon() tray = QtGui.QSystemTrayIcon(QtGui.QIcon(curr_directory() + '/images/icon.png'))
tray.setContextMenu(QtGui.QMenu()) tray.setContextMenu(QtGui.QMenu())
tray.show() tray.show()
if len(text) > 50: if len(text) > 30:
text = text[:50] + '...' text = text[:30] + '...'
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 4000) tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)