|
45.
|
|
|
Choose the Save menu item, and it will be selected in <application>Glade</application>.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:137(para)
|
|
46.
|
|
|
In GTK+, menu items are "activated" when a user chooses the item from the menu. Since we want a function to run when the user chooses Save, we want to specify a function to respond to the activate signal from the menu item. Note the name of the menu item is "mnu_save" in the right panel. You will use this in a second.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:141(para)
|
|
47.
|
|
|
Edit the Code in Gedit
|
|
|
|
Modifier le Code dans Gedit
|
|
Translated and reviewed by
Pierre Slamich
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:142(title)
|
|
48.
|
|
|
Create the Save File Signal Handler
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:143(title)
|
|
49.
|
|
|
<placeholder-1/> Now you're ready to write some code. The code for the window is stored in the file "JottyWindow.py".
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:143(para)
|
|
50.
|
|
|
Use the "quickly edit" command to start editing your code files:
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:145(para)
|
|
51.
|
|
|
quickly edit
|
|
|
|
quickly edit
|
|
Translated and reviewed by
Pierre Slamich
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:146(programlisting) data/templates/ubuntu-application/help/tutorial.xml:917(programlisting) data/templates/ubuntu-application/help/tutorial.xml:946(programlisting)
|
|
52.
|
|
|
This will open the default Ubuntu text editor <application>gedit</application> with all the customizable Python files in the "jotty" directory.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:147(para)
|
|
53.
|
|
|
When signals are emitted, if the window's class has a method called "on_WIDGET_SIGNAL", it will be called. In this case, we are interested in the "activate" signal on the "mnu_save" widget. So we want to create an "on_mnu_save_activate" method in the JottyWindow class. So simply switch to the JottyWindow.py file and add the following right under the finish_initializing method:
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:151(para)
|
|
54.
|
|
|
def on_mnu_save_activate(self, widget, data=None):
print "save"
|
|
|
represents a line break.
Start a new line in the equivalent position in the translation.
|
|
|
represents a space character.
Enter a space in the equivalent position in the translation.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
data/templates/ubuntu-application/help/tutorial.xml:153(programlisting)
|