mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1337 (Priority for Conversion Jobs lost)
This commit is contained in:
parent
b828f4c245
commit
809b84f539
@ -6,7 +6,7 @@ from PyQt4.QtGui import QDialog, QMessageBox, QListWidgetItem, QIcon, \
|
||||
QDesktopServices, QVBoxLayout, QLabel, QPlainTextEdit
|
||||
from PyQt4.QtCore import SIGNAL, QTimer, Qt, QSize, QVariant, QUrl
|
||||
|
||||
from calibre import islinux
|
||||
from calibre.constants import islinux, iswindows
|
||||
from calibre.gui2.dialogs.config_ui import Ui_Dialog
|
||||
from calibre.gui2 import qstring_to_unicode, choose_dir, error_dialog, config, \
|
||||
warning_dialog, ALL_COLUMNS
|
||||
@ -116,6 +116,10 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
self.systray_icon.setChecked(config['systray_icon'])
|
||||
self.sync_news.setChecked(config['upload_news_to_device'])
|
||||
self.delete_news.setChecked(config['delete_news_from_library_on_upload'])
|
||||
p = {'normal':0, 'high':1, 'low':2}[prefs['worker_process_priority']]
|
||||
self.priority.setCurrentIndex(p)
|
||||
self.priority.setVisible(iswindows)
|
||||
self.priority_label.setVisible(iswindows)
|
||||
|
||||
def up_column(self):
|
||||
idx = self.columns.currentRow()
|
||||
@ -212,6 +216,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
||||
config['confirm_delete'] = bool(self.confirm_delete.isChecked())
|
||||
pattern = self.filename_pattern.commit()
|
||||
prefs['filename_pattern'] = pattern
|
||||
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
|
||||
prefs['worker_process_priority'] = p
|
||||
prefs['read_file_metadata'] = bool(self.pdf_metadata.isChecked())
|
||||
config['save_to_disk_single_format'] = BOOK_EXTENSIONS[self.single_format.currentIndex()]
|
||||
config['cover_flow_queue_length'] = self.cover_browse.value()
|
||||
|
@ -231,6 +231,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QComboBox" name="priority" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>High</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Low</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="priority_label" >
|
||||
<property name="text" >
|
||||
<string>Job &priority:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>priority</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -32,6 +32,7 @@ from math import ceil
|
||||
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
from calibre import iswindows, detect_ncpus, isosx
|
||||
from calibre.utils.config import prefs
|
||||
|
||||
DEBUG = False
|
||||
|
||||
@ -223,6 +224,8 @@ class WorkerMother(object):
|
||||
return child
|
||||
|
||||
def spawn_free_spirit_windows(self, arg, type='free_spirit'):
|
||||
priority = {'high':win32process.HIGH_PRIORITY_CLASS, 'normal':win32process.NORMAL_PRIORITY_CLASS,
|
||||
'low':win32process.IDLE_PRIORITY_CLASS}[prefs['worker_process_priority']]
|
||||
fd, name = tempfile.mkstemp('.log', 'calibre_'+type+'_')
|
||||
handle = msvcrt.get_osfhandle(fd)
|
||||
si = win32process.STARTUPINFO()
|
||||
@ -236,7 +239,7 @@ class WorkerMother(object):
|
||||
None, # processAttributes
|
||||
None, # threadAttributes
|
||||
1, # bInheritHandles
|
||||
win32process.CREATE_NO_WINDOW, # Dont want ugly console popping up
|
||||
win32process.CREATE_NO_WINDOW|priority, # Dont want ugly console popping up
|
||||
self.get_env(), # New environment
|
||||
None, # Current directory
|
||||
si
|
||||
|
@ -536,6 +536,8 @@ def _prefs():
|
||||
help=_('The default output format for ebook conversions.'))
|
||||
c.add_opt('read_file_metadata', default=True,
|
||||
help=_('Read metadata from files'))
|
||||
c.add_opt('worker_process_priority', default='normal',
|
||||
help=_('The priority of worker processes'))
|
||||
|
||||
c.add_opt('migrated', default=False, help='For Internal use. Don\'t modify.')
|
||||
return c
|
||||
|
Loading…
x
Reference in New Issue
Block a user