~lrcshow-x/lrcshow-x/2-series

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Xu Jia (Sanfanling)   E-mail:xujia19@gmail.com
# Lisence: GPL-2.0
 
from PyQt4.QtCore import *
from PyQt4.QtGui import *

class selectItemNet(QDialog):
	
	def __init__(self, parent = None, *args):
        	QDialog.__init__(self, parent)
		self.counter = 16
		self.setWindowTitle(_('Please choose lrc, after %s secs auto choose for you') %str(self.counter))
		MainWindowLayout = QVBoxLayout(self)
		layout1 = QVBoxLayout(None)
		self.listBox = QListWidget(self)
		
		buttonBox = QDialogButtonBox(self)
		okButton = QPushButton(QIcon('./icon/ok.png'), _('Ok'))
		cancelButton = QPushButton(QIcon('./icon/cancel.png'), _('Cancel'))
        	buttonBox.addButton(okButton, QDialogButtonBox.AcceptRole)
        	buttonBox.addButton(cancelButton, QDialogButtonBox.RejectRole)
		
		layout1.addWidget(self.listBox)
		layout1.addWidget(buttonBox)
		MainWindowLayout.addLayout(layout1)

		self.myTimer = QTimer()
		self.myTimer.setSingleShot(False)
		self.myTimer.start(1000)

		self.connect(buttonBox, SIGNAL('accepted()'), self, SLOT("accept()"))
		self.connect(buttonBox, SIGNAL('rejected()'), self, SLOT("reject()"))
		self.connect(self.myTimer, SIGNAL("timeout()"), self.autoCount)
		self.connect(self.listBox, SIGNAL("itemDoubleClicked(QListWidgetItem *)"), self, SLOT("accept()"))
	
	def autoCount(self):
		if(self.counter == 0):
			self.accept()
		else:
			self.counter -= 1
			self.setWindowTitle(_('Please choose lrc, after %s secs auto choose for you') %str(self.counter))