def add_files(self, fnames=None):
        if fnames is None:
            # pop up the file chooser dialog box if the files weren't passed in
            settings = QtCore.QSettings('ShotgunSharing', 'uploader')
            # default to the last dir we used
            d = settings.value("fdialog/dir", QtCore.QString()).toString()
            fnames = [str(f) for f in QtGui.QFileDialog.getOpenFileNames(self, 'Select files to upload', d)]
            if fnames:
                # save the dir of the first file selected
                settings.setValue("fdialog/dir", os.path.dirname(fnames[0]))
        if fnames:
            tags = str(self.gui.tags.text())
            files = []
            project = int(self.gui.project.itemData(self.gui.project.currentIndex()).toInt()[0])
            skipped_fnames = []
            for fname in [str(f) for f in fnames]:
                if str(self.gui.link_name.currentText()):
                    # if link_name has been selected, use all the info used to
                    # get to that entity
                    link_type = str(self.gui.link_type.currentText())
                    link_name = str(self.gui.link_name.currentText())
                    link_id = int(self.gui.link_name.itemData(self.gui.link_name.currentIndex()).toInt()[0])
                    link = {'type': link_type, 'name': link_name, 'id': link_id, 'project': {'type': 'Project', 'id': project}}
                else:
                    # otherwise try to figure out the link from the path rules
                    # in the prefs
                    link = self.__link_for_file(fname)
                if link is None:
                    # didn't have a link, remember that so we can error
                    skipped_fnames.append(fname)
                    continue
                f = ShotgunFile(str(fname), tags, link)
                files.append(f)
            # we've got the file objects we're going to create.  do it
            self.stack.push(NewFileCommand(self.model, files))
        for i in xrange(self.model.columnCount()):
            # make sure we can see the data
            self.gui.file_table_view.resizeColumnToContents(i)
        if skipped_fnames:
            # and let people know if we skipped something becuase of no links
            QtGui.QMessageBox.warning(self, self.tr("uploader"),
                self.tr("Couldn't figure out link for:\n%s\n\nPlease select what to link it to." - '\n'.join(skipped_fnames)),
                QtGui.QMessageBox.Ok)

    # Pattern - find an odd # of $ which doesn't have a $ before it
    #   then match {pattern} or pattern, keep pattern in the match group 'name'
dataset/ETHPy150Open shotgunsoftware/pyqt-uploader/uploader.py/Uploader.add_files/operator `%` -> `-`