mirror of
https://github.com/ciromattia/kcc
synced 2025-12-21 13:41:44 +00:00
"Fixed" UTF-8 problems
This commit is contained in:
@@ -8,8 +8,8 @@ It can also optionally optimize images by applying a number of transformations.
|
|||||||
|
|
||||||
### A word of warning
|
### A word of warning
|
||||||
**KCC** _is not_ [Amazon's Kindle Comic Creator](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1001103761) nor is in any way endorsed by Amazon.
|
**KCC** _is not_ [Amazon's Kindle Comic Creator](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1001103761) nor is in any way endorsed by Amazon.
|
||||||
Amazon's tool is for comic _publishers_ and involves a lot of manual effort, while **KCC** is for comic _readers_.
|
Amazon's tool is for comic **publishers** and involves a lot of manual effort, while **KCC** is for comic **readers**.
|
||||||
If you want to read some comments over *Amazon's kc2* you can take a look at [this](http://www.mobileread.com/forums/showthread.php?t=207461&page=7#96) and [that](http://www.mobileread.com/forums/showthread.php?t=211047) threads on Mobileread.
|
If you want to read some comments over *Amazon's KC2* you can take a look at [this](http://www.mobileread.com/forums/showthread.php?t=207461&page=7#96) and [that](http://www.mobileread.com/forums/showthread.php?t=211047) threads on Mobileread.
|
||||||
_KC2_ in no way is a replacement for **KCC** so you can be quite confident we'll going to carry on developing our little monster ;)
|
_KC2_ in no way is a replacement for **KCC** so you can be quite confident we'll going to carry on developing our little monster ;)
|
||||||
|
|
||||||
### Donations
|
### Donations
|
||||||
@@ -42,7 +42,7 @@ In the meanwhile you can download [version 2.9](https://dl.dropbox.com/u/1680610
|
|||||||
- [unrar](http://www.rarlab.com/download.htm) *(For CBR support)*
|
- [unrar](http://www.rarlab.com/download.htm) *(For CBR support)*
|
||||||
|
|
||||||
### For compiling/running from source:
|
### For compiling/running from source:
|
||||||
- Python 2.7+ - Included in MacOS and Linux, follow the [official documentation](http://www.python.org/getit/windows/) to install on Windows)
|
- Python 2.7+ - Included in MacOS and Linux, follow the [official documentation](http://www.python.org/getit/windows/) to install on Windows.
|
||||||
- PyQt4 4.10+ - Please refer to official documentation for installing into your system.
|
- PyQt4 4.10+ - Please refer to official documentation for installing into your system.
|
||||||
- [Pillow](http://pypi.python.org/pypi/Pillow/) - For comic optimizations. Please refer to official documentation for installing into your system.
|
- [Pillow](http://pypi.python.org/pypi/Pillow/) - For comic optimizations. Please refer to official documentation for installing into your system.
|
||||||
|
|
||||||
|
|||||||
1
kcc.py
1
kcc.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012 Ciro Mattia Gonano <ciromattia@gmail.com>
|
# Copyright (c) 2012 Ciro Mattia Gonano <ciromattia@gmail.com>
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 Ciro Mattia Gonano <ciromattia@gmail.com>
|
# Copyright (c) 2013 Ciro Mattia Gonano <ciromattia@gmail.com>
|
||||||
#
|
#
|
||||||
@@ -39,7 +40,15 @@ class Ui_KCC(object):
|
|||||||
self.firstStart = False
|
self.firstStart = False
|
||||||
GUI.JobList.clear()
|
GUI.JobList.clear()
|
||||||
dname = QtGui.QFileDialog.getExistingDirectory(MainWindow, 'Select directory', '')
|
dname = QtGui.QFileDialog.getExistingDirectory(MainWindow, 'Select directory', '')
|
||||||
|
# Lame UTF-8 security measure
|
||||||
|
try:
|
||||||
|
str(dname)
|
||||||
|
except Exception:
|
||||||
|
QtGui.QMessageBox.critical(MainWindow, 'KCC Error', "Path cannot contain non-ASCII characters.",
|
||||||
|
QtGui.QMessageBox.Ok)
|
||||||
|
return
|
||||||
GUI.JobList.addItem(dname)
|
GUI.JobList.addItem(dname)
|
||||||
|
self.clearEmptyJobs()
|
||||||
|
|
||||||
def selectFile(self):
|
def selectFile(self):
|
||||||
if self.firstStart:
|
if self.firstStart:
|
||||||
@@ -49,11 +58,24 @@ class Ui_KCC(object):
|
|||||||
fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.cbr *.zip *.rar *.pdf')
|
fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.cbr *.zip *.rar *.pdf')
|
||||||
else:
|
else:
|
||||||
fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.zip *.pdf')
|
fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.zip *.pdf')
|
||||||
|
# Lame UTF-8 security measure
|
||||||
|
try:
|
||||||
|
str(fname)
|
||||||
|
except Exception:
|
||||||
|
QtGui.QMessageBox.critical(MainWindow, 'KCC Error', "Path cannot contain non-ASCII characters.",
|
||||||
|
QtGui.QMessageBox.Ok)
|
||||||
|
return
|
||||||
GUI.JobList.addItem(fname)
|
GUI.JobList.addItem(fname)
|
||||||
|
self.clearEmptyJobs()
|
||||||
|
|
||||||
def clearJobs(self):
|
def clearJobs(self):
|
||||||
GUI.JobList.clear()
|
GUI.JobList.clear()
|
||||||
|
|
||||||
|
def clearEmptyJobs(self):
|
||||||
|
for i in range(GUI.JobList.count()):
|
||||||
|
if str(GUI.JobList.item(i).text()) == '':
|
||||||
|
GUI.JobList.takeItem(i)
|
||||||
|
|
||||||
def modeBasic(self):
|
def modeBasic(self):
|
||||||
MainWindow.setMinimumSize(QtCore.QSize(420, 270))
|
MainWindow.setMinimumSize(QtCore.QSize(420, 270))
|
||||||
MainWindow.setMaximumSize(QtCore.QSize(420, 270))
|
MainWindow.setMaximumSize(QtCore.QSize(420, 270))
|
||||||
@@ -139,6 +161,7 @@ class Ui_KCC(object):
|
|||||||
profile = ProfileData.ProfileLabels[str(GUI.DeviceBox.currentText())]
|
profile = ProfileData.ProfileLabels[str(GUI.DeviceBox.currentText())]
|
||||||
argv = ["--profile=" + profile]
|
argv = ["--profile=" + profile]
|
||||||
currentJobs = []
|
currentJobs = []
|
||||||
|
global errors
|
||||||
if GUI.MangaBox.isChecked():
|
if GUI.MangaBox.isChecked():
|
||||||
argv.append("--manga-style")
|
argv.append("--manga-style")
|
||||||
if GUI.RotateBox.isChecked():
|
if GUI.RotateBox.isChecked():
|
||||||
@@ -162,7 +185,6 @@ class Ui_KCC(object):
|
|||||||
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
||||||
argv.append("--cbz-output")
|
argv.append("--cbz-output")
|
||||||
for i in range(GUI.JobList.count()):
|
for i in range(GUI.JobList.count()):
|
||||||
#TODO UTF8!
|
|
||||||
currentJobs.append(str(GUI.JobList.item(i).text()))
|
currentJobs.append(str(GUI.JobList.item(i).text()))
|
||||||
GUI.JobList.clear()
|
GUI.JobList.clear()
|
||||||
for job in currentJobs:
|
for job in currentJobs:
|
||||||
@@ -182,7 +204,7 @@ class Ui_KCC(object):
|
|||||||
type_, value_, traceback_ = sys.exc_info()
|
type_, value_, traceback_ = sys.exc_info()
|
||||||
QtGui.QMessageBox.critical(MainWindow, 'KCC Error',
|
QtGui.QMessageBox.critical(MainWindow, 'KCC Error',
|
||||||
"Error on file %s:\n%s\nTraceback:\n%s"
|
"Error on file %s:\n%s\nTraceback:\n%s"
|
||||||
% (jobargv[-1], str(err),traceback.format_tb(traceback_)),
|
% (jobargv[-1], str(err), traceback.format_tb(traceback_)),
|
||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
self.addMessage('KCC failed to create EPUB!', self.errorIcon)
|
self.addMessage('KCC failed to create EPUB!', self.errorIcon)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user