~ubuntu-branches/ubuntu/karmic/python-kde3/karmic

« back to all changes in this revision

Viewing changes to examples/pykde-sampler/misc/passivepop.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-11-22 19:03:34 UTC
  • mfrom: (1.1.5 upstream) (3.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20061122190334-z7nhzu4dca926iam
Tags: 3.16.0-0ubuntu1
* New upstream release
* Build-depend on pyqt 3.17 and sip 4.5
* Add build-depends on /usr/lib/kde3/libkonsolepart.so
* Don't build for python 2.5, it fails to build
* Merge with Debian, remaining change:
  - kubuntu_01_dcop.diff patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from qt import Qt, QFrame, QHBoxLayout, QVBoxLayout, QLabel, SIGNAL
 
2
from kdeui import KPassivePopup, KTextEdit, KPushButton
 
3
from kdecore import KGlobal, KIcon
 
4
 
 
5
iconName = 'popup'
 
6
labelText = 'KPassivePopup'
 
7
docParts = ('kdeui', 'KPassivePopup')
 
8
helpText = ('Examples of the KPassivePopup widget.')
 
9
 
 
10
 
 
11
class MainFrame(QFrame):
 
12
    def __init__(self, parent=None):
 
13
        QFrame.__init__(self, parent)
 
14
        self.help = KTextEdit(helpText, '', self)
 
15
        self.button = KPushButton('Show Passive Popups', self)
 
16
        
 
17
        layout = QVBoxLayout(self, 4)
 
18
        layout.addWidget(self.help, 10)
 
19
        buttonLayout = QHBoxLayout(layout, 4)
 
20
        buttonLayout.addWidget(self.button, 1)
 
21
        buttonLayout.addStretch(10)
 
22
        layout.addStretch(10)
 
23
 
 
24
 
 
25
        self.connect(self.button, SIGNAL('clicked()'), self.showPopups)
 
26
 
 
27
 
 
28
    def showPopups(self):
 
29
        ## no support for all of the 3.5 calls
 
30
        pop = KPassivePopup.message('Hello, <i>KPassivePopup</i>', self)
 
31
        pop.setTimeout(3000)
 
32
        pop.show()
 
33
 
 
34
        
 
35
        pos = pop.pos()
 
36
        pos.setY(pos.y() + pop.height() + 10)
 
37
        
 
38
        ico = KGlobal.instance().iconLoader().loadIcon('help', KIcon.NoGroup,
 
39
                                                       KIcon.SizeSmall)
 
40
        pop = KPassivePopup.message('<b>Hello</b>', 'With Icons', ico, self)
 
41
        pop.setTimeout(3000)
 
42
        pop.show()
 
43
        pop.move(pos)