mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Another Qt 5.7 compatibility fix
This commit is contained in:
parent
32fd1c2e7f
commit
fc1676e30f
@ -7,12 +7,13 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
from PyQt5.Qt import QIcon, Qt, QStringListModel
|
from PyQt5.Qt import (
|
||||||
|
QIcon, Qt, QStringListModel, QListView, QSizePolicy, QHBoxLayout, QSize,
|
||||||
|
QStackedWidget, pyqtSignal)
|
||||||
|
|
||||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit
|
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit
|
||||||
from calibre.ebooks.conversion.plumber import Plumber
|
from calibre.ebooks.conversion.plumber import Plumber
|
||||||
from calibre.utils.logging import Log
|
from calibre.utils.logging import Log
|
||||||
from calibre.gui2.preferences.conversion_ui import Ui_Form
|
|
||||||
from calibre.gui2.convert.look_and_feel import LookAndFeelWidget
|
from calibre.gui2.convert.look_and_feel import LookAndFeelWidget
|
||||||
from calibre.gui2.convert.heuristics import HeuristicsWidget
|
from calibre.gui2.convert.heuristics import HeuristicsWidget
|
||||||
from calibre.gui2.convert.search_and_replace import SearchAndReplaceWidget
|
from calibre.gui2.convert.search_and_replace import SearchAndReplaceWidget
|
||||||
@ -36,12 +37,39 @@ class Model(QStringListModel):
|
|||||||
return (QIcon(w.ICON))
|
return (QIcon(w.ICON))
|
||||||
return QStringListModel.data(self, index, role)
|
return QStringListModel.data(self, index, role)
|
||||||
|
|
||||||
class Base(ConfigWidgetBase, Ui_Form):
|
|
||||||
|
class ListView(QListView):
|
||||||
|
|
||||||
|
current_changed = pyqtSignal(object, object)
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
QListView.__init__(self, parent)
|
||||||
|
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
|
||||||
|
f = self.font()
|
||||||
|
f.setBold(True)
|
||||||
|
self.setFont(f)
|
||||||
|
self.setIconSize(QSize(48, 48))
|
||||||
|
self.setFlow(self.TopToBottom)
|
||||||
|
self.setSpacing(10)
|
||||||
|
|
||||||
|
def currentChanged(self, cur, prev):
|
||||||
|
QListView.currentChanged(self, cur, prev)
|
||||||
|
self.current_changed.emit(cur, prev)
|
||||||
|
|
||||||
|
class Base(ConfigWidgetBase):
|
||||||
|
|
||||||
restore_defaults_desc = _('Restore settings to default values. '
|
restore_defaults_desc = _('Restore settings to default values. '
|
||||||
'Only settings for the currently selected section '
|
'Only settings for the currently selected section '
|
||||||
'are restored.')
|
'are restored.')
|
||||||
|
|
||||||
|
def setupUi(self, x):
|
||||||
|
self.resize(720, 603)
|
||||||
|
self.l = l = QHBoxLayout(self)
|
||||||
|
self.list = lv = ListView(self)
|
||||||
|
l.addWidget(lv)
|
||||||
|
self.stack = s = QStackedWidget(self)
|
||||||
|
l.addWidget(s, stretch=10)
|
||||||
|
|
||||||
def genesis(self, gui):
|
def genesis(self, gui):
|
||||||
log = Log()
|
log = Log()
|
||||||
log.outputs = []
|
log.outputs = []
|
||||||
@ -64,7 +92,7 @@ class Base(ConfigWidgetBase, Ui_Form):
|
|||||||
if isinstance(w, TOCWidget):
|
if isinstance(w, TOCWidget):
|
||||||
w.manually_fine_tune_toc.hide()
|
w.manually_fine_tune_toc.hide()
|
||||||
|
|
||||||
self.list.currentChanged = self.category_current_changed
|
self.list.current_changed.connect(self.category_current_changed)
|
||||||
self.list.setCurrentIndex(self.model.index(0))
|
self.list.setCurrentIndex(self.model.index(0))
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Form</class>
|
|
||||||
<widget class="QWidget" name="Form">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>720</width>
|
|
||||||
<height>603</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="list">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>180</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>180</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="tabKeyNavigation">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="showDropIndicator" stdset="0">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>48</width>
|
|
||||||
<height>48</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerItem</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollMode">
|
|
||||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="flow">
|
|
||||||
<enum>QListView::TopToBottom</enum>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="viewMode">
|
|
||||||
<enum>QListView::ListMode</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QStackedWidget" name="stack"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
Loading…
x
Reference in New Issue
Block a user