mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1494 (main screen refresh)
This commit is contained in:
parent
360701b3af
commit
c667ad16a6
@ -15,8 +15,8 @@ from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt, QString, \
|
|||||||
from calibre import strftime
|
from calibre import strftime
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
from calibre.library.database2 import FIELD_MAP
|
from calibre.library.database2 import FIELD_MAP
|
||||||
from calibre.gui2 import NONE, TableView, qstring_to_unicode, config,\
|
from calibre.gui2 import NONE, TableView, qstring_to_unicode, config, \
|
||||||
error_dialog
|
error_dialog
|
||||||
from calibre.utils.search_query_parser import SearchQueryParser
|
from calibre.utils.search_query_parser import SearchQueryParser
|
||||||
|
|
||||||
class LibraryDelegate(QItemDelegate):
|
class LibraryDelegate(QItemDelegate):
|
||||||
|
@ -3,11 +3,11 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
import os, sys, textwrap, collections, traceback, time
|
import os, sys, textwrap, collections, traceback, time
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from PyQt4.QtCore import Qt, SIGNAL, QObject, QCoreApplication, QUrl, QTimer
|
from PyQt4.Qt import Qt, SIGNAL, QObject, QCoreApplication, QUrl, QTimer, \
|
||||||
from PyQt4.QtGui import QPixmap, QColor, QPainter, QMenu, QIcon, QMessageBox, \
|
QModelIndex, QPixmap, QColor, QPainter, QMenu, QIcon, \
|
||||||
QToolButton, QDialog, QDesktopServices, QFileDialog, \
|
QToolButton, QDialog, QDesktopServices, QFileDialog, \
|
||||||
QSystemTrayIcon, QApplication, QKeySequence, QAction, \
|
QSystemTrayIcon, QApplication, QKeySequence, QAction, \
|
||||||
QProgressDialog
|
QProgressDialog, QMessageBox
|
||||||
from PyQt4.QtSvg import QSvgRenderer
|
from PyQt4.QtSvg import QSvgRenderer
|
||||||
|
|
||||||
from calibre import __version__, __appname__, islinux, sanitize_file_name, \
|
from calibre import __version__, __appname__, islinux, sanitize_file_name, \
|
||||||
@ -308,7 +308,6 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
db = LibraryDatabase2(self.library_path)
|
db = LibraryDatabase2(self.library_path)
|
||||||
self.library_view.set_database(db)
|
self.library_view.set_database(db)
|
||||||
if self.olddb is not None:
|
if self.olddb is not None:
|
||||||
from PyQt4.QtGui import QProgressDialog
|
|
||||||
pd = QProgressDialog('', '', 0, 100, self)
|
pd = QProgressDialog('', '', 0, 100, self)
|
||||||
pd.setWindowModality(Qt.ApplicationModal)
|
pd.setWindowModality(Qt.ApplicationModal)
|
||||||
pd.setCancelButton(None)
|
pd.setCancelButton(None)
|
||||||
@ -798,6 +797,7 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
Edit metadata of selected books in library.
|
Edit metadata of selected books in library.
|
||||||
'''
|
'''
|
||||||
rows = self.library_view.selectionModel().selectedRows()
|
rows = self.library_view.selectionModel().selectedRows()
|
||||||
|
previous = self.library_view.currentIndex()
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self, _('Cannot edit metadata'), _('No books selected'))
|
d = error_dialog(self, _('Cannot edit metadata'), _('No books selected'))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
@ -814,7 +814,10 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
self.library_view.model().db,
|
self.library_view.model().db,
|
||||||
accepted_callback=accepted)
|
accepted_callback=accepted)
|
||||||
d.exec_()
|
d.exec_()
|
||||||
|
if rows:
|
||||||
|
current = self.library_view.currentIndex()
|
||||||
|
self.library_view.model().current_changed(current, previous)
|
||||||
|
|
||||||
def edit_bulk_metadata(self, checked):
|
def edit_bulk_metadata(self, checked):
|
||||||
'''
|
'''
|
||||||
Edit metadata of selected books in library in bulk.
|
Edit metadata of selected books in library in bulk.
|
||||||
@ -1071,6 +1074,9 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
os.remove(f.name)
|
os.remove(f.name)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if self.current_view() is self.library_view:
|
||||||
|
current = self.library_view.currentIndex()
|
||||||
|
self.library_view.model().current_changed(current, QModelIndex())
|
||||||
|
|
||||||
#############################View book######################################
|
#############################View book######################################
|
||||||
|
|
||||||
@ -1203,7 +1209,6 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
newloc = d.database_location
|
newloc = d.database_location
|
||||||
if not os.path.exists(os.path.join(newloc, 'metadata.db')):
|
if not os.path.exists(os.path.join(newloc, 'metadata.db')):
|
||||||
if os.access(self.library_path, os.R_OK):
|
if os.access(self.library_path, os.R_OK):
|
||||||
from PyQt4.QtGui import QProgressDialog
|
|
||||||
pd = QProgressDialog('', '', 0, 100, self)
|
pd = QProgressDialog('', '', 0, 100, self)
|
||||||
pd.setWindowModality(Qt.ApplicationModal)
|
pd.setWindowModality(Qt.ApplicationModal)
|
||||||
pd.setCancelButton(None)
|
pd.setCancelButton(None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user