mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More stupid PyQt enums
This commit is contained in:
parent
e2f9ef1e2b
commit
5e40d11834
@ -696,7 +696,7 @@ class ShortcutConfig(QWidget): # {{{
|
|||||||
self.view.setModel(self._model)
|
self.view.setModel(self._model)
|
||||||
|
|
||||||
def editor_opened(self, index):
|
def editor_opened(self, index):
|
||||||
self.view.scrollTo(index, self.view.EnsureVisible)
|
self.view.scrollTo(index, QAbstractItemView.ScrollHint.EnsureVisible)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_editing(self):
|
def is_editing(self):
|
||||||
@ -744,7 +744,7 @@ class ShortcutConfig(QWidget): # {{{
|
|||||||
idx = self.view.model().index_for_group(group_name)
|
idx = self.view.model().index_for_group(group_name)
|
||||||
if idx is not None:
|
if idx is not None:
|
||||||
self.view.expand(idx)
|
self.view.expand(idx)
|
||||||
self.view.scrollTo(idx, self.view.PositionAtTop)
|
self.view.scrollTo(idx, QAbstractItemView.ScrollHint.PositionAtTop)
|
||||||
self.view.selectionModel().select(idx, QItemSelectionModel.SelectionFlag.ClearAndSelect)
|
self.view.selectionModel().select(idx, QItemSelectionModel.SelectionFlag.ClearAndSelect)
|
||||||
self.view.setCurrentIndex(idx)
|
self.view.setCurrentIndex(idx)
|
||||||
self.view.setFocus(Qt.FocusReason.OtherFocusReason)
|
self.view.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
|
@ -1124,7 +1124,7 @@ class GridView(QListView):
|
|||||||
return
|
return
|
||||||
self.set_current_row(row)
|
self.set_current_row(row)
|
||||||
self.select_rows((row,))
|
self.select_rows((row,))
|
||||||
self.scrollTo(self.model().index(row, 0), self.PositionAtCenter)
|
self.scrollTo(self.model().index(row, 0), QAbstractItemView.ScrollHint.PositionAtCenter)
|
||||||
|
|
||||||
def marked_changed(self, old_marked, current_marked):
|
def marked_changed(self, old_marked, current_marked):
|
||||||
changed = old_marked | current_marked
|
changed = old_marked | current_marked
|
||||||
|
@ -1088,7 +1088,7 @@ class BooksView(QTableView): # {{{
|
|||||||
h = self.horizontalHeader()
|
h = self.horizontalHeader()
|
||||||
for i in range(h.count()):
|
for i in range(h.count()):
|
||||||
if not h.isSectionHidden(i) and h.sectionViewportPosition(i) >= 0:
|
if not h.isSectionHidden(i) and h.sectionViewportPosition(i) >= 0:
|
||||||
self.scrollTo(self.model().index(row, i), self.PositionAtCenter)
|
self.scrollTo(self.model().index(row, i), QAbstractItemView.ScrollHint.PositionAtCenter)
|
||||||
break
|
break
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -10,7 +10,7 @@ import textwrap, os
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from PyQt5.Qt import (Qt, QModelIndex, QAbstractItemModel, QIcon,
|
from PyQt5.Qt import (Qt, QModelIndex, QAbstractItemModel, QIcon,
|
||||||
QBrush, QDialog, QItemSelectionModel)
|
QBrush, QDialog, QItemSelectionModel, QAbstractItemView)
|
||||||
|
|
||||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||||
from calibre.gui2.preferences.plugins_ui import Ui_Form
|
from calibre.gui2.preferences.plugins_ui import Ui_Form
|
||||||
@ -263,7 +263,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.plugin_view.selectionModel().select(idx, QItemSelectionModel.SelectionFlag.ClearAndSelect)
|
self.plugin_view.selectionModel().select(idx, QItemSelectionModel.SelectionFlag.ClearAndSelect)
|
||||||
self.plugin_view.setCurrentIndex(idx)
|
self.plugin_view.setCurrentIndex(idx)
|
||||||
self.plugin_view.setFocus(Qt.FocusReason.OtherFocusReason)
|
self.plugin_view.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
self.plugin_view.scrollTo(idx, self.plugin_view.EnsureVisible)
|
self.plugin_view.scrollTo(idx, QAbstractItemView.ScrollHint.EnsureVisible)
|
||||||
|
|
||||||
def find_next(self, *args):
|
def find_next(self, *args):
|
||||||
idx = self.plugin_view.currentIndex()
|
idx = self.plugin_view.currentIndex()
|
||||||
|
@ -305,7 +305,7 @@ class ShortcutConfig(QWidget):
|
|||||||
type=Qt.ConnectionType.QueuedConnection)
|
type=Qt.ConnectionType.QueuedConnection)
|
||||||
|
|
||||||
def scrollTo(self, index):
|
def scrollTo(self, index):
|
||||||
self.view.scrollTo(index, self.view.EnsureVisible)
|
self.view.scrollTo(index, QAbstractItemView.ScrollHint.EnsureVisible)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_editing(self):
|
def is_editing(self):
|
||||||
|
@ -1113,7 +1113,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
self.blockSignals(False)
|
self.blockSignals(False)
|
||||||
|
|
||||||
def show_item_at_path(self, path, box=False,
|
def show_item_at_path(self, path, box=False,
|
||||||
position=QTreeView.PositionAtCenter):
|
position=QAbstractItemView.ScrollHint.PositionAtCenter):
|
||||||
'''
|
'''
|
||||||
Scroll the browser and open categories to show the item referenced by
|
Scroll the browser and open categories to show the item referenced by
|
||||||
path. If possible, the item is placed in the center. If box=True, a
|
path. If possible, the item is placed in the center. If box=True, a
|
||||||
@ -1133,7 +1133,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
self.expand(idx)
|
self.expand(idx)
|
||||||
|
|
||||||
def show_item_at_index(self, idx, box=False,
|
def show_item_at_index(self, idx, box=False,
|
||||||
position=QTreeView.PositionAtCenter):
|
position=QAbstractItemView.ScrollHint.PositionAtCenter):
|
||||||
if idx.isValid() and idx.data(Qt.ItemDataRole.UserRole) is not self._model.root_item:
|
if idx.isValid() and idx.data(Qt.ItemDataRole.UserRole) is not self._model.root_item:
|
||||||
self.expand_parent(idx)
|
self.expand_parent(idx)
|
||||||
self.setCurrentIndex(idx)
|
self.setCurrentIndex(idx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user