mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Comments editor: Add a button to easily insert separators (i.e. <hr> tags) when editing comments
This commit is contained in:
parent
9f4bf26b9d
commit
ebdec9f6ae
95
imgsrc/format-text-hr.svg
Normal file
95
imgsrc/format-text-hr.svg
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="136.53334"
|
||||
height="136.53334"
|
||||
viewBox="0 0 128 128"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.1 r"
|
||||
sodipodi:docname="format-text-hr.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="50.735407"
|
||||
inkscape:cy="62.616635"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2128"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="32"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Kovid Goyal</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-924.36216)">
|
||||
<path
|
||||
d="m 127,990.98716 v -5.25 q 0,-1.1484 -0.73828,-1.8867 -0.73828,-0.7383 -1.88672,-0.7383 H 3.6250002 q -1.14844,0 -1.88672,0.7383 -0.7382799,0.7383 -0.7382799,1.8867 v 5.25 q 0,1.1484 0.7382799,1.8867 0.73828,0.7383 1.88672,0.7383 H 124.375 q 1.14844,0 1.88672,-0.7383 Q 127,992.13556 127,990.98716 Z"
|
||||
id="path4"
|
||||
style="fill:#0d5cc6;fill-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
BIN
resources/images/format-text-hr.png
Normal file
BIN
resources/images/format-text-hr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 260 B |
@ -163,9 +163,13 @@ class EditorWidget(QWebView): # {{{
|
||||
|
||||
self.action_insert_link = QAction(QIcon(I('insert-link.png')),
|
||||
_('Insert link or image'), self)
|
||||
self.action_insert_hr = QAction(QIcon(I('format-text-hr.png')),
|
||||
_('Insert separator'), self)
|
||||
self.action_insert_link.triggered.connect(self.insert_link)
|
||||
self.action_insert_hr.triggered.connect(self.insert_hr)
|
||||
self.pageAction(QWebPage.ToggleBold).changed.connect(self.update_link_action)
|
||||
self.action_insert_link.setEnabled(False)
|
||||
self.action_insert_hr.setEnabled(False)
|
||||
self.action_clear = QAction(QIcon(I('trash.png')), _('Clear'), self)
|
||||
self.action_clear.triggered.connect(self.clear_text)
|
||||
|
||||
@ -177,8 +181,9 @@ class EditorWidget(QWebView): # {{{
|
||||
self.set_readonly(False)
|
||||
|
||||
def update_link_action(self):
|
||||
wac = self.pageAction(QWebPage.ToggleBold)
|
||||
self.action_insert_link.setEnabled(wac.isEnabled())
|
||||
wac = self.pageAction(QWebPage.ToggleBold).isEnabled()
|
||||
self.action_insert_link.setEnabled(wac)
|
||||
self.action_insert_hr.setEnabled(wac)
|
||||
|
||||
def set_readonly(self, what):
|
||||
self.readonly = what
|
||||
@ -209,6 +214,9 @@ class EditorWidget(QWebView): # {{{
|
||||
if col.isValid():
|
||||
self.exec_command('hiliteColor', unicode(col.name()))
|
||||
|
||||
def insert_hr(self, *args):
|
||||
self.exec_command('insertHTML', '<hr>')
|
||||
|
||||
def insert_link(self, *args):
|
||||
link, name, is_image = self.ask_link()
|
||||
if not link:
|
||||
@ -705,6 +713,7 @@ class Editor(QWidget): # {{{
|
||||
if hasattr(w, 'setPopupMode'):
|
||||
w.setPopupMode(w.InstantPopup)
|
||||
self.toolbar2.addAction(self.editor.action_insert_link)
|
||||
self.toolbar2.addAction(self.editor.action_insert_hr)
|
||||
# }}}
|
||||
|
||||
# toolbar3 {{{
|
||||
|
Loading…
x
Reference in New Issue
Block a user