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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: preferenceInterface.py
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class preferenceInterface(QWidget):
def __init__(self, parent = None, *args):
QWidget.__init__(self, parent)
mainLayout = QVBoxLayout(None)
mainLayout.setContentsMargins(5,10,0,50)
self.autoTitleBar = QCheckBox(_('Show tag information in title bar'), self)
self.rememberLastShowMode = QCheckBox(_('Remember last display mode settings'), self)
self.enableTransparency = QCheckBox(_('Change transparency by mouse wheel'), self)
self.rememberOpacity = QCheckBox(_('Remember the transparency'), self)
self.rememberOpacity.setEnabled(False)
layout1 = QHBoxLayout(None)
layout1.setContentsMargins(0,0,200,0)
self.minLabel = QLabel(_('Window minimum width:'), self)
self.minWidth = QSpinBox(self)
self.minWidth.setRange(100, QApplication.desktop().width())
layout1.addWidget(self.minLabel)
layout1.addWidget(self.minWidth)
layout2 = QHBoxLayout(None)
layout2.setContentsMargins(0, 0, 200, 0)
self.marginLabel = QLabel(_('Lyrics line margin:'), self)
self.marginValue = QSpinBox(self)
self.marginValue.setRange(11, 50)
layout2.addWidget(self.marginLabel)
layout2.addWidget(self.marginValue)
self.groupHide = groupHide(_('When no lrc, the window:'), self)
mainLayout.addWidget(self.autoTitleBar)
mainLayout.addWidget(self.rememberLastShowMode)
mainLayout.addWidget(self.enableTransparency)
mainLayout.addWidget(self.rememberOpacity)
mainLayout.addLayout(layout1)
mainLayout.addLayout(layout2)
mainLayout.addWidget(self.groupHide)
self.setLayout(mainLayout)
self.connect(self.groupHide.normal, SIGNAL("toggled(bool)"), self.normalChecked)
self.connect(self.enableTransparency, SIGNAL("clicked(bool)"), self.enableWarn)
self.connect(self.enableTransparency, SIGNAL("toggled(bool)"), self.rememberOpacity, SLOT("setEnabled(bool)"))
def enableWarn(self, t):
if(t):
b = QMessageBox(QMessageBox.Information, _('Notice'), _('To avoid any problem, please check if your WM support this function.'))
b.addButton(_('Ok'), QMessageBox.AcceptRole)
b.exec_()
def normalChecked(self, checked):
if(checked):
self.groupHide.includeCheckBox.setEnabled(False)
else:
self.groupHide.includeCheckBox.setEnabled(True)
class groupHide(QGroupBox):
def __init__(self, parent = None, *args):
QGroupBox.__init__(self, parent)
mainLayout = QVBoxLayout(None)
self.normal = QRadioButton(_('No behavior'), self)
self.hide = QRadioButton(_('Auto hide'), self)
self.mini = QRadioButton(_('Auto minimized'), self)
self.includeCheckBox = QCheckBox(self)
self.includeCheckBox.setText(_('The same effect when users cancel lyrics manually'))
mainLayout.addWidget(self.normal)
mainLayout.addWidget(self.hide)
mainLayout.addWidget(self.mini)
mainLayout.addWidget(self.includeCheckBox)
self.setLayout(mainLayout)
|