changing no spam

This commit is contained in:
ingvar1995 2016-05-03 22:02:56 +03:00
parent 61b124dad4
commit 7a5b1fc05e
2 changed files with 17 additions and 4 deletions

View File

@ -88,7 +88,7 @@ class ProfileSettings(CenteredWidget):
self.status.setObjectName("status") self.status.setObjectName("status")
self.status.setText(profile.status_message) self.status.setText(profile.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(40, 30, 91, 21))
font = QtGui.QFont() font = QtGui.QFont()
font.setPointSize(18) font.setPointSize(18)
font.setWeight(75) font.setWeight(75)
@ -100,7 +100,7 @@ class ProfileSettings(CenteredWidget):
self.label_2.setFont(font) self.label_2.setFont(font)
self.label_2.setObjectName("label_2") self.label_2.setObjectName("label_2")
self.label_3 = QtGui.QLabel(self) self.label_3 = QtGui.QLabel(self)
self.label_3.setGeometry(QtCore.QRect(40, 170, 100, 21)) self.label_3.setGeometry(QtCore.QRect(40, 180, 100, 21))
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)
@ -111,13 +111,16 @@ class ProfileSettings(CenteredWidget):
s = profile.tox_id s = profile.tox_id
self.tox_id.setText(s) self.tox_id.setText(s)
self.copyId = QtGui.QPushButton(self) self.copyId = QtGui.QPushButton(self)
self.copyId.setGeometry(QtCore.QRect(40, 250, 150, 30)) self.copyId.setGeometry(QtCore.QRect(40, 250, 160, 30))
self.copyId.setObjectName("copyId") self.copyId.setObjectName("copyId")
self.copyId.clicked.connect(self.copy) self.copyId.clicked.connect(self.copy)
self.export = QtGui.QPushButton(self) self.export = QtGui.QPushButton(self)
self.export.setGeometry(QtCore.QRect(200, 250, 150, 30)) self.export.setGeometry(QtCore.QRect(210, 250, 160, 30))
self.export.setObjectName("export") self.export.setObjectName("export")
self.export.clicked.connect(self.export_profile) self.export.clicked.connect(self.export_profile)
self.new_nospam = QtGui.QPushButton(self)
self.new_nospam.setGeometry(QtCore.QRect(380, 250, 160, 30))
self.new_nospam.clicked.connect(self.new_no_spam)
self.new_avatar = QtGui.QPushButton(self) self.new_avatar = QtGui.QPushButton(self)
self.new_avatar.setGeometry(QtCore.QRect(400, 50, 200, 50)) self.new_avatar.setGeometry(QtCore.QRect(400, 50, 200, 50))
self.delete_avatar = QtGui.QPushButton(self) self.delete_avatar = QtGui.QPushButton(self)
@ -136,12 +139,16 @@ class ProfileSettings(CenteredWidget):
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.new_avatar.setText(QtGui.QApplication.translate("ProfileSettingsForm", "New avatar", None, QtGui.QApplication.UnicodeUTF8)) self.new_avatar.setText(QtGui.QApplication.translate("ProfileSettingsForm", "New avatar", None, QtGui.QApplication.UnicodeUTF8))
self.delete_avatar.setText(QtGui.QApplication.translate("ProfileSettingsForm", "Reset avatar", None, QtGui.QApplication.UnicodeUTF8)) self.delete_avatar.setText(QtGui.QApplication.translate("ProfileSettingsForm", "Reset avatar", None, QtGui.QApplication.UnicodeUTF8))
self.new_nospam.setText(QtGui.QApplication.translate("ProfileSettingsForm", "New NoSpam", None, QtGui.QApplication.UnicodeUTF8))
def copy(self): def copy(self):
clipboard = QtGui.QApplication.clipboard() clipboard = QtGui.QApplication.clipboard()
profile = Profile.get_instance() profile = Profile.get_instance()
clipboard.setText(profile.tox_id) clipboard.setText(profile.tox_id)
def new_no_spam(self):
self.tox_id.setText(Profile.get_instance().new_nospam())
def reset_avatar(self): def reset_avatar(self):
Profile.get_instance().reset_avatar() Profile.get_instance().reset_avatar()

View File

@ -341,6 +341,12 @@ class Profile(Contact, Singleton):
super(self.__class__, self).set_status_message(value) super(self.__class__, self).set_status_message(value)
self._tox.self_set_status_message(self._status_message.encode('utf-8')) self._tox.self_set_status_message(self._status_message.encode('utf-8'))
def new_nospam(self):
import random
self._tox.self_set_nospam(random.randint(0, 4294967295)) # no spam - uint32
self._tox_id = self._tox.self_get_address()
return self._tox_id
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
# Filtration # Filtration
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------