This is a work for a decorator, much simpler and clean ;-)

On Fri, Oct 19, 2012 at 11:45 PM, Eric Thivierge <[email protected]>wrote:

> As a note I would recommend putting it in a try / finally statement to
> ensure it gets set back even if part of it fails unless it does this
> automatically:
>
> #Python
> def launchFileBrowser(self):
>     try:
>         # suspend control hooks so our filedialog looks normal
>         desktop = Application.Desktop
>         desktop.SuspendWin32ControlsHook()
>
>         # call the filedialog
>         self.fileDialog = QFileDialog(self)
>         sourceDir = self.fileDialog.getExistingDirectory(None,'Choose a
> directory')
>     finally:
>         # restore control hooks
>         desktop.RestoreWin32ControlsHook()
>
>
> --------------------------------------------
> Eric Thivierge
> http://www.ethivierge.com
>
>
>
> On Sat, Oct 20, 2012 at 1:12 AM, Tim Crowson <
> [email protected]> wrote:
>
>>  Had that same problem. Here's what your Python code might look like
>> using the method Jo describes. This works for me.
>>
>> *    def launchFileBrowser(self):
>>         # suspend control hooks so our filedialog looks normal
>>         desktop = Application.Desktop
>>         desktop.SuspendWin32ControlsHook()
>>
>>         # call the filedialog
>>         self.fileDialog = QFileDialog(self)
>>         sourceDir = self.fileDialog.getExistingDirectory(None,'Choose a
>> directory')
>>
>>         # restore control hooks
>>         desktop.RestoreWin32ControlsHook()*
>>
>>
>> *Tim Crowson
>> **Lead CG Artist*
>>
>> *Magnetic Dreams Animation Studio, Inc.
>> *2525 Lebanon Pike, Building C. Nashville, TN 37214
>> *Ph*  615.885.6801 | *Fax*  615.889.4768 | www.magneticdreams.com
>> [email protected]
>>
>

Reply via email to