コード例 #1
0
 def _StartSearch(self, event):
     sourceFiles = self.content
     if len(sourceFiles) < 1:
         dlg = wxMessageDialog(self, "No source file specified.\n\n"
                             "Please provide at least one file in the\n"
                             "list of source files.",
                             "No source file", wxOK | wxICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
     dis_sigs = []
     for i in range(0, len(self.sigcontent)):
         if not self.signaturelist.IsChecked(i):
             dis_sigs.append(self.sigcontent[i])
     from FESettings import getSettings
     if getSettings().getValue('naming_digits') and getSettings().getValue('naming_digits'): # they only come together
         digits = int(getSettings().getValue('naming_digits'))
         start = int(getSettings().getValue('naming_start') )
         settings = ExecutionSettings(disabled_signatures = dis_sigs, sourceFiles = sourceFiles, dest_folder=self.dest_folder,
                 signatures = signatures.getCopyOfAllSignauteres(), output_level = 0, output_frequency=10000, digits = digits, 
                 counterstart = start)
     else:
         settings = ExecutionSettings(disabled_signatures = dis_sigs, sourceFiles = sourceFiles, dest_folder=self.dest_folder,
                 signatures = signatures.getCopyOfAllSignauteres(), output_level = 0, output_frequency=10000)
     progressDialog = ProgressDialog.ProgressDialog(self, -1, "Progress of Search",
             settings)
コード例 #2
0
def getAvailableSignatures():
    """
    Forwards the request for available signatures to the signatures module. Normalises
    the output from this function (checks the signaturs).
    
    @return: C{None} if error in signatures file, otherwise the list of signatures.
    @rtype: C{List} of C{Signatures}
    """
    signs = signatures.getCopyOfAllSignauteres()
    if signatures.normaliseSignatures(signs) == -1:
        return None
    return signs
コード例 #3
0
def handleArguments(args):
    """
    Processes a list of arguments.
    
    Creates a new L{ExecutionSettings} and a new L{ExecutionStatus} object.
    Iterates the list of arguments and assigns any known argument value to the given 
    settings or status instance.
    
    @param args: List of arguments to be processed (usually the CLI arguments list)
    @return: Info about success: 0 - not successful, 1 - Signature information is requested,
    2 - successful; The settings applied to the Settings / Status instances
    @rtype: C{int}; L{ExecutionStatus}
    """
    if len(args) < 2:
        usage(args[0])
        return 0, None
    settings = ExecutionSettings(signatures = signatures.getCopyOfAllSignauteres())
    status = ExecutionStatus(settings)
    disabled_signs = []
    for arg in args:
        if arg[0] != '-':
            continue
        if arg[1] == 's':
            status.file_start = int(arg[2:])
        elif arg[1] == 'e':
            status.file_end = int(arg[2:])
        elif arg[1] == 'd':
            settings.digits = int(arg[2:])
        elif arg[1] == 'n':
            settings.counterstart_global = int(arg[2:])
        elif arg[1] == 'f':
            settings.dest_folder = arg[2:]
        elif arg[1] == 'o':
            settings.output_level = int(arg[2:])
        elif arg[1] =='g':
            settings.output_frequency = int(arg[2:])
        elif arg[1] =='i':
            if arg[2] == 's':
                return 1, status
            elif arg[2] == 'd':
                disabled_signs.append(arg[3:])
            else:
                print ('Unrecognised option for Signature operations: %c [Ignored]' %(arg[2]))
        else:
            print ('Unrecognised option: %c [Ignored]' %(arg[1]))
    settings.dest_folder = tools.checkDestfolder(settings.dest_folder)
    settings.sourceFiles.append(args[len(args)-1])
    settings.disableSignatureWithNames(disabled_signs)
    return 2, status
コード例 #4
0
    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)