/usr/share/help/el/gnome-devel-demos/statusbar.py.page is in gnome-devel-docs 3.8.1-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 | <?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:xi="http://www.w3.org/2001/XInclude" type="guide" style="task" id="statusbar.py" xml:lang="el">
<info>
<title type="text">Γραμμή κατάστασης (Python)</title>
<link type="guide" xref="beginner.py#display-widgets"/>
<link type="seealso" xref="signals-callbacks.py"/>
<link type="next" xref="spinner.py"/>
<revision version="0.2" date="2012-06-12" status="draft"/>
<credit type="author copyright">
<name>Marta Maria Casetti</name>
<email>mmcasetti@gmail.com</email>
<years>2012</years>
</credit>
<desc>Μηνύματα αναφοράς μικρότερης σημασίας για τον χρήστη</desc>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Δημήτρης Σπίγγος</mal:name>
<mal:email>dmtrs32@gmail.com</mal:email>
<mal:years>2012, 2013</mal:years>
</mal:credit>
</info>
<title>Γραμμή κατάστασης</title>
<media type="image" mime="image/png" src="media/statusbar.png"/>
<p>Αυτή η γραμμή κατάστασης σας λέει εάν πατήσετε το κουμπί ή εάν πατήσετε οποιοδήποτε κλειδί (και ποιο κλειδί).</p>
<links type="section"/>
<section id="code">
<title>Ο χρησιμοποιούμενος κώδικας για παραγωγή αυτού παραδείγματος</title>
<code mime="text/x-python" style="numbered">from gi.repository import Gtk
from gi.repository import Gdk
import sys
class MyWindow(Gtk.ApplicationWindow):
# a window
def __init__(self, app):
Gtk.Window.__init__(self, title="StatusBar Example", application=app)
self.set_default_size(200, 100)
# a label
label = Gtk.Label(label="Press any key or ")
# a button
button = Gtk.Button(label="click me.")
# connected to a callback
button.connect("clicked", self.button_clicked_cb)
# the statusbar
self.statusbar = Gtk.Statusbar()
# its context_id - not shown in the UI but needed to uniquely identify
# the source of a message
self.context_id = self.statusbar.get_context_id("example")
# we push a message onto the statusbar's stack
self.statusbar.push(self.context_id, "Waiting for you to do something...")
# a grid to attach the widgets
grid = Gtk.Grid()
grid.set_column_spacing(5)
grid.set_column_homogeneous(True)
grid.set_row_homogeneous(True)
grid.attach(label, 0, 0, 1, 1)
grid.attach_next_to(button, label, Gtk.PositionType.RIGHT, 1, 1)
grid.attach(self.statusbar, 0, 1, 2, 1)
# add the grid to the window
self.add(grid)
# callback function for the button clicked
# if the button is clicked the event is signaled to the statusbar
# onto which we push a new status
def button_clicked_cb(self, button):
self.statusbar.push(self.context_id, "You clicked the button.")
# event handler
def do_key_press_event(self, event):
# any signal from the keyboard is signaled to the statusbar
# onto which we push a new status with the symbolic name
# of the key pressed
self.statusbar.push(self.context_id, Gdk.keyval_name(event.keyval) +
" key was pressed.")
# stop the signal emission
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>
<note><p>Το <code>Gdk.keyval_name(event.keyval)</code> μετατρέπει την τιμή κλειδιού σε <code>event.keyval</code> ένα συμβολικό όνομα. Τα ονόματα και οι αντίστοιχες τιμές κλειδιού μπορούν να βρεθούν <link href="http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h">εδώ</link>, αλλά για παράδειγμα το <code>GDK_KEY_BackSpace</code> γίνεται η συμβολοσειρά <code>"BackSpace"</code>.</p></note>
</section>
<section id="methods">
<title>Χρήσιμες μέθοδοι για ένα γραφικό συστατικό γραμμής κατάστασης</title>
<p>Στη γραμμή 17 το σήμα <code>"clicked"</code> συνδέεται με τη συνάρτηση επανάκλησης <code>button_clicked_cb()</code> χρησιμοποιώντας <code><var>widget</var>.connect(<var>signal</var>, <var>callback function</var>)</code>. Δείτε <link xref="signals-callbacks.py"/> για μια πιο λεπτομερή εξήγηση.</p>
<list>
<item><p>Το <code>pop(context_id)</code> αφαιρεί το πρώτο μήνυμα στη στοίβα της γραμμής κατάστασης με το δοσμένο <code>context_id</code>.</p></item>
<item><p>Το <code>remove_all(context_id)</code> αφαιρεί όλα τα μηνύματα στη στοίβα της γραμμής κατάστασης με το δοσμένο <code>context_id</code>.</p></item>
<item><p>Το <code>remove(context_id, message_id)</code> αφαιρεί το μήνυμα με το δοσμένο <code>message_id</code> στη στοίβα γραμμής κατάστασης με το δοσμένο <code>context_id</code>. Το <code>message_id</code> επιστρέφεται με <code>push(context_id, "the message")</code> όταν προωθείτε το μήνυμα στη γραμμή κατάστασης.</p></item>
</list>
</section>
<section id="references">
<title>Αναφορές API</title>
<p>Σε αυτό το παράδειγμα χρησιμοποιήσαμε τα παρακάτω:</p>
<list>
<item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkStatusbar.html">GtkStatusbar</link></p></item>
<item><p><link href="http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html">Gdk - Key Values</link></p></item>
</list>
</section>
</page>
|