about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--kcc.py1
-rw-r--r--kcc/KCC_gui.py26
3 files changed, 28 insertions, 5 deletions
diff --git a/README.md b/README.md
index bab669e..2c42845 100644
--- a/README.md
+++ b/README.md
@@ -8,8 +8,8 @@ It can also optionally optimize images by applying a number of transformations.
 
 ### 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.  
-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.  
+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.
 _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
@@ -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)*
 
 ### 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.
 - [Pillow](http://pypi.python.org/pypi/Pillow/) - For comic optimizations. Please refer to official documentation for installing into your system.
 
diff --git a/kcc.py b/kcc.py
index 6b71753..0eb4493 100644
--- a/kcc.py
+++ b/kcc.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012 Ciro Mattia Gonano <ciromattia@gmail.com>
 #
diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py
index d129c16..23979cd 100644
--- a/kcc/KCC_gui.py
+++ b/kcc/KCC_gui.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 #
 # Copyright (c) 2013 Ciro Mattia Gonano <ciromattia@gmail.com>
 #
@@ -39,7 +40,15 @@ class Ui_KCC(object):
             self.firstStart = False
             GUI.JobList.clear()
         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)
+        self.clearEmptyJobs()
 
     def selectFile(self):
         if self.firstStart:
@@ -49,11 +58,24 @@ class Ui_KCC(object):
             fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Select file', '', '*.cbz *.cbr *.zip *.rar *.pdf')
         else:
             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)
+        self.clearEmptyJobs()
 
     def clearJobs(self):
         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):
         MainWindow.setMinimumSize(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())]
         argv = ["--profile=" + profile]
         currentJobs = []
+        global errors
         if GUI.MangaBox.isChecked():
             argv.append("--manga-style")
         if GUI.RotateBox.isChecked():
@@ -162,7 +185,6 @@ class Ui_KCC(object):
         if str(GUI.FormatBox.currentText()) == 'CBZ':
             argv.append("--cbz-output")
         for i in range(GUI.JobList.count()):
-            #TODO UTF8!
             currentJobs.append(str(GUI.JobList.item(i).text()))
         GUI.JobList.clear()
         for job in currentJobs:
@@ -182,7 +204,7 @@ class Ui_KCC(object):
                 type_, value_, traceback_ = sys.exc_info()
                 QtGui.QMessageBox.critical(MainWindow, 'KCC Error',
                                            "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)
                 self.addMessage('KCC failed to create EPUB!', self.errorIcon)
                 continue