pyqt5 fixes - menu and smileys

This commit is contained in:
ingvar1995 2017-06-20 22:55:48 +03:00
parent 142255ccc8
commit adf6cefd1f
2 changed files with 7 additions and 5 deletions

View File

@ -153,7 +153,7 @@ class SmileyWindow(QtWidgets.QWidget):
for i in range(self.page_count): # buttons with smileys for i in range(self.page_count): # buttons with smileys
elem = QtWidgets.QRadioButton(self) elem = QtWidgets.QRadioButton(self)
elem.setGeometry(QtCore.QRect(i * 20 + 5, 180, 20, 20)) 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) self.radio.append(elem)
width = max(self.page_count * 20 + 30, (self.page_size + 5) * 8 // 10) width = max(self.page_count * 20 + 30, (self.page_size + 5) * 8 // 10)
self.setMaximumSize(width, 200) self.setMaximumSize(width, 200)
@ -162,7 +162,7 @@ class SmileyWindow(QtWidgets.QWidget):
for i in range(self.page_size): # pages - radio buttons for i in range(self.page_size): # pages - radio buttons
b = QtWidgets.QPushButton(self) b = QtWidgets.QPushButton(self)
b.setGeometry(QtCore.QRect((i // 8) * 20 + 5, (i % 8) * 20, 20, 20)) 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.buttons.append(b)
self.checked(0) self.checked(0)

View File

@ -705,7 +705,7 @@ class InterfaceSettings(CenteredWidget):
settings['theme'] = str(self.themeSelect.currentText()) settings['theme'] = str(self.themeSelect.currentText())
try: try:
theme = settings['theme'] theme = settings['theme']
app = QtGui.QApplication.instance() app = QtWidgets.QApplication.instance()
with open(curr_directory() + settings.built_in_themes()[theme]) as fl: with open(curr_directory() + settings.built_in_themes()[theme]) as fl:
style = fl.read() style = fl.read()
app.setStyleSheet(style) app.setStyleSheet(style)
@ -846,9 +846,11 @@ class VideoSettings(CenteredWidget):
self.devices.append(i) self.devices.append(i)
self.frame_max_sizes.append((width, height)) self.frame_max_sizes.append((width, height))
self.input.addItem('Device #' + str(i)) self.input.addItem('Device #' + str(i))
index = self.devices.index(settings.video['device']) try:
if index + 1: index = self.devices.index(settings.video['device'])
self.input.setCurrentIndex(index) self.input.setCurrentIndex(index)
except:
print('Video devices error!')
def retranslateUi(self): def retranslateUi(self):
self.setWindowTitle(QtWidgets.QApplication.translate("videoSettingsForm", "Video settings")) self.setWindowTitle(QtWidgets.QApplication.translate("videoSettingsForm", "Video settings"))