mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Bucket of various tweaks
This commit is contained in:
6
kcc.py
6
kcc.py
@@ -27,15 +27,15 @@ import sys
|
||||
import os
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from PyQt4 import QtCore, QtGui, QtNetwork
|
||||
from PyQt5 import QtCore, QtGui, QtNetwork
|
||||
except ImportError:
|
||||
print("ERROR: PyQT4 is not installed!")
|
||||
print("ERROR: PyQT5 is not installed!")
|
||||
if sys.platform.startswith('linux'):
|
||||
import tkinter
|
||||
import tkinter.messagebox
|
||||
importRoot = tkinter.Tk()
|
||||
importRoot.withdraw()
|
||||
tkinter.messagebox.showerror("KCC - Error", "PyQT4 is not installed!")
|
||||
tkinter.messagebox.showerror("KCC - Error", "PyQT5 is not installed!")
|
||||
exit(1)
|
||||
from kcc import KCC_gui
|
||||
from multiprocessing import freeze_support
|
||||
|
||||
@@ -34,7 +34,7 @@ from shutil import move
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from socketserver import ThreadingMixIn
|
||||
from subprocess import STDOUT, PIPE
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from PyQt5 import QtGui, QtCore
|
||||
from xml.dom.minidom import parse
|
||||
from html.parser import HTMLParser
|
||||
from .KCC_rc_web import WebContent
|
||||
|
||||
@@ -27,12 +27,11 @@ import sys
|
||||
import re
|
||||
import stat
|
||||
import string
|
||||
import unicodedata
|
||||
import zipfile
|
||||
from tempfile import mkdtemp
|
||||
from shutil import move, copyfile, copytree, rmtree
|
||||
from optparse import OptionParser, OptionGroup
|
||||
from multiprocessing import Pool, freeze_support
|
||||
from multiprocessing import Pool
|
||||
from xml.dom.minidom import parse
|
||||
from uuid import uuid4
|
||||
from slugify import slugify
|
||||
@@ -40,25 +39,25 @@ try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from PIL import Image
|
||||
if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (Image.PILLOW_VERSION.split(".")))):
|
||||
print "ERROR: Pillow 2.3.0 or newer is required!"
|
||||
print("ERROR: Pillow 2.3.0 or newer is required!")
|
||||
if sys.platform.startswith('linux'):
|
||||
import Tkinter
|
||||
import tkMessageBox
|
||||
importRoot = Tkinter.Tk()
|
||||
import tkinter
|
||||
import tkinter.messagebox
|
||||
importRoot = tkinter.Tk()
|
||||
importRoot.withdraw()
|
||||
tkMessageBox.showerror("KCC - Error", "Pillow 2.3.0 or newer is required!")
|
||||
tkinter.messagebox.showerror("KCC - Error", "Pillow 2.3.0 or newer is required!")
|
||||
exit(1)
|
||||
except ImportError:
|
||||
print "ERROR: Pillow is not installed!"
|
||||
print("ERROR: Pillow is not installed!")
|
||||
if sys.platform.startswith('linux'):
|
||||
import Tkinter
|
||||
import tkMessageBox
|
||||
importRoot = Tkinter.Tk()
|
||||
import tkinter
|
||||
import tkinter.messagebox
|
||||
importRoot = tkinter.Tk()
|
||||
importRoot.withdraw()
|
||||
tkMessageBox.showerror("KCC - Error", "Pillow 2.3.0 or newer is required!")
|
||||
tkinter.messagebox.showerror("KCC - Error", "Pillow 2.3.0 or newer is required!")
|
||||
exit(1)
|
||||
try:
|
||||
from PyQt4 import QtCore
|
||||
from PyQt5 import QtCore
|
||||
except ImportError:
|
||||
QtCore = None
|
||||
from . import comic2panel
|
||||
@@ -672,6 +671,7 @@ def checkComicInfo(path, originalPath):
|
||||
os.remove(xmlPath)
|
||||
|
||||
|
||||
# TODO: Check if replacement work correctly
|
||||
#def slugify(value):
|
||||
# # Normalizes string, converts to lowercase, removes non-alpha characters and converts spaces to hyphens.
|
||||
# value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
|
||||
|
||||
@@ -26,7 +26,7 @@ import os
|
||||
import sys
|
||||
from shutil import rmtree, copytree, move
|
||||
from optparse import OptionParser, OptionGroup
|
||||
from multiprocessing import Pool, freeze_support
|
||||
from multiprocessing import Pool
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from PIL import Image, ImageStat
|
||||
@@ -49,7 +49,7 @@ except ImportError:
|
||||
tkinter.messagebox.showerror("KCC - Error", "Pillow 2.3.0 or newer is required!")
|
||||
exit(1)
|
||||
try:
|
||||
from PyQt4 import QtCore
|
||||
from PyQt5 import QtCore
|
||||
except ImportError:
|
||||
QtCore = None
|
||||
|
||||
|
||||
2
setup.py
2
setup.py
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
cx_Freeze build script for KCC.
|
||||
|
||||
|
||||
2
setup.sh
2
setup.sh
@@ -5,7 +5,7 @@ VERSION="4.0"
|
||||
|
||||
cp kcc.py __main__.py
|
||||
zip kcc.zip __main__.py kcc/*.py
|
||||
echo "#!/usr/bin/env python2" > kcc-bin
|
||||
echo "#!/usr/bin/env python3" > kcc-bin
|
||||
cat kcc.zip >> kcc-bin
|
||||
chmod +x kcc-bin
|
||||
tar --xform s:^.*/:: --xform s/kcc-bin/kcc/ --xform s/comic2ebook/kcc/ -czf KindleComicConverter_linux_$VERSION.tar.gz kcc-bin LICENSE.txt icons/comic2ebook.png
|
||||
|
||||
Reference in New Issue
Block a user