def __init__(self, file, isMediaInfo): QWidget.__init__(self) try: self.setWindowIcon(QIcon(path.join(sys._MEIPASS, 'assets\\avpreserve-2.png'))) except: pass self.scroll = QScrollArea() self.setWindowTitle("Rule Generation") self.layout = QVBoxLayout(self) self.slayout = QVBoxLayout(self) self.slayout.setContentsMargins(0, 0, 0, 0) self.slayout.setSpacing(0) self.val = QPushButton("Set Rules", self) self.val.clicked.connect(self.close) self.layout.addWidget(self.val) self.swidget = QWidget(self) self.swidget.setLayout(self.slayout) # if nothing was set, populate if tags == []: if isExif: dict = qcdict.exifMeta(file) else: if isMediaInfo: dict = qcdict.mnfoMeta(file, True) #self.parseMediaInfo(file) else: dict = qcdict.mnfoMeta(file, False) print dict try: sdict = sorted(dict) except: QMessageBox.warning(self, "Metadata Quality Control", "Invalid reference file selected!") return n = 0 for d in sdict: self.addRow(d, 0, dict[d], n) n += 1 # otherwise, use what's there else: xtags = tags[:] xops = ops[:] xvals = vals[:] del tags[0:len(tags)] del ops[0:len(ops)] del vals[0:len(vals)] for n in xrange(len(xtags)): self.addRow(xtags[n].text(), xops[n].currentIndex(), xvals[n].text(), n) self.layout.addWidget(self.scroll) self.setLayout(self.layout) self.scroll.setWidget(self.swidget) self.scroll.setWidgetResizable(True) self.show()
def __init__(self, file, isMediaInfo): QWidget.__init__(self) self.scroll = QScrollArea() self.setWindowTitle("Rule Generation") self.layout = QVBoxLayout(self) self.slayout = QVBoxLayout(self) self.slayout.setContentsMargins(0, 0, 0, 0) self.slayout.setSpacing(0) self.val = QPushButton("Set Rules", self) self.val.clicked.connect(self.close) self.layout.addWidget(self.val) self.swidget = QWidget(self) self.swidget.setLayout(self.slayout) # if nothing was set, populate if tags == []: if isExif: dict = qcdict.exifMeta(file) else: if isMediaInfo: dict = dict = qcdict.mnfoMeta( file, True) #self.parseMediaInfo(file) else: dict = qcdict.mnfoMeta(file, False) sdict = sorted(dict) n = 0 for d in sdict: self.addRow(d, 0, dict[d], n) n += 1 # otherwise, use what's there else: xtags = tags[:] xops = ops[:] xvals = vals[:] del tags[0:len(tags)] del ops[0:len(ops)] del vals[0:len(vals)] for n in xrange(len(xtags)): self.addRow(xtags[n].text(), xops[n].currentIndex(), xvals[n].text(), n) self.layout.addWidget(self.scroll) self.setLayout(self.layout) self.scroll.setWidget(self.swidget) self.scroll.setWidgetResizable(True) self.show()
def __init__(self, file): QWidget.__init__(self) self.scroll = QScrollArea() self.setWindowTitle("Rule Generation") self.layout = QVBoxLayout(self) self.slayout = QVBoxLayout(self) self.slayout.setContentsMargins(0, 0, 0, 0) self.slayout.setSpacing(0) self.val = QPushButton("Set Rules", self) self.val.clicked.connect(self.close) self.layout.addWidget(self.val) self.swidget = QWidget(self) self.swidget.setLayout(self.slayout) # if nothing was set, populate if tags == []: if isExif: dict = qcdict.exifMeta(file) else: dict = qcdict.mnfoMeta(file) sdict = sorted(dict) n = 0 for d in sdict: self.addRow(d, 0, dict[d], n) n += 1 # otherwise, use what's there else: xtags = tags[:] xops = ops[:] xvals = vals[:] del tags[0:len(tags)] del ops[0:len(ops)] del vals[0:len(vals)] for n in xrange(len(xtags)): self.addRow(xtags[n].text(), xops[n].currentIndex(), xvals[n].text(), n) self.layout.addWidget(self.scroll) self.setLayout(self.layout) self.scroll.setWidget(self.swidget) self.scroll.setWidgetResizable(True) self.show()