mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
d64ba2eb20
@ -4,7 +4,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from qt.core import (
|
||||
Qt, QDialog, QIcon, QListWidgetItem)
|
||||
Qt, QApplication, QDialog, QIcon, QListWidgetItem)
|
||||
|
||||
from calibre.gui2.dialogs.tag_categories_ui import Ui_TagCategories
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
@ -103,6 +103,7 @@ class TagCategories(QDialog, Ui_TagCategories):
|
||||
self.category_filter_box.addItem(v)
|
||||
self.current_cat_name = None
|
||||
|
||||
self.copy_category_name_to_clipboard.clicked.connect(self.copy_category_name_to_clipboard_clicked)
|
||||
self.apply_button.clicked.connect(self.apply_button_clicked)
|
||||
self.unapply_button.clicked.connect(self.unapply_button_clicked)
|
||||
self.add_category_button.clicked.connect(self.add_category)
|
||||
@ -128,6 +129,10 @@ class TagCategories(QDialog, Ui_TagCategories):
|
||||
self.category_box.setCurrentIndex(0)
|
||||
self.select_category(0)
|
||||
|
||||
def copy_category_name_to_clipboard_clicked(self):
|
||||
t = self.category_box.itemText(self.category_box.currentIndex())
|
||||
QApplication.clipboard().setText(t)
|
||||
|
||||
def initialize_category_lists(self, book_ids):
|
||||
self.db_categories = self.db.new_api.get_categories(book_ids=book_ids)
|
||||
self.all_items = []
|
||||
|
@ -21,7 +21,7 @@
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QGridLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@ -38,7 +38,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="category_box">
|
||||
<property name="toolTip">
|
||||
<string>Select a category to edit</string>
|
||||
<string>Copy category name to clipboard</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
@ -51,6 +51,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="copy_category_name_to_clipboard">
|
||||
<property name="toolTip">
|
||||
<string>Copy the category name to the clipboard</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/edit-copy.png</normaloff>:/images/edit-copy.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
|
@ -180,6 +180,7 @@ class TagsView(QTreeView): # {{{
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QTreeView.__init__(self, parent=None)
|
||||
self.possible_drag_start = None
|
||||
self.setProperty('frame_for_focus', True)
|
||||
self.setMouseTracking(True)
|
||||
self.alter_tb = None
|
||||
@ -384,7 +385,12 @@ class TagsView(QTreeView): # {{{
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
if event.buttons() & Qt.MouseButton.LeftButton:
|
||||
# Only remember a possible drag start if the item is drag enabled
|
||||
dex = self.indexAt(event.pos())
|
||||
if self._model.flags(dex) & Qt.ItemFlag.ItemIsDragEnabled:
|
||||
self.possible_drag_start = event.pos()
|
||||
else:
|
||||
self.possible_drag_start = None
|
||||
return QTreeView.mousePressEvent(self, event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
@ -399,7 +405,8 @@ class TagsView(QTreeView): # {{{
|
||||
QTreeView.mouseMoveEvent(self, event)
|
||||
return
|
||||
# don't start drag/drop until the mouse has moved a bit.
|
||||
if ((event.pos() - self.possible_drag_start).manhattanLength() <
|
||||
if (self.possible_drag_start is None or
|
||||
(event.pos() - self.possible_drag_start).manhattanLength() <
|
||||
QApplication.startDragDistance()):
|
||||
QTreeView.mouseMoveEvent(self, event)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user