device selection in settings
This commit is contained in:
parent
ec6c04a7df
commit
8bc4613407
3 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
Loading…
Reference in a new issue