Thanks Justin, it really helped me:

Just because all the examples were showing it like that, I was using:

asset_name, ok = QtGui.QInputDialog.getText(
    self,
    "Enter new asset name",
    "Asset name:"
)

to create a modal dialog. But as you suggested, using this:

input_dialog = QtGui.QInputDialog(self)
asset_name, ok = input_dialog.getText(
    self,
    "Enter new asset name",
    "Asset name:"
)

now I'm able to use the "input_dialog" to reach the input dialog. It was so
simple.

Thank you very much...

E.Ozgur Yilmaz
Lead Technical Director
eoyilmaz.blogspot.com



On Tue, Nov 22, 2011 at 7:35 PM, Justin Israel <[email protected]>wrote:

> How are you calling you QInputDialog?
> My guess is that you are using the static convenience methods (or exec_)
> which cause your dialog to become modal, and thus block the main
> application.
> What you probably want to do is:
>
> self.d = QInputDialog(self)
> self.d.setModal(False)
> self.d.show()
>
> At this point you can either decide to set a connection to a slot to
> handle when the window is closed,
> or subclass it and overload your own accept() method.
>
> # setting a connection
> self.d.accepted.connect(handleInputMethod)
>
> def handleInputMethod(self):
> print self.d.textValue()
>
> The static methods are good for when you don't need any special access or
> functionality from the dialog, as it creates it behind the scenes, blocks,
> and just returns the value and whether it was accepted or rejected.
>
>
>
>
> On Nov 22, 2011, at 8:53 AM, Erkan Özgür Yılmaz wrote:
>
> Hi everybody,
>
> I'm re-writing our asset management system with all its Qt interfaces, and
> this time I used TDD practices. I'm stuck at testing QInputDialog. I can
> test a lot of other UI elements (for example, to test if they are enabled
> or showing the correct item etc.).
>
> The problem is when I create the dialog everything stops working and is
> waiting for the UI to close. I've tried using threading an created a thread
> to call the QInputDialog in and created another one to test it but because
> there is no way to reach the dialog it self I can not test if it is shown
> and has the correct data in it.
>
> So is there a way to reach the QInputDialog from the dialog it self?
>
> Thanks...
>
> E.Ozgur Yilmaz
> Lead Technical Director
> eoyilmaz.blogspot.com
>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
>
>  --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to