Multiple inheritance makes me nervous

This commit is contained in:
Kovid Goyal 2025-02-10 09:34:57 +05:30
parent 773a5206b3
commit 5da6c49d8f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 5 deletions

View File

@ -67,7 +67,7 @@ from calibre.gui2.library.delegates import (
TextDelegate,
)
from calibre.gui2.library.models import BooksModel, DeviceBooksModel
from calibre.gui2.pin_columns import CustomEditTabbingBehavior, PinTableView
from calibre.gui2.pin_columns import PinTableView, TableView
from calibre.gui2.preferences.create_custom_column import CreateNewCustomColumn
from calibre.utils.config import prefs, tweaks
from calibre.utils.icu import primary_sort_key
@ -356,7 +356,7 @@ class AdjustColumnSize(QDialog): # {{{
@setup_dnd_interface
class BooksView(QTableView, CustomEditTabbingBehavior): # {{{
class BooksView(TableView): # {{{
files_dropped = pyqtSignal(object)
books_dropped = pyqtSignal(object)

View File

@ -8,7 +8,7 @@ from calibre.gui2 import gprefs
from calibre.gui2.library import DEFAULT_SORT
class CustomEditTabbingBehavior:
class TableView(QTableView):
def closeEditor(self, editor, hint):
# We want to implement our own go to next/previous cell behavior
@ -18,7 +18,7 @@ class CustomEditTabbingBehavior:
delta = 1
elif hint is QAbstractItemDelegate.EndEditHint.EditPreviousItem:
delta = -1
QTableView.closeEditor(self, editor, QAbstractItemDelegate.EndEditHint.NoHint if delta else hint)
super().closeEditor(editor, QAbstractItemDelegate.EndEditHint.NoHint if delta else hint)
if not delta:
return
current = self.currentIndex()
@ -59,7 +59,7 @@ class CustomEditTabbingBehavior:
self.edit(idx)
class PinTableView(QTableView, CustomEditTabbingBehavior):
class PinTableView(TableView):
disable_save_state = False