summaryrefslogtreecommitdiff
path: root/kberylsettings/widget.py
diff options
context:
space:
mode:
authornatural <natural>2006-12-28 13:30:24 +0000
committernatural <natural>2006-12-28 13:30:24 +0000
commit6353813802ba776b05241f07cb8fee9c90310c40 (patch)
treebbdb3641c28de20c9c6164748436d7411be468ff /kberylsettings/widget.py
parentc8ad4394c474f9f6854904f377ab28a38172b867 (diff)
downloadkberylsettings-6353813802ba776b05241f07cb8fee9c90310c40.tar.gz
kberylsettings-6353813802ba776b05241f07cb8fee9c90310c40.tar.bz2
Support for plugin categories.
Fixed scroll view layouts. Many other bug fixes and enhancements.
Diffstat (limited to 'kberylsettings/widget.py')
-rw-r--r--kberylsettings/widget.py46
1 files changed, 45 insertions, 1 deletions
diff --git a/kberylsettings/widget.py b/kberylsettings/widget.py
index 2f9e6ca..d6a60f9 100644
--- a/kberylsettings/widget.py
+++ b/kberylsettings/widget.py
@@ -5,7 +5,7 @@
"""
from qt import Qt, QFrame, QGroupBox, QListViewItem, QListViewItemIterator, \
QSizePolicy, QSplitter, QVBoxLayout, QWidgetStack
-from kdeui import KListView, KPopupMenu, KPushButton
+from kdeui import KListView, KPopupMenu, KPushButton, KStdGuiItem
class Frame(QFrame):
@@ -62,6 +62,9 @@ class ListView(KListView):
"""
def __init__(self, parent):
KListView.__init__(self, parent)
+ self.configList()
+
+ def configList(self):
self.setSorting(-1)
def __iter__(self):
@@ -77,6 +80,9 @@ class ListView(KListView):
class ShortListView(ListView):
+ """ ShortListView -> KListView with height set equal to a number of items
+
+ """
def __init__(self, parent, text, lines):
ListView.__init__(self, parent)
self.addColumn(text)
@@ -89,6 +95,18 @@ class ShortListView(ListView):
self.setMaximumHeight(height)
+class BasicListView(ListView):
+ """ BasicListView -> KListView configured for a single column, no
+ sorting, hidden header and no horizontal scrollbar.
+
+ """
+ def configList(self):
+ self.addColumn('')
+ self.setSorting(-1)
+ self.header().hide()
+ self.setHScrollBarMode(self.AlwaysOff)
+
+
class WidgetStack(QWidgetStack):
""" WidgetStack -> QWidgetStack with QVBoxLayout
@@ -100,6 +118,9 @@ class WidgetStack(QWidgetStack):
class GroupBox(QGroupBox):
+ """ GroupBox -> QGroupBox with nicer parameters
+
+ """
def __init__(self, strips, orient, text, parent, margin=0, spacing=0):
QGroupBox.__init__(self, strips, orient, text, parent)
self.setFlat(True)
@@ -107,5 +128,28 @@ class GroupBox(QGroupBox):
self.setInsideSpacing(spacing)
def addSpaces(self, count, size=0):
+ """ adds a number of spaces to the groupbox
+
+ @param count number of spaces to add
+ @param size size of each space
+ @return None
+ """
for i in range(count):
self.addSpace(size)
+
+
+def guiButton(parent, name, layout=None, enable=True):
+ """ builds a standard push button by name
+
+ @param parent parent of button
+ @param name name of standard item; refer to KStdGuiItem static members
+ @keyparam layout=None if given, new button is added to this layout
+ @keyparam enable=True initial enabled state of button
+ @return KPushButton instance
+ """
+ gui = getattr(KStdGuiItem, name)()
+ button = KPushButton(gui.iconSet(), gui.text(), parent)
+ if layout:
+ layout.addWidget(button)
+ button.setEnabled(enable)
+ return button