def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, 'About ShaderMan.Next',) html = wx.html.HtmlWindow(self, -1, size=(420, -1)) html.SetPage(self.text % (good_path("core/logo.gif"), aversion, wx.VERSION_STRING, wx.PlatformInfo[1], sys.version.split()[0])) ir = html.GetInternalRepresentation() html.SetSize( (ir.GetWidth()+20, ir.GetHeight()+20) ) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH) html.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
def generator(self, filename, code): try: os.unlink("%s.sl*" % filename) # delete previous version and compiled shader except: pass outf = open(filename+".sl", "w") print >>outf, code outf.close() # default values shader = "shader" prman = "prman" # now load from the settings... for s in set.settings: if s["name"] == "ShaderCompiler": shader = s["default"] if s["name"] == "Renderer": prman = s["default"] os.system("%s %s.sl" % (shader, filename)) from mako.template import Template results = {} previewtemplate = Template("".join(open(good_path("preview.rib")).readlines())) results["shadername"] = self.factory.getName() # this will be refactored preview = previewtemplate.render(**results) #outf = open(filename+".rib", "w") #print >>outf, preview #outf.close() #os.system("prman -progress %s.rib" % filename) import subprocess pipe = subprocess.Popen("%s -progress" % prman, shell=True, stdin=subprocess.PIPE).stdin print >>pipe, preview pipe.close()