some broken dialogs fixed

This commit is contained in:
ingvar1995 2017-05-08 23:58:23 +03:00
parent b081bff2ce
commit 3546dbd75b

View file

@ -247,12 +247,12 @@ class ProfileSettings(CenteredWidget):
def set_avatar(self): def set_avatar(self):
choose = QtWidgets.QApplication.translate("ProfileSettingsForm", "Choose avatar") choose = QtWidgets.QApplication.translate("ProfileSettingsForm", "Choose avatar")
name = QtWidgets.QFileDialog.getOpenFileName(self, choose, None, 'Images (*.png)', name = QtWidgets.QFileDialog.getOpenFileName(self, choose, None, None, 'Images (*.png)',
QtGui.QComboBoxQtWidgets.QFileDialog.DontUseNativeDialog) QtWidgets.QFileDialog.DontUseNativeDialog)
if name[0]: if name[0]:
bitmap = QtGui.QPixmap(name[0]) bitmap = QtGui.QPixmap(name[0])
bitmap.scaled(QtCore.QSize(128, 128), aspectMode=QtCore.Qt.KeepAspectRatio, bitmap.scaled(128, 128, QtCore.Qt.KeepAspectRatio,
mode=QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
byte_array = QtCore.QByteArray() byte_array = QtCore.QByteArray()
buffer = QtCore.QBuffer(byte_array) buffer = QtCore.QBuffer(byte_array)
@ -261,8 +261,9 @@ 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 = QtWidgets.QFileDialog.getExistingDirectory(options=QtWidgets.QFileDialog.DontUseNativeDialog, directory = QtWidgets.QFileDialog.getExistingDirectory(self, '', curr_directory() + '/',
dir=curr_directory()) + '/' QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
if directory != '/': if directory != '/':
reply = QtWidgets.QMessageBox.question(None, reply = QtWidgets.QMessageBox.question(None,
QtWidgets.QApplication.translate("ProfileSettingsForm", QtWidgets.QApplication.translate("ProfileSettingsForm",
@ -493,7 +494,8 @@ class PrivacySettings(CenteredWidget):
settings.save() settings.save()
def new_path(self): def new_path(self):
directory = QtWidgets.QFileDialog.getExistingDirectory(options=QtWidgets.QFileDialog.DontUseNativeDialog) + '/' directory = QtWidgets.QFileDialog.getExistingDirectory(self, '', curr_directory() + '/',
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) + '/'
if directory != '/': if directory != '/':
self.path.setPlainText(directory) self.path.setPlainText(directory)