Properly overlay fetched online data

git-svn-id: http://comictagger.googlecode.com/svn/trunk@94 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville@gmail.com 2012-11-27 18:02:08 +00:00
parent fc17becca2
commit 92086fe386
2 changed files with 23 additions and 13 deletions

View File

@ -144,10 +144,22 @@ class GenericMetadata:
assign( "comments", new_md.comments )
assign( "notes", new_md.notes )
self.overlayCredits( new_md.credits )
# TODO
# not sure if the tags, credits, and pages should broken down, or treated
# not sure if the tags and pages should broken down, or treated
# as whole lists....
for c in new_md.credits:
# For now, go the easy route, where any overlay
# value wipes out the whole list
if len(new_md.tags) > 0:
assign( "tags", new_md.tags )
if len(new_md.pages) > 0:
assign( "pages", new_md.pages )
def overlayCredits( self, new_credits ):
for c in new_credits:
if c.has_key('primary') and c['primary']:
primary = True
else:
@ -158,17 +170,9 @@ class GenericMetadata:
for r in reversed(self.credits):
if r['role'].lower() == c['role'].lower():
self.credits.remove(r)
# otherwise, add it!
else:
self.addCredit( c['person'], c['role'], primary )
# For now, go the easy route, where any overlay
# value wipes out the whole list
if len(new_md.tags) > 0:
assign( "tags", new_md.tags )
if len(new_md.pages) > 0:
assign( "pages", new_md.pages )
def addCredit( self, person, role, primary = False ):

View File

@ -756,11 +756,17 @@ class TaggerWindow( QtGui.QMainWindow):
#we should now have a volume ID
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
#copy the form onto metadata object
self.formToMetadata()
comicVine = ComicVineTalker( )
self.metadata = comicVine.fetchIssueData( selector.volume_id, selector.issue_number )
new_metadata = comicVine.fetchIssueData( selector.volume_id, selector.issue_number )
# Now push the right data into the edit controls
self.metadata.overlay( new_metadata )
# Now push the new combined data into the edit controls
self.metadataToForm()
#!!!ATB should I clear the form???
QtGui.QApplication.restoreOverrideCursor()