@ -1,7 +1,4 @@
try :
from PySide import QtCore , QtGui
except ImportError :
from PyQt4 import QtCore , QtGui
from PyQt5 import QtCore , QtGui , QtWidgets
from settings import *
from profile import Profile
from util import curr_directory , copy
@ -23,7 +20,7 @@ class AddContact(CenteredWidget):
def initUI ( self , tox_id ) :
self . setObjectName ( ' AddContact ' )
self . resize ( 568 , 306 )
self . sendRequestButton = Qt Gui . QPushButton ( self )
self . sendRequestButton = Qt Widgets . QPushButton ( self )
self . sendRequestButton . setGeometry ( QtCore . QRect ( 50 , 270 , 471 , 31 ) )
self . sendRequestButton . setMinimumSize ( QtCore . QSize ( 0 , 0 ) )
self . sendRequestButton . setBaseSize ( QtCore . QSize ( 0 , 0 ) )
@ -33,7 +30,7 @@ class AddContact(CenteredWidget):
self . tox_id . setGeometry ( QtCore . QRect ( 50 , 40 , 471 , 27 ) )
self . tox_id . setObjectName ( " lineEdit " )
self . tox_id . setText ( tox_id )
self . label = Qt Gui . QLabel ( self )
self . label = Qt Widgets . QLabel ( self )
self . label . setGeometry ( QtCore . QRect ( 50 , 10 , 80 , 20 ) )
self . error_label = DataLabel ( self )
self . error_label . setGeometry ( QtCore . QRect ( 120 , 10 , 420 , 20 ) )
@ -44,10 +41,10 @@ class AddContact(CenteredWidget):
self . error_label . setFont ( font )
self . error_label . setStyleSheet ( " QLabel { color: #BC1C1C; } " )
self . label . setObjectName ( " label " )
self . message_edit = Qt Gui . QTextEdit ( self )
self . message_edit = Qt Widgets . QTextEdit ( self )
self . message_edit . setGeometry ( QtCore . QRect ( 50 , 110 , 471 , 151 ) )
self . message_edit . setObjectName ( " textEdit " )
self . message = Qt Gui . QLabel ( self )
self . message = Qt Widgets . QLabel ( self )
self . message . setGeometry ( QtCore . QRect ( 50 , 70 , 101 , 31 ) )
self . message . setFont ( font )
self . message . setObjectName ( " label_2 " )
@ -73,11 +70,11 @@ class AddContact(CenteredWidget):
self . error_label . setText ( send )
def retranslateUi ( self ) :
self . setWindowTitle ( Qt Gui . QApplication . translate ( ' AddContact ' , " Add contact " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . sendRequestButton . setText ( Qt Gui . QApplication . translate ( " Form " , " Send request " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label . setText ( Qt Gui . QApplication . translate ( ' AddContact ' , " TOX ID: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . message . setText ( Qt Gui . QApplication . translate ( ' AddContact ' , " Message: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . tox_id . setPlaceholderText ( Qt Gui . QApplication . translate ( ' AddContact ' , " TOX ID or public key of contact " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( ' AddContact ' , " Add contact " ) )
self . sendRequestButton . setText ( Qt Widgets . QApplication . translate ( " Form " , " Send request " ) )
self . label . setText ( Qt Widgets . QApplication . translate ( ' AddContact ' , " TOX ID: " ) )
self . message . setText ( Qt Widgets . QApplication . translate ( ' AddContact ' , " Message: " ) )
self . tox_id . setPlaceholderText ( Qt Widgets . QApplication . translate ( ' AddContact ' , " TOX ID or public key of contact " ) )
class ProfileSettings ( CenteredWidget ) :
@ -95,12 +92,12 @@ class ProfileSettings(CenteredWidget):
self . nick . setGeometry ( QtCore . QRect ( 30 , 60 , 350 , 27 ) )
profile = Profile . get_instance ( )
self . nick . setText ( profile . name )
self . status = Qt Gui . QComboBox ( self )
self . status = Qt Widgets . QComboBox ( self )
self . status . setGeometry ( QtCore . QRect ( 400 , 60 , 200 , 27 ) )
self . status_message = LineEdit ( self )
self . status_message . setGeometry ( QtCore . QRect ( 30 , 130 , 350 , 27 ) )
self . status_message . setText ( profile . status_message )
self . label = Qt Gui . QLabel ( self )
self . label = Qt Widgets . QLabel ( self )
self . label . setGeometry ( QtCore . QRect ( 40 , 30 , 91 , 25 ) )
font = QtGui . QFont ( )
font . setFamily ( Settings . get_instance ( ) [ ' font ' ] )
@ -108,59 +105,59 @@ class ProfileSettings(CenteredWidget):
font . setWeight ( 75 )
font . setBold ( True )
self . label . setFont ( font )
self . label_2 = Qt Gui . QLabel ( self )
self . label_2 = Qt Widgets . QLabel ( self )
self . label_2 . setGeometry ( QtCore . QRect ( 40 , 100 , 100 , 25 ) )
self . label_2 . setFont ( font )
self . label_3 = Qt Gui . QLabel ( self )
self . label_3 = Qt Widgets . QLabel ( self )
self . label_3 . setGeometry ( QtCore . QRect ( 40 , 180 , 100 , 25 ) )
self . label_3 . setFont ( font )
self . tox_id = Qt Gui . QLabel ( self )
self . tox_id = Qt Widgets . QLabel ( self )
self . tox_id . setGeometry ( QtCore . QRect ( 15 , 210 , 685 , 21 ) )
font . setPointSize ( 10 )
self . tox_id . setFont ( font )
s = profile . tox_id
self . tox_id . setText ( s )
self . copyId = Qt Gui . QPushButton ( self )
self . copyId = Qt Widgets . QPushButton ( self )
self . copyId . setGeometry ( QtCore . QRect ( 40 , 250 , 180 , 30 ) )
self . copyId . clicked . connect ( self . copy )
self . export = Qt Gui . QPushButton ( self )
self . export = Qt Widgets . QPushButton ( self )
self . export . setGeometry ( QtCore . QRect ( 230 , 250 , 180 , 30 ) )
self . export . clicked . connect ( self . export_profile )
self . new_nospam = Qt Gui . QPushButton ( self )
self . new_nospam = Qt Widgets . QPushButton ( self )
self . new_nospam . setGeometry ( QtCore . QRect ( 420 , 250 , 180 , 30 ) )
self . new_nospam . clicked . connect ( self . new_no_spam )
self . copy_pk = Qt Gui . QPushButton ( self )
self . copy_pk = Qt Widgets . QPushButton ( self )
self . copy_pk . setGeometry ( QtCore . QRect ( 40 , 300 , 180 , 30 ) )
self . copy_pk . clicked . connect ( self . copy_public_key )
self . new_avatar = Qt Gui . QPushButton ( self )
self . new_avatar = Qt Widgets . QPushButton ( self )
self . new_avatar . setGeometry ( QtCore . QRect ( 230 , 300 , 180 , 30 ) )
self . delete_avatar = Qt Gui . QPushButton ( self )
self . delete_avatar = Qt Widgets . QPushButton ( self )
self . delete_avatar . setGeometry ( QtCore . QRect ( 420 , 300 , 180 , 30 ) )
self . delete_avatar . clicked . connect ( self . reset_avatar )
self . new_avatar . clicked . connect ( self . set_avatar )
self . profilepass = Qt Gui . QLabel ( self )
self . profilepass = Qt Widgets . QLabel ( self )
self . profilepass . setGeometry ( QtCore . QRect ( 40 , 340 , 300 , 30 ) )
font . setPointSize ( 18 )
self . profilepass . setFont ( font )
self . password = LineEdit ( self )
self . password . setGeometry ( QtCore . QRect ( 40 , 380 , 300 , 30 ) )
self . password . setEchoMode ( Qt Gui. QLineEdit . EchoMode . Password )
self . leave_blank = Qt Gui . QLabel ( self )
self . password . setEchoMode ( Qt Widgets. QLineEdit . Password )
self . leave_blank = Qt Widgets . QLabel ( self )
self . leave_blank . setGeometry ( QtCore . QRect ( 350 , 380 , 300 , 30 ) )
self . confirm_password = LineEdit ( self )
self . confirm_password . setGeometry ( QtCore . QRect ( 40 , 420 , 300 , 30 ) )
self . confirm_password . setEchoMode ( Qt Gui. QLineEdit . EchoMode . Password )
self . set_password = Qt Gui . QPushButton ( self )
self . confirm_password . setEchoMode ( Qt Widgets. QLineEdit . Password )
self . set_password = Qt Widgets . QPushButton ( self )
self . set_password . setGeometry ( QtCore . QRect ( 40 , 470 , 300 , 30 ) )
self . set_password . clicked . connect ( self . new_password )
self . not_match = Qt Gui . QLabel ( self )
self . not_match = Qt Widgets . QLabel ( self )
self . not_match . setGeometry ( QtCore . QRect ( 350 , 420 , 300 , 30 ) )
self . not_match . setVisible ( False )
self . not_match . setStyleSheet ( ' QLabel { color: #BC1C1C; } ' )
self . warning = Qt Gui . QLabel ( self )
self . warning = Qt Widgets . QLabel ( self )
self . warning . setGeometry ( QtCore . QRect ( 40 , 510 , 500 , 30 ) )
self . warning . setStyleSheet ( ' QLabel { color: #BC1C1C; } ' )
self . default = Qt Gui . QPushButton ( self )
self . default = Qt Widgets . QPushButton ( self )
self . default . setGeometry ( QtCore . QRect ( 40 , 550 , 620 , 30 ) )
path , name = Settings . get_auto_profile ( )
self . auto = path + name == ProfileHelper . get_path ( ) + Settings . get_instance ( ) . name
@ -173,30 +170,30 @@ class ProfileSettings(CenteredWidget):
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . export . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Export profile " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Profile settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Name: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label_2 . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Status: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label_3 . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " TOX ID: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . copyId . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Copy TOX ID " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . new_avatar . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " New avatar " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . delete_avatar . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Reset avatar " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . new_nospam . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " New NoSpam " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . profilepass . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Profile password " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . password . setPlaceholderText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Password (at least 8 symbols) " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . confirm_password . setPlaceholderText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Confirm password " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . set_password . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Set password " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . not_match . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Passwords do not match " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . leave_blank . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Leaving blank will reset current password " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . warning . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " There is no way to recover lost passwords " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . status . addItem ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Online " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . status . addItem ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Away " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . status . addItem ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Busy " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . copy_pk . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Copy public key " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . export . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Export profile " ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Profile settings " ) )
self . label . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Name: " ) )
self . label_2 . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Status: " ) )
self . label_3 . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " TOX ID: " ) )
self . copyId . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Copy TOX ID " ) )
self . new_avatar . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " New avatar " ) )
self . delete_avatar . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Reset avatar " ) )
self . new_nospam . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " New NoSpam " ) )
self . profilepass . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Profile password " ) )
self . password . setPlaceholderText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Password (at least 8 symbols) " ) )
self . confirm_password . setPlaceholderText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Confirm password " ) )
self . set_password . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Set password " ) )
self . not_match . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Passwords do not match " ) )
self . leave_blank . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Leaving blank will reset current password " ) )
self . warning . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " There is no way to recover lost passwords " ) )
self . status . addItem ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Online " ) )
self . status . addItem ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Away " ) )
self . status . addItem ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Busy " ) )
self . copy_pk . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Copy public key " ) )
if self . auto :
self . default . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Mark as not default profile " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . default . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Mark as not default profile " ) )
else :
self . default . setText ( Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Mark as default profile " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . default . setText ( Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Mark as default profile " ) )
def auto_profile ( self ) :
if self . auto :
@ -205,12 +202,10 @@ class ProfileSettings(CenteredWidget):
Settings . set_auto_profile ( ProfileHelper . get_path ( ) , Settings . get_instance ( ) . name )
self . auto = not self . auto
if self . auto :
self . default . setText ( QtGui . QApplication . translate ( " ProfileSettingsForm " , " Mark as not default profile " , None ,
QtGui . QApplication . UnicodeUTF8 ) )
self . default . setText ( QtWidgets . QApplication . translate ( " ProfileSettingsForm " , " Mark as not default profile " ) )
else :
self . default . setText (
QtGui . QApplication . translate ( " ProfileSettingsForm " , " Mark as default profile " , None ,
QtGui . QApplication . UnicodeUTF8 ) )
QtWidgets . QApplication . translate ( " ProfileSettingsForm " , " Mark as default profile " ) )
def new_password ( self ) :
if self . password . text ( ) == self . confirm_password . text ( ) :
@ -220,16 +215,14 @@ class ProfileSettings(CenteredWidget):
self . close ( )
else :
self . not_match . setText (
QtGui . QApplication . translate ( " ProfileSettingsForm " , " Password must be at least 8 symbols " , None ,
QtGui . QApplication . UnicodeUTF8 ) )
QtWidgets . QApplication . translate ( " ProfileSettingsForm " , " Password must be at least 8 symbols " ) )
self . not_match . setVisible ( True )
else :
self . not_match . setText ( QtGui . QApplication . translate ( " ProfileSettingsForm " , " Passwords do not match " , None ,
QtGui . QApplication . UnicodeUTF8 ) )
self . not_match . setText ( QtWidgets . QApplication . translate ( " ProfileSettingsForm " , " Passwords do not match " ) )
self . not_match . setVisible ( True )
def copy ( self ) :
clipboard = Qt Gui . QApplication . clipboard ( )
clipboard = Qt Widgets . QApplication . clipboard ( )
profile = Profile . get_instance ( )
clipboard . setText ( profile . tox_id )
pixmap = QtGui . QPixmap ( curr_directory ( ) + ' /images/accept.png ' )
@ -238,7 +231,7 @@ class ProfileSettings(CenteredWidget):
self . copyId . setIconSize ( QtCore . QSize ( 10 , 10 ) )
def copy_public_key ( self ) :
clipboard = Qt Gui . QApplication . clipboard ( )
clipboard = Qt Widgets . QApplication . clipboard ( )
profile = Profile . get_instance ( )
clipboard . setText ( profile . tox_id [ : 64 ] )
pixmap = QtGui . QPixmap ( curr_directory ( ) + ' /images/accept.png ' )
@ -253,13 +246,13 @@ class ProfileSettings(CenteredWidget):
Profile . get_instance ( ) . reset_avatar ( )
def set_avatar ( self ) :
choose = Qt Gui . QApplication . translate ( " ProfileSettingsForm " , " Choose avatar " , None , QtGui . QApplication . UnicodeUTF8 )
name = Qt Gui . QFileDialog . getOpenFileName ( self , choos e, None , ' Images (*.png) ' ,
options = QtGui . QFileDialog . DontUseNativeDialog )
choose = Qt Widgets . QApplication . translate ( " ProfileSettingsForm " , " Choose avatar " )
name = Qt Widgets . QFileDialog . getOpenFileName ( self , choos e, Non e, None , ' Images (*.png) ' ,
QtWidgets . QFileDialog . DontUseNativeDialog )
if name [ 0 ] :
bitmap = QtGui . QPixmap ( name [ 0 ] )
bitmap . scaled ( QtCore . QSize ( 128 , 128 ) , aspectMode = QtCore . Qt . KeepAspectRatio ,
mode= QtCore. Qt . SmoothTransformation )
bitmap . scaled ( 128 , 128 , QtCore . Qt . KeepAspectRatio ,
QtCore. Qt . SmoothTransformation )
byte_array = QtCore . QByteArray ( )
buffer = QtCore . QBuffer ( byte_array )
@ -268,25 +261,22 @@ class ProfileSettings(CenteredWidget):
Profile . get_instance ( ) . set_avatar ( bytes ( byte_array . data ( ) ) )
def export_profile ( self ) :
directory = QtGui . QFileDialog . getExistingDirectory ( options = QtGui . QFileDialog . DontUseNativeDialog ,
dir = curr_directory ( ) ) + ' / '
directory = QtWidgets . QFileDialog . getExistingDirectory ( self , ' ' , curr_directory ( ) + ' / ' ,
QtWidgets . QFileDialog . ShowDirsOnly | QtWidgets . QFileDialog . DontUseNativeDialog )
if directory != ' / ' :
reply = QtGui . QMessageBox . question ( None ,
QtGui . QApplication . translate ( " ProfileSettingsForm " ,
' Use new path ' ,
None ,
QtGui . QApplication . UnicodeUTF8 ) ,
QtGui . QApplication . translate ( " ProfileSettingsForm " ,
' Do you want to move your profile to this location? ' ,
None ,
QtGui . QApplication . UnicodeUTF8 ) ,
QtGui . QMessageBox . Yes ,
QtGui . QMessageBox . No )
reply = QtWidgets . QMessageBox . question ( None ,
QtWidgets . QApplication . translate ( " ProfileSettingsForm " ,
' Use new path ' ) ,
QtWidgets . QApplication . translate ( " ProfileSettingsForm " ,
' Do you want to move your profile to this location? ' ) ,
QtWidgets . QMessageBox . Yes ,
QtWidgets . QMessageBox . No )
settings = Settings . get_instance ( )
settings . export ( directory )
profile = Profile . get_instance ( )
profile . export_db ( directory )
ProfileHelper . get_instance ( ) . export_profile ( directory , reply == Qt Gui . QMessageBox . Yes )
ProfileHelper . get_instance ( ) . export_profile ( directory , reply == Qt Widgets . QMessageBox . Yes )
def closeEvent ( self , event ) :
profile = Profile . get_instance ( )
@ -309,15 +299,15 @@ class NetworkSettings(CenteredWidget):
self . setMinimumSize ( QtCore . QSize ( 300 , 330 ) )
self . setMaximumSize ( QtCore . QSize ( 300 , 330 ) )
self . setBaseSize ( QtCore . QSize ( 300 , 330 ) )
self . ipv = Qt Gui . QCheckBox ( self )
self . ipv = Qt Widgets . QCheckBox ( self )
self . ipv . setGeometry ( QtCore . QRect ( 20 , 10 , 97 , 22 ) )
self . ipv . setObjectName ( " ipv " )
self . udp = Qt Gui . QCheckBox ( self )
self . udp = Qt Widgets . QCheckBox ( self )
self . udp . setGeometry ( QtCore . QRect ( 150 , 10 , 97 , 22 ) )
self . udp . setObjectName ( " udp " )
self . proxy = Qt Gui . QCheckBox ( self )
self . proxy = Qt Widgets . QCheckBox ( self )
self . proxy . setGeometry ( QtCore . QRect ( 20 , 40 , 97 , 22 ) )
self . http = Qt Gui . QCheckBox ( self )
self . http = Qt Widgets . QCheckBox ( self )
self . http . setGeometry ( QtCore . QRect ( 20 , 70 , 97 , 22 ) )
self . proxy . setObjectName ( " proxy " )
self . proxyip = LineEdit ( self )
@ -326,11 +316,11 @@ class NetworkSettings(CenteredWidget):
self . proxyport = LineEdit ( self )
self . proxyport . setGeometry ( QtCore . QRect ( 40 , 190 , 231 , 27 ) )
self . proxyport . setObjectName ( " proxyport " )
self . label = Qt Gui . QLabel ( self )
self . label = Qt Widgets . QLabel ( self )
self . label . setGeometry ( QtCore . QRect ( 40 , 100 , 66 , 17 ) )
self . label_2 = Qt Gui . QLabel ( self )
self . label_2 = Qt Widgets . QLabel ( self )
self . label_2 . setGeometry ( QtCore . QRect ( 40 , 165 , 66 , 17 ) )
self . reconnect = Qt Gui . QPushButton ( self )
self . reconnect = Qt Widgets . QPushButton ( self )
self . reconnect . setGeometry ( QtCore . QRect ( 40 , 230 , 231 , 30 ) )
self . reconnect . clicked . connect ( self . restart_core )
settings = Settings . get_instance ( )
@ -340,7 +330,7 @@ class NetworkSettings(CenteredWidget):
self . proxyip . setText ( settings [ ' proxy_host ' ] )
self . proxyport . setText ( str ( settings [ ' proxy_port ' ] ) )
self . http . setChecked ( settings [ ' proxy_type ' ] == 1 )
self . warning = Qt Gui . QLabel ( self )
self . warning = Qt Widgets . QLabel ( self )
self . warning . setGeometry ( QtCore . QRect ( 5 , 270 , 290 , 60 ) )
self . warning . setStyleSheet ( ' QLabel { color: #BC1C1C; } ' )
self . retranslateUi ( )
@ -349,16 +339,15 @@ class NetworkSettings(CenteredWidget):
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . setWindowTitle ( QtGui . QApplication . translate ( " NetworkSettings " , " Network settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . ipv . setText ( QtGui . QApplication . translate ( " Form " , " IPv6 " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . udp . setText ( QtGui . QApplication . translate ( " Form " , " UDP " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . proxy . setText ( QtGui . QApplication . translate ( " Form " , " Proxy " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label . setText ( QtGui . QApplication . translate ( " Form " , " IP: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label_2 . setText ( QtGui . QApplication . translate ( " Form " , " Port: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . reconnect . setText ( QtGui . QApplication . translate ( " NetworkSettings " , " Restart TOX core " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . http . setText ( QtGui . QApplication . translate ( " Form " , " HTTP " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . warning . setText ( QtGui . QApplication . translate ( " Form " , " WARNING: \n using proxy with enabled UDP \n can produce IP leak " ,
None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( QtWidgets . QApplication . translate ( " NetworkSettings " , " Network settings " ) )
self . ipv . setText ( QtWidgets . QApplication . translate ( " Form " , " IPv6 " ) )
self . udp . setText ( QtWidgets . QApplication . translate ( " Form " , " UDP " ) )
self . proxy . setText ( QtWidgets . QApplication . translate ( " Form " , " Proxy " ) )
self . label . setText ( QtWidgets . QApplication . translate ( " Form " , " IP: " ) )
self . label_2 . setText ( QtWidgets . QApplication . translate ( " Form " , " Port: " ) )
self . reconnect . setText ( QtWidgets . QApplication . translate ( " NetworkSettings " , " Restart TOX core " ) )
self . http . setText ( QtWidgets . QApplication . translate ( " Form " , " HTTP " ) )
self . warning . setText ( QtWidgets . QApplication . translate ( " Form " , " WARNING: \n using proxy with enabled UDP \n can produce IP leak " ) )
def activate ( self ) :
bl = self . proxy . isChecked ( )
@ -395,23 +384,23 @@ class PrivacySettings(CenteredWidget):
self . resize ( 370 , 600 )
self . setMinimumSize ( QtCore . QSize ( 370 , 600 ) )
self . setMaximumSize ( QtCore . QSize ( 370 , 600 ) )
self . saveHistory = Qt Gui . QCheckBox ( self )
self . saveHistory = Qt Widgets . QCheckBox ( self )
self . saveHistory . setGeometry ( QtCore . QRect ( 10 , 20 , 350 , 22 ) )
self . saveUnsentOnly = Qt Gui . QCheckBox ( self )
self . saveUnsentOnly = Qt Widgets . QCheckBox ( self )
self . saveUnsentOnly . setGeometry ( QtCore . QRect ( 10 , 60 , 350 , 22 ) )
self . fileautoaccept = Qt Gui . QCheckBox ( self )
self . fileautoaccept = Qt Widgets . QCheckBox ( self )
self . fileautoaccept . setGeometry ( QtCore . QRect ( 10 , 100 , 350 , 22 ) )
self . typingNotifications = Qt Gui . QCheckBox ( self )
self . typingNotifications = Qt Widgets . QCheckBox ( self )
self . typingNotifications . setGeometry ( QtCore . QRect ( 10 , 140 , 350 , 30 ) )
self . inlines = Qt Gui . QCheckBox ( self )
self . inlines = Qt Widgets . QCheckBox ( self )
self . inlines . setGeometry ( QtCore . QRect ( 10 , 180 , 350 , 30 ) )
self . auto_path = Qt Gui . QLabel ( self )
self . auto_path = Qt Widgets . QLabel ( self )
self . auto_path . setGeometry ( QtCore . QRect ( 10 , 230 , 350 , 30 ) )
self . path = Qt Gui . QPlainTextEdit ( self )
self . path = Qt Widgets . QPlainTextEdit ( self )
self . path . setGeometry ( QtCore . QRect ( 10 , 265 , 350 , 45 ) )
self . change_path = Qt Gui . QPushButton ( self )
self . change_path = Qt Widgets . QPushButton ( self )
self . change_path . setGeometry ( QtCore . QRect ( 10 , 320 , 350 , 30 ) )
settings = Settings . get_instance ( )
self . typingNotifications . setChecked ( settings [ ' typing_notifications ' ] )
@ -423,37 +412,37 @@ class PrivacySettings(CenteredWidget):
self . saveHistory . stateChanged . connect ( self . update )
self . path . setPlainText ( settings [ ' auto_accept_path ' ] or curr_directory ( ) )
self . change_path . clicked . connect ( self . new_path )
self . block_user_label = Qt Gui . QLabel ( self )
self . block_user_label = Qt Widgets . QLabel ( self )
self . block_user_label . setGeometry ( QtCore . QRect ( 10 , 360 , 350 , 30 ) )
self . block_id = Qt Gui . QPlainTextEdit ( self )
self . block_id = Qt Widgets . QPlainTextEdit ( self )
self . block_id . setGeometry ( QtCore . QRect ( 10 , 390 , 350 , 30 ) )
self . block = Qt Gui . QPushButton ( self )
self . block = Qt Widgets . QPushButton ( self )
self . block . setGeometry ( QtCore . QRect ( 10 , 430 , 350 , 30 ) )
self . block . clicked . connect ( lambda : Profile . get_instance ( ) . block_user ( self . block_id . toPlainText ( ) ) or self . close ( ) )
self . blocked_users_label = Qt Gui . QLabel ( self )
self . blocked_users_label = Qt Widgets . QLabel ( self )
self . blocked_users_label . setGeometry ( QtCore . QRect ( 10 , 470 , 350 , 30 ) )
self . comboBox = Qt Gui . QComboBox ( self )
self . comboBox = Qt Widgets . QComboBox ( self )
self . comboBox . setGeometry ( QtCore . QRect ( 10 , 500 , 350 , 30 ) )
self . comboBox . addItems ( settings [ ' blocked ' ] )
self . unblock = Qt Gui . QPushButton ( self )
self . unblock = Qt Widgets . QPushButton ( self )
self . unblock . setGeometry ( QtCore . QRect ( 10 , 540 , 350 , 30 ) )
self . unblock . clicked . connect ( lambda : self . unblock_user ( ) )
self . retranslateUi ( )
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . setWindowTitle ( Qt Gui . QApplication . translate ( " privacySettings " , " Privacy settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . saveHistory . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Save chat history " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . fileautoaccept . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Allow file auto accept " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . typingNotifications . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Send typing notifications " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . auto_path . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Auto accept default path: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . change_path . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Change " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . inlines . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Allow inlines " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . block_user_label . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Block by public key: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . blocked_users_label . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Blocked users: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . unblock . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Unblock " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . block . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Block user " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . saveUnsentOnly . setText ( Qt Gui . QApplication . translate ( " privacySettings " , " Save unsent messages only " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " privacySettings " , " Privacy settings " ) )
self . saveHistory . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Save chat history " ) )
self . fileautoaccept . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Allow file auto accept " ) )
self . typingNotifications . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Send typing notifications " ) )
self . auto_path . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Auto accept default path: " ) )
self . change_path . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Change " ) )
self . inlines . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Allow inlines " ) )
self . block_user_label . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Block by public key: " ) )
self . blocked_users_label . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Blocked users: " ) )
self . unblock . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Unblock " ) )
self . block . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Block user " ) )
self . saveUnsentOnly . setText ( Qt Widgets . QApplication . translate ( " privacySettings " , " Save unsent messages only " ) )
def update ( self , new_state ) :
self . saveUnsentOnly . setEnabled ( new_state )
@ -463,10 +452,10 @@ class PrivacySettings(CenteredWidget):
def unblock_user ( self ) :
if not self . comboBox . count ( ) :
return
title = Qt Gui . QApplication . translate ( " privacySettings " , " Add to friend list " , None , QtGui . QApplication . UnicodeUTF8 )
info = Qt Gui . QApplication . translate ( " privacySettings " , " Do you want to add this user to friend list? " , None , QtGui . QApplication . UnicodeUTF8 )
reply = Qt Gui . QMessageBox . question ( None , title , info , Qt Gui. QMessageBox . Yes , QtGui . QMessageBox . No )
Profile . get_instance ( ) . unblock_user ( self . comboBox . currentText ( ) , reply == Qt Gui . QMessageBox . Yes )
title = Qt Widgets . QApplication . translate ( " privacySettings " , " Add to friend list " )
info = Qt Widgets . QApplication . translate ( " privacySettings " , " Do you want to add this user to friend list? " )
reply = Qt Widgets . QMessageBox . question ( None , title , info , Qt Widgets. QMessageBox . Yes , QtWidgets . QMessageBox . No )
Profile . get_instance ( ) . unblock_user ( self . comboBox . currentText ( ) , reply == Qt Widgets . QMessageBox . Yes )
self . close ( )
def closeEvent ( self , event ) :
@ -475,31 +464,27 @@ class PrivacySettings(CenteredWidget):
settings [ ' allow_auto_accept ' ] = self . fileautoaccept . isChecked ( )
if settings [ ' save_history ' ] and not self . saveHistory . isChecked ( ) : # clear history
reply = QtGui . QMessageBox . question ( None ,
QtGui . QApplication . translate ( " privacySettings " ,
' Chat history ' ,
None , QtGui . QApplication . UnicodeUTF8 ) ,
QtGui . QApplication . translate ( " privacySettings " ,
' History will be cleaned! Continue? ' ,
None , QtGui . QApplication . UnicodeUTF8 ) ,
QtGui . QMessageBox . Yes ,
QtGui . QMessageBox . No )
if reply == QtGui . QMessageBox . Yes :
reply = QtWidgets . QMessageBox . question ( None ,
QtWidgets . QApplication . translate ( " privacySettings " ,
' Chat history ' ) ,
QtWidgets . QApplication . translate ( " privacySettings " ,
' History will be cleaned! Continue? ' ) ,
QtWidgets . QMessageBox . Yes ,
QtWidgets . QMessageBox . No )
if reply == QtWidgets . QMessageBox . Yes :
Profile . get_instance ( ) . clear_history ( )
settings [ ' save_history ' ] = self . saveHistory . isChecked ( )
else :
settings [ ' save_history ' ] = self . saveHistory . isChecked ( )
if self . saveUnsentOnly . isChecked ( ) and not settings [ ' save_unsent_only ' ] :
reply = QtGui . QMessageBox . question ( None ,
QtGui . QApplication . translate ( " privacySettings " ,
' Chat history ' ,
None , QtGui . QApplication . UnicodeUTF8 ) ,
QtGui . QApplication . translate ( " privacySettings " ,
' History will be cleaned! Continue? ' ,
None , QtGui . QApplication . UnicodeUTF8 ) ,
QtGui . QMessageBox . Yes ,
QtGui . QMessageBox . No )
if reply == QtGui . QMessageBox . Yes :
reply = QtWidgets . QMessageBox . question ( None ,
QtWidgets . QApplication . translate ( " privacySettings " ,
' Chat history ' ) ,
QtWidgets . QApplication . translate ( " privacySettings " ,
' History will be cleaned! Continue? ' ) ,
QtWidgets . QMessageBox . Yes ,
QtWidgets . QMessageBox . No )
if reply == QtWidgets . QMessageBox . Yes :
Profile . get_instance ( ) . clear_history ( None , True )
settings [ ' save_unsent_only ' ] = self . saveUnsentOnly . isChecked ( )
else :
@ -509,7 +494,8 @@ class PrivacySettings(CenteredWidget):
settings . save ( )
def new_path ( self ) :
directory = QtGui . QFileDialog . getExistingDirectory ( options = QtGui . QFileDialog . DontUseNativeDialog ) + ' / '
directory = QtWidgets . QFileDialog . getExistingDirectory ( self , ' ' , curr_directory ( ) + ' / ' ,
QtWidgets . QFileDialog . ShowDirsOnly | QtWidgets . QFileDialog . DontUseNativeDialog ) + ' / '
if directory != ' / ' :
self . path . setPlainText ( directory )
@ -527,11 +513,11 @@ class NotificationsSettings(CenteredWidget):
self . resize ( 350 , 180 )
self . setMinimumSize ( QtCore . QSize ( 350 , 180 ) )
self . setMaximumSize ( QtCore . QSize ( 350 , 180 ) )
self . enableNotifications = Qt Gui . QCheckBox ( self )
self . enableNotifications = Qt Widgets . QCheckBox ( self )
self . enableNotifications . setGeometry ( QtCore . QRect ( 10 , 20 , 340 , 18 ) )
self . callsSound = Qt Gui . QCheckBox ( self )
self . callsSound = Qt Widgets . QCheckBox ( self )
self . callsSound . setGeometry ( QtCore . QRect ( 10 , 120 , 340 , 18 ) )
self . soundNotifications = Qt Gui . QCheckBox ( self )
self . soundNotifications = Qt Widgets . QCheckBox ( self )
self . soundNotifications . setGeometry ( QtCore . QRect ( 10 , 70 , 340 , 18 ) )
font = QtGui . QFont ( )
s = Settings . get_instance ( )
@ -547,10 +533,10 @@ class NotificationsSettings(CenteredWidget):
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . setWindowTitle ( Qt Gui . QApplication . translate ( " notificationsForm " , " Notification settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . enableNotifications . setText ( Qt Gui . QApplication . translate ( " notificationsForm " , " Enable notifications " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . callsSound . setText ( Qt Gui . QApplication . translate ( " notificationsForm " , " Enable call \' s sound " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . soundNotifications . setText ( Qt Gui . QApplication . translate ( " notificationsForm " , " Enable sound notifications " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " notificationsForm " , " Notification settings " ) )
self . enableNotifications . setText ( Qt Widgets . QApplication . translate ( " notificationsForm " , " Enable notifications " ) )
self . callsSound . setText ( Qt Widgets . QApplication . translate ( " notificationsForm " , " Enable call \' s sound " ) )
self . soundNotifications . setText ( Qt Widgets . QApplication . translate ( " notificationsForm " , " Enable sound notifications " ) )
def closeEvent ( self , * args , * * kwargs ) :
settings = Settings . get_instance ( )
@ -571,7 +557,7 @@ class InterfaceSettings(CenteredWidget):
self . setObjectName ( " interfaceForm " )
self . setMinimumSize ( QtCore . QSize ( 400 , 650 ) )
self . setMaximumSize ( QtCore . QSize ( 400 , 650 ) )
self . label = Qt Gui . QLabel ( self )
self . label = Qt Widgets . QLabel ( self )
self . label . setGeometry ( QtCore . QRect ( 30 , 10 , 370 , 20 ) )
settings = Settings . get_instance ( )
font = QtGui . QFont ( )
@ -579,7 +565,7 @@ class InterfaceSettings(CenteredWidget):
font . setBold ( True )
font . setFamily ( settings [ ' font ' ] )
self . label . setFont ( font )
self . themeSelect = Qt Gui . QComboBox ( self )
self . themeSelect = Qt Widgets . QComboBox ( self )
self . themeSelect . setGeometry ( QtCore . QRect ( 30 , 40 , 120 , 30 ) )
list_of_themes = [ ' dark ' ]
self . themeSelect . addItems ( list_of_themes )
@ -589,26 +575,26 @@ class InterfaceSettings(CenteredWidget):
else :
index = 0
self . themeSelect . setCurrentIndex ( index )
self . lang_choose = Qt Gui . QComboBox ( self )
self . lang_choose = Qt Widgets . QComboBox ( self )
self . lang_choose . setGeometry ( QtCore . QRect ( 30 , 110 , 120 , 30 ) )
supported = sorted ( Settings . supported_languages ( ) . keys ( ) , reverse = True )
for key in supported :
self . lang_choose . insertItem ( 0 , key )
if settings [ ' language ' ] == key :
self . lang_choose . setCurrentIndex ( 0 )
self . lang = Qt Gui . QLabel ( self )
self . lang = Qt Widgets . QLabel ( self )
self . lang . setGeometry ( QtCore . QRect ( 30 , 80 , 370 , 20 ) )
self . lang . setFont ( font )
self . mirror_mode = Qt Gui . QCheckBox ( self )
self . mirror_mode = Qt Widgets . QCheckBox ( self )
self . mirror_mode . setGeometry ( QtCore . QRect ( 30 , 160 , 370 , 20 ) )
self . mirror_mode . setChecked ( settings [ ' mirror_mode ' ] )
self . smileys = Qt Gui . QCheckBox ( self )
self . smileys = Qt Widgets . QCheckBox ( self )
self . smileys . setGeometry ( QtCore . QRect ( 30 , 190 , 120 , 20 ) )
self . smileys . setChecked ( settings [ ' smileys ' ] )
self . smiley_pack_label = Qt Gui . QLabel ( self )
self . smiley_pack_label = Qt Widgets . QLabel ( self )
self . smiley_pack_label . setGeometry ( QtCore . QRect ( 30 , 230 , 370 , 20 ) )
self . smiley_pack_label . setFont ( font )
self . smiley_pack = Qt Gui . QComboBox ( self )
self . smiley_pack = Qt Widgets . QComboBox ( self )
self . smiley_pack . setGeometry ( QtCore . QRect ( 30 , 260 , 160 , 30 ) )
sm = smileys . SmileyLoader . get_instance ( )
self . smiley_pack . addItems ( sm . get_packs_list ( ) )
@ -617,39 +603,39 @@ class InterfaceSettings(CenteredWidget):
except :
ind = sm . get_packs_list ( ) . index ( ' default ' )
self . smiley_pack . setCurrentIndex ( ind )
self . messages_font_size_label = Qt Gui . QLabel ( self )
self . messages_font_size_label = Qt Widgets . QLabel ( self )
self . messages_font_size_label . setGeometry ( QtCore . QRect ( 30 , 300 , 370 , 20 ) )
self . messages_font_size_label . setFont ( font )
self . messages_font_size = Qt Gui . QComboBox ( self )
self . messages_font_size = Qt Widgets . QComboBox ( self )
self . messages_font_size . setGeometry ( QtCore . QRect ( 30 , 330 , 160 , 30 ) )
self . messages_font_size . addItems ( [ str ( x ) for x in range ( 10 , 19 ) ] )
self . messages_font_size . setCurrentIndex ( settings [ ' message_font_size ' ] - 10 )
self . unread = Qt Gui . QPushButton ( self )
self . unread = Qt Widgets . QPushButton ( self )
self . unread . setGeometry ( QtCore . QRect ( 30 , 470 , 340 , 30 ) )
self . unread . clicked . connect ( self . select_color )
self . compact_mode = Qt Gui . QCheckBox ( self )
self . compact_mode = Qt Widgets . QCheckBox ( self )
self . compact_mode . setGeometry ( QtCore . QRect ( 30 , 380 , 370 , 20 ) )
self . compact_mode . setChecked ( settings [ ' compact_mode ' ] )
self . close_to_tray = Qt Gui . QCheckBox ( self )
self . close_to_tray = Qt Widgets . QCheckBox ( self )
self . close_to_tray . setGeometry ( QtCore . QRect ( 30 , 410 , 370 , 20 ) )
self . close_to_tray . setChecked ( settings [ ' close_to_tray ' ] )
self . show_avatars = Qt Gui . QCheckBox ( self )
self . show_avatars = Qt Widgets . QCheckBox ( self )
self . show_avatars . setGeometry ( QtCore . QRect ( 30 , 440 , 370 , 20 ) )
self . show_avatars . setChecked ( settings [ ' show_avatars ' ] )
self . choose_font = Qt Gui . QPushButton ( self )
self . choose_font = Qt Widgets . QPushButton ( self )
self . choose_font . setGeometry ( QtCore . QRect ( 30 , 510 , 340 , 30 ) )
self . choose_font . clicked . connect ( self . new_font )
self . import_smileys = Qt Gui . QPushButton ( self )
self . import_smileys = Qt Widgets . QPushButton ( self )
self . import_smileys . setGeometry ( QtCore . QRect ( 30 , 550 , 340 , 30 ) )
self . import_smileys . clicked . connect ( self . import_sm )
self . import_stickers = Qt Gui . QPushButton ( self )
self . import_stickers = Qt Widgets . QPushButton ( self )
self . import_stickers . setGeometry ( QtCore . QRect ( 30 , 590 , 340 , 30 ) )
self . import_stickers . clicked . connect ( self . import_st )
@ -657,29 +643,27 @@ class InterfaceSettings(CenteredWidget):
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . show_avatars . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Show avatars in chat " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Gui . QApplication . translate ( " interfaceForm " , " Interface settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Theme: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . lang . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Language: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . smileys . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Smileys " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . smiley_pack_label . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Smiley pack: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . mirror_mode . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Mirror mode " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . messages_font_size_label . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Messages font size: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . unread . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Select unread messages notification color " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . compact_mode . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Compact contact list " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . import_smileys . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Import smiley pack " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . import_stickers . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Import sticker pack " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . close_to_tray . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Close to tray " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . choose_font . setText ( Qt Gui . QApplication . translate ( " interfaceForm " , " Select font " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . show_avatars . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Show avatars in chat " ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Interface settings " ) )
self . label . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Theme: " ) )
self . lang . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Language: " ) )
self . smileys . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Smileys " ) )
self . smiley_pack_label . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Smiley pack: " ) )
self . mirror_mode . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Mirror mode " ) )
self . messages_font_size_label . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Messages font size: " ) )
self . unread . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Select unread messages notification color " ) )
self . compact_mode . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Compact contact list " ) )
self . import_smileys . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Import smiley pack " ) )
self . import_stickers . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Import sticker pack " ) )
self . close_to_tray . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Close to tray " ) )
self . choose_font . setText ( Qt Widgets . QApplication . translate ( " interfaceForm " , " Select font " ) )
def import_st ( self ) :
directory = QtGui . QFileDialog . getExistingDirectory ( self ,
QtGui . QApplication . translate ( " MainWindow " ,
' Choose folder with sticker pack ' ,
None ,
QtGui . QApplication . UnicodeUTF8 ) ,
curr_directory ( ) ,
QtGui . QFileDialog . ShowDirsOnly | QtGui . QFileDialog . DontUseNativeDialog )
directory = QtWidgets . QFileDialog . getExistingDirectory ( self ,
QtWidgets . QApplication . translate ( " MainWindow " ,
' Choose folder with sticker pack ' ) ,
curr_directory ( ) ,
QtWidgets . QFileDialog . ShowDirsOnly | QtWidgets . QFileDialog . DontUseNativeDialog )
if directory :
src = directory + ' / '
@ -687,13 +671,11 @@ class InterfaceSettings(CenteredWidget):
copy ( src , dest )
def import_sm ( self ) :
directory = QtGui . QFileDialog . getExistingDirectory ( self ,
QtGui . QApplication . translate ( " MainWindow " ,
' Choose folder with smiley pack ' ,
None ,
QtGui . QApplication . UnicodeUTF8 ) ,
directory = QtWidgets . QFileDialog . getExistingDirectory ( self ,
QtWidgets . QApplication . translate ( " MainWindow " ,
' Choose folder with smiley pack ' ) ,
curr_directory ( ) ,
Qt Gui. QFileDialog . ShowDirsOnly | QtGui . QFileDialog . DontUseNativeDialog )
QtWidgets . QFileDialog . ShowDirsOnly | QtWidgets . QFileDialog . DontUseNativeDialog )
if directory :
src = directory + ' / '
@ -702,21 +684,19 @@ class InterfaceSettings(CenteredWidget):
def new_font ( self ) :
settings = Settings . get_instance ( )
font , ok = Qt Gui . QFontDialog . getFont ( QtGui . QFont ( settings [ ' font ' ] , 10 ) , self )
font , ok = Qt Widgets . QFontDialog . getFont ( QtGui . QFont ( settings [ ' font ' ] , 10 ) , self )
if ok :
settings [ ' font ' ] = font . family ( )
settings . save ( )
msgBox = QtGui . QMessageBox ( )
text = QtGui . QApplication . translate ( " interfaceForm " , ' Restart app to apply settings ' , None ,
QtGui . QApplication . UnicodeUTF8 )
msgBox . setWindowTitle ( QtGui . QApplication . translate ( " interfaceForm " , ' Restart required ' , None ,
QtGui . QApplication . UnicodeUTF8 ) )
msgBox = QtWidgets . QMessageBox ( )
text = QtWidgets . QApplication . translate ( " interfaceForm " , ' Restart app to apply settings ' )
msgBox . setWindowTitle ( QtWidgets . QApplication . translate ( " interfaceForm " , ' Restart required ' ) )
msgBox . setText ( text )
msgBox . exec_ ( )
def select_color ( self ) :
settings = Settings . get_instance ( )
col = Qt Gui . QColorDialog . getColor ( settings[ ' unread_color ' ] )
col = Qt Widgets . QColorDialog . getColor ( QtGui. QColor ( settings[ ' unread_color ' ] ) )
if col . isValid ( ) :
name = col . name ( )
@ -745,7 +725,7 @@ class InterfaceSettings(CenteredWidget):
settings [ ' language ' ] = language
text = self . lang_choose . currentText ( )
path = Settings . supported_languages ( ) [ text ]
app = Qt Gui . QApplication . instance ( )
app = Qt Widgets . QApplication . instance ( )
app . removeTranslator ( app . translator )
app . translator . load ( curr_directory ( ) + ' /translations/ ' + path )
app . installTranslator ( app . translator )
@ -753,11 +733,9 @@ class InterfaceSettings(CenteredWidget):
Profile . get_instance ( ) . update ( )
settings . save ( )
if restart :
msgBox = QtGui . QMessageBox ( )
text = QtGui . QApplication . translate ( " interfaceForm " , ' Restart app to apply settings ' , None ,
QtGui . QApplication . UnicodeUTF8 )
msgBox . setWindowTitle ( QtGui . QApplication . translate ( " interfaceForm " , ' Restart required ' , None ,
QtGui . QApplication . UnicodeUTF8 ) )
msgBox = QtWidgets . QMessageBox ( )
text = QtWidgets . QApplication . translate ( " interfaceForm " , ' Restart app to apply settings ' )
msgBox . setWindowTitle ( QtWidgets . QApplication . translate ( " interfaceForm " , ' Restart required ' ) )
msgBox . setText ( text )
msgBox . exec_ ( )
@ -778,9 +756,9 @@ class AudioSettings(CenteredWidget):
self . resize ( 400 , 150 )
self . setMinimumSize ( QtCore . QSize ( 400 , 150 ) )
self . setMaximumSize ( QtCore . QSize ( 400 , 150 ) )
self . in_label = Qt Gui . QLabel ( self )
self . in_label = Qt Widgets . QLabel ( self )
self . in_label . setGeometry ( QtCore . QRect ( 25 , 5 , 350 , 20 ) )
self . out_label = Qt Gui . QLabel ( self )
self . out_label = Qt Widgets . QLabel ( self )
self . out_label . setGeometry ( QtCore . QRect ( 25 , 65 , 350 , 20 ) )
settings = Settings . get_instance ( )
font = QtGui . QFont ( )
@ -789,9 +767,9 @@ class AudioSettings(CenteredWidget):
font . setFamily ( settings [ ' font ' ] )
self . in_label . setFont ( font )
self . out_label . setFont ( font )
self . input = Qt Gui . QComboBox ( self )
self . input = Qt Widgets . QComboBox ( self )
self . input . setGeometry ( QtCore . QRect ( 25 , 30 , 350 , 30 ) )
self . output = Qt Gui . QComboBox ( self )
self . output = Qt Widgets . QComboBox ( self )
self . output . setGeometry ( QtCore . QRect ( 25 , 90 , 350 , 30 ) )
p = pyaudio . PyAudio ( )
self . in_indexes , self . out_indexes = [ ] , [ ]
@ -808,9 +786,9 @@ class AudioSettings(CenteredWidget):
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . setWindowTitle ( Qt Gui . QApplication . translate ( " audioSettingsForm " , " Audio settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . in_label . setText ( Qt Gui . QApplication . translate ( " audioSettingsForm " , " Input device: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . out_label . setText ( Qt Gui . QApplication . translate ( " audioSettingsForm " , " Output device: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " audioSettingsForm " , " Audio settings " ) )
self . in_label . setText ( Qt Widgets . QApplication . translate ( " audioSettingsForm " , " Input device: " ) )
self . out_label . setText ( Qt Widgets . QApplication . translate ( " audioSettingsForm " , " Output device: " ) )
def closeEvent ( self , event ) :
settings = Settings . get_instance ( )
@ -834,15 +812,15 @@ class PluginsSettings(CenteredWidget):
self . resize ( 400 , 210 )
self . setMinimumSize ( QtCore . QSize ( 400 , 210 ) )
self . setMaximumSize ( QtCore . QSize ( 400 , 210 ) )
self . comboBox = Qt Gui . QComboBox ( self )
self . comboBox = Qt Widgets . QComboBox ( self )
self . comboBox . setGeometry ( QtCore . QRect ( 30 , 10 , 340 , 30 ) )
self . label = Qt Gui . QLabel ( self )
self . label = Qt Widgets . QLabel ( self )
self . label . setGeometry ( QtCore . QRect ( 30 , 40 , 340 , 90 ) )
self . label . setWordWrap ( True )
self . button = Qt Gui . QPushButton ( self )
self . button = Qt Widgets . QPushButton ( self )
self . button . setGeometry ( QtCore . QRect ( 30 , 130 , 340 , 30 ) )
self . button . clicked . connect ( self . button_click )
self . open = Qt Gui . QPushButton ( self )
self . open = Qt Widgets . QPushButton ( self )
self . open . setGeometry ( QtCore . QRect ( 30 , 170 , 340 , 30 ) )
self . open . clicked . connect ( self . open_plugin )
self . pl_loader = plugin_support . PluginLoader . get_instance ( )
@ -851,8 +829,8 @@ class PluginsSettings(CenteredWidget):
self . show_data ( )
def retranslateUi ( self ) :
self . setWindowTitle ( Qt Gui . QApplication . translate ( ' PluginsForm ' , " Plugins " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . open . setText ( Qt Gui . QApplication . translate ( ' PluginsForm ' , " Open selected plugin " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( ' PluginsForm ' , " Plugins " ) )
self . open . setText ( Qt Widgets . QApplication . translate ( ' PluginsForm ' , " Open selected plugin " ) )
def open_plugin ( self ) :
ind = self . comboBox . currentIndex ( )
@ -862,11 +840,9 @@ class PluginsSettings(CenteredWidget):
self . window = window
self . window . show ( )
else :
msgBox = QtGui . QMessageBox ( )
text = QtGui . QApplication . translate ( " PluginsForm " , ' No GUI found for this plugin ' , None ,
QtGui . QApplication . UnicodeUTF8 )
msgBox . setWindowTitle ( QtGui . QApplication . translate ( " PluginsForm " , ' Error ' , None ,
QtGui . QApplication . UnicodeUTF8 ) )
msgBox = QtWidgets . QMessageBox ( )
text = QtWidgets . QApplication . translate ( " PluginsForm " , ' No GUI found for this plugin ' )
msgBox . setWindowTitle ( QtWidgets . QApplication . translate ( " PluginsForm " , ' Error ' ) )
msgBox . setText ( text )
msgBox . exec_ ( )
@ -880,16 +856,16 @@ class PluginsSettings(CenteredWidget):
ind = self . comboBox . currentIndex ( )
if len ( self . data ) :
plugin = self . data [ ind ]
descr = plugin [ 2 ] or Qt Gui . QApplication . translate ( " PluginsForm " , " No description available " , None , QtGui . QApplication . UnicodeUTF8 )
descr = plugin [ 2 ] or Qt Widgets . QApplication . translate ( " PluginsForm " , " No description available " )
self . label . setText ( descr )
if plugin [ 1 ] :
self . button . setText ( Qt Gui . QApplication . translate ( " PluginsForm " , " Disable plugin " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . button . setText ( Qt Widgets . QApplication . translate ( " PluginsForm " , " Disable plugin " ) )
else :
self . button . setText ( Qt Gui . QApplication . translate ( " PluginsForm " , " Enable plugin " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . button . setText ( Qt Widgets . QApplication . translate ( " PluginsForm " , " Enable plugin " ) )
else :
self . open . setVisible ( False )
self . button . setVisible ( False )
self . label . setText ( Qt Gui . QApplication . translate ( " PluginsForm " , " No plugins found " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . label . setText ( Qt Widgets . QApplication . translate ( " PluginsForm " , " No plugins found " ) )
def button_click ( self ) :
ind = self . comboBox . currentIndex ( )
@ -897,9 +873,9 @@ class PluginsSettings(CenteredWidget):
self . pl_loader . toggle_plugin ( plugin [ - 1 ] )
plugin [ 1 ] = not plugin [ 1 ]
if plugin [ 1 ] :
self . button . setText ( Qt Gui . QApplication . translate ( " PluginsForm " , " Disable plugin " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . button . setText ( Qt Widgets . QApplication . translate ( " PluginsForm " , " Disable plugin " ) )
else :
self . button . setText ( Qt Gui . QApplication . translate ( " PluginsForm " , " Enable plugin " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . button . setText ( Qt Widgets . QApplication . translate ( " PluginsForm " , " Enable plugin " ) )
class UpdateSettings ( CenteredWidget ) :
@ -917,7 +893,7 @@ class UpdateSettings(CenteredWidget):
self . resize ( 400 , 150 )
self . setMinimumSize ( QtCore . QSize ( 400 , 120 ) )
self . setMaximumSize ( QtCore . QSize ( 400 , 120 ) )
self . in_label = Qt Gui . QLabel ( self )
self . in_label = Qt Widgets . QLabel ( self )
self . in_label . setGeometry ( QtCore . QRect ( 25 , 5 , 350 , 20 ) )
settings = Settings . get_instance ( )
font = QtGui . QFont ( )
@ -925,9 +901,9 @@ class UpdateSettings(CenteredWidget):
font . setBold ( True )
font . setFamily ( settings [ ' font ' ] )
self . in_label . setFont ( font )
self . autoupdate = Qt Gui . QComboBox ( self )
self . autoupdate = Qt Widgets . QComboBox ( self )
self . autoupdate . setGeometry ( QtCore . QRect ( 25 , 30 , 350 , 30 ) )
self . button = Qt Gui . QPushButton ( self )
self . button = Qt Widgets . QPushButton ( self )
self . button . setGeometry ( QtCore . QRect ( 25 , 70 , 350 , 30 ) )
self . button . setEnabled ( settings [ ' update ' ] )
self . button . clicked . connect ( self . update_client )
@ -937,12 +913,12 @@ class UpdateSettings(CenteredWidget):
QtCore . QMetaObject . connectSlotsByName ( self )
def retranslateUi ( self ) :
self . setWindowTitle ( Qt Gui . QApplication . translate ( " updateSettingsForm " , " Update settings " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . in_label . setText ( Qt Gui . QApplication . translate ( " updateSettingsForm " , " Select update mode: " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . button . setText ( Qt Gui . QApplication . translate ( " updateSettingsForm " , " Update Toxygen " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . autoupdate . addItem ( Qt Gui . QApplication . translate ( " updateSettingsForm " , " Disabled " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . autoupdate . addItem ( Qt Gui . QApplication . translate ( " updateSettingsForm " , " Manual " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . autoupdate . addItem ( Qt Gui . QApplication . translate ( " updateSettingsForm " , " Auto " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " updateSettingsForm " , " Update settings " ) )
self . in_label . setText ( Qt Widgets . QApplication . translate ( " updateSettingsForm " , " Select update mode: " ) )
self . button . setText ( Qt Widgets . QApplication . translate ( " updateSettingsForm " , " Update Toxygen " ) )
self . autoupdate . addItem ( Qt Widgets . QApplication . translate ( " updateSettingsForm " , " Disabled " ) )
self . autoupdate . addItem ( Qt Widgets . QApplication . translate ( " updateSettingsForm " , " Manual " ) )
self . autoupdate . addItem ( Qt Widgets . QApplication . translate ( " updateSettingsForm " , " Auto " ) )
def closeEvent ( self , event ) :
settings = Settings . get_instance ( )
@ -951,34 +927,29 @@ class UpdateSettings(CenteredWidget):
def update_client ( self ) :
if not updater . connection_available ( ) :
msgBox = Qt Gui . QMessageBox ( )
msgBox = Qt Widgets . QMessageBox ( )
msgBox . setWindowTitle (
QtGui . QApplication . translate ( " updateSettingsForm " , " Error " , None ,
QtGui . QApplication . UnicodeUTF8 ) )
text = ( QtGui . QApplication . translate ( " updateSettingsForm " , ' Problems with internet connection ' , None ,
QtGui . QApplication . UnicodeUTF8 ) )
QtWidgets . QApplication . translate ( " updateSettingsForm " , " Error " ) )
text = ( QtWidgets . QApplication . translate ( " updateSettingsForm " , ' Problems with internet connection ' ) )
msgBox . setText ( text )
msgBox . exec_ ( )
return
if not updater . updater_available ( ) :
msgBox = Qt Gui . QMessageBox ( )
msgBox = Qt Widgets . QMessageBox ( )
msgBox . setWindowTitle (
QtGui . QApplication . translate ( " updateSettingsForm " , " Error " , None ,
QtGui . QApplication . UnicodeUTF8 ) )
text = ( QtGui . QApplication . translate ( " updateSettingsForm " , ' Updater not found ' , None ,
QtGui . QApplication . UnicodeUTF8 ) )
QtWidgets . QApplication . translate ( " updateSettingsForm " , " Error " ) )
text = ( QtWidgets . QApplication . translate ( " updateSettingsForm " , ' Updater not found ' ) )
msgBox . setText ( text )
msgBox . exec_ ( )
return
version = updater . check_for_updates ( )
if version is not None :
updater . download ( version )
Qt Gui . QApplication . closeAllWindows ( )
Qt Widgets . QApplication . closeAllWindows ( )
else :
msgBox = Qt Gui . QMessageBox ( )
msgBox = Qt Widgets . QMessageBox ( )
msgBox . setWindowTitle (
QtGui . QApplication . translate ( " updateSettingsForm " , " No updates found " , None , QtGui . QApplication . UnicodeUTF8 ) )
text = ( QtGui . QApplication . translate ( " updateSettingsForm " , ' Toxygen is up to date ' , None ,
QtGui . QApplication . UnicodeUTF8 ) )
QtWidgets . QApplication . translate ( " updateSettingsForm " , " No updates found " ) )
text = ( QtWidgets . QApplication . translate ( " updateSettingsForm " , ' Toxygen is up to date ' ) )
msgBox . setText ( text )
msgBox . exec_ ( )