Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-09-05 20:31:16 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-09-05 21:44:59 (GMT)
commitdefd57dffbf8c24a1dd6ab33d69a4a92c1102151 (patch)
tree1e5a5ac41bddaa83f9cffd11b6cb776c0b27100f
parentef8b57606d8f4d49354d5019317ecc649ecdf521 (diff)
Add rotate buttons - SL #4583
Right now, is implemented only for pdf files. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--epubadapter.py3
-rw-r--r--evinceadapter.py11
-rw-r--r--icons/rotate_anticlockwise.svg71
-rw-r--r--icons/rotate_clockwise.svg71
-rw-r--r--readtoolbar.py27
-rw-r--r--textadapter.py2
6 files changed, 184 insertions, 1 deletions
diff --git a/epubadapter.py b/epubadapter.py
index 1946e51..e412675 100644
--- a/epubadapter.py
+++ b/epubadapter.py
@@ -70,6 +70,9 @@ class EpubViewer(epubview.EpubView):
def can_do_text_to_speech(self):
return False
+ def can_rotate(self):
+ return False
+
def get_marked_words(self):
"Adds a mark between each word of text."
i = self.current_word
diff --git a/evinceadapter.py b/evinceadapter.py
index 3a1f263..31859d9 100644
--- a/evinceadapter.py
+++ b/evinceadapter.py
@@ -122,6 +122,17 @@ class EvinceViewer():
def previous_page(self):
self._view.previous_page()
+ def rotate_left(self):
+ rotation = self._model.get_rotation()
+ self._model.set_rotation(rotation - 90)
+
+ def rotate_right(self):
+ rotation = self._model.get_rotation()
+ self._model.set_rotation(rotation + 90)
+
+ def can_rotate(self):
+ return True
+
def get_pagecount(self):
'''
Returns the pagecount of the loaded file
diff --git a/icons/rotate_anticlockwise.svg b/icons/rotate_anticlockwise.svg
new file mode 100644
index 0000000..55a9c61
--- /dev/null
+++ b/icons/rotate_anticlockwise.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<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"
+ version="1.1"
+ x="0px"
+ y="0px"
+ width="55px"
+ height="55px"
+ viewBox="0 0 55 55"
+ enable-background="new 0 0 55 55"
+ xml:space="preserve"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="rotate_anticlockwise.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata14"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs12"><inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 27.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="55 : 27.5 : 1"
+ inkscape:persp3d-origin="27.5 : 18.333333 : 1"
+ id="perspective16" /></defs><sodipodi:namedview
+ inkscape:window-height="976"
+ inkscape:window-width="1680"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="8.3636364"
+ inkscape:cx="27.5"
+ inkscape:cy="27.5"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:current-layer="svg2" />
+
+<g
+ id="Undo"
+ transform="matrix(0,-1,1,0,0.975043,54.158)">
+ <g
+ display="inline"
+ id="g5"
+ style="display:inline">
+ <polyline
+ points=" 22.903,27.523 15.091,20.935 22.903,14.344 "
+ id="polyline7"
+ style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round;stroke-linejoin:round" />
+ <path
+ d="M 15.091,20.935 L 32.345,20.935 C 37.038,20.935 40.879,24.776 40.879,29.469 C 40.879,34.162 40.983652,31.904174 40.83413,38.838957"
+ id="path9"
+ style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round"
+ sodipodi:nodetypes="ccsc" />
+ </g>
+</g>
+</svg> \ No newline at end of file
diff --git a/icons/rotate_clockwise.svg b/icons/rotate_clockwise.svg
new file mode 100644
index 0000000..474f6f0
--- /dev/null
+++ b/icons/rotate_clockwise.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<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"
+ version="1.1"
+ x="0px"
+ y="0px"
+ width="55px"
+ height="55px"
+ viewBox="0 0 55 55"
+ enable-background="new 0 0 55 55"
+ xml:space="preserve"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="rotate_clockwise.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata14"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs12"><inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 27.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="55 : 27.5 : 1"
+ inkscape:persp3d-origin="27.5 : 18.333333 : 1"
+ id="perspective16" /></defs><sodipodi:namedview
+ inkscape:window-height="976"
+ inkscape:window-width="1680"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="8.3636364"
+ inkscape:cx="27.5"
+ inkscape:cy="27.5"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:current-layer="svg2" />
+
+<g
+ id="Undo"
+ transform="matrix(0,-1,-1,0,54.158,54.158)">
+ <g
+ display="inline"
+ id="g5"
+ style="display:inline">
+ <polyline
+ points=" 22.903,27.523 15.091,20.935 22.903,14.344 "
+ id="polyline7"
+ style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round;stroke-linejoin:round" />
+ <path
+ d="M 15.091,20.935 L 32.345,20.935 C 37.038,20.935 40.879,24.776 40.879,29.469 C 40.879,34.162 40.983652,31.904174 40.83413,38.838957"
+ id="path9"
+ style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round"
+ sodipodi:nodetypes="ccsc" />
+ </g>
+</g>
+</svg> \ No newline at end of file
diff --git a/readtoolbar.py b/readtoolbar.py
index 435da1c..02170af 100644
--- a/readtoolbar.py
+++ b/readtoolbar.py
@@ -225,7 +225,7 @@ class ViewToolbar(Gtk.Toolbar):
self._zoom_to_original.show()
spacer = Gtk.SeparatorToolItem()
- spacer.props.draw = False
+ spacer.props.draw = True
self.insert(spacer, -1)
spacer.show()
@@ -245,6 +245,23 @@ class ViewToolbar(Gtk.Toolbar):
self._view_notify_zoom_handler = None
+ spacer = Gtk.SeparatorToolItem()
+ spacer.props.draw = True
+ self.insert(spacer, -1)
+ spacer.show()
+
+ self._rotate_left = ToolButton('rotate_anticlockwise')
+ self._rotate_left.set_tooltip(_('Rotate left'))
+ self._rotate_left.connect('clicked', self._rotate_left_cb)
+ self.insert(self._rotate_left, -1)
+ self._rotate_left.show()
+
+ self._rotate_right = ToolButton('rotate_clockwise')
+ self._rotate_right.set_tooltip(_('Rotate right'))
+ self._rotate_right.connect('clicked', self._rotate_right_cb)
+ self.insert(self._rotate_right, -1)
+ self._rotate_right.show()
+
def set_view(self, view):
self._view = view
self._update_zoom_buttons()
@@ -260,6 +277,12 @@ class ViewToolbar(Gtk.Toolbar):
def _zoom_in_cb(self, button):
self.zoom_in()
+ def _rotate_left_cb(self, button):
+ self._view.rotate_left()
+
+ def _rotate_right_cb(self, button):
+ self._view.rotate_right()
+
def zoom_out(self):
self._view.zoom_out()
self._update_zoom_buttons()
@@ -283,6 +306,8 @@ class ViewToolbar(Gtk.Toolbar):
self._zoom_to_width.props.sensitive = self._view.can_zoom_to_width()
self._zoom_to_fit.props.sensitive = self._view.can_zoom_to_width()
self._zoom_to_original.props.sensitive = self._view.can_zoom_to_width()
+ self._rotate_left.props.sensitive = self._view.can_rotate()
+ self._rotate_right.props.sensitive = self._view.can_rotate()
def _zoom_to_fit_cb(self, menu_item):
self._view.zoom_to_best_fit()
diff --git a/textadapter.py b/textadapter.py
index 1a81bf5..c6ded43 100644
--- a/textadapter.py
+++ b/textadapter.py
@@ -480,6 +480,8 @@ class TextViewer(GObject.GObject):
def zoom_to_actual_size(self):
return False
+ def can_rotate(self):
+ return False
class _JobFind(GObject.GObject):