473,657 Members | 2,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About the slot declaration decorator in PyQt4

I remember when I did UI Design in PyQt4 for the first time, I found a
manual. In it, no "connect" was used. Instead, an OO approach is
applied, new UI classes inherit from old ones, and all the slot
functions are automatically connected to some signals, using a
decorator. In the __init__ function of our newly written class,
"connect" is not invoked.

I like this style...

Unfortunately, I cannot find that manual now.... So anyone have read
something like that before? If so, could you tell me where can I find
that manual please? Thank you :)
Jul 14 '08 #1
2 2199
Bighead <Xu*********@gm ail.com>:
I remember when I did UI Design in PyQt4 for the first time, I found a
manual. In it, no "connect" was used. Instead, an OO approach is
applied, new UI classes inherit from old ones, and all the slot
functions are automatically connected to some signals, using a
decorator. In the __init__ function of our newly written class,
"connect" is not invoked.

I like this style...

Unfortunately, I cannot find that manual now.... So anyone have read
something like that before? If so, could you tell me where can I find
that manual please? Thank you :)
I guess, you're referring to QtCore.pyqtSign ature and
QtCore.QMetaObj ect.connectSlot sByName.

See
http://www.riverbankcomputing.co.uk/...ture-decorator

Especially "3.7.3 Connecting Slots By Name"

Hih

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
Jul 14 '08 #2
On Jul 15, 2:04 am, "Sebastian \"lunar\" Wiesner"
<basti.wies...@ gmx.netwrote:
Bighead <Xue.Huic...@gm ail.com>:
I remember when I did UI Design in PyQt4 for the first time, I found a
manual. In it, no "connect" was used. Instead, an OO approach is
applied, new UI classes inherit from old ones, and all the slot
functions are automatically connected to some signals, using a
decorator. In the __init__ function of our newly written class,
"connect" is not invoked.
I like this style...
Unfortunately, I cannot find that manual now.... So anyone have read
something like that before? If so, could you tell me where can I find
that manual please? Thank you :)

I guess, you're referring to QtCore.pyqtSign ature and
QtCore.QMetaObj ect.connectSlot sByName.

Seehttp://www.riverbankco mputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#t ...

Especially "3.7.3 Connecting Slots By Name"

Hih

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
Oh yes, that's it! connectSlotsByN ame. That is the reason I though Qt
was easy to use.

This will be much easier :) Thank you very much.
Jul 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1566
by: Paul Morrow | last post by:
I like many am not wild about the <at> operator. I also don't think that the decorator syntax should be so directly attached to the method, since what we're trying to do is to say something about the *relationship between* a method and a class (e.g. "method m is a staticmethod of class C"). So if we are going to extend the Python grammar to support this sort of thing (which I believe is a good idea), my preference would be to introduce...
161
7806
by: KraftDiner | last post by:
I was under the assumption that everything in python was a refrence... so if I code this: lst = for i in lst: if i==2: i = 4 print lst I though the contents of lst would be modified.. (After reading that
3
2083
by: Tina I | last post by:
I'm trying to 'convert' my self from Qt3 to Qt4 (it rocks!) and one thing seem strange: With Qt3 I usually did "from qt import *", but this does not seem to work with Qt4. I have to use "from PyQt4 import QtGui , QtCore" and also have to use "QtCore.something". Like when connecting a button: self.connect(self.ui.testButton, QtCore.SIGNAL("clicked()"), self.doSomething)
0
1937
by: Pradnyesh Sawant | last post by:
Hello, i've written a small pyqt code which increments a counter in the backend, and prints it on the frontend. However, i'm passing a dummy string var along with it in the signal/slot mechanism. The problem is that from the 2nd call onwards, the string gets printed, but NOT in the 1st call. (eg, in the foll code i get:- 1, (2, 'a'), (3, 'a'), ...) The code is:- ************************************************** import time import sys
2
2251
by: Pradnyesh Sawant | last post by:
Hello, I have a pyqt4 code in which i'm trying the signal/slot mechanism. The (stripped) code is as follows: class D(QtCore.QThread): def __init__(self): QtCore.QThread.__init__(self) tpl = ("Primary", "priSec") print "tpl:", tpl self.emit(QtCore.SIGNAL("setLabel"), tpl)
0
1378
by: Pradnyesh Sawant | last post by:
Hello, i have the following code: ################################################################# import time import sys from PyQt4 import QtGui, QtCore class Counter(QtCore.QThread): def __init__(self): QtCore.QThread.__init__(self) def run(self):
2
3258
by: jiang.haiyun | last post by:
Hi, I am having some serious problems with PyQT4, when i run pyqt script, I always get 'Segmentation fault'. the script is simple: ====================== %less qttest.py from PyQt4 import QtGui, QtCore import sys
2
3706
by: Alexander Eisenhuth | last post by:
Hello pyqt users, i tried to use signal / slot across threads. With the following example I want to emit a signal when the thread loop is entered. The connected slot is never called. Why? Any help is very welcome ... Alexander
0
3364
by: kunalgalav | last post by:
Hi , I am a newbie to python and I am trying to send a signal to my application using a thread. Here's my code: import sys from PyQt4 import QtGui, QtCore from PyQt4.QtCore import * class MyThread(QtCore.QThread,QtCore.QObject): def __init__(self, parent):
0
8395
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.