autopep8 -aa

—aggressive, level 2
This commit is contained in:
fcanc 2015-02-15 12:55:04 +01:00
parent ee52448f17
commit a419969b85
20 changed files with 555 additions and 272 deletions

View File

@ -207,11 +207,12 @@ class AutoTagMatchWindow(QtGui.QDialog):
self.updateData()
def reject(self):
reply = QtGui.QMessageBox.question(self,
self.tr("Cancel Matching"),
self.tr(
"Are you sure you wish to cancel the matching process?"),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr("Cancel Matching"),
self.tr("Are you sure you wish to cancel the matching process?"),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.No:
return

View File

@ -108,14 +108,15 @@ def display_match_set_for_choice(label, match_set, opts, settings):
for (counter, m) in enumerate(match_set.matches):
counter += 1
print(u" {0}. {1} #{2} [{3}] ({4}/{5}) - {6}".format(counter,
m['series'],
m['issue_number'],
m['publisher'],
m['month'],
m['year'],
m['issue_title'])
)
print(
u" {0}. {1} #{2} [{3}] ({4}/{5}) - {6}".format(
counter,
m['series'],
m['issue_number'],
m['publisher'],
m['month'],
m['year'],
m['issue_title']))
if opts.interactive:
while True:
i = raw_input("Choose a match #, or 's' to skip: ")
@ -289,7 +290,10 @@ def process_file_cli(filename, opts, settings, match_results):
print("--------- ComicRack tags ---------")
if opts.raw:
print(
u"{0}".format(unicode(ca.readRawCIX(), errors='ignore')))
u"{0}".format(
unicode(
ca.readRawCIX(),
errors='ignore')))
else:
print(u"{0}".format(ca.readCIX()))
@ -332,8 +336,10 @@ def process_file_cli(filename, opts, settings, match_results):
filename, dst_style_name))
return
if opts.copy_source == opts.data_style:
print(u"{0}: Destination and source are same: {1}. Nothing to do.".format(
filename, dst_style_name))
print(
u"{0}: Destination and source are same: {1}. Nothing to do.".format(
filename,
dst_style_name))
return
src_style_name = MetaDataStyle.name[opts.copy_source]

View File

@ -286,7 +286,12 @@ class RarArchiver:
working_dir = os.path.dirname(os.path.abspath(self.path))
# use external program to write comment to Rar archive
subprocess.call([self.rar_exe_path, 'c', '-w' + working_dir, '-c-', '-z' + tmp_name, self.path],
subprocess.call([self.rar_exe_path,
'c',
'-w' + working_dir,
'-c-',
'-z' + tmp_name,
self.path],
startupinfo=self.startupinfo,
stdout=RarArchiver.devnull)
@ -318,7 +323,8 @@ class RarArchiver:
if entries[0][0].size != len(entries[0][1]):
print >> sys.stderr, u"readArchiveFile(): [file is not expected size: {0} vs {1}] {2}:{3} [attempt # {4}]".format(
entries[0][0].size, len(entries[0][1]), self.path, archive_file, tries)
entries[0][0].size, len(
entries[0][1]), self.path, archive_file, tries)
continue
except (OSError, IOError) as e:
@ -360,7 +366,13 @@ class RarArchiver:
f.close()
# use external program to write file to Rar archive
subprocess.call([self.rar_exe_path, 'a', '-w' + working_dir, '-c-', '-ep', self.path, tmp_file],
subprocess.call([self.rar_exe_path,
'a',
'-w' + working_dir,
'-c-',
'-ep',
self.path,
tmp_file],
startupinfo=self.startupinfo,
stdout=RarArchiver.devnull)
@ -379,7 +391,11 @@ class RarArchiver:
if self.rar_exe_path is not None:
try:
# use external program to remove file from Rar archive
subprocess.call([self.rar_exe_path, 'd', '-c-', self.path, archive_file],
subprocess.call([self.rar_exe_path,
'd',
'-c-',
self.path,
archive_file],
startupinfo=self.startupinfo,
stdout=RarArchiver.devnull)
@ -741,7 +757,11 @@ class ComicArchive:
# sort by most common
sorted_buckets = sorted(
length_buckets.iteritems(), key=lambda k_v: (k_v[1], k_v[0]), reverse=True)
length_buckets.iteritems(),
key=lambda k_v: (
k_v[1],
k_v[0]),
reverse=True)
# statistical mode occurence is first
mode_length = sorted_buckets[0][0]
@ -789,8 +809,11 @@ class ComicArchive:
# make a sub-list of image files
self.page_list = []
for name in files:
if (name[-4:].lower() in [".jpg", "jpeg", ".png",
".gif", "webp"] and os.path.basename(name)[0] != "."):
if (name[-4:].lower() in [".jpg",
"jpeg",
".png",
".gif",
"webp"] and os.path.basename(name)[0] != "."):
self.page_list.append(name)
return self.page_list

View File

@ -77,48 +77,48 @@ class ComicVineCacher:
cur = con.cursor()
# name,id,start_year,publisher,image,description,count_of_issues
cur.execute("CREATE TABLE VolumeSearchCache(" +
"search_term TEXT," +
"id INT," +
"name TEXT," +
"start_year INT," +
"publisher TEXT," +
"count_of_issues INT," +
"image_url TEXT," +
"description TEXT," +
"timestamp DATE DEFAULT (datetime('now','localtime'))) "
)
cur.execute(
"CREATE TABLE VolumeSearchCache(" +
"search_term TEXT," +
"id INT," +
"name TEXT," +
"start_year INT," +
"publisher TEXT," +
"count_of_issues INT," +
"image_url TEXT," +
"description TEXT," +
"timestamp DATE DEFAULT (datetime('now','localtime'))) ")
cur.execute("CREATE TABLE Volumes(" +
"id INT," +
"name TEXT," +
"publisher TEXT," +
"count_of_issues INT," +
"start_year INT," +
"timestamp DATE DEFAULT (datetime('now','localtime')), " +
"PRIMARY KEY (id))"
)
cur.execute(
"CREATE TABLE Volumes(" +
"id INT," +
"name TEXT," +
"publisher TEXT," +
"count_of_issues INT," +
"start_year INT," +
"timestamp DATE DEFAULT (datetime('now','localtime')), " +
"PRIMARY KEY (id))")
cur.execute("CREATE TABLE AltCovers(" +
"issue_id INT," +
"url_list TEXT," +
"timestamp DATE DEFAULT (datetime('now','localtime')), " +
"PRIMARY KEY (issue_id))"
)
cur.execute(
"CREATE TABLE AltCovers(" +
"issue_id INT," +
"url_list TEXT," +
"timestamp DATE DEFAULT (datetime('now','localtime')), " +
"PRIMARY KEY (issue_id))")
cur.execute("CREATE TABLE Issues(" +
"id INT," +
"volume_id INT," +
"name TEXT," +
"issue_number TEXT," +
"super_url TEXT," +
"thumb_url TEXT," +
"cover_date TEXT," +
"site_detail_url TEXT," +
"description TEXT," +
"timestamp DATE DEFAULT (datetime('now','localtime')), " +
"PRIMARY KEY (id))"
)
cur.execute(
"CREATE TABLE Issues(" +
"id INT," +
"volume_id INT," +
"name TEXT," +
"issue_number TEXT," +
"super_url TEXT," +
"thumb_url TEXT," +
"cover_date TEXT," +
"site_detail_url TEXT," +
"description TEXT," +
"timestamp DATE DEFAULT (datetime('now','localtime')), " +
"PRIMARY KEY (id))")
def add_search_results(self, search_term, cv_search_results):
@ -130,7 +130,8 @@ class ComicVineCacher:
# remove all previous entries with this search term
cur.execute(
"DELETE FROM VolumeSearchCache WHERE search_term = ?", [search_term.lower()])
"DELETE FROM VolumeSearchCache WHERE search_term = ?", [
search_term.lower()])
# now add in new results
for record in cv_search_results:
@ -146,18 +147,18 @@ class ComicVineCacher:
else:
url = record['image']['super_url']
cur.execute("INSERT INTO VolumeSearchCache " +
"(search_term, id, name, start_year, publisher, count_of_issues, image_url, description) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?)",
(search_term.lower(),
record['id'],
record['name'],
record['start_year'],
pub_name,
record['count_of_issues'],
url,
record['description'])
)
cur.execute(
"INSERT INTO VolumeSearchCache " +
"(search_term, id, name, start_year, publisher, count_of_issues, image_url, description) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?)",
(search_term.lower(),
record['id'],
record['name'],
record['start_year'],
pub_name,
record['count_of_issues'],
url,
record['description']))
def get_search_results(self, search_term):
@ -170,7 +171,8 @@ class ComicVineCacher:
# purge stale search results
a_day_ago = datetime.datetime.today() - datetime.timedelta(days=1)
cur.execute(
"DELETE FROM VolumeSearchCache WHERE timestamp < ?", [str(a_day_ago)])
"DELETE FROM VolumeSearchCache WHERE timestamp < ?", [
str(a_day_ago)])
# fetch
cur.execute(
@ -226,7 +228,8 @@ class ComicVineCacher:
a_month_ago = datetime.datetime.today() - \
datetime.timedelta(days=30)
cur.execute(
"DELETE FROM AltCovers WHERE timestamp < ?", [str(a_month_ago)])
"DELETE FROM AltCovers WHERE timestamp < ?", [
str(a_month_ago)])
cur.execute(
"SELECT url_list FROM AltCovers WHERE issue_id=?", [issue_id])
@ -310,7 +313,8 @@ class ComicVineCacher:
# fetch
cur.execute(
"SELECT id,name,publisher,count_of_issues,start_year FROM Volumes WHERE id = ?", [volume_id])
"SELECT id,name,publisher,count_of_issues,start_year FROM Volumes WHERE id = ?",
[volume_id])
row = cur.fetchone()
@ -349,7 +353,8 @@ class ComicVineCacher:
results = list()
cur.execute(
"SELECT id,name,issue_number,site_detail_url,cover_date,super_url,thumb_url,description FROM Issues WHERE volume_id = ?", [volume_id])
"SELECT id,name,issue_number,site_detail_url,cover_date,super_url,thumb_url,description FROM Issues WHERE volume_id = ?",
[volume_id])
rows = cur.fetchall()
# now process the results
@ -374,7 +379,12 @@ class ComicVineCacher:
return results
def add_issue_select_details(
self, issue_id, image_url, thumb_image_url, cover_date, site_detail_url):
self,
issue_id,
image_url,
thumb_image_url,
cover_date,
site_detail_url):
con = lite.connect(self.db_file)
@ -400,7 +410,8 @@ class ComicVineCacher:
con.text_factory = unicode
cur.execute(
"SELECT super_url,thumb_url,cover_date,site_detail_url FROM Issues WHERE id=?", [issue_id])
"SELECT super_url,thumb_url,cover_date,site_detail_url FROM Issues WHERE id=?",
[issue_id])
row = cur.fetchone()
details = dict()

