Re: [Maya-Python] prompt save before opening a file?

2013-02-26 Thread Justin Israel
First check if the scene needs saving: cmds.file(q=True, modified=True) You can also check where it is saved: cmds.file(q=True, location=True) If it is modified, you can use the built-in command to handle all the logic of saving with dialogs: # What Maya uses when you choose the File

Re: [Maya-Python] About calling the super() function

2013-02-28 Thread Justin Israel
I first started out by doing the same thing, and replacing the bound method with another one. Nowadays I find it a bit messy and prefer the event filter approach if I am not subclassing the target object. Here are two example of the way you are trying to do it, followed by the event filter appr

Re: [Maya-Python] what does list[:] do ?

2013-03-01 Thread Justin Israel
+1 to the explanation by Chad. I also not too long ago realized the cool stuff you can do with slices, to overwrite and insert another slice into a list In [1]: aList = range(5) In [2]: print aList [0, 1, 2, 3, 4] In [3]: aList[3:] = ['a','b','c'] # insert, overwrite, and extend In [4]: pri

Re: [Maya-Python] How does sip API version works?

2013-03-03 Thread Justin Israel
Backwards compatibility. But you have to be aware that if you use an api 2 sip stuff in Maya it will kind of lock all pyqt4 scripts to needing it since its a persistent interpreter. If anyone else tried to write code again api 1 they will encounter crashes. On Mar 3, 2013 7:36 PM, "Panupat Chongst

Re: [Maya-Python] What does this decorator do?

2013-03-03 Thread Justin Israel
Pyqt4 let's you use any python callable as a slot. The decorator actually defines a c++ signature for it as a registered slot http://pythonxy.googlecode.com/hg-history/4ef4255f59b092a123a5788c821434d9fe94aee9/src/python/PyQt4/PLATLIB/PyQt4/doc/html/new_style_signals_slots.html#the-pyqtslot-decorat

Re: [Maya-Python] What does this decorator do?

2013-03-03 Thread Justin Israel
ing method. How can I find out more about methods > available in each widget so I can over ride it in my own class? The code > included with PyQt installation seems to be in binary. > > > > On Sun, Mar 3, 2013 at 3:24 PM, Justin Israel wrote: > >> Pyqt4 let's you use

Re: [Maya-Python] What does this decorator do?

2013-03-03 Thread Justin Israel
wrote: > For example, QComboBox currentIndexChanged signal give me an index. If I want > the signals to give additional values (maybe some string), which method am I > looking for? > > > > On Sun, Mar 3, 2013 at 4:33 PM, Justin Israel wrote: > It just means c++

Re: [Maya-Python] What does this decorator do?

2013-03-03 Thread Justin Israel
d style to connect it > ui.connect(myWidget, SIGNAL("panupat(blah)"), someMethod) > > I think I read somewhere about an "accept signal" method, is that what I > need to do? > > > > On Sun, Mar 3, 2013 at 5:02 PM, Justin Israel wrote: > >> current

Re: [Maya-Python] Maya Interfaces with Python

2013-03-04 Thread Justin Israel
Dictionaries are unsorted, but you can iterate over a sorted version like this: for name, widget in sorted(widget.iteritems()): ... This will sort on the keys. Also, from your snippet you can save a few steps of looping and converting your category names by just starting with a set: categori

Re: [Maya-Python] Making a scriptJob using the API

2013-03-04 Thread Justin Israel
What is slow about the qtimer? The api has the MMessage classes that do the same as script job On Mar 5, 2013 8:20 PM, "Te Wilson" wrote: > Hello, I was curious if it was possible to make a function similar to a > scriptJob using the api? The problem I am trying to solve is in my function > now

Re: [Maya-Python] Maya Interfaces with Python

2013-03-05 Thread Justin Israel
I don't see in your code where you are trying to loop over your layouts. You are just creating them and putting them into a widgets dict. So I assumed somewhere else in code you want to loop over the widgets dict with the names sorted. I might need to ask that you do the same and show the exact sec

Re: [Maya-Python] Add an icon to the mouse cursor

2013-03-05 Thread Justin Israel
You can use button.setCursor() and pass it a QCursor with either one of the built-in shapes or a custom pixmap http://qt-project.org/doc/qt-4.8/qwidget.html#cursor-prop This will add it as a cursor just for that widget. On Mar 6, 2013 1:53 AM, "CharlieWales" wrote: > Is it posibble to add an ic

Re: [Maya-Python] pyQt uic error

2013-03-05 Thread Justin Israel
Is that the entire traceback? Have you tried it from the command line with pyuic? pyuic c:\testMayaQT.ui -o testMayaQTUI.py On Mar 6, 2013 1:58 AM, "John VanDerZalm" wrote: > hi all just having a problem running .ui file in QT, > > if i run > > from PyQt4 import QtGui,QtCore, uic > > uifile = 'c

Re: [Maya-Python] pyQt uic error

2013-03-05 Thread Justin Israel
; > actaully can anyone tell me why windows has this issue? and how do people > deal with windows paths i'm building on a linux enviroment and try map it > over to windows. > > alot of the time i'm using > %MY_CUSTOM_BasePATH_VARIABLE%\pathToMyFile\file.file > > ex

Re: [Maya-Python] GridLayout - different widths

2013-03-06 Thread Justin Israel
GridLayout: http://download.autodesk.com/us/maya/2011help/CommandsPython/gridLayout.html#flagcellWidth " This layout arranges children in a grid fashion where every cell in the grid is the same size. You may specify the number of rows and columns as well as the width and height of the grid cells.

Re: [Maya-Python] QProgressBar

2013-03-06 Thread Justin Israel
Does the avconv output give you textual progress? If so, you would need to be reading from the subprocess or QProcess as it runs, parsing the progress value and setting that value on your progress meter. QProcess will emit signals as new output is ready from the command, whereas a subprocess would

Re: [Maya-Python] Maya Interfaces with Python

2013-03-06 Thread Justin Israel
I'm assuming your niceName is what you want to sort on: niceName = icon.partition(".")[0] This means you basically just want to sort on the filenames in general. So you would want to change this from: for icon in icons: to... for icon in sorted(icons): Is that what you are after? Now y

Re: [Maya-Python] Draw bezier curve in qt

2013-03-07 Thread Justin Israel
Ya, QPainterPath provides "cubicTo": http://qt-project.org/doc/qt-4.8/qpainterpath.html#cubicTo "Adds a cubic Bezier curve between the current position and the given * endPoint* using the control points specified by *c1*, and*c2*." What do you mean by using an SVG as a QRect? Do you meant to get a

Re: [Maya-Python] Draw bezier curve in qt

2013-03-07 Thread Justin Israel
> On Fri, Mar 8, 2013 at 11:03 AM, Justin Israel wrote: > >> Ya, QPainterPath provides "cubicTo": >> http://qt-project.org/doc/qt-4.8/qpainterpath.html#cubicTo >> "Adds a cubic Bezier curve between the current position and the given * >> endPoi

Re: [Maya-Python] Digest for python_inside_maya@googlegroups.com - 16 Messages in 6 Topics

2013-03-08 Thread Justin Israel
The Maya Python Api 2.0 doc has a list of notes detailing the differences: http://docs.autodesk.com/MAYAUL/2013/ENU/Maya-API-Documentation/python-api/index.html The main syntax differences would be where they use return types instead of pointer/reference parameters, and python attributes instead

Re: [Maya-Python] How does sip API version works?

2013-03-11 Thread Justin Israel
g an api 1 version is actually reasonable or if I should > be pushing for our studio to use api 2 internally (would be a fair bit of > work at this point...particularly given theres *at least* 1 other 3rd > party package that uses api 1 as well). Would love some opinions... > >

Re: [Maya-Python] Re: Passing float variables in polyCreateFacet

2013-03-11 Thread Justin Israel
a1 = "%.3f" %wPos0[12] That is actually a string representation of a float to a precision of 3. So you are passing a string, but thought it was a float because of the print out. You should simply do: a1 = wPos0[12] or if you wanted to round to 3 precision: a1 = round(wPos0[12], 3) or just get y

Re: [Maya-Python] Re: Passing float variables in polyCreateFacet

2013-03-11 Thread Justin Israel
... That is: a = wPos0[12:15] b = wPos1[12:15] c = wPos2[12:15] cmds.polyCreateFacet( point=[a,b,c] ) On Tue, Mar 12, 2013 at 11:42 AM, Justin Israel wrote: > a1 = "%.3f" %wPos0[12] > > That is actually a string representation of a float to a precision of 3. > So you are

Re: [Maya-Python] Clip representation in Trax Editor

2013-03-13 Thread Justin Israel
You can do anything with QGraphics and painting :-) standard widgets only get you so far. You can also do painting in normal widgets. I did a visual EDL diff tool with qgraphics where it draws multiple timelines with clips and a play head. On Mar 13, 2013 5:28 PM, "kosing-cg" wrote: > Good day

Re: [Maya-Python] Re: Catch maya error before it happen

