Auto set book title to image directory

When adding an image directory set the book title to the name of the
directory (which is usually the name of the manga/chapter)

Fixed a slip with isdir
This commit is contained in:
Jan 2013-10-10 18:54:46 +11:00
parent 560687b768
commit df08b06d33

View File

@ -215,6 +215,7 @@ class MainWindowBook(QtGui.QMainWindow):
def onBookAddDirectory(self): def onBookAddDirectory(self):
directory = QtGui.QFileDialog.getExistingDirectory(self, 'Select an image directory to add') directory = QtGui.QFileDialog.getExistingDirectory(self, 'Select an image directory to add')
if not directory.isNull(): if not directory.isNull():
self.book.title = os.path.basename(os.path.normpath(unicode(directory)))
self.addImageDirs([directory]) self.addImageDirs([directory])
@ -375,7 +376,7 @@ class MainWindowBook(QtGui.QMainWindow):
path = os.path.join(directory, item) path = os.path.join(directory, item)
if self.isImageFile(path): if self.isImageFile(path):
filenames.append(path) filenames.append(path)
elif os.path.isdir: elif os.path.isdir(path):
self.addImageDirs([path]) self.addImageDirs([path])
self.addImageFiles(filenames) self.addImageFiles(filenames)