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
23a324c643
commit
89304c2e17
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence, QAbstractItemView,
|
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence, QAbstractItemView,
|
||||||
QApplication, QListView, QPoint, QModelIndex,
|
QApplication, QListView, QPoint, QModelIndex, QEvent,
|
||||||
QStyleOptionComboBox, QStyle, QComboBox, QTimer)
|
QStyleOptionComboBox, QStyle, QComboBox, QTimer)
|
||||||
try:
|
try:
|
||||||
from PyQt5 import sip
|
from PyQt5 import sip
|
||||||
@ -184,7 +184,7 @@ class Completer(QListView): # {{{
|
|||||||
def debug_event(self, ev):
|
def debug_event(self, ev):
|
||||||
from calibre.gui2 import event_type_name
|
from calibre.gui2 import event_type_name
|
||||||
print('Event:', event_type_name(ev))
|
print('Event:', event_type_name(ev))
|
||||||
if ev.type() in (ev.KeyPress, ev.ShortcutOverride, ev.KeyRelease):
|
if ev.type() in (QEvent.Type.KeyPress, QEvent.Type.ShortcutOverride, QEvent.Type.KeyRelease):
|
||||||
print('\tkey:', QKeySequence(ev.key()).toString())
|
print('\tkey:', QKeySequence(ev.key()).toString())
|
||||||
|
|
||||||
def mouseMoveEvent(self, ev):
|
def mouseMoveEvent(self, ev):
|
||||||
@ -206,7 +206,7 @@ class Completer(QListView): # {{{
|
|||||||
|
|
||||||
# self.debug_event(e)
|
# self.debug_event(e)
|
||||||
|
|
||||||
if etype == e.KeyPress:
|
if etype == QEvent.Type.KeyPress:
|
||||||
try:
|
try:
|
||||||
key = e.key()
|
key = e.key()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@ -253,13 +253,14 @@ class Completer(QListView): # {{{
|
|||||||
self.hide()
|
self.hide()
|
||||||
if e.isAccepted():
|
if e.isAccepted():
|
||||||
return True
|
return True
|
||||||
elif ismacos and etype == e.InputMethodQuery and e.queries() == (Qt.InputMethodQuery.ImHints | Qt.InputMethodQuery.ImEnabled) and self.isVisible():
|
elif ismacos and etype == QEvent.Type.InputMethodQuery and e.queries() == (
|
||||||
|
Qt.InputMethodQuery.ImHints | Qt.InputMethodQuery.ImEnabled) and self.isVisible():
|
||||||
# In Qt 5 the Esc key causes this event and the line edit does not
|
# In Qt 5 the Esc key causes this event and the line edit does not
|
||||||
# handle it, which causes the parent dialog to be closed
|
# handle it, which causes the parent dialog to be closed
|
||||||
# See https://bugreports.qt-project.org/browse/QTBUG-41806
|
# See https://bugreports.qt-project.org/browse/QTBUG-41806
|
||||||
e.accept()
|
e.accept()
|
||||||
return True
|
return True
|
||||||
elif etype == e.MouseButtonPress and hasattr(e, 'globalPos') and not self.rect().contains(self.mapFromGlobal(e.globalPos())):
|
elif etype == QEvent.Type.MouseButtonPress and hasattr(e, 'globalPos') and not self.rect().contains(self.mapFromGlobal(e.globalPos())):
|
||||||
# A click outside the popup, close it
|
# A click outside the popup, close it
|
||||||
if isinstance(widget, QComboBox):
|
if isinstance(widget, QComboBox):
|
||||||
# This workaround is needed to ensure clicking on the drop down
|
# This workaround is needed to ensure clicking on the drop down
|
||||||
@ -274,7 +275,7 @@ class Completer(QListView): # {{{
|
|||||||
self.hide()
|
self.hide()
|
||||||
e.accept()
|
e.accept()
|
||||||
return True
|
return True
|
||||||
elif etype in (e.InputMethod, e.ShortcutOverride):
|
elif etype in (QEvent.Type.InputMethod, QEvent.Type.ShortcutOverride):
|
||||||
QApplication.sendEvent(widget, e)
|
QApplication.sendEvent(widget, e)
|
||||||
return False
|
return False
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -12,7 +12,7 @@ from functools import partial
|
|||||||
from PyQt5.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex,
|
from PyQt5.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex,
|
||||||
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame,
|
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame,
|
||||||
QApplication, QSize, QRectF, QWidget, QTreeView, QHBoxLayout, QVBoxLayout,
|
QApplication, QSize, QRectF, QWidget, QTreeView, QHBoxLayout, QVBoxLayout,
|
||||||
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon)
|
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon, QEvent)
|
||||||
try:
|
try:
|
||||||
from PyQt5 import sip
|
from PyQt5 import sip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -490,10 +490,10 @@ class Editor(QFrame): # {{{
|
|||||||
def eventFilter(self, obj, event):
|
def eventFilter(self, obj, event):
|
||||||
if self.capture and obj in (self.button1, self.button2):
|
if self.capture and obj in (self.button1, self.button2):
|
||||||
t = event.type()
|
t = event.type()
|
||||||
if t == event.ShortcutOverride:
|
if t == QEvent.Type.ShortcutOverride:
|
||||||
event.accept()
|
event.accept()
|
||||||
return True
|
return True
|
||||||
if t == event.KeyPress:
|
if t == QEvent.Type.KeyPress:
|
||||||
self.key_press_event(event, 1 if obj is self.button1 else 2)
|
self.key_press_event(event, 1 if obj is self.button1 else 2)
|
||||||
return True
|
return True
|
||||||
return QFrame.eventFilter(self, obj, event)
|
return QFrame.eventFilter(self, obj, event)
|
||||||
|
@ -1146,7 +1146,7 @@ class GridView(QListView):
|
|||||||
return index
|
return index
|
||||||
|
|
||||||
def selectionCommand(self, index, event):
|
def selectionCommand(self, index, event):
|
||||||
if event and event.type() == event.KeyPress and event.key() in (Qt.Key.Key_Home, Qt.Key.Key_End) and event.modifiers() & Qt.Modifier.CTRL:
|
if event and event.type() == QEvent.Type.KeyPress and event.key() in (Qt.Key.Key_Home, Qt.Key.Key_End) and event.modifiers() & Qt.Modifier.CTRL:
|
||||||
return QItemSelectionModel.SelectionFlag.ClearAndSelect | QItemSelectionModel.SelectionFlag.Rows
|
return QItemSelectionModel.SelectionFlag.ClearAndSelect | QItemSelectionModel.SelectionFlag.Rows
|
||||||
return super(GridView, self).selectionCommand(index, event)
|
return super(GridView, self).selectionCommand(index, event)
|
||||||
|
|
||||||
|
@ -1184,7 +1184,7 @@ class BooksView(QTableView): # {{{
|
|||||||
return index
|
return index
|
||||||
|
|
||||||
def selectionCommand(self, index, event):
|
def selectionCommand(self, index, event):
|
||||||
if event and event.type() == event.KeyPress and event.key() in (Qt.Key.Key_Home, Qt.Key.Key_End) and event.modifiers() & Qt.Modifier.CTRL:
|
if event and event.type() == QEvent.Type.KeyPress and event.key() in (Qt.Key.Key_Home, Qt.Key.Key_End) and event.modifiers() & Qt.Modifier.CTRL:
|
||||||
return QItemSelectionModel.SelectionFlag.ClearAndSelect | QItemSelectionModel.SelectionFlag.Rows
|
return QItemSelectionModel.SelectionFlag.ClearAndSelect | QItemSelectionModel.SelectionFlag.Rows
|
||||||
return super(BooksView, self).selectionCommand(index, event)
|
return super(BooksView, self).selectionCommand(index, event)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from functools import partial
|
|||||||
|
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QComboBox, Qt, QLineEdit, pyqtSlot, QDialog,
|
QComboBox, Qt, QLineEdit, pyqtSlot, QDialog, QEvent,
|
||||||
pyqtSignal, QCompleter, QAction, QKeySequence, QTimer,
|
pyqtSignal, QCompleter, QAction, QKeySequence, QTimer,
|
||||||
QIcon, QMenu, QApplication, QKeyEvent)
|
QIcon, QMenu, QApplication, QKeyEvent)
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class SearchLineEdit(QLineEdit): # {{{
|
|||||||
|
|
||||||
def paste_and_search(self):
|
def paste_and_search(self):
|
||||||
self.paste()
|
self.paste()
|
||||||
ev = QKeyEvent(QKeyEvent.KeyPress, Qt.Key.Key_Enter, Qt.KeyboardModifier.NoModifier)
|
ev = QKeyEvent(QEvent.Type.KeyPress, Qt.Key.Key_Enter, Qt.KeyboardModifier.NoModifier)
|
||||||
self.keyPressEvent(ev)
|
self.keyPressEvent(ev)
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
@ -11,7 +11,7 @@ from functools import partial
|
|||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QAbstractListModel, Qt, QKeySequence, QListView, QVBoxLayout, QLabel,
|
QAbstractListModel, Qt, QKeySequence, QListView, QVBoxLayout, QLabel,
|
||||||
QHBoxLayout, QWidget, QApplication, QStyledItemDelegate, QStyle, QIcon,
|
QHBoxLayout, QWidget, QApplication, QStyledItemDelegate, QStyle, QIcon,
|
||||||
QTextDocument, QRectF, QFrame, QSize, QFont, QKeyEvent, QRadioButton, QPushButton, QToolButton
|
QTextDocument, QRectF, QFrame, QSize, QFont, QKeyEvent, QRadioButton, QPushButton, QToolButton, QEvent
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
@ -72,10 +72,10 @@ class Customize(QFrame):
|
|||||||
if self.capture == 0 or obj not in (self.button1, self.button2):
|
if self.capture == 0 or obj not in (self.button1, self.button2):
|
||||||
return QFrame.eventFilter(self, obj, event)
|
return QFrame.eventFilter(self, obj, event)
|
||||||
t = event.type()
|
t = event.type()
|
||||||
if t == event.ShortcutOverride:
|
if t == QEvent.Type.ShortcutOverride:
|
||||||
event.accept()
|
event.accept()
|
||||||
return True
|
return True
|
||||||
if t == event.KeyPress:
|
if t == QEvent.Type.KeyPress:
|
||||||
self.key_press_event(event, 1 if obj is self.button1 else 2)
|
self.key_press_event(event, 1 if obj is self.button1 else 2)
|
||||||
return True
|
return True
|
||||||
return QFrame.eventFilter(self, obj, event)
|
return QFrame.eventFilter(self, obj, event)
|
||||||
|
@ -9,7 +9,7 @@ import textwrap
|
|||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QIcon, QDialog,
|
QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QIcon, QDialog,
|
||||||
QSize, QComboBox, QLineEdit, QListWidgetItem, QStyledItemDelegate, QAbstractItemView,
|
QSize, QComboBox, QLineEdit, QListWidgetItem, QStyledItemDelegate, QAbstractItemView,
|
||||||
QStaticText, Qt, QStyle, QToolButton, QInputDialog, QMenu, pyqtSignal
|
QStaticText, Qt, QStyle, QToolButton, QInputDialog, QMenu, pyqtSignal, QPalette
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.ebooks.metadata.tag_mapper import map_tags, compile_pat
|
from calibre.ebooks.metadata.tag_mapper import map_tags, compile_pat
|
||||||
@ -256,7 +256,7 @@ class Delegate(QStyledItemDelegate):
|
|||||||
def paint(self, painter, option, index):
|
def paint(self, painter, option, index):
|
||||||
QStyledItemDelegate.paint(self, painter, option, index)
|
QStyledItemDelegate.paint(self, painter, option, index)
|
||||||
pal = option.palette
|
pal = option.palette
|
||||||
color = pal.color(pal.HighlightedText if option.state & QStyle.StateFlag.State_Selected else pal.Text).name()
|
color = pal.color(QPalette.ColorRole.HighlightedText if option.state & QStyle.StateFlag.State_Selected else QPalette.ColorRole.Text).name()
|
||||||
text = '<div style="color:%s">%s</div>' % (color, index.data(RENDER_ROLE))
|
text = '<div style="color:%s">%s</div>' % (color, index.data(RENDER_ROLE))
|
||||||
st = QStaticText(text)
|
st = QStaticText(text)
|
||||||
st.setTextWidth(option.rect.width())
|
st.setTextWidth(option.rect.width())
|
||||||
|
@ -9,7 +9,7 @@ import textwrap
|
|||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QWidget, Qt, QStaticText, QTextOption, QSize, QPainter, QTimer, QPalette)
|
QWidget, Qt, QStaticText, QTextOption, QSize, QPainter, QTimer, QPalette, QEvent)
|
||||||
|
|
||||||
from calibre import prints, prepare_string_for_xml
|
from calibre import prints, prepare_string_for_xml
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
@ -109,9 +109,9 @@ class ChoosePopupWidget(QWidget):
|
|||||||
painter = QPainter(self)
|
painter = QPainter(self)
|
||||||
painter.setClipRect(ev.rect())
|
painter.setClipRect(ev.rect())
|
||||||
pal = self.palette()
|
pal = self.palette()
|
||||||
painter.fillRect(self.rect(), pal.color(pal.Text))
|
painter.fillRect(self.rect(), pal.color(QPalette.ColorRole.Text))
|
||||||
crect = self.rect().adjusted(1, 1, -1, -1)
|
crect = self.rect().adjusted(1, 1, -1, -1)
|
||||||
painter.fillRect(crect, pal.color(pal.Base))
|
painter.fillRect(crect, pal.color(QPalette.ColorRole.Base))
|
||||||
painter.setClipRect(crect)
|
painter.setClipRect(crect)
|
||||||
painter.setFont(self.parent().font())
|
painter.setFont(self.parent().font())
|
||||||
width = self.rect().width()
|
width = self.rect().width()
|
||||||
@ -195,7 +195,7 @@ class ChoosePopupWidget(QWidget):
|
|||||||
def eventFilter(self, obj, ev):
|
def eventFilter(self, obj, ev):
|
||||||
if obj is self.parent() and self.isVisible():
|
if obj is self.parent() and self.isVisible():
|
||||||
etype = ev.type()
|
etype = ev.type()
|
||||||
if etype == ev.KeyPress:
|
if etype == QEvent.Type.KeyPress:
|
||||||
ret = self.handle_keypress(ev)
|
ret = self.handle_keypress(ev)
|
||||||
if ret:
|
if ret:
|
||||||
ev.accept()
|
ev.accept()
|
||||||
|
@ -122,20 +122,20 @@ class TextBrowser(PlainTextEdit): # {{{
|
|||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
theme = get_theme(tprefs['editor_theme'])
|
theme = get_theme(tprefs['editor_theme'])
|
||||||
pal = self.palette()
|
pal = self.palette()
|
||||||
pal.setColor(pal.Base, theme_color(theme, 'Normal', 'bg'))
|
pal.setColor(QPalette.ColorRole.Base, theme_color(theme, 'Normal', 'bg'))
|
||||||
pal.setColor(pal.AlternateBase, theme_color(theme, 'CursorLine', 'bg'))
|
pal.setColor(QPalette.ColorRole.AlternateBase, theme_color(theme, 'CursorLine', 'bg'))
|
||||||
pal.setColor(pal.Text, theme_color(theme, 'Normal', 'fg'))
|
pal.setColor(QPalette.ColorRole.Text, theme_color(theme, 'Normal', 'fg'))
|
||||||
pal.setColor(pal.Highlight, theme_color(theme, 'Visual', 'bg'))
|
pal.setColor(QPalette.ColorRole.Highlight, theme_color(theme, 'Visual', 'bg'))
|
||||||
pal.setColor(pal.HighlightedText, theme_color(theme, 'Visual', 'fg'))
|
pal.setColor(QPalette.ColorRole.HighlightedText, theme_color(theme, 'Visual', 'fg'))
|
||||||
self.setPalette(pal)
|
self.setPalette(pal)
|
||||||
self.viewport().setCursor(Qt.CursorShape.ArrowCursor)
|
self.viewport().setCursor(Qt.CursorShape.ArrowCursor)
|
||||||
self.line_number_area = LineNumbers(self)
|
self.line_number_area = LineNumbers(self)
|
||||||
self.blockCountChanged[int].connect(self.update_line_number_area_width)
|
self.blockCountChanged[int].connect(self.update_line_number_area_width)
|
||||||
self.updateRequest.connect(self.update_line_number_area)
|
self.updateRequest.connect(self.update_line_number_area)
|
||||||
self.line_number_palette = pal = QPalette()
|
self.line_number_palette = pal = QPalette()
|
||||||
pal.setColor(pal.Base, theme_color(theme, 'LineNr', 'bg'))
|
pal.setColor(QPalette.ColorRole.Base, theme_color(theme, 'LineNr', 'bg'))
|
||||||
pal.setColor(pal.Text, theme_color(theme, 'LineNr', 'fg'))
|
pal.setColor(QPalette.ColorRole.Text, theme_color(theme, 'LineNr', 'fg'))
|
||||||
pal.setColor(pal.BrightText, theme_color(theme, 'LineNrC', 'fg'))
|
pal.setColor(QPalette.ColorRole.BrightText, theme_color(theme, 'LineNrC', 'fg'))
|
||||||
self.line_number_map = LineNumberMap()
|
self.line_number_map = LineNumberMap()
|
||||||
self.search_header_pos = 0
|
self.search_header_pos = 0
|
||||||
self.changes, self.headers, self.images = [], [], OrderedDict()
|
self.changes, self.headers, self.images = [], [], OrderedDict()
|
||||||
|
@ -235,19 +235,19 @@ class TextEdit(PlainTextEdit):
|
|||||||
def apply_theme(self, theme):
|
def apply_theme(self, theme):
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
pal = self.palette()
|
pal = self.palette()
|
||||||
pal.setColor(pal.Base, theme_color(theme, 'Normal', 'bg'))
|
pal.setColor(QPalette.ColorRole.Base, theme_color(theme, 'Normal', 'bg'))
|
||||||
pal.setColor(pal.AlternateBase, theme_color(theme, 'CursorLine', 'bg'))
|
pal.setColor(QPalette.ColorRole.AlternateBase, theme_color(theme, 'CursorLine', 'bg'))
|
||||||
pal.setColor(pal.Text, theme_color(theme, 'Normal', 'fg'))
|
pal.setColor(QPalette.ColorRole.Text, theme_color(theme, 'Normal', 'fg'))
|
||||||
pal.setColor(pal.Highlight, theme_color(theme, 'Visual', 'bg'))
|
pal.setColor(pal.Highlight, theme_color(theme, 'Visual', 'bg'))
|
||||||
pal.setColor(pal.HighlightedText, theme_color(theme, 'Visual', 'fg'))
|
pal.setColor(pal.HighlightedText, theme_color(theme, 'Visual', 'fg'))
|
||||||
self.setPalette(pal)
|
self.setPalette(pal)
|
||||||
self.tooltip_palette = pal = QPalette()
|
self.tooltip_palette = pal = QPalette()
|
||||||
pal.setColor(pal.ToolTipBase, theme_color(theme, 'Tooltip', 'bg'))
|
pal.setColor(QPalette.ColorRole.ToolTipBase, theme_color(theme, 'Tooltip', 'bg'))
|
||||||
pal.setColor(pal.ToolTipText, theme_color(theme, 'Tooltip', 'fg'))
|
pal.setColor(QPalette.ColorRole.ToolTipText, theme_color(theme, 'Tooltip', 'fg'))
|
||||||
self.line_number_palette = pal = QPalette()
|
self.line_number_palette = pal = QPalette()
|
||||||
pal.setColor(pal.Base, theme_color(theme, 'LineNr', 'bg'))
|
pal.setColor(QPalette.ColorRole.Base, theme_color(theme, 'LineNr', 'bg'))
|
||||||
pal.setColor(pal.Text, theme_color(theme, 'LineNr', 'fg'))
|
pal.setColor(QPalette.ColorRole.Text, theme_color(theme, 'LineNr', 'fg'))
|
||||||
pal.setColor(pal.BrightText, theme_color(theme, 'LineNrC', 'fg'))
|
pal.setColor(QPalette.ColorRole.BrightText, theme_color(theme, 'LineNrC', 'fg'))
|
||||||
self.match_paren_format = theme_format(theme, 'MatchParen')
|
self.match_paren_format = theme_format(theme, 'MatchParen')
|
||||||
font = self.font()
|
font = self.font()
|
||||||
ff = tprefs['editor_font_family']
|
ff = tprefs['editor_font_family']
|
||||||
|
@ -14,7 +14,7 @@ from PyQt5.Qt import (
|
|||||||
QGridLayout, QHBoxLayout, QIcon, QItemSelection, QKeySequence, QLabel, QLineEdit,
|
QGridLayout, QHBoxLayout, QIcon, QItemSelection, QKeySequence, QLabel, QLineEdit,
|
||||||
QListView, QMenu, QMimeData, QModelIndex, QPushButton, QScrollArea, QSize,
|
QListView, QMenu, QMimeData, QModelIndex, QPushButton, QScrollArea, QSize,
|
||||||
QSizePolicy, QStackedLayout, QStyledItemDelegate, Qt, QTimer, QToolBar, QDialog,
|
QSizePolicy, QStackedLayout, QStyledItemDelegate, Qt, QTimer, QToolBar, QDialog,
|
||||||
QToolButton, QVBoxLayout, QWidget, pyqtSignal, QAbstractItemView
|
QToolButton, QVBoxLayout, QWidget, pyqtSignal, QAbstractItemView, QEvent
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre import prepare_string_for_xml
|
from calibre import prepare_string_for_xml
|
||||||
@ -104,7 +104,7 @@ class HistoryBox(HistoryComboBox):
|
|||||||
self.set_uniform_item_sizes(False)
|
self.set_uniform_item_sizes(False)
|
||||||
|
|
||||||
def event(self, ev):
|
def event(self, ev):
|
||||||
if ev.type() in (ev.ShortcutOverride, ev.KeyPress) and ev.key() == KEY and ev.modifiers() & MODIFIER:
|
if ev.type() in (QEvent.Type.ShortcutOverride, QEvent.Type.KeyPress) and ev.key() == KEY and ev.modifiers() & MODIFIER:
|
||||||
if not self.ignore_snip_expansion:
|
if not self.ignore_snip_expansion:
|
||||||
self.ignore_snip_expansion = True
|
self.ignore_snip_expansion = True
|
||||||
expand_template(self.lineEdit())
|
expand_template(self.lineEdit())
|
||||||
|
@ -8,7 +8,7 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
from itertools import count
|
from itertools import count
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QT_VERSION, QApplication, QBuffer, QByteArray, QFontDatabase, QFontInfo,
|
QT_VERSION, QApplication, QBuffer, QByteArray, QFontDatabase, QFontInfo, QPalette,
|
||||||
QHBoxLayout, QMimeData, QSize, Qt, QTimer, QUrl, QWidget, pyqtSignal, QIODevice
|
QHBoxLayout, QMimeData, QSize, Qt, QTimer, QUrl, QWidget, pyqtSignal, QIODevice
|
||||||
)
|
)
|
||||||
from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler
|
from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler
|
||||||
@ -422,8 +422,8 @@ def system_colors():
|
|||||||
is_dark_theme = app.is_dark_theme
|
is_dark_theme = app.is_dark_theme
|
||||||
pal = app.palette()
|
pal = app.palette()
|
||||||
ans = {
|
ans = {
|
||||||
'background': pal.color(pal.Base).name(),
|
'background': pal.color(QPalette.ColorRole.Base).name(),
|
||||||
'foreground': pal.color(pal.Text).name(),
|
'foreground': pal.color(QPalette.ColorRole.Text).name(),
|
||||||
}
|
}
|
||||||
if is_dark_theme:
|
if is_dark_theme:
|
||||||
# only override link colors for dark themes
|
# only override link colors for dark themes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user