ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/MCP_AddCase_UI.py
Revision: 466
Committed: Mon Oct 7 19:13:24 2013 UTC (12 years, 5 months ago) by nino.borges
Content type: text/x-python
File size: 3649 byte(s)
Log Message:
Added a splash screen to ViewEdit, CopyUp and AddCase.

File Contents

# Content
1 """
2
3 MCP_AddCase_UI
4
5 Created by
6 Emanuel Borges
7 12.21.2010
8
9 This is the UI to the Add Case function. Eventually this will be part of a larger
10 GUI console but for now, each will be it's own separate program.
11
12 """
13
14 import wx, MCP_Lib,MCP_Console
15
16 class MyFrame(wx.Frame):
17 def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
18 wx.Frame.__init__(self, parent, ID, title, pos, size =(330,180))#(550,580))
19 self.panel = wx.Panel(self,-1)
20 caseNameLabel = wx.StaticText(self.panel, -1, "Case Name: ")
21 self.caseNameTextBox = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (90,-1))
22 clientMatterLabel = wx.StaticText(self.panel, -1, "Client Matter: ")
23 clientHyphenLabel = wx.StaticText(self.panel, -1, " - ")
24 self.clientNumberTextBox = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (52,-1))
25 self.matterNumberTextBox = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (40,-1))
26 self.CreateBoxesSection()
27
28 requiredSectionSizer = wx.GridBagSizer(10,2)
29 requiredSectionSizer.Add(caseNameLabel,pos = (0,0))
30 requiredSectionSizer.Add(self.caseNameTextBox,pos = (0,1),span=(1,4), flag = wx.EXPAND)
31 requiredSectionSizer.Add(clientMatterLabel,pos = (1,0))
32 requiredSectionSizer.Add(self.clientNumberTextBox,pos = (1,1))
33 requiredSectionSizer.Add(clientHyphenLabel, pos=(1,2))
34 requiredSectionSizer.Add(self.matterNumberTextBox,pos = (1,3))
35 mainSizer = wx.BoxSizer(wx.VERTICAL)
36 mainSizer.Add(requiredSectionSizer,0, wx.ALL, 20)
37 #mainSizer.Add(self.caseNameTextBox, 0, wx.ALL, 10)
38 mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
39
40 self.panel.SetSizer(mainSizer)
41 self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
42 self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
43
44 def CreateBoxesSection(self):
45 self.oKButton = wx.Button(self.panel, wx.ID_OK)
46 self.oKButton.SetDefault()
47 self.oKButton.SetSize(self.oKButton.GetBestSize())
48 self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL)
49 self.cancelButton.SetSize(self.cancelButton.GetBestSize())
50 self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
51 self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
52 self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
53
54 def CloseWindow(self, event):
55 self.Close(True)
56
57 def OnProcess(self, event):
58 print self.caseNameTextBox.GetValue()
59 print self.clientNumberTextBox.GetValue() + " - " + self.matterNumberTextBox.GetValue()
60 processor = MCP_Console.MainConsole()
61 processor.AddNewCase(self.caseNameTextBox.GetValue(),self.clientNumberTextBox.GetValue() + "-" + self.matterNumberTextBox.GetValue())
62 self.Show(False)
63 finishedDlg = wx.MessageDialog(self, "A new case been added to the MCP.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
64 finishedDlg.ShowModal()
65 self.Destroy()
66
67 class MyApp(wx.App):
68 def OnInit(self):
69 image = wx.Image("DDSC-LTsmall_2.jpg", wx.BITMAP_TYPE_JPEG)
70 bmp = image.ConvertToBitmap()
71 wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_PARENT |wx.SPLASH_TIMEOUT, 2000, None, -1)
72 wx.Yield()
73 prgVersion = MCP_Lib.GetMCPVersion()
74 self.frame = MyFrame(None, -1, "MCP Add New Case %s"%prgVersion)
75 self.frame.Show(True)
76 self.SetTopWindow(self.frame)
77 return True
78
79
80 if __name__ == '__main__':
81 app = MyApp(0)
82 app.MainLoop()