View File

@ -170,8 +170,10 @@ class ComicVineTalker(QObject):
if total_time_waited < 20:
continue
if cv_response['status_code'] != 1:
self.writeLog("Comic Vine query failed with error #{0}: [{1}]. \n".format(
cv_response['status_code'], cv_response['error']))
self.writeLog(
"Comic Vine query failed with error #{0}: [{1}]. \n".format(
cv_response['status_code'],
cv_response['error']))
raise ComicVineTalkerException(
cv_response['status_code'], cv_response['error'])
else:
@ -249,8 +251,10 @@ class ComicVineTalker(QObject):
total_result_count = cv_response['number_of_total_results']
if callback is None:
self.writeLog("Found {0} of {1} results\n".format(
cv_response['number_of_page_results'], cv_response['number_of_total_results']))
self.writeLog(
"Found {0} of {1} results\n".format(
cv_response['number_of_page_results'],
cv_response['number_of_total_results']))
search_results.extend(cv_response['results'])
page = 1
@ -260,8 +264,10 @@ class ComicVineTalker(QObject):
# see if we need to keep asking for more pages...
while (current_result_count < total_result_count):
if callback is None:
self.writeLog("getting another page of results {0} of {1}...\n".format(
current_result_count, total_result_count))
self.writeLog(
"getting another page of results {0} of {1}...\n".format(
current_result_count,
total_result_count))
page += 1
cv_response = self.getCVContent(search_url + "&page=" + str(page))
@ -725,7 +731,9 @@ class ComicVineTalker(QObject):
details = self.fetchCachedIssueSelectDetails(issue_id)
if details['image_url'] is not None:
self.urlFetchComplete.emit(
details['image_url'], details['thumb_image_url'], self.issue_id)
details['image_url'],
details['thumb_image_url'],
self.issue_id)
return
issue_url = self.api_base_url + "/issue/" + CVTypeID.Issue + "-" + \

View File

@ -230,10 +230,14 @@ class CoverImageWidget(QWidget):
self.label.setText("")
elif self.mode == CoverImageWidget.AltCoverMode:
self.label.setText(
"Cover {0} (of {1})".format(self.imageIndex + 1, self.imageCount))
"Cover {0} (of {1})".format(
self.imageIndex + 1,
self.imageCount))
else:
self.label.setText(
"Page {0} (of {1})".format(self.imageIndex + 1, self.imageCount))
"Page {0} (of {1})".format(
self.imageIndex + 1,
self.imageCount))
def loadURL(self):
self.loadDefault()

View File

