Move from readyCheckbox to readyPushButton

This commit is contained in:
Et0h 2014-12-07 01:38:05 +00:00
parent d3be1f0917
commit cabadec4e7
4 changed files with 22 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

BIN
resources/tick_checkbox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

View File

@ -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;"

View File

@ -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()