Logo Search packages:      
Sourcecode: rapid-photo-downloader version File versions  Download package

def rapid::rapid::SelectionTreeView::apply_job_code (   self,
  job_code,
  overwrite = True,
  to_all_rows = False,
  thread_id = None 
)

Applies the Job code to the selected rows, or all rows if to_all_rows is True.

If overwrite is True, then it will overwrite any existing job code.

Definition at line 4171 of file rapid.py.

04171                                                                                          :
        """
        Applies the Job code to the selected rows, or all rows if to_all_rows is True.
        
        If overwrite is True, then it will overwrite any existing job code.
        """

        def _apply_job_code():
            status = self.get_status(iter)
            if status in [STATUS_DOWNLOAD_PENDING, STATUS_WARNING, STATUS_NOT_DOWNLOADED]:
                
                if mediaFile.isImage:
                    apply = rn.usesJobCode(self.rapidApp.prefs.image_rename) or rn.usesJobCode(self.rapidApp.prefs.subfolder)
                else:
                    apply = rn.usesJobCode(self.rapidApp.prefs.video_rename) or rn.usesJobCode(self.rapidApp.prefs.video_subfolder)
                if apply:
                    if overwrite:
                        self.liststore.set(iter, 8, job_code)
                        mediaFile.jobcode = job_code
                        mediaFile.sampleStale = True
                    else:
                        if not self.get_job_code(iter):
                            self.liststore.set(iter, 8, job_code)
                            mediaFile.jobcode = job_code
                            mediaFile.sampleStale = True
                else:
                    pass
                    #if they got an existing job code, may as well keep it there in case the user 
                    #reactivates job codes again in their prefs
                    
        if to_all_rows or thread_id is not None:
            for iter in self.get_tree_row_iters():
                apply = True
                if thread_id is not None:
                    t = self.get_thread(iter)
                    apply = t == thread_id
                    
                if apply:
                    mediaFile = self.get_mediaFile(iter)
                    _apply_job_code()
                    if mediaFile.treerowref == self.previewed_file_treerowref:
                        self.show_preview(iter)
        else:
            for iter in self.get_tree_row_iters(selected_only = True):
                mediaFile = self.get_mediaFile(iter)
                _apply_job_code()
                if mediaFile.treerowref == self.previewed_file_treerowref:
                    self.show_preview(iter)
            
    def job_code_missing(self, selected_only):


Generated by  Doxygen 1.6.0   Back to index