| 1 |
"""
|
| 2 |
|
| 3 |
WorkDirDialog
|
| 4 |
|
| 5 |
Created by
|
| 6 |
Emanuel Borges
|
| 7 |
01.25.2013
|
| 8 |
|
| 9 |
This dialog will show the copyup work dir and allow them to change it.
|
| 10 |
|
| 11 |
"""
|
| 12 |
|
| 13 |
import wx, wx.grid, os
|
| 14 |
|
| 15 |
class WorkDirDialog(wx.Dialog):
|
| 16 |
def __init__(self, parent,workDir):
|
| 17 |
#self.CLM = CLM
|
| 18 |
self.parent = parent
|
| 19 |
wx.Dialog.__init__(self, parent, -1, "Temporary File Archive Buffer Directory", style = wx.DEFAULT_DIALOG_STYLE, size = (510,140))
|
| 20 |
#wx.Frame.__init__(self, parent, -1, 'test', size =(435,500))
|
| 21 |
#panel = wx.Panel(self,-1)
|
| 22 |
workDirStaticText = wx.StaticText(self, -1, "Select Work Dir:",wx.DefaultPosition)
|
| 23 |
self.workDirControl = wx.TextCtrl(self,-1,workDir, size=(296,-1))
|
| 24 |
workDirBrowseButton = wx.Button(self, -1, "Browse", (10, 10))
|
| 25 |
|
| 26 |
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 27 |
workDirSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 28 |
workDirSizer.Add(workDirStaticText,0,wx.ALL,5)
|
| 29 |
workDirSizer.Add(self.workDirControl,0,wx.ALL,5)
|
| 30 |
workDirSizer.Add(workDirBrowseButton,0,wx.ALL,5)
|
| 31 |
mainSizer.Add(workDirSizer,0,wx.ALL, 10)
|
| 32 |
|
| 33 |
oKButton = wx.Button(self, wx.ID_OK)
|
| 34 |
oKButton.SetDefault()
|
| 35 |
cancelButton = wx.Button(self, wx.ID_CANCEL)
|
| 36 |
buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 37 |
buttonSizer.Add(oKButton,0,wx.ALL,5)
|
| 38 |
buttonSizer.Add(cancelButton,0,wx.ALL,5)
|
| 39 |
mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
|
| 40 |
self.SetSizer(mainSizer)
|
| 41 |
self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, workDirBrowseButton)
|
| 42 |
def OnBrowseClick(self,event):
|
| 43 |
#eventCode = event.GetId()
|
| 44 |
#print eventCode
|
| 45 |
#if eventCode == -209:
|
| 46 |
dlg = wx.DirDialog(self, message = "Working Directory Path: ", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
|
| 47 |
if dlg.ShowModal() == wx.ID_OK:
|
| 48 |
dirPath = dlg.GetPath()
|
| 49 |
dlg.Destroy()
|
| 50 |
self.workDirControl.SetValue(dirPath)
|
| 51 |
def GetValues(self):
|
| 52 |
return self.workDirControl.GetValue() |