def runBatch(self): ''' Produce Mystery SMD package for all existing SMD footprints. ''' desiredPinCount = 2 # should be arg. For now, use 2 or 3. For Generic IC, many? directory = FritzingFootprintDirectory() directory.initSMD() count = 0 for filename, footprint in directory.iteritems(): if footprint.connectorCount() == desiredPinCount: outFileNameFzp = self.partFactory.produce(footprint) # Sanity check written fzp file is valid XML. Uncomment for debug from xml.dom.minidom import parse outDom = parse(outFileNameFzp) count += 1 if count > 5: # Temporary: limit to 5 break
def __init__(self, args): super(App, self).__init__(args) # Read SMD packages. Since ScavengeDialog is not shown, effectively modal # TODO 1000 is arbitrary, seems large enough for the contrib directory, but fragile progress = QProgressDialog("Reading SMD packages...", "Abort", 0, 1000) # progress.setWindowModality(Qt.WindowModal) progress.show() progress.setValue(0) directory = FritzingFootprintDirectory() directory.initSMDWithProgress(progress) progress.setValue(1000) # close progress dialog = ScavengeDialog(directory) dialog.exec_() if dialog.result() == QDialog.Accepted: msgBox = QMessageBox() msgBox.setWindowTitle(App.appName) msgBox.setText(r"""Part created. To use the part, restart Fritzing, search parts by name of the chosen package, and drag the part to "Mine" bin."""); msgBox.exec_()