/usr/share/help/es/gnome-devel-demos/progressbar.py.page is in gnome-devel-docs 3.28.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | <?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:xi="http://www.w3.org/2001/XInclude" type="guide" style="task" id="progressbar.py" xml:lang="es">
<info>
<title type="text">ProgressBar (Python)</title>
<link type="guide" xref="beginner.py#display-widgets"/>
<link type="next" xref="spinbutton.py"/>
<revision version="0.2" date="2012-06-12" status="draft"/>
<credit type="author copyright">
<name>Marta Maria Casetti</name>
<email its:translate="no">mmcasetti@gmail.com</email>
<years>2012</years>
</credit>
<desc>Un widget que indica el progreso de manera visual.</desc>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Daniel Mustieles</mal:name>
<mal:email>daniel.mustieles@gmail.com</mal:email>
<mal:years>2011 - 2017</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Nicolás Satragno</mal:name>
<mal:email>nsatragno@gmail.com</mal:email>
<mal:years>2012 - 2013</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Jorge González</mal:name>
<mal:email>jorgegonz@svn.gnome.org</mal:email>
<mal:years>2011</mal:years>
</mal:credit>
</info>
<title>ProgressBar</title>
<media type="video" mime="application/ogv" src="media/progressbar.ogv">
<tt:tt xmlns:tt="http://www.w3.org/ns/ttml">
<tt:body>
<tt:div begin="0s" end="6s">
<tt:p>Pulsar cualquier tecla detiene e inicia esta ProgressBar.</tt:p>
</tt:div>
</tt:body>
</tt:tt>
</media>
<p>La ProgressBar se detiene y se inicia pulsando una tecla.</p>
<links type="section"/>
<section id="code">
<title>Código usado para generar este ejemplo</title>
<code mime="text/x-python" style="numbered">from gi.repository import GLib
from gi.repository import Gtk
import sys
class MyWindow(Gtk.ApplicationWindow):
# a window
def __init__(self, app):
Gtk.Window.__init__(self, title="ProgressBar Example", application=app)
self.set_default_size(220, 20)
# a progressbar
self.progress_bar = Gtk.ProgressBar()
# add the progressbar to the window
self.add(self.progress_bar)
# the method self.pulse is called each 100 milliseconds
# and self.source_id is set to be the ID of the event source
# (i.e. the bar changes position every 100 milliseconds)
self.source_id = GLib.timeout_add(100, self.pulse)
# event handler
# any signal from the keyboard controls if the progressbar stops/starts
def do_key_press_event(self, event):
# if the progressbar has been stopped (therefore source_id == 0 - see
# "else" below), turn it back on
if (self.source_id == 0):
self.source_id = GLib.timeout_add(100, self.pulse)
# if the bar is moving, remove the source with the ID of source_id
# from the main context (stop the bar) and set the source_id to 0
else:
GLib.source_remove(self.source_id)
self.source_id = 0
# stop the signal emission
return True
# source function
# the progressbar is in "activity mode" when this method is called
def pulse(self):
self.progress_bar.pulse()
# call the function again
return True
class MyApplication(Gtk.Application):
def __init__(self):
Gtk.Application.__init__(self)
def do_activate(self):
win = MyWindow(self)
win.show_all()
def do_startup(self):
Gtk.Application.do_startup(self)
app = MyApplication()
exit_status = app.run(sys.argv)
sys.exit(exit_status)
</code>
</section>
<section id="methods">
<title>Métodos útiles para un widget «ProgressBar»</title>
<list>
<item><p>En lugar de <code>pulse()</code>, que hace que la barra avance y retroceda, si se quiere que la barra de progreso «llene» una fracción (un <code>float</code> entre <code>0.0</code> y <code>1.0</code> inclusive) de la barra que se ha completado, use <code>set_fraction(fracción)</code>.</p></item>
<item><p>Para establecer un texto y mostrarlo (superpuesto a la barra) use <code>set_text(<var>"texto"</var>)</code> y <code>set_show_text(True)</code>. Si no se establece un texto y <code>set_show_text(True)</code>, el texto será el porcentaje del trabajo que se ha completado.</p></item>
</list>
</section>
<section id="references">
<title>Referencias de la API</title>
<p>En este ejemplo se usa lo siguiente:</p>
<list>
<item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkProgressBar.html">GtkProgressBar</link></p></item>
<item><p><link href="http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html">GLib: el bucle de eventos principal</link></p></item>
<item><p><link href="http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling">Gdk: valores de teclas</link></p></item>
</list>
</section>
</page>
|