connecting clicked signal to different slots depending on function executing

2013-09-01 Thread tausciam
I have one tablewidget I want to use for two different uses, audio and video. 
If cover art is displayed and the user clicks the cover art, it emits a cell 
clicked and gets the list of the songs. If video thumbnails are displayed, it 
emits a cell clicked and plays the video fullscreen.

So, I have the same signal going to two different slots. Is there any way to 
break that connection before I define it again? In other words, in the audio 
section I could have something like:

[break video signal/slot connection]
self.tableWidget.cellClicked.connect(self.audiocell_clicked)

and then for the video section:

[break audio signal/slot connection]
self.tableWidget.cellClicked.connect(self.videocell_clicked)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: connecting clicked signal to different slots depending on function executing

2013-09-01 Thread tausciam
Nevermind. I found that it would let me create the connection again then 
when I disconnected, it would disconnect all of the instances...

so I ended up with: 

self.tableWidget.cellClicked.connect(self.videocell_clicked)   
self.tableWidget.cellClicked.disconnect(self.videocell_clicked)   
self.tableWidget.cellClicked.connect(self.audiocell_clicked)

If there's a better way to do this, I'd be interested in hearing about it. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: connecting clicked signal to different slots depending on function executing

2013-09-01 Thread tausciam
I should add that I know about:

self.tableWidget.cellClicked.disconnect(self.videocell_clicked)  

but, when I do that, if the connection is not there, then the program crashes. 
So, how could I check to see if the connection is there then break it?
-- 
http://mail.python.org/mailman/listinfo/python-list