[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Working with sub-windows
From: Barry Scott <barry () barrys-emacs ! org>
Date: 2018-01-22 19:04:44
Message-ID: E6F0FB78-66D8-4353-AB40-9F94F77E1274 () barrys-emacs ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On 19 Jan 2018, at 09:30, Alain Muls <alain.muls@gmail.com> wrote:
>
> Hi All
>
> I am working on a pyqt script that next to a mainwindow opens several separate sub \
> windows. A worker script is running in a separate thread and sends signals which \
> connect to different slots. These slots can be located in sub-windows which are not \
> necessarily created at the instance the signal-slot connection is made.
> A problem arises for which I would get a correct solution (I circumvent them for \
> now):
> to avoid a problem with the signal-slot connection I do a test on the sub-window, \
> which I initialize to None at startup, before connecting, doing
> if subWindow is not None:
> connect signal to slot
>
> If I open the window I create the connection from the MainWindow, but here I have \
> to check whether the worker script is already active (done by opening a file) for \
> which I also perform an init to None and a similar check.
> Now I wonder what happens when I close the sub-window, will its value ecome None \
> again ? Also, from whatever side I try to create the connection, I perform a check \
> on something else being 'None' and I think this is not the correct approach.
I think this is what you have.
A main window that is always visible.
1 or more background tasks that are outputting something.
Other windows that come and go that show the output of the background tasks.
What I would do is feed the output of the background tasks into a buffer that is used \
as the basis of what will be drawn. When the user requests a window to show the \
background task do the following: 1. Create the Window
2. set a pointer to the background task buffer from which to draw the windows \
contents 3. connect all the signals you need. Probable including a buffer changed \
signal.
If the user closes the window undo the above.
Barry
>
> Tx for your help
> Alain
>
> --
>
> <logorma-transparent-scaled.png>
> Alain Muls
> Professor
> Department CISS
> Royal Military Academy
> p: +32 244 13936
> a: Renaissance Avenue 30
> B1000 Brussels (Belgium)
> w: www.rma.ac.be/ciss/en/ <http://www.rma.ac.be/ciss/en/> e: alain.muls@rma.ac.be \
> <mailto:alain.muls@rma.ac.be>_______________________________________________ PyQt \
> mailing list PyQt@riverbankcomputing.com \
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[Attachment #5 (unknown)]
<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; line-break: after-white-space;" class=""><br class=""><div><br \
class=""><blockquote type="cite" class=""><div class="">On 19 Jan 2018, at 09:30, \
Alain Muls <<a href="mailto:alain.muls@gmail.com" \
class="">alain.muls@gmail.com</a>> wrote:</div><br \
class="Apple-interchange-newline"><div class="">
<meta http-equiv="content-type" content="text/html; charset=utf-8" class="">
<div text="#000000" bgcolor="#FFFFFF" class=""><p class="">Hi All</p><p class="">I \
am working on a pyqt script that next to a mainwindow opens several separate sub \
windows. A worker script is running in a separate thread and sends signals which \
connect to different slots. These slots can be located in sub-windows which are not
necessarily created at the instance the signal-slot connection is
made.</p><p class="">A problem arises for which I would get a correct solution \
(I circumvent them for now):</p>
<ul class="">
<li class="">to avoid a problem with the signal-slot connection I do a test
on the sub-window, which I initialize to None at startup, before
connecting, doing<br class="">
<br class="">
if subWindow is not None:<br class="">
connect signal to slot<br class="">
<br class="">
If I open the window I create the connection from the
MainWindow, but here I have to check whether the worker script
is already active (done by opening a file) for which I also
perform an init to None and a similar check.<br class="">
<br class="">
Now I wonder what happens when I close the sub-window, will its
value ecome None again ?<br class="">
Also, from whatever side I try to create the connection, I
perform a check on something else being 'None' and I think this
is not the correct approach.<br \
class=""></li></ul></div></div></blockquote><div><br class=""></div><div>I think this \
is what you have.</div><div><br class=""></div><div>A main window that is always \
visible.</div><div>1 or more background tasks that are outputting \
something.</div><div>Other windows that come and go that show the output of the \
background tasks.</div><div><br class=""></div><div>What I would do is feed the \
output of the background tasks into a buffer that is used as the basis of what will \
be drawn.</div><div>When the user requests a window to show the background task do \
the following:</div><div>1. Create the Window</div><div>2. set a pointer to the \
background task buffer from which to draw the windows contents</div><div>3. connect \
all the signals you need. Probable including a buffer changed signal.</div><div><br \
class=""></div><div>If the user closes the window undo the above.</div><div><br \
class=""></div><div>Barry</div><div><br class=""></div><br class=""><blockquote \
type="cite" class=""><div class=""><div text="#000000" bgcolor="#FFFFFF" class=""><ul \
class=""><li class=""> </li>
</ul><p class="">Tx for your help<br class="">
Alain<br class="">
</p><p class=""><br class="">
</p>
<div class="moz-signature">-- <br class="">
<br class="">
<table style="background: none; border-width: 0px; border: 0px;
margin: 0; padding: 0; border-collapse: collapse; border-top:
1pt solid #F7751F; padding-top: 2px;" cellspacing="0" cellpadding="0" \
border="0" class=""> <tbody class="">
<tr class="">
<td style="padding-top: 0; padding-bottom: 0; padding-left:
0; padding-right: 7px; border-top: 0; border-bottom: 0:
border-left: 0; border-right: solid 3px #F7751F" valign="top" \
class=""><span id="cid:part1.0CB23D65.E117931F@gmail.com"><logorma-transparent-scaled.png></span></td>
<td style="padding-top: 0; padding-bottom: 0; padding-left:
12px; padding-right: 0;" class="">
<table style="background: none; border-width: 0px; border:
0px; margin: 0; padding: 0;" cellspacing="0" cellpadding="0" \
border="0" class=""> <tbody class="">
<tr class="">
<td colspan="2" style="padding-bottom: 5px; color:
#F7751F; font-size: 14px; font-family: Arial,
Helvetica, sans-serif;" class=""><strong class="">Alain \
Muls</strong></td> </tr>
<tr class="">
<td colspan="2" style="color: #333333; font-size:
11px; font-family: Arial, Helvetica, sans-serif;" class=""><i \
class="">Professor</i></td> </tr>
<tr class="">
<td colspan="2" style="color: #333333; font-size:
11px; font-family: Arial, Helvetica, sans-serif;" \
class="">Department CISS</td>
</tr>
<tr class="">
<td colspan="2" style="color: #333333; font-size:
11px; font-family: Arial, Helvetica, sans-serif;" \
class=""><strong class="">Royal Military Academy</strong></td>
</tr>
<tr class="">
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20" \
class="">p:</td> <td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top" class="">+32 244 13936</td>
</tr>
<tr class="">
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20" \
class="">a:</td> <td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top" class="">Renaissance Avenue 30</td>
</tr>
<tr class="">
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20" \
class=""> </td> <td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top" class="">B1000 Brussels \
(Belgium)</td> </tr>
<tr class="">
<td style="vertical-align: top; width: 20px; color:
#F7751F; font-size: 11px; font-family: Arial,
Helvetica, sans-serif;" valign="top" width="20" \
class="">w:</td> <td style="vertical-align: top; color: #333333;
font-size: 11px; font-family: Arial, Helvetica,
sans-serif;" valign="top" class=""><a \
href="http://www.rma.ac.be/ciss/en/" style=" color: #1da1db; text-decoration: none;
font-weight: normal; font-size: 11px;" \
class="">www.rma.ac.be/ciss/en/</a> <span style="color: #F7751F;" \
class="">e: </span><a href="mailto:alain.muls@rma.ac.be" style="color: #1da1db; \
text-decoration: none; font-weight:
normal; font-size: 11px;" \
class="">alain.muls@rma.ac.be</a></td> </tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
_______________________________________________<br class="">PyQt mailing list \
<a href="mailto:PyQt@riverbankcomputing.com" \
class="">PyQt@riverbankcomputing.com</a><br class=""><a \
href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
class="">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></div></blockquote></div><br \
class=""></body></html>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic