mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-20 08:36:15 +01:00
pyqt6: More random fixes
This commit is contained in:
parent
d06622615a
commit
334216663e
8 changed files with 12 additions and 12 deletions
|
|
@ -556,7 +556,7 @@ def getter(self):
|
|||
|
||||
def edit(self):
|
||||
ctrl_or_shift_pressed = (QApplication.keyboardModifiers() &
|
||||
(Qt.KeyboardModifier.ControlModifier + Qt.KeyboardModifier.ShiftModifier))
|
||||
(Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.ShiftModifier))
|
||||
if (self.getter() != self.initial_val and (self.getter() or self.initial_val)):
|
||||
d = _save_dialog(self.parent, _('Values changed'),
|
||||
_('You have changed the values. In order to use this '
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ user categories, and other information from the old to the new library</string>
|
|||
<item row="2" column="1" colspan="2">
|
||||
<widget class="HistoryLineEdit" name="location">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
<enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>40</number>
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ def show_context_menu(self, point):
|
|||
|
||||
def set_word_wrap(self, to_what):
|
||||
gprefs['gpm_template_editor_word_wrap_mode'] = to_what
|
||||
self.textbox.setWordWrapMode(QTextOption.WordWrap if to_what else QTextOption.NoWrap)
|
||||
self.textbox.setWordWrapMode(QTextOption.WrapMode.WordWrap if to_what else QTextOption.WrapMode.NoWrap)
|
||||
|
||||
def load_last_template_text(self):
|
||||
from calibre.customize.ui import find_plugin
|
||||
|
|
@ -560,7 +560,7 @@ def set_editor_font(self):
|
|||
|
||||
def set_up_font_boxes(self):
|
||||
font = self.get_current_font()
|
||||
self.font_box.setWritingSystem(QFontDatabase.Latin)
|
||||
self.font_box.setWritingSystem(QFontDatabase.WritingSystem.Latin)
|
||||
self.font_box.setCurrentFont(font)
|
||||
self.font_box.setEditable(False)
|
||||
gprefs['gpm_template_editor_font'] = str(font.family())
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ def keyPressEvent(self, ev):
|
|||
|
||||
|
||||
def check_key_modifier(which_modifier):
|
||||
v = int(QApplication.keyboardModifiers() & (Qt.KeyboardModifier.ControlModifier + Qt.KeyboardModifier.ShiftModifier))
|
||||
v = QApplication.keyboardModifiers() & (Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.ShiftModifier)
|
||||
return v == which_modifier
|
||||
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ def createEditor(self, parent, option, index):
|
|||
def setEditorData(self, editor, index):
|
||||
if check_key_modifier(Qt.KeyboardModifier.ControlModifier):
|
||||
val = UNDEFINED_QDATETIME
|
||||
elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier + Qt.KeyboardModifier.ControlModifier):
|
||||
elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier):
|
||||
val = now()
|
||||
else:
|
||||
val = index.data(Qt.ItemDataRole.EditRole)
|
||||
|
|
@ -273,7 +273,7 @@ def setEditorData(self, editor, index):
|
|||
val = index.data(Qt.ItemDataRole.EditRole)
|
||||
if check_key_modifier(Qt.KeyboardModifier.ControlModifier):
|
||||
val = UNDEFINED_QDATETIME
|
||||
elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier + Qt.KeyboardModifier.ControlModifier):
|
||||
elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier):
|
||||
val = now()
|
||||
elif is_date_undefined(val):
|
||||
val = QDate.currentDate()
|
||||
|
|
@ -439,7 +439,7 @@ def createEditor(self, parent, option, index):
|
|||
def setEditorData(self, editor, index):
|
||||
if check_key_modifier(Qt.KeyboardModifier.ControlModifier):
|
||||
val = UNDEFINED_QDATETIME
|
||||
elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier + Qt.KeyboardModifier.ControlModifier):
|
||||
elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier):
|
||||
val = now()
|
||||
else:
|
||||
val = index.data(Qt.ItemDataRole.EditRole)
|
||||
|
|
|
|||
|
|
@ -1434,7 +1434,7 @@ def changed(self):
|
|||
|
||||
def edit(self, db, id_):
|
||||
ctrl_or_shift_pressed = (QApplication.keyboardModifiers() &
|
||||
(Qt.KeyboardModifier.ControlModifier + Qt.KeyboardModifier.ShiftModifier))
|
||||
(Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.ShiftModifier))
|
||||
if self.changed:
|
||||
d = save_dialog(self, _('Tags changed'),
|
||||
_('You have changed the tags. In order to use the tags'
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ def setupUi(self, x):
|
|||
|
||||
self.search = sb = SearchBox2(self)
|
||||
sb.sizePolicy().setHorizontalStretch(10)
|
||||
sb.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLength)
|
||||
sb.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
|
||||
sb.setMinimumContentsLength(10)
|
||||
g.setColumnStretch(0, 100)
|
||||
g.addWidget(self.search, 0, 0, 1, 1)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ def __init__(
|
|||
self.selected_files = []
|
||||
use_native_dialog = 'CALIBRE_NO_NATIVE_FILEDIALOGS' not in os.environ
|
||||
with sanitize_env_vars():
|
||||
opts = QFileDialog.Option()
|
||||
opts = QFileDialog.Option(0)
|
||||
if not use_native_dialog:
|
||||
opts |= QFileDialog.Option.DontUseNativeDialog
|
||||
if has_long_filter:
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,7 @@ def initialize(self, choices=None):
|
|||
from calibre.ebooks.conversion.plugins.pdf_output import PAPER_SIZES
|
||||
choices = PAPER_SIZES
|
||||
for a in sorted(choices, key=numeric_sort_key):
|
||||
s = getattr(QPageSize, a.capitalize())
|
||||
s = getattr(QPageSize.PageSizeId, a.capitalize())
|
||||
sz = QPageSize.definitionSize(s)
|
||||
unit = {QPageSize.Unit.Millimeter: 'mm', QPageSize.Unit.Inch: 'inch'}[QPageSize.definitionUnits(s)]
|
||||
name = f'{QPageSize.name(s)} ({sz.width():g} x {sz.height():g} {unit})'
|
||||
|
|
|
|||
Loading…
Reference in a new issue