2013-03-13 Thread Justin Israel
Does catch actually catch warning, or just the errors? Warnings are kind of like print statements that trigger some UI color coding. If catch can see them then that's probably the way, since they aren't exceptions. On Mar 14, 2013 7:41 AM, "Jesse Capper" wrote: > You can use try/except statements

Re: [Maya-Python] how to drag and drop an icon from pyqt4 gui to maya shelf ?

2013-03-13 Thread Justin Israel
For the drag part, you will have to implement the standard drag event, a la: http://zetcode.com/tutorials/pyqt4/dragdrop/ I don't remember off hand what the drop callback on a native maya widget will receive, but you could print the *args and see. On Thu, Mar 14, 2013 at 2:26 AM, oglop wrote:

Re: [Maya-Python] commandPort result size

2013-03-13 Thread Justin Israel
The default buffer size for the commandPort is 4096. This means you should not expect to receive a response larger than the buffer, since maya will just return an error in that case. data = conn.recv(4096) This will receive up to 4096 bytes. You may get less. On Thu, Mar 14, 2013 at 2:56 PM, vu

Re: [Maya-Python] Re: commandPort result size

2013-03-13 Thread Justin Israel
I think you are misunderstanding how the recv method works. You do not have to know ahead of time exactly how many bytes are going to be returned to you. You just need to tell it how many bytes to try and read. You may get back less... import socket s = socket.socket(socket.AF_INET, socket.SOCK_ST

Re: [Maya-Python] Clip representation in Trax Editor

2013-03-14 Thread Justin Israel
need. > > On Wednesday, March 13, 2013, kosing-cg wrote: > On Wednesday, 13 March 2013 16:37:27 UTC+8, Justin Israel wrote: > > You can do anything with QGraphics and painting :-) > > > > standard widgets only get you so far. You can also do painting in normal > > wid

Re: [Maya-Python] Clip representation in Trax Editor

2013-03-14 Thread Justin Israel
30 PM, "Ravi Jagannadhan" wrote: > What about QML? (noob question) > > On Thu, Mar 14, 2013 at 12:20 AM, Justin Israel wrote: > >> You can definitely do custom paint event in QWidget. The only reason I >> decided to suggest QGraphics is because when you start

[Maya-Python] Re: python commandPort in __main__ with valid result

2013-03-14 Thread Justin Israel
exec() doesn't return anything. Do you need to set state on variables in the maya python interpreter, or just create a sphere? If you aren't interacting with code objects in the interpreter then you can just send: mc.sphere() Otherwise I think you have to do some extra work to save the stdout a

Re: [Maya-Python] Re: how to drag and drop an icon from pyqt4 gui to maya shelf ?

2013-03-14 Thread Justin Israel
They probably use internal Maya mimetypes the same way the outliner does, with pointers and stuff that don't make sense to anyone on the outside. So your drops aren't satisfying their mimetypes. On Mar 15, 2013, at 4:56 PM, Paul Winex wrote: > I tried to do it many times in many ways. Maya ign

[Maya-Python] Re: QProgressBar

2013-03-15 Thread Justin Israel
QProcess has signals that indicate when new data is ready to read from your process, allowing to to get line updates. Also, in your example, you are going to be blocking the event loop with your for loop. I put together an example of each of those for you here: https://gist.github.com/justinfx/5

Re: [Maya-Python] Maya gui in qt gui or visa versa.

2013-03-17 Thread Justin Israel
Someone asked this similar question not to long ago, and I wrote up an example of how to embed a model panel in your app: http://www.justinfx.com/2011/11/20/mixing-pyqt4-widgets-and-maya-ui-objects/ On Mon, Mar 18, 2013 at 1:55 PM, John VanDerZalm wrote: > Hi all has anyone used maya gui elemen

Re: [Maya-Python] Re: QProgressBar

2013-03-18 Thread Justin Israel
. > > Another thing i can't figure is why i have to say to subprocess -> > Shell=True. In your code you don't have it. but if i run it that way > i get an error : > > File "/usr/lib/python2.7/**subprocess.py", line 1249, in _execute_child > raise child

Re: [Maya-Python] QProgressBar

2013-03-18 Thread Justin Israel
ers > Ricardo Viana > > > On 03/18/2013 06:53 PM, Justin Israel wrote: >> Can you post a full example on pastsbin or gist? It sounds like something is >> happening before the event loop. >> Also for subprocess, you should pass the command as a list so you

Re: [Maya-Python] QProgressBar

2013-03-18 Thread Justin Israel
; > here is the latest. > > https://gist.github.com/RicardoViana/5190548 > > > > > > > On 03/18/2013 07:57 PM, Justin Israel wrote: > > This works fine as a test, when I change these lines: > > command = 'for i in {1..5}; do echo $i; sleep 1; do

