summaryrefslogtreecommitdiff
path: root/kberylsettings
diff options
context:
space:
mode:
authornatural <natural>2006-12-29 22:33:55 +0000
committernatural <natural>2006-12-29 22:33:55 +0000
commit7a42e6fc0a031c905b045564609ca5a4317cfe07 (patch)
tree2f5e671ed637a578e82b8bbd6a49c2b0ea5ecbc1 /kberylsettings
parent0aec17325b9df32be8a46d09efea611eb12fd5ec (diff)
downloadkberylsettings-7a42e6fc0a031c905b045564609ca5a4317cfe07.tar.gz
kberylsettings-7a42e6fc0a031c905b045564609ca5a4317cfe07.tar.bz2
Honor icon size in category view.
Diffstat (limited to 'kberylsettings')
-rw-r--r--kberylsettings/main.py6
-rw-r--r--kberylsettings/pluginframe.py32
2 files changed, 28 insertions, 10 deletions
diff --git a/kberylsettings/main.py b/kberylsettings/main.py
index 632aacb..ee6f16b 100644
--- a/kberylsettings/main.py
+++ b/kberylsettings/main.py
@@ -325,12 +325,12 @@ class KBerylSettings(KMainWindow):
@param value new view mode
@return None
"""
- if value == PluginFrame.searchPageId:
+ if value in PluginFrame.transitoryModes:
return
self.viewMode = value
- isIconMode = value == PluginFrame.iconPageId
+ iconMode = value in PluginFrame.iconSizeModes
for menuid in self.iconSizePopupIds.values():
- self.iconSizePopup.setItemEnabled(menuid, isIconMode)
+ self.iconSizePopup.setItemEnabled(menuid, iconMode)
for mode, menuid in self.modePopupIds.items():
self.modePopup.setItemChecked(menuid, mode==value)
diff --git a/kberylsettings/pluginframe.py b/kberylsettings/pluginframe.py
index f096de3..5ede875 100644
--- a/kberylsettings/pluginframe.py
+++ b/kberylsettings/pluginframe.py
@@ -20,6 +20,8 @@ class PluginFrame(WidgetStack):
"""
iconPageId, treePageId, searchPageId, categoryPageId = pageIds = range(4)
+ iconSizeModes = (iconPageId, categoryPageId)
+ transitoryModes = (searchPageId, )
modePages = (
(iconPageId, '&Icon View'),
(treePageId, '&Tree View'),
@@ -366,6 +368,22 @@ class CategoryView(BasicPluginView):
def __init__(self, parent):
BasicPluginView.__init__(self, parent)
self.setRootIsDecorated(True)
+ root = self.topLevelWidget()
+ self.connect(root, Signals.iconSizeChanged, self.onIconSize)
+
+ def onIconSize(self, size):
+ """ update the icon size
+
+ @param size icon size as integer
+ @return None
+ """
+ self.iconSize = size
+ for item in self:
+ category, plugin = item.value
+ if category:
+ item.setPixmap(0, category.icon(size))
+ elif plugin:
+ item.setPixmap(0, plugin.icon(size, self.loader))
def onItemClick(self, item):
""" emit appropriate signal when plugin or category selected
@@ -375,7 +393,7 @@ class CategoryView(BasicPluginView):
"""
if not item:
return
- plugin, setting = item.value
+ category, plugin = item.value
if plugin:
self.emit(Signals.showGroups, (plugin, ))
@@ -412,7 +430,7 @@ class CategoryView(BasicPluginView):
desc = category.ShortDesc
item = self.findItem(desc, 0)
if not item:
- item = CategoryListViewItem(self, desc, (None, None))
+ item = CategoryListViewItem(self, desc, (category, None))
item.setPixmap(0, category.icon(self.iconSize))
return item
@@ -423,15 +441,15 @@ class CategoryView(BasicPluginView):
@return QListViewItem instance
"""
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)
+ if item.value[1].Name == plugin.Name:
+ item.value = (None, plugin)
return item
if parent is self:
item = self.findItem(plugin.ShortDesc, 0)
if item:
- item.value = (plugin, None)
+ item.value = (None, plugin)
return item
- item = CategoryListViewItem(parent, plugin.ShortDesc, (plugin, None))
+ item = CategoryListViewItem(parent, plugin.ShortDesc, (None, plugin))
item.setPixmap(0, plugin.icon(self.iconSize, self.loader))
return item
@@ -449,7 +467,7 @@ class CategoryListViewItem(ValueListViewItem):
@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]
+ plugin = obj.value[1]
if plugin and plugin.isGeneral:
return val
return cmp(self.text(0), other.text(0))