|
when i try to shut down my wxpython window maya crashes :( anybody know why?
my own research points to that the : finally: del app is the thief.
anyone that know how to solve this problem? im running 2009 on vista x64
"""
psdvwui.py
UI for Photoshop Friend
Erik Larsson
[email]Erik.larsson@live.com[/email]
<a href="http://www.technical3dart.com">http://www.technical3dart.com</a>
Description: This is the UI Element for making texture import/export from maya easier.
REQUIRED PYTHON EXTENSIONS: wxpython - <a href="http://www.wxpython.org/">http://www.wxpython.org/</a> pywin32 - <a href="http://sourceforge.net/projects/pywin32/">http://sourceforge.net/projects/pywin32/</a> """
import wx,os
import maya.cmds as cmds
mapID = 101
exportXmapID = 110
exportYmapID = 111
exportBtn = 112
importXmapID = 120
importYmapID = 121
importBtn = 122
class MainWindow(wx.Frame):
""" We simply derive a new class of Frame. """
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(300,250))
self.CreateStatusBar()
panel = wx.Panel(self, -1)
titleFont = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, True)
#############################
## Maya to photoshop ##
#############################
self.maya2psp = wx.StaticText(panel, -1, "Maya To Photoshop ",wx.Point(10, 5))
self.maya2psp.SetFont(titleFont)
wx.StaticText(panel, -1, "Map Size:", wx.Point(10,40))
self.importMapSizeX = wx.TextCtrl(panel,importXmapID , "", wx.Point(60, 35), wx.Size(40,-1))
wx.StaticText(panel, -1, "x" , wx.Point(105,37))
self.importMapSizeY = wx.TextCtrl(panel,importYmapID , "", wx.Point(120, 35), wx.Size(40,-1))
self.exportButton = wx.Button(panel, exportBtn, "Generate PSD-file", wx.Point(10,75))
self.maptxt = wx.StaticText(panel, -1, "Maps:",wx.Point(200, 25))
self.mapList = ["Diffuse" , "Specular" , "Normal" , "Emissive"]
self.mapchkbx = wx.CheckListBox(panel, mapID, wx.Point (200, 40), wx.Size (70, 70), self.mapList)
wx.EVT_CHECKLISTBOX(self, mapID, self.mapCheck)
wx.EVT_BUTTON(self, exportBtn, self.uvExport)
#############################
## photoshop to Maya ##
#############################
self.psp2maya = wx.StaticText(panel, -1, "Photoshop To Maya ",wx.Point(10, 110))
self.psp2maya.SetFont(titleFont)
wx.StaticText(panel, -1, "Map Size:", wx.Point(10,135))
self.exportMapSizeX = wx.TextCtrl(panel,exportXmapID , "", wx.Point(60, 130), wx.Size(40,-1))
wx.StaticText(panel, -1, "x" , wx.Point(105,132))
self.exportMapSizeY = wx.TextCtrl(panel,exportYmapID , "", wx.Point(120, 130), wx.Size(40,-1))
self.importButton = wx.Button(panel, importBtn, "Import Maps", wx.Point(10,160))
self.importButton = wx.Button(panel, importBtn, "Import Maps", wx.Point(100,160))
self.Show(True)
def mapCheck(self, event):
print "hej %d" % event.GetInt()
def uvExport(self, event):
self.importMapXint = int(wx.TextCtrl.GetLineText(self.importMapSizeX, 0))
self.importMapYint = int(wx.TextCtrl.GetLineText(self.importMapSizeY, 0))
print " %d" % self.importMapXint
app = wx.PySimpleApp()
try:
frame=MainWindow(None, wx.ID_ANY, 'Photoshop Friend')
app.MainLoop()
finally:
del app
|