Re: [Maya-Python] QProgressBar

2013-03-18 Thread Justin Israel
avconv use the StandardError instead > of standardOutput. So i used: > > out = str(proc.readAllStandardError()) > > > and it works like a charm. Next step is to figure a way to translate this > to a progress bar.. > > > thank you very much for the help. > > cheers &

Re: [Maya-Python] Re: An humble Maya Python API tutorial to voxelize your geometry.

2013-03-19 Thread Justin Israel
Nice tutorial I have one suggestion about the usage of the voxelIdList If you are using it as a lookup for the hash of previously seen items, using a list is going to be progressively slower and slower over time as the list grows, because doing "x in list" is O(n) complexity. You might want to use

Re: [Maya-Python] Executing Python code from iOS device through commandPort interface

2013-03-24 Thread Justin Israel
Thats pretty awesome. Nice job! The idiom for accessing stuff in the global namespace over commandPort has been something like this: cmd_template = "import __main__\nexec('''%s''', __main__.__dict__, __main__.__dict__)" cmd = cmd_template % "foo()" a la: https://github.com/justinfx/MayaSublime/b

Re: [Maya-Python] Re: PyQt progress bar need to update on subprocess

2013-03-25 Thread Justin Israel
Can you provide a small generic example that reproduces the problem? We don't need the production code. On Mar 26, 2013 4:54 AM, "DayDreamer" wrote: > On Friday, March 22, 2013 8:07:40 PM UTC+5:30, DayDreamer wrote: > > Hi, i have a Qt Ui(pyQt in use), which on click of a button launches a > subp

[Maya-Python] Weta Digital is hiring

2013-03-25 Thread Justin Israel
Hey all, Thought I would forward this posting for those interested, since this is a pretty savvy group of developers... Weta Digital is hiring a couple position, including some in my department (Production Engineering and Prod Eng Coordinator): http://www-ext.wetafx.co.nz/jobs They want a cou

[Maya-Python] Playing with dock widgets

2013-03-25 Thread Justin Israel
I started to write a Panel Manager for a current app, and was playing with the options I wanted to expose, and came up with a fun little example that I thought I would share for enjoyment: https://gist.github.com/justinfx/5241369 The default mode of this script acts like a normal dock widget co

Re: [Maya-Python] PyQt progress bar need to update on subprocess

2013-03-26 Thread Justin Israel
The start() method does allow you to pass an unbuffered flag to the process, though I am not seeing any issues when the process is returning small amounts of characters slowly over time. They all come in, which makes me wonder if the QProcess is already using a small buffer. On Mar 26, 2013, at

Re: [Maya-Python] Re: PyQt progress bar need to update on subprocess

2013-03-31 Thread Justin Israel
I haven't tested it specifically against running a nuke comp. Have you tried this with any other commands to confirm that it is not just Nukes output? My testing shows immediate output from calling shell commands. I am not sure if windows is doing different buffering behavior than POSIX. Have you

Re: [Maya-Python] PyQt: Suppress wheel event

2013-04-01 Thread Justin Israel
Simple but not obvious fix... The QTextEdit is a subclass of QAbstractScrollArea, and this superclass actually receives the wheel events on its viewport. So what you really want to do is filter on the viewport(): http://pastebin.com/xnYLk1QE [snip] self.te_viewport = self.te.viewport()

Re: [Maya-Python] maya.standalone and mayapy

2013-04-02 Thread Justin Israel
When you pass a string it is going to use that as the literal command. The problem is that you have spaces in the paths. I feel like there should be more of a traceback than you listed, but my guess to fix the problem is to pass a list of arguments and allow Popen to properly quote them: ## may

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-02 Thread Justin Israel
20 items is by no means "a lot". I have had scenes with thousands of items. It sounds like you might be doing something heavy in your paint events. Can you provide some more details about the items you are using? Snippet? On Apr 3, 2013 1:01 AM, "illunara" wrote: > Hi everybody > I'm working wi

Re: [Maya-Python] Re: maya.standalone and mayapy

