summaryrefslogtreecommitdiffstats
path: root/examples/pytde-sampler
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pytde-sampler')
-rw-r--r--examples/pytde-sampler/HOWTO.samples60
-rw-r--r--examples/pytde-sampler/TODO12
-rw-r--r--examples/pytde-sampler/__init__.py1
-rw-r--r--examples/pytde-sampler/about.py57
-rw-r--r--examples/pytde-sampler/aboutkde.pngbin0 -> 36991 bytes
-rw-r--r--examples/pytde-sampler/basic_widgets/__init__.py17
-rw-r--r--examples/pytde-sampler/basic_widgets/datepicker.py42
-rw-r--r--examples/pytde-sampler/basic_widgets/historycombo.py53
-rw-r--r--examples/pytde-sampler/contributors.txt4
-rw-r--r--examples/pytde-sampler/dialogs/__init__.py18
-rw-r--r--examples/pytde-sampler/dialogs/about/__init__.py16
-rw-r--r--examples/pytde-sampler/dialogs/about/aboutapp.py29
-rw-r--r--examples/pytde-sampler/dialogs/about/aboutkde.py28
-rw-r--r--examples/pytde-sampler/dialogs/bugreport.py34
-rw-r--r--examples/pytde-sampler/dialogs/color.py42
-rw-r--r--examples/pytde-sampler/dialogs/config.py59
-rw-r--r--examples/pytde-sampler/dialogs/edfind.py52
-rw-r--r--examples/pytde-sampler/dialogs/edreplace.py52
-rw-r--r--examples/pytde-sampler/dialogs/font.py53
-rw-r--r--examples/pytde-sampler/dialogs/input.py87
-rw-r--r--examples/pytde-sampler/dialogs/key.py29
-rw-r--r--examples/pytde-sampler/dialogs/msgbox.py141
-rw-r--r--examples/pytde-sampler/dialogs/passwd.py34
-rw-r--r--examples/pytde-sampler/dialogs/progress.py39
-rw-r--r--examples/pytde-sampler/dialogs/tip.py31
-rw-r--r--examples/pytde-sampler/dialogs/tips24
-rw-r--r--examples/pytde-sampler/gen_todo.py19
-rw-r--r--examples/pytde-sampler/icon_handling/__init__.py18
-rw-r--r--examples/pytde-sampler/icon_handling/misc.py31
-rw-r--r--examples/pytde-sampler/icon_handling/sizes.py30
-rw-r--r--examples/pytde-sampler/lib.py105
-rw-r--r--examples/pytde-sampler/misc/__init__.py16
-rw-r--r--examples/pytde-sampler/misc/gradientselect.py51
-rw-r--r--examples/pytde-sampler/misc/passivepop.py43
-rw-r--r--examples/pytde-sampler/misc/window_info.py35
-rw-r--r--examples/pytde-sampler/qt_widgets/CONTRIB537
-rw-r--r--examples/pytde-sampler/qt_widgets/__init__.py17
-rw-r--r--examples/pytde-sampler/qt_widgets/table.py42
-rwxr-xr-xexamples/pytde-sampler/runner.py58
-rwxr-xr-xexamples/pytde-sampler/sampler.py423
-rw-r--r--examples/pytde-sampler/sampler.rc13
-rw-r--r--examples/pytde-sampler/wizards/__init__.py2
-rw-r--r--examples/pytde-sampler/wizards/wiz.py2
-rw-r--r--examples/pytde-sampler/xwin/__init__.py18
44 files changed, 2474 insertions, 0 deletions
diff --git a/examples/pytde-sampler/HOWTO.samples b/examples/pytde-sampler/HOWTO.samples
new file mode 100644
index 0000000..2b20c52
--- /dev/null
+++ b/examples/pytde-sampler/HOWTO.samples
@@ -0,0 +1,60 @@
+How to Write Samples for the PyKDE Sampler
+==========================================
+
+
+Create or locate a directory within the sampler application root directory.
+
+Add a module.
+
+In side the module, add the following:
+
+- iconName - string (optional)
+ default: 'filenew'
+ example: 'colorize'
+
+ When supplied, this should be the short name of a KDE icon, such as
+ 'stop', 'editclear', etc. If available, This icon will be used as
+ the list item's icon in the sampler. Not all icons are available in
+ all themes, so try to use the icons that are available in the
+ default KDE installation.
+
+
+- labelText - string (optional)
+ default: module name
+ example: 'KMessageBox'
+
+ When supplied, this value is used as the list item text for the
+ sample. If it's not supplied, the application will use the name of
+ the module instead.
+
+
+- docParts - two-tuple (optional)
+ default: None
+ example: ('tdeui', 'KAboutDialog')
+
+ If specified, this sequence should contain two items, first item
+ name of pytde module, second item name of class within the module.
+ These two values are used to form the URL to the documentation for
+ the sample.
+
+
+- one of buildWidget, buildDialog, buildApp, MainFrame - callable (retquired)
+ default: None
+ example: MainFrame(TQFrame): ...
+
+ The sample module must contain a callable with one of these names.
+ The callable must accept a single positional parameter, the parent
+ widget.
+
+ In most cases, it is sufficient to define a subclass of TQFrame named
+ 'MainFrame'. To construct a more complex sample, define a function
+ with one of the other names.
+
+ The callable should return (or instatiate) a widget for display in
+ the main sampler widget. The created frame is responsible for
+ displaying it's help text and for any providing any widgets
+ necessary to
+
+
+
+
diff --git a/examples/pytde-sampler/TODO b/examples/pytde-sampler/TODO
new file mode 100644
index 0000000..730cc02
--- /dev/null
+++ b/examples/pytde-sampler/TODO
@@ -0,0 +1,12 @@
+Sampler App
+===========
+
+- Turn off word wrap in the source viewer
+- Add application icon
+- Enable hyperlink signal and slot in doc viewer
+
+
+Samples
+=======
+
+- More samples
diff --git a/examples/pytde-sampler/__init__.py b/examples/pytde-sampler/__init__.py
new file mode 100644
index 0000000..4265cc3
--- /dev/null
+++ b/examples/pytde-sampler/__init__.py
@@ -0,0 +1 @@
+#!/usr/bin/env python
diff --git a/examples/pytde-sampler/about.py b/examples/pytde-sampler/about.py
new file mode 100644
index 0000000..108194b
--- /dev/null
+++ b/examples/pytde-sampler/about.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+""" About the PyKDE Sampler
+
+Defines the 'about' function to create a KAboutData instance for the
+sampler application.
+"""
+from os.path import dirname, join
+from tdecore import KAboutData
+
+
+appName = 'pytdesampler'
+progName = 'PyKDE Sampler'
+authorName = 'Troy Melhase'
+authorEmail = bugsEmailAddress = '[email protected]'
+version = '0.1'
+shortDescription = 'The PyKDE Sampler'
+licenseType = KAboutData.License_GPL_V2
+copyrightStatement = '(c) 2006, %s' % (authorName, )
+homePageAddress = 'http://www.riverbankcomputing.co.uk/pytde/'
+aboutText = ("The application sampler for PyKDE.")
+contributors = [] # module-level global for keeping the strings around; intentional
+
+
+def about():
+ """ creates KAboutData instance for the app
+
+ """
+ about = KAboutData(
+ appName,
+ progName,
+ version,
+ shortDescription,
+ licenseType,
+ copyrightStatement,
+ aboutText,
+ homePageAddress,
+ bugsEmailAddress)
+ about.addAuthor(authorName, '', authorEmail)
+
+ try:
+ contrib = open(join(dirname(__file__), 'contributors.txt'))
+ contrib = [line.strip() for line in contrib]
+ contrib = [line for line in contrib if not line.startswith('#')]
+ for line in contrib:
+ try:
+ name, task, addr = [s.strip() for s in line.split(',')]
+ contributors.append((name, task, addr))
+ except:
+ pass
+ except:
+ pass
+
+ contributors.sort(lambda a, b:cmp(a[0], b[0]))
+ for name, task, addr in contributors:
+ about.addCredit(name, task, addr)
+
+ return about
diff --git a/examples/pytde-sampler/aboutkde.png b/examples/pytde-sampler/aboutkde.png
new file mode 100644
index 0000000..2aa6d73
--- /dev/null
+++ b/examples/pytde-sampler/aboutkde.png
Binary files differ
diff --git a/examples/pytde-sampler/basic_widgets/__init__.py b/examples/pytde-sampler/basic_widgets/__init__.py
new file mode 100644
index 0000000..312f629
--- /dev/null
+++ b/examples/pytde-sampler/basic_widgets/__init__.py
@@ -0,0 +1,17 @@
+labelText = 'Widgets'
+iconName = 'about_kde'
+
+helpText = """KDE provides a large set of basic widgets for application use.
+Select the children of this item to see for yourself."""
+
+from qt import TQFrame, TQVBoxLayout
+from tdeui import KTextEdit
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ self.text = KTextEdit(helpText, '', self)
+ layout.addWidget(self.text, 1)
+ layout.addStretch(1)
diff --git a/examples/pytde-sampler/basic_widgets/datepicker.py b/examples/pytde-sampler/basic_widgets/datepicker.py
new file mode 100644
index 0000000..b0f74c6
--- /dev/null
+++ b/examples/pytde-sampler/basic_widgets/datepicker.py
@@ -0,0 +1,42 @@
+from qt import TQFrame, TQStringList, TQVBoxLayout, SIGNAL, TQLabel, TQSizePolicy, TQt
+from qttable import TQTable
+from tdeui import KTextEdit, KDatePicker, KDateWidget
+
+
+labelText = 'KDatePicker'
+iconName = 'date'
+helpText = """A date selection widget.
+
+Provides a widget for calendar date input.
+
+Different from the previous versions, it now emits two types of
+signals, either dateSelected() or dateEntered() (see documentation for
+both signals).
+
+A line edit has been added in the newer versions to allow the user to
+select a date directly by entering numbers like 19990101 or 990101.
+"""
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+ self.dateDisplay = KDateWidget(self)
+
+ self.dateDisplay.setSizePolicy(TQSizePolicy(TQSizePolicy.Maximum,
+ TQSizePolicy.Maximum))
+
+ self.datePicker = KDatePicker(self)
+
+ layout = TQVBoxLayout(self)
+ layout.addWidget(self.help, 1)
+ layout.addWidget(self.datePicker, 0, TQt.AlignHCenter)
+ layout.addStretch(1)
+
+ self.other = TQLabel('Selected Date:', self)
+ layout.addWidget(self.other, 0)
+ layout.addWidget(self.dateDisplay, 2)
+
+ self.connect(self.datePicker, SIGNAL('dateChanged(TQDate)'),
+ self.dateDisplay.setDate)
+
diff --git a/examples/pytde-sampler/basic_widgets/historycombo.py b/examples/pytde-sampler/basic_widgets/historycombo.py
new file mode 100644
index 0000000..3b0797c
--- /dev/null
+++ b/examples/pytde-sampler/basic_widgets/historycombo.py
@@ -0,0 +1,53 @@
+from qt import TQt, TQFrame, TQHBoxLayout, TQVBoxLayout, TQStringList, TQLabel, \
+ SIGNAL, SLOT
+from tdeui import KHistoryCombo, KTextEdit
+
+
+iconName = 'history'
+labelText = 'KHistoryCombo'
+docParts = ('tdeui', 'KHistoryCombo')
+helpText = ('An example of the KHistoryCombo widget.'
+ '\n\n'
+ 'Completion is enabled via the setHistoryItems call; when the second '
+ 'parameter is True, matching items from the list appear as you type.'
+ '\n\n'
+ 'The activated signal is connected to the addToHistory '
+ 'slot to automatically add new items.')
+
+
+historyText = 'a tquick brown fox jumps over the lazy dog'
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+ self.historyCombo = KHistoryCombo(self)
+
+ self.historySelectionLabel = TQLabel('Selected value: ', self)
+ self.historySelection = TQLabel('(none)', self)
+
+ items = TQStringList()
+ for item in historyText.split():
+ items.append(item)
+ self.historyCombo.setHistoryItems(items, True)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help, 3)
+ layout.addStretch(1)
+ selectionLayout = TQHBoxLayout(layout, 4)
+ selectionLayout.addWidget(self.historySelectionLabel, 1)
+ selectionLayout.addWidget(self.historySelection, 10, TQt.AlignLeft)
+ layout.addWidget(self.historyCombo, 0)
+ layout.addStretch(10)
+
+ self.connect(self.historyCombo, SIGNAL('activated(const TQString& )'),
+ self.historyCombo, SLOT('addToHistory(const TQString&)'))
+ self.connect(self.historyCombo, SIGNAL('cleared()'),
+ self.historyCleared)
+ self.connect(self.historyCombo, SIGNAL('activated(const TQString &)'),
+ self.historySelection.setText)
+
+ def historyCleared(self):
+ print 'History combo cleared.'
+
diff --git a/examples/pytde-sampler/contributors.txt b/examples/pytde-sampler/contributors.txt
new file mode 100644
index 0000000..5063545
--- /dev/null
+++ b/examples/pytde-sampler/contributors.txt
@@ -0,0 +1,4 @@
+# author, contributions, email
+Phil Thompson, For PyTQt and SIP, [email protected]
+Jim Bublitz, For PyKDE, [email protected]
+
diff --git a/examples/pytde-sampler/dialogs/__init__.py b/examples/pytde-sampler/dialogs/__init__.py
new file mode 100644
index 0000000..07a731c
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/__init__.py
@@ -0,0 +1,18 @@
+labelText = 'Dialog Boxes'
+iconName = 'launch'
+
+
+helpText = ("KDE provides a convenient set of dialog boxes for application use. "
+ "Select the children of this item to see for yourself.")
+
+
+from qt import TQFrame, TQVBoxLayout
+from tdeui import KTextEdit
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ self.text = KTextEdit(helpText, '', self)
+ layout.addWidget(self.text, 1)
diff --git a/examples/pytde-sampler/dialogs/about/__init__.py b/examples/pytde-sampler/dialogs/about/__init__.py
new file mode 100644
index 0000000..ea1ad17
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/about/__init__.py
@@ -0,0 +1,16 @@
+labelText = 'About Dialogs'
+iconName = 'info'
+
+helpText = ("KDE has multiple dialog types to display information about your "
+"applicaiton and environment. They provide a tremendous amount of functionality "
+"and consistency. They're easy to use, and they're good for the environment!")
+
+from qt import TQFrame, TQVBoxLayout
+from tdeui import KTextEdit
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ self.text = KTextEdit(helpText, '', self)
+ layout.addWidget(self.text, 1)
diff --git a/examples/pytde-sampler/dialogs/about/aboutapp.py b/examples/pytde-sampler/dialogs/about/aboutapp.py
new file mode 100644
index 0000000..820d50f
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/about/aboutapp.py
@@ -0,0 +1,29 @@
+iconName = 'about_kde'
+labelText = 'KAboutApplication'
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KAboutApplication, KPushButton, KTextEdit
+
+
+helpText = ("Typically available via the applications 'Help' menu, this "
+ "dialog presents the user with the applications About widget.")
+
+docParts = ('tdeui', 'KAboutDialog')
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('About Application'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showAboutDialog)
+
+ def showAboutDialog(self):
+ dlg = KAboutApplication(self)
+ dlg.show()
diff --git a/examples/pytde-sampler/dialogs/about/aboutkde.py b/examples/pytde-sampler/dialogs/about/aboutkde.py
new file mode 100644
index 0000000..dc7390c
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/about/aboutkde.py
@@ -0,0 +1,28 @@
+iconName = 'about_kde'
+labelText = 'KAboutKDE'
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KAboutKDE, KPushButton, KTextEdit
+
+
+helpText = ("Typically available via the applications 'Help' menu, this "
+ "dialog presents the user with the standard KDE About dialog.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('About KDE'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showAboutDialog)
+
+ def showAboutDialog(self):
+ dlg = KAboutKDE(self)
+ dlg.show()
diff --git a/examples/pytde-sampler/dialogs/bugreport.py b/examples/pytde-sampler/dialogs/bugreport.py
new file mode 100644
index 0000000..76fe0ae
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/bugreport.py
@@ -0,0 +1,34 @@
+iconName = 'core'
+labelText = 'KBugReport'
+
+##~ if we wanted to, we could define the name of a KDE class used for lookup of
+##~ the documentation url. The 'labelText' string above already
+##~ specifies what we want.
+##~ docItemName = 'KBugReport'
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KAboutDialog, KPushButton, KBugReport, KTextEdit
+
+
+helpText = ("KDE provides a way to report bugs from applications. This dialog"
+ "is typically available from the application 'Help' menu.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Bug Report Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showBugDialog)
+
+
+ def showBugDialog(self):
+ dlg = KBugReport(self)
+ dlg.exec_loop()
diff --git a/examples/pytde-sampler/dialogs/color.py b/examples/pytde-sampler/dialogs/color.py
new file mode 100644
index 0000000..738c000
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/color.py
@@ -0,0 +1,42 @@
+iconName = 'colorize'
+labelText = 'KColorDialog'
+
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KPushButton, KColorDialog, KColorPatch, KTextEdit
+
+
+helpText = ("KDE provides a nifty common color selection dialog."
+ "The color selection in the dialog is tracked via a SIGNAL "
+ "connected to the KColorPatch area below.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Color Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ self.patch = KColorPatch(self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addWidget(self.patch, 10)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showColorDialog)
+
+ def showColorDialog(self):
+ dlg = KColorDialog(self)
+
+ ## this connection is made so that there's a default color
+ self.connect(dlg, SIGNAL('colorSelected(const TQColor &)'),
+ self.patch.setPaletteBackgroundColor)
+ dlg.setColor(self.patch.paletteBackgroundColor())
+
+ ## this connection is the one that changes the patch color to match
+ ## the color selected in the dialog
+ self.connect(dlg, SIGNAL('colorSelected(const TQColor &)'),
+ self.patch.setColor)
+ dlg.exec_loop()
diff --git a/examples/pytde-sampler/dialogs/config.py b/examples/pytde-sampler/dialogs/config.py
new file mode 100644
index 0000000..8700cff
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/config.py
@@ -0,0 +1,59 @@
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, TQTimer, SIGNAL, TQString
+from tdecore import i18n, KConfigSkeleton
+from tdeui import KPushButton, KConfigDialog, KTextEdit
+
+iconName = 'configure'
+labelText = 'KConfigDialog'
+docParts = ('tdeui', 'KConfigDialog')
+helpText = ("")
+
+
+class SampleSettings(KConfigSkeleton):
+ def __init__(self):
+ KConfigSkeleton.__init__(self)
+ self.anyString = TQString()
+
+ self.setCurrentGroup("Strings")
+ self.addItemString("Test", self.anyString, "Default Value")
+
+ self.setCurrentGroup("Booleans")
+ self.addItemBool("Any Bool", False)
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Config Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showConfigDialog)
+
+
+ def showConfigDialog(self):
+ config = SampleSettings()
+ dlg = KConfigDialog(self, 'Sampler Config', config)
+ self.strings = StringsSettings(self)
+ self.bools = BoolSettings(self)
+ dlg.addPage(self.strings, 'Strings', 'Strings')
+ dlg.addPage(self.bools, 'Bools', 'Bools')
+ dlg.exec_loop()
+
+
+class StringsSettings(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.text = KTextEdit('A String', '', self)
+
+
+class BoolSettings(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.text = KTextEdit('A Bool', '', self)
+
diff --git a/examples/pytde-sampler/dialogs/edfind.py b/examples/pytde-sampler/dialogs/edfind.py
new file mode 100644
index 0000000..0dabb2f
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/edfind.py
@@ -0,0 +1,52 @@
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, TQTimer, SIGNAL, TQFont, TQString
+from tdecore import i18n
+from tdeui import KPushButton, KEdFind, KTextEdit
+
+iconName = 'find'
+labelText = 'KEdFind'
+docParts = ('tdeui', 'KEdFind')
+helpText = ("An example of the KEdFind dialog.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Edit Find Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showEdFind)
+
+
+ def showEdFind(self):
+ dlg = self.dlg = KEdFind(self)
+ self.connect(dlg, SIGNAL('done()'),
+ self.doneClicked)
+ self.connect(dlg, SIGNAL('search()'),
+ self.searchClicked)
+ dlg.exec_loop()
+
+
+ def doneClicked(self):
+ print 'done searching'
+
+ def searchClicked(self):
+ print 'searching: ', self.dlg.getText(),
+ if self.dlg.get_direction():
+ print '(backwards) ',
+ else:
+ print '(forwards) ',
+ if self.dlg.case_sensitive():
+ print '(case-sensitive)'
+ else:
+ print '(case-insensitive)'
+
+
+
+
diff --git a/examples/pytde-sampler/dialogs/edreplace.py b/examples/pytde-sampler/dialogs/edreplace.py
new file mode 100644
index 0000000..2cbc03e
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/edreplace.py
@@ -0,0 +1,52 @@
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, TQTimer, SIGNAL, TQFont, TQString
+from tdecore import i18n
+from tdeui import KPushButton, KEdReplace, KTextEdit
+
+iconName = 'findreplace'
+labelText = 'KEdReplace'
+docParts = ('tdeui', 'KEdReplace')
+helpText = ("An example of the KEdReplace dialog.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Edit Find Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showEdReplace)
+
+
+ def showEdReplace(self):
+ dlg = self.dlg = KEdReplace(self)
+ self.connect(dlg, SIGNAL('done()'),
+ self.doneClicked)
+ self.connect(dlg, SIGNAL('replace()'),
+ self.replaceClicked)
+ dlg.exec_loop()
+
+
+ def doneClicked(self):
+ print 'done replacing'
+
+ def replaceClicked(self):
+ print 'replacing: ', self.dlg.getText()
+ return
+ if self.dlg.get_direction():
+ print '(backwards) ',
+ else:
+ print '(forwards) ',
+ if self.dlg.case_sensitive():
+ print '(case-sensitive)'
+ else:
+ print '(case-insensitive)'
+
+
+
+
diff --git a/examples/pytde-sampler/dialogs/font.py b/examples/pytde-sampler/dialogs/font.py
new file mode 100644
index 0000000..194524c
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/font.py
@@ -0,0 +1,53 @@
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, TQTimer, SIGNAL, TQFont, TQString
+from tdecore import i18n
+from tdeui import KPushButton, KFontDialog, KTextEdit
+
+iconName = 'fonts'
+labelText = 'KFontDialog'
+docParts = ('tdeui', 'KFontDialog')
+helpText = ("KDE provides a font dialog box for users to select (can you "
+ "guess??) fonts. The button below displays a font dialog box. "
+ "The font of this widget (the text widget you're reading) is used "
+ "as the default. If the dialog is accepted, the font of this "
+ "widget is change to match the selection.")
+
+
+fontText = """Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam
+ante. Nam in mauris. Vestibulum ante velit, condimentum vel, congue
+sit amet, lobortis a, dui. Fusce auctor, quam non pretium nonummy, leo
+ante imperdiet libero, id lobortis erat erat tquis eros. Pellentesque
+habitant morbi tristique senectus et netus et malesuada fames ac
+turpis egestas. Cras ut metus. Vivamus suscipit, sapien id tempor
+elementum, nunc quam malesuada dolor, sit amet luctus sapien odio vel
+ligula. Integer scelerisque, risus a interdum vestibulum, felis ipsum
+pharetra eros, nec nonummy libero justo tquis risus. Vestibulum
+tincidunt, augue vitae suscipit congue, sem dui adipiscing nulla, ut
+nonummy arcu quam ac sem. Nulla in metus. Phasellus neque.
+"""
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Font Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ self.example = KTextEdit(fontText, '', self)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addWidget(self.example, 10)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showFontDialog)
+
+
+ def showFontDialog(self):
+ font = TQFont(self.example.font())
+ string = TQString()
+ accepted, other = KFontDialog.getFontAndText(font, string, False, self)
+ if accepted:
+ self.example.setFont(font)
+ self.example.setText(string)
diff --git a/examples/pytde-sampler/dialogs/input.py b/examples/pytde-sampler/dialogs/input.py
new file mode 100644
index 0000000..8d9312f
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/input.py
@@ -0,0 +1,87 @@
+iconName = 'editclear'
+labelText = 'KInputDialog'
+
+from qt import TQFrame, TQGridLayout, TQLabel, TQStringList, SIGNAL
+from tdecore import i18n
+from tdeui import KPushButton, KInputDialog, KTextEdit
+
+
+helpText = ("KInputDialog allows the programmer to display a simple dialog to "
+ "request a bit of text, an integer value, a double value, or a "
+ "list item from the user.")
+
+
+class MainFrame(TQFrame):
+ items = ['Apples', 'Bananas', 'Mangos', 'Oranges', 'Pears', ]
+
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+
+ layout = TQGridLayout(self, 5, 2, 4) # five rows, two cols, four px spacing
+ layout.setRowStretch(0, 10)
+ layout.setColStretch(1, 10)
+ layout.addMultiCellWidget(self.help, 0, 1, 0, 1)
+
+ button = KPushButton(i18n('Get Text'), self)
+ self.connect(button, SIGNAL('clicked()'), self.getText)
+ self.getTextLabel = TQLabel('text value', self)
+ layout.addWidget(button, 2, 0)
+ layout.addWidget(self.getTextLabel, 2, 1)
+ layout.setRowStretch(2, 0)
+
+ button = KPushButton(i18n('Get Integer'), self)
+ self.connect(button, SIGNAL('clicked()'), self.getInt)
+ self.getIntLabel = TQLabel('0', self)
+ layout.addWidget(self.getIntLabel, 3, 1)
+ layout.addWidget(button, 3, 0)
+ layout.setRowStretch(3, 0)
+
+ button = KPushButton(i18n('Get Double'), self)
+ self.connect(button, SIGNAL('clicked()'), self.getDouble)
+ self.getDoubleLabel = TQLabel('0.0', self)
+ layout.addWidget(self.getDoubleLabel, 4, 1)
+ layout.addWidget(button, 4, 0)
+ layout.setRowStretch(4, 0)
+
+ button = KPushButton(i18n('Get Item'), self)
+ self.connect(button, SIGNAL('clicked()'), self.getItem)
+ self.getItemLabel = TQLabel(self.items[0], self)
+ layout.addWidget(button, 5, 0)
+ layout.addWidget(self.getItemLabel, 5, 1)
+ layout.setRowStretch(5, 0)
+
+ def getText(self):
+ title = 'KInputDialog.getText Dialog'
+ label = 'Enter some text:'
+ default = self.getTextLabel.text()
+ value, accepted = KInputDialog.getText(title, label, default)
+ if accepted:
+ self.getTextLabel.setText(value)
+
+ def getInt(self):
+ title = 'KInputDialog.getInteger Dialog'
+ label = 'Enter an integer:'
+ default = int('%s' % self.getIntLabel.text())
+ value, accepted = KInputDialog.getInteger(title, label, default)
+ if accepted:
+ self.getIntLabel.setText('%s' % value)
+
+ def getDouble(self):
+ title = 'KInputDialog.getDouble Dialog'
+ label = 'Enter a double:'
+ default = float('%s' % self.getDoubleLabel.text())
+ value, accepted = KInputDialog.getDouble(title, label, default, -10.0, 10.0)
+ if accepted:
+ self.getDoubleLabel.setText('%s' % value)
+
+ def getItem(self):
+ title = 'KInputDialog.getItem Dialog'
+ label = 'Select an item:'
+ current = self.items.index('%s' % self.getItemLabel.text())
+ selections = TQStringList()
+ for item in self.items:
+ selections.append(item)
+ value, accepted = KInputDialog.getItem(title, label, selections, current)
+ if accepted:
+ self.getItemLabel.setText('%s' % value)
diff --git a/examples/pytde-sampler/dialogs/key.py b/examples/pytde-sampler/dialogs/key.py
new file mode 100644
index 0000000..8c88537
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/key.py
@@ -0,0 +1,29 @@
+iconName = 'configure_shortcuts'
+labelText = 'KKeyDialog'
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KPushButton, KKeyDialog, KTextEdit
+
+
+helpText = ("Configuring keystroke shortcuts is simple with KActions and the "
+ "KKeyDialog type. This sample starts the KKeyDialog for the "
+ "sampler application.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Key Configuration Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showKeysDialog)
+
+ def showKeysDialog(self):
+ top = self.topLevelWidget()
+ KKeyDialog.configure(top.actionCollection(), self)
diff --git a/examples/pytde-sampler/dialogs/msgbox.py b/examples/pytde-sampler/dialogs/msgbox.py
new file mode 100644
index 0000000..b22c03f
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/msgbox.py
@@ -0,0 +1,141 @@
+iconName = 'stop'
+labelText = 'KMessageBox'
+
+from random import random
+from traceback import print_exc
+from StringIO import StringIO
+
+from qt import TQFrame, TQGridLayout, TQLabel, TQStringList, SIGNAL
+from tdecore import i18n
+from tdeui import KGuiItem, KPushButton, KMessageBox, KTextEdit
+
+
+helpText = ("The KMessageBox Python class wraps the static methods of its C++ "
+ "counterpart. Some of these methods are used below. Refer to the "
+ "docs for KMessageBox for a full list.")
+
+
+class MainFrame(TQFrame):
+ msg = 'Do you like food?'
+ caption = 'Simple Question'
+ err = 'Some kind of error happened, but it could be worse!'
+ info = 'Always wash your hands after eating.'
+ items = ['Apples', 'Bananas', 'Cantaloupe', 'Mangos', 'Oranges', 'Pears', ]
+
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ items = TQStringList()
+ for item in self.items:
+ items.append(item)
+ self.items = items
+
+ responses = 'Ok Cancel Yes No Continue'.split()
+ responses = [(getattr(KMessageBox, res), res) for res in responses]
+ self.responses = dict(responses)
+
+ self.help = KTextEdit(helpText, '', self)
+
+ layout = TQGridLayout(self, 5, 2, 4)
+ layout.setRowStretch(0, 10)
+ layout.setColStretch(1, 10)
+ layout.addMultiCellWidget(self.help, 0, 1, 0, 1)
+
+ button = KPushButton(i18n('Question Yes-No'), self)
+ self.connect(button, SIGNAL('clicked()'), self.questionYesNo)
+ layout.addWidget(button, 2, 0)
+ layout.setRowStretch(2, 0)
+
+ button = KPushButton(i18n('Warning Yes-No-Cancel'), self)
+ self.connect(button, SIGNAL('clicked()'), self.warningYesNoCancel)
+ layout.addWidget(button, 3, 0)
+ layout.setRowStretch(3, 0)
+
+ button = KPushButton(i18n('Warning Continue-Cancel-List'), self)
+ self.connect(button, SIGNAL('clicked()'), self.warningContinueCancelList)
+ layout.addWidget(button, 4, 0)
+ layout.setRowStretch(4, 0)
+
+ button = KPushButton(i18n('Error'), self)
+ self.connect(button, SIGNAL('clicked()'), self.error)
+ layout.addWidget(button, 5, 0)
+ layout.setRowStretch(5, 0)
+
+ button = KPushButton(i18n('Detailed Error'), self)
+ self.connect(button, SIGNAL('clicked()'), self.detailedError)
+ layout.addWidget(button, 6, 0)
+ layout.setRowStretch(6, 0)
+
+ button = KPushButton(i18n('Sorry'), self)
+ self.connect(button, SIGNAL('clicked()'), self.sorry)
+ layout.addWidget(button, 7, 0)
+ layout.setRowStretch(7, 0)
+
+ button = KPushButton(i18n('Detailed Sorry'), self)
+ self.connect(button, SIGNAL('clicked()'), self.detailedSorry)
+ layout.addWidget(button, 8, 0)
+ layout.setRowStretch(8, 0)
+
+ button = KPushButton(i18n('Information'), self)
+ self.connect(button, SIGNAL('clicked()'), self.information)
+ layout.addWidget(button, 9, 0)
+ layout.setRowStretch(9, 0)
+
+ button = KPushButton(i18n('Information List'), self)
+ self.connect(button, SIGNAL('clicked()'), self.informationList)
+ layout.addWidget(button, 10, 0)
+ layout.setRowStretch(10, 0)
+
+ def questionYesNo(self):
+ dlg = KMessageBox.questionYesNo(self, self.msg, self.caption)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def warningYesNoCancel(self):
+ dlg = KMessageBox.warningYesNoCancel(self, self.msg, self.caption)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def warningContinueCancelList(self):
+ uiitem = KGuiItem('Time to Eat', 'favorites')
+ ctor = KMessageBox.warningContinueCancelList
+ dlgid = '%s' % random()
+ args = self, self.msg, self.items, self.caption, uiitem, dlgid
+ dlg = ctor(*args)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def error(self):
+ dlg = KMessageBox.error(self, self.err)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def detailedError(self):
+ try:
+ x = self.thisAttributeDoesNotExist
+ except (AttributeError, ), ex:
+ handle = StringIO()
+ print_exc(0, handle)
+ details = handle.getvalue()
+ dlg = KMessageBox.detailedError(self, self.err, details)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def sorry(self):
+ dlg = KMessageBox.sorry(self, self.err)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def detailedSorry(self):
+ try:
+ x = self.thisAttributeDoesNotExist
+ except (AttributeError, ), ex:
+ handle = StringIO()
+ print_exc(0, handle)
+ details = handle.getvalue()
+ dlg = KMessageBox.detailedSorry(self, self.err, details)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def information(self):
+ dlgid = '%s' % random()
+ dlg = KMessageBox.information(self, self.info, '', dlgid)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
+
+ def informationList(self):
+ dlgid = '%s' % random()
+ ctor = KMessageBox.informationList
+ dlg = ctor(self, self.info, self.items, '', dlgid)
+ print 'You pressed "%s"' % (self.responses.get(dlg, dlg), )
diff --git a/examples/pytde-sampler/dialogs/passwd.py b/examples/pytde-sampler/dialogs/passwd.py
new file mode 100644
index 0000000..3081c3d
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/passwd.py
@@ -0,0 +1,34 @@
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KPushButton, KPasswordDialog, KTextEdit
+
+iconName = 'password'
+labelText = 'KPasswordDialog'
+docParts = ('tdeui', 'KPasswordDialog')
+helpText = ("KDE provides two variations on the password dialog. The simple "
+ "one shown here prompts for a password. The other type allows the "
+ "user to enter a new password, and provides a second field to "
+ "confirm the first entry.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Password Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showPasswordDialog)
+
+
+ def showPasswordDialog(self):
+ old = 'foo bar baz'
+ prompt = "Enter your super-secret password (enter anything, it's just an example):"
+ result = KPasswordDialog.getPassword(old, prompt)
+ if result == KPasswordDialog.Accepted:
+ pass
+
diff --git a/examples/pytde-sampler/dialogs/progress.py b/examples/pytde-sampler/dialogs/progress.py
new file mode 100644
index 0000000..948ad78
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/progress.py
@@ -0,0 +1,39 @@
+iconName = 'go'
+labelText = 'KProgressDialog'
+
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, TQTimer, SIGNAL
+from tdecore import i18n
+from tdeui import KPushButton, KProgressDialog, KTextEdit
+
+
+helpText = """KDE provides a ready-built dialog to display a bit of text and a
+progress bar."""
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Progress Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showProgressDialog)
+
+ def showProgressDialog(self):
+ self.dlg = dlg = KProgressDialog(self, None, 'Sample Progress Dialog',
+ helpText)
+ dlg.progressBar().setTotalSteps(20)
+ dlg.progressBar().setFormat('% complete: %p - value: %v - maximum: %m')
+ timer = TQTimer(self)
+ self.connect(timer, SIGNAL('timeout()'), self.updateProgress)
+ timer.start(250, False)
+ dlg.exec_loop()
+ timer.stop()
+
+ def updateProgress(self):
+ self.dlg.progressBar().advance(1)
diff --git a/examples/pytde-sampler/dialogs/tip.py b/examples/pytde-sampler/dialogs/tip.py
new file mode 100644
index 0000000..b86d3fd
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/tip.py
@@ -0,0 +1,31 @@
+iconName = 'idea'
+labelText = 'KTipDialog'
+
+import os
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KPushButton, KTipDatabase, KTipDialog, KTextEdit
+
+
+helpText = ("The KDE standard Tip-of-the-Day dialog.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Tip-of-the-Day Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showTipDialog)
+
+ def showTipDialog(self):
+ filename = os.path.abspath(os.path.join(os.path.dirname(__file__), 'tips'))
+ tips = KTipDatabase(filename)
+ dlg = KTipDialog(tips, self)
+ dlg.exec_loop()
diff --git a/examples/pytde-sampler/dialogs/tips b/examples/pytde-sampler/dialogs/tips
new file mode 100644
index 0000000..9f24457
--- /dev/null
+++ b/examples/pytde-sampler/dialogs/tips
@@ -0,0 +1,24 @@
+
+<tip category="PyKDE Sampler|General">
+<html>
+<p>Don't tug on Superman's cape.</p>
+</html>
+</tip>
+
+<tip category="PyKDE Sampler|General">
+<html>
+<p>Don't spit into the wind.</p>
+</html>
+</tip>
+
+<tip category="PyKDE Sampler|General">
+<html>
+<p>Don't pull the mask off the Lone Ranger.</p>
+</html>
+</tip>
+
+<tip category="PyKDE Sampler|General">
+<html>
+<p>And don't mess around with <em>Jim</em>!</p>
+</html>
+</tip>
diff --git a/examples/pytde-sampler/gen_todo.py b/examples/pytde-sampler/gen_todo.py
new file mode 100644
index 0000000..6abd5be
--- /dev/null
+++ b/examples/pytde-sampler/gen_todo.py
@@ -0,0 +1,19 @@
+mods = ['dcop', 'tdecore', 'tdefx', 'tdeprint', 'tdesu', 'tdeui', 'kfile', 'khtml', 'kio', 'kmdi', 'kparts', 'kspell', ]
+all = []
+
+
+print 'Module,Item,Path,Contributor'
+for mod in mods:
+ module = __import__(mod)
+ items = dir(module)
+ items.sort()
+ items = [item for item in items if not item.startswith('_')]
+ items = [item for item in items if not item in all]
+
+ for item in items:
+ all.append(item)
+ print '%s,%s,,,' % (mod, item, )
+
+
+
+
diff --git a/examples/pytde-sampler/icon_handling/__init__.py b/examples/pytde-sampler/icon_handling/__init__.py
new file mode 100644
index 0000000..2a525ac
--- /dev/null
+++ b/examples/pytde-sampler/icon_handling/__init__.py
@@ -0,0 +1,18 @@
+labelText = 'Icons'
+iconName = 'icons'
+
+
+helpText = ("KDE icons are nice. "
+ "Select the children of this item to see for yourself.")
+
+
+from qt import TQFrame, TQVBoxLayout
+from tdeui import KTextEdit
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ self.text = KTextEdit(helpText, '', self)
+ layout.addWidget(self.text, 1)
diff --git a/examples/pytde-sampler/icon_handling/misc.py b/examples/pytde-sampler/icon_handling/misc.py
new file mode 100644
index 0000000..cab3571
--- /dev/null
+++ b/examples/pytde-sampler/icon_handling/misc.py
@@ -0,0 +1,31 @@
+
+iconName = 'icons'
+labelText = 'Misc.'
+
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL, TQPoint
+from tdecore import i18n
+from tdeui import KAboutDialog, KPushButton, KBugReport, KTextEdit
+from tdeui import KRootPermsIcon, KWritePermsIcon
+
+
+helpText = ("Samples for the KRootPermsIcon and KWritePermsIcon classes."
+ "These icons don't do anything.")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.setAutoAdd(True)
+
+ self.help = KTextEdit(helpText, '', self)
+ self.root = KRootPermsIcon(None)
+ self.root.reparent(self, 0, TQPoint(0,0), True)
+
+ import os
+ fn = os.path.abspath('.')
+ print fn
+ self.write = KWritePermsIcon(fn)
+ self.write.reparent(self, 0, TQPoint(0,0), True)
diff --git a/examples/pytde-sampler/icon_handling/sizes.py b/examples/pytde-sampler/icon_handling/sizes.py
new file mode 100644
index 0000000..af7226d
--- /dev/null
+++ b/examples/pytde-sampler/icon_handling/sizes.py
@@ -0,0 +1,30 @@
+
+iconName = 'icons'
+labelText = 'Icon Sizing'
+
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdecore import i18n
+from tdeui import KAboutDialog, KPushButton, KBugReport, KTextEdit
+
+
+helpText = ("")
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Bug Report Dialog'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showBugDialog)
+
+
+ def showBugDialog(self):
+ dlg = KBugReport(self)
+ dlg.exec_loop()
diff --git a/examples/pytde-sampler/lib.py b/examples/pytde-sampler/lib.py
new file mode 100644
index 0000000..875ae1a
--- /dev/null
+++ b/examples/pytde-sampler/lib.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+"""
+
+"""
+import os
+import sys
+
+from os import listdir, walk
+from os.path import dirname, isdir, abspath, split, join, exists
+
+
+samplerpath = dirname(abspath(__file__))
+packagepath, packagename = split(samplerpath)
+
+samplerpath += os.path.sep
+packagepath += os.path.sep
+
+
+def namedimport(name):
+ """ import a module given a dotted package name
+
+ Taken directly from the Python library docs for __import __
+ """
+ mod = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ return mod
+
+
+def ispackage(path):
+ return isdir(path) and exists(join(path, '__init__.py'))
+
+
+def ismodule(path):
+ head, tail = os.path.split(path)
+ if tail in ('__init__.py', '__init__.pyc', '__init__.pyo'):
+ return False
+ head, tail = os.path.splitext(path)
+ return tail in ('.py', ) # don't use these, which filters them out dupes ( '.pyc', '.pyo')
+
+
+def listimports(top):
+ top = abspath(top)
+ yield top
+ for path in listdir(top):
+ path = join(top, path)
+ if ispackage(path):
+ yield path
+ for subpath in listimports(path):
+ yield subpath
+ elif ismodule(path):
+ yield path
+
+
+def listmodules():
+ if samplerpath not in sys.path:
+ sys.path.append(samplerpath)
+
+ dirs = [join(samplerpath, d) for d in listdir(samplerpath)]
+ dirs = [d for d in dirs if exists(join(d, '__init__.py'))]
+
+ modules = []
+ for dirname in dirs:
+ dirpath = join(samplerpath, dirname)
+ for path in listimports(dirpath):
+ path = path.replace('.py', '')
+ path = path.replace(samplerpath, '').replace(os.path.sep, '.')
+ try:
+ module = namedimport(path)
+ except (ValueError, ImportError, ), exc:
+ print 'Exception %s importing %s' % (exc, path, )
+ else:
+ modules.append((path, module))
+ modules.sort()
+ return [(path, SamplerModule(module)) for path, module in modules]
+
+
+class SamplerModule(object):
+ defaultIcon = 'filenew'
+
+
+ def __init__(self, module):
+ self.module = module
+
+
+ def name(self):
+ return self.module.__name__.split('.')[-1]
+
+
+ def labelText(self):
+ return getattr(self.module, 'labelText', self.name())
+
+
+ def icon(self):
+ return getattr(self.module, 'iconName', self.defaultIcon)
+
+
+ def builder(self):
+ for name in ('buildWidget', 'buildDialog', 'buildApp', 'MainFrame'):
+ try:
+ return getattr(self.module, name)
+ except (AttributeError, ):
+ pass
+ raise AttributeError('No builder found')
diff --git a/examples/pytde-sampler/misc/__init__.py b/examples/pytde-sampler/misc/__init__.py
new file mode 100644
index 0000000..f9b66ae
--- /dev/null
+++ b/examples/pytde-sampler/misc/__init__.py
@@ -0,0 +1,16 @@
+labelText = 'Misc'
+iconName = 'misc'
+
+
+helpText = ("")
+
+from qt import TQFrame, TQVBoxLayout
+from tdeui import KTextEdit
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ self.text = KTextEdit(helpText, '', self)
+ layout.addWidget(self.text, 1)
diff --git a/examples/pytde-sampler/misc/gradientselect.py b/examples/pytde-sampler/misc/gradientselect.py
new file mode 100644
index 0000000..0adb2ea
--- /dev/null
+++ b/examples/pytde-sampler/misc/gradientselect.py
@@ -0,0 +1,51 @@
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL, TQColor, TQSizePolicy, TQLabel
+from tdecore import i18n
+from tdeui import KPushButton, KGradientSelector, KTextEdit, KDualColorButton, KColorPatch
+
+iconName = 'colors'
+labelText = 'KGradientSelector'
+docParts = ('tdeui', 'KGradientSelector')
+helpText = ("An example of the KGradientSelector widget."
+ "\n"
+ "Change the start and finish colors with the dual color button."
+ )
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+ self.selector = KGradientSelector(self)
+ self.dualLabel = TQLabel('Select Colors:', self)
+
+ self.startColor = TQColor('red')
+ self.finishColor = TQColor('blue')
+
+ self.selector.setColors(self.startColor, self.finishColor)
+ self.selector.setText('Start', 'Finish')
+
+ self.dualButton = KDualColorButton(self.startColor, self.finishColor, self)
+ self.dualButton.setSizePolicy(TQSizePolicy(TQSizePolicy.Maximum,
+ TQSizePolicy.Maximum))
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help, 20)
+
+ buttonLayout = TQHBoxLayout(layout, 4)
+ buttonLayout.addWidget(self.dualLabel, 0)
+ buttonLayout.addWidget(self.dualButton, 1)
+
+ layout.addWidget(self.selector, 10)
+
+
+ self.connect(self.dualButton, SIGNAL('fgChanged(const TQColor &)'),
+ self.selector.setFirstColor)
+ self.connect(self.dualButton, SIGNAL('bgChanged(const TQColor &)'),
+ self.selector.setSecondColor)
+ self.connect(self.selector, SIGNAL('valueChanged(int)'),
+ self.updateValue)
+
+
+ def updateValue(self, value):
+ ## this should be extended to update a color swatch
+ pass
diff --git a/examples/pytde-sampler/misc/passivepop.py b/examples/pytde-sampler/misc/passivepop.py
new file mode 100644
index 0000000..8a2b2e8
--- /dev/null
+++ b/examples/pytde-sampler/misc/passivepop.py
@@ -0,0 +1,43 @@
+from qt import TQt, TQFrame, TQHBoxLayout, TQVBoxLayout, TQLabel, SIGNAL
+from tdeui import KPassivePopup, KTextEdit, KPushButton
+from tdecore import KGlobal, KIcon
+
+iconName = 'popup'
+labelText = 'KPassivePopup'
+docParts = ('tdeui', 'KPassivePopup')
+helpText = ('Examples of the KPassivePopup widget.')
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+ self.button = KPushButton('Show Passive Popups', self)
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help, 10)
+ buttonLayout = TQHBoxLayout(layout, 4)
+ buttonLayout.addWidget(self.button, 1)
+ buttonLayout.addStretch(10)
+ layout.addStretch(10)
+
+
+ self.connect(self.button, SIGNAL('clicked()'), self.showPopups)
+
+
+ def showPopups(self):
+ ## no support for all of the 3.5 calls
+ pop = KPassivePopup.message('Hello, <i>KPassivePopup</i>', self)
+ pop.setTimeout(3000)
+ pop.show()
+
+
+ pos = pop.pos()
+ pos.setY(pos.y() + pop.height() + 10)
+
+ ico = KGlobal.instance().iconLoader().loadIcon('help', KIcon.NoGroup,
+ KIcon.SizeSmall)
+ pop = KPassivePopup.message('<b>Hello</b>', 'With Icons', ico, self)
+ pop.setTimeout(3000)
+ pop.show()
+ pop.move(pos)
diff --git a/examples/pytde-sampler/misc/window_info.py b/examples/pytde-sampler/misc/window_info.py
new file mode 100644
index 0000000..daef2e0
--- /dev/null
+++ b/examples/pytde-sampler/misc/window_info.py
@@ -0,0 +1,35 @@
+
+
+
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL
+from tdeui import KWindowInfo, KPushButton, KTextEdit
+from tdecore import i18n, KApplication
+
+iconName = 'misc'
+labelText = 'KWindowInfo'
+helpText = ''
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent):
+ TQFrame.__init__(self, parent)
+ self.button = KPushButton(i18n('Show Message'), self)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ buttonlayout = TQHBoxLayout(layout, 4)
+ buttonlayout.addWidget(self.button)
+ buttonlayout.addStretch(1)
+ layout.addStretch(1)
+ self.connect(self.button, SIGNAL('clicked()'), self.showWindowInfo)
+
+
+ def showWindowInfo(self):
+ main = KApplication.kApplication()
+ print main
+ print main.mainWidget()
+
+ info = KWindowInfo(main)
+ info.message('Updated Window Info', 3)
+
+
diff --git a/examples/pytde-sampler/qt_widgets/CONTRIB b/examples/pytde-sampler/qt_widgets/CONTRIB
new file mode 100644
index 0000000..3def876
--- /dev/null
+++ b/examples/pytde-sampler/qt_widgets/CONTRIB
@@ -0,0 +1,537 @@
+Module,Item,Path,Contributor
+dcop,DCOPClient,,,
+dcop,DCOPClientTransaction,,,
+dcop,DCOPObject,,,
+dcop,DCOPObjectProxy,,,
+dcop,DCOPRef,,,
+dcop,DCOPReply,,,
+dcop,DCOPStub,,,
+tdecore,BarIcon,,,
+tdecore,BarIconSet,,,
+tdecore,DesktopIcon,,,
+tdecore,DesktopIconSet,,,
+tdecore,IconSize,,,
+tdecore,KAboutData,,,
+tdecore,KAboutPerson,,,
+tdecore,KAboutTranslator,,,
+tdecore,KAccel,,,
+tdecore,KAccelAction,,,
+tdecore,KAccelActions,,,
+tdecore,KAccelBase,,,
+tdecore,KAccelShortcutList,,,
+tdecore,KApplication,,,
+tdecore,KAsyncIO,,,
+tdecore,KAudioPlayer,,,
+tdecore,KBufferedIO,,,
+tdecore,KCalendarSystem,,,
+tdecore,KCalendarSystemFactory,,,
+tdecore,KCatalogue,,,
+tdecore,KCharsets,,,
+tdecore,KClipboardSynchronizer,,,
+tdecore,KCmdLineArgs,,,
+tdecore,KCmdLineOptions,,,
+tdecore,KCodecs,,,
+tdecore,KCompletion,,,
+tdecore,KCompletionBase,,,
+tdecore,KConfig,,,
+tdecore,KConfigBackEnd,,,
+tdecore,KConfigBase,,,
+tdecore,KConfigDialogManager,,,
+tdecore,KConfigGroup,,,
+tdecore,KConfigGroupSaver,,,
+tdecore,KConfigINIBackEnd,,,
+tdecore,KConfigSkeleton,,,
+tdecore,KConfigSkeletonItem,,,
+tdecore,KCrash,,,
+tdecore,KDCOPPropertyProxy,,,
+tdecore,KDE,,,
+tdecore,KDesktopFile,,,
+tdecore,KEntry,,,
+tdecore,KEntryKey,,,
+tdecore,KGlobal,,,
+tdecore,KGlobalAccel,,,
+tdecore,KGlobalSettings,,,
+tdecore,KIDNA,,,
+tdecore,KIPC,,,
+tdecore,KIcon,,,
+tdecore,KIconEffect,,,
+tdecore,KIconLoader,,,
+tdecore,KIconTheme,,,
+tdecore,KInstance,,,
+tdecore,KKey,,,
+tdecore,KKeyNative,,,
+tdecore,KKeySequence,,,
+tdecore,KKeyServer,,,
+tdecore,KLibFactory,,,
+tdecore,KLibLoader,,,
+tdecore,KLibrary,,,
+tdecore,KLocale,,,
+tdecore,KMD5,,,
+tdecore,KMacroExpander,,,
+tdecore,KMacroExpanderBase,,,
+tdecore,KMimeSourceFactory,,,
+tdecore,KMountPoint,,,
+tdecore,KMultipleDrag,,,
+tdecore,KNotifyClient,,,
+tdecore,KPalette,,,
+tdecore,KPixmapProvider,,,
+tdecore,KProcIO,,,
+tdecore,KProcess,,,
+tdecore,KProcessController,,,
+tdecore,KPty,,,
+tdecore,KRFCDate,,,
+tdecore,KRandomSequence,,,
+tdecore,KRegExp,,,
+tdecore,KRootProp,,,
+tdecore,KSaveFile,,,
+tdecore,KSelectionOwner,,,
+tdecore,KSelectionWatcher,,,
+tdecore,KServerSocket,,,
+tdecore,KSessionManaged,,,
+tdecore,KShared,,,
+tdecore,KSharedConfig,,,
+tdecore,KShell,,,
+tdecore,KShellProcess,,,
+tdecore,KShortcut,,,
+tdecore,KShortcutList,,,
+tdecore,KSimpleConfig,,,
+tdecore,KSocket,,,
+tdecore,KStandardDirs,,,
+tdecore,KStartupInfo,,,
+tdecore,KStartupInfoData,,,
+tdecore,KStartupInfoId,,,
+tdecore,KStaticDeleterBase,,,
+tdecore,KStdAccel,,,
+tdecore,KStringHandler,,,
+tdecore,KTempDir,,,
+tdecore,KTempFile,,,
+tdecore,KURL,,,
+tdecore,KURLDrag,,,
+tdecore,KUniqueApplication,,,
+tdecore,KWin,,,
+tdecore,KWinModule,,,
+tdecore,KZoneAllocator,,,
+tdecore,MainBarIcon,,,
+tdecore,MainBarIconSet,,,
+tdecore,NET,,,
+tdecore,NETIcon,,,
+tdecore,NETPoint,,,
+tdecore,NETRect,,,
+tdecore,NETRootInfo,,,
+tdecore,NETRootInfo2,,,
+tdecore,NETSize,,,
+tdecore,NETStrut,,,
+tdecore,NETWinInfo,,,
+tdecore,SmallIcon,,,
+tdecore,SmallIconSet,,,
+tdecore,UserIcon,,,
+tdecore,UserIconSet,,,
+tdecore,i18n,,,
+tdecore,locate,,,
+tdecore,locateLocal,,,
+tdecore,testKEntryMap,,,
+tdecore,urlcmp,,,
+tdefx,KCPUInfo,,,
+tdefx,KImageEffect,,,
+tdefx,KPixmap,,,
+tdefx,KPixmapEffect,,,
+tdefx,KPixmapSplitter,,,
+tdefx,KStyle,,,
+tdefx,kColorBitmaps,,,
+tdefx,kDrawBeButton,,,
+tdefx,kDrawNextButton,,,
+tdefx,kDrawRoundButton,,,
+tdefx,kDrawRoundMask,,,
+tdefx,kRoundMaskRegion,,,
+tdeprint,DrBase,,,
+tdeprint,DrBooleanOption,,,
+tdeprint,DrChoiceGroup,,,
+tdeprint,DrConstraint,,,
+tdeprint,DrFloatOption,,,
+tdeprint,DrGroup,,,
+tdeprint,DrIntegerOption,,,
+tdeprint,DrListOption,,,
+tdeprint,DrMain,,,
+tdeprint,DrPageSize,,,
+tdeprint,DrStringOption,,,
+tdeprint,KMJob,,,
+tdeprint,KMJobManager,,,
+tdeprint,KMManager,,,
+tdeprint,KMObject,,,
+tdeprint,KMPrinter,,,
+tdeprint,KPReloadObject,,,
+tdeprint,KPrintAction,,,
+tdeprint,KPrintDialog,,,
+tdeprint,KPrintDialogPage,,,
+tdeprint,KPrinter,,,
+tdeprint,pageNameToPageSize,,,
+tdeprint,pageSizeToPageName,,,
+tdeprint,rangeToSize,,,
+tdesu,KCookie,,,
+tdesu,KDEsuClient,,,
+tdesu,PTY,,,
+tdesu,PtyProcess,,,
+tdesu,SshProcess,,,
+tdesu,StubProcess,,,
+tdesu,SuProcess,,,
+tdeui,KAboutApplication,,,
+tdeui,KAboutContainer,,,
+tdeui,KAboutContributor,,,
+tdeui,KAboutDialog,,,
+tdeui,KAboutKDE,,,
+tdeui,KAboutWidget,,,
+tdeui,KAction,,,
+tdeui,KActionCollection,,,
+tdeui,KActionMenu,,,
+tdeui,KActionPtrShortcutList,,,
+tdeui,KActionSeparator,,,
+tdeui,KActionShortcutList,,,
+tdeui,KActiveLabel,,,
+tdeui,KAnimWidget,,,
+tdeui,KArrowButton,,,
+tdeui,KAuthIcon,,,
+tdeui,KBugReport,,,
+tdeui,KButtonBox,,,
+tdeui,KCModule,,,
+tdeui,KCharSelect,,,
+tdeui,KCharSelectTable,,,
+tdeui,KColor,,,
+tdeui,KColorButton,,,
+tdeui,KColorCells,,,
+tdeui,KColorCombo,,,
+tdeui,KColorDialog,,,
+tdeui,KColorDrag,,,
+tdeui,KColorPatch,,,
+tdeui,KComboBox,,,
+tdeui,KCommand,,,
+tdeui,KCommandHistory,,,
+tdeui,KCompletionBox,,,
+tdeui,KConfigDialog,,,
+tdeui,KContextMenuManager,,,
+tdeui,KCursor,,,
+tdeui,KDCOPActionProxy,,,
+tdeui,KDateInternalMonthPicker,,,
+tdeui,KDateInternalWeekSelector,,,
+tdeui,KDateInternalYearSelector,,,
+tdeui,KDatePicker,,,
+tdeui,KDateTable,,,
+tdeui,KDateTimeWidget,,,
+tdeui,KDateValidator,,,
+tdeui,KDateWidget,,,
+tdeui,KDialog,,,
+tdeui,KDialogBase,,,
+tdeui,KDialogQueue,,,
+tdeui,KDockArea,,,
+tdeui,KDockMainWindow,,,
+tdeui,KDockManager,,,
+tdeui,KDockTabGroup,,,
+tdeui,KDockWidget,,,
+tdeui,KDockWidgetAbstractHeader,,,
+tdeui,KDockWidgetAbstractHeaderDrag,,,
+tdeui,KDockWidgetHeader,,,
+tdeui,KDockWidgetHeaderDrag,,,
+tdeui,KDockWindow,,,
+tdeui,KDoubleNumInput,,,
+tdeui,KDoubleSpinBox,,,
+tdeui,KDoubleValidator,,,
+tdeui,KDualColorButton,,,
+tdeui,KEdFind,,,
+tdeui,KEdGotoLine,,,
+tdeui,KEdReplace,,,
+tdeui,KEdit,,,
+tdeui,KEditListBox,,,
+tdeui,KEditToolbar,,,
+tdeui,KEditToolbarWidget,,,
+tdeui,KFloatValidator,,,
+tdeui,KFontAction,,,
+tdeui,KFontChooser,,,
+tdeui,KFontCombo,,,
+tdeui,KFontDialog,,,
+tdeui,KFontRequester,,,
+tdeui,KFontSizeAction,,,
+tdeui,KGradientSelector,,,
+tdeui,KGuiItem,,,
+tdeui,KHSSelector,,,
+tdeui,KHelpMenu,,,
+tdeui,KHistoryCombo,,,
+tdeui,KIconView,,,
+tdeui,KIconViewItem,,,
+tdeui,KInputDialog,,,
+tdeui,KIntNumInput,,,
+tdeui,KIntSpinBox,,,
+tdeui,KIntValidator,,,
+tdeui,KJanusWidget,,,
+tdeui,KKeyButton,,,
+tdeui,KKeyChooser,,,
+tdeui,KKeyDialog,,,
+tdeui,KLed,,,
+tdeui,KLineEdit,,,
+tdeui,KLineEditDlg,,,
+tdeui,KListAction,,,
+tdeui,KListBox,,,
+tdeui,KListView,,,
+tdeui,KListViewItem,,,
+tdeui,KMacroCommand,,,
+tdeui,KMainWindow,,,
+tdeui,KMainWindowInterface,,,
+tdeui,KMenuBar,,,
+tdeui,KMessageBox,,,
+tdeui,KMimeTypeValidator,,,
+tdeui,KNamedCommand,,,
+tdeui,KNumInput,,,
+tdeui,KPaletteTable,,,
+tdeui,KPanelAppMenu,,,
+tdeui,KPanelApplet,,,
+tdeui,KPanelExtension,,,
+tdeui,KPanelMenu,,,
+tdeui,KPassivePopup,,,
+tdeui,KPasswordDialog,,,
+tdeui,KPasswordEdit,,,
+tdeui,KPasteTextAction,,,
+tdeui,KPixmapIO,,,
+tdeui,KPopupFrame,,,
+tdeui,KPopupMenu,,,
+tdeui,KPopupTitle,,,
+tdeui,KProgress,,,
+tdeui,KProgressDialog,,,
+tdeui,KPushButton,,,
+tdeui,KRadioAction,,,
+tdeui,KRecentFilesAction,,,
+tdeui,KRestrictedLine,,,
+tdeui,KRootPermsIcon,,,
+tdeui,KRootPixmap,,,
+tdeui,KRuler,,,
+tdeui,KSelectAction,,,
+tdeui,KSelector,,,
+tdeui,KSeparator,,,
+tdeui,KSplashScreen,,,
+tdeui,KSqueezedTextLabel,,,
+tdeui,KStatusBar,,,
+tdeui,KStatusBarLabel,,,
+tdeui,KStdAction,,,
+tdeui,KStdGuiItem,,,
+tdeui,KStringListValidator,,,
+tdeui,KSystemTray,,,
+tdeui,KTabBar,,,
+tdeui,KTabCtl,,,
+tdeui,KTabWidget,,,
+tdeui,KTextBrowser,,,
+tdeui,KTextEdit,,,
+tdeui,KTimeWidget,,,
+tdeui,KTipDatabase,,,
+tdeui,KTipDialog,,,
+tdeui,KToggleAction,,,
+tdeui,KToggleFullScreenAction,,,
+tdeui,KToggleToolBarAction,,,
+tdeui,KToolBar,,,
+tdeui,KToolBarButton,,,
+tdeui,KToolBarPopupAction,,,
+tdeui,KToolBarRadioGroup,,,
+tdeui,KToolBarSeparator,,,
+tdeui,KURLLabel,,,
+tdeui,KValueSelector,,,
+tdeui,KWidgetAction,,,
+tdeui,KWindowInfo,,,
+tdeui,KWindowListMenu,,,
+tdeui,KWizard,,,
+tdeui,KWordWrap,,,
+tdeui,KWritePermsIcon,,,
+tdeui,KXMLGUIBuilder,,,
+tdeui,KXMLGUIClient,,,
+tdeui,KXMLGUIFactory,,,
+tdeui,KXYSelector,,,
+tdeui,QXEmbed,,,
+tdeui,testKActionList,,,
+kfile,KApplicationPropsPlugin,,,
+kfile,KBindingPropsPlugin,,,
+kfile,KCombiView,,,
+kfile,KCustomMenuEditor,,,
+kfile,KDesktopPropsPlugin,,,
+kfile,KDevicePropsPlugin,,,
+kfile,KDirOperator,,,
+kfile,KDirSelectDialog,,,
+kfile,KDirSize,,,
+kfile,KDiskFreeSp,,,
+kfile,KEncodingFileDialog,,,
+kfile,KExecPropsPlugin,,,
+kfile,KFile,,,
+kfile,KFileDetailView,,,
+kfile,KFileDialog,,,
+kfile,KFileFilterCombo,,,
+kfile,KFileIconView,,,
+kfile,KFileIconViewItem,,,
+kfile,KFileListViewItem,,,
+kfile,KFileOpenWithHandler,,,
+kfile,KFilePermissionsPropsPlugin,,,
+kfile,KFilePreview,,,
+kfile,KFilePropsPlugin,,,
+kfile,KFileSharePropsPlugin,,,
+kfile,KFileTreeBranch,,,
+kfile,KFileTreeView,,,
+kfile,KFileTreeViewItem,,,
+kfile,KFileTreeViewToolTip,,,
+kfile,KFileView,,,
+kfile,KFileViewSignaler,,,
+kfile,KIconButton,,,
+kfile,KIconCanvas,,,
+kfile,KIconDialog,,,
+kfile,KImageFilePreview,,,
+kfile,KNotify,,,
+kfile,KNotifyDialog,,,
+kfile,KOpenWithDlg,,,
+kfile,KPreviewWidgetBase,,,
+kfile,KPropertiesDialog,,,
+kfile,KPropsDlgPlugin,,,
+kfile,KRecentDocument,,,
+kfile,KURLBar,,,
+kfile,KURLBarItem,,,
+kfile,KURLBarItemDialog,,,
+kfile,KURLBarListBox,,,
+kfile,KURLComboBox,,,
+kfile,KURLComboRequester,,,
+kfile,KURLPropsPlugin,,,
+kfile,KURLRequester,,,
+kfile,KURLRequesterDlg,,,
+khtml,DOM,,,
+khtml,KHTMLPart,,,
+khtml,KHTMLSettings,,,
+khtml,KHTMLView,,,
+kio,KAr,,,
+kio,KArchive,,,
+kio,KArchiveDirectory,,,
+kio,KArchiveEntry,,,
+kio,KArchiveFile,,,
+kio,KAutoMount,,,
+kio,KAutoUnmount,,,
+kio,KDCOPServiceStarter,,,
+kio,KDEDesktopMimeType,,,
+kio,KDataTool,,,
+kio,KDataToolAction,,,
+kio,KDataToolInfo,,,
+kio,KDirLister,,,
+kio,KDirNotify,,,
+kio,KDirWatch,,,
+kio,KEMailSettings,,,
+kio,KExecMimeType,,,
+kio,KFileFilter,,,
+kio,KFileItem,,,
+kio,KFileMetaInfo,,,
+kio,KFileMetaInfoGroup,,,
+kio,KFileMetaInfoItem,,,
+kio,KFileMetaInfoProvider,,,
+kio,KFileMimeTypeInfo,,,
+kio,KFilePlugin,,,
+kio,KFileShare,,,
+kio,KFileSharePrivate,,,
+kio,KFilterBase,,,
+kio,KFilterDev,,,
+kio,KFolderType,,,
+kio,KIO,,,
+kio,KImageIO,,,
+kio,KMimeMagic,,,
+kio,KMimeMagicResult,,,
+kio,KMimeType,,,
+kio,KOCRDialog,,,
+kio,KOCRDialogFactory,,,
+kio,KOpenWithHandler,,,
+kio,KProcessRunner,,,
+kio,KProtocolInfo,,,
+kio,KProtocolManager,,,
+kio,KRun,,,
+kio,KST_CTimeInfo,,,
+kio,KST_KCustom,,,
+kio,KST_KDEDesktopMimeType,,,
+kio,KST_KExecMimeType,,,
+kio,KST_KFolderType,,,
+kio,KST_KImageIO,,,
+kio,KST_KImageIOFormat,,,
+kio,KST_KMimeType,,,
+kio,KST_KProtocolInfo,,,
+kio,KST_KProtocolInfoFactory,,,
+kio,KST_KService,,,
+kio,KST_KServiceFactory,,,
+kio,KST_KServiceGroup,,,
+kio,KST_KServiceGroupFactory,,,
+kio,KST_KServiceType,,,
+kio,KST_KServiceTypeFactory,,,
+kio,KST_KSycocaEntry,,,
+kio,KScanDialog,,,
+kio,KScanDialogFactory,,,
+kio,KService,,,
+kio,KServiceGroup,,,
+kio,KServiceOffer,,,
+kio,KServiceSeparator,,,
+kio,KServiceType,,,
+kio,KServiceTypeProfile,,,
+kio,KShellCompletion,,,
+kio,KShred,,,
+kio,KSimpleFileFilter,,,
+kio,KSycoca,,,
+kio,KSycocaEntry,,,
+kio,KSycocaFactory,,,
+kio,KTar,,,
+kio,KTrader,,,
+kio,KURIFilter,,,
+kio,KURIFilterData,,,
+kio,KURIFilterPlugin,,,
+kio,KURLCompletion,,,
+kio,KURLPixmapProvider,,,
+kio,KZip,,,
+kio,KZipFileEntry,,,
+kio,Observer,,,
+kio,RenameDlgPlugin,,,
+kio,ThumbCreator,,,
+kio,testKIOMetaData,,,
+kio,testKIOUDSEntry,,,
+kio,testKIOUDSEntryList,,,
+kmdi,KMdi,,,
+kmdi,KMdiChildArea,,,
+kmdi,KMdiChildFrm,,,
+kmdi,KMdiChildFrmCaption,,,
+kmdi,KMdiChildFrmDragBeginEvent,,,
+kmdi,KMdiChildFrmDragEndEvent,,,
+kmdi,KMdiChildFrmMoveEvent,,,
+kmdi,KMdiChildFrmResizeBeginEvent,,,
+kmdi,KMdiChildFrmResizeEndEvent,,,
+kmdi,KMdiChildView,,,
+kmdi,KMdiMainFrm,,,
+kmdi,KMdiTaskBar,,,
+kmdi,KMdiTaskBarButton,,,
+kmdi,KMdiToolViewAccessor,,,
+kmdi,KMdiViewCloseEvent,,,
+kmdi,KMdiWin32IconButton,,,
+kparts,KParts,,,
+kparts,createReadOnlyPart,,,
+kparts,createReadWritePart,,,
+kparts,testTQMapTQCStringInt,,,
+kspell,KS_ADD,,,
+kspell,KS_CANCEL,,,
+kspell,KS_CLIENT_ASPELL,,,
+kspell,KS_CLIENT_HSPELL,,,
+kspell,KS_CLIENT_ISPELL,,,
+kspell,KS_CONFIG,,,
+kspell,KS_E_ASCII,,,
+kspell,KS_E_CP1251,,,
+kspell,KS_E_CP1255,,,
+kspell,KS_E_KOI8R,,,
+kspell,KS_E_KOI8U,,,
+kspell,KS_E_LATIN1,,,
+kspell,KS_E_LATIN13,,,
+kspell,KS_E_LATIN15,,,
+kspell,KS_E_LATIN2,,,
+kspell,KS_E_LATIN3,,,
+kspell,KS_E_LATIN4,,,
+kspell,KS_E_LATIN5,,,
+kspell,KS_E_LATIN7,,,
+kspell,KS_E_LATIN8,,,
+kspell,KS_E_LATIN9,,,
+kspell,KS_E_UTF8,,,
+kspell,KS_IGNORE,,,
+kspell,KS_IGNOREALL,,,
+kspell,KS_REPLACE,,,
+kspell,KS_REPLACEALL,,,
+kspell,KS_STOP,,,
+kspell,KS_SUGGEST,,,
+kspell,KSpell,,,
+kspell,KSpellConfig,,,
+kspell,KSpellDlg,,,
diff --git a/examples/pytde-sampler/qt_widgets/__init__.py b/examples/pytde-sampler/qt_widgets/__init__.py
new file mode 100644
index 0000000..fdd6539
--- /dev/null
+++ b/examples/pytde-sampler/qt_widgets/__init__.py
@@ -0,0 +1,17 @@
+labelText = 'TQt Widgets'
+iconName = 'designer'
+
+helpText = """TQt provides a rich set of widgets for application use.
+Select the children of this item to see for yourself."""
+
+from qt import TQFrame, TQVBoxLayout, SIGNAL
+from tdeui import KTextEdit
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ layout.addStretch(1)
diff --git a/examples/pytde-sampler/qt_widgets/table.py b/examples/pytde-sampler/qt_widgets/table.py
new file mode 100644
index 0000000..4a689d2
--- /dev/null
+++ b/examples/pytde-sampler/qt_widgets/table.py
@@ -0,0 +1,42 @@
+labelText = 'TQTable'
+iconName = 'inline_table'
+
+helpText = """From the docs: 'The TQTable class provides a flexible
+editable table widget.'
+"""
+
+import csv
+import os
+
+from qt import TQFrame, TQStringList, TQVBoxLayout, SIGNAL
+from qttable import TQTable
+
+from tdeui import KTextEdit
+
+contrib = os.path.join(os.path.split(__file__)[0], 'CONTRIB')
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+
+ data = csv.reader(open(contrib))
+ header = data.next()
+ items = [item for item in data]
+
+ self.table = table = TQTable(len(items), len(header), self)
+ headers = TQStringList()
+ for headertext in header:
+ headers.append(headertext)
+ table.setColumnLabels(headers)
+
+ cols = range(len(header))
+ for row, record in enumerate(items):
+ for col in cols:
+ table.setText(row, col, record[col])
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help)
+ layout.addWidget(self.table)
+ layout.addStretch(1)
diff --git a/examples/pytde-sampler/runner.py b/examples/pytde-sampler/runner.py
new file mode 100755
index 0000000..e153fae
--- /dev/null
+++ b/examples/pytde-sampler/runner.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+"""
+
+"""
+import sys
+from tdecore import KApplication, KCmdLineArgs
+from tdeui import KMainWindow
+from qt import TQVBoxLayout
+
+## relative import -- cry me a river!
+import about
+
+
+class SamplerRunnerWindow(KMainWindow):
+ def __init__(self, ctor):
+ KMainWindow.__init__(self)
+ layout = TQVBoxLayout(self)
+ layout.setAutoAdd(True)
+ self.widget = ctor(self)
+
+
+def importItem(name):
+ """ importItem(name) -> import an item from a module by dotted name
+
+ """
+ def importName(name):
+ """ importName(name) -> import and return a module by name in dotted form
+
+ Copied from the Python lib docs.
+ """
+ mod = __import__(name)
+ for comp in name.split('.')[1:]:
+ mod = getattr(mod, comp)
+ return mod
+
+ names = name.split('.')
+ modname, itemname = names[0:-1], names[-1]
+ mod = importName(str.join('.', modname))
+ return getattr(mod, itemname)
+
+
+
+if __name__ == '__main__':
+ options = [('+item', 'An item in the sys.path')]
+ KCmdLineArgs.init(sys.argv, about.about)
+ KCmdLineArgs.addCmdLineOptions(options)
+
+ args = KCmdLineArgs.parsedArgs()
+ if not args.count():
+ args.usage()
+ else:
+ pathitem = args.arg(0)
+ widget = importItem(pathitem)
+
+ app = KApplication()
+ mainWindow = SamplerRunnerWindow(widget)
+ mainWindow.show()
+ app.exec_loop()
diff --git a/examples/pytde-sampler/sampler.py b/examples/pytde-sampler/sampler.py
new file mode 100755
index 0000000..83a4979
--- /dev/null
+++ b/examples/pytde-sampler/sampler.py
@@ -0,0 +1,423 @@
+#!/usr/bin/env python
+""" The PyKDE application sampler
+
+This module defines the top-level widgets for displaying the sampler
+application.
+
+
+"""
+import inspect
+import os
+import sys
+
+from qt import SIGNAL, SLOT, PYSIGNAL, TQt
+from qt import TQVBoxLayout, TQLabel, TQPixmap, TQSplitter, TQFrame, TQDialog
+from qt import TQSizePolicy, TQHBoxLayout, TQSpacerItem, TQPushButton
+
+from tdecore import i18n, KAboutData, KApplication, KCmdLineArgs, KGlobal
+from tdecore import KGlobalSettings, KWin, KWinModule, KURL, KIcon
+
+from tdeui import KComboBox, KListView, KListViewItem, KTabWidget, KTextEdit
+from tdeui import KMainWindow, KPushButton, KSplashScreen, KStdAction
+from tdeui import KKeyDialog, KEditToolbar
+
+from kio import KTrader
+from kparts import createReadOnlyPart, createReadWritePart
+from khtml import KHTMLPart
+
+import about
+import lib
+
+
+try:
+ __file__
+except (NameError, ):
+ __file__ = sys.argv[0]
+
+
+sigDoubleClicked = SIGNAL('doubleClicked(TQListViewItem *)')
+sigViewItemSelected = SIGNAL('selectionChanged(TQListViewItem *)')
+sigSampleSelected = PYSIGNAL('sample selected')
+
+blank = KURL('about:blank')
+
+
+def appConfig(group=None):
+ """ appConfig(group=None) -> returns the application KConfig
+
+ """
+ config = KGlobal.instance().config()
+ if group is not None:
+ config.setGroup(group)
+ return config
+
+
+def getIcon(name, group=KIcon.NoGroup, size=KIcon.SizeSmall):
+ """ returns a kde icon by name
+
+ """
+ return KGlobal.instance().iconLoader().loadIcon(name, group, size)
+
+
+def getIconSet(name, group=KIcon.NoGroup, size=KIcon.SizeSmall):
+ """ returns a kde icon set by name
+
+ """
+ return KGlobal.instance().iconLoader().loadIconSet(name, group, size)
+
+
+def buildPart(parent, query, constraint, writable=False):
+ """ builds the first available offered part on the parent
+
+ """
+ offers = KTrader.self().query(query, constraint)
+ for ptr in offers:
+ if writable:
+ builder = createReadWritePart
+ else:
+ builder = createReadOnlyPart
+ part = builder(ptr.library(), parent, ptr.name())
+ if part:
+ break
+ return part
+
+
+
+class CommonFrame(TQFrame):
+ """ provides a modicum of reuse
+
+ """
+ def __init__(self, parent):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ layout.setAutoAdd(True)
+ layout.setAlignment(TQt.AlignCenter | TQt.AlignVCenter)
+
+
+class SamplerFrame(CommonFrame):
+ """ frame type that swaps out old widgets for new when told to do so
+
+ """
+ def __init__(self, parent):
+ CommonFrame.__init__(self, parent)
+ self.widget = None
+
+ def setWidget(self, widget):
+ self.layout().deleteAllItems()
+ previous = self.widget
+ if previous:
+ previous.close()
+ delattr(self, 'widget')
+ self.widget = widget
+
+ def showSample(self, item, module):
+ try:
+ frameType = module.builder()
+ except (AttributeError, ):
+ print 'No sample callable defined in %s' % (module.name(), )
+ else:
+ frame = frameType(self)
+ self.setWidget(frame)
+ frame.show()
+
+
+class SourceFrame(CommonFrame):
+ """ frame with part for displaying python source
+
+ """
+ def __init__(self, parent):
+ CommonFrame.__init__(self, parent)
+ query = ''
+ self.part = buildPart(self, 'application/x-python', query, False)
+
+ def showModuleSource(self, item, module):
+ if not self.part:
+ print 'No part available for displaying python source.'
+ return
+ try:
+ modulefile = inspect.getabsfile(module.module)
+ except:
+ return
+ self.part.openURL(blank)
+ if os.path.splitext(modulefile)[-1] == '.py':
+ self.part.openURL(KURL('file://%s' % modulefile))
+
+
+class WebFrame(CommonFrame):
+ """ frame with part for viewing web pages
+
+ """
+ docBase = 'http://www.riverbankcomputing.com/Docs/PyKDE3/classref/'
+
+ def __init__(self, parent):
+ CommonFrame.__init__(self, parent)
+ self.part = part = buildPart(self, 'text/html', "Type == 'Service'")
+ #part.connect(part, SIGNAL('khtmlMousePressEvent(a)'), self.onURL)
+
+ def onURL(self, a):
+ print '****', a
+
+ def showDocs(self, item, module):
+ try:
+ mod, cls = module.module.docParts
+ except (AttributeError, ):
+ url = blank
+ else:
+ url = KURL(self.docUrl(mod, cls))
+ self.part.openURL(url)
+
+
+ def docUrl(self, module, klass):
+ """ docUrl(name) -> return a doc url given a name from the kde libs
+
+ """
+ return '%s/%s/%s.html' % (self.docBase, module, klass, )
+
+
+class OutputFrame(KTextEdit):
+ """ text widget that acts (just enough) like a file
+
+ """
+ def __init__(self, parent, filehandle):
+ KTextEdit.__init__(self, parent)
+ self.filehandle = filehandle
+ self.setReadOnly(True)
+ self.setFont(KGlobalSettings.fixedFont())
+
+
+ def write(self, text):
+ self.insert(text)
+
+
+ def clear(self):
+ self.setText('')
+
+
+ def __getattr__(self, name):
+ return getattr(self.filehandle, name)
+
+
+class SamplerListView(KListView):
+ """ the main list view of samples
+
+ """
+ def __init__(self, parent):
+ KListView.__init__(self, parent)
+ self.addColumn(i18n('Sample'))
+ self.setRootIsDecorated(True)
+
+ modules = lib.listmodules()
+ modules.sort(lambda a, b: cmp(a[0], b[0]))
+
+ modmap = dict(modules)
+ modules = [(name.split('.'), name, mod) for name, mod in modules]
+ roots, cache = {}, {}
+
+ for names, modname, module in modules:
+ topname, subnames = names[0], names[1:]
+ item = roots.get(topname, None)
+ if item is None:
+ roots[topname] = item = KListViewItem(self, module.labelText())
+ item.module = module
+ item.setPixmap(0, getIcon(module.icon()))
+
+ bname = ''
+ subitem = item
+ for subname in subnames:
+ bname = '%s.%s' % (bname, subname, )
+ item = cache.get(bname, None)
+ if item is None:
+ subitem = cache[bname] = \
+ KListViewItem(subitem, module.labelText())
+ subitem.module = module
+ subitem.setPixmap(0, getIcon(module.icon()))
+ subitem = item
+
+ for root in roots.values():
+ self.setOpen(root, True)
+
+
+class SamplerMainWindow(KMainWindow):
+ """ the main window
+
+ """
+ def __init__(self, *args):
+ KMainWindow.__init__(self, *args)
+ self.hSplitter = hSplit = TQSplitter(TQt.Horizontal, self)
+ self.samplesList = samplesList = SamplerListView(hSplit)
+ self.vSplitter = vSplit = TQSplitter(TQt.Vertical, hSplit)
+ self.setCentralWidget(hSplit)
+ self.setIcon(getIcon('kmail'))
+
+ hSplit.setOpaqueResize(True)
+ vSplit.setOpaqueResize(True)
+
+ self.contentTabs = cTabs = KTabWidget(vSplit)
+ self.outputTabs = oTabs = KTabWidget(vSplit)
+
+ self.sampleFrame = SamplerFrame(cTabs)
+ self.sourceFrame = SourceFrame(cTabs)
+ self.webFrame = WebFrame(cTabs)
+
+ cTabs.insertTab(self.sampleFrame, getIconSet('exec'), i18n('Sample'))
+ cTabs.insertTab(self.sourceFrame, getIconSet('source'), i18n('Source'))
+ cTabs.insertTab(self.webFrame, getIconSet('help'), i18n('Docs'))
+
+ sys.stdout = self.stdoutFrame = OutputFrame(oTabs, sys.stdout)
+ sys.stderr = self.stderrFrame = OutputFrame(oTabs, sys.stderr)
+
+ termIcons = getIconSet('terminal')
+ oTabs.insertTab(self.stdoutFrame, termIcons, i18n('stdout'))
+ oTabs.insertTab(self.stderrFrame, termIcons, i18n('stderr'))
+
+ self.resize(640, 480)
+ height, width = self.height(), self.width()
+ hSplit.setSizes([width * 0.35, width * 0.65])
+ vSplit.setSizes([height * 0.80, height * 0.20])
+
+ self.xmlRcFileName = os.path.abspath(os.path.join(os.path.dirname(__file__), 'sampler.rc'))
+ self.setXMLFile(self.xmlRcFileName)
+ config = appConfig()
+ actions = self.actionCollection()
+ actions.readShortcutSettings("", config)
+ self.quitAction = KStdAction.quit(self.close, actions)
+
+ self.toggleMenubarAction = \
+ KStdAction.showMenubar(self.showMenubar, actions)
+ self.toggleToolbarAction = \
+ KStdAction.showToolbar(self.showToolbar, actions)
+ self.toggleStatusbarAction = \
+ KStdAction.showStatusbar(self.showStatusbar, actions)
+ self.configureKeysAction = \
+ KStdAction.keyBindings(self.showConfigureKeys, actions)
+ self.configureToolbarAction = \
+ KStdAction.configureToolbars(self.showConfigureToolbars, actions)
+ self.configureAppAction = \
+ KStdAction.preferences(self.showConfiguration, actions)
+
+ connect = self.connect
+ connect(samplesList, sigViewItemSelected, self.sampleSelected)
+ connect(self, sigSampleSelected, self.reloadModule)
+ connect(self, sigSampleSelected, self.sourceFrame.showModuleSource)
+ connect(self, sigSampleSelected, self.sampleFrame.showSample)
+ connect(self, sigSampleSelected, self.webFrame.showDocs)
+
+ self.restoreWindowSize(config)
+ self.createGUI(self.xmlRcFileName, 0)
+ self.sourceFrame.part.openURL(KURL('file://%s' % os.path.abspath(__file__)))
+
+
+ def showConfiguration(self):
+ """ showConfiguration() -> display the config dialog
+
+ """
+ return
+ ## not yet implemented
+ dlg = configdialog.ConfigurationDialog(self)
+ for obj in (self.stderrFrame, self.stdoutFrame, self.pythonShell):
+ call = getattr(obj, 'configChanged', None)
+ if call:
+ self.connect(dlg, util.sigConfigChanged, call)
+ dlg.show()
+
+
+ def senderCheckShow(self, widget):
+ """ senderCheckShow(widget) -> show or hide widget if sender is checked
+
+ """
+ if self.sender().isChecked():
+ widget.show()
+ else:
+ widget.hide()
+
+
+ def showMenubar(self):
+ """ showMenuBar() -> toggle the menu bar
+
+ """
+ self.senderCheckShow(self.menuBar())
+
+
+ def showToolbar(self):
+ """ showToolbar() -> toggle the tool bar
+
+ """
+ self.senderCheckShow(self.toolBar())
+
+
+ def showStatusbar(self):
+ """ showStatusbar() -> toggle the status bar
+
+ """
+ self.senderCheckShow(self.statusBar())
+
+
+ def showConfigureKeys(self):
+ """ showConfigureKeys() -> show the shortcut keys dialog
+
+ """
+ ret = KKeyDialog.configure(self.actionCollection(), self)
+ print ret
+ if ret == TQDialog.Accepted:
+ actions = self.actionCollection()
+ actions.writeShortcutSettings(None, appConfig())
+
+
+ def showConfigureToolbars(self):
+ """ showConfigureToolbars() -> broken
+
+ """
+ dlg = KEditToolbar(self.actionCollection(), self.xmlRcFileName)
+ self.connect(dlg, SIGNAL('newToolbarConfig()'), self.rebuildGui)
+ #connect(self, sigSampleSelected, self.sourceFrame.showModuleSource)
+
+ dlg.exec_loop()
+
+
+ def rebuildGui(self):
+ """ rebuildGui() -> recreate the gui and refresh the palette
+
+ """
+ self.createGUI(self.xmlRcFileName, 0)
+ for widget in (self.toolBar(), self.menuBar(), ):
+ widget.setPalette(self.palette())
+
+
+ def sampleSelected(self):
+ """ sampleSelected() -> emit the current item and its module
+
+ """
+ self.stdoutFrame.clear()
+ self.stderrFrame.clear()
+ item = self.sender().currentItem()
+ self.emit(sigSampleSelected, (item, item.module))
+
+
+ def setSplashPixmap(self, pixmap):
+ """ setSplashPixmap(pixmap) -> assimilate the splash screen pixmap
+
+ """
+ target = self.sampleFrame
+ label = TQLabel(target)
+ label.setPixmap(pixmap)
+ target.setWidget(label)
+
+
+ def reloadModule(self, item, module):
+ print >> sys.__stdout__, 'reload: ', reload(module.module)
+
+
+if __name__ == '__main__':
+ aboutdata = about.about()
+ KCmdLineArgs.init(sys.argv, aboutdata)
+ app = KApplication()
+
+ splashpix = TQPixmap(os.path.join(lib.samplerpath, 'aboutkde.png'))
+ splash = KSplashScreen(splashpix)
+ splash.resize(splashpix.size())
+ splash.show()
+ mainWindow = SamplerMainWindow()
+ mainWindow.setSplashPixmap(splashpix)
+ mainWindow.show()
+ splash.finish(mainWindow)
+ app.exec_loop()
diff --git a/examples/pytde-sampler/sampler.rc b/examples/pytde-sampler/sampler.rc
new file mode 100644
index 0000000..fc068ca
--- /dev/null
+++ b/examples/pytde-sampler/sampler.rc
@@ -0,0 +1,13 @@
+<!DOCTYPE kpartgui>
+<kpartgui version="1" name="MainWindow" >
+ <MenuBar>
+ <Merge/>
+ </MenuBar>
+ <ToolBar noMerge="1" name="mainToolBar" >
+ <Action name="options_configure_toolbars" />
+ <Action name="options_configure_keybinding" />
+ <Action name="file_quit" />
+ <Action name="help_about_kde" />
+ </ToolBar>
+ <ActionProperties/>
+</kpartgui>
diff --git a/examples/pytde-sampler/wizards/__init__.py b/examples/pytde-sampler/wizards/__init__.py
new file mode 100644
index 0000000..63472b4
--- /dev/null
+++ b/examples/pytde-sampler/wizards/__init__.py
@@ -0,0 +1,2 @@
+iconName = 'wizard'
+labelText = 'Wizards'
diff --git a/examples/pytde-sampler/wizards/wiz.py b/examples/pytde-sampler/wizards/wiz.py
new file mode 100644
index 0000000..1cb5544
--- /dev/null
+++ b/examples/pytde-sampler/wizards/wiz.py
@@ -0,0 +1,2 @@
+iconName = 'wizard'
+labelText = 'Wizard'
diff --git a/examples/pytde-sampler/xwin/__init__.py b/examples/pytde-sampler/xwin/__init__.py
new file mode 100644
index 0000000..34787fd
--- /dev/null
+++ b/examples/pytde-sampler/xwin/__init__.py
@@ -0,0 +1,18 @@
+labelText = 'X Windows Features'
+iconName = 'kcmx'
+
+helpText = """KDE and PyKDE allow interaction with the X Window system. Check
+out the nifty samples below."""
+
+from qt import TQFrame, TQLabel, TQVBoxLayout
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ layout = TQVBoxLayout(self)
+ self.text = TQLabel(helpText, self)
+ layout.addWidget(self.text, 1)
+
+
+
+