@ -112,11 +112,23 @@ class FileSelectionList(QWidget):
def selectAll(self):
self.twList.setRangeSelected(
QTableWidgetSelectionRange(0, 0, self.twList.rowCount() - 1, 5), True)
QTableWidgetSelectionRange(
0,
0,
self.twList.rowCount() -
1,
5),
True)
def deselectAll(self):
self.twList.setRangeSelected(
QTableWidgetSelectionRange(0, 0, self.twList.rowCount() - 1, 5), False)
QTableWidgetSelectionRange(
0,
0,
self.twList.rowCount() -
1,
5),
False)
def removeArchiveList(self, ca_list):
self.twList.setSortingEnabled(False)
@ -146,8 +158,9 @@ class FileSelectionList(QWidget):
return
if self.twList.currentRow() in row_list:
if not self.modifiedFlagVerification("Remove Archive",
"If you close this archive, data in the form will be lost. Are you sure?"):
if not self.modifiedFlagVerification(
"Remove Archive",
"If you close this archive, data in the form will be lost. Are you sure?"):
return
row_list.sort()
@ -223,7 +236,9 @@ class FileSelectionList(QWidget):
"Selected file doesn't seem to be a comic archive."))
else:
QMessageBox.information(
self, self.tr("File/Folder Open"), self.tr("No comic archives were found."))
self,
self.tr("File/Folder Open"),
self.tr("No comic archives were found."))
self.twList.setSortingEnabled(True)
@ -397,8 +412,9 @@ class FileSelectionList(QWidget):
# don't allow change if modified
if prev is not None and new_idx != old_idx:
if not self.modifiedFlagVerification("Change Archive",
"If you change archives now, data in the form will be lost. Are you sure?"):
if not self.modifiedFlagVerification(
"Change Archive",
"If you change archives now, data in the form will be lost. Are you sure?"):
self.twList.currentItemChanged.disconnect(
self.currentItemChangedCB)
self.twList.setCurrentItem(prev)

View File

@ -49,8 +49,12 @@ class ImagePopup(QtGui.QDialog):
# This is a total hack. Uses a snapshot of the desktop, and overlays a
# translucent screen over it. Probably can do it better by setting opacity of a
# widget
self.desktopBg = QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId(),
0, 0, screen_size.width(), screen_size.height())
self.desktopBg = QtGui.QPixmap.grabWindow(
QtGui.QApplication.desktop().winId(),
0,
0,
screen_size.width(),
screen_size.height())
bg = QtGui.QPixmap(ComicTaggerSettings.getGraphic('popup_bg.png'))
self.clientBgPixmap = bg.scaled(
screen_size.width(), screen_size.height())

View File

@ -243,8 +243,16 @@ class IssueIdentifier:
if newline:
self.output_function("\n")
def getIssueCoverMatchScore(self, comicVine, issue_id, primary_img_url, primary_thumb_url,
page_url, localCoverHashList, useRemoteAlternates=False, useLog=True):
def getIssueCoverMatchScore(
self,
comicVine,
issue_id,
primary_img_url,
primary_thumb_url,
page_url,
localCoverHashList,
useRemoteAlternates=False,
useLog=True):
# localHashes is a list of pre-calculated hashs.
# useRemoteAlternates - indicates to use alternate covers from CV
@ -256,7 +264,7 @@ class IssueIdentifier:
"Network issue while fetching cover image from ComicVine. Aborting...")
raise IssueIdentifierNetworkError
if self.cancel == True:
if self.cancel:
raise IssueIdentifierCancelled
# alert the GUI, if needed
@ -270,7 +278,7 @@ class IssueIdentifier:
item['hash'] = self.calculateHash(url_image_data)
remote_cover_list.append(item)
if self.cancel == True:
if self.cancel:
raise IssueIdentifierCancelled
if useRemoteAlternates:
@ -285,7 +293,7 @@ class IssueIdentifier:
"Network issue while fetching alt. cover image from ComicVine. Aborting...")
raise IssueIdentifierNetworkError
if self.cancel == True:
if self.cancel:
raise IssueIdentifierCancelled
# alert the GUI, if needed
@ -297,7 +305,7 @@ class IssueIdentifier:
item['hash'] = self.calculateHash(alt_url_image_data)
remote_cover_list.append(item)
if self.cancel == True:
if self.cancel:
raise IssueIdentifierCancelled
if useLog and useRemoteAlternates:
@ -413,7 +421,7 @@ class IssueIdentifier:
return []
#self.log_msg("Found " + str(len(cv_search_results)) + " initial results")
if self.cancel == True:
if self.cancel:
return []
if cv_search_results is None:
@ -428,8 +436,9 @@ class IssueIdentifier:
date_approved = True
# remove any series that starts after the issue year
if keys['year'] is not None and str(keys['year']).isdigit() and item[
'start_year'] is not None and str(item['start_year']).isdigit():
if keys['year'] is not None and str(
keys['year']).isdigit() and item['start_year'] is not None and str(
item['start_year']).isdigit():
if int(keys['year']) < int(item['start_year']):
date_approved = False
@ -467,10 +476,10 @@ class IssueIdentifier:
volume_id_list.append(series['id'])
try:
issue_list = comicVine.fetchIssuesByVolumeIssueNumAndYear(volume_id_list,
keys[
'issue_number'],
keys['year'])
issue_list = comicVine.fetchIssuesByVolumeIssueNumAndYear(
volume_id_list,
keys['issue_number'],
keys['year'])
except ComicVineTalkerException:
self.log_msg(
@ -492,8 +501,11 @@ class IssueIdentifier:
self.log_msg(u"Found {0} series that have an issue #{1}".format(
len(shortlist), keys['issue_number']))
else:
self.log_msg(u"Found {0} series that have an issue #{1} from {2}".format(
len(shortlist), keys['issue_number'], keys['year']))
self.log_msg(
u"Found {0} series that have an issue #{1} from {2}".format(
len(shortlist),
keys['issue_number'],
keys['year']))
# now we have a shortlist of volumes with the desired issue number
# Do first round of cover matching
@ -521,8 +533,14 @@ class IssueIdentifier:
thumb_url = issue['image']['thumb_url']
page_url = issue['site_detail_url']
score_item = self.getIssueCoverMatchScore(comicVine, issue[
'id'], image_url, thumb_url, page_url, hash_list, useRemoteAlternates=False)
score_item = self.getIssueCoverMatchScore(
comicVine,
issue['id'],
image_url,
thumb_url,
page_url,
hash_list,
useRemoteAlternates=False)
except:
self.match_list = []
return self.match_list
@ -600,12 +618,20 @@ class IssueIdentifier:
if self.callback is not None:
self.callback(counter, len(self.match_list) * 3)
counter += 1
self.log_msg(u"Examining alternate covers for ID: {0} {1} ...".format(
m['volume_id'],
m['series']), newline=False)
self.log_msg(
u"Examining alternate covers for ID: {0} {1} ...".format(
m['volume_id'],
m['series']),
newline=False)
try:
score_item = self.getIssueCoverMatchScore(comicVine, m['issue_id'], m[
'image_url'], m['thumb_url'], m['page_url'], hash_list, useRemoteAlternates=True)
score_item = self.getIssueCoverMatchScore(
comicVine,
m['issue_id'],
m['image_url'],
m['thumb_url'],
m['page_url'],
hash_list,
useRemoteAlternates=True)
except:
self.match_list = []
return self.match_list
@ -665,8 +691,10 @@ class IssueIdentifier:
if match['cv_issue_count'] != 1:
new_list.append(match)
else:
self.log_msg("Removing volume {0} [{1}] from consideration (only 1 issue)".format(
match['series'], match['volume_id']))
self.log_msg(
"Removing volume {0} [{1}] from consideration (only 1 issue)".format(
match['series'],
match['volume_id']))
if len(new_list) > 0:
self.match_list = new_list

View File

@ -107,10 +107,14 @@ class IssueSelectionWindow(QtGui.QDialog):
QtGui.QApplication.restoreOverrideCursor()
if e.code == ComicVineTalkerException.RateLimit:
QtGui.QMessageBox.critical(
self, self.tr("Comic Vine Error"), ComicVineTalker.getRateLimitMessage())
self,
self.tr("Comic Vine Error"),
ComicVineTalker.getRateLimitMessage())
else:
QtGui.QMessageBox.critical(self, self.tr("Network Issue"), self.tr(
"Could not connect to ComicVine to list issues!"))
QtGui.QMessageBox.critical(
self,
self.tr("Network Issue"),
self.tr("Could not connect to ComicVine to list issues!"))
return
while self.twList.rowCount() > 0:
@ -151,7 +155,8 @@ class IssueSelectionWindow(QtGui.QDialog):
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.twList.setItem(row, 2, item)
if IssueString(record['issue_number']).asString().lower() == IssueString(
if IssueString(
record['issue_number']).asString().lower() == IssueString(
self.issue_number).asString().lower():
self.initial_id = record['id']

View File

@ -84,5 +84,8 @@ def ctmain():
sys.exit(app.exec_())
except Exception as e:
QtGui.QMessageBox.critical(QtGui.QMainWindow(
), "Error", "Unhandled exception in app:\n" + traceback.format_exc())
QtGui.QMessageBox.critical(
QtGui.QMainWindow(),
"Error",
"Unhandled exception in app:\n" +
traceback.format_exc())

View File

@ -95,7 +95,12 @@ class OptionalMessageDialog(QDialog):
def msg(parent, title, msg, check_state=Qt.Unchecked, check_text=None):
d = OptionalMessageDialog(
parent, StyleMessage, title, msg, check_state=check_state, check_text=check_text)
parent,
StyleMessage,
title,
msg,
check_state=check_state,
check_text=check_text)
d.exec_()
return d.theCheckBox.isChecked()
@ -105,7 +110,12 @@ class OptionalMessageDialog(QDialog):
parent, title, msg, check_state=Qt.Unchecked, check_text=None):
d = OptionalMessageDialog(
parent, StyleQuestion, title, msg, check_state=check_state, check_text=check_text)
parent,
StyleQuestion,
title,
msg,
check_state=check_state,
check_text=check_text)
d.exec_()