2013-04-02 Thread Justin Israel
@Geoff - Thats what I suggested in my previous reply ;-) On Wed, Apr 3, 2013 at 10:51 AM, Geoff Harvey wrote: > Have you tried submitting the command like this? > > subprocess.Popen([mayaPath, scriptPath, > filename],stdout=subprocess.PIPE,stderr=subprocess.PIPE) > > I've always had much better

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-02 Thread Justin Israel
t; > > On Wed, Apr 3, 2013 at 6:04 AM, Judah Baron wrote: > >> Yeah, that sounds suspicious. What's going on with those 20 items? >> >> >> On Tue, Apr 2, 2013 at 11:07 AM, Justin Israel wrote: >> >>> 20 items is by no means "a lot". I

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-03 Thread Justin Israel
:3 > > > On Wed, Apr 3, 2013 at 1:06 PM, Justin Israel wrote: > The formatting and indents are all messed up on that gist. But it doesn't > look like you are doing much of anything in the paint event. Is it slow to > add them to the scene, or slow when you have 1000 of t

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-03 Thread Justin Israel
>> we setup the GraphicsView and Scene, isn't it? >> >> I will try what you told me first :3 >> >> >> On Wed, Apr 3, 2013 at 1:06 PM, Justin Israel wrote: >> The formatting and indents are all messed up on that gist. But it doesn't >>

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-04 Thread Justin Israel
nd > QGraphicsScene in GraphicsModule.py . Setting for QGraphicsItem inside > NodeModule and skip all the rest :3 > > and use this to call it up > > from Lib import GraphicsModule > GraphicsModule.showUi() > > Thank Justin :3 > > > On Wed, Apr 3, 2013 at 5:

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-04 Thread Justin Israel
lf is pretty simple and could be designed with QPainter. On Apr 4, 2013, at 10:36 PM, Justin Israel wrote: > I was kind of hoping you had a small, concise example, since it took a while > to go through all of that code and figure out where possible slow downs could > be coming fr

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-04 Thread Justin Israel
your ideas and will give it a try right > away. Thank Justin > > > On Thu, Apr 4, 2013 at 4:40 PM, Justin Israel wrote: > >> I forgot to mention the 3rd point, which doesn't have a code example but >> is just a suggestion... >> If you can manage to draw these no

Re: [Maya-Python] PySide unwrapinstance analog

