def ok(self):
        """make the magic happen"""
        conn = self.__conn
        prog = QtGui.QProgressDialog()
        # guess that progress will progress along with bytes uploaded
        maximum = sum([f.size for f in self.model.files])
        nfiles = len(self.model.files)
        prog.setMaximum(maximum)
        prog.setLabelText("%-80s" % "Uploading %d/%d: %s" % (0, nfiles, ''))
        prog.setValue(0)
        prog.show()
        i = 0
        while self.model.files:
            i += 1
            f = self.model.files[0]
            # let folks know what we're doing
            prog.setLabelText("%-80s" % "Uploading %d/%d: %s" % (i, nfiles, f.path))
            if prog.wasCanceled():
                break
            # upload
            f_id = conn.upload(f.link['type'], f.link['id'], f.path)
            # update tags, path, and reference for
            data = {'attachment_reference_links': [self.default_link]}
            if self.prefs.path_field:
                data[self.prefs.path_field] = f.path
            if f.tags:
                data['tag_list'] = f.tags.split(',')
            conn.update('Attachment', f_id, data)
            # do thumbnails for files we can
            mime = mimetypes.guess_type(f.path)[0]
            if mime is not None or (mime.startswith('video') or mime.startswith('image')):
                tmp = tempfile.mktemp('.jpg', 'uploader_')
                try:
                    # figure out which command to run
                    cmd = None
                    if mime.startswith('image'):
                        cmd = self.prefs.image_command
                    elif mime.startswith('video'):
                        cmd = self.prefs.movie_command
                    if cmd is not None:
                        # do the replacements for the command and run it
                        cmd = cmd.replace('$in', '"%s"' % f.path)
                        cmd = cmd.replace('$out', '"%s"' % tmp)
                        cmd = cmd.replace('$offset', '"%s"' % f.hero_offset)
                        os.system(cmd)
                        if os.path.exists(tmp):
                            # it worked, upload the thumbnail
                            conn.upload_thumbnail('Attachment', f_id, tmp)
                finally:
                    # make sure we clean up
                    if os.path.exists(tmp):
                        os.remove(tmp)
            if f.note:
                # add the note if set
                conn.create('Note', {'content': f.note, 'note_links': [{'type': 'Attachment', 'id': f_id}],
                    'project': f.link.get('project', f.link)})
            # update progress
            prog.setValue(prog.value()+f.size)
            # get rid of the file from the interface
            self.model.delete_files(0, 1)
            # allow the gui to update
            QtGui.QApplication.processEvents()
        # all done, make sure we're clear
        prog.setValue(maximum)
        self.stack.clear()
dataset/ETHPy150Open shotgunsoftware/pyqt-uploader/uploader.py/Uploader.ok/operator `and` -> `or`