mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
1) Merge from trunk
2) Remember the ID of a tag for renaming 3) check for duplicates, both existing and renamed tags
This commit is contained in:
commit
91dd1ca76a
@ -14,7 +14,7 @@ from PyQt4.Qt import QDialog, QListWidgetItem, QIcon, \
|
|||||||
from calibre.constants import iswindows, isosx
|
from calibre.constants import iswindows, isosx
|
||||||
from calibre.gui2.dialogs.config.config_ui import Ui_Dialog
|
from calibre.gui2.dialogs.config.config_ui import Ui_Dialog
|
||||||
from calibre.gui2.dialogs.config.create_custom_column import CreateCustomColumn
|
from calibre.gui2.dialogs.config.create_custom_column import CreateCustomColumn
|
||||||
from calibre.gui2 import choose_dir, error_dialog, config, \
|
from calibre.gui2 import choose_dir, error_dialog, config, gprefs, \
|
||||||
ALL_COLUMNS, NONE, info_dialog, choose_files, \
|
ALL_COLUMNS, NONE, info_dialog, choose_files, \
|
||||||
warning_dialog, ResizableDialog, question_dialog
|
warning_dialog, ResizableDialog, question_dialog
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs
|
||||||
@ -480,6 +480,8 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
|
|||||||
self.opt_enforce_cpu_limit.setChecked(config['enforce_cpu_limit'])
|
self.opt_enforce_cpu_limit.setChecked(config['enforce_cpu_limit'])
|
||||||
self.device_detection_button.clicked.connect(self.debug_device_detection)
|
self.device_detection_button.clicked.connect(self.debug_device_detection)
|
||||||
self.port.editingFinished.connect(self.check_port_value)
|
self.port.editingFinished.connect(self.check_port_value)
|
||||||
|
self.show_splash_screen.setChecked(gprefs.get('show_splash_screen',
|
||||||
|
True))
|
||||||
|
|
||||||
def check_port_value(self, *args):
|
def check_port_value(self, *args):
|
||||||
port = self.port.value()
|
port = self.port.value()
|
||||||
@ -852,6 +854,7 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
|
|||||||
config['get_social_metadata'] = self.opt_get_social_metadata.isChecked()
|
config['get_social_metadata'] = self.opt_get_social_metadata.isChecked()
|
||||||
config['overwrite_author_title_metadata'] = self.opt_overwrite_author_title_metadata.isChecked()
|
config['overwrite_author_title_metadata'] = self.opt_overwrite_author_title_metadata.isChecked()
|
||||||
config['enforce_cpu_limit'] = bool(self.opt_enforce_cpu_limit.isChecked())
|
config['enforce_cpu_limit'] = bool(self.opt_enforce_cpu_limit.isChecked())
|
||||||
|
gprefs['show_splash_screen'] = bool(self.show_splash_screen.isChecked())
|
||||||
fmts = []
|
fmts = []
|
||||||
for i in range(self.viewer.count()):
|
for i in range(self.viewer.count()):
|
||||||
if self.viewer.item(i).checkState() == Qt.Checked:
|
if self.viewer.item(i).checkState() == Qt.Checked:
|
||||||
|
@ -331,8 +331,8 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="roman_numerals">
|
<widget class="QCheckBox" name="roman_numerals">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use &Roman numerals for series number</string>
|
<string>Use &Roman numerals for series number</string>
|
||||||
@ -342,28 +342,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="systray_icon">
|
<widget class="QCheckBox" name="systray_icon">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable system &tray icon (needs restart)</string>
|
<string>Enable system &tray icon (needs restart)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<widget class="QCheckBox" name="systray_notifications">
|
<widget class="QCheckBox" name="systray_notifications">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show &notifications in system tray</string>
|
<string>Show &notifications in system tray</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="show_splash_screen">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show &splash screen at startup</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="separate_cover_flow">
|
<widget class="QCheckBox" name="separate_cover_flow">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show cover &browser in a separate window (needs restart)</string>
|
<string>Show cover &browser in a separate window (needs restart)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="search_as_you_type">
|
<widget class="QCheckBox" name="search_as_you_type">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Search as you type</string>
|
<string>Search as you type</string>
|
||||||
@ -373,21 +380,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="5" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="sync_news">
|
<widget class="QCheckBox" name="sync_news">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically send downloaded &news to ebook reader</string>
|
<string>Automatically send downloaded &news to ebook reader</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="delete_news">
|
<widget class="QCheckBox" name="delete_news">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Delete news from library when it is automatically sent to reader</string>
|
<string>&Delete news from library when it is automatically sent to reader</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="7" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
@ -404,7 +411,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Toolbar</string>
|
<string>Toolbar</string>
|
||||||
@ -452,7 +459,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="9" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
@ -527,12 +534,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="add_custcol_button">
|
<widget class="QToolButton" name="add_custcol_button">
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Add a user-defined column</string>
|
<string>Add a user-defined column</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../../../resources/images.qrc">
|
<iconset resource="../../../../../resources/images.qrc">
|
||||||
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
|
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Tag Editor</string>
|
<string>Saved Search Editor</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset>
|
||||||
@ -137,7 +137,11 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QPlainTextEdit" name="search_text"/>
|
<widget class="QPlainTextEdit" name="search_text">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Change the contents of the saved search</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Tag Editor</string>
|
<string>User Categories Editor</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset>
|
||||||
|
@ -9,7 +9,7 @@ from calibre.gui2 import question_dialog, error_dialog
|
|||||||
class TagListEditor(QDialog, Ui_TagListEditor):
|
class TagListEditor(QDialog, Ui_TagListEditor):
|
||||||
|
|
||||||
def tag_cmp(self, x, y):
|
def tag_cmp(self, x, y):
|
||||||
return cmp(x.text().lower(), y.text().lower())
|
return cmp(x.lower(), y.lower())
|
||||||
|
|
||||||
def __init__(self, window, db, tag_to_match):
|
def __init__(self, window, db, tag_to_match):
|
||||||
QDialog.__init__(self, window)
|
QDialog.__init__(self, window)
|
||||||
@ -19,10 +19,12 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
self.to_rename = {}
|
self.to_rename = {}
|
||||||
self.to_delete = []
|
self.to_delete = []
|
||||||
self.db = db
|
self.db = db
|
||||||
all_tags = db.get_tags_and_ids()
|
self.all_tags = {}
|
||||||
for tag in sorted(all_tags.keys()):
|
for k,v in db.get_tags_with_ids():
|
||||||
|
self.all_tags[v] = k
|
||||||
|
for tag in sorted(self.all_tags.keys(), cmp=self.tag_cmp):
|
||||||
item = QListWidgetItem(tag)
|
item = QListWidgetItem(tag)
|
||||||
item.setData(all_tags[tag])
|
item.setData(Qt.UserRole, self.all_tags[tag])
|
||||||
self.available_tags.addItem(item)
|
self.available_tags.addItem(item)
|
||||||
|
|
||||||
items = self.available_tags.findItems(tag_to_match, Qt.MatchExactly)
|
items = self.available_tags.findItems(tag_to_match, Qt.MatchExactly)
|
||||||
@ -35,8 +37,14 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
self.connect(self.available_tags, SIGNAL('itemChanged(QListWidgetItem *)'), self.finish_editing)
|
self.connect(self.available_tags, SIGNAL('itemChanged(QListWidgetItem *)'), self.finish_editing)
|
||||||
|
|
||||||
def finish_editing(self, item):
|
def finish_editing(self, item):
|
||||||
if item.text() != self.item_before_editing:
|
if item.text() != self.item_before_editing.text():
|
||||||
self.to_rename[self.item_before_editing] = item.text()
|
if item.text() in self.all_tags.keys() or item.text() in self.to_rename.keys():
|
||||||
|
error_dialog(self, 'Tag already used',
|
||||||
|
'The tag %s is already used.'%(item.text())).exec_()
|
||||||
|
item.setText(self.item_before_editing.text())
|
||||||
|
return
|
||||||
|
id,ign = self.item_before_editing.data(Qt.UserRole).toInt()
|
||||||
|
self.to_rename[item.text()] = id
|
||||||
|
|
||||||
def rename_tag(self):
|
def rename_tag(self):
|
||||||
item = self.available_tags.currentItem()
|
item = self.available_tags.currentItem()
|
||||||
@ -46,7 +54,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
if item is None:
|
if item is None:
|
||||||
error_dialog(self, 'No tag selected', 'You must select one tag from the list of Available tags.').exec_()
|
error_dialog(self, 'No tag selected', 'You must select one tag from the list of Available tags.').exec_()
|
||||||
return
|
return
|
||||||
self.item_before_editing = item.text()
|
self.item_before_editing = item.clone()
|
||||||
item.setFlags (item.flags() | Qt.ItemIsEditable);
|
item.setFlags (item.flags() | Qt.ItemIsEditable);
|
||||||
self.available_tags.editItem(item)
|
self.available_tags.editItem(item)
|
||||||
|
|
||||||
@ -73,8 +81,8 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
self.available_tags.takeItem(self.available_tags.row(item))
|
self.available_tags.takeItem(self.available_tags.row(item))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
for item in self.to_rename:
|
for text in self.to_rename:
|
||||||
self.db.rename_tag(old=unicode(item), new=unicode(self.to_rename[item]))
|
self.db.rename_tag(self.to_rename[text], unicode(text))
|
||||||
for item in self.to_delete:
|
for item in self.to_delete:
|
||||||
self.db.delete_tag(unicode(item.text()))
|
self.db.delete_tag(unicode(item.text()))
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
|
@ -63,6 +63,12 @@
|
|||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
|
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -77,6 +83,15 @@
|
|||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
|
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+S</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -5,13 +5,15 @@ import sys, os, time, socket, traceback
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from PyQt4.Qt import QCoreApplication, QIcon, QMessageBox, QObject, QTimer, \
|
from PyQt4.Qt import QCoreApplication, QIcon, QMessageBox, QObject, QTimer, \
|
||||||
QThread, pyqtSignal, Qt, QProgressDialog, QString
|
QThread, pyqtSignal, Qt, QProgressDialog, QString, QPixmap, \
|
||||||
|
QSplashScreen, QApplication
|
||||||
|
|
||||||
from calibre import prints, plugins
|
from calibre import prints, plugins
|
||||||
from calibre.constants import iswindows, __appname__, isosx, filesystem_encoding
|
from calibre.constants import iswindows, __appname__, isosx, DEBUG, \
|
||||||
|
filesystem_encoding
|
||||||
from calibre.utils.ipc import ADDRESS, RC
|
from calibre.utils.ipc import ADDRESS, RC
|
||||||
from calibre.gui2 import ORG_NAME, APP_UID, initialize_file_icon_provider, \
|
from calibre.gui2 import ORG_NAME, APP_UID, initialize_file_icon_provider, \
|
||||||
Application, choose_dir, error_dialog, question_dialog
|
Application, choose_dir, error_dialog, question_dialog, gprefs
|
||||||
from calibre.gui2.main_window import option_parser as _option_parser
|
from calibre.gui2.main_window import option_parser as _option_parser
|
||||||
from calibre.utils.config import prefs, dynamic
|
from calibre.utils.config import prefs, dynamic
|
||||||
from calibre.library.database2 import LibraryDatabase2
|
from calibre.library.database2 import LibraryDatabase2
|
||||||
@ -113,16 +115,25 @@ class GuiRunner(QObject):
|
|||||||
initialization'''
|
initialization'''
|
||||||
|
|
||||||
def __init__(self, opts, args, actions, listener, app):
|
def __init__(self, opts, args, actions, listener, app):
|
||||||
|
self.startup_time = time.time()
|
||||||
self.opts, self.args, self.listener, self.app = opts, args, listener, app
|
self.opts, self.args, self.listener, self.app = opts, args, listener, app
|
||||||
self.actions = actions
|
self.actions = actions
|
||||||
self.main = None
|
self.main = None
|
||||||
QObject.__init__(self)
|
QObject.__init__(self)
|
||||||
|
self.splash_screen = None
|
||||||
self.timer = QTimer.singleShot(1, self.initialize)
|
self.timer = QTimer.singleShot(1, self.initialize)
|
||||||
|
if DEBUG:
|
||||||
|
prints('Starting up...')
|
||||||
|
|
||||||
def start_gui(self):
|
def start_gui(self):
|
||||||
from calibre.gui2.ui import Main
|
from calibre.gui2.ui import Main
|
||||||
main = Main(self.opts)
|
main = Main(self.opts)
|
||||||
|
if self.splash_screen is not None:
|
||||||
|
self.splash_screen.showMessage(_('Initializing user interface...'))
|
||||||
|
self.splash_screen.finish(main)
|
||||||
main.initialize(self.library_path, self.db, self.listener, self.actions)
|
main.initialize(self.library_path, self.db, self.listener, self.actions)
|
||||||
|
if DEBUG:
|
||||||
|
prints('Started up in', time.time() - self.startup_time)
|
||||||
add_filesystem_book = partial(main.add_filesystem_book, allow_device=False)
|
add_filesystem_book = partial(main.add_filesystem_book, allow_device=False)
|
||||||
sys.excepthook = main.unhandled_exception
|
sys.excepthook = main.unhandled_exception
|
||||||
if len(self.args) > 1:
|
if len(self.args) > 1:
|
||||||
@ -143,7 +154,7 @@ class GuiRunner(QObject):
|
|||||||
|
|
||||||
if db is None and tb is not None:
|
if db is None and tb is not None:
|
||||||
# DB Repair failed
|
# DB Repair failed
|
||||||
error_dialog(None, _('Repairing failed'),
|
error_dialog(self.splash_screen, _('Repairing failed'),
|
||||||
_('The database repair failed. Starting with '
|
_('The database repair failed. Starting with '
|
||||||
'a new empty library.'),
|
'a new empty library.'),
|
||||||
det_msg=tb, show=True)
|
det_msg=tb, show=True)
|
||||||
@ -160,7 +171,7 @@ class GuiRunner(QObject):
|
|||||||
os.makedirs(x)
|
os.makedirs(x)
|
||||||
except:
|
except:
|
||||||
x = os.path.expanduser('~')
|
x = os.path.expanduser('~')
|
||||||
candidate = choose_dir(None, 'choose calibre library',
|
candidate = choose_dir(self.splash_screen, 'choose calibre library',
|
||||||
_('Choose a location for your new calibre e-book library'),
|
_('Choose a location for your new calibre e-book library'),
|
||||||
default_dir=x)
|
default_dir=x)
|
||||||
|
|
||||||
@ -171,7 +182,7 @@ class GuiRunner(QObject):
|
|||||||
self.library_path = candidate
|
self.library_path = candidate
|
||||||
db = LibraryDatabase2(candidate)
|
db = LibraryDatabase2(candidate)
|
||||||
except:
|
except:
|
||||||
error_dialog(None, _('Bad database location'),
|
error_dialog(self.splash_screen, _('Bad database location'),
|
||||||
_('Bad database location %r. calibre will now quit.'
|
_('Bad database location %r. calibre will now quit.'
|
||||||
)%self.library_path,
|
)%self.library_path,
|
||||||
det_msg=traceback.format_exc(), show=True)
|
det_msg=traceback.format_exc(), show=True)
|
||||||
@ -185,7 +196,7 @@ class GuiRunner(QObject):
|
|||||||
try:
|
try:
|
||||||
db = LibraryDatabase2(self.library_path)
|
db = LibraryDatabase2(self.library_path)
|
||||||
except (sqlite.Error, DatabaseException):
|
except (sqlite.Error, DatabaseException):
|
||||||
repair = question_dialog(None, _('Corrupted database'),
|
repair = question_dialog(self.splash_screen, _('Corrupted database'),
|
||||||
_('Your calibre database appears to be corrupted. Do '
|
_('Your calibre database appears to be corrupted. Do '
|
||||||
'you want calibre to try and repair it automatically? '
|
'you want calibre to try and repair it automatically? '
|
||||||
'If you say No, a new empty calibre library will be created.'),
|
'If you say No, a new empty calibre library will be created.'),
|
||||||
@ -204,14 +215,27 @@ class GuiRunner(QObject):
|
|||||||
self.repair.start()
|
self.repair.start()
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
error_dialog(None, _('Bad database location'),
|
error_dialog(self.splash_screen, _('Bad database location'),
|
||||||
_('Bad database location %r. Will start with '
|
_('Bad database location %r. Will start with '
|
||||||
' a new, empty calibre library')%self.library_path,
|
' a new, empty calibre library')%self.library_path,
|
||||||
det_msg=traceback.format_exc(), show=True)
|
det_msg=traceback.format_exc(), show=True)
|
||||||
|
|
||||||
self.initialize_db_stage2(db, None)
|
self.initialize_db_stage2(db, None)
|
||||||
|
|
||||||
|
def show_splash_screen(self):
|
||||||
|
self.splash_pixmap = QPixmap()
|
||||||
|
self.splash_pixmap.load(I('library.png'))
|
||||||
|
self.splash_screen = QSplashScreen(self.splash_pixmap,
|
||||||
|
Qt.SplashScreen|Qt.WindowStaysOnTopHint)
|
||||||
|
self.splash_screen.showMessage(_('Starting %s: Loading books...') %
|
||||||
|
__appname__)
|
||||||
|
self.splash_screen.show()
|
||||||
|
QApplication.instance().processEvents()
|
||||||
|
|
||||||
def initialize(self, *args):
|
def initialize(self, *args):
|
||||||
|
if gprefs.get('show_splash_screen', True):
|
||||||
|
self.show_splash_screen()
|
||||||
|
|
||||||
self.library_path = get_library_path()
|
self.library_path = get_library_path()
|
||||||
if self.library_path is None:
|
if self.library_path is None:
|
||||||
self.initialization_failed()
|
self.initialization_failed()
|
||||||
|
@ -985,17 +985,18 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
if notify:
|
if notify:
|
||||||
self.notify('metadata', [id])
|
self.notify('metadata', [id])
|
||||||
|
|
||||||
def get_tags_and_ids(self):
|
# Convenience method for tags_list_editor
|
||||||
|
def get_tags_with_ids(self):
|
||||||
result = self.conn.get('SELECT * FROM tags')
|
result = self.conn.get('SELECT * FROM tags')
|
||||||
if not result:
|
if not result:
|
||||||
return {}
|
return {}
|
||||||
r = {}
|
r = []
|
||||||
for k,v in result:
|
for k,v in result:
|
||||||
r[v] = k
|
r.append((k,v))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def rename_tag(self, old, new):
|
def rename_tag(self, id, new):
|
||||||
self.conn.execute('UPDATE tags SET name=? WHERE name=?', (new, old))
|
self.conn.execute('UPDATE tags SET name=? WHERE id=?', (new, id))
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
||||||
def get_tags(self, id):
|
def get_tags(self, id):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user