From fdfc74521b1edea50cc0dcdf494e4d7f5baa994e Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Wed, 27 Jul 2016 14:50:36 +0300 Subject: [PATCH] some updates and fixes --- toxygen/libtox.py | 33 ++++++++++++++++++--------------- toxygen/mainscreen.py | 6 +++--- toxygen/menu.py | 3 ++- toxygen/styles/style.qss | 10 ++++++++++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/toxygen/libtox.py b/toxygen/libtox.py index edf2a12..1c30eee 100644 --- a/toxygen/libtox.py +++ b/toxygen/libtox.py @@ -6,13 +6,14 @@ import util class LibToxCore: def __init__(self): - if system() == 'Linux': - # libtoxcore and libsodium must be installed in your os - self._libtoxcore = CDLL('libtoxcore.so') - elif system() == 'Windows': + if system() == 'Windows': self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll') 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): return self._libtoxcore.__getattr__(item) @@ -21,14 +22,15 @@ class LibToxCore: class LibToxAV: def __init__(self): - if system() == 'Linux': - # that /usr/lib/libtoxav.so must exists - self._libtoxav = CDLL('libtoxav.so') - elif system() == 'Windows': + if system() == 'Windows': # on Windows av api is in libtox.dll self._libtoxav = CDLL(util.curr_directory() + '/libs/libtox.dll') 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): return self._libtoxav.__getattr__(item) @@ -37,14 +39,15 @@ class LibToxAV: class LibToxEncryptSave: def __init__(self): - if system() == 'Linux': - # /usr/lib/libtoxencryptsave.so must exists - self._lib_tox_encrypt_save = CDLL('libtoxencryptsave.so') - elif system() == 'Windows': + if system() == 'Windows': # on Windows profile encryption api is in libtox.dll self._lib_tox_encrypt_save = CDLL(util.curr_directory() + '/libs/libtox.dll') 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): return self._lib_tox_encrypt_save.__getattr__(item) diff --git a/toxygen/mainscreen.py b/toxygen/mainscreen.py index 282ab50..8a8c9ab 100644 --- a/toxygen/mainscreen.py +++ b/toxygen/mainscreen.py @@ -265,6 +265,7 @@ class MainWindow(QtGui.QMainWindow, Singleton): self.messages.verticalScrollBar().setValue(1) self.messages.verticalScrollBar().valueChanged.connect(load) self.messages.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel) + self.messages.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) def initUI(self, tox): self.setMinimumSize(920, 500) @@ -325,8 +326,8 @@ class MainWindow(QtGui.QMainWindow, Singleton): self.profile.save_history() self.profile.close() s = Settings.get_instance() - s['x'] = self.pos().x() - s['y'] = self.pos().y() + s['x'] = self.geometry().x() + s['y'] = self.geometry().y() s['width'] = self.width() s['height'] = self.height() s.save() @@ -610,4 +611,3 @@ class MainWindow(QtGui.QMainWindow, Singleton): def filtering(self): self.profile.filtration(self.online_contacts.currentIndex() == 1, self.contact_name.text()) - diff --git a/toxygen/menu.py b/toxygen/menu.py index 74e785d..8c95ce3 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -266,7 +266,8 @@ class ProfileSettings(CenteredWidget): Profile.get_instance().set_avatar(bytes(byte_array.data())) 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 != '/': ProfileHelper.get_instance().export_profile(directory) settings = Settings.get_instance() diff --git a/toxygen/styles/style.qss b/toxygen/styles/style.qss index 0eddfde..a672d38 100644 --- a/toxygen/styles/style.qss +++ b/toxygen/styles/style.qss @@ -1245,10 +1245,20 @@ QPushButton:hover } #messages:item:selected +{ + background-color: #1E90FF; +} + +MessageEdit { background-color: transparent; } +#messages:item:selected QListWidgetItem +{ + background-color: #1E90FF; +} + #friends_list:item:selected { background-color: #333333;