Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

OneColor In pasive Mode Works! some gui fixes

  • Loading branch information...
commit 17afe7fafc500a312fc50f54cc03b520163959a4 1 parent 2036478
@grizz-pl authored
Showing with 58 additions and 9 deletions.
  1. +7 −4 src/mirlight.ui
  2. +5 −4 src/mirlight_form.py
  3. +46 −1 src/mirlight_gui.py
View
11 src/mirlight.ui
@@ -4178,7 +4178,7 @@
<x>0</x>
<y>0</y>
<width>471</width>
- <height>174</height>
+ <height>161</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
@@ -4372,9 +4372,9 @@
<property name="geometry">
<rect>
<x>0</x>
- <y>171</y>
+ <y>160</y>
<width>471</width>
- <height>132</height>
+ <height>121</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@@ -4718,7 +4718,10 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
- <string>Passive</string>
+ <string>Start Passive Mode</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
</property>
</widget>
</item>
View
9 src/mirlight_form.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'mirlight.ui'
#
-# Created: Sun Mar 6 18:03:52 2011
+# Created: Sun Mar 6 19:43:29 2011
# by: PyQt4 UI code generator 4.8.2
#
# WARNING! All changes made in this file will be lost!
@@ -1443,7 +1443,7 @@ def setupUi(self, MainWindow):
self.tab_5 = QtGui.QWidget()
self.tab_5.setObjectName(_fromUtf8("tab_5"))
self.layoutWidget_2 = QtGui.QWidget(self.tab_5)
- self.layoutWidget_2.setGeometry(QtCore.QRect(0, 0, 471, 174))
+ self.layoutWidget_2.setGeometry(QtCore.QRect(0, 0, 471, 161))
self.layoutWidget_2.setObjectName(_fromUtf8("layoutWidget_2"))
self.gridLayout_4 = QtGui.QGridLayout(self.layoutWidget_2)
self.gridLayout_4.setMargin(0)
@@ -1543,7 +1543,7 @@ def setupUi(self, MainWindow):
self.PMpushButton_9.setObjectName(_fromUtf8("PMpushButton_9"))
self.gridLayout_4.addWidget(self.PMpushButton_9, 1, 1, 1, 1)
self.gridLayoutWidget = QtGui.QWidget(self.tab_5)
- self.gridLayoutWidget.setGeometry(QtCore.QRect(0, 171, 471, 132))
+ self.gridLayoutWidget.setGeometry(QtCore.QRect(0, 160, 471, 121))
self.gridLayoutWidget.setObjectName(_fromUtf8("gridLayoutWidget"))
self.gridLayout_8 = QtGui.QGridLayout(self.gridLayoutWidget)
self.gridLayout_8.setMargin(0)
@@ -1695,6 +1695,7 @@ def setupUi(self, MainWindow):
sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth())
self.pushButton_2.setSizePolicy(sizePolicy)
self.pushButton_2.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
+ self.pushButton_2.setCheckable(True)
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.gridLayout_5.addWidget(self.pushButton_2, 1, 1, 1, 1)
self.InfoLabel = QtGui.QLabel(self.layoutWidget3)
@@ -1810,7 +1811,7 @@ def retranslateUi(self, MainWindow):
self.pushButton.setStatusTip(QtGui.QApplication.translate("MainWindow", "Start/Stop", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Start!", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setStatusTip(QtGui.QApplication.translate("MainWindow", "Start/Stop", None, QtGui.QApplication.UnicodeUTF8))
- self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "Passive", None, QtGui.QApplication.UnicodeUTF8))
+ self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "Start Passive Mode", None, QtGui.QApplication.UnicodeUTF8))
import mirlight_rc
import mirlight_rc
View
47 src/mirlight_gui.py
@@ -18,7 +18,7 @@
__author__ = "Witold Firlej (http://grizz.pl)"
__project__ = "mirlight"
-__version__ = "d.2011.03.06.1"
+__version__ = "d.2011.03.06.2"
__license__ = "GPL"
__copyright__ = "Witold Firlej"
@@ -52,12 +52,14 @@ def __init__(self, parent=None):
self.connect(self._Timer, QtCore.SIGNAL('timeout()'), self.timer)
self.connect(self._watchTimer, QtCore.SIGNAL('timeout()'), self.watch)
QtCore.QObject.connect(self.ui.pushButton,QtCore.SIGNAL("clicked()"), self.startStop)
+ QtCore.QObject.connect(self.ui.pushButton_2,QtCore.SIGNAL("clicked()"), self.PMStartStop)
QtCore.QObject.connect(self.ui.testPortPushButton,QtCore.SIGNAL("clicked()"), self.testPort)
QtCore.QObject.connect(self.ui.showFieldsPushButton,QtCore.SIGNAL("clicked()"), self.showFields)
QtCore.QObject.connect(self.ui.buttonBox,QtCore.SIGNAL("accepted()"), self.saveConfiguration)
QtCore.QObject.connect(self.ui.buttonBox,QtCore.SIGNAL("rejected()"), self.loadConfiguration)
QtCore.QObject.connect(self.ui.AutoArrangeCheckBox,QtCore.SIGNAL("clicked()"), self.changePresetsComboBoxEnabled)
QtCore.QObject.connect(self.ui.LicensePushButton,QtCore.SIGNAL("clicked()"), self.showLicenseBox)
+ QtCore.QObject.connect(self.ui.PMpushButton_9,QtCore.SIGNAL("clicked()"), self.selectColor)
self.setWindowTitle(__project__ + " ver. " + __version__ )
@@ -65,6 +67,27 @@ def __init__(self, parent=None):
self.fieldsWidgets = []
self.blackout = [0,0,0,0,0,0,0,0]
+ self.passiveColors = [255,255,255,255,255,255,255,255]
+
+ self.ui.OneColorCheckBox.setChecked(True) ###TODO temporary
+ self.ui.OneColorCheckBox.setDisabled(True) ###TODO temporary
+
+ def PMStartStop(self):
+ """
+ start/stop passive mode
+ """
+ if self.ui.pushButton_2.isChecked():
+ button = self.ui.PMpushButton_9 #TODO all buttons
+ palette = QtGui.QPalette(button.palette())
+ color = QtGui.QColor.rgb(palette.color(QtGui.QPalette.Button))
+ self.sendColors([color]*8)
+ self.ui.pushButton_2.setText("Stop Passive Mode")
+ self.ui.pushButton.setDisabled(True)
+ else:
+ self.sendColors(self.blackout)
+ self.ui.pushButton_2.setText("Start Passive Mode")
+ self.ui.pushButton.setEnabled(True)
+
def startStop(self):
@@ -75,6 +98,7 @@ def startStop(self):
if not self._Timer.isActive(): # if timer doesn't work
self.loadConfiguration()
self.ui.pushButton.setText("Stop!")
+ self.ui.pushButton_2.setDisabled(True)
self.ui.tab_2.setEnabled(0) # no messing with settings during work!
try:
if ser.isOpen(): # close and open port - hardware likes it
@@ -87,6 +111,7 @@ def startStop(self):
else:
self._Timer.stop()
self.ui.pushButton.setText("Start!")
+ self.ui.pushButton_2.setEnabled(True)
self.ui.tab_2.setEnabled(1)
self.sendColors(self.blackout)
try:
@@ -217,6 +242,15 @@ def updateLabel (self, field, x, y, w, h, color = 0): # default color is black
palette.setColor(QtGui.QPalette.Window, QtGui.QColor(color))
label.setPalette(palette)
+ def updatePushButton (self, color = 0): # default color is black
+ """
+ set pushButton background color
+ """
+ button = self.ui.PMpushButton_9 #TODO all buttons
+ palette = QtGui.QPalette(button.palette())
+ palette.setColor(QtGui.QPalette.Button, QtGui.QColor(color))
+ button.setPalette(palette)
+ button.setText("aaaaa")
def showFields(self):
"""
@@ -576,6 +610,17 @@ def showLicenseBox(self):
message.exec_()
+ def selectColor(self):
+ """
+ select color from dialog set is as button background, and return it as rgb
+ @return color
+ """
+ color = QtGui.QColorDialog.getColor()
+ self.updatePushButton(color)
+ if self.ui.pushButton_2.isChecked(): ###TODO temporary fix... rewrite it
+ self.ui.pushButton_2.setChecked(True)
+ self.PMStartStop()
+ return QtGui.QColor.rgb(color)
class FieldDialog(QtGui.QFrame):
Please sign in to comment.
Something went wrong with that request. Please try again.