| 1 |
nino.borges |
681 |
"""
|
| 2 |
|
|
Created by Emanuel Borges
|
| 3 |
|
|
2020.05.04
|
| 4 |
|
|
|
| 5 |
|
|
GUI for the Evidence Item Log Creator Program
|
| 6 |
|
|
|
| 7 |
|
|
"""
|
| 8 |
|
|
|
| 9 |
|
|
|
| 10 |
|
|
import wx, os
|
| 11 |
nino.borges |
684 |
import wx.lib.agw.pybusyinfo as PBI
|
| 12 |
nino.borges |
681 |
import EvidenceItemLogCreator
|
| 13 |
|
|
|
| 14 |
|
|
|
| 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 = (350,325))
|
| 19 |
|
|
#db = ConcordanceConnection()
|
| 20 |
|
|
self.panel = wx.Panel(self,-1)
|
| 21 |
|
|
self.currentCaseStaticText = wx.StaticText(self.panel, -1, "This simple program will take an exported evidence\nreport from the XPM app and convert it to a report\nthat can be shared with a client.",wx.DefaultPosition)
|
| 22 |
|
|
|
| 23 |
|
|
|
| 24 |
|
|
self.CreateBrowseSection()
|
| 25 |
|
|
self.fileNameBox = wx.TextCtrl(self.panel, -1, "", size=(190, -1), style=wx.TE_READONLY)
|
| 26 |
|
|
self.CreateBoxesSection()
|
| 27 |
|
|
|
| 28 |
|
|
|
| 29 |
|
|
|
| 30 |
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 31 |
|
|
mainSizer.Add(self.currentCaseStaticText,0,wx.ALL, 25)
|
| 32 |
|
|
mainSizer.Add(self.browseSectionSizer, 0, wx.ALIGN_CENTER|wx.ALL, 5)
|
| 33 |
|
|
mainSizer.Add(self.fileNameBox, 0, wx.ALIGN_CENTER|wx.ALL, 5)
|
| 34 |
|
|
mainSizer.Add(self.buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL,25)
|
| 35 |
|
|
self.panel.SetSizer(mainSizer)
|
| 36 |
|
|
|
| 37 |
|
|
self.CreateStatusBar()
|
| 38 |
|
|
self.SetStatusText("Ready.")
|
| 39 |
|
|
|
| 40 |
|
|
self.oKButton.Disable()
|
| 41 |
|
|
|
| 42 |
|
|
self.Bind(wx.EVT_BUTTON, self.Process, self.oKButton)
|
| 43 |
|
|
self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
|
| 44 |
|
|
|
| 45 |
|
|
def CreateBrowseSection(self):
|
| 46 |
|
|
self.browseButton = wx.Button(self.panel, -1, "SelectReport", (50,50))
|
| 47 |
|
|
self.Bind(wx.EVT_BUTTON, self.OnBrowseButton, self.browseButton)
|
| 48 |
|
|
self.browseSectionSizer = wx.BoxSizer(wx.VERTICAL)
|
| 49 |
|
|
self.browseSectionSizer.Add(self.browseButton,0, wx.ALIGN_RIGHT|wx.ALL, 5)
|
| 50 |
|
|
|
| 51 |
|
|
def CreateBoxesSection(self):
|
| 52 |
|
|
self.oKButton = wx.Button(self.panel, -1, "Ok", (10,10))
|
| 53 |
|
|
self.oKButton.SetDefault()
|
| 54 |
|
|
self.oKButton.SetSize(self.oKButton.GetBestSize())
|
| 55 |
|
|
self.cancelButton = wx.Button(self.panel, -1, "Cancel", (10,10))
|
| 56 |
|
|
self.cancelButton.SetSize(self.cancelButton.GetBestSize())
|
| 57 |
|
|
self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 58 |
|
|
self.buttonSizer.Add(self.oKButton, 0, wx.ALL,10)
|
| 59 |
|
|
self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
|
| 60 |
|
|
|
| 61 |
|
|
def OnBrowseButton(self, event):
|
| 62 |
|
|
dlg = wx.FileDialog(
|
| 63 |
|
|
self, message="Choose a file",
|
| 64 |
|
|
defaultDir=os.path.expanduser("~\\Downloads"),
|
| 65 |
|
|
defaultFile="",
|
| 66 |
|
|
wildcard="All files (*.*)|*.*",
|
| 67 |
|
|
style=wx.FD_OPEN |
|
| 68 |
|
|
wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST |
|
| 69 |
|
|
wx.FD_PREVIEW
|
| 70 |
|
|
)
|
| 71 |
|
|
if dlg.ShowModal() == wx.ID_OK:
|
| 72 |
|
|
self.rawReportPath = dlg.GetPath()
|
| 73 |
|
|
self.fileNameBox.SetValue(os.path.split(dlg.GetPath())[1])
|
| 74 |
|
|
self.oKButton.Enable()
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
def Process(self,event):
|
| 79 |
nino.borges |
684 |
message = "Please wait while the new report is generated..."
|
| 80 |
|
|
busy = PBI.PyBusyInfo(message, parent=self, title="System Busy: Hold Yer Horses!")
|
| 81 |
nino.borges |
681 |
EvidenceItemLogCreator.CreateEvidenceItemLog(self.rawReportPath)
|
| 82 |
nino.borges |
684 |
del busy
|
| 83 |
nino.borges |
681 |
finishedDiag = wx.MessageDialog(self, "Report has been created and saved to the same path.", "Processing Complete.", wx.OK | wx.ICON_INFORMATION)
|
| 84 |
|
|
finishedDiag.ShowModal()
|
| 85 |
|
|
finishedDiag.Destroy()
|
| 86 |
|
|
self.Close(True)
|
| 87 |
|
|
|
| 88 |
|
|
def CloseWindow(self,event):
|
| 89 |
|
|
self.Close(True)
|
| 90 |
|
|
|
| 91 |
|
|
class MyApp(wx.App):
|
| 92 |
|
|
def OnInit(self):
|
| 93 |
nino.borges |
714 |
self.frame = MyFrame(None, -1, "Evidence Item Log Creator v 1.8")
|
| 94 |
nino.borges |
681 |
self.frame.Show(True)
|
| 95 |
|
|
self.SetTopWindow(self.frame)
|
| 96 |
|
|
return True
|
| 97 |
|
|
|
| 98 |
|
|
|
| 99 |
|
|
if __name__ == '__main__':
|
| 100 |
|
|
app = MyApp(0)
|
| 101 |
|
|
app.MainLoop() |