View File

@ -179,7 +179,9 @@ For more help visit the wiki at: http://code.google.com/p/comictagger/
person = (cred_attribs[1] if len(cred_attribs) > 1 else "")
primary = (cred_attribs[2] if len(cred_attribs) > 2 else None)
md.addCredit(
person.strip(), role.strip(), True if primary is not None else False)
person.strip(),
role.strip(),
True if primary is not None else False)
else:
md_dict[key] = value
@ -374,7 +376,8 @@ For more help visit the wiki at: http://code.google.com/p/comictagger/
if count > 1:
self.display_msg_and_quit(
"Must choose only one action of print, delete, save, copy, rename, export, set key, or run script", 1)
"Must choose only one action of print, delete, save, copy, rename, export, set key, or run script",
1)
if self.script is not None:
self.launch_script(self.script)

View File

@ -36,7 +36,8 @@ class RenameWindow(QtGui.QDialog):
uic.loadUi(ComicTaggerSettings.getUIFile('renamewindow.ui'), self)
self.label.setText(
"Preview (based on {0} tags):".format(MetaDataStyle.name[data_style]))
"Preview (based on {0} tags):".format(
MetaDataStyle.name[data_style]))
self.setWindowFlags(self.windowFlags() |
QtCore.Qt.WindowSystemMenuHint |

View File

@ -317,7 +317,8 @@ class ComicTaggerSettings:
if self.config.has_option(
'cbl_transform', 'apply_cbl_transform_on_bulk_operation'):
self.apply_cbl_transform_on_bulk_operation = self.config.getboolean(
'cbl_transform', 'apply_cbl_transform_on_bulk_operation')
'cbl_transform',
'apply_cbl_transform_on_bulk_operation')
if self.config.has_option('rename', 'rename_template'):
self.rename_template = self.config.get('rename', 'rename_template')
@ -348,7 +349,8 @@ class ComicTaggerSettings:
if self.config.has_option(
'autotag', 'remove_archive_after_successful_match'):
self.remove_archive_after_successful_match = self.config.getboolean(
'autotag', 'remove_archive_after_successful_match')
'autotag',
'remove_archive_after_successful_match')
if self.config.has_option('autotag', 'wait_and_retry_on_rate_limit'):
self.wait_and_retry_on_rate_limit = self.config.getboolean(
'autotag', 'wait_and_retry_on_rate_limit')
@ -369,9 +371,13 @@ class ComicTaggerSettings:
self.config.set('auto', 'install_id', self.install_id)
self.config.set(
'auto', 'last_selected_load_data_style', self.last_selected_load_data_style)
'auto',
'last_selected_load_data_style',
self.last_selected_load_data_style)
self.config.set(
'auto', 'last_selected_save_data_style', self.last_selected_save_data_style)
'auto',
'last_selected_save_data_style',
self.last_selected_save_data_style)
self.config.set('auto', 'last_opened_folder', self.last_opened_folder)
self.config.set(
'auto', 'last_main_window_width', self.last_main_window_width)
@ -384,17 +390,25 @@ class ComicTaggerSettings:
self.config.set(
'auto', 'last_list_side_width', self.last_list_side_width)
self.config.set(
'auto', 'last_filelist_sorted_column', self.last_filelist_sorted_column)
'auto',
'last_filelist_sorted_column',
self.last_filelist_sorted_column)
self.config.set(
'auto', 'last_filelist_sorted_order', self.last_filelist_sorted_order)
'auto',
'last_filelist_sorted_order',
self.last_filelist_sorted_order)
if not self.config.has_section('identifier'):
self.config.add_section('identifier')
self.config.set(
'identifier', 'id_length_delta_thresh', self.id_length_delta_thresh)
'identifier',
'id_length_delta_thresh',
self.id_length_delta_thresh)
self.config.set(
'identifier', 'id_publisher_blacklist', self.id_publisher_blacklist)
'identifier',
'id_publisher_blacklist',
self.id_publisher_blacklist)
if not self.config.has_section('dialogflags'):
self.config.add_section('dialogflags')
@ -403,7 +417,9 @@ class ComicTaggerSettings:
'dialogflags', 'ask_about_cbi_in_rar', self.ask_about_cbi_in_rar)
self.config.set('dialogflags', 'show_disclaimer', self.show_disclaimer)
self.config.set(
'dialogflags', 'dont_notify_about_this_version', self.dont_notify_about_this_version)
'dialogflags',
'dont_notify_about_this_version',
self.dont_notify_about_this_version)
self.config.set(
'dialogflags', 'ask_about_usage_stats', self.ask_about_usage_stats)
self.config.set(
@ -419,7 +435,9 @@ class ComicTaggerSettings:
self.config.add_section('comicvine')
self.config.set(
'comicvine', 'use_series_start_as_volume', self.use_series_start_as_volume)
'comicvine',
'use_series_start_as_volume',
self.use_series_start_as_volume)
self.config.set('comicvine', 'clear_form_before_populating_from_cv',
self.clear_form_before_populating_from_cv)
self.config.set(
@ -430,32 +448,52 @@ class ComicTaggerSettings:
self.config.add_section('cbl_transform')
self.config.set(
'cbl_transform', 'assume_lone_credit_is_primary', self.assume_lone_credit_is_primary)
'cbl_transform',
'assume_lone_credit_is_primary',
self.assume_lone_credit_is_primary)
self.config.set(
'cbl_transform', 'copy_characters_to_tags', self.copy_characters_to_tags)
'cbl_transform',
'copy_characters_to_tags',
self.copy_characters_to_tags)
self.config.set(
'cbl_transform', 'copy_teams_to_tags', self.copy_teams_to_tags)
self.config.set(
'cbl_transform', 'copy_locations_to_tags', self.copy_locations_to_tags)
'cbl_transform',
'copy_locations_to_tags',
self.copy_locations_to_tags)
self.config.set(
'cbl_transform', 'copy_storyarcs_to_tags', self.copy_storyarcs_to_tags)
'cbl_transform',
'copy_storyarcs_to_tags',
self.copy_storyarcs_to_tags)
self.config.set(
'cbl_transform', 'copy_notes_to_comments', self.copy_notes_to_comments)
'cbl_transform',
'copy_notes_to_comments',
self.copy_notes_to_comments)
self.config.set(
'cbl_transform', 'copy_weblink_to_comments', self.copy_weblink_to_comments)
'cbl_transform',
'copy_weblink_to_comments',
self.copy_weblink_to_comments)
self.config.set(
'cbl_transform', 'apply_cbl_transform_on_cv_import', self.apply_cbl_transform_on_cv_import)
self.config.set('cbl_transform', 'apply_cbl_transform_on_bulk_operation',
self.apply_cbl_transform_on_bulk_operation)
'cbl_transform',
'apply_cbl_transform_on_cv_import',
self.apply_cbl_transform_on_cv_import)
self.config.set(
'cbl_transform',
'apply_cbl_transform_on_bulk_operation',
self.apply_cbl_transform_on_bulk_operation)
if not self.config.has_section('rename'):
self.config.add_section('rename')
self.config.set('rename', 'rename_template', self.rename_template)
self.config.set(
'rename', 'rename_issue_number_padding', self.rename_issue_number_padding)
'rename',
'rename_issue_number_padding',
self.rename_issue_number_padding)
self.config.set(
'rename', 'rename_use_smart_string_cleanup', self.rename_use_smart_string_cleanup)
'rename',
'rename_use_smart_string_cleanup',
self.rename_use_smart_string_cleanup)
self.config.set('rename', 'rename_extension_based_on_archive',
self.rename_extension_based_on_archive)
@ -464,15 +502,21 @@ class ComicTaggerSettings:
self.config.set(
'autotag', 'save_on_low_confidence', self.save_on_low_confidence)
self.config.set(
'autotag', 'dont_use_year_when_identifying', self.dont_use_year_when_identifying)
'autotag',
'dont_use_year_when_identifying',
self.dont_use_year_when_identifying)
self.config.set(
'autotag', 'assume_1_if_no_issue_num', self.assume_1_if_no_issue_num)
'autotag',
'assume_1_if_no_issue_num',
self.assume_1_if_no_issue_num)
self.config.set('autotag', 'ignore_leading_numbers_in_filename',
self.ignore_leading_numbers_in_filename)
self.config.set('autotag', 'remove_archive_after_successful_match',
self.remove_archive_after_successful_match)
self.config.set(
'autotag', 'wait_and_retry_on_rate_limit', self.wait_and_retry_on_rate_limit)
'autotag',
'wait_and_retry_on_rate_limit',
self.wait_and_retry_on_rate_limit)
with codecs.open(self.settings_file, 'wb', 'utf8') as configfile:
self.config.write(configfile)

