ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/CasePathsDialog.py
Revision: 265
Committed: Mon Feb 4 18:47:35 2013 UTC (13 years, 1 month ago) by nino.borges
Content type: text/x-python
File size: 2359 byte(s)
Log Message:
Finished and tested Alternate Media Path feature with settings feature.

File Contents

# User Rev Content
1 nino.borges 263 """
2     CasePathsDialog
3    
4     Created by
5     Emanuel Borges
6     02.01.2013
7    
8     This dialog will show the alternate media path and allow them to change it.
9     It will also show and unchageable case path.
10    
11     """
12    
13     import wx, wx.grid, os
14    
15     class CasePathsDialog(wx.Dialog):
16     def __init__(self, parent,altMediaPath,casePath):
17     #self.CLM = CLM
18     self.parent = parent
19 nino.borges 265 wx.Dialog.__init__(self, parent, -1, "Case Paths", style = wx.DEFAULT_DIALOG_STYLE, size = (450,190))
20 nino.borges 263 altMediaPathStaticText = wx.StaticText(self, -1, "Alternate Media Path:",wx.DefaultPosition)
21     self.altMediaPathControl = wx.TextCtrl(self,-1,altMediaPath, size=(296,-1))
22 nino.borges 265 casePathStaticText = wx.StaticText(self, -1, "Case Files Path:",wx.DefaultPosition)
23 nino.borges 263 self.casePathControl = wx.TextCtrl(self,-1,casePath, size=(296,-1))
24 nino.borges 265 self.casePathControl.Enable(False)
25 nino.borges 263
26     mainSizer = wx.BoxSizer(wx.VERTICAL)
27     altMediaPathSizer = wx.BoxSizer(wx.HORIZONTAL)
28     altMediaPathSizer.Add(altMediaPathStaticText,0,wx.ALL,5)
29     altMediaPathSizer.Add(self.altMediaPathControl,0,wx.ALL,5)
30    
31     casePathSizer = wx.BoxSizer(wx.HORIZONTAL)
32     casePathSizer.Add(casePathStaticText,0,wx.ALL,5)
33     casePathSizer.Add(self.casePathControl,0,wx.ALL,5)
34    
35     mainSizer.Add(altMediaPathSizer,0,wx.ALL, 10)
36     mainSizer.Add(casePathSizer,0,wx.ALL, 10)
37    
38     oKButton = wx.Button(self, wx.ID_OK)
39     oKButton.SetDefault()
40     cancelButton = wx.Button(self, wx.ID_CANCEL)
41     buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
42     buttonSizer.Add(oKButton,0,wx.ALL,5)
43     buttonSizer.Add(cancelButton,0,wx.ALL,5)
44     mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
45     self.SetSizer(mainSizer)
46    
47     def GetValues(self):
48     ## check to see if it's a drive letter. if so, convert to unc.
49     ## Do not allow local paths.
50     altMediaPath = self.altMediaPathControl.GetValue()
51     if os.path.splitdrive(altMediaPath)[0]:
52     err = True
53     else:
54     if os.path.exists(altMediaPath):
55     err = False
56 nino.borges 265 else:
57     if altMediaPath == "":
58     err = False
59     else:
60     err = True
61     return altMediaPath, err