def _updateValuesRecovery(self, event): if not self.status.hasMoreSourceFiles(): return elapsed = self.status.getCurrentElapsedTime() time1 = tools.processTime(elapsed) self.label_current_time_value = "Time elapsed: "+time1[0]+":"+time1[1]+":"+time1[2] if self.status.getCurrentFinished() != 0 and (self.status.getCurrentSize() - self.status.getCurrentFinished()) != 0: remaining = self.status.getCurrentElapsedTime() / self.status.getCurrentFinished() * (self.status.getCurrentSize() - self.status.getCurrentFinished()) remaining = tools.processTime(remaining) elapsed = time1 self.label_current_time_value = "Time elapsed: " + elapsed[0] + ":" + elapsed[1] + ":" + elapsed[2] + " (- " + remaining[0] + ":" + remaining[1] + ":" + remaining[2] + ")" self.gauge_current_file_value = self.status.getCurrentFinished() * 10000 / self.status.getCurrentSize() progress = int(round(self.status.getCurrentFinished() * 10000.0 / self.status.getCurrentSize())) self.label_current_percentage_value = "Finished: "+ self._formatSize(self.status.getCurrentFinished())+" / "+self._formatSize(self.status.getCurrentSize()) + " (" + str(progress / 100) +"."+ str(progress % 100 / 10) + str(progress % 100 % 10) +" %)" self.label_current_found_value = "Files recovered: " + str(self.status.getCurrentFound()) #self.label_overall_filesdone_value = "Current source file: "+ str(self.status.finished+1) + " / " + str(self.status.getSourceFileNumber()) progress_per_file = 10000.0 / self.status.getSourceFileNumber() progressOverall = int(round(self.status.finished * progress_per_file + self.status.getCurrentFinished() * progress_per_file / self.status.getCurrentSize())) self._page3.label_current_time.SetLabel(self.label_current_time_value) self._page3.gauge_current_file.SetValue(self.gauge_current_file_value) self._page3.label_current_percentage.SetLabel(self.label_current_percentage_value) self._page3.label_current_found.SetLabel(self.label_current_found_value)
def _displayResults(self): elapsed = tools.processTime(self._timeAllTogether) self._page4._timeOverall.SetLabel("Overall time: " + elapsed[0] + ":" + elapsed[1] + ":" + elapsed[2]) self._page4._lFilesRecovered.SetLabel("Files recovered: " + str(self.status.getOverallFound())) if self._page1.if_dir.GetValue() == "Working Directory": location_dest = tools.determineAbsPath("./") else: location_dest = tools.determineAbsPath(self._page1.if_dir.GetValue()) self._page4._outputLocation.SetLabel("Look for your recovered files in:\n " + location_dest) if FESettings.getSettings().getValue("ig_delete_imagefile") == "yes": location_dest = tools.determineAbsPath( FESettings.getSettings().getValue("ig_output_dir")) if os.path.exists(location_dest): os.remove(location_dest) print "Image file removed."
def __init__(self, parent, ID, title, status): """ Initialises the result dialog. Creates a wxDialog (size L{wxSize(600,400)}) and fills the content. The events for the close button is registered with its private function. Finally, this dialog is centered on the parent window and displayed modally. Hence; the function L{ShowModal()} must not be invoked from the calling module. @param parent: Parent window for this wxDialog - passed to the superclass constructor (wxPython.wx.wxDialog.__init__) @type parent: L{wxPython.wx.wxFrame} @param ID: ID for this component - passed to the superclass constructor (wxPython.wx.wxDialog.__init__) @type ID: C{int} @param title: Title for the dialog - - passed to the superclass constructor (wxPython.wx.wxDialog.__init__) @type title: C{String} @param status: Status instance for the execution results shall be shown for @type status: L{ExecutionSettings.ExecutionStatus} """ wxDialog.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(600, 400)) settings = status.settings font_headings = wxFont(12, wxDEFAULT, wxNORMAL, wxBOLD) panel_outer = wxPanel(self, -1) label_results = wxStaticText (panel_outer, -1 , "Results") label_results.SetFont(font_headings) panel_content = wxPanel(panel_outer, -1) colour = panel_content.GetBackgroundColour() grid = wxGrid(panel_content, -1, wxDefaultPosition, wxSize(400,300), wxSIMPLE_BORDER) no_rows = len(settings.sourceFiles) + 2 no_cols = len(settings.signatures) + 2 grid.CreateGrid(no_rows,no_cols) font_bold = grid.GetDefaultCellFont() font_bold.SetWeight(wxBOLD) colour_grid = grid.GetDefaultCellTextColour() grid.SetDefaultCellBackgroundColour(colour) grid.EnableEditing(false) grid.SetRowLabelSize(0) grid.SetColLabelSize(0) grid.SetGridLineColour(colour_grid) i = 1 for sourceFile in settings.sourceFiles: grid.SetCellValue(i,0, sourceFile) grid.SetCellAlignment(i, 0, wxALIGN_RIGHT, wxALIGN_CENTRE) i += 1 grid.SetCellValue(no_rows-1,0, "After all") grid.SetCellAlignment(no_rows-1, 0, wxALIGN_RIGHT, wxALIGN_CENTRE) grid.SetCellFont(no_rows-1, 0, font_bold) j = 1 for j1 in range(0, len(settings.signatures)): sig = settings.signatures[j1] grid.SetCellValue(0, j, sig[signatures.name]) grid.SetCellAlignment(0, j, wxALIGN_CENTRE, wxALIGN_CENTRE) grid.SetColSize(j,50) j += 1 grid.SetColSize(0,150) grid.SetColSize(no_cols-1,100) grid.SetCellValue(0, no_cols-1,"Time") grid.SetCellAlignment(0, no_cols-1, wxALIGN_CENTRE, wxALIGN_CENTRE) overall_time = 0 k = 1 for z in range(0, len(settings.sourceFiles)): name = settings.sourceFiles[z] res = status.result_eachfile[z] l = 1 for l1 in range(0, len(settings.signatures)): sig = settings.signatures[l1] if res.has_key(sig[signatures.name]): grid.SetCellValue(k, l, str(res[sig[signatures.name]])) else: grid.SetCellValue(k, l, "0") grid.SetCellAlignment(k, l, wxALIGN_RIGHT, wxALIGN_CENTRE) l += 1 overall_time += status.getRunTimeForNumber(z) timeL = tools.processTime(status.getRunTimeForNumber(z)) grid.SetCellValue(k, no_cols-1, timeL[0] + ":" + timeL[1] + ":" + timeL[2]) grid.SetCellAlignment(k, no_cols-1, wxALIGN_RIGHT, wxALIGN_CENTRE) k += 1 timeL = tools.processTime(overall_time) grid.SetCellValue(no_rows-1, no_cols-1, timeL[0] + ":" + timeL[1] + ":" + timeL[2]) grid.SetCellAlignment(no_rows-1, no_cols-1, wxALIGN_RIGHT, wxALIGN_CENTRE) grid.SetCellFont(no_rows-1, no_cols-1, font_bold) l = 1 for l1 in range(0, len(settings.signatures)): sig = settings.signatures[l1] grid.SetCellValue(no_rows-1, l, str(status.counterr[sig[signatures.name]])) grid.SetCellAlignment(no_rows-1, l, wxALIGN_RIGHT, wxALIGN_CENTRE) grid.SetCellFont(no_rows-1, l, font_bold) l += 1 boxc = wxBoxSizer(wxVERTICAL) boxc.Add(grid,1, wxEXPAND) panel_content.SetAutoLayout(True) panel_content.SetSizer(boxc) panel_content.Layout() label_destfolder = wxStaticText(panel_outer, -1, "Find your output files in") if_dir = wxTextCtrl(panel_outer, -1, settings.dest_folder) if_dir.SetEditable(false) if_dir.Enable(false) self.bOKButton = wxButton(panel_outer, _ID_B_OK, "OK") pFill0 = wxPanel(panel_outer, -1) pFill1 = wxPanel(panel_outer, -1) pFill2 = wxPanel(panel_outer, -1) pFill3 = wxPanel(panel_outer, -1) pFill4 = wxPanel(panel_outer, -1) box = wxBoxSizer(wxVERTICAL) box.Add(pFill0, 1) box.Add(label_results, 2, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL) box.Add(pFill1, 1) box.Add(panel_content, 15, wxEXPAND) box.Add(pFill2, 1) box.Add(label_destfolder, 1, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT) box.Add(if_dir, 2, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT) box.Add(pFill3, 1) box.Add(self.bOKButton, 2, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) box.Add(pFill4, 1) panel_outer.SetAutoLayout(True) panel_outer.SetSizer(box) panel_outer.Layout() pFill4 = wxPanel(self, -1) pFill5 = wxPanel(self, -1) boxo = wxBoxSizer(wxHORIZONTAL) boxo.Add(pFill4, 1, wxEXPAND) boxo.Add(panel_outer, 20, wxEXPAND) boxo.Add(pFill5, 1, wxEXPAND) self.SetAutoLayout(True) self.SetSizer(boxo) self.Layout() EVT_BUTTON(self, _ID_B_OK, self.closeItDown) self.CentreOnParent() self.ShowModal()