2013-04-05 Thread Justin Israel
The equivalent of sip for PySide is shiboken: import shiboken ptr = long(shiboken.getCppPointer(obj)[0]) On Apr 6, 2013, at 12:46 AM, vux wrote: > In PyQt i had function to get maya-style path of qt control: > def qControlPath( ctl ): >return apiui.MQtUtil.fullName( long(unwrapinstance(ctl

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-06 Thread Justin Israel
phicsItem only allows us to use QRect to set the boundingRect of the > item, isn't it? > > > On Thu, Apr 4, 2013 at 5:19 PM, Justin Israel wrote: > People have mentioned that they can be slow. You could also try replacing my > pixmap approach with toggling the cache mod

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-06 Thread Justin Israel
No problem! On Apr 6, 2013 10:12 PM, "Tuan Nguyen" wrote: > Ahi think i misunderstand it. Sorry for a vague question. > > And as always, thank Justin :3 > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To un

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-06 Thread Justin Israel
st.github.com/illunara/5329248 > > painter = QtGui.QPainter(self) > > I think i did something wrong with the PaintDevice? > > > On Sat, Apr 6, 2013 at 5:52 PM, Justin Israel wrote: > >> No problem! >> On Apr 6, 2013 10:12 PM, "Tuan Nguyen" wrote: >>

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-06 Thread Justin Israel
stebin.com/cPc2U1YJ [snip] def boundingRect(self): return QtCore.QRectF(0,0,100,50) ... def paint(self, painter, option, widget): rect = option.rect painter.setRenderHint(painter.Antialiasing) [/snip] On Apr 7, 2013, at 6:36 PM, Justin Israel wrote: > Don'

Re: [Maya-Python] QGraphicsView is slow with alot of items

2013-04-07 Thread Justin Israel
n Sun, Apr 7, 2013 at 1:50 PM, Justin Israel wrote: > 1) Implement boundingRect() to return the appropriate size of your item at > any given moment. You can return the same size if your widget doesn't change, > and only the view does the scaling > > 2) Check out the method si

Re: [Maya-Python] Read shell output

2013-04-13 Thread Justin Israel
The output from the script editor? Or the shell from which you run Maya? On Apr 12, 2013 7:57 PM, "Manuel Macha" wrote: > Does by any chance someone have an example on how to read the output from > Maya's shell (Linux)? Any help is appreciated. > > -- > You received this message because you are s

Re: [Maya-Python] pyside conversion issue

2013-04-14 Thread Justin Israel
What is "self.wrapinstance" doing? If you are using sip, then that would be for PyQt4 only. On Mon, Apr 15, 2013 at 12:16 PM, Serguei Kalentchouk < serguei.kalentch...@gmail.com> wrote: > I think PySide requires you to call the parent constructor directly: > super (skinWrangler, self).__init__ (

Re: [Maya-Python] pyside conversion issue

2013-04-15 Thread Justin Israel
et the same error whether I call the parent constructor or not > > > On Mon, Apr 15, 2013 at 3:26 AM, Justin Israel wrote: > >> What is "self.wrapinstance" doing? If you are using sip, then that would >> be for PyQt4 only. >> >> >> On Mon, Apr 15,

Re: [Maya-Python] URGENT REQ: Tibco Developer with Business Events

2013-04-15 Thread Justin Israel
I am not sure these job posts line up with the topic of this forum. On Apr 16, 2013 4:15 AM, "vikram choudhary" wrote: > > > HI > Hope you are doing fine!! > Please review the requirement and if your Consultants are interested > then reply back with your's Consultants resume > > > > Tibco Devel

Re: [Maya-Python] pyside conversion issue

2013-04-15 Thread Justin Israel
ui.QWidget(PySide.QtCore.QObject) > # Supported signatures: > # PySide.QtGui.QWidget(PySide.QtGui.QWidget = None, > PySide.QtCore.Qt.WindowFlags = 0) > > The object is , which is a widget or > dialog, and the parent > > > On Mon, Apr 15, 2013 at 9:26 AM, Justin

Re: [Maya-Python] URGENT REQ: Oracle UCM 11g and Site Studio 11g Consultant

2013-04-16 Thread Justin Israel
I think anyone with admin status on here can remove the membership. These jobs have nothing to do with this group. I think this person is just blasting a number of technical groups. On Apr 17, 2013 7:59 AM, "Ravi Jagannadhan" wrote: > Is there a way to blacklist e-mail addys? Or do we want to? >

Re: [Maya-Python] Scripting complex tools - managing parts of code?

2013-04-17 Thread Justin Israel
I honestly didn't understand most of what you are trying to accomplish, but I got a bit of an idea from your two pastebin examples. Seems like all you really need here is to make better use of the function arguments. http://pastebin.com/0qVN3FAD Just split up your code into smaller reusable fun

Re: [Maya-Python] Re: Scripting complex tools - managing parts of code?

2013-04-17 Thread Justin Israel
The isinstance() is used so that you can pass a single string name of a set but it will still treat it as a list of one item. This replicated what a lot of the Maya.cmds module does when you call something with either one string or a list of strings. Reusing code is all about making the repetitive

Re: [Maya-Python] About calling the super() function

2013-04-18 Thread Justin Israel
Did you confirm that the eventFilter() is being called? Put a print statement right after: if obj is self.GraphicsView Also remember to do event.accept() if you are handling the event yourself so that it doesn't bubble up. On Fri, Apr 19, 2013 at 6:36 PM, Tuan Nguyen wrote: > Sorry to

Re: [Maya-Python] About calling the super() function

2013-04-20 Thread Justin Israel
ts not working? > > > > On Fri, Apr 19, 2013 at 1:52 PM, Justin Israel wrote: > Did you confirm that the eventFilter() is being called? Put a print statement > right after: > if obj is self.GraphicsView > > Also remember to do event.accept() if you are han

Re: [Maya-Python] About calling the super() function

2013-04-20 Thread Justin Israel
take :( > However can i ask another question? Can i use the eventFilter on > QGraphicsItem? they are not widget and i have to make an except on it > when call the QGraphicsView's keyPressEvent :( > > > > On Sat, Apr 20, 2013 at 2:19 PM, Justin Israel wrote: > >

Re: [Maya-Python] About calling the super() function

2013-04-21 Thread Justin Israel
27;t know why it keep jump up to > Maya's keyEvent, even i put an eventFilter on. When i reimplement > QGraphicsView's keyPressEvent, i have to skip calling events super class, > else Maya's hotkey still working as well. > > > On Sun, Apr 21, 2013 at 3:51 AM, Justi

Re: [Maya-Python] About calling the super() function

2013-04-21 Thread Justin Israel
No problem, David :-) On Apr 22, 2013 3:35 PM, "Tuan Nguyen" wrote: > Ah, everything work as expect, thank a ton Justin :3 > > > On Mon, Apr 22, 2013 at 1:57 AM, Justin Israel wrote: > >> If you call the super class method then of course it will pass the event

Re: [Maya-Python] About calling the super() function

2013-04-22 Thread Justin Israel
Haha I am just teasing. You can't really delete messages off the message group ;-) On Apr 22, 2013 6:48 PM, "Tuan Nguyen" wrote: > eh, sorry about that. I though i delete the last one, and send a new one :D > > > On Mon, Apr 22, 2013 at 12:02 PM, Justin Israel wr

Re: [Maya-Python] About calling the super() function

2013-04-22 Thread Justin Israel
ilter on. I try change the method, like in, isinstance but no luck :( > > The second thing is, sceneEventFilterEvent not working on itself, and its > child either? > > :3 > > > On Mon, Apr 22, 2013 at 3:00 PM, Justin Israel wrote: > Haha I am just teasing. You can

Re: [Maya-Python] Re: how use internal maya icons in your pyqt gui ?

2013-04-22 Thread Justin Israel
Fascinating! Never knew that was there. On Tue, Apr 16, 2013 at 7:52 AM, luceric wrote: > This is a month old post, but I'll reply in case someone needs the info. > The trick is to use the prefix ":/" at the beginning of an image path, to > let Qt load the image file from Maya's Qt resource. >

Re: [Maya-Python] textField example...

2013-04-23 Thread Justin Israel
The change command wont fire until the field loses focus. Add one more text field, then change some text in your original field and switch to the new field. On Apr 23, 2013, at 9:27 PM, Daz wrote: > OK silly me... > > Now I got the print to work and so on > > http://pastebin.com/i0xe7EZ3 >

[Maya-Python] SublimeJEDI: Easier than SublimeCodeIntel

2013-04-25 Thread Justin Israel
Just stumbled across this: https://github.com/svaiter/SublimeJEDI Thought I would give it a try and see how it compares to SublimeCodeIntel. Result is... PyQt4/PySide completion worked immediately :-) I just followed the default suggestions on the README. Had to manually clone it into my Packag

Re: [Maya-Python] cPickle doesn't work on PyQt's object?

2013-04-25 Thread Justin Israel
You can't pickle QObject subclasses, because they are C++ extensions and contain internal state and pointers and stuff. The Qt approach (to follow what they already do on QMainWindow and other widgets) is to create a saveState() and restoreState(state) method on your class class Widget(QtGui.QWi

Re: [Maya-Python] Re: SublimeJEDI: Easier than SublimeCodeIntel

2013-04-25 Thread Justin Israel
Yea I noticed it does have a small lag the first time it needs to build an index, but I can live with that. On Fri, Apr 26, 2013 at 1:52 PM, dgovil wrote: > Someone shared this gem with us at work today, and it's been really > awesome. > Slight lag as it indexes the package, but then it's prett

Re: [Maya-Python] How to run PyQt Gui in the command prompt(cmd) in windows?

2013-05-03 Thread Justin Israel
Can you be more specific? It doesn't show up, as in it says "PyQt4" not found? Can you show what you are doing and what error is being raised? If you have installed the binary installers for pyqt, then it should be in your site-packages. On May 4, 2013, at 2:35 AM, matthew park wrote: > Hi the

Re: [Maya-Python] How to run PyQt Gui in the command prompt(cmd) in windows?

2013-05-03 Thread Justin Israel
> '*.pyw' file in eclipse editor, the GUI is shown up. > > But, I want to run this GUI program in the command prompt of Windows. > code is run but GUI isn't shown up if I type like > > "C:\myPyQt\blah.pyw myApp parameter" in the command prompt. > > >

Re: [Maya-Python] How to run PyQt Gui in the command prompt(cmd) in windows?

2013-05-04 Thread Justin Israel
ut, I want to run this GUI program in the command prompt of Windows. code > > is run but GUI isn't shown up if I type like > > "C:\myPyQt\blah.pyw myApp parameter" in the command prompt. > > > > > > > > > > > > > > On Fri, May 3, 2

Re: [Maya-Python] button commands

2013-05-04 Thread Justin Israel
Make sure you are passing the method object and not actually calling it: cmds.button(myButton, e = 1, command = self.process) You were doing this: self.process() On May 5, 2013, at 10:54 AM, Todd Widup wrote: > using the CMDS commands for a quick UI > > when I have this in my code : > >

Re: [Maya-Python] Extracting information from a Massive Simulation File (asf file)

2013-05-06 Thread Justin Israel
You can use aString.startswith("BEGIN") to test if a string object starts with a prefix. But I decided to just write a full example, with comments: http://pastebin.com/MEDTr5A0 This example will open the file, and parse every single agent into a final dictionary object. Here is a second versio

Re: [Maya-Python] Extracting information from a Massive Simulation File (asf file)

2013-05-06 Thread Justin Israel
I'm not sure I understand the problem with the examples I gave, in achieving what you want. If you are concerned with being able to retrieve the 'b_Waist_JNT' attribute, and that it could appear at any point within each agent block, why not just parse the file, and get the attribute you want for

Re: [Maya-Python] PyQt Maya memory issues

2013-05-12 Thread Justin Israel
I use that same method in the current asset management software I am developing. But some of the things that are different for me... I'm not using a tree view to load the data. My thumbnails come into a paged grid view and pages are created and destroyed between queries. I also wrote my own cop

Re: [Maya-Python] Help with Print

2013-05-12 Thread Justin Israel
Seems like you are dealing with a list of pymel nodes. So you would need to take an item from the list, and then get its name: aItem = items[0] print aItem.name() On Mon, May 13, 2013 at 1:52 PM, Ben Kamakorewa wrote: > > I need to get just "Sandbag_Deformer_02_CL_Handle" > > but when i print

Re: [Maya-Python] My personal workspace

2013-05-13 Thread Justin Israel
Any specific reason you are avoiding the "os" and "shutil" modules for joining paths properly, and doing arbitrary file path copies? On May 13, 2013 10:25 PM, "Ævar Guðmundsson" wrote: > Hey Matty! > Indeed long time, and too long even. All is well and jolly in London > while the weather is t

Re: [Maya-Python] Re: PyQt Maya memory issues

2013-05-13 Thread Justin Israel
Closing the window won't destroy the actual object by default. There are window flags that can make that happen. But all you need to do is call myWindow.deleteLater() to destroy the Qt object. It will delete all of the child objects in turn. So make sure you properly set the parent attribute of chi

Re: [Maya-Python] My personal workspace

2013-05-13 Thread Justin Israel
I admit I didn't read too much into what you are doing, other than catching the part about wanting to save a backup copy of a file to another location, but using only Maya's cmds module or python builtins. So I was curious why you want to avoid using os.path.join for joining path components, and sh

Re: [Maya-Python] My personal workspace

2013-05-14 Thread Justin Israel
This is definitely quite an in-depth discussion, on the topic of joining paths and copying files :-) While str.join() is extremely useful, I tend to avoid joining paths on a explicit path separator and defer to os.path.join, as it decides the path separator and also automatically handles the c

Re: [Maya-Python] My personal workspace

2013-05-17 Thread Justin Israel
@Ben - I think you meant to suggest "my_uNkle_bobo" ? He was creating a folder with spaces, but spaces should pretty much always be replaced with underscore for portability General: Normally you would move that version number to the root of the module: __version__ = '0.1.2' That way you ca

Re: [Maya-Python] My personal workspace

2013-05-17 Thread Justin Israel
it some more! Some > great tips & things to be learned here, so thanks again for taking the time > Justin, the members of this group are very lucky to have somebody like you > around! > > On 18/05/2013, at 6:24, Justin Israel wrote: > >> @Ben - I think you meant to

Re: [Maya-Python] My personal workspace

2013-05-18 Thread Justin Israel
# Substitute anything that isn't a number or letter with a separator character sep = "_" original = 'a silly ! looking __ @windows -file.ext' name, ext = os.path.splitext(s) cleaned = re.sub(r'[^a-zA-Z0-9]+', sep, name) path = ''.join([cleaned, ext]) # a_silly_looking_windows_file.ext O

Re: [Maya-Python] Error # UnboundLocalError: - what went wrong?

2013-05-18 Thread Justin Israel
Its this bit here: if isinstance(RGBname(str,unicode)): At first glance it confused me because you are using upper case for a local variable RGBname, which is usually reserved for classes, so it seemed like you were making an instance of a class. But really, the syntax of the isinstance call

Re: [Maya-Python] Error # UnboundLocalError: - what went wrong?

2013-05-18 Thread Justin Israel
Is there some special reason to use a comma-seperated single string to pass arguments to your function? Does it not suffice to use more than one argument, or a list? def foo(a, b) print a, b def foo(abList) a, b = abList print a,b On May 19, 2013, at 9:00 AM, Daz wrote: > Hey

Re: [Maya-Python] Remembering the script editor history file.

2013-05-19 Thread Justin Israel
Testing your commands on osx actually crashed Maya while its starting up. I assume what you would need is to schedule the call to be made once Maya has finished loading and returns to its idle state: ## userSetup.py ## import maya.cmds as cmds import maya.utils as mutils def hist_callback():

Re: [Maya-Python] how to reflect download progress onto QtableView or QtableWidget?

2013-05-19 Thread Justin Israel
Just a random high-level suggestion using QTableWidget, since its easier to talk about that... You could use QTableWidget.setCellWidget() to set QProgressBars into your table, and

  1   2   3   4   5   6   7   8   9   10   >