Hey Guys
I know I am missing some important points on how to use the python language. Is it possible to pass variables between methods (is that what theyare called?)
in my attempt below I have an initial definition that gets users input in 2 text fields and uses that later down the script to create a bunch of directories once the button "GO!!!" is clicked.
I get this error: jobfolder = a
NameError: global name 'a' is not defined
but i defined it up in the beginning of the script.
Any ideas?
Apologies for all the questions forum posts - I'll stop soon!
AT -
-
#!/usr/bin/python
-
-
# newjob.py
-
-
import wx
-
import os
-
-
APP_SIZE_X = 400
-
APP_SIZE_Y = 210
-
-
class NewJob(wx.Dialog):
-
def __init__(self, parent, id, title):
-
wx.Dialog.__init__(self, parent, id, title, size=(APP_SIZE_X, APP_SIZE_Y))
-
-
a = wx.StaticText(self, -1, 'Enter a job name:', (25, 20), style=wx.ALIGN_LEFT)
-
wx.TextCtrl(self, 3, '', (25,50), (200, -1))
-
b = wx.StaticText(self, -1, 'Enter number of shots:', (25, 85), style=wx.ALIGN_LEFT)
-
wx.TextCtrl(self, 4, '', (25,110), (85, -1))
-
-
wx.Button(self, 2, 'Quit', (50, 150))
-
wx.Button(self, 1, 'GO!!!', (150, 150), (210, -1))
-
-
self.Bind(wx.EVT_BUTTON, self.OnClose, id=2)
-
self.Bind(wx.EVT_BUTTON, self.OnCreateJob, id=1)
-
-
self.Centre()
-
self.ShowModal()
-
self.Destroy()
-
-
def OnClose(self, event):
-
self.Close(True)
-
-
def OnCreateJob(self, event):
-
-
jobfolder = a
-
shotamount = b
-
-
jobroot = os.getcwd()
-
-
def GLOBALSDIR():
-
-
os.mkdir( "_global")
-
-
os.mkdir( "_global/2d")
-
os.mkdir( "_global/2d/ae")
-
os.mkdir( "_global/2d/ae/render")
-
os.mkdir( "_global/2d/ae/script")
-
os.mkdir( "_global/2d/ai")
-
os.mkdir( "_global/2d/ai/project")
-
os.mkdir( "_global/2d/ai/export")
-
os.mkdir( "_global/2d/psd")
-
os.mkdir( "_global/2d/psd/project")
-
os.mkdir( "_global/2d/psd/export")
-
os.mkdir( "_global/2d/shk")
-
os.mkdir( "_global/2d/shk/script")
-
os.mkdir( "_global/2d/shk/render")
-
os.mkdir( "_global/2d/output")
-
-
os.mkdir( "_global/3d")
-
os.mkdir( "_global/3d/boujou")
-
os.mkdir( "_global/3d/maya")
-
os.mkdir( "_global/3d/max")
-
os.mkdir( "_global/3d/syntheyes")
-
os.mkdir( "_global/3d/output")
-
-
os.mkdir( "_global/color")
-
-
os.mkdir( "_global/edit")
-
os.mkdir( "_global/edit/audio")
-
os.mkdir( "_global/edit/fcp")
-
os.mkdir( "_global/edit/fcp/projects")
-
os.mkdir( "_global/edit/graphics")
-
os.mkdir( "_global/edit/edl")
-
os.mkdir( "_global/edit/xml")
-
-
os.mkdir( "_global/plates")
-
-
os.mkdir( "_global/ref")
-
-
-
def SUBFOLDERS():
-
-
os.mkdir( "2d")
-
os.mkdir( "2d/ae")
-
os.mkdir( "2d/ae/render")
-
os.mkdir( "2d/ae/script")
-
os.mkdir( "2d/ai")
-
os.mkdir( "2d/ai/project")
-
os.mkdir( "2d/ai/export")
-
os.mkdir( "2d/psd")
-
os.mkdir( "2d/psd/project")
-
os.mkdir( "2d/psd/export")
-
os.mkdir( "2d/shk")
-
os.mkdir( "2d/shk/render")
-
os.mkdir( "2d/shk/script")
-
os.mkdir( "2d/output")
-
-
os.mkdir( "3d")
-
os.mkdir( "3d/boujou")
-
os.mkdir( "3d/maya")
-
os.mkdir( "3d/max")
-
os.mkdir( "3d/syntheyes")
-
os.mkdir( "3d/output")
-
-
os.mkdir( "plates")
-
-
os.chdir( "../")
-
-
-
#CREATE JOB DIRECTORY
-
os.mkdir( jobfolder)
-
-
#CREATE OFFLINE & ONLINE DIRECTORIES
-
os.mkdir( jobfolder + "/offline")
-
-
#CHANGE INTO OFFLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES
-
os.chdir( jobfolder + "/offline")
-
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
#CHANGE INTO ONLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES
-
os.chdir( jobroot)
-
os.mkdir( jobfolder + "/online")
-
os.chdir( jobfolder + "/online")
-
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
-
app = wx.App(0)
-
NewJob(None, -1, 'newjob')
-
app.MainLoop()
-
-
13 2104
It's all about the "scope" of a variable.
Inside your __init__() function, the variable a only has life in that scope (the method - or function, if you prefer- scope). The object that is directing the show is the Dialog. The reason that self (this Dialog) is present in every method definition is so that the given method has access to the object scope (self.whatever). So, if you want a variable to live outside a function, make it an attribute of the object: - self.useDescriptiveNamesForAttributes = .....
These are in effect "global", but only in the object scope (encapsulation).
Hope that's not too confusing...
Hi,
attach the variable to your class,
line 15: self.myVariable
then in the method
def OnCreateJob():
self.myVariable...
br,
Björn
I notice that you are doing several things in a debatable manner.
1) Assigning IDs as absolutes is a definite no-no. It's bound to cause problems down the road: - wxID_SEGMENTDIALOGRECORDBUTTON = wx.NewId()
That's actually a generated name, yours could be shorter.
2) Button events should be bound to the button and not the parent: - # <snipped from Dialog subclass>
-
self.RecordButton = wx.Button(id=wxID_SEGMENTDIALOGRECORDBUTTON, label='Record Station', name='RecordButton', parent=self.panel1, pos=wx.Point(816, 20), size=wx.Size(173, 36), style=0)
-
self.RecordButton.Bind(wx.EVT_BUTTON, self.OnRecordButton, id=wxID_SEGMENTDIALOGRECORDBUTTON)
I notice that you are doing several things in a debatable manner.
1) Assigning IDs as absolutes is a definite no-no. It's bound to cause problems down the road: - wxID_SEGMENTDIALOGRECORDBUTTON = wx.NewId()
That's actually a generated name, yours could be shorter.
2) Button events should be bound to the button and not the parent: - # <snipped from Dialog subclass>
-
self.RecordButton = wx.Button(id=wxID_SEGMENTDIALOGRECORDBUTTON, label='Record Station', name='RecordButton', parent=self.panel1, pos=wx.Point(816, 20), size=wx.Size(173, 36), style=0)
-
self.RecordButton.Bind(wx.EVT_BUTTON, self.OnRecordButton, id=wxID_SEGMENTDIALOGRECORDBUTTON)
Making a Button (or even StaticText) an attribute of the Dialog may seem like just an extra variable in you class's name space, but it actually comes in handy very quickly. You may soon find that you want to disable, change the color of, (or a host of other things) any one of these little GUI devils (it happens to me, anyway).
Hey Guys
Thanks for your help. I kind of understand but a lot of it is flying right over my head. :)
BjornB I tried what I think you said to do - but I think I didn't really understand.
I changed the variables "a" & "b" to self.a & self.b in the "class NewJob" in the "def __int__".
Mind taking a look? -
#!/usr/bin/python
-
-
# newjob.py
-
-
import wx
-
import os
-
-
APP_SIZE_X = 400
-
APP_SIZE_Y = 210
-
-
class NewJob(wx.Dialog):
-
def __init__(self, parent, id, title):
-
wx.Dialog.__init__(self, parent, id, title, size=(APP_SIZE_X, APP_SIZE_Y))
-
-
wx.StaticText(self, -1, 'Enter a job name:', (25, 20), style=wx.ALIGN_LEFT)
-
self.a = str(wx.TextCtrl(self, 3, '', (25,50), (200, -1)))
-
wx.StaticText(self, -1, 'Enter number of shots:', (25, 85), style=wx.ALIGN_LEFT)
-
self.b = str(wx.TextCtrl(self, 4, '', (25,110), (85, -1)))
-
-
wx.Button(self, 2, 'Quit', (50, 150))
-
wx.Button(self, 1, 'GO!!!', (150, 150), (210, -1))
-
-
self.Bind(wx.EVT_BUTTON, self.OnClose, id=2)
-
self.Bind(wx.EVT_BUTTON, self.OnCreateJob, id=1)
-
-
self.Centre()
-
self.ShowModal()
-
self.Destroy()
-
-
def OnClose(self, event):
-
self.Close(True)
-
-
def OnCreateJob(self, event):
-
-
jobfolder = self.a
-
shotamount = self.b
-
-
jobroot = os.getcwd()
-
-
def GLOBALSDIR():
-
-
os.mkdir( "_global")
-
-
os.mkdir( "_global/2d")
-
os.mkdir( "_global/2d/ae")
-
os.mkdir( "_global/2d/ae/render")
-
os.mkdir( "_global/2d/ae/script")
-
os.mkdir( "_global/2d/ai")
-
os.mkdir( "_global/2d/ai/project")
-
os.mkdir( "_global/2d/ai/export")
-
os.mkdir( "_global/2d/psd")
-
os.mkdir( "_global/2d/psd/project")
-
os.mkdir( "_global/2d/psd/export")
-
os.mkdir( "_global/2d/shk")
-
os.mkdir( "_global/2d/shk/script")
-
os.mkdir( "_global/2d/shk/render")
-
os.mkdir( "_global/2d/output")
-
-
os.mkdir( "_global/3d")
-
os.mkdir( "_global/3d/boujou")
-
os.mkdir( "_global/3d/maya")
-
os.mkdir( "_global/3d/max")
-
os.mkdir( "_global/3d/syntheyes")
-
os.mkdir( "_global/3d/output")
-
-
os.mkdir( "_global/color")
-
-
os.mkdir( "_global/edit")
-
os.mkdir( "_global/edit/audio")
-
os.mkdir( "_global/edit/fcp")
-
os.mkdir( "_global/edit/fcp/projects")
-
os.mkdir( "_global/edit/graphics")
-
os.mkdir( "_global/edit/edl")
-
os.mkdir( "_global/edit/xml")
-
-
os.mkdir( "_global/plates")
-
-
os.mkdir( "_global/ref")
-
-
-
def SUBFOLDERS():
-
-
os.mkdir( "2d")
-
os.mkdir( "2d/ae")
-
os.mkdir( "2d/ae/render")
-
os.mkdir( "2d/ae/script")
-
os.mkdir( "2d/ai")
-
os.mkdir( "2d/ai/project")
-
os.mkdir( "2d/ai/export")
-
os.mkdir( "2d/psd")
-
os.mkdir( "2d/psd/project")
-
os.mkdir( "2d/psd/export")
-
os.mkdir( "2d/shk")
-
os.mkdir( "2d/shk/render")
-
os.mkdir( "2d/shk/script")
-
os.mkdir( "2d/output")
-
-
os.mkdir( "3d")
-
os.mkdir( "3d/boujou")
-
os.mkdir( "3d/maya")
-
os.mkdir( "3d/max")
-
os.mkdir( "3d/syntheyes")
-
os.mkdir( "3d/output")
-
-
os.mkdir( "plates")
-
-
os.chdir( "../")
-
-
-
#CREATE JOB DIRECTORY
-
os.mkdir( jobfolder)
-
-
#CREATE OFFLINE & ONLINE DIRECTORIES
-
os.mkdir( jobfolder + "/offline")
-
-
#CHANGE INTO OFFLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES
-
os.chdir( jobfolder + "/offline")
-
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
#CHANGE INTO ONLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES
-
os.chdir( jobroot)
-
os.mkdir( jobfolder + "/online")
-
os.chdir( jobfolder + "/online")
-
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
-
app = wx.App(0)
-
NewJob(None, -1, 'newjob')
-
app.MainLoop()
-
-
I notice that you are doing several things in a debatable manner.
1) Assigning IDs as absolutes is a definite no-no. It's bound to cause problems down the road: - wxID_SEGMENTDIALOGRECORDBUTTON = wx.NewId()
That's actually a generated name, yours could be shorter.
2) Button events should be bound to the button and not the parent: - # <snipped from Dialog subclass>
-
self.RecordButton = wx.Button(id=wxID_SEGMENTDIALOGRECORDBUTTON, label='Record Station', name='RecordButton', parent=self.panel1, pos=wx.Point(816, 20), size=wx.Size(173, 36), style=0)
-
self.RecordButton.Bind(wx.EVT_BUTTON, self.OnRecordButton, id=wxID_SEGMENTDIALOGRECORDBUTTON)
Hey BartonC,
does that mean that rather than doing this:
wx.Button(self, 2, 'Quit', (50, 150))
i should do:
self.QuitButton = wx.Button(self, 2, 'Quit', (50, 150))
Thanks for all your help!
Hey BartonC,
does that mean that rather than doing this:
wx.Button(self, 2, 'Quit', (50, 150))
i should do:
self.QuitButton = wx.Button(self, 2, 'Quit', (50, 150))
Thanks for all your help!
First: Yes, you got what Bjorn was conveying.
Second: I treat (well, I would if I wrote the GUI layout part - Boa Constructor does that for me) GUI elements the same as other variables that are needed in the Class Scope (such as self.a and self.b in your post). And I can't stress enough how important it is to use better naming for your variables. Here is a thread discussing naming conventions in Python. You'll like yourself much more when you go back into a piece of code later and find things like "veryDescriptiveNameStr" rather than "a".
Hope that make sense.
hey guys
thanks for all your help so far - sorry I havent got back to your replies - distracted with work
I think I understand what u mean by giving everything descriptive names and assigning them as self. and flexible IDs
Does this look better?
It still doesn't work - I cant seem to convert a string to an integer - this error:
line 128, in OnCreateJob
os.mkdir( self.jobfolder)
TypeError: coercing to Unicode: need string or buffer, TextCtrl found
Any ideas how to get that to convert to a string?
i thought this would work:
int( self.NumberOfShots)
but get this:
TypeError: int() argument must be a string or a number
Cheers!!
Adam -
-
#!/usr/bin/python
-
-
# newjob.py
-
-
import wx
-
import os
-
-
class MyFrame(wx.Frame):
-
def __init__(self, parent, id, title):
-
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(400, 200))
-
-
panel = wx.Panel(self, -1)
-
-
wxID_ENTERJOBNAME = wx.NewId()
-
wxID_JOBNAME = wx.NewId()
-
wxID_ENTERSHOTNAME = wx.NewId()
-
wxID_SHOTAMOUNT = wx.NewId()
-
wxID_QUITBUTTON = wx.NewId()
-
wxID_GOBUTTON = wx.NewId()
-
-
self.EnterJobname = wx.StaticText(panel, wxID_ENTERJOBNAME, 'Enter a job name:', (10, 20), style=wx.ALIGN_LEFT)
-
self.JobName = wx.TextCtrl(panel, wxID_JOBNAME, '', (25,50), (200, -1))
-
-
self.EnterShotAmount = wx.StaticText(panel, wxID_ENTERSHOTNAME, 'Enter number of shots:', (10, 80), style=wx.ALIGN_LEFT)
-
self.NumberOfShots = wx.TextCtrl(panel, wxID_SHOTAMOUNT, '', (25,110), (85, -1))
-
self.NumberOfShots.Bind(wx.EVT_TEXT, self.OnCreateJob, id=wxID_SHOTAMOUNT)
-
-
self.jobfolder = str( self.JobName)
-
self.shotamount = self.NumberOfShots
-
-
self.QuitButton = wx.Button(panel, wxID_QUITBUTTON, "Quit", (10,140))
-
self.QuitButton.Bind(wx.EVT_BUTTON, self.OnClose, id=wxID_QUITBUTTON)
-
-
self.GoButton = wx.Button(panel, wxID_GOBUTTON, "GO!!!", (200,140))
-
self.GoButton.Bind(wx.EVT_BUTTON, self.OnCreateJob, id=wxID_GOBUTTON)
-
-
-
def OnClose(self, event):
-
self.Close(True)
-
-
-
def OnCreateJob(self, event):
-
-
jobroot = os.getcwd()
-
-
def GLOBALSDIR():
-
-
os.mkdir( "global")
-
-
os.mkdir( "global/2d")
-
os.mkdir( "global/2d/ae")
-
os.mkdir( "global/2d/ae/render")
-
os.mkdir( "global/2d/ae/script")
-
os.mkdir( "global/2d/ai")
-
os.mkdir( "global/2d/ai/project")
-
os.mkdir( "global/2d/ai/export")
-
os.mkdir( "global/2d/motion")
-
os.mkdir( "global/2d/motion/scripts")
-
os.mkdir( "global/2d/motion/render")
-
os.mkdir( "global/2d/psd")
-
os.mkdir( "global/2d/psd/project")
-
os.mkdir( "global/2d/psd/export")
-
os.mkdir( "global/2d/shk")
-
os.mkdir( "global/2d/shk/script")
-
os.mkdir( "global/2d/shk/render")
-
os.mkdir( "global/2d/output")
-
-
os.mkdir( "global/3d")
-
os.mkdir( "global/3d/boujou")
-
os.mkdir( "global/3d/maya")
-
os.mkdir( "global/3d/max")
-
os.mkdir( "global/3d/syntheyes")
-
os.mkdir( "global/3d/output")
-
-
os.mkdir( "global/color")
-
-
os.mkdir( "global/output")
-
os.mkdir( "global/output/dvd")
-
os.mkdir( "global/output/dvd/projects")
-
os.mkdir( "global/output/dvd/builds")
-
os.mkdir( "global/output/quicktime")
-
-
os.mkdir( "global/edit")
-
os.mkdir( "global/edit/audio")
-
os.mkdir( "global/edit/fcp")
-
os.mkdir( "global/edit/fcp/projects")
-
os.mkdir( "global/edit/graphics")
-
os.mkdir( "global/edit/edl")
-
os.mkdir( "global/edit/xml")
-
-
os.mkdir( "global/plates")
-
os.mkdir( "global/ref")
-
-
-
def SUBFOLDERS():
-
-
os.mkdir( "2d")
-
os.mkdir( "2d/ae")
-
os.mkdir( "2d/ae/render")
-
os.mkdir( "2d/ae/script")
-
os.mkdir( "2d/ai")
-
os.mkdir( "2d/ai/project")
-
os.mkdir( "2d/ai/export")
-
os.mkdir( "2d/motion")
-
os.mkdir( "2d/motion/scripts")
-
os.mkdir( "2d/motion/render")
-
os.mkdir( "2d/psd")
-
os.mkdir( "2d/psd/project")
-
os.mkdir( "2d/psd/export")
-
os.mkdir( "2d/shk")
-
os.mkdir( "2d/shk/render")
-
os.mkdir( "2d/shk/script")
-
os.mkdir( "2d/output")
-
-
os.mkdir( "3d")
-
os.mkdir( "3d/boujou")
-
os.mkdir( "3d/maya")
-
os.mkdir( "3d/max")
-
os.mkdir( "3d/syntheyes")
-
os.mkdir( "3d/output")
-
-
os.mkdir( "plates")
-
-
os.chdir( "../")
-
-
-
#CREATE JOB DIRECTORY
-
os.mkdir( self.jobfolder)
-
-
#CREATE OFFLINE & CHANGE INTO OFFLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES & GLOBALS
-
os.mkdir( self.jobfolder + "/offline")
-
os.chdir( self.jobfolder + "/offline")
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, self.shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
#CREATE ONLINE & CHANGE INTO ONLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES
-
os.chdir( jobroot)
-
os.mkdir( self.jobfolder + "/online")
-
os.chdir( self.jobfolder + "/online")
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, self.shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
-
print
-
print "job " + self.jobfolder + " created"
-
-
-
-
-
class MyApp(wx.App):
-
def OnInit(self):
-
frame = MyFrame(None, -1, New Job')
-
frame.Show(True)
-
frame.Centre()
-
return True
-
-
app = MyApp(0)
-
app.MainLoop()
Sweet!!!
I think I worked it out.
Can anyone confirm this works & is ok (code wise?) -
-
#!/usr/bin/python
-
-
# newjob.py
-
-
import wx
-
import os
-
-
class MyFrame(wx.Frame):
-
def __init__(self, parent, id, title):
-
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(400, 200))
-
-
panel = wx.Panel(self, -1)
-
-
wxID_ENTERJOBNAME = wx.NewId()
-
wxID_JOBNAME = wx.NewId()
-
wxID_ENTERSHOTNAME = wx.NewId()
-
wxID_SHOTAMOUNT = wx.NewId()
-
wxID_QUITBUTTON = wx.NewId()
-
wxID_GOBUTTON = wx.NewId()
-
-
self.EnterJobname = wx.StaticText(panel, wxID_ENTERJOBNAME, 'Enter a job name:', (10, 20), style=wx.ALIGN_LEFT)
-
self.JobName = wx.TextCtrl(panel, wxID_JOBNAME, '', (25,50), (200, -1))
-
-
self.EnterShotAmount = wx.StaticText(panel, wxID_ENTERSHOTNAME, 'Enter number of shots:', (10, 80), style=wx.ALIGN_LEFT)
-
self.NumberOfShots = wx.TextCtrl(panel, wxID_SHOTAMOUNT, '', (25,110), (85, -1))
-
-
self.QuitButton = wx.Button(panel, wxID_QUITBUTTON, "Quit", (10,140))
-
self.QuitButton.Bind(wx.EVT_BUTTON, self.OnClose, id=wxID_QUITBUTTON)
-
-
self.GoButton = wx.Button(panel, wxID_GOBUTTON, "GO!!!", (200,140))
-
self.GoButton.Bind(wx.EVT_BUTTON, self.OnCreateJob, id=wxID_GOBUTTON)
-
-
-
def OnClose(self, event):
-
self.Close(True)
-
-
-
def OnCreateJob(self, event):
-
-
jobfolder = str( self.JobName.GetValue())
-
shotamount = int( self.NumberOfShots.GetValue())
-
-
print shotamount
-
-
jobroot = os.getcwd()
-
-
def GLOBALSDIR():
-
-
os.mkdir( "global")
-
-
os.mkdir( "global/2d")
-
os.mkdir( "global/2d/ae")
-
os.mkdir( "global/2d/ae/render")
-
os.mkdir( "global/2d/ae/script")
-
os.mkdir( "global/2d/ai")
-
os.mkdir( "global/2d/ai/project")
-
os.mkdir( "global/2d/ai/export")
-
os.mkdir( "global/2d/motion")
-
os.mkdir( "global/2d/motion/scripts")
-
os.mkdir( "global/2d/motion/render")
-
os.mkdir( "global/2d/psd")
-
os.mkdir( "global/2d/psd/project")
-
os.mkdir( "global/2d/psd/export")
-
os.mkdir( "global/2d/shk")
-
os.mkdir( "global/2d/shk/script")
-
os.mkdir( "global/2d/shk/render")
-
os.mkdir( "global/2d/output")
-
-
os.mkdir( "global/3d")
-
os.mkdir( "global/3d/boujou")
-
os.mkdir( "global/3d/maya")
-
os.mkdir( "global/3d/max")
-
os.mkdir( "global/3d/syntheyes")
-
os.mkdir( "global/3d/output")
-
-
os.mkdir( "global/color")
-
-
os.mkdir( "global/output")
-
os.mkdir( "global/output/dvd")
-
os.mkdir( "global/output/dvd/projects")
-
os.mkdir( "global/output/dvd/builds")
-
os.mkdir( "global/output/quicktime")
-
-
os.mkdir( "global/edit")
-
os.mkdir( "global/edit/audio")
-
os.mkdir( "global/edit/fcp")
-
os.mkdir( "global/edit/fcp/projects")
-
os.mkdir( "global/edit/graphics")
-
os.mkdir( "global/edit/edl")
-
os.mkdir( "global/edit/xml")
-
-
os.mkdir( "global/plates")
-
os.mkdir( "global/ref")
-
-
-
def SUBFOLDERS():
-
-
os.mkdir( "2d")
-
os.mkdir( "2d/ae")
-
os.mkdir( "2d/ae/render")
-
os.mkdir( "2d/ae/script")
-
os.mkdir( "2d/ai")
-
os.mkdir( "2d/ai/project")
-
os.mkdir( "2d/ai/export")
-
os.mkdir( "2d/motion")
-
os.mkdir( "2d/motion/scripts")
-
os.mkdir( "2d/motion/render")
-
os.mkdir( "2d/psd")
-
os.mkdir( "2d/psd/project")
-
os.mkdir( "2d/psd/export")
-
os.mkdir( "2d/shk")
-
os.mkdir( "2d/shk/render")
-
os.mkdir( "2d/shk/script")
-
os.mkdir( "2d/output")
-
-
os.mkdir( "3d")
-
os.mkdir( "3d/boujou")
-
os.mkdir( "3d/maya")
-
os.mkdir( "3d/max")
-
os.mkdir( "3d/syntheyes")
-
os.mkdir( "3d/output")
-
-
os.mkdir( "plates")
-
-
os.chdir( "../")
-
-
-
#CREATE JOB DIRECTORY
-
os.mkdir( jobfolder)
-
-
#CREATE OFFLINE & CHANGE INTO OFFLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES & GLOBALS
-
os.mkdir( jobfolder + "/offline")
-
os.chdir( jobfolder + "/offline")
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
#CREATE ONLINE & CHANGE INTO ONLINE DIRECTORY TO CREATE ALL THE SHOT DIRECTORIES
-
os.chdir( jobroot)
-
os.mkdir( jobfolder + "/online")
-
os.chdir( jobfolder + "/online")
-
GLOBALSDIR()
-
-
#CREATE SHOT DIRECTORY AND AND SUB-DIRECTORIES
-
-
for i in range(1, shotamount + 1):
-
shotname = '%03d' % (i)
-
os.mkdir( shotname)
-
os.chdir( shotname)
-
SUBFOLDERS()
-
-
-
print
-
print "job " + jobfolder + " created"
-
-
-
-
-
class MyApp(wx.App):
-
def OnInit(self):
-
frame = MyFrame(None, -1, 'New Job')
-
frame.Show(True)
-
frame.Centre()
-
return True
-
-
app = MyApp(0)
-
app.MainLoop()
-
-
hey guys
thanks for all your help so far - sorry I havent got back to your replies - distracted with work
I think I understand what u mean by giving everything descriptive names and assigning them as self. and flexible IDs
Does this look better?
It still doesn't work - I cant seem to convert a string to an integer - this error:
line 128, in OnCreateJob
os.mkdir( self.jobfolder)
TypeError: coercing to Unicode: need string or buffer, TextCtrl found
Any ideas how to get that to convert to a string?
i thought this would work:
int( self.NumberOfShots)
but get this:
TypeError: int() argument must be a string or a number
Cheers!!
Adam
It's starting to look good (even better with "=python" in the code tags).
A couple of things:
str() will convert pure python Types (objects with __str__() methods) to strings.
In order to get a value from a GUI object, call one of its "getter" (almost always starts with "Get") functions.
I'm not going to run this on my machine so we'll just have to work out the bugs long-distance.
Get rid of -
self.jobfolder = str( self.JobName)
In the event handler (and I'm beginning to doubt the logic behind creating so many directories in response to an event) where you need the value of a GUI element, - #
-
-
#
-
#CREATE JOB DIRECTORY
-
jobFolderName = self.JobName.GetValue()
-
os.mkdir( jobFolderName)
ahhhhh cool! I get it!
Thanks for all your help so far!
Will keep refining it!
Thanks again!
This is very addictive
ahhhhh cool! I get it!
Thanks for all your help so far!
Will keep refining it!
Thanks again!
This is very addictive
You are welcome.
I highly recommend hitting the "buy the book" link on the wxPython home page. Your purchase helps pay for the project is some small way and the info in there is invaluable.
You are welcome.
I highly recommend hitting the "buy the book" link on the wxPython home page. Your purchase helps pay for the project is some small way and the info in there is invaluable.
great idea! Will definitely do that! Cheers!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Andy Read |
last post by:
Dear all,
I thought I understood passing parameters ByVal and ByRef but I
clearly don't! If I define a simple class
of:
Public Class Person
Public Name as String
Public Age as Integer
End...
|
by: justanotherguy63 |
last post by:
Hi,
I am designing an application where to preserve the hierachy and for
code substitability, I need to pass an array of derived class object in
place of an array of base class object. Since I...
|
by: Kyzer |
last post by:
Hi all,
I have created a class which contains many TShapes, TLabels and
TPanels. What I want to be able to do is when creating this class, is
passing in a pointer to OnMouseDown and OnMouseUp...
|
by: Amadeus W. M. |
last post by:
I have a member static const int x defined in class Foo, and I'm passing
it by reference, and by value elsewhere (see the code below). Passing it
by value works, but by reference it doesn't: it...
|
by: Harolds |
last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005
the pmID is evaluated to "" instead of what the value is set to:
....
xmlItems.Document = pmXML
// Add the pmID...
|
by: Arsen Vladimirskiy |
last post by:
Hello,
If I have a few simple classes to represent Entities such as Customers and
Orders.
What is the proper way to pass information to the Data Access Layer?
1) Pass the actual ENTITY to...
|
by: Ron Rohrssen |
last post by:
I want to show a dialog and when the form (dialog) is
closed, return to the calling form. The calling form
should then be able to pass the child form to another
object with the form as a...
|
by: Ken Allen |
last post by:
I have a .net client/server application using remoting, and I cannot get the
custom exception class to pass from the server to the client. The custom
exception is derived from ApplicationException...
|
by: scottt |
last post by:
hi,
I am having a little problem passing in reference of my calling class (in my
..exe)into a DLL. Both programs are C# and what I am trying to do is pass a
reference to my one class into a DLL...
|
by: TS |
last post by:
I was under the assumption that if you pass an object as a param to a method
and inside that method this object is changed, the object will stay changed
when returned from the method because the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |