Call it on showEvent of your widget, e.g

class Example(QtGui.QWidget):
    def __init__(self, parent=None):
        super(Example, self).__init__(parent=parent)

    def showEvent(self, event):
        if not event.spontaneous():
            # Only need to fix margins when initially showing the
            # widget or docking to new panel, not spontaneous
            # showEvents like un-minimizing or switching desktops.
            nuke_marginfix(self)

On 20/05/17 00:42, Bruno-Pierre Jobin wrote:
This seems to be what I'm looking for, but I'm having a hard time
putting it all together. If I'm creating my panel inside my menu.py
instead of inside the module itself, will it work? Right now I'm getting
this error:

Traceback (most recent call last):
   File "/home/bpjobin/.nuke/menu.py", line 133, in <module>
     test = panel.customKnob.getObject().widget
AttributeError: 'NoneType' object has no attribute 'widget'


menu.py :

importfunctions

panel = nukescripts.panels.registerWidgetAsPanel(
         'test.Test',
         'Test',
         "com.bpjobin.test",
         True)
pane = nuke.getPaneFor("com.bpjobin.test")
panel.addToPane(pane)
test_panel = panel.customKnob.getObject().widget
functions._nuke_set_zero_margins(test_panel)


On Fri, May 19, 2017 at 9:21 AM, Fredrik Averpil <fred...@averpil.com
<mailto:fred...@averpil.com>> wrote:

    Check out the "_nuke_set_zero_margins" function here:
    
https://github.com/fredrikaverpil/pyvfx-boilerplate/blob/master/boilerplate.py
    
<https://github.com/fredrikaverpil/pyvfx-boilerplate/blob/master/boilerplate.py>


    fre 19 maj 2017 kl. 14:55 skrev Bruno-Pierre Jobin
    <bpjo...@gmail.com <mailto:bpjo...@gmail.com>>:

        It helps a little bit (I'm gaining around 5px). When I compare
        to a python panel though, it too has that bezel. Maybe it's
        deeper inside Nuke styling?

        On Fri, May 19, 2017 at 2:14 AM, Frank Rueter|OHUfx
        <fr...@ohufx.com <mailto:fr...@ohufx.com>> wrote:

            Have you tried setting your main widgets content margins to 0?
            E.g.:
                     layout = QVBoxLayout()
                     layout.setContentsMargins(0,0,0,0)




            On 18/05/17 8:10 AM, Bruno-Pierre Jobin wrote:
            Hi,

            I think this has been discussed before, but I can't find
            the thread. Is there a way to make a PySide widget take up
            the full width and height of the available space in a tab?


            ​
            ​Thank you!

            --
            Bruno-Pierre Jobin
            www.bpjobin.com <http://www.bpjobin.com>


            _______________________________________________
            Nuke-python mailing list
            Nuke-python@support.thefoundry.co.uk  
<mailto:Nuke-python@support.thefoundry.co.uk>,http://forums.thefoundry.co.uk/  
<http://forums.thefoundry.co.uk/>
            http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python  
<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python>


            _______________________________________________
            Nuke-python mailing list
            Nuke-python@support.thefoundry.co.uk
            <mailto:Nuke-python@support.thefoundry.co.uk>,
            http://forums.thefoundry.co.uk/
            <http://forums.thefoundry.co.uk/>
            http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
            
<http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python>




        --
        Bruno-Pierre Jobin
        www.bpjobin.com <http://www.bpjobin.com>
        _______________________________________________
        Nuke-python mailing list
        Nuke-python@support.thefoundry.co.uk
        <mailto:Nuke-python@support.thefoundry.co.uk>,
        http://forums.thefoundry.co.uk/ <http://forums.thefoundry.co.uk/>
        http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
        <http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python>


    _______________________________________________
    Nuke-python mailing list
    Nuke-python@support.thefoundry.co.uk
    <mailto:Nuke-python@support.thefoundry.co.uk>,
    http://forums.thefoundry.co.uk/ <http://forums.thefoundry.co.uk/>
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
    <http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python>




--
Bruno-Pierre Jobin
www.bpjobin.com <http://www.bpjobin.com>


_______________________________________________
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


--
ben dickson
2D TD | ben.dick...@rsp.com.au
rising sun pictures | www.rsp.com.au
_______________________________________________
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