Added warning when rar is tried be loaded, and unrar tool isn't known

Fixed a bug when erroneous message is show when file is attempted to be reloaded

git-svn-id: http://comictagger.googlecode.com/svn/trunk@726 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville@gmail.com 2014-04-12 06:08:07 +00:00
parent 752a1d8923
commit 3d93197101
2 changed files with 34 additions and 3 deletions

View File

@ -31,7 +31,10 @@ from settings import ComicTaggerSettings
from comicarchive import ComicArchive
from comicarchive import MetaDataStyle
from genericmetadata import GenericMetadata, PageType
from optionalmsgdialog import OptionalMessageDialog
import utils
import platform
import os
class FileTableWidget( QTableWidget ):
@ -172,7 +175,6 @@ class FileSelectionList(QWidget):
def addPathList( self, pathlist ):
filelist = utils.get_recursive_filelist( pathlist )
# we now have a list of files to add
progdialog = QProgressDialog("", "Cancel", 0, len(filelist), self)
@ -196,6 +198,21 @@ class FileSelectionList(QWidget):
firstAdded = row
progdialog.close()
if self.settings.show_no_unrar_warning and self.settings.unrar_exe_path == "" and platform.system() != "Windows":
for f in filelist:
ext = os.path.splitext(f)[1].lower()
if ext == ".rar" or ext ==".cbr":
checked = OptionalMessageDialog.msg( self, "No unrar tool",
"""
It looks like you've tried to load at least one CBR or RAR file.<br><br>
In order for ComicTagger to read this kind of file, you will have to configure
the location of the unrar tool in the settings. Until then, ComicTagger
will not be able recognize these kind of files.
"""
)
self.settings.show_no_unrar_warning = not checked
break
if firstAdded is not None:
self.twList.selectRow(firstAdded)
else:
@ -226,7 +243,17 @@ class FileSelectionList(QWidget):
return True
r = r + 1
return False
return False
def getCurrentListRow( self, path ):
r = 0
while r < self.twList.rowCount():
ca = self.getArchiveByRow( r )
if ca.path == path:
return r
r = r + 1
return -1
def addPathItem( self, path):
path = unicode( path )
@ -234,7 +261,7 @@ class FileSelectionList(QWidget):
#print "processing", path
if self.isListDupe(path):
return None
return self.getCurrentListRow(path)
ca = ComicArchive( path, self.settings.rar_exe_path )

View File

@ -98,6 +98,7 @@ class ComicTaggerSettings:
self.show_disclaimer = True
self.dont_notify_about_this_version = ""
self.ask_about_usage_stats = True
self.show_no_unrar_warning = True
#filename parsing settings
self.parse_scan_info = True
@ -242,6 +243,8 @@ class ComicTaggerSettings:
self.dont_notify_about_this_version = self.config.get( 'dialogflags', 'dont_notify_about_this_version' )
if self.config.has_option('dialogflags', 'ask_about_usage_stats'):
self.ask_about_usage_stats = self.config.getboolean( 'dialogflags', 'ask_about_usage_stats' )
if self.config.has_option('dialogflags', 'show_no_unrar_warning'):
self.show_no_unrar_warning = self.config.getboolean( 'dialogflags', 'show_no_unrar_warning' )
if self.config.has_option('comicvine', 'use_series_start_as_volume'):
self.use_series_start_as_volume = self.config.getboolean( 'comicvine', 'use_series_start_as_volume' )
@ -329,6 +332,7 @@ class ComicTaggerSettings:
self.config.set( 'dialogflags', 'show_disclaimer', self.show_disclaimer )
self.config.set( '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( 'dialogflags', 'show_no_unrar_warning', self.show_no_unrar_warning )
if not self.config.has_section( 'filenameparser' ):
self.config.add_section( 'filenameparser' )