Arh, had that a few times in the past.  From what I remember it was due to
bad inheritance (Try a QDialog).  I think I had it when I was using
QTabWidget and I hadn't set the allowed area's correctly.

-Dave



On Thu, Aug 5, 2010 at 10:06 PM, <br...@meljunky.com> wrote:

>  Figured out the "_" thing, guess I should grab working code
> online. Appears uic.compileUI does use pyuic4
>
> No, it doesnt run everytime an instance is made. Well, plan on
> making compile Ui files when a py is not found.
>
> Now, the window (partically displayed) is literaly embeded in the top left
> corner of Maya making it unuseable.
>
> Thanks,
> -brian
>
>
> -------- Original Message --------
> Subject: Re: [Maya-Python] Calling a compiled QT file in Maya
> From: David Moulder <da...@thirstydevil.co.uk>
> Date: Thu, August 05, 2010 10:55 am
> To: python_inside_maya@googlegroups.com
>
> To parent your window you well need to get the Maya main window and pass
> that in as the parent widget
>
> > 2011
>
> def GetMayaMainWindow():
>     '''
>     :returns: The QtWidget that pertains to the Maya Main Window
>     '''
>     import maya.OpenMayaUI as mui
>     import sip
>     ptr = mui.MQtUtil.mainWindow()
>     if ptr:
>         return sip.wrapinstance(long(ptr), QtCore.QObject)
>
> Then pass the resulting QWidget into your class
>
> eg
> a = Browser(GetMayaMainWindow())
>
> I don't know about uic.compileUI as I pre compile all my ui files with the
> pyuic4.exe from the command line.
>
> Well, not exactly.  I wrote a PyQt ui to browser and convert them on double
> click using os.system
>
> cmd = 'pyuic4 %s > %s' % (DesignFile, OutPutFile)
> os.system(cmd)
>
> To be honest, it was on of the 1st things I did so I've never looked at
> another way to convert files.  Does your method convert each and every time
> you make an instance?
>
> -Dave
>
>
> On Thu, Aug 5, 2010 at 5:18 PM, <br...@meljunky.com> wrote:
>
>>  I edited the class below to reference the class for my browser using the
>> following lines of code to show the window:
>>
>> a = Browser()
>>  a.show()
>>
>> Two things happen.. first the window does not stay "parented" to the main
>> Maya window and will disappear under Maya.
>>
>> Second... using the compiled version of calculatorform that comes with Qt
>> works fine. However, when I used uic.compileUi to complile the
>> calculatorform.ui. I get the following error:
>>
>> # Error: ... global name '_' is not defined #
>>
>> The compiler added a '_' that doesn't belong. For example:
>>
>> CalculatorForm.setWindowTitle(_( u"Calculator Form"))
>>
>> If I removed the '_', it will open.
>>
>> Also, on a ui that I created I had to comment out the following lines
>> because:
>> test.setCentralWidget(self.centralwidget)
>> test.setMenuBar(self.menubar)
>> test.setStatusBar(self.statusbar)
>>
>> They cause a Attribute Error such as:
>> # Error: AttributeError ... 'Browser' object has no attribute
>> 'setCentralWidget' #
>>
>> Is there a way to get a compiled version of a Ui to open without having to
>> edit the file?
>>
>> Thanks,
>> -brian
>>
>>
>>   -------- Original Message --------
>> Subject: Re: [Maya-Python] Calling a compiled QT file in Maya
>> From: David Moulder <da...@thirstydevil.co.uk>
>> Date: Thu, August 05, 2010 8:09 am
>> To: python_inside_maya@googlegroups.com
>>
>> I use multiple inheritance...
>>
>> import ui_Browser
>> class Browser(QtGui.QWidget, ui_Browser.Ui_Form):
>>     def __init__(self, parent=None):
>>         super(Browser, self).__init__(parent)
>>         self.setupUi(self)
>>         self.setObjectName('Browser')
>>         self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
>>
>> -Dave
>>
>> On Thu, Aug 5, 2010 at 2:39 PM, meljunky <br...@meljunky.com> wrote:
>>
>>> Trying to get QT Ui file to work in Maya I could use the loadUI
>>> command for example:
>>>
>>> import maya.cmds as cmds
>>> dialog = cmds.loadUI(f=r'C:/Python26/Lib/site-packages/PyQt4/examples/
>>> designer/calculatorform/calculatorform.ui')
>>> cmds.showWindow(dialog)
>>>
>>> Don't expect the calculator to actually work but the UI opens in Maya.
>>> But, I want to be able to edit UI elements so I used uic.compileUi to
>>> convert the file into a Python file in hopes to make method calls to
>>> add and remove UI elements while the window is open.
>>>
>>> The first four lines are:
>>> from PyQt4 import QtCore, QtGui
>>>
>>> class Ui_CalculatorForm(object):
>>>    def setupUi(self, CalculatorForm):
>>>        ...
>>>
>>> At this point I don't know how to call the Ui_CalculatorForm class
>>> method setupUi since it needs a different class called CalculatorForm.
>>>
>>> Thanks in advance.
>>>
>>> --
>>> http://groups.google.com/group/python_inside_maya
>>>
>>
>>
>>
>> --
>> David Moulder
>> http://www.google.com/profiles/squish3d
>> --
>> http://groups.google.com/group/python_inside_maya
>>
>>   --
>> http://groups.google.com/group/python_inside_maya
>>
>
>
>
> --
> David Moulder
> http://www.google.com/profiles/squish3d
> --
> http://groups.google.com/group/python_inside_maya
>
>  --
> http://groups.google.com/group/python_inside_maya
>



-- 
David Moulder
http://www.google.com/profiles/squish3d

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to