If you want to narrow it down to the actual perpetrators, I believe it's
all down to 2 widgets that are adding their own Layout with margins.

They both happen to have a QGridLayout, so you could test for that and only
change the margins when you come across a QGridLayout.

http://pastebin.com/UX4idRBC

Still hacky, but it might help you narrow it down to the actual
perpetrators.



On Fri, Dec 20, 2013 at 6:58 PM, Jesse Kretschmer <je...@krets.com> wrote:

> Wow, that's perfect. I can definitely imagine that it might do some
> undesired damage to the layout, however, the example works perfectly in my
> situation.
>
> For posterity, I'll explain it in more detail. Nuke's offers a command to
> use a QWidget as a panel (PythonPanel) in the UI. This is done with
> nukescripts.panels.registerWidgetAsPanel('WidgetName','Label
> Name','uniqueID'). The parent is not available in the constructor, but it
> should be available when the widget is finally shown. So by re-implementing
> the showEvent on the QWidget subclass, there is finally access to parent
> widget, and therefore the margins. It just so happens, that there are many
> parent widgets adding these annoying margins.
>
> I consider this a hacky solution, but it's not overly complicated. I like
> it. Thanks for the help Frank.
>
> I might try to do some more introspection to see if there is any way to
> identify and adjust only the relevant ancestral perpetrators.
>
> Cheers,
> Jesse
>
>
> On Fri, Dec 20, 2013 at 5:43 PM, Frank Rueter <fr...@beingfrank.info>wrote:
>
>>  Hi Jesse,
>>
>> you can use, say, the showEvent() to loop over the widget's ancestors and
>> set all their layouts' content margins to 0. What you are seeing is an
>> accumulation of a bunch of (4 or 5) layouts' contents margins.
>>
>> Here is a brute force example (there may be side effects, or it may just
>> work, let us know):
>> http://pastebin.com/pXcDP4v9
>>
>>
>> Cheers,
>> frank
>>
>>
>>
>>
>> On 21/12/13 13:42, Jesse Kretschmer wrote:
>>
>> I do think this is related to the contents margins of the parent layout,
>> so that's on the right track. Unfortunately I can't figure out how to walk
>> up the tree to find the parent layout.
>>
>>  The properties panel is filled almost edge-to-edge. Given that, it must
>> be possible (somehow) with their panel system.
>>
>>  It does not seem to be user controllable now that I've read the source
>> for 
>> PythonPanel<http://docs.thefoundry.co.uk/nuke/70/pythonreference/nukescripts.panels-pysrc.html#PythonPanel>.
>> I'm just hoping some nuke/qt hacker has a trick to navigate up the UI
>> stack. Nuke seems to use a pyui module for all the ui stuff in python. (It
>> does not seem to be the same pyui as http://pyui.sf.net)
>>
>>
>> On Fri, Dec 20, 2013 at 3:02 PM, Den Serras <denserras...@gmail.com>wrote:
>>
>>> Can you use layout.setContentsMargin()?
>>>
>>>
>>> On Friday, December 20, 2013, Jesse Kretschmer wrote:
>>>
>>>>  Also, here's an image if anyone is interested in seeing what I mean
>>>> without running the code:
>>>> http://i.imgur.com/FIk503r.png
>>>>
>>>>
>>>> On Fri, Dec 20, 2013 at 11:40 AM, Jesse Kretschmer <je...@krets.com>wrote:
>>>>
>>>>> I have a python panel with a QWidget. I would like to find a way to
>>>>> get back some real estate. The margin is larger than I'd like (roughly 20
>>>>> pixels).
>>>>> Does anyone know of a way to reduce the margin of a PythonPanel?
>>>>> Example Code: http://pastebin.com/buGcJypr
>>>>> Thanks,Jesse
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Nuke-python mailing list
>>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>>
>>>
>>
>>
>> _______________________________________________
>> Nuke-python mailing listnuke-pyt...@support.thefoundry.co.uk, 
>> http://forums.thefoundry.co.uk/http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
>>
>> _______________________________________________
>> Nuke-python mailing list
>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
>
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to