mirror of
https://github.com/ciromattia/kcc
synced 2026-01-30 08:57:40 +00:00
Miscellaneous tweaks
This commit is contained in:
19
kcc.py
19
kcc.py
@@ -23,7 +23,7 @@ if sys.version_info[0] != 3:
|
||||
print('ERROR: This is Python 3 script!')
|
||||
exit(1)
|
||||
|
||||
# OS specific PATH variable workarounds
|
||||
# OS specific workarounds
|
||||
import os
|
||||
if sys.platform.startswith('darwin'):
|
||||
if getattr(sys, 'frozen', False):
|
||||
@@ -34,6 +34,23 @@ if sys.platform.startswith('darwin'):
|
||||
else:
|
||||
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/osx/:' + os.environ['PATH']
|
||||
elif sys.platform.startswith('win'):
|
||||
import multiprocessing.popen_spawn_win32 as forking
|
||||
|
||||
class _Popen(forking.Popen):
|
||||
def __init__(self, *args, **kw):
|
||||
if hasattr(sys, 'frozen'):
|
||||
# noinspection PyProtectedMember
|
||||
os.putenv('_MEIPASS2', sys._MEIPASS)
|
||||
try:
|
||||
super(_Popen, self).__init__(*args, **kw)
|
||||
finally:
|
||||
if hasattr(sys, 'frozen'):
|
||||
if hasattr(os, 'unsetenv'):
|
||||
os.unsetenv('_MEIPASS2')
|
||||
else:
|
||||
os.putenv('_MEIPASS2', '')
|
||||
forking.Popen = _Popen
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
|
||||
else:
|
||||
|
||||
@@ -21,12 +21,9 @@ import os
|
||||
import sys
|
||||
from urllib.parse import unquote
|
||||
from urllib.request import urlopen, urlretrieve, Request
|
||||
from socket import gethostbyname_ex, gethostname
|
||||
from time import sleep, time
|
||||
from datetime import datetime
|
||||
from shutil import move
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from socketserver import ThreadingMixIn
|
||||
from subprocess import STDOUT, PIPE
|
||||
from PyQt5 import QtGui, QtCore, QtWidgets, QtNetwork
|
||||
from xml.dom.minidom import parse, Document
|
||||
@@ -399,10 +396,10 @@ class WorkerThread(QtCore.QThread):
|
||||
MW.addMessage.emit('Processing MOBI files... <b>Done!</b>', 'info', True)
|
||||
k = kindle.Kindle()
|
||||
if k.path and k.coverSupport:
|
||||
MW.addMessage.emit('Kindle detected. Uploading covers...', 'info', False)
|
||||
for item in outputPath:
|
||||
comic2ebook.options.covers[outputPath.index(item)][0].saveToKindle(
|
||||
k, comic2ebook.options.covers[outputPath.index(item)][1])
|
||||
MW.addMessage.emit('Kindle detected. Uploading covers...', 'info', False)
|
||||
else:
|
||||
GUI.progress.content = ''
|
||||
for item in outputPath:
|
||||
@@ -546,16 +543,22 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
||||
MW.setMaximumSize(QtCore.QSize(420, 335))
|
||||
MW.setMinimumSize(QtCore.QSize(420, 335))
|
||||
MW.resize(420, 335)
|
||||
GUI.OptionsGamma.setVisible(False)
|
||||
GUI.OptionsCustom.setVisible(False)
|
||||
elif mode == 2:
|
||||
self.currentMode = 2
|
||||
MW.setMaximumSize(QtCore.QSize(420, 365))
|
||||
MW.setMinimumSize(QtCore.QSize(420, 365))
|
||||
MW.resize(420, 365)
|
||||
GUI.OptionsGamma.setVisible(True)
|
||||
GUI.OptionsCustom.setVisible(False)
|
||||
elif mode == 3:
|
||||
self.currentMode = 3
|
||||
MW.setMaximumSize(QtCore.QSize(420, 390))
|
||||
MW.setMinimumSize(QtCore.QSize(420, 390))
|
||||
MW.resize(420, 390)
|
||||
GUI.OptionsGamma.setVisible(True)
|
||||
GUI.OptionsCustom.setVisible(True)
|
||||
|
||||
def modeConvert(self, enable):
|
||||
if enable < 1:
|
||||
@@ -1111,7 +1114,7 @@ class KCCGUI_MetaEditor(KCC_MetaEditor_ui.Ui_MetaEditorDialog):
|
||||
for field in (self.WriterLine, self.PencillerLine, self.InkerLine, self.ColoristLine):
|
||||
field.setText(', '.join(self.parser.data[field.objectName()[:-4] + 's']))
|
||||
if self.SeriesLine.text() == '':
|
||||
self.SeriesLine.setText(file.split('\\')[-1].split('.')[0])
|
||||
self.SeriesLine.setText(file.split('\\')[-1].split('/')[-1].split('.')[0])
|
||||
|
||||
def saveData(self):
|
||||
for field in (self.VolumeLine, self.NumberLine, self.MUidLine):
|
||||
|
||||
Reference in New Issue
Block a user