Move theme selection into options menu

This commit is contained in:
Kiooeht 2011-05-03 21:24:11 -07:00
parent 2fd5b3f759
commit e401667e13
2 changed files with 19 additions and 8 deletions

View file

@ -621,7 +621,7 @@ class PesterOptions(QtGui.QDialog):
self.tabs = QtGui.QButtonGroup(self)
self.connect(self.tabs, QtCore.SIGNAL('buttonClicked(int)'),
self, QtCore.SLOT('changePage(int)'))
tabNames = ["Chum List", "Conversations", "Sound", "Logging", "Idle"]
tabNames = ["Chum List", "Conversations", "Sound", "Logging", "Idle", "Theme"]
for t in tabNames:
button = QtGui.QPushButton(t)
self.tabs.addButton(button)
@ -703,6 +703,13 @@ class PesterOptions(QtGui.QDialog):
layout_5.addWidget(QtGui.QLabel("Minutes before Idle:"))
layout_5.addWidget(self.idleBox)
avail_themes = self.config.availableThemes()
self.themeBox = QtGui.QComboBox(self)
for (i, t) in enumerate(avail_themes):
self.themeBox.addItem(t)
if t == theme.name:
self.themeBox.setCurrentIndex(i)
self.ok = QtGui.QPushButton("OK", self)
self.ok.setDefault(True)
self.connect(self.ok, QtCore.SIGNAL('clicked()'),
@ -767,6 +774,14 @@ class PesterOptions(QtGui.QDialog):
layout_idle.addLayout(layout_5)
self.pages.addWidget(widget)
# Theme
widget = QtGui.QWidget()
layout_theme = QtGui.QVBoxLayout(widget)
layout_theme.setAlignment(QtCore.Qt.AlignTop)
layout_theme.addWidget(QtGui.QLabel("Pick a Theme:"))
layout_theme.addWidget(self.themeBox)
self.pages.addWidget(widget)
layout_0 = QtGui.QVBoxLayout()
layout_1 = QtGui.QHBoxLayout()
layout_1.addLayout(layout_4)

View file

@ -1356,10 +1356,6 @@ class PesterWindow(MovingWindow):
filemenu.addAction(self.reconnectAction)
filemenu.addAction(exitaction)
changetheme = QtGui.QAction(self.theme["main/menus/profile/theme"], self)
self.changetheme = changetheme
self.connect(changetheme, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('pickTheme()'))
changequirks = QtGui.QAction(self.theme["main/menus/profile/quirks"], self)
self.changequirks = changequirks
self.connect(changequirks, QtCore.SIGNAL('triggered()'),
@ -1381,7 +1377,6 @@ class PesterWindow(MovingWindow):
profilemenu = self.menu.addMenu(self.theme["main/menus/profile/_name"])
self.profilemenu = profilemenu
profilemenu.addAction(changetheme)
profilemenu.addAction(changequirks)
profilemenu.addAction(loadslum)
profilemenu.addAction(changecoloraction)
@ -1672,7 +1667,6 @@ class PesterWindow(MovingWindow):
self.idleaction.setText(theme["main/menus/client/idle"])
self.reconnectAction.setText(theme["main/menus/client/reconnect"])
self.filemenu.setTitle(theme["main/menus/client/_name"])
self.changetheme.setText(theme["main/menus/profile/theme"])
self.changequirks.setText(theme["main/menus/profile/quirks"])
self.loadslum.setText(theme["main/menus/profile/block"])
self.changecoloraction.setText(theme["main/menus/profile/color"])
@ -2331,11 +2325,13 @@ class PesterWindow(MovingWindow):
if idlesetting != curidle:
self.config.set('idleTime', idlesetting)
self.idlethreshold = 60*idlesetting
# theme
self.themeSelected()
self.optionmenu = None
@QtCore.pyqtSlot()
def themeSelected(self):
themename = unicode(self.choosetheme.themeBox.currentText())
themename = unicode(self.optionmenu.themeBox.currentText())
if themename != self.theme.name:
try:
self.changeTheme(pesterTheme(themename))