@ -1,5 +1,5 @@
import plugin_super_class
from Py Side import QtGui , QtCore
from Py Qt5 import QtCore , QtWidgets
import json
@ -15,25 +15,25 @@ class CopyableToxId(plugin_super_class.PluginSuperClass):
self . load_translator ( )
def get_description ( self ) :
return Qt Gui . QApplication . translate ( " TOXID " , ' Plugin which allows you to copy TOX ID of your friend easily. ' , None , QtGui . QApplication . UnicodeUTF8 )
return Qt Widgets . QApplication . translate ( " TOXID " , ' Plugin which allows you to copy TOX ID of your friend easily. ' )
def get_window ( self ) :
inst = self
class Window ( Qt Gui . QWidget ) :
class Window ( Qt Widgets . QWidget ) :
def __init__ ( self ) :
super ( Window , self ) . __init__ ( )
self . setGeometry ( QtCore . QRect ( 450 , 300 , 350 , 100 ) )
self . send = Qt Gui . QCheckBox ( self )
self . send = Qt Widgets . QCheckBox ( self )
self . send . setGeometry ( QtCore . QRect ( 20 , 10 , 310 , 25 ) )
self . send . setText ( Qt Gui . QApplication . translate ( " TOXID " , " Send my TOX ID to contacts " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . setWindowTitle ( Qt Gui . QApplication . translate ( " TOXID " , " CopyableToxID " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . send . setText ( Qt Widgets . QApplication . translate ( " TOXID " , " Send my TOX ID to contacts " ) )
self . setWindowTitle ( Qt Widgets . QApplication . translate ( " TOXID " , " CopyableToxID " ) )
self . send . clicked . connect ( self . update )
self . send . setChecked ( inst . _data [ ' send_id ' ] )
self . help = Qt Gui . QPushButton ( self )
self . help = Qt Widgets . QPushButton ( self )
self . help . setGeometry ( QtCore . QRect ( 20 , 40 , 200 , 25 ) )
self . help . setText ( Qt Gui . QApplication . translate ( " TOXID " , " List of commands " , None , QtGui . QApplication . UnicodeUTF8 ) )
self . help . setText ( Qt Widgets . QApplication . translate ( " TOXID " , " List of commands " ) )
self . help . clicked . connect ( lambda : inst . command ( ' help ' ) )
def update ( self ) :
@ -49,17 +49,17 @@ class CopyableToxId(plugin_super_class.PluginSuperClass):
if self . _copy :
self . _timer . stop ( )
self . _copy = False
clipboard = Qt Gui . QApplication . clipboard ( )
clipboard = Qt Widgets . QApplication . clipboard ( )
clipboard . setText ( data )
self . save_settings ( json . dumps ( self . _data ) )
elif self . _data [ ' send_id ' ] :
self . send_lossless ( self . _tox . self_get_address ( ) , friend_number )
def error ( self ) :
msgbox = Qt Gui . QMessageBox ( )
title = Qt Gui . QApplication . translate ( " TOXID " , " Error " , None , QtGui . QApplication . UnicodeUTF8 )
msgbox = Qt Widgets . QMessageBox ( )
title = Qt Widgets . QApplication . translate ( " TOXID " , " Error " )
msgbox . setWindowTitle ( title . format ( self . _name ) )
text = Qt Gui . QApplication . translate ( " TOXID " , " Tox ID cannot be copied " , None , QtGui . QApplication . UnicodeUTF8 )
text = Qt Widgets . QApplication . translate ( " TOXID " , " Tox ID cannot be copied " )
msgbox . setText ( text )
msgbox . exec_ ( )
@ -70,7 +70,7 @@ class CopyableToxId(plugin_super_class.PluginSuperClass):
self . _curr = - 1
arr = list ( filter ( lambda x : x . startswith ( public_key ) , self . _data [ ' id ' ] ) )
if len ( arr ) :
clipboard = Qt Gui . QApplication . clipboard ( )
clipboard = Qt Widgets . QApplication . clipboard ( )
clipboard . setText ( arr [ 0 ] )
else :
self . error ( )
@ -97,15 +97,15 @@ class CopyableToxId(plugin_super_class.PluginSuperClass):
self . _copy = False
return
elif text == ' help ' :
msgbox = Qt Gui . QMessageBox ( )
title = Qt Gui . QApplication . translate ( " TOXID " , " List of commands for plugin CopyableToxID " , None , QtGui . QApplication . UnicodeUTF8 )
msgbox = Qt Widgets . QMessageBox ( )
title = Qt Widgets . QApplication . translate ( " TOXID " , " List of commands for plugin CopyableToxID " )
msgbox . setWindowTitle ( title )
text = Qt Gui . QApplication . translate ( " TOXID " , """ Commands:
text = Qt Widgets . QApplication . translate ( " TOXID " , """ Commands:
copy : copy TOX ID of current friend
copy < friend_number > : copy TOX ID of friend with specified number
enable : allow send your TOX ID to friends
disable : disallow send your TOX ID to friends
help : show this help """ , None, QtGui.QApplication.UnicodeUTF8 )
help : show this help """ )
msgbox . setText ( text )
msgbox . exec_ ( )
return
@ -114,7 +114,7 @@ help: show this help""", None, QtGui.QApplication.UnicodeUTF8)
public_key = self . _tox . friend_get_public_key ( num )
arr = list ( filter ( lambda x : x . startswith ( public_key ) , self . _data [ ' id ' ] ) )
if self . _profile . get_friend_by_number ( num ) . status is None and len ( arr ) :
clipboard = Qt Gui . QApplication . clipboard ( )
clipboard = Qt Widgets . QApplication . clipboard ( )
clipboard . setText ( arr [ 0 ] )
elif self . _profile . get_friend_by_number ( num ) . status is not None :
self . _copy = True
@ -125,7 +125,7 @@ help: show this help""", None, QtGui.QApplication.UnicodeUTF8)
self . error ( )
def get_menu ( self , menu , num ) :
act = Qt Gui. QAction ( QtGui . QApplication . translate ( " TOXID " , " Copy TOX ID " , None , QtGui . QApplication . UnicodeUTF8 ) , menu )
act = Qt Widgets. QAction ( QtWidgets . QApplication . translate ( " TOXID " , " Copy TOX ID " ) , menu )
friend = self . _profile . get_friend ( num )
act . connect ( act , QtCore . SIGNAL ( " triggered() " ) , lambda : self . command ( ' copy ' + str ( friend . number ) ) )
return [ act ]