View File

@ -244,7 +244,10 @@ class SettingsWindow(QtGui.QDialog):
self.settings.reset()
self.settingsToForm()
QtGui.QMessageBox.information(
self, self.name, self.name + " have been returned to default values.")
self,
self.name,
self.name +
" have been returned to default values.")
def selectFile(self, control, name):

View File

@ -98,8 +98,9 @@ class TaggerWindow(QtGui.QMainWindow):
socket.connectToServer(settings.install_id)
alive = socket.waitForConnected(3000)
if alive:
print("Another application with key [{}] is already running".format(
settings.install_id))
print(
"Another application with key [{}] is already running".format(
settings.install_id))
# send file list to other instance
if len(file_list) > 0:
socket.write(pickle.dumps(file_list))
@ -120,8 +121,10 @@ class TaggerWindow(QtGui.QMainWindow):
self.socketServer.removeServer(settings.install_id)
ok = self.socketServer.listen(settings.install_id)
if not ok:
print("Cannot start local socket with key [{}]. Reason: %s ".format(
settings.install_id, self.socketServer.errorString()))
print(
"Cannot start local socket with key [{}]. Reason: %s ".format(
settings.install_id,
self.socketServer.errorString()))
sys.exit()
#print("Registering as single instance with key [{}]".format(settings.install_id))
#----------------------------------
@ -145,8 +148,9 @@ class TaggerWindow(QtGui.QMainWindow):
self.fileSelectionList.selectionChanged.connect(
self.fileListSelectionChanged)
self.fileSelectionList.listCleared.connect(self.fileListCleared)
self.fileSelectionList.setSorting(self.settings.last_filelist_sorted_column,
self.settings.last_filelist_sorted_order)
self.fileSelectionList.setSorting(
self.settings.last_filelist_sorted_column,
self.settings.last_filelist_sorted_order)
# we can't specify relative font sizes in the UI designer, so
# walk through all the lablels in the main form, and make them
@ -260,13 +264,14 @@ class TaggerWindow(QtGui.QMainWindow):
self.settings.show_disclaimer = not checked
if self.settings.ask_about_usage_stats:
reply = QtGui.QMessageBox.question(self,
self.tr("Anonymous Stats"),
self.tr(
"Is it okay if ComicTagger occasionally sends some anonymous usage statistics? Nothing nefarious, "
"just trying to get a better idea of how the app is being used.\n\nThanks for your support!"
),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Default, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr("Anonymous Stats"),
self.tr(
"Is it okay if ComicTagger occasionally sends some anonymous usage statistics? Nothing nefarious, "
"just trying to get a better idea of how the app is being used.\n\nThanks for your support!"),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Default,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
self.settings.send_usage_stats = True
@ -310,7 +315,11 @@ class TaggerWindow(QtGui.QMainWindow):
ro_str = " [read only]"
self.setWindowTitle(
self.appName + " - " + self.comic_archive.path + mod_str + ro_str)
self.appName +
" - " +
self.comic_archive.path +
mod_str +
ro_str)
def configMenus(self):
@ -446,16 +455,22 @@ class TaggerWindow(QtGui.QMainWindow):
if rar_count == 0:
QtGui.QMessageBox.information(
self, self.tr("Export as Zip Archive"), self.tr("No RAR archives selected!"))
self,
self.tr("Export as Zip Archive"),
self.tr("No RAR archives selected!"))
return
if not self.dirtyFlagVerification("Export as Zip Archive",
"If you export archives as Zip now, unsaved data in the form may be lost. Are you sure?"):
if not self.dirtyFlagVerification(
"Export as Zip Archive",
"If you export archives as Zip now, unsaved data in the form may be lost. Are you sure?"):
return
if rar_count != 0:
dlg = ExportWindow(self, self.settings,
self.tr("You have selected {0} archive(s) to export to Zip format. New archives will be created in the same folder as the original.\n\nPlease choose options below, and select OK.\n".format(rar_count)))
dlg = ExportWindow(
self,
self.settings,
self.tr(
"You have selected {0} archive(s) to export to Zip format. New archives will be created in the same folder as the original.\n\nPlease choose options below, and select OK.\n".format(rar_count)))
dlg.adjustSize()
dlg.setModal(True)
if not dlg.exec_():
@ -546,12 +561,15 @@ class TaggerWindow(QtGui.QMainWindow):
msgBox.setTextFormat(QtCore.Qt.RichText)
msgBox.setIconPixmap(
QtGui.QPixmap(ComicTaggerSettings.getGraphic('about.png')))
msgBox.setText("<br><br><br>"
+ self.appName + " v" + self.version + "<br>"
+ "(c)2014 Anthony Beville<br><br>"
+ "<a href='{0}'>{0}</a><br><br>".format(website)
+ "<a href='mailto:{0}'>{0}</a><br><br>".format(email)
+ "License: <a href='{0}'>{1}</a>".format(license_link, license_name))
msgBox.setText("<br><br><br>" +
self.appName +
" v" +
self.version +
"<br>" +
"(c)2014 Anthony Beville<br><br>" +
"<a href='{0}'>{0}</a><br><br>".format(website) +
"<a href='mailto:{0}'>{0}</a><br><br>".format(email) +
"License: <a href='{0}'>{1}</a>".format(license_link, license_name))
msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
msgBox.exec_()
@ -827,8 +845,11 @@ class TaggerWindow(QtGui.QMainWindow):
if self.isDupeCredit(credit['role'].title(), credit['person']):
continue
self.addNewCreditEntry(row, credit['role'].title(), credit[
'person'], (credit['primary'] if 'primary' in credit else False))
self.addNewCreditEntry(
row,
credit['role'].title(),
credit['person'],
(credit['primary'] if 'primary' in credit else False))
row += 1
@ -987,8 +1008,10 @@ class TaggerWindow(QtGui.QMainWindow):
def autoIdentifySearch(self):
if self.comic_archive is None:
QtGui.QMessageBox.warning(self, self.tr("Automatic Identify Search"),
self.tr("You need to load a comic first!"))
QtGui.QMessageBox.warning(
self,
self.tr("Automatic Identify Search"),
self.tr("You need to load a comic first!"))
return
self.queryOnline(autoselect=True)
@ -999,14 +1022,18 @@ class TaggerWindow(QtGui.QMainWindow):
if autoselect and issue_number == "":
QtGui.QMessageBox.information(
self, "Automatic Identify Search", "Can't auto-identify without an issue number (yet!)")
self,
"Automatic Identify Search",
"Can't auto-identify without an issue number (yet!)")
return
if unicode(self.leSeries.text()).strip() != "":
series_name = unicode(self.leSeries.text()).strip()
else:
QtGui.QMessageBox.information(self, self.tr("Online Search"), self.tr(
"Need to enter a series name to search."))
QtGui.QMessageBox.information(
self,
self.tr("Online Search"),
self.tr("Need to enter a series name to search."))
return
year = str(self.lePubYear.text()).strip()
@ -1019,7 +1046,15 @@ class TaggerWindow(QtGui.QMainWindow):
cover_index_list = self.metadata.getCoverPageIndexList()
selector = VolumeSelectionWindow(
self, series_name, issue_number, year, issue_count, cover_index_list, self.comic_archive, self.settings, autoselect)
self,
series_name,
issue_number,
year,
issue_count,
cover_index_list,
self.comic_archive,
self.settings,
autoselect)
title = "Search: '" + series_name + "' - "
selector.setWindowTitle(title + "Select Series")
@ -1043,10 +1078,14 @@ class TaggerWindow(QtGui.QMainWindow):
QtGui.QApplication.restoreOverrideCursor()
if e.code == ComicVineTalkerException.RateLimit:
QtGui.QMessageBox.critical(
self, self.tr("Comic Vine Error"), ComicVineTalker.getRateLimitMessage())
self,
self.tr("Comic Vine Error"),
ComicVineTalker.getRateLimitMessage())
else:
QtGui.QMessageBox.critical(self, self.tr("Network Issue"), self.tr(
"Could not connect to ComicVine to get issue details.!"))
QtGui.QMessageBox.critical(
self,
self.tr("Network Issue"),
self.tr("Could not connect to ComicVine to get issue details.!"))
else:
QtGui.QApplication.restoreOverrideCursor()
if new_metadata is not None:
@ -1062,17 +1101,24 @@ class TaggerWindow(QtGui.QMainWindow):
# Now push the new combined data into the edit controls
self.metadataToForm()
else:
QtGui.QMessageBox.critical(self, self.tr("Search"), self.tr(
"Could not find an issue {0} for that series".format(selector.issue_number)))
QtGui.QMessageBox.critical(
self, self.tr("Search"), self.tr(
"Could not find an issue {0} for that series".format(
selector.issue_number)))
def commitMetadata(self):
if (self.metadata is not None and self.comic_archive is not None):
reply = QtGui.QMessageBox.question(self,
self.tr("Save Tags"),
self.tr("Are you sure you wish to save " + MetaDataStyle.name[
self.save_data_style] + " tags to this archive?"),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr("Save Tags"),
self.tr(
"Are you sure you wish to save " +
MetaDataStyle.name[
self.save_data_style] +
" tags to this archive?"),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
QtGui.QApplication.setOverrideCursor(
@ -1087,7 +1133,9 @@ class TaggerWindow(QtGui.QMainWindow):
if not success:
QtGui.QMessageBox.warning(
self, self.tr("Save failed"), self.tr("The tag save operation seemed to fail!"))
self,
self.tr("Save failed"),
self.tr("The tag save operation seemed to fail!"))
else:
self.clearDirtyFlag()
self.updateInfoBox()
@ -1100,8 +1148,9 @@ class TaggerWindow(QtGui.QMainWindow):
self, self.tr("Whoops!"), self.tr("No data to commit!"))
def setLoadDataStyle(self, s):
if self.dirtyFlagVerification("Change Tag Read Style",
"If you change read tag style now, data in the form will be lost. Are you sure?"):
if self.dirtyFlagVerification(
"Change Tag Read Style",
"If you change read tag style now, data in the form will be lost. Are you sure?"):
self.load_data_style, b = self.cbLoadDataStyle.itemData(s).toInt()
self.settings.last_selected_load_data_style = self.load_data_style
self.updateMenus()
@ -1241,8 +1290,8 @@ class TaggerWindow(QtGui.QMainWindow):
role = str(self.twCredits.item(row, 1).text())
r = 0
while r < self.twCredits.rowCount():
if (self.twCredits.item(r, 0).text() != "" and
str(self.twCredits.item(r, 1).text()).lower() == role.lower()):
if (self.twCredits.item(r, 0).text() != "" and str(
self.twCredits.item(r, 1).text()).lower() == role.lower()):
self.twCredits.item(r, 0).setText("")
r = r + 1
@ -1281,12 +1330,12 @@ class TaggerWindow(QtGui.QMainWindow):
ok_to_mod = True
if self.isDupeCredit(new_role, new_name):
# delete the dupe credit from list
reply = QtGui.QMessageBox.question(self,
self.tr(
"Duplicate Credit!"),
self.tr(
"This will create a duplicate credit entry. Would you like to merge the entries, or create a duplicate?"),
self.tr("Merge"), self.tr("Duplicate"))
reply = QtGui.QMessageBox.question(
self,
self.tr("Duplicate Credit!"),
self.tr("This will create a duplicate credit entry. Would you like to merge the entries, or create a duplicate?"),
self.tr("Merge"),
self.tr("Duplicate"))
if reply == 0:
# merge
@ -1330,9 +1379,11 @@ class TaggerWindow(QtGui.QMainWindow):
def setAppPosition(self):
if self.settings.last_main_window_width != 0:
self.move(
self.settings.last_main_window_x, self.settings.last_main_window_y)
self.settings.last_main_window_x,
self.settings.last_main_window_y)
self.resize(
self.settings.last_main_window_width, self.settings.last_main_window_height)
self.settings.last_main_window_width,
self.settings.last_main_window_height)
else:
screen = QtGui.QDesktopWidget().screenGeometry()
size = self.frameGeometry()
@ -1472,20 +1523,27 @@ class TaggerWindow(QtGui.QMainWindow):
has_md_count += 1
if has_md_count == 0:
QtGui.QMessageBox.information(self, self.tr("Remove Tags"),
self.tr("No archives with {0} tags selected!".format(MetaDataStyle.name[style])))
QtGui.QMessageBox.information(
self, self.tr("Remove Tags"), self.tr(
"No archives with {0} tags selected!".format(
MetaDataStyle.name[style])))
return
if has_md_count != 0 and not self.dirtyFlagVerification("Remove Tags",
"If you remove tags now, unsaved data in the form will be lost. Are you sure?"):
if has_md_count != 0 and not self.dirtyFlagVerification(
"Remove Tags",
"If you remove tags now, unsaved data in the form will be lost. Are you sure?"):
return
if has_md_count != 0:
reply = QtGui.QMessageBox.question(self,
self.tr("Remove Tags"),
self.tr("Are you sure you wish to remove the {0} tags from {1} archive(s)?".format(
MetaDataStyle.name[style], has_md_count)),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr("Remove Tags"),
self.tr(
"Are you sure you wish to remove the {0} tags from {1} archive(s)?".format(
MetaDataStyle.name[style],
has_md_count)),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
progdialog = QtGui.QProgressDialog(
@ -1543,8 +1601,12 @@ class TaggerWindow(QtGui.QMainWindow):
dest_style = self.save_data_style
if src_style == dest_style:
QtGui.QMessageBox.information(self, self.tr("Copy Tags"), self.tr("Can't copy tag style onto itself." +
" Read style and modify style must be different."))
QtGui.QMessageBox.information(
self,
self.tr("Copy Tags"),
self.tr(
"Can't copy tag style onto itself." +
" Read style and modify style must be different."))
return
for ca in ca_list:
@ -1552,20 +1614,28 @@ class TaggerWindow(QtGui.QMainWindow):
has_src_count += 1
if has_src_count == 0:
QtGui.QMessageBox.information(self, self.tr("Copy Tags"), self.tr("No archives with {0} tags selected!".format(
MetaDataStyle.name[src_style])))
QtGui.QMessageBox.information(
self, self.tr("Copy Tags"), self.tr(
"No archives with {0} tags selected!".format(
MetaDataStyle.name[src_style])))
return
if has_src_count != 0 and not self.dirtyFlagVerification("Copy Tags",
"If you copy tags now, unsaved data in the form may be lost. Are you sure?"):
if has_src_count != 0 and not self.dirtyFlagVerification(
"Copy Tags",
"If you copy tags now, unsaved data in the form may be lost. Are you sure?"):
return
if has_src_count != 0:
reply = QtGui.QMessageBox.question(self,
self.tr("Copy Tags"),
self.tr("Are you sure you wish to copy the {0} tags to {1} tags in {2} archive(s)?".format(
MetaDataStyle.name[src_style], MetaDataStyle.name[dest_style], has_src_count)),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr("Copy Tags"),
self.tr(
"Are you sure you wish to copy the {0} tags to {1} tags in {2} archive(s)?".format(
MetaDataStyle.name[src_style],
MetaDataStyle.name[dest_style],
has_src_count)),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
progdialog = QtGui.QProgressDialog(
@ -1760,13 +1830,19 @@ class TaggerWindow(QtGui.QMainWindow):
self, self.tr("Auto-Tag"), self.tr("No archives selected!"))
return
if not self.dirtyFlagVerification("Auto-Tag",
"If you auto-tag now, unsaved data in the form will be lost. Are you sure?"):
if not self.dirtyFlagVerification(
"Auto-Tag",
"If you auto-tag now, unsaved data in the form will be lost. Are you sure?"):
return
atstartdlg = AutoTagStartWindow(self, self.settings,
self.tr("You have selected {0} archive(s) to automatically identify and write {1} tags to.\n\n".format(len(ca_list), MetaDataStyle.name[style]) +
"Please choose options below, and select OK to Auto-Tag.\n"))
atstartdlg = AutoTagStartWindow(
self,
self.settings,
self.tr(
"You have selected {0} archive(s) to automatically identify and write {1} tags to.\n\n".format(
len(ca_list),
MetaDataStyle.name[style]) +
"Please choose options below, and select OK to Auto-Tag.\n"))
atstartdlg.adjustSize()
atstartdlg.setModal(True)
@ -1851,16 +1927,21 @@ class TaggerWindow(QtGui.QMainWindow):
if sum_selectable > 0:
summary += u"\n\nDo you want to manually select the ones with multiple matches and/or low-confidence matches now?"
reply = QtGui.QMessageBox.question(self,
self.tr(u"Auto-Tag Summary"),
self.tr(summary),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr(u"Auto-Tag Summary"),
self.tr(summary),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
match_results.multipleMatches.extend(
match_results.lowConfidenceMatches)
if reply == QtGui.QMessageBox.Yes:
matchdlg = AutoTagMatchWindow(
self, match_results.multipleMatches, style, self.actualIssueDataFetch)
self,
match_results.multipleMatches,
style,
self.actualIssueDataFetch)
matchdlg.setModal(True)
matchdlg.exec_()
self.fileSelectionList.updateSelectedRows()
@ -1872,10 +1953,12 @@ class TaggerWindow(QtGui.QMainWindow):
def dirtyFlagVerification(self, title, desc):
if self.dirtyFlag:
reply = QtGui.QMessageBox.question(self,
self.tr(title),
self.tr(desc),
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(
self,
self.tr(title),
self.tr(desc),
QtGui.QMessageBox.Yes,
QtGui.QMessageBox.No)
if reply != QtGui.QMessageBox.Yes:
return False
@ -1883,8 +1966,10 @@ class TaggerWindow(QtGui.QMainWindow):
def closeEvent(self, event):
if self.dirtyFlagVerification("Exit " + self.appName,
"If you quit now, data in the form will be lost. Are you sure?"):
if self.dirtyFlagVerification(
"Exit " +
self.appName,
"If you quit now, data in the form will be lost. Are you sure?"):
appsize = self.size()
self.settings.last_main_window_width = appsize.width()
self.settings.last_main_window_height = appsize.height()
@ -1954,8 +2039,9 @@ class TaggerWindow(QtGui.QMainWindow):
self, self.tr("Rename"), self.tr("No archives selected!"))
return
if self.dirtyFlagVerification("File Rename",
"If you rename files now, unsaved data in the form will be lost. Are you sure?"):
if self.dirtyFlagVerification(
"File Rename",
"If you rename files now, unsaved data in the form will be lost. Are you sure?"):
dlg = RenameWindow(
self, ca_list, self.load_data_style, self.settings)
@ -2011,12 +2097,15 @@ class TaggerWindow(QtGui.QMainWindow):
if (new_version != self.version and
new_version != self.settings.dont_notify_about_this_version):
website = "http://code.google.com/p/comictagger"
checked = OptionalMessageDialog.msg(self, "New version available!",
"New version ({0}) available!<br>(You are currently running {1})<br><br>".format(new_version, self.version) +
"Visit <a href='{0}'>{0}</a> for more info.<br><br>".format(
website),
QtCore.Qt.Unchecked,
"Don't tell me about this version again")
checked = OptionalMessageDialog.msg(
self,
"New version available!",
"New version ({0}) available!<br>(You are currently running {1})<br><br>".format(
new_version,
self.version) +
"Visit <a href='{0}'>{0}</a> for more info.<br><br>".format(website),
QtCore.Qt.Unchecked,
"Don't tell me about this version again")
if checked:
self.settings.dont_notify_about_this_version = new_version

View File

@ -55,7 +55,9 @@ class SearchThread(QtCore.QThread):
try:
self.cv_error = False
self.cv_search_results = comicVine.searchForSeries(
self.series_name, callback=self.prog_callback, refresh_cache=self.refresh)
self.series_name,
callback=self.prog_callback,
refresh_cache=self.refresh)
except ComicVineTalkerException as e:
self.cv_search_results = []
self.cv_error = True
@ -160,7 +162,9 @@ class VolumeSelectionWindow(QtGui.QDialog):
if self.issue_number is None or self.issue_number == "":
QtGui.QMessageBox.information(
self, "Auto-Select", "Can't auto-select without an issue number (yet!)")
self,
"Auto-Select",
"Can't auto-select without an issue number (yet!)")
return
self.iddialog = IDProgressWindow(self)
@ -215,21 +219,29 @@ class VolumeSelectionWindow(QtGui.QDialog):
self, "Auto-Select Result", " No matches found :-(")
elif result == self.ii.ResultFoundMatchButBadCoverScore:
QtGui.QMessageBox.information(
self, "Auto-Select Result", " Found a match, but cover doesn't seem the same. Verify before commiting!")
self,
"Auto-Select Result",
" Found a match, but cover doesn't seem the same. Verify before commiting!")
found_match = matches[0]
elif result == self.ii.ResultFoundMatchButNotFirstPage:
QtGui.QMessageBox.information(
self, "Auto-Select Result", " Found a match, but not with the first page of the archive.")
self,
"Auto-Select Result",
" Found a match, but not with the first page of the archive.")
found_match = matches[0]
elif result == self.ii.ResultMultipleMatchesWithBadImageScores:
QtGui.QMessageBox.information(
self, "Auto-Select Result", " Found some possibilities, but no confidence. Proceed manually.")
self,
"Auto-Select Result",
" Found some possibilities, but no confidence. Proceed manually.")
choices = True
elif result == self.ii.ResultOneGoodMatch:
found_match = matches[0]
elif result == self.ii.ResultMultipleGoodMatches:
QtGui.QMessageBox.information(
self, "Auto-Select Result", " Found multiple likely matches. Please select.")
self,
"Auto-Select Result",
" Found multiple likely matches. Please select.")
choices = True
if choices:
@ -313,10 +325,14 @@ class VolumeSelectionWindow(QtGui.QDialog):
if self.search_thread.cv_error:
if self.search_thread.error_code == ComicVineTalkerException.RateLimit:
QtGui.QMessageBox.critical(
self, self.tr("Comic Vine Error"), ComicVineTalker.getRateLimitMessage())
self,
self.tr("Comic Vine Error"),
ComicVineTalker.getRateLimitMessage())
else:
QtGui.QMessageBox.critical(self, self.tr("Network Issue"), self.tr(
"Could not connect to ComicVine to search for series!"))
QtGui.QMessageBox.critical(
self,
self.tr("Network Issue"),
self.tr("Could not connect to ComicVine to search for series!"))
return
self.cv_search_results = self.search_thread.cv_search_results

View File

@ -109,8 +109,10 @@ def main():
series_name = series_name.replace(":", " -")
series_name = series_name.replace("/", "-")
series_name = series_name.replace("?", "")
series_folder = os.path.join(tree_root, unicode(publisher_name), unicode(
series_name) + " (" + unicode(start_year) + ")")
series_folder = os.path.join(
tree_root,
unicode(publisher_name),
unicode(series_name) + " (" + unicode(start_year) + ")")
make_folder(series_folder)
move_file(filename, os.path.join(
series_folder, os.path.basename(filename)))

View File

@ -38,9 +38,15 @@ def parse_args():
parser = argparse.ArgumentParser(
description='a script to rename comic files')
parser.add_argument(
'-t', '--transforms', metavar='xformfile', help="the file with transforms")
'-t',
'--transforms',
metavar='xformfile',
help="the file with transforms")
parser.add_argument(
'-n', '--noconfirm', action='store_true', help="don't confirm before rename")
'-n',
'--noconfirm',
action='store_true',
help="don't confirm before rename")
parser.add_argument('paths', metavar='PATH', type=str,
nargs='+', help='path to look for comic files')
parsed_args = parser.parse_args(input_args)