From adf6cefd1fdeb9d0d4cf4b49306a6f0920ed596a Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Tue, 20 Jun 2017 22:55:48 +0300 Subject: [PATCH] pyqt5 fixes - menu and smileys --- toxygen/mainscreen_widgets.py | 4 ++-- toxygen/menu.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/toxygen/mainscreen_widgets.py b/toxygen/mainscreen_widgets.py index 1de7b54..7632af0 100644 --- a/toxygen/mainscreen_widgets.py +++ b/toxygen/mainscreen_widgets.py @@ -153,7 +153,7 @@ class SmileyWindow(QtWidgets.QWidget): for i in range(self.page_count): # buttons with smileys elem = QtWidgets.QRadioButton(self) elem.setGeometry(QtCore.QRect(i * 20 + 5, 180, 20, 20)) - elem.clicked.connect(lambda i=i: self.checked(i)) + elem.clicked.connect(lambda c, t=i: self.checked(t)) self.radio.append(elem) width = max(self.page_count * 20 + 30, (self.page_size + 5) * 8 // 10) self.setMaximumSize(width, 200) @@ -162,7 +162,7 @@ class SmileyWindow(QtWidgets.QWidget): for i in range(self.page_size): # pages - radio buttons b = QtWidgets.QPushButton(self) b.setGeometry(QtCore.QRect((i // 8) * 20 + 5, (i % 8) * 20, 20, 20)) - b.clicked.connect(lambda i=i: self.clicked(i)) + b.clicked.connect(lambda c, t=i: self.clicked(t)) self.buttons.append(b) self.checked(0) diff --git a/toxygen/menu.py b/toxygen/menu.py index cabd03f..beea221 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -705,7 +705,7 @@ class InterfaceSettings(CenteredWidget): settings['theme'] = str(self.themeSelect.currentText()) try: theme = settings['theme'] - app = QtGui.QApplication.instance() + app = QtWidgets.QApplication.instance() with open(curr_directory() + settings.built_in_themes()[theme]) as fl: style = fl.read() app.setStyleSheet(style) @@ -846,9 +846,11 @@ class VideoSettings(CenteredWidget): self.devices.append(i) self.frame_max_sizes.append((width, height)) self.input.addItem('Device #' + str(i)) - index = self.devices.index(settings.video['device']) - if index + 1: + try: + index = self.devices.index(settings.video['device']) self.input.setCurrentIndex(index) + except: + print('Video devices error!') def retranslateUi(self): self.setWindowTitle(QtWidgets.QApplication.translate("videoSettingsForm", "Video settings"))