mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add progress indicator to search dialog.
This commit is contained in:
parent
df52819199
commit
f64e279767
@ -17,6 +17,7 @@ from PyQt4.Qt import Qt, QAbstractItemModel, QDialog, QTimer, QVariant, \
|
|||||||
|
|
||||||
from calibre import browser
|
from calibre import browser
|
||||||
from calibre.gui2 import NONE
|
from calibre.gui2 import NONE
|
||||||
|
from calibre.gui2.progress_indicator import ProgressIndicator
|
||||||
from calibre.gui2.store.search_ui import Ui_Dialog
|
from calibre.gui2.store.search_ui import Ui_Dialog
|
||||||
from calibre.utils.config import DynamicConfig
|
from calibre.utils.config import DynamicConfig
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
@ -56,6 +57,10 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
stores_group_layout.addWidget(cbox)
|
stores_group_layout.addWidget(cbox)
|
||||||
setattr(self, 'store_check_' + x, cbox)
|
setattr(self, 'store_check_' + x, cbox)
|
||||||
stores_group_layout.addStretch()
|
stores_group_layout.addStretch()
|
||||||
|
|
||||||
|
# Create and add the progress indicator
|
||||||
|
self.pi = ProgressIndicator(self, 24)
|
||||||
|
self.bottom_layout.insertWidget(0, self.pi)
|
||||||
|
|
||||||
self.search.clicked.connect(self.do_search)
|
self.search.clicked.connect(self.do_search)
|
||||||
self.checker.timeout.connect(self.get_results)
|
self.checker.timeout.connect(self.get_results)
|
||||||
@ -109,6 +114,7 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
self.hang_check = 0
|
self.hang_check = 0
|
||||||
self.checker.start(100)
|
self.checker.start(100)
|
||||||
self.search_pool.start_threads()
|
self.search_pool.start_threads()
|
||||||
|
self.pi.startAnimation()
|
||||||
|
|
||||||
def save_state(self):
|
def save_state(self):
|
||||||
self.config['store_search_geometry'] = self.saveGeometry()
|
self.config['store_search_geometry'] = self.saveGeometry()
|
||||||
@ -151,10 +157,12 @@ class SearchDialog(QDialog, Ui_Dialog):
|
|||||||
if self.hang_check >= HANG_TIME:
|
if self.hang_check >= HANG_TIME:
|
||||||
self.search_pool.abort()
|
self.search_pool.abort()
|
||||||
self.checker.stop()
|
self.checker.stop()
|
||||||
|
self.pi.stopAnimation()
|
||||||
else:
|
else:
|
||||||
# Stop the checker if not threads are running.
|
# Stop the checker if not threads are running.
|
||||||
if not self.search_pool.threads_running() and not self.search_pool.has_tasks():
|
if not self.search_pool.threads_running() and not self.search_pool.has_tasks():
|
||||||
self.checker.stop()
|
self.checker.stop()
|
||||||
|
self.pi.stopAnimation()
|
||||||
|
|
||||||
while self.search_pool.has_results():
|
while self.search_pool.has_results():
|
||||||
res = self.search_pool.get_result()
|
res = self.search_pool.get_result()
|
||||||
|
@ -149,7 +149,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="bottom_layout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user