summaryrefslogtreecommitdiff
path: root/kberylsettings
diff options
context:
space:
mode:
authornatural <natural>2006-12-29 07:37:39 +0000
committernatural <natural>2006-12-29 07:37:39 +0000
commite60bfbb3b724d5999d089ed952ae8a43c244e9ae (patch)
tree08271831068169fe7fd3268c794e167118f1df79 /kberylsettings
parent3f0d8beae4fe502938aa8b15efa875159ebf3280 (diff)
downloadkberylsettings-e60bfbb3b724d5999d089ed952ae8a43c244e9ae.tar.gz
kberylsettings-e60bfbb3b724d5999d089ed952ae8a43c244e9ae.tar.bz2
Added changed signal to bell binding checkbox.
Made category view sort like beryl-settings; now places plugins in the 'Unknown Category' at top of list and not as children of other items. Removed unused signals and slots; sorted Signals and Slots class members.
Diffstat (limited to 'kberylsettings')
-rw-r--r--kberylsettings/lib.py47
-rw-r--r--kberylsettings/pluginframe.py53
-rw-r--r--kberylsettings/settingwidget.py3
3 files changed, 68 insertions, 35 deletions
diff --git a/kberylsettings/lib.py b/kberylsettings/lib.py
index d081719..e8a033b 100644
--- a/kberylsettings/lib.py
+++ b/kberylsettings/lib.py
@@ -32,48 +32,45 @@ class Signals:
""" class with SIGNAL and PYSIGNAL attributes
"""
- viewModeChanged = PYSIGNAL('viewModeChanged')
- iconSizeChanged = PYSIGNAL('iconSizeChanged')
+ actionStatusText = SIGNAL('actionStatusText(const QString &)')
+ activated = SIGNAL('activated()')
+ activatedIndex = SIGNAL('activated(int)')
berylContextChanged = PYSIGNAL('berylContextChanged')
- berylSettingChanged = PYSIGNAL('berylSettingChanged')
berylPluginEnabled = PYSIGNAL('berylPluginEnabled')
- showAbout = PYSIGNAL('showAbout')
- showSettings = PYSIGNAL('showSettings')
- showGroups = PYSIGNAL('showGroups')
- statusMessage = PYSIGNAL('statusMessage')
- someChange = PYSIGNAL('someChange')
+ berylSettingChanged = PYSIGNAL('berylSettingChanged')
+ capturedShortcut = SIGNAL('capturedShortcut (const KShortcut &)')
+ changed = SIGNAL('changed()')
+ clearStatusText = SIGNAL('clearStatusText()')
clicked = SIGNAL('clicked()')
clickedId = SIGNAL('clicked(int)')
- changed = SIGNAL('changed()')
+ colorChanged = SIGNAL('changed(const QColor &)')
+ doubleValueChanged = SIGNAL('valueChanged(double)')
+ iconSizeChanged = PYSIGNAL('iconSizeChanged')
+ intValueChanged = SIGNAL('valueChanged(int)')
itemClicked = SIGNAL('clicked(QListViewItem *)')
itemSelected = SIGNAL('selectionChanged(QListViewItem *)')
okClicked = SIGNAL('okClicked()')
- cancelClicked = SIGNAL('cancelClicked()')
- finished = SIGNAL('finished()')
- activated = SIGNAL('activated()')
- activatedIndex = SIGNAL('activated(int)')
- textChanged = SIGNAL('textChanged(const QString&)')
quitSelected = SIGNAL("quitSelected()")
- actionStatusText = SIGNAL('actionStatusText(const QString &)')
- clearStatusText = SIGNAL('clearStatusText()')
- toggled = SIGNAL('toggled(bool)')
- intValueChanged = SIGNAL('valueChanged(int)')
- doubleValueChanged = SIGNAL('valueChanged(double)')
- colorChanged = SIGNAL('changed(const QColor &)')
- contextMenuRequest = \
- SIGNAL('contextMenuRequested(QListViewItem*,const QPoint&,int)')
searchInput = PYSIGNAL('searchInput')
selectPrevious = PYSIGNAL('selectPrevious')
- capturedShortcut = SIGNAL('capturedShortcut (const KShortcut &)')
+ showAbout = PYSIGNAL('showAbout')
+ showGroups = PYSIGNAL('showGroups')
+ showSettings = PYSIGNAL('showSettings')
+ someChange = PYSIGNAL('someChange')
+ statusMessage = PYSIGNAL('statusMessage')
+ textChanged = SIGNAL('textChanged(const QString&)')
+ toggled = SIGNAL('toggled(bool)')
+ viewModeChanged = PYSIGNAL('viewModeChanged')
+
class Slots:
""" class with SLOT attributes
"""
+ captureShortcut = SLOT('captureShortcut()')
clear = SLOT('clear()')
- close = SLOT('close()')
messageText = SLOT('message( const QString & )')
- captureShortcut = SLOT('captureShortcut()')
+
def iconLoader():
""" returns the global icon loader
diff --git a/kberylsettings/pluginframe.py b/kberylsettings/pluginframe.py
index 3d139be..8d81f9e 100644
--- a/kberylsettings/pluginframe.py
+++ b/kberylsettings/pluginframe.py
@@ -384,15 +384,25 @@ class CategoryView(BasicPluginView):
@return None
"""
+
active = self.context.active
for category in self.context.categories[::-1]:
plugins = [p for p in category.plugins[::-1] if p.Name in active]
- catitem = self.categoryItem(category)
- catitem.setVisible(bool(plugins))
- for plugin in plugins:
- if plugin.Name in active:
- self.pluginItem(plugin, catitem)
-
+ if not category.Name:
+ ## general plugin(s)
+ for plugin in category.plugins:
+ if plugin.Name in active:
+ self.pluginItem(plugin, self)
+ else:
+ catitem = self.categoryItem(category)
+ catitem.setVisible(bool(plugins))
+ for plugin in plugins:
+ if plugin.Name in active:
+ self.pluginItem(plugin, catitem)
+ self.setSorting(1)
+ self.sort()
+ self.setSorting(-1)
+
def categoryItem(self, category):
""" create a list view item for a category
@@ -402,7 +412,7 @@ class CategoryView(BasicPluginView):
desc = category.ShortDesc
item = self.findItem(desc, 0)
if not item:
- item = ValueListViewItem(self, desc, (None, None))
+ item = CategoryListViewItem(self, desc, (None, None))
item.setPixmap(0, category.icon(self.iconSize, self.loader))
return item
@@ -412,10 +422,35 @@ class CategoryView(BasicPluginView):
@param category
@return QListViewItem instance
"""
- for item in [i for i in self if i.parent() == parent]:
+ for item in [i for i in self if i.parent() in (parent, 0)]:
if item.value[0].Name == plugin.Name:
item.value = (plugin, None)
return item
- item = ValueListViewItem(parent, plugin.ShortDesc, (plugin, None))
+ if parent is self:
+ item = self.findItem(plugin.ShortDesc, 0)
+ if item:
+ item.value = (plugin, None)
+ return item
+ item = CategoryListViewItem(parent, plugin.ShortDesc, (plugin, None))
item.setPixmap(0, plugin.icon(self.iconSize, self.loader))
return item
+
+
+class CategoryListViewItem(ValueListViewItem):
+ """ Sortable items for the category list view
+
+ """
+ def compare(self, other, column, ascending):
+ """ compare this item to another
+
+ @param other QListViewItem instance to compare against
+ @param column ignored
+ @param ascending ignored
+ @return -1 if this item is less than other, 1 if greater, 0 if equal
+ """
+ for (obj, val) in ((self, -1), (other, 1)):
+ plugin = obj.value[0]
+ if plugin and plugin.isGeneral:
+ return val
+ return cmp(self.text(0), other.text(0))
+
diff --git a/kberylsettings/settingwidget.py b/kberylsettings/settingwidget.py
index 4f671fd..0bfe81d 100644
--- a/kberylsettings/settingwidget.py
+++ b/kberylsettings/settingwidget.py
@@ -697,6 +697,7 @@ class Binding(SettingWidget):
lineLayout.addWidget(keyButton)
connect(keyLine, Signals.textChanged, self, someChange)
connect(keyButton, Signals.capturedShortcut, self.grabKey)
+ connect(keyButton, Signals.capturedShortcut, self, someChange)
connect(enableCheck, toggled, keyLine.setEnabled)
connect(enableCheck, toggled, keyButton.setEnabled)
elif which == self.idxPointer:
@@ -724,7 +725,6 @@ class Binding(SettingWidget):
init[self.idxKey] = skey
self.initial = tuple(init)
self.reset()
- self.emit(Signals.someChange, ())
def edgeBindingWidget(self, text):
connect = self.connect
@@ -740,6 +740,7 @@ class Binding(SettingWidget):
layout = QHBoxLayout(ctl.bellFrame)
ctl.bellCheck = QCheckBox(i18n('Enable Bell'), ctl.bellFrame)
layout.addWidget(ctl.bellCheck)
+ self.connect(ctl.bellCheck, Signals.toggled, self, Signals.someChange)
return ctl
class control(object):