summaryrefslogtreecommitdiff
path: root/kberylsettings/widget.py
diff options
context:
space:
mode:
authornatural <natural>2006-12-17 10:06:18 +0000
committernatural <natural>2006-12-17 10:06:18 +0000
commit99b44818d60794aae11dca5f67722ab32c98f137 (patch)
tree8e54863077d35d0cbb88925c3fd012827d328a80 /kberylsettings/widget.py
parentfcfa23f8e1b16bc68329c9e9aa3cb31d906ee572 (diff)
downloadkberylsettings-99b44818d60794aae11dca5f67722ab32c98f137.tar.gz
kberylsettings-99b44818d60794aae11dca5f67722ab32c98f137.tar.bz2
Implemented search -- search for plugin settings by keyword.
Refactored views and content frames. Many docstrings.
Diffstat (limited to 'kberylsettings/widget.py')
-rw-r--r--kberylsettings/widget.py55
1 files changed, 53 insertions, 2 deletions
diff --git a/kberylsettings/widget.py b/kberylsettings/widget.py
index 5b2dc29..246c29d 100644
--- a/kberylsettings/widget.py
+++ b/kberylsettings/widget.py
@@ -1,10 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from qt import Qt, QFrame, QSizePolicy, QSplitter, QVBoxLayout
-from kdeui import KPopupMenu, KPushButton
+""" kberylsettings.widget -> various common widgets.
+
+"""
+from qt import Qt, QFrame, QListViewItem, QListViewItemIterator, QSizePolicy, \
+ QSplitter, QVBoxLayout, QWidgetStack
+from kdeui import KListView, KPopupMenu, KPushButton
class Frame(QFrame):
+ """ Frame -> QFrame with QVBoxLayout
+
+ """
def __init__(self, parent, margin=0, spacing=-1):
QFrame.__init__(self, parent)
layout = QVBoxLayout(self, margin, spacing)
@@ -13,21 +20,65 @@ class Frame(QFrame):
class Popup(KPopupMenu):
+ """ Popup -> KPopupMenu always set to checkable
+
+ """
def __init__(self, parent):
KPopupMenu.__init__(self, parent)
self.setCheckable(True)
class Splitter(QSplitter):
+ """ Splitter -> QSplitter always set to opaque resize
+
+ """
def __init__(self, parent, style):
QSplitter.__init__(self, style, parent)
self.setOpaqueResize(True)
class SmallPushButton(KPushButton):
+ """ SmallPushButton -> KPushButton with fixed sizes
+
+ """
def __init__(self, icon, text, parent):
KPushButton.__init__(self, icon, text, parent)
self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
+class ValueListViewItem(QListViewItem):
+ """ ValueListViewItem -> QListViewItem with extra 'value' attribute
+
+ """
+ def __init__(self, parent, text, value=None):
+ QListViewItem.__init__(self, parent, text)
+ self.value = value
+
+
+class ListView(KListView):
+ """ ListView -> KListView that is directly iterable
+ """
+ def __init__(self, parent):
+ KListView.__init__(self, parent)
+
+ def __iter__(self):
+ """ iterate over QListView items
+
+ """
+ it = QListViewItemIterator(self)
+ item = it.current()
+ while item:
+ yield item
+ it += 1
+ item = it.current()
+
+
+class WidgetStack(QWidgetStack):
+ """ WidgetStack -> QWidgetStack with QVBoxLayout
+
+ """
+ def __init__(self, parent):
+ QWidgetStack.__init__(self, parent)
+ layout = QVBoxLayout(self)
+ layout.setAutoAdd(True)