mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Added option to select output directory
This commit is contained in:
@@ -240,6 +240,9 @@
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Shift+Click to select the output directory.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Convert</string>
|
||||
</property>
|
||||
|
||||
@@ -243,6 +243,9 @@
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><span style=" font-size:12pt;">Shift+Click to select the output directory.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Convert</string>
|
||||
</property>
|
||||
|
||||
3
KCC.ui
3
KCC.ui
@@ -206,6 +206,9 @@
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Shift+Click to select the output directory.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Convert</string>
|
||||
</property>
|
||||
|
||||
@@ -514,6 +514,12 @@ class WorkerThread(QtCore.QThread):
|
||||
GUI.progress.content = ''
|
||||
mobiPath = item.replace('.epub', '.mobi')
|
||||
os.remove(mobiPath + '_toclean')
|
||||
if GUI.targetDirectory and GUI.targetDirectory != os.path.split(mobiPath)[0]:
|
||||
try:
|
||||
move(mobiPath, GUI.targetDirectory)
|
||||
mobiPath = os.path.join(GUI.targetDirectory, os.path.basename(mobiPath))
|
||||
except Exception:
|
||||
pass
|
||||
GUI.completedWork[os.path.basename(mobiPath)] = mobiPath
|
||||
MW.addMessage.emit('Cleaning MOBI files... <b>Done!</b>', 'info', True)
|
||||
else:
|
||||
@@ -544,6 +550,12 @@ class WorkerThread(QtCore.QThread):
|
||||
False)
|
||||
else:
|
||||
for item in outputPath:
|
||||
if GUI.targetDirectory and GUI.targetDirectory != os.path.split(item)[0]:
|
||||
try:
|
||||
move(item, GUI.targetDirectory)
|
||||
item = os.path.join(GUI.targetDirectory, os.path.basename(item))
|
||||
except Exception:
|
||||
pass
|
||||
GUI.completedWork[os.path.basename(item)] = item
|
||||
GUI.progress.content = ''
|
||||
GUI.progress.stop()
|
||||
@@ -918,6 +930,17 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
||||
self.conversionAlive = False
|
||||
self.worker.sync()
|
||||
else:
|
||||
# noinspection PyArgumentList
|
||||
if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
|
||||
dname = QtWidgets.QFileDialog.getExistingDirectory(MW, 'Select output directory', self.lastPath)
|
||||
if dname != '':
|
||||
if sys.platform.startswith('win'):
|
||||
dname = dname.replace('/', '\\')
|
||||
GUI.targetDirectory = dname
|
||||
else:
|
||||
GUI.targetDirectory = ''
|
||||
else:
|
||||
GUI.targetDirectory = ''
|
||||
self.progress.start()
|
||||
if self.needClean:
|
||||
self.needClean = False
|
||||
@@ -1046,6 +1069,7 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
||||
self.needClean = True
|
||||
self.GammaValue = 1.0
|
||||
self.completedWork = {}
|
||||
self.targetDirectory = ''
|
||||
if sys.platform.startswith('darwin'):
|
||||
self.listFontSize = 11
|
||||
self.statusBarFontSize = 10
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'KCC.ui'
|
||||
#
|
||||
# Created: Mon Jan 20 10:34:14 2014
|
||||
# Created: Mon Jan 20 22:02:01 2014
|
||||
# by: PyQt5 UI code generator 5.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@@ -274,6 +274,7 @@ class Ui_KCC(object):
|
||||
self.NoRotateBox.setText(_translate("KCC", "No split/rotate"))
|
||||
self.DeviceBox.setToolTip(_translate("KCC", "Target device."))
|
||||
self.FormatBox.setToolTip(_translate("KCC", "Output format."))
|
||||
self.ConvertButton.setToolTip(_translate("KCC", "<html><head/><body><p>Shift+Click to select the output directory.</p></body></html>"))
|
||||
self.ConvertButton.setText(_translate("KCC", "Convert"))
|
||||
self.DirectoryButton.setText(_translate("KCC", "Add directory"))
|
||||
self.FileButton.setText(_translate("KCC", "Add file"))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'KCC-Linux.ui'
|
||||
#
|
||||
# Created: Mon Jan 20 10:34:24 2014
|
||||
# Created: Mon Jan 20 22:02:12 2014
|
||||
# by: PyQt5 UI code generator 5.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@@ -343,6 +343,7 @@ class Ui_KCC(object):
|
||||
self.NoRotateBox.setText(_translate("KCC", "No split/rotate"))
|
||||
self.DeviceBox.setToolTip(_translate("KCC", "Target device."))
|
||||
self.FormatBox.setToolTip(_translate("KCC", "Output format."))
|
||||
self.ConvertButton.setToolTip(_translate("KCC", "<html><head/><body><p>Shift+Click to select the output directory.</p></body></html>"))
|
||||
self.ConvertButton.setText(_translate("KCC", "Convert"))
|
||||
self.DirectoryButton.setText(_translate("KCC", "Add directory"))
|
||||
self.FileButton.setText(_translate("KCC", "Add file"))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'KCC-OSX.ui'
|
||||
#
|
||||
# Created: Mon Jan 20 10:34:32 2014
|
||||
# Created: Mon Jan 20 22:02:21 2014
|
||||
# by: PyQt5 UI code generator 5.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@@ -366,6 +366,7 @@ class Ui_KCC(object):
|
||||
self.NoRotateBox.setText(_translate("KCC", "No split/rotate"))
|
||||
self.DeviceBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Target device.</span></p></body></html>"))
|
||||
self.FormatBox.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Output format.</span></p></body></html>"))
|
||||
self.ConvertButton.setToolTip(_translate("KCC", "<html><head/><body><p><span style=\" font-size:12pt;\">Shift+Click to select the output directory.</span></p></body></html>"))
|
||||
self.ConvertButton.setText(_translate("KCC", "Convert"))
|
||||
self.DirectoryButton.setText(_translate("KCC", "Add directory"))
|
||||
self.FileButton.setText(_translate("KCC", "Add file"))
|
||||
|
||||
4
setup.py
4
setup.py
@@ -52,9 +52,9 @@ if platform == "darwin":
|
||||
)
|
||||
)
|
||||
elif platform == "win32":
|
||||
import platform
|
||||
import platform as arch
|
||||
from cx_Freeze import setup, Executable
|
||||
if platform.architecture()[0] == '64bit':
|
||||
if arch.architecture()[0] == '64bit':
|
||||
library = 'libEGL64.dll'
|
||||
else:
|
||||
library = 'libEGL32.dll'
|
||||
|
||||
Reference in New Issue
Block a user