Package list sugar-read-activity / defd57d
Add rotate buttons - SL #4583 Right now, is implemented only for pdf files. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org> Gonzalo Odiard 8 years ago
6 changed file(s) with 184 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6767 return False
6868
6969 def can_do_text_to_speech(self):
70 return False
71
72 def can_rotate(self):
7073 return False
7174
7275 def get_marked_words(self):
121121 def previous_page(self):
122122 self._view.previous_page()
123123
124 def rotate_left(self):
125 rotation = self._model.get_rotation()
126 self._model.set_rotation(rotation - 90)
127
128 def rotate_right(self):
129 rotation = self._model.get_rotation()
130 self._model.set_rotation(rotation + 90)
131
132 def can_rotate(self):
133 return True
134
124135 def get_pagecount(self):
125136 '''
126137 Returns the pagecount of the loaded file
0 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1 <!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
2 <svg
3 xmlns:dc="http://purl.org/dc/elements/1.1/"
4 xmlns:cc="http://creativecommons.org/ns#"
5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6 xmlns:svg="http://www.w3.org/2000/svg"
7 xmlns="http://www.w3.org/2000/svg"
8 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10 version="1.1"
11 x="0px"
12 y="0px"
13 width="55px"
14 height="55px"
15 viewBox="0 0 55 55"
16 enable-background="new 0 0 55 55"
17 xml:space="preserve"
18 id="svg2"
19 sodipodi:version="0.32"
20 inkscape:version="0.46"
21 sodipodi:docname="rotate_anticlockwise.svg"
22 inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
23 id="metadata14"><rdf:RDF><cc:Work
24 rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
25 rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
26 id="defs12"><inkscape:perspective
27 sodipodi:type="inkscape:persp3d"
28 inkscape:vp_x="0 : 27.5 : 1"
29 inkscape:vp_y="0 : 1000 : 0"
30 inkscape:vp_z="55 : 27.5 : 1"
31 inkscape:persp3d-origin="27.5 : 18.333333 : 1"
32 id="perspective16" /></defs><sodipodi:namedview
33 inkscape:window-height="976"
34 inkscape:window-width="1680"
35 inkscape:pageshadow="2"
36 inkscape:pageopacity="0.0"
37 guidetolerance="10.0"
38 gridtolerance="10.0"
39 objecttolerance="10.0"
40 borderopacity="1.0"
41 bordercolor="#666666"
42 pagecolor="#ffffff"
43 id="base"
44 showgrid="false"
45 inkscape:zoom="8.3636364"
46 inkscape:cx="27.5"
47 inkscape:cy="27.5"
48 inkscape:window-x="0"
49 inkscape:window-y="24"
50 inkscape:current-layer="svg2" />
51
52 <g
53 id="Undo"
54 transform="matrix(0,-1,1,0,0.975043,54.158)">
55 <g
56 display="inline"
57 id="g5"
58 style="display:inline">
59 <polyline
60 points=" 22.903,27.523 15.091,20.935 22.903,14.344 "
61 id="polyline7"
62 style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round;stroke-linejoin:round" />
63 <path
64 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"
65 id="path9"
66 style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round"
67 sodipodi:nodetypes="ccsc" />
68 </g>
69 </g>
70 </svg>
0 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1 <!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
2 <svg
3 xmlns:dc="http://purl.org/dc/elements/1.1/"
4 xmlns:cc="http://creativecommons.org/ns#"
5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6 xmlns:svg="http://www.w3.org/2000/svg"
7 xmlns="http://www.w3.org/2000/svg"
8 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10 version="1.1"
11 x="0px"
12 y="0px"
13 width="55px"
14 height="55px"
15 viewBox="0 0 55 55"
16 enable-background="new 0 0 55 55"
17 xml:space="preserve"
18 id="svg2"
19 sodipodi:version="0.32"
20 inkscape:version="0.46"
21 sodipodi:docname="rotate_clockwise.svg"
22 inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
23 id="metadata14"><rdf:RDF><cc:Work
24 rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
25 rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
26 id="defs12"><inkscape:perspective
27 sodipodi:type="inkscape:persp3d"
28 inkscape:vp_x="0 : 27.5 : 1"
29 inkscape:vp_y="0 : 1000 : 0"
30 inkscape:vp_z="55 : 27.5 : 1"
31 inkscape:persp3d-origin="27.5 : 18.333333 : 1"
32 id="perspective16" /></defs><sodipodi:namedview
33 inkscape:window-height="976"
34 inkscape:window-width="1680"
35 inkscape:pageshadow="2"
36 inkscape:pageopacity="0.0"
37 guidetolerance="10.0"
38 gridtolerance="10.0"
39 objecttolerance="10.0"
40 borderopacity="1.0"
41 bordercolor="#666666"
42 pagecolor="#ffffff"
43 id="base"
44 showgrid="false"
45 inkscape:zoom="8.3636364"
46 inkscape:cx="27.5"
47 inkscape:cy="27.5"
48 inkscape:window-x="0"
49 inkscape:window-y="24"
50 inkscape:current-layer="svg2" />
51
52 <g
53 id="Undo"
54 transform="matrix(0,-1,-1,0,54.158,54.158)">
55 <g
56 display="inline"
57 id="g5"
58 style="display:inline">
59 <polyline
60 points=" 22.903,27.523 15.091,20.935 22.903,14.344 "
61 id="polyline7"
62 style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round;stroke-linejoin:round" />
63 <path
64 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"
65 id="path9"
66 style="fill:none;stroke:#ffffff;stroke-width:2.98670006;stroke-linecap:round"
67 sodipodi:nodetypes="ccsc" />
68 </g>
69 </g>
70 </svg>
224224 self._zoom_to_original.show()
225225
226226 spacer = Gtk.SeparatorToolItem()
227 spacer.props.draw = False
227 spacer.props.draw = True
228228 self.insert(spacer, -1)
229229 spacer.show()
230230
244244
245245 self._view_notify_zoom_handler = None
246246
247 spacer = Gtk.SeparatorToolItem()
248 spacer.props.draw = True
249 self.insert(spacer, -1)
250 spacer.show()
251
252 self._rotate_left = ToolButton('rotate_anticlockwise')
253 self._rotate_left.set_tooltip(_('Rotate left'))
254 self._rotate_left.connect('clicked', self._rotate_left_cb)
255 self.insert(self._rotate_left, -1)
256 self._rotate_left.show()
257
258 self._rotate_right = ToolButton('rotate_clockwise')
259 self._rotate_right.set_tooltip(_('Rotate right'))
260 self._rotate_right.connect('clicked', self._rotate_right_cb)
261 self.insert(self._rotate_right, -1)
262 self._rotate_right.show()
263
247264 def set_view(self, view):
248265 self._view = view
249266 self._update_zoom_buttons()
258275
259276 def _zoom_in_cb(self, button):
260277 self.zoom_in()
278
279 def _rotate_left_cb(self, button):
280 self._view.rotate_left()
281
282 def _rotate_right_cb(self, button):
283 self._view.rotate_right()
261284
262285 def zoom_out(self):
263286 self._view.zoom_out()
282305 self._zoom_to_width.props.sensitive = self._view.can_zoom_to_width()
283306 self._zoom_to_fit.props.sensitive = self._view.can_zoom_to_width()
284307 self._zoom_to_original.props.sensitive = self._view.can_zoom_to_width()
308 self._rotate_left.props.sensitive = self._view.can_rotate()
309 self._rotate_right.props.sensitive = self._view.can_rotate()
285310
286311 def _zoom_to_fit_cb(self, menu_item):
287312 self._view.zoom_to_best_fit()
479479 def zoom_to_actual_size(self):
480480 return False
481481
482 def can_rotate(self):
483 return False
482484
483485 class _JobFind(GObject.GObject):
484486