diff options
Diffstat (limited to 'python/pykde/examples/pykde-sampler/dialogs')
17 files changed, 0 insertions, 768 deletions
diff --git a/python/pykde/examples/pykde-sampler/dialogs/__init__.py b/python/pykde/examples/pykde-sampler/dialogs/__init__.py deleted file mode 100644 index c6f70f9c..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -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 QFrame, QVBoxLayout -from kdeui import KTextEdit - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - layout = QVBoxLayout(self) - self.text = KTextEdit(helpText, '', self) - layout.addWidget(self.text, 1) diff --git a/python/pykde/examples/pykde-sampler/dialogs/about/__init__.py b/python/pykde/examples/pykde-sampler/dialogs/about/__init__.py deleted file mode 100644 index 4c40da7b..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/about/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -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 QFrame, QVBoxLayout -from kdeui import KTextEdit - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - layout = QVBoxLayout(self) - self.text = KTextEdit(helpText, '', self) - layout.addWidget(self.text, 1) diff --git a/python/pykde/examples/pykde-sampler/dialogs/about/aboutapp.py b/python/pykde/examples/pykde-sampler/dialogs/about/aboutapp.py deleted file mode 100644 index afdd71a9..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/about/aboutapp.py +++ /dev/null @@ -1,29 +0,0 @@ -iconName = 'about_kde' -labelText = 'KAboutApplication' - -from qt import QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui import KAboutApplication, KPushButton, KTextEdit - - -helpText = ("Typically available via the applications 'Help' menu, this " - "dialog presents the user with the applications About widget.") - -docParts = ('kdeui', 'KAboutDialog') - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('About Application'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/about/aboutkde.py b/python/pykde/examples/pykde-sampler/dialogs/about/aboutkde.py deleted file mode 100644 index 9c73f9d4..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/about/aboutkde.py +++ /dev/null @@ -1,28 +0,0 @@ -iconName = 'about_kde' -labelText = 'KAboutKDE' - -from qt import QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui 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(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('About KDE'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/bugreport.py b/python/pykde/examples/pykde-sampler/dialogs/bugreport.py deleted file mode 100644 index 6c411650..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/bugreport.py +++ /dev/null @@ -1,34 +0,0 @@ -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 QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui 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(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Bug Report Dialog'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/color.py b/python/pykde/examples/pykde-sampler/dialogs/color.py deleted file mode 100644 index b749cce4..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/color.py +++ /dev/null @@ -1,42 +0,0 @@ -iconName = 'colorize' -labelText = 'KColorDialog' - - -from qt import QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui 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(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Color Dialog'), self) - self.help = KTextEdit(helpText, '', self) - self.patch = KColorPatch(self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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 QColor &)'), - 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 QColor &)'), - self.patch.setColor) - dlg.exec_loop() diff --git a/python/pykde/examples/pykde-sampler/dialogs/config.py b/python/pykde/examples/pykde-sampler/dialogs/config.py deleted file mode 100644 index 74454ab0..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/config.py +++ /dev/null @@ -1,59 +0,0 @@ - -from qt import QFrame, QHBoxLayout, QVBoxLayout, QTimer, SIGNAL, QString -from kdecore import i18n, KConfigSkeleton -from kdeui import KPushButton, KConfigDialog, KTextEdit - -iconName = 'configure' -labelText = 'KConfigDialog' -docParts = ('kdeui', 'KConfigDialog') -helpText = ("") - - -class SampleSettings(KConfigSkeleton): - def __init__(self): - KConfigSkeleton.__init__(self) - self.anyString = QString() - - self.setCurrentGroup("Strings") - self.addItemString("Test", self.anyString, "Default Value") - - self.setCurrentGroup("Booleans") - self.addItemBool("Any Bool", False) - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Config Dialog'), self) - self.help = KTextEdit(helpText, '', self) - - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.text = KTextEdit('A String', '', self) - - -class BoolSettings(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.text = KTextEdit('A Bool', '', self) - diff --git a/python/pykde/examples/pykde-sampler/dialogs/edfind.py b/python/pykde/examples/pykde-sampler/dialogs/edfind.py deleted file mode 100644 index 685902e0..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/edfind.py +++ /dev/null @@ -1,52 +0,0 @@ - -from qt import QFrame, QHBoxLayout, QVBoxLayout, QTimer, SIGNAL, QFont, QString -from kdecore import i18n -from kdeui import KPushButton, KEdFind, KTextEdit - -iconName = 'find' -labelText = 'KEdFind' -docParts = ('kdeui', 'KEdFind') -helpText = ("An example of the KEdFind dialog.") - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Edit Find Dialog'), self) - self.help = KTextEdit(helpText, '', self) - - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/edreplace.py b/python/pykde/examples/pykde-sampler/dialogs/edreplace.py deleted file mode 100644 index df956141..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/edreplace.py +++ /dev/null @@ -1,52 +0,0 @@ -from qt import QFrame, QHBoxLayout, QVBoxLayout, QTimer, SIGNAL, QFont, QString -from kdecore import i18n -from kdeui import KPushButton, KEdReplace, KTextEdit - -iconName = 'findreplace' -labelText = 'KEdReplace' -docParts = ('kdeui', 'KEdReplace') -helpText = ("An example of the KEdReplace dialog.") - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Edit Find Dialog'), self) - self.help = KTextEdit(helpText, '', self) - - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/font.py b/python/pykde/examples/pykde-sampler/dialogs/font.py deleted file mode 100644 index ae2189e5..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/font.py +++ /dev/null @@ -1,53 +0,0 @@ - -from qt import QFrame, QHBoxLayout, QVBoxLayout, QTimer, SIGNAL, QFont, QString -from kdecore import i18n -from kdeui import KPushButton, KFontDialog, KTextEdit - -iconName = 'fonts' -labelText = 'KFontDialog' -docParts = ('kdeui', '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 quis 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 quis risus. Vestibulum -tincidunt, augue vitae suscipit congue, sem dui adipiscing nulla, ut -nonummy arcu quam ac sem. Nulla in metus. Phasellus neque. -""" - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Font Dialog'), self) - self.help = KTextEdit(helpText, '', self) - self.example = KTextEdit(fontText, '', self) - - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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 = QFont(self.example.font()) - string = QString() - accepted, other = KFontDialog.getFontAndText(font, string, False, self) - if accepted: - self.example.setFont(font) - self.example.setText(string) diff --git a/python/pykde/examples/pykde-sampler/dialogs/input.py b/python/pykde/examples/pykde-sampler/dialogs/input.py deleted file mode 100644 index 30edc6fb..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/input.py +++ /dev/null @@ -1,87 +0,0 @@ -iconName = 'editclear' -labelText = 'KInputDialog' - -from qt import QFrame, QGridLayout, QLabel, QStringList, SIGNAL -from kdecore import i18n -from kdeui 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(QFrame): - items = ['Apples', 'Bananas', 'Mangos', 'Oranges', 'Pears', ] - - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.help = KTextEdit(helpText, '', self) - - layout = QGridLayout(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 = QLabel('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 = QLabel('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 = QLabel('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 = QLabel(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 = QStringList() - 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/python/pykde/examples/pykde-sampler/dialogs/key.py b/python/pykde/examples/pykde-sampler/dialogs/key.py deleted file mode 100644 index 4c437da2..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/key.py +++ /dev/null @@ -1,29 +0,0 @@ -iconName = 'configure_shortcuts' -labelText = 'KKeyDialog' - -from qt import QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui 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(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Key Configuration Dialog'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/msgbox.py b/python/pykde/examples/pykde-sampler/dialogs/msgbox.py deleted file mode 100644 index a0b3c9a3..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/msgbox.py +++ /dev/null @@ -1,141 +0,0 @@ -iconName = 'stop' -labelText = 'KMessageBox' - -from random import random -from traceback import print_exc -from StringIO import StringIO - -from qt import QFrame, QGridLayout, QLabel, QStringList, SIGNAL -from kdecore import i18n -from kdeui 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(QFrame): - 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): - QFrame.__init__(self, parent) - items = QStringList() - 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 = QGridLayout(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/python/pykde/examples/pykde-sampler/dialogs/passwd.py b/python/pykde/examples/pykde-sampler/dialogs/passwd.py deleted file mode 100644 index 554093b9..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/passwd.py +++ /dev/null @@ -1,34 +0,0 @@ -from qt import QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui import KPushButton, KPasswordDialog, KTextEdit - -iconName = 'password' -labelText = 'KPasswordDialog' -docParts = ('kdeui', '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(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Password Dialog'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/progress.py b/python/pykde/examples/pykde-sampler/dialogs/progress.py deleted file mode 100644 index ba85b8eb..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/progress.py +++ /dev/null @@ -1,39 +0,0 @@ -iconName = 'go' -labelText = 'KProgressDialog' - - -from qt import QFrame, QHBoxLayout, QVBoxLayout, QTimer, SIGNAL -from kdecore import i18n -from kdeui import KPushButton, KProgressDialog, KTextEdit - - -helpText = """KDE provides a ready-built dialog to display a bit of text and a -progress bar.""" - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Progress Dialog'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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 = QTimer(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/python/pykde/examples/pykde-sampler/dialogs/tip.py b/python/pykde/examples/pykde-sampler/dialogs/tip.py deleted file mode 100644 index 29ac66b7..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/tip.py +++ /dev/null @@ -1,31 +0,0 @@ -iconName = 'idea' -labelText = 'KTipDialog' - -import os - -from qt import QFrame, QHBoxLayout, QVBoxLayout, SIGNAL -from kdecore import i18n -from kdeui import KPushButton, KTipDatabase, KTipDialog, KTextEdit - - -helpText = ("The KDE standard Tip-of-the-Day dialog.") - - -class MainFrame(QFrame): - def __init__(self, parent=None): - QFrame.__init__(self, parent) - self.button = KPushButton(i18n('Show Tip-of-the-Day Dialog'), self) - self.help = KTextEdit(helpText, '', self) - layout = QVBoxLayout(self, 4) - layout.addWidget(self.help) - buttonlayout = QHBoxLayout(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/python/pykde/examples/pykde-sampler/dialogs/tips b/python/pykde/examples/pykde-sampler/dialogs/tips deleted file mode 100644 index 9f24457a..00000000 --- a/python/pykde/examples/pykde-sampler/dialogs/tips +++ /dev/null @@ -1,24 +0,0 @@ - -<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> |