some updates and fixes

This commit is contained in:
ingvar1995 2016-07-27 14:50:36 +03:00
parent 3db10ead6a
commit fdfc74521b
4 changed files with 33 additions and 19 deletions

View file

@ -6,13 +6,14 @@ import util
class LibToxCore: class LibToxCore:
def __init__(self): def __init__(self):
if system() == 'Linux': if system() == 'Windows':
# libtoxcore and libsodium must be installed in your os
self._libtoxcore = CDLL('libtoxcore.so')
elif system() == 'Windows':
self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll') self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll')
else: else:
raise OSError('Unknown system.') # libtoxcore and libsodium must be installed in your os
try:
self._libtoxcore = CDLL('libtoxcore.so')
except:
self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtoxcore.so')
def __getattr__(self, item): def __getattr__(self, item):
return self._libtoxcore.__getattr__(item) return self._libtoxcore.__getattr__(item)
@ -21,14 +22,15 @@ class LibToxCore:
class LibToxAV: class LibToxAV:
def __init__(self): def __init__(self):
if system() == 'Linux': if system() == 'Windows':
# that /usr/lib/libtoxav.so must exists
self._libtoxav = CDLL('libtoxav.so')
elif system() == 'Windows':
# on Windows av api is in libtox.dll # on Windows av api is in libtox.dll
self._libtoxav = CDLL(util.curr_directory() + '/libs/libtox.dll') self._libtoxav = CDLL(util.curr_directory() + '/libs/libtox.dll')
else: else:
raise OSError('Unknown system.') # /usr/lib/libtoxav.so must exists
try:
self._libtoxav = CDLL('libtoxav.so')
except:
self._libtoxav = CDLL(util.curr_directory() + '/libs/libtoxav.so')
def __getattr__(self, item): def __getattr__(self, item):
return self._libtoxav.__getattr__(item) return self._libtoxav.__getattr__(item)
@ -37,14 +39,15 @@ class LibToxAV:
class LibToxEncryptSave: class LibToxEncryptSave:
def __init__(self): def __init__(self):
if system() == 'Linux': if system() == 'Windows':
# /usr/lib/libtoxencryptsave.so must exists
self._lib_tox_encrypt_save = CDLL('libtoxencryptsave.so')
elif system() == 'Windows':
# on Windows profile encryption api is in libtox.dll # on Windows profile encryption api is in libtox.dll
self._lib_tox_encrypt_save = CDLL(util.curr_directory() + '/libs/libtox.dll') self._lib_tox_encrypt_save = CDLL(util.curr_directory() + '/libs/libtox.dll')
else: else:
raise OSError('Unknown system.') # /usr/lib/libtoxencryptsave.so must exists
try:
self._lib_tox_encrypt_save = CDLL('libtoxencryptsave.so')
except:
self._lib_tox_encrypt_save = CDLL(util.curr_directory() + '/libs/libtoxencryptsave.so')
def __getattr__(self, item): def __getattr__(self, item):
return self._lib_tox_encrypt_save.__getattr__(item) return self._lib_tox_encrypt_save.__getattr__(item)

View file

@ -265,6 +265,7 @@ class MainWindow(QtGui.QMainWindow, Singleton):
self.messages.verticalScrollBar().setValue(1) self.messages.verticalScrollBar().setValue(1)
self.messages.verticalScrollBar().valueChanged.connect(load) self.messages.verticalScrollBar().valueChanged.connect(load)
self.messages.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel) self.messages.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
self.messages.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
def initUI(self, tox): def initUI(self, tox):
self.setMinimumSize(920, 500) self.setMinimumSize(920, 500)
@ -325,8 +326,8 @@ class MainWindow(QtGui.QMainWindow, Singleton):
self.profile.save_history() self.profile.save_history()
self.profile.close() self.profile.close()
s = Settings.get_instance() s = Settings.get_instance()
s['x'] = self.pos().x() s['x'] = self.geometry().x()
s['y'] = self.pos().y() s['y'] = self.geometry().y()
s['width'] = self.width() s['width'] = self.width()
s['height'] = self.height() s['height'] = self.height()
s.save() s.save()
@ -610,4 +611,3 @@ class MainWindow(QtGui.QMainWindow, Singleton):
def filtering(self): def filtering(self):
self.profile.filtration(self.online_contacts.currentIndex() == 1, self.contact_name.text()) self.profile.filtration(self.online_contacts.currentIndex() == 1, self.contact_name.text())

View file

@ -266,7 +266,8 @@ class ProfileSettings(CenteredWidget):
Profile.get_instance().set_avatar(bytes(byte_array.data())) Profile.get_instance().set_avatar(bytes(byte_array.data()))
def export_profile(self): def export_profile(self):
directory = QtGui.QFileDialog.getExistingDirectory(options=QtGui.QFileDialog.DontUseNativeDialog) + '/' directory = QtGui.QFileDialog.getExistingDirectory(options=QtGui.QFileDialog.DontUseNativeDialog,
dir=curr_directory()) + '/'
if directory != '/': if directory != '/':
ProfileHelper.get_instance().export_profile(directory) ProfileHelper.get_instance().export_profile(directory)
settings = Settings.get_instance() settings = Settings.get_instance()

View file

@ -1245,10 +1245,20 @@ QPushButton:hover
} }
#messages:item:selected #messages:item:selected
{
background-color: #1E90FF;
}
MessageEdit
{ {
background-color: transparent; background-color: transparent;
} }
#messages:item:selected QListWidgetItem
{
background-color: #1E90FF;
}
#friends_list:item:selected #friends_list:item:selected
{ {
background-color: #333333; background-color: #333333;