mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
Fixes #1922405 [Make the Create/edit a column icon rule window narrower](https://bugs.launchpad.net/calibre/+bug/1922405)
This commit is contained in:
commit
b4b2108546
@ -224,7 +224,7 @@ you the value as well as all the local variables</p></string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="go_button">
|
||||
<widget class="QToolButton" name="go_button">
|
||||
<property name="text">
|
||||
<string>&Go</string>
|
||||
</property>
|
||||
@ -232,8 +232,8 @@ you the value as well as all the local variables</p></string>
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/sync-right.png</normaloff>:/images/sync-right.png</iconset>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 5; padding-left: 1;</string>
|
||||
<property name="toolButtonStyle">
|
||||
<set>Qt::ToolButtonTextBesideIcon</set>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>If 'Enable breakpoints' is checked then click this button to run your template</string>
|
||||
@ -286,12 +286,12 @@ you the value as well as all the local variables</p></string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toggle_button">
|
||||
<widget class="QToolButton" name="toggle_button">
|
||||
<property name="text">
|
||||
<string>&Toggle</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 5; padding-left: 1;</string>
|
||||
<property name="toolButtonStyle">
|
||||
<set>Qt::ToolButtonTextBesideIcon</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
@ -316,12 +316,12 @@ you the value as well as all the local variables</p></string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remove_all_button">
|
||||
<widget class="QToolButton" name="remove_all_button">
|
||||
<property name="text">
|
||||
<string>&Remove all</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 5; padding-left: 1;</string>
|
||||
<property name="toolButtonStyle">
|
||||
<set>Qt::ToolButtonTextBesideIcon</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
@ -333,12 +333,12 @@ you the value as well as all the local variables</p></string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="set_all_button">
|
||||
<widget class="QToolButton" name="set_all_button">
|
||||
<property name="text">
|
||||
<string>&Set all</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 5; padding-left: 1;</string>
|
||||
<property name="toolButtonStyle">
|
||||
<set>Qt::ToolButtonTextBesideIcon</set>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
|
@ -12,7 +12,8 @@ from qt.core import (QWidget, QDialog, QLabel, QGridLayout, QComboBox, QSize,
|
||||
QLineEdit, QIntValidator, QDoubleValidator, QFrame, Qt, QIcon, QHBoxLayout,
|
||||
QScrollArea, QPushButton, QVBoxLayout, QDialogButtonBox, QToolButton, QItemSelectionModel,
|
||||
QListView, QAbstractListModel, pyqtSignal, QSizePolicy, QSpacerItem, QPalette,
|
||||
QApplication, QStandardItem, QStandardItemModel, QCheckBox, QMenu, QAbstractItemView)
|
||||
QApplication, QStandardItem, QStandardItemModel, QCheckBox, QMenu, QAbstractItemView,
|
||||
QColor, QBrush, QPixmap, QPainter)
|
||||
|
||||
from calibre import prepare_string_for_xml, sanitize_file_name, as_unicode
|
||||
from calibre.constants import config_dir
|
||||
@ -21,7 +22,7 @@ from calibre.gui2 import (error_dialog, choose_files, pixmap_to_data, gprefs,
|
||||
choose_save_file, open_local_file)
|
||||
from calibre.gui2.dialogs.template_dialog import TemplateDialog
|
||||
from calibre.gui2.metadata.single_download import RichTextDelegate
|
||||
from calibre.gui2.widgets2 import ColorButton
|
||||
from calibre.gui2.widgets2 import ColorButton, FlowLayout
|
||||
from calibre.library.coloring import (Rule, conditionable_columns,
|
||||
displayable_columns, rule_from_template, color_row_key)
|
||||
from calibre.utils.localization import lang_map
|
||||
@ -895,6 +896,33 @@ class RulesView(QListView): # {{{
|
||||
# }}}
|
||||
|
||||
|
||||
class Separator(QWidget): # {{{
|
||||
|
||||
def __init__(self, parent, widget_for_height):
|
||||
QWidget.__init__(self, parent)
|
||||
self.bcol = QColor(QPalette.ColorRole.Text)
|
||||
self.update_brush()
|
||||
self.widget_for_height = widget_for_height
|
||||
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.MinimumExpanding)
|
||||
|
||||
def update_brush(self):
|
||||
self.brush = QBrush(self.bcol)
|
||||
self.update()
|
||||
|
||||
def sizeHint(self):
|
||||
return QSize(1, self.widget_for_height.height())
|
||||
|
||||
def paintEvent(self, ev):
|
||||
painter = QPainter(self)
|
||||
# Purely subjective: shorten the line a bit to look 'better'
|
||||
r = ev.rect()
|
||||
r.setTop(r.top() + 3)
|
||||
r.setBottom(r.bottom() - 3)
|
||||
painter.fillRect(r, self.brush)
|
||||
painter.end()
|
||||
# }}}
|
||||
|
||||
|
||||
class EditRules(QWidget): # {{{
|
||||
|
||||
changed = pyqtSignal()
|
||||
@ -949,7 +977,7 @@ class EditRules(QWidget): # {{{
|
||||
self.add_advanced_button = b = QPushButton(QIcon(I('plus.png')),
|
||||
_('Add ad&vanced rule'), self)
|
||||
b.clicked.connect(self.add_advanced)
|
||||
self.hb = hb = QHBoxLayout()
|
||||
self.hb = hb = FlowLayout()
|
||||
l.addLayout(hb, l.rowCount(), 0, 1, 2)
|
||||
hb.addWidget(b)
|
||||
self.duplicate_rule_button = b = QPushButton(QIcon(I('edit-copy.png')),
|
||||
@ -962,13 +990,16 @@ class EditRules(QWidget): # {{{
|
||||
b.clicked.connect(self.convert_to_advanced)
|
||||
b.setEnabled(False)
|
||||
hb.addWidget(b)
|
||||
hb.addStretch(10)
|
||||
sep = Separator(self, b)
|
||||
hb.addWidget(sep)
|
||||
|
||||
self.open_icon_folder_button = b = QPushButton(QIcon(I('icon_choose.png')),
|
||||
_('Open icon folder'), self)
|
||||
connect_lambda(b.clicked, self,
|
||||
lambda _: open_local_file(os.path.join(config_dir, 'cc_icons')))
|
||||
hb.addWidget(b)
|
||||
hb.addStretch(10)
|
||||
sep = Separator(self, b)
|
||||
hb.addWidget(sep)
|
||||
self.export_button = b = QPushButton(_('E&xport'), self)
|
||||
b.clicked.connect(self.export_rules)
|
||||
b.setToolTip(_('Export these rules to a file'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user