From 8bc4613407189748989c15cca5d8f3a970caf3ab Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Tue, 13 Jun 2017 22:42:05 +0300 Subject: [PATCH] device selection in settings --- toxygen/calls.py | 2 +- toxygen/mainscreen.py | 1 + toxygen/menu.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/toxygen/calls.py b/toxygen/calls.py index f7fa9cc..5898862 100644 --- a/toxygen/calls.py +++ b/toxygen/calls.py @@ -179,7 +179,7 @@ class AV: self._video_width = 640 # TODO: use settings self._video_height = 480 - self._video = cv2.VideoCapture(0) + self._video = cv2.VideoCapture(settings.Settings.get_instance().video['device']) self._video.set(cv2.CAP_PROP_FPS, 25) self._video.set(cv2.CAP_PROP_FRAME_WIDTH, self._video_width) self._video.set(cv2.CAP_PROP_FRAME_HEIGHT, self._video_height) diff --git a/toxygen/mainscreen.py b/toxygen/mainscreen.py index 1c1e113..84d266c 100644 --- a/toxygen/mainscreen.py +++ b/toxygen/mainscreen.py @@ -131,6 +131,7 @@ class MainWindow(QtWidgets.QMainWindow, Singleton): self.actionAbout_program.setText(QtWidgets.QApplication.translate("MainWindow", "About program")) self.actionSettings.setText(QtWidgets.QApplication.translate("MainWindow", "Settings")) self.audioSettings.setText(QtWidgets.QApplication.translate("MainWindow", "Audio")) + self.videoSettings.setText(QtWidgets.QApplication.translate("MainWindow", "Video")) self.updateSettings.setText(QtWidgets.QApplication.translate("MainWindow", "Updates")) self.contact_name.setPlaceholderText(QtWidgets.QApplication.translate("MainWindow", "Search")) self.sendMessageButton.setToolTip(QtWidgets.QApplication.translate("MainWindow", "Send message")) diff --git a/toxygen/menu.py b/toxygen/menu.py index 3e9696f..77fd1ea 100644 --- a/toxygen/menu.py +++ b/toxygen/menu.py @@ -823,13 +823,13 @@ class VideoSettings(CenteredWidget): self.input.setGeometry(QtCore.QRect(25, 30, 350, 30)) import cv2 self.devices = [] - for i in range(15): + for i in range(10): v = cv2.VideoCapture(i) if v.isOpened(): del v self.devices.append(i) self.input.addItem('Device #' + str(i)) - self.input.setCurrentIndex(self.in_indexes.index(settings.video['device'])) + self.input.setCurrentIndex(self.devices.index(settings.video['device'])) def retranslateUi(self): self.setWindowTitle(QtWidgets.QApplication.translate("videoSettingsForm", "Video settings"))