diff --git a/resources/cross_checkbox.png b/resources/cross_checkbox.png new file mode 100644 index 0000000..785a529 Binary files /dev/null and b/resources/cross_checkbox.png differ diff --git a/resources/tick_checkbox.png b/resources/tick_checkbox.png new file mode 100644 index 0000000..d434c7f Binary files /dev/null and b/resources/tick_checkbox.png differ diff --git a/syncplay/constants.py b/syncplay/constants.py index 7f389f3..5866fe0 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -118,6 +118,7 @@ STYLE_SUBCHECKBOX = "QCheckBox, QLabel {{ margin-left: 6px; padding-left: 21px; STYLE_SUBLABEL = "QCheckBox, QLabel {{ margin-left: 6px; padding-left: 16px; background:url('{}') left no-repeat }}" #Graphic path STYLE_ERRORLABEL = "QLabel { color : black; border-style: outset; border-width: 2px; border-radius: 7px; border-color: red; padding: 2px; background: #FFAAAA; }" STYLE_SUCCESSLABEL = "QLabel { color : black; border-style: outset; border-width: 2px; border-radius: 7px; border-color: green; padding: 2px; background: #AAFFAA; }" +STYLE_READY_PUSHBUTTON = "QPushButton { text-align: left; color : black; border-style: outset; border-width: 2px; border-radius: 7px; padding: 2px; } QPushButton::Checked {border-color: green; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #00CC00, stop: 1 #00FF00); } QPushButton::!Checked { border-color: maroon; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF0000, stop: 1 #BB0000); } QPushButton::hover:Checked {border-color: green; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #00FF00, stop: 1 #00DD00); } QPushButton::hover:!Checked { border-color: maroon; background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #BB0000, stop: 1 #FF0000); } QPushButton::pressed { border-style: inset; }" STYLE_NOTIFICATIONBOX = "Username { color: #367AA9; font-weight:bold; }" STYLE_USERNAME = "color: #367AA9; font-weight:bold;" STYLE_ERRORNOTIFICATION = "color: red;" diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index c60ea11..e218f36 100644 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -201,9 +201,10 @@ class MainWindow(QtGui.QMainWindow): pass def updateReadyState(self, newState): - oldState = self.readyCheckbox.isChecked() + oldState = self.readyPushButton.isChecked() if newState != oldState and newState != None: - self.readyCheckbox.setChecked(newState) + self.readyPushButton.setChecked(newState) + self.updateReadyIcon() def roomClicked(self, item): while item.parent().row() != -1: @@ -458,13 +459,15 @@ class MainWindow(QtGui.QMainWindow): window.listLayout.addWidget(window.listlabel) window.listLayout.addWidget(window.listTreeView) - window.readyCheckbox = QtGui.QCheckBox() + window.readyPushButton = QtGui.QPushButton() readyFont = QtGui.QFont() readyFont.setWeight(QtGui.QFont.Bold) - window.readyCheckbox.setText("I'm ready to watch!") - window.readyCheckbox.setFont(readyFont) - window.readyCheckbox.toggled.connect(self.changeReadyState) - window.listLayout.addWidget(window.readyCheckbox, Qt.AlignRight) + window.readyPushButton.setCheckable(True) + window.readyPushButton.setAutoExclusive(True) + window.readyPushButton.toggled.connect(self.changeReadyState) + window.readyPushButton.setFont(readyFont) + window.readyPushButton.setStyleSheet(constants.STYLE_READY_PUSHBUTTON) + window.listLayout.addWidget(window.readyPushButton, Qt.AlignRight) window.contactLabel = QtGui.QLabel() window.contactLabel.setWordWrap(True) @@ -627,7 +630,17 @@ class MainWindow(QtGui.QMainWindow): self.listbox.moveCursor(QtGui.QTextCursor.End) def changeReadyState(self): - self._syncplayClient.changeReadyState(self.readyCheckbox.isChecked()) + self.updateReadyIcon() + self._syncplayClient.changeReadyState(self.readyPushButton.isChecked()) + + def updateReadyIcon(self): + ready = self.readyPushButton.isChecked() + if ready: + self.readyPushButton.setIcon(QtGui.QIcon(self.resourcespath + 'tick_checkbox.png')) + self.readyPushButton.setText("I'm ready to watch! (Click to toggle)") + else: + self.readyPushButton.setIcon(QtGui.QIcon(self.resourcespath + 'cross_checkbox.png')) + self.readyPushButton.setText("I'm not ready to watch! (Click to toggle)") def dragEnterEvent(self, event): data = event.mimeData()