mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove header changes from model
This commit is contained in:
parent
74904c40af
commit
2e6f424e0a
@ -9,7 +9,7 @@ import functools, re, os, traceback, errno, time
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from PyQt4.Qt import (QAbstractTableModel, Qt, pyqtSignal, QIcon, QImage,
|
from PyQt4.Qt import (QAbstractTableModel, Qt, pyqtSignal, QIcon, QImage,
|
||||||
QModelIndex, QVariant, QDateTime, QColor, QPixmap, QFont)
|
QModelIndex, QVariant, QDateTime, QColor, QPixmap)
|
||||||
|
|
||||||
from calibre.gui2 import NONE, UNDEFINED_QDATETIME, error_dialog
|
from calibre.gui2 import NONE, UNDEFINED_QDATETIME, error_dialog
|
||||||
from calibre.utils.search_query_parser import ParseException
|
from calibre.utils.search_query_parser import ParseException
|
||||||
@ -164,12 +164,6 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
self.ids_to_highlight_set = set()
|
self.ids_to_highlight_set = set()
|
||||||
self.current_highlighted_idx = None
|
self.current_highlighted_idx = None
|
||||||
self.highlight_only = False
|
self.highlight_only = False
|
||||||
self.current_index_column = -1
|
|
||||||
self.current_index_row = -1
|
|
||||||
self.selected_header_font = QFont()
|
|
||||||
self.selected_header_font.setBold(True)
|
|
||||||
self.selected_header_font.setItalic(True)
|
|
||||||
|
|
||||||
self.read_config()
|
self.read_config()
|
||||||
|
|
||||||
def _clear_caches(self):
|
def _clear_caches(self):
|
||||||
@ -895,15 +889,6 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
# return QVariant(_("Double click to <b>edit</b> me<br><br>"))
|
# return QVariant(_("Double click to <b>edit</b> me<br><br>"))
|
||||||
return NONE
|
return NONE
|
||||||
|
|
||||||
def set_current_cell(self, idx):
|
|
||||||
if idx and idx.isValid():
|
|
||||||
# Copy these out here for performance, avoiding using idx in headerData
|
|
||||||
self.current_index_column = idx.column()
|
|
||||||
self.current_index_row = idx.row()
|
|
||||||
else:
|
|
||||||
self.current_index_column = -1
|
|
||||||
self.current_index_row = -1
|
|
||||||
|
|
||||||
def headerData(self, section, orientation, role):
|
def headerData(self, section, orientation, role):
|
||||||
if orientation == Qt.Horizontal:
|
if orientation == Qt.Horizontal:
|
||||||
if section >= len(self.column_map): # same problem as in data, the column_map can be wrong
|
if section >= len(self.column_map): # same problem as in data, the column_map can be wrong
|
||||||
@ -915,8 +900,6 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
return QVariant(_('The lookup/search name is "{0}"').format(ht))
|
return QVariant(_('The lookup/search name is "{0}"').format(ht))
|
||||||
if role == Qt.DisplayRole:
|
if role == Qt.DisplayRole:
|
||||||
return QVariant(self.headers[self.column_map[section]])
|
return QVariant(self.headers[self.column_map[section]])
|
||||||
if role == Qt.FontRole and self.current_index_column == section:
|
|
||||||
return QVariant(self.selected_header_font)
|
|
||||||
return NONE
|
return NONE
|
||||||
if DEBUG and role == Qt.ToolTipRole and orientation == Qt.Vertical:
|
if DEBUG and role == Qt.ToolTipRole and orientation == Qt.Vertical:
|
||||||
col = self.db.field_metadata['uuid']['rec_index']
|
col = self.db.field_metadata['uuid']['rec_index']
|
||||||
@ -924,8 +907,6 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
|
|
||||||
if role == Qt.DisplayRole: # orientation is vertical
|
if role == Qt.DisplayRole: # orientation is vertical
|
||||||
return QVariant(section+1)
|
return QVariant(section+1)
|
||||||
if role == Qt.FontRole and self.current_index_row == section:
|
|
||||||
return QVariant(self.selected_header_font)
|
|
||||||
return NONE
|
return NONE
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user