[PySide] determine if pyside is run as standalone or inside of host app
Frank Rueter | OHUfx
frank at ohufx.com
Wed Jul 16 00:57:40 CEST 2014
yes, it did, thank's a lot for nudging me in the right direction.
Getting my head back into PySide again now.
Cheers,
frank
On 16/07/14 3:52 AM, Sean Fisk wrote:
> No problem! Hope it works out for you!
>
>
> --
> Sean Fisk
>
>
> On Sun, Jul 13, 2014 at 7:47 PM, Frank Rueter | OHUfx <frank at ohufx.com
> <mailto:frank at ohufx.com>> wrote:
>
> Ah, of course, much tidier. I will do that, thanks Sean!
>
>
> On 14/07/14 2:17 AM, Sean Fisk wrote:
>> Hi Frank,
>>
>> I would go for a different architecture if possible. Have you
>> considered giving TestWidget a signal which gets connected to
>> app.quit() in the standalone application? In the host
>> application, just don't connect it to anything. You could name
>> the signal 'quit_requested' or something like that, but adapt it
>> to your scenario. I'm not sure if this is possible in your
>> situation; just a suggestion.
>>
>> - Sean
>>
>>
>> --
>> Sean Fisk
>>
>>
>> On Sun, Jul 13, 2014 at 9:19 AM, Frank Rueter | OHUfx
>> <frank at ohufx.com <mailto:frank at ohufx.com>> wrote:
>>
>> Hi,
>>
>> I have a QWidget that uses
>> self.setWindowFlags(QtCore.Qt.Popup)
>>
>> This causes the widget to not quit the QApplication when it
>> closes even
>> though it's the main widget.
>> I can put something like QtGui.QApplication.instance().quit()
>> into the
>> appropriate event to ensure the application closes properly,
>> but most of
>> the time this widget will be run from inside a host
>> application, not as
>> a standalone app, so closing the application instance would
>> have fatal
>> consequences for the user.
>>
>> What would be the best way to determine whether the widget is
>> run as a
>> standalone, and I can quite the application safely, or if
>> it's run from
>> inside a host app?
>> In my current scenario I could check
>> QtGui.QApplication.applicationFilePath() for the host
>> applications that
>> this is mostly going to be run from, but if somebody else
>> imports my
>> code into an app I didn't cater for, my QWidget will quit
>> that when the
>> widget closes, until I include the particular host in my code
>> logic.
>>
>> Here is a simple example that always manually quits the
>> application
>> (when I need ti be clever and not quit if it's run from
>> inside a host):
>> http://pastebin.com/48y7nqc2
>>
>> What's the best way to go about this?
>>
>> Cheers,
>> frank
>>
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org <mailto:PySide at qt-project.org>
>> http://lists.qt-project.org/mailman/listinfo/pyside
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140716/86eb985e/attachment.html>
More information about the PySide
mailing list