This commit is contained in:
Kovid Goyal 2013-02-14 11:54:45 +05:30
parent 3e1090d48f
commit b5947ad55e

View File

@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en'
import os, weakref, shutil import os, weakref, shutil
from collections import OrderedDict from collections import OrderedDict
from functools import partial
from PyQt4.Qt import (QDialog, QGridLayout, QIcon, QCheckBox, QLabel, QFrame, from PyQt4.Qt import (QDialog, QGridLayout, QIcon, QCheckBox, QLabel, QFrame,
QApplication, QDialogButtonBox, Qt, QSize, QSpacerItem, QApplication, QDialogButtonBox, Qt, QSize, QSpacerItem,
@ -66,6 +67,7 @@ class Polish(QDialog): # {{{
for name, text in self.all_actions.iteritems(): for name, text in self.all_actions.iteritems():
count += 1 count += 1
x = QCheckBox(text, self) x = QCheckBox(text, self)
x.stateChanged.connect(partial(self.option_toggled, name))
l.addWidget(x, count, 0, 1, 1) l.addWidget(x, count, 0, 1, 1)
setattr(self, 'opt_'+name, x) setattr(self, 'opt_'+name, x)
la = QLabel(' <a href="#%s">%s</a>'%(name, _('About'))) la = QLabel(' <a href="#%s">%s</a>'%(name, _('About')))
@ -94,6 +96,10 @@ class Polish(QDialog): # {{{
self.resize(QSize(800, 600)) self.resize(QSize(800, 600))
def option_toggled(self, name, *args):
if getattr(self, 'opt_'+name).isChecked():
self.help_label.setText(self.help_text[name])
def help_link_activated(self, link): def help_link_activated(self, link):
link = unicode(link)[1:] link = unicode(link)[1:]
self.help_label.setText(self.help_text[link]) self.help_label.setText(self.help_text[link])