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 _startImageProcessing(self): from imagegenerator import Runtime corename = tools.determineCoreName( FESettings.getSettings().getValue("ig_default_core")) location_dd = tools.determineAbsPath( FESettings.getSettings().getValue("ig_location_dd")) location_dest = tools.determineAbsPath( os.path.join(FESettings.getSettings().getValue("ig_output_dir"), FESettings.getSettings().getValue("ig_output_filename"))) self._timeAllTogether = 0 sourceTmp = self._page1._cbSources.GetValue() ## sourceTmp = self._cbSources.GetStringSelection() if self._devicesDict.has_key(sourceTmp): source = self._devicesDict[sourceTmp] else: source = sourceTmp #location_dest = "d:\\temp\\dd.img" if os.path.exists(location_dest): print "Image file existing - I am overwriting." try: os.remove(location_dest) except OSError: # let's try again with root priv print "Seems to be root; try again with root priv" sudo = FESettings.getSettings().getValue('command_sudo') command = sudo + " rm " + location_dest ret = os.system(command) # FIX ME: if not working ... redirectBuffer = DEBUG_FILENAME settings = Runtime.Settings(path_dd = location_dd, source = source, destination = location_dest, redirectOutput = redirectBuffer) #corename = tools.determineCoreName( getSettings("ig_default_core")) #print corename core = self._initCore(corename, settings) status = Runtime.Status() status.setStarted() sizeEstimation = core.getSizeEstimationForPartition(settings.getSource()) if sizeEstimation: status.setEndFilesize(sizeEstimation) thread.start_new_thread(core.createImage,(status,)) self._mytimer = wx.Timer(self, _TIMER_ID) self._mytimer.Start(1000, 0) wx.EVT_TIMER(self, _TIMER_ID, self._updateValuesImaging) self._status = status self._settings = settings
def _startFileRecovery(self): location_img = tools.determineAbsPath( os.path.join(FESettings.getSettings().getValue("ig_output_dir"), FESettings.getSettings().getValue("ig_output_filename"))) if self._page1.if_dir.GetValue() == "Working Directory": location_dest = tools.determineAbsPath("./") else: location_dest = tools.determineAbsPath(self._page1.if_dir.GetValue()) self.settings = ExecutionSettings(sourceFiles = [location_img], signatures = signatures.getCopyOfAllSignauteres(), output_frequency = 2300, output_level = 0, dest_folder = location_dest) self.status = ExecutionStatus(self.settings) self.startTime = time.time() if FileExtractorCore.init(self.status) < 0: print "Error on initialisation" thread.start_new_thread(self._startRecoveryInThred,(self.status,)) self._mytimer = wx.Timer(self, _TIMER_ID1) self._mytimer.Start(1000, 0) wx.EVT_TIMER(self, _TIMER_ID1, self._updateValuesRecovery)
def _processSourcesList(self): corename = tools.determineCoreName( FESettings.getSettings().getValue("ig_default_core")) locationDD = tools.determineAbsPath( FESettings.getSettings().getValue("ig_location_dd")) #print corename self._devicesDict = {} self._core = self._initCore(corename, ddloc = locationDD) suggestions, devices = self._core.getPossibleSources() self._page1._cbSources.Clear() i = 0 for sug in suggestions: self._page1._cbSources.Append(sug, None) self._devicesDict[sug] = devices[i] i += 1
def __init__(self, parent): AbstractFileExtractorWizardPage.__init__(self, parent, None, None,"newicons/wizard_heading_1.png") contentPane = self.getContentPane() font_headings = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.BOLD) lSources = wx.StaticText(contentPane, -1, "Choose your source device") lSources.SetFont(font_headings) panel_info = wx.Panel(contentPane, -1) choicesSources = [] self._cbSources = wx.ComboBox(panel_info, -1, choices = choicesSources) bmDir = wx.Bitmap(os.path.join(FESettings.PATH_ICONS, "info.png"), wx.BITMAP_TYPE_PNG); panel_fill = wx.Panel(panel_info, -1) ## panel_fill.SetBackgroundColour(wx.RED) bInfoSources = wx.BitmapButton(panel_info, _ID_INFO_SOURCES, bmDir, size=(28,28)) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(self._cbSources, 16, wx.ALIGN_CENTER) box.Add(panel_fill, 1, wx.EXPAND) box.Add(bInfoSources, 3, wx.ALIGN_CENTER) panel_info.SetAutoLayout(True) panel_info.SetSizer(box) panel_info.Layout() lOutputDir = wx.StaticText (contentPane, -1, "Choose your output directory") lOutputDir.SetFont(font_headings) panel_dir = wx.Panel(contentPane, -1) if getSettings().getValue('output_dir'): import tools self.if_dir = wx.TextCtrl(panel_dir, -1, tools.determineAbsPath(getSettings().getValue('output_dir'))) else: self.if_dir = wx.TextCtrl(panel_dir, -1, 'Working Directory') self.if_dir.SetEditable(False) bmDir = wx.Bitmap(os.path.join(FESettings.PATH_ICONS, "browse.png"), wx.BITMAP_TYPE_PNG); panel_fill = wx.Panel(panel_dir, -1) bChooseDir = wx.BitmapButton(panel_dir, _ID_B_DIR, bmDir, size=(28,28)) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(self.if_dir, 16, wx.ALIGN_CENTER) box.Add(panel_fill, 1, wx.ALIGN_CENTER) box.Add(bChooseDir, 3, wx.ALIGN_CENTER) panel_dir.SetAutoLayout(True) panel_dir.SetSizer(box) panel_dir.Layout() panel_fill1 = wx.Panel(contentPane, -1) panel_fill2 = wx.Panel(contentPane, -1) panel_fill3 = wx.Panel(contentPane, -1) box = wx.BoxSizer(wx.VERTICAL) box.Add(panel_fill1, 3, wx.EXPAND) box.Add(lSources, 2, wx.EXPAND) box.Add(panel_info, 2, wx.EXPAND) box.Add(panel_fill2, 2, wx.EXPAND) box.Add(lOutputDir, 2, wx.EXPAND) box.Add(panel_dir, 2, wx.EXPAND) box.Add(panel_fill3, 7, wx.EXPAND) contentPane.SetAutoLayout(True) contentPane.SetSizer(box) contentPane.Layout()