about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--KCC-Linux.ui3
-rw-r--r--KCC-OSX.ui3
-rw-r--r--KCC.ui3
-rw-r--r--kcc/KCC_gui.py24
-rw-r--r--kcc/KCC_ui.py3
-rw-r--r--kcc/KCC_ui_linux.py3
-rw-r--r--kcc/KCC_ui_osx.py3
-rwxr-xr-xsetup.py4
8 files changed, 41 insertions, 5 deletions
diff --git a/KCC-Linux.ui b/KCC-Linux.ui
index e08ef60..c69f1ce 100644
--- a/KCC-Linux.ui
+++ b/KCC-Linux.ui
@@ -240,6 +240,9 @@
     <property name="focusPolicy">
      <enum>Qt::NoFocus</enum>
     </property>
+    <property name="toolTip">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Shift+Click to select the output directory.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
     <property name="text">
      <string>Convert</string>
     </property>
diff --git a/KCC-OSX.ui b/KCC-OSX.ui
index 21dc000..38365a5 100644
--- a/KCC-OSX.ui
+++ b/KCC-OSX.ui
@@ -243,6 +243,9 @@
     <property name="focusPolicy">
      <enum>Qt::NoFocus</enum>
     </property>
+    <property name="toolTip">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Shift+Click to select the output directory.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
     <property name="text">
      <string>Convert</string>
     </property>
diff --git a/KCC.ui b/KCC.ui
index a067723..d062fec 100644
--- a/KCC.ui
+++ b/KCC.ui
@@ -206,6 +206,9 @@
     <property name="focusPolicy">
      <enum>Qt::NoFocus</enum>
     </property>
+    <property name="toolTip">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Shift+Click to select the output directory.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
     <property name="text">
      <string>Convert</string>
     </property>
diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py
index 463bb02..726089f 100644
--- a/kcc/KCC_gui.py
+++ b/kcc/KCC_gui.py
@@ -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
diff --git a/kcc/KCC_ui.py b/kcc/KCC_ui.py
index d370c57..8d28591 100644
--- a/kcc/KCC_ui.py
+++ b/kcc/KCC_ui.py
@@ -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"))
diff --git a/kcc/KCC_ui_linux.py b/kcc/KCC_ui_linux.py
index 089647c..25592d8 100644
--- a/kcc/KCC_ui_linux.py
+++ b/kcc/KCC_ui_linux.py
@@ -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"))
diff --git a/kcc/KCC_ui_osx.py b/kcc/KCC_ui_osx.py
index 5009adb..aea2ae6 100644
--- a/kcc/KCC_ui_osx.py
+++ b/kcc/KCC_ui_osx.py
@@ -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"))
diff --git a/setup.py b/setup.py
index 8f5e2f1..6e5b5b9 100755
--- a/setup.py
+++ b/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'