| 1 |
nino.borges |
573 |
"""
|
| 2 |
|
|
NewProductionRequest
|
| 3 |
|
|
|
| 4 |
|
|
Created by
|
| 5 |
|
|
Emanuel Borges
|
| 6 |
|
|
02.04.2015
|
| 7 |
|
|
|
| 8 |
|
|
"""
|
| 9 |
|
|
|
| 10 |
|
|
import wx, HoneywellProjectManager
|
| 11 |
|
|
|
| 12 |
|
|
class MyFrame(wx.Frame):
|
| 13 |
|
|
def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
|
| 14 |
|
|
wx.Frame.__init__(self, parent, ID, title, pos, size =(430,280))#(550,580))
|
| 15 |
|
|
self.panel = wx.Panel(self,-1)
|
| 16 |
|
|
productionNameLabel = wx.StaticText(self.panel, -1, "Production Name: ")
|
| 17 |
|
|
self.productionNameTextBox = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (90,-1))
|
| 18 |
|
|
assignedByLabel = wx.StaticText(self.panel, -1, "Assigned By: ")
|
| 19 |
|
|
assignedToLabel = wx.StaticText(self.panel, -1, "Assigned To:")
|
| 20 |
|
|
self.assignedByTextBox = wx.TextCtrl(self.panel, -1, "Stacy", wx.DefaultPosition, (90,-1))
|
| 21 |
|
|
self.assignedToTextBox = wx.TextCtrl(self.panel, -1, "Manny", wx.DefaultPosition, (90,-1))
|
| 22 |
|
|
dueDateLabel = wx.StaticText(self.panel, -1, "Due Date:")
|
| 23 |
|
|
self.dueDateTextBox = wx.DatePickerCtrl(self.panel, size=(120,-1),style = wx.DP_DROPDOWN)#|wx.DP_SHOWCENTURY)
|
| 24 |
|
|
|
| 25 |
|
|
self.pdfRequestedCheckBox = wx.CheckBox(self.panel,-1,"PDFs too?")
|
| 26 |
|
|
self.CreateBoxesSection()
|
| 27 |
|
|
|
| 28 |
|
|
requiredSectionSizer = wx.GridBagSizer(10,2)
|
| 29 |
|
|
requiredSectionSizer.Add(productionNameLabel,pos = (0,0))
|
| 30 |
|
|
requiredSectionSizer.Add(self.productionNameTextBox,pos = (0,1), flag = wx.EXPAND)
|
| 31 |
|
|
requiredSectionSizer.Add(assignedByLabel,pos = (1,0))
|
| 32 |
|
|
requiredSectionSizer.Add(self.assignedByTextBox,pos = (1,1))
|
| 33 |
|
|
requiredSectionSizer.Add(assignedToLabel, pos=(2,0))
|
| 34 |
|
|
requiredSectionSizer.Add(self.assignedToTextBox,pos = (2,1))
|
| 35 |
|
|
|
| 36 |
|
|
requiredSectionSizer.Add(dueDateLabel, pos=(3,0))
|
| 37 |
|
|
requiredSectionSizer.Add(self.dueDateTextBox,pos = (3,1))
|
| 38 |
|
|
requiredSectionSizer.Add(self.pdfRequestedCheckBox, pos=(4,0))
|
| 39 |
|
|
|
| 40 |
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 41 |
|
|
mainSizer.Add(requiredSectionSizer,0, wx.ALL, 20)
|
| 42 |
|
|
#mainSizer.Add(self.productionNameTextBox, 0, wx.ALL, 10)
|
| 43 |
|
|
mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
|
| 44 |
|
|
|
| 45 |
|
|
self.panel.SetSizer(mainSizer)
|
| 46 |
|
|
self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
|
| 47 |
|
|
self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
|
| 48 |
|
|
|
| 49 |
|
|
def CreateBoxesSection(self):
|
| 50 |
|
|
self.oKButton = wx.Button(self.panel, wx.ID_OK)
|
| 51 |
|
|
self.oKButton.SetDefault()
|
| 52 |
|
|
self.oKButton.SetSize(self.oKButton.GetBestSize())
|
| 53 |
|
|
self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL)
|
| 54 |
|
|
self.cancelButton.SetSize(self.cancelButton.GetBestSize())
|
| 55 |
|
|
self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 56 |
|
|
self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
|
| 57 |
|
|
self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
|
| 58 |
|
|
|
| 59 |
|
|
def CloseWindow(self, event):
|
| 60 |
|
|
self.Close(True)
|
| 61 |
|
|
|
| 62 |
|
|
def OnProcess(self, event):
|
| 63 |
|
|
prodName = str(self.productionNameTextBox.GetValue())
|
| 64 |
|
|
print prodName
|
| 65 |
|
|
assignedBy = str(self.assignedByTextBox.GetValue())
|
| 66 |
|
|
print assignedBy
|
| 67 |
|
|
assignedTo = str(self.assignedToTextBox.GetValue())
|
| 68 |
|
|
print assignedTo
|
| 69 |
|
|
dueDate = str(self.dueDateTextBox.GetValue()).split(" ")[0]
|
| 70 |
|
|
dueDate = "%s20%s"%(dueDate[:-2],dueDate[-2:])
|
| 71 |
|
|
print dueDate
|
| 72 |
|
|
print self.pdfRequestedCheckBox.GetValue()
|
| 73 |
|
|
db = HoneywellProjectManager.HPM()
|
| 74 |
|
|
db.CreateProductionEntry(prodName,assignedTo,assignedBy,dueDate,self.pdfRequestedCheckBox.GetValue())
|
| 75 |
nino.borges |
574 |
db.GetProductionReport(r"\\nykads01\data\CLI\_Manny_Borges_BOS\_HPRS\Productions.html")
|
| 76 |
nino.borges |
573 |
#processor = MCP_Console.MainConsole()
|
| 77 |
|
|
#processor.AddNewCase(self.productionNameTextBox.GetValue(),self.assignedByTextBox.GetValue() + "-" + self.assignedToTextBox.GetValue())
|
| 78 |
|
|
self.Show(False)
|
| 79 |
|
|
finishedDlg = wx.MessageDialog(self, "A new production has been added to the HPM.", "Process Complete",wx.OK, wx.DefaultPosition)
|
| 80 |
|
|
finishedDlg.ShowModal()
|
| 81 |
|
|
self.Destroy()
|
| 82 |
|
|
|
| 83 |
|
|
class MyApp(wx.App):
|
| 84 |
|
|
def OnInit(self):
|
| 85 |
|
|
#image = wx.Image("DDSC-LTsmall_2.jpg", wx.BITMAP_TYPE_JPEG)
|
| 86 |
|
|
#bmp = image.ConvertToBitmap()
|
| 87 |
|
|
#wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_PARENT |wx.SPLASH_TIMEOUT, 2000, None, -1)
|
| 88 |
|
|
#wx.Yield()
|
| 89 |
|
|
#prgVersion = MCP_Lib.GetMCPVersion()
|
| 90 |
|
|
self.frame = MyFrame(None, -1, "Add New Production")
|
| 91 |
|
|
self.frame.Show(True)
|
| 92 |
|
|
self.SetTopWindow(self.frame)
|
| 93 |
|
|
return True
|
| 94 |
|
|
|
| 95 |
|
|
|
| 96 |
|
|
if __name__ == '__main__':
|
| 97 |
|
|
app = MyApp(0)
|
| 98 |
|
|
app.MainLoop() |