tests update, bug fix
This commit is contained in:
parent
5204cba58d
commit
18935c5b10
8 changed files with 26 additions and 43 deletions
|
@ -6,7 +6,7 @@ class Node:
|
|||
self._ip, self._port, self._tox_key, self.rand = ip, port, tox_key, rand
|
||||
|
||||
def get_data(self):
|
||||
return self._ip, self._port, self._tox_key
|
||||
return bytes(self._ip, 'utf-8'), self._port, self._tox_key
|
||||
|
||||
|
||||
def node_generator():
|
||||
|
|
|
@ -3,7 +3,7 @@ from sqlite3 import connect
|
|||
import settings
|
||||
from os import chdir
|
||||
import os.path
|
||||
from toxencryptsave import LibToxEncryptSave
|
||||
from toxencryptsave import ToxEncryptSave
|
||||
|
||||
|
||||
PAGE_SIZE = 42
|
||||
|
@ -22,7 +22,7 @@ class History:
|
|||
chdir(settings.ProfileHelper.get_path())
|
||||
path = settings.ProfileHelper.get_path() + self._name + '.hstr'
|
||||
if os.path.exists(path):
|
||||
decr = LibToxEncryptSave.get_instance()
|
||||
decr = ToxEncryptSave.get_instance()
|
||||
try:
|
||||
with open(path, 'rb') as fin:
|
||||
data = fin.read()
|
||||
|
@ -40,7 +40,7 @@ class History:
|
|||
db.close()
|
||||
|
||||
def save(self):
|
||||
encr = LibToxEncryptSave.get_instance()
|
||||
encr = ToxEncryptSave.get_instance()
|
||||
if encr.has_password():
|
||||
path = settings.ProfileHelper.get_path() + self._name + '.hstr'
|
||||
with open(path, 'rb') as fin:
|
||||
|
@ -54,7 +54,7 @@ class History:
|
|||
new_path = directory + self._name + '.hstr'
|
||||
with open(path, 'rb') as fin:
|
||||
data = fin.read()
|
||||
encr = LibToxEncryptSave.get_instance()
|
||||
encr = ToxEncryptSave.get_instance()
|
||||
if encr.has_password():
|
||||
data = encr.pass_encrypt(data)
|
||||
with open(new_path, 'wb') as fout:
|
||||
|
|
|
@ -36,7 +36,7 @@ class Toxygen:
|
|||
Show password screen
|
||||
"""
|
||||
tmp = [data]
|
||||
p = PasswordScreen(toxencryptsave.LibToxEncryptSave.get_instance(), tmp)
|
||||
p = PasswordScreen(toxencryptsave.ToxEncryptSave.get_instance(), tmp)
|
||||
p.show()
|
||||
self.app.connect(self.app, QtCore.SIGNAL("lastWindowClosed()"), self.app, QtCore.SLOT("quit()"))
|
||||
self.app.exec_()
|
||||
|
@ -58,7 +58,7 @@ class Toxygen:
|
|||
dark_style = fl.read()
|
||||
app.setStyleSheet(dark_style)
|
||||
|
||||
encrypt_save = toxencryptsave.LibToxEncryptSave()
|
||||
encrypt_save = toxencryptsave.ToxEncryptSave()
|
||||
|
||||
if self.path is not None:
|
||||
path = os.path.dirname(self.path) + '/'
|
||||
|
|
|
@ -205,7 +205,7 @@ class ProfileSettings(CenteredWidget):
|
|||
def new_password(self):
|
||||
if self.password.text() == self.confirm_password.text():
|
||||
if not len(self.password.text()) or len(self.password.text()) >= 8:
|
||||
e = toxencryptsave.LibToxEncryptSave.get_instance()
|
||||
e = toxencryptsave.ToxEncryptSave.get_instance()
|
||||
e.set_password(self.password.text())
|
||||
self.close()
|
||||
else:
|
||||
|
|
|
@ -16,7 +16,7 @@ class PluginLoader(util.Singleton):
|
|||
self._settings = settings
|
||||
self._plugins = {} # dict. key - plugin unique short name, value - tuple (plugin instance, is active)
|
||||
self._tox = tox
|
||||
self._encr = toxencryptsave.LibToxEncryptSave.get_instance()
|
||||
self._encr = toxencryptsave.ToxEncryptSave.get_instance()
|
||||
|
||||
def set_tox(self, tox):
|
||||
"""
|
||||
|
|
|
@ -4,7 +4,7 @@ import os
|
|||
import locale
|
||||
from util import Singleton, curr_directory, log
|
||||
import pyaudio
|
||||
from toxencryptsave import LibToxEncryptSave
|
||||
from toxencryptsave import ToxEncryptSave
|
||||
import smileys
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ class Settings(dict, Singleton):
|
|||
if os.path.isfile(self.path):
|
||||
with open(self.path, 'rb') as fl:
|
||||
data = fl.read()
|
||||
inst = LibToxEncryptSave.get_instance()
|
||||
inst = ToxEncryptSave.get_instance()
|
||||
try:
|
||||
if inst.is_data_encrypted(data):
|
||||
data = inst.pass_decrypt(data)
|
||||
|
@ -145,7 +145,7 @@ class Settings(dict, Singleton):
|
|||
|
||||
def save(self):
|
||||
text = json.dumps(self)
|
||||
inst = LibToxEncryptSave.get_instance()
|
||||
inst = ToxEncryptSave.get_instance()
|
||||
if inst.has_password():
|
||||
text = bytes(inst.pass_encrypt(bytes(text, 'utf-8')))
|
||||
else:
|
||||
|
@ -224,7 +224,7 @@ class ProfileHelper(Singleton):
|
|||
return self._directory
|
||||
|
||||
def save_profile(self, data):
|
||||
inst = LibToxEncryptSave.get_instance()
|
||||
inst = ToxEncryptSave.get_instance()
|
||||
if inst.has_password():
|
||||
data = inst.pass_encrypt(data)
|
||||
with open(self._path, 'wb') as fl:
|
||||
|
|
|
@ -34,7 +34,7 @@ TOX_ERR_DECRYPTION = {
|
|||
TOX_PASS_ENCRYPTION_EXTRA_LENGTH = 80
|
||||
|
||||
|
||||
class LibToxEncryptSave(util.Singleton):
|
||||
class ToxEncryptSave(util.Singleton):
|
||||
|
||||
libtoxencryptsave = libtox.LibToxEncryptSave()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue