Merge lp:~shanepatrickfagan/quickly/quickly_docbook into lp:quickly

Proposed by Shane Fagan
Status: Merged
Merged at revision: not available
Proposed branch: lp:~shanepatrickfagan/quickly/quickly_docbook
Merge into: lp:quickly
Diff against target: 6627 lines (+5098/-1282)
12 files modified
data/templates/ubuntu-application/help/index.html (+0/-46)
data/templates/ubuntu-application/help/po/ie.po (+1420/-0)
data/templates/ubuntu-application/help/po/quickly-ubuntu-application-tutorial.pot (+2387/-0)
data/templates/ubuntu-application/help/quickly-dialogs.html (+0/-286)
data/templates/ubuntu-application/help/quickly-getting-started.html (+0/-315)
data/templates/ubuntu-application/help/quickly-package.html (+0/-176)
data/templates/ubuntu-application/help/quickly-reference.html (+0/-278)
data/templates/ubuntu-application/help/quickly-release.html (+0/-27)
data/templates/ubuntu-application/help/quickly-ubuntu-application-tutorial.xml (+1150/-0)
data/templates/ubuntu-application/tutorial.py (+8/-2)
po/quickly.pot (+132/-151)
quickly/quicklyconfig.py (+1/-1)
To merge this branch: bzr merge lp:~shanepatrickfagan/quickly/quickly_docbook
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Needs Information
Review via email: mp+19147@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Shane Fagan (shanepatrickfagan) wrote :

Done ready for merging. I just got the main branch and remerged my changes and it fixed itself and now builds.

Revision history for this message
Shane Fagan (shanepatrickfagan) wrote :

I dont know why the diff has stuff I didnt change. I used the main branch. Ill look into it.

Revision history for this message
Shane Fagan (shanepatrickfagan) wrote :

I think its right now

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hey Fagan, thanks for your work, awesome :)

Just a quick question as I requested you on IRC. As the main purpose of using docbook is to be able to translate the tutorial, did you try to build it, translate some strings in a diffrent language and set it as your language to ensure the translated version is taken into account?

If you didn't have the time to test that, can you test it before I merge the branch? (as it's directly related this feature).

Thanks a lot again ;)

review: Needs Information
414. By Didier Roche-Tolomelli

fix copyright as copyright wasn't canonical

415. By Didier Roche-Tolomelli

Some fixes in share/transition/competion. Kudos to v0xel

416. By Didier Roche-Tolomelli

fix quickly help configure

417. By Didier Roche-Tolomelli

remove not pushing to ppa for debugging

418. By Didier Roche-Tolomelli

simplify versionning computation (v0xel)

419. By Didier Roche-Tolomelli

split the quickly package in multiple package

420. By Didier Roche-Tolomelli

stop on unlicensed project

421. By Didier Roche-Tolomelli

enable adding manual dependencies to quickly project

422. By Didier Roche-Tolomelli

don't care anymore about --root option. --prefix should be use

423. By Didier Roche-Tolomelli

fix licensing call in release and share raising an Exception (LP: #524805)

424. By Philip Peitsch

Fixing license upgrade to correctly skip files that already have a license line present

425. By Didier Roche-Tolomelli

fix license issue on first licensing

426. By Didier Roche-Tolomelli

 some license fix

427. By Didier Roche-Tolomelli

enable configure its own bzr branch and resetting parent branch even once
already configured (quickly configure bzr <branch-path>)

428. By Didier Roche-Tolomelli

now recommends seahorse-plugins to have a graphical prompt for signing
package

429. By Didier Roche-Tolomelli

rename quickly glade to quickly design

430. By Didier Roche-Tolomelli

refresh pot file

431. By Didier Roche-Tolomelli

fix quickly --version with last move

432. By Didier Roche-Tolomelli

create command is now more flexible and enable people to inherit from
other template more easily

433. By Didier Roche-Tolomelli

don't launch the project if file isn't present

434. By Didier Roche-Tolomelli

* fix bad formatted catalog file
* Move some file to be more explicit in the folder layout
* fix quickly add dialog to put the python file as well
* misc pep compliance rewriting

435. By Didier Roche-Tolomelli

* factorizing some os.abspath() code

436. By Didier Roche-Tolomelli

take add dialog path in the origin template set if doesn't exist

437. By Didier Roche-Tolomelli

add translation domain to gtkbuilder and fix some items that shouldn't
been translatable (Łukasz Jernaś)

438. By Shane Fagan

Added translations and yelp opens the correct one for your locale. Needs lots of testing and some setup.py work

439. By Shane Fagan

Moved the pot to the right folder and updated it.

440. By Shane Fagan

Rebuilt the pot again because of new changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'data/templates/ubuntu-application/help/index.html'
--- data/templates/ubuntu-application/help/index.html 2009-10-24 14:03:39 +0000
+++ data/templates/ubuntu-application/help/index.html 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Quickly Help Index</TITLE>
4<STYLE>
5img
6{
7 display: block;
8 width:668px;
9 padding-top:10px;
10}
11p
12{
13 width: 800px;
14}
15.emphasis
16{
17 font-weight: bold;
18}
19</STYLE>
20</HEAD>
21<BODY>
22 <H1>What is Quickly?</H1>
23 <P>
24 <span class="emphasis">Quickly is a set of choices</span> about writing apps for Ubuntu. Out of all the wonderful richness and variety of programming for Linux, Quickly make some very opinionated choices about what tools to use, and how to combine them. The criteria for these choices was to make it easy and fun to write and release Linux applications, even if it's your first time trying, but also in a way that delivers the full power and flexibility of the platform. One benefit of these choices, is that it's also easier to write tools that make it even easier and more fun. So <span class="emphasis">Quickly is also a set of commands</span>.
25 </P>
26
27 <H1>Quickly Tutorial</H2>
28 <OL>
29 <LI><A HREF="quickly-getting-started.html">Part 1 - Getting Started</A></LI>
30 <LI><A HREF="quickly-dialogs.html">Part 2 - Using Dialogs</A></LI>
31 <LI><A HREF="quickly-package.html">Part 3 - Packaging</A></LI>
32 </OL>
33
34 <H1>Reference</H1>
35 <UL>
36 <LI><A HREF="quickly-reference.html">Quickly: Quickly Command Reference</A></LI>
37 <LI><A HREF="http://blog.didrocks.fr/index.php/post/Build-your-application-quickly-with-Quickly%3A-part1">Blog post suit on Quickly</A></LI>
38 <LI><A HREF="http://docs.python.org/reference/">Language: Python Language Reference</A></LI>
39 <LI><A HREF="http://www.python.org/doc/2.6/library/index.html">Core Library: Python 2.6 Library Reference</A></LI>
40 <LI><A HREF="http://www.pygtk.org/docs/pygtk/">UI Library: PyGtk</A></LI>
41 <LI><A HREF="http://wiki.apache.org/couchdb/Reference">Database: CouchDB Reference</LI>
42 <LI><A HREF="http://library.gnome.org/devel/glade/stable/">UI Editing: Glade User Documenation</A></LI>
43 <LI><A HREF="http://library.gnome.org/users/gedit/stable/index.html">Editor: Gedit Help</A></LI>
44 <LI><A HREF="http://doc.bazaar-vcs.org/bzr.dev/en/user-reference/bzr_man.html">Version Control: Bazaar</A></LI>
45 </UL>
46</BODY>
470
=== added directory 'data/templates/ubuntu-application/help/po'
=== added file 'data/templates/ubuntu-application/help/po/ie.po'
--- data/templates/ubuntu-application/help/po/ie.po 1970-01-01 00:00:00 +0000
+++ data/templates/ubuntu-application/help/po/ie.po 2010-03-12 17:35:32 +0000
@@ -0,0 +1,1420 @@
1msgid ""
2msgstr ""
3"Project-Id-Version: PACKAGE VERSION\n"
4"POT-Creation-Date: 2010-03-04 15:41+0000\n"
5"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
6"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
7"Language-Team: LANGUAGE <LL@li.org>\n"
8"MIME-Version: 1.0\n"
9"Content-Type: text/plain; charset=UTF-8\n"
10"Content-Transfer-Encoding: 8bit\n"
11
12#: quickly-ubuntu-application-tutorial.xml:13(firstname)
13msgid "Shane"
14msgstr ""
15
16#: quickly-ubuntu-application-tutorial.xml:14(surname)
17msgid "Fagan"
18msgstr ""
19
20#: quickly-ubuntu-application-tutorial.xml:17(firstname)
21msgid "Rick"
22msgstr ""
23
24#: quickly-ubuntu-application-tutorial.xml:18(surname)
25msgid "Spencer"
26msgstr ""
27
28#: quickly-ubuntu-application-tutorial.xml:20(corpauthor)
29msgid "Canonical ltd"
30msgstr ""
31
32#: quickly-ubuntu-application-tutorial.xml:24(date) quickly-ubuntu-application-tutorial.xml:29(invpartnumber)
33msgid "2010"
34msgstr ""
35
36#: quickly-ubuntu-application-tutorial.xml:30(title)
37msgid "<application>Quickly</application> 0.4 User Guide"
38msgstr ""
39
40#: quickly-ubuntu-application-tutorial.xml:35(title)
41msgid "About This Guide"
42msgstr "Maidir leis an treoir"
43
44#: quickly-ubuntu-application-tutorial.xml:36(para)
45msgid "<application>Quickly</application> is a set of choices about writing apps for Ubuntu. Out of all the wonderful richness and variety of programming for Linux, <application>Quickly</application> make some very opinionated choices about what tools to use, and how to combine them. The criteria for these choices was to make it easy and fun to write and release Linux applications, even if it's your first time trying, but also in a way that delivers the full power and flexibility of the platform. One benefit of these choices, is that it's also easier to write tools that make it even easier and more fun. So <application>Quickly</application> is also a set of commands."
46msgstr ""
47
48#: quickly-ubuntu-application-tutorial.xml:39(link) quickly-ubuntu-application-tutorial.xml:45(title)
49msgid "Getting Started"
50msgstr ""
51
52#: quickly-ubuntu-application-tutorial.xml:46(para)
53msgid "Welcome to the <application>Quickly</application> tutorial. In this guide you will learn how to get started using <application>Quickly</application>."
54msgstr ""
55
56#: quickly-ubuntu-application-tutorial.xml:49(application) quickly-ubuntu-application-tutorial.xml:52(application) quickly-ubuntu-application-tutorial.xml:55(application) quickly-ubuntu-application-tutorial.xml:65(application) quickly-ubuntu-application-tutorial.xml:80(application) quickly-ubuntu-application-tutorial.xml:87(application) quickly-ubuntu-application-tutorial.xml:142(application) quickly-ubuntu-application-tutorial.xml:170(application) quickly-ubuntu-application-tutorial.xml:182(application) quickly-ubuntu-application-tutorial.xml:238(application) quickly-ubuntu-application-tutorial.xml:260(application) quickly-ubuntu-application-tutorial.xml:280(application) quickly-ubuntu-application-tutorial.xml:325(application) quickly-ubuntu-application-tutorial.xml:349(application) quickly-ubuntu-application-tutorial.xml:361(application) quickly-ubuntu-application-tutorial.xml:367(application) quickly-ubuntu-application-tutorial.xml:453(application) quickly-ubuntu-application-tutorial.xml:477(application) quickly-ubuntu-application-tutorial.xml:482(application) quickly-ubuntu-application-tutorial.xml:514(application) quickly-ubuntu-application-tutorial.xml:691(application) quickly-ubuntu-application-tutorial.xml:702(application) quickly-ubuntu-application-tutorial.xml:713(application) quickly-ubuntu-application-tutorial.xml:822(application) quickly-ubuntu-application-tutorial.xml:881(application) quickly-ubuntu-application-tutorial.xml:896(application) quickly-ubuntu-application-tutorial.xml:899(application) quickly-ubuntu-application-tutorial.xml:907(application) quickly-ubuntu-application-tutorial.xml:924(application) quickly-ubuntu-application-tutorial.xml:928(application) quickly-ubuntu-application-tutorial.xml:953(application) quickly-ubuntu-application-tutorial.xml:963(application) quickly-ubuntu-application-tutorial.xml:976(application) quickly-ubuntu-application-tutorial.xml:985(application) quickly-ubuntu-application-tutorial.xml:1024(application) quickly-ubuntu-application-tutorial.xml:1041(application) quickly-ubuntu-application-tutorial.xml:1076(application) quickly-ubuntu-application-tutorial.xml:1086(application) quickly-ubuntu-application-tutorial.xml:1102(application) quickly-ubuntu-application-tutorial.xml:1121(application) quickly-ubuntu-application-tutorial.xml:1121(application) quickly-ubuntu-application-tutorial.xml:1124(application)
57msgid "Quickly"
58msgstr ""
59
60#: quickly-ubuntu-application-tutorial.xml:49(link)
61msgid "Introduction to <placeholder-1/> Part 1"
62msgstr ""
63
64#: quickly-ubuntu-application-tutorial.xml:52(link)
65msgid "Introduction to <placeholder-1/> Part 2"
66msgstr ""
67
68#: quickly-ubuntu-application-tutorial.xml:55(link)
69msgid "Introduction to <placeholder-1/> Part 3"
70msgstr ""
71
72#: quickly-ubuntu-application-tutorial.xml:61(title)
73msgid "Introduction to <application>Quickly</application> Part 1"
74msgstr ""
75
76#: quickly-ubuntu-application-tutorial.xml:62(para)
77msgid "This part 1 of the <application>Quickly</application> tutorial. This part is will introduce some key <application>Quickly</application> commands, editing a user interface in Glade, and editing code in Gedit. This part of the tutorial will familiarize you with these three tools, and how they work together with python and pygtk so that you can <application>Quickly</application> build applications."
78msgstr ""
79
80#: quickly-ubuntu-application-tutorial.xml:64(title)
81msgid "Creating a <application>Quickly</application> Project"
82msgstr ""
83
84#: quickly-ubuntu-application-tutorial.xml:64(para)
85msgid "<placeholder-1/>Creating an empty but working program couldn't be simpler. First, open a terminal window to type commands into. When it's open, type the command:"
86msgstr ""
87
88#: quickly-ubuntu-application-tutorial.xml:65(code)
89msgid "<placeholder-1/> create ubuntu-application jotty"
90msgstr ""
91
92#: quickly-ubuntu-application-tutorial.xml:69(para)
93msgid "This will create a jotty sub directory containing a complete directory tree and files for an empty python application. The command finishes by running the newly created empty application."
94msgstr ""
95
96#: quickly-ubuntu-application-tutorial.xml:73(title)
97msgid "Testing the Empty Application"
98msgstr ""
99
100#: quickly-ubuntu-application-tutorial.xml:73(para)
101msgid "<placeholder-1/> They are populated and set up, and you can resize the window. Notice that <application>Quickly</application> inferred that the application title is \"Jotty\". Only a few of menu items do anything in the empty application, Help-&gt;About, Edit-&gt;Preferences, and File-&gt;Quit."
102msgstr ""
103
104#: quickly-ubuntu-application-tutorial.xml:77(title)
105msgid "Running the Application"
106msgstr ""
107
108#: quickly-ubuntu-application-tutorial.xml:77(para)
109msgid "<placeholder-1/> Close the application by closing the window or using the Quit command. Since the empty application isn't installed into Ubuntu yet, you can't start the application from the application menu yet. To start the applicaton, use the terminal to first cd into the new subdirectory, and then use \"<application>Quickly</application> run\" to start the program."
110msgstr ""
111
112#: quickly-ubuntu-application-tutorial.xml:79(code)
113msgid "cd jotty"
114msgstr ""
115
116#: quickly-ubuntu-application-tutorial.xml:80(code) quickly-ubuntu-application-tutorial.xml:181(code) quickly-ubuntu-application-tutorial.xml:1075(code)
117msgid "<placeholder-1/> run"
118msgstr ""
119
120#: quickly-ubuntu-application-tutorial.xml:84(title)
121msgid "Editing an Application"
122msgstr ""
123
124#: quickly-ubuntu-application-tutorial.xml:85(title)
125msgid "Edit the User Interface in Glade"
126msgstr ""
127
128#: quickly-ubuntu-application-tutorial.xml:85(para)
129msgid "<placeholder-1/><application>Quickly</application> programs use Glade to edit the user interface. Start Glade with <application>Quickly</application> in order to set up Glade for editing the empty applicaton. Don't start glade directly, or it won't load the necessary catalogue files for editing the classes that were automaticaly generated by <application>Quickly</application>."
130msgstr ""
131
132#: quickly-ubuntu-application-tutorial.xml:87(code) quickly-ubuntu-application-tutorial.xml:142(code) quickly-ubuntu-application-tutorial.xml:481(code) quickly-ubuntu-application-tutorial.xml:896(code) quickly-ubuntu-application-tutorial.xml:924(code) quickly-ubuntu-application-tutorial.xml:962(code)
133msgid "<placeholder-1/> design"
134msgstr ""
135
136#: quickly-ubuntu-application-tutorial.xml:91(para)
137msgid "Glade will open with the project loaded up and ready to edit."
138msgstr ""
139
140#: quickly-ubuntu-application-tutorial.xml:95(para)
141msgid "Use the Project Menu to choose \"JottytWindow.ui\" for editing."
142msgstr ""
143
144#: quickly-ubuntu-application-tutorial.xml:99(para)
145msgid "We want to create a text area for typing into. There are some default Widgets added to the Window. We won't need these so we'll start with deleting them. Click on the label, and press delete, and it will disappear from the window."
146msgstr ""
147
148#: quickly-ubuntu-application-tutorial.xml:106(para)
149msgid "Do the same with the image widget. This leave us two free slots."
150msgstr ""
151
152#: quickly-ubuntu-application-tutorial.xml:110(para)
153msgid "We'll use the bottom slot to add a TextView widget for the user to type into. In the toolbox, click on the TextView widget. Then click in the empty slot."
154msgstr ""
155
156#: quickly-ubuntu-application-tutorial.xml:114(para)
157msgid "Make sure you save the file in Glade, or your changes won't take! Then run the application from terminal again. The window now has a place where the user can type."
158msgstr ""
159
160#: quickly-ubuntu-application-tutorial.xml:118(para)
161msgid "Now we'll add the entry field for the title, and also a label for it. We'll use the top empty slot for that. First, click on Horizontal Box (HBox) from the \"Containers\" section of the pallette, and then click on the top slot. A dialog box will open, tell it that you want two items."
162msgstr ""
163
164#: quickly-ubuntu-application-tutorial.xml:122(para)
165msgid "The HBox is a container that arranges it's children horizontally. Add a label to the empty left hand box, and a Text Entry to the right hand one."
166msgstr ""
167
168#: quickly-ubuntu-application-tutorial.xml:126(para)
169msgid "Before going on, let's clean up the UI just a tad here. Select the new HBox from the treeview in the inspector window. Then go to the Packing tab, and set Expand and Fill to \"No\"."
170msgstr ""
171
172#: quickly-ubuntu-application-tutorial.xml:130(para)
173msgid "Go to the General tab, and set spacing to 5."
174msgstr ""
175
176#: quickly-ubuntu-application-tutorial.xml:134(para)
177msgid "Select the label. On the general tab, set \"Label\" to \"Name:\". Set expand and fill to \"no\" for the label, but keep it \"yes\" for the entry. Set the padding for both to 5 (also on the Packing tab)."
178msgstr ""
179
180#: quickly-ubuntu-application-tutorial.xml:138(title)
181msgid "Add the Save, Open, and New Features"
182msgstr ""
183
184#: quickly-ubuntu-application-tutorial.xml:138(para)
185msgid "<placeholder-1/> After the user types something, they may want to save it. A File-&gt;Save menu item was automatically created when the empty applicaton was created, but it's not hooked up to any code. To make Save work, we need tell the menu item what function to call, and then create a function to actually do the saving."
186msgstr ""
187
188#: quickly-ubuntu-application-tutorial.xml:140(title)
189msgid "Set the Signal Handler in Glade"
190msgstr ""
191
192#: quickly-ubuntu-application-tutorial.xml:140(para)
193msgid "<placeholder-1/> To tell the menu item what function to call. If glade is not still open, open up the application in glade:"
194msgstr ""
195
196#: quickly-ubuntu-application-tutorial.xml:143(para)
197msgid "Click on the file menu, and the menu opens as if the application were running."
198msgstr ""
199
200#: quickly-ubuntu-application-tutorial.xml:147(para)
201msgid "Choose the Save menu item, and it will be selected in Glade."
202msgstr ""
203
204#: quickly-ubuntu-application-tutorial.xml:151(para)
205msgid "Then choose the \"Signals\" tab of the properties window."
206msgstr ""
207
208#: quickly-ubuntu-application-tutorial.xml:155(para)
209msgid "In pygtk, 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. We'll call the function \"save_file\". Simply type the function name into the box for the activate signal.Make sure to save the glade file."
210msgstr ""
211
212#: quickly-ubuntu-application-tutorial.xml:159(para)
213msgid "Note that you will need to setup the \"open_file\" signal and the \"new_file\" signal as well when you get to those functions later."
214msgstr ""
215
216#: quickly-ubuntu-application-tutorial.xml:160(title)
217msgid "Edit the Code in Gedit"
218msgstr ""
219
220#: quickly-ubuntu-application-tutorial.xml:161(title)
221msgid "Set Up Tabs Correctly"
222msgstr ""
223
224#: quickly-ubuntu-application-tutorial.xml:161(para)
225msgid "<placeholder-1/> Note a major gotcha here. In python spaces and tabs are totally different, but they look just the same in an editor. So being indented one tab stop is not the same as being indented four spaces, even though they might look the same. And indentation level is very important in python. You will get a lot of errors if you mix tab indentation with space indentation. Your generated project follows the python standard of using four spaces for each indentation level. So you'll either have to hit the space bar four time every time you indent, or set up your editor to use the right number of spaces for tabs."
226msgstr ""
227
228#: quickly-ubuntu-application-tutorial.xml:163(para)
229msgid "The upshot is that you should take a moment to set up your Gedit (or whatever editor you are using) to use spaces for tabs. In Gedit, select Preferences from the Edit menu, and choose the Editor tab. Then set Tab width to 4, and turn on \"Insert spaces instead of tabs\". Your preferences should look like this:"
230msgstr ""
231
232#: quickly-ubuntu-application-tutorial.xml:167(title)
233msgid "Create the Save File Signal Handler"
234msgstr ""
235
236#: quickly-ubuntu-application-tutorial.xml:167(para)
237msgid "<placeholder-1/> Now you're ready to write some code. Of course just telling the glade file what signal to emit won't make the file actually save, because we haven't created the \"save_file\" function yet. The code for JottyWindow is stored in the file jotty. jotty is a special python file that is the entry point for your application. Other python files in your application have the \".py\" suffix."
238msgstr ""
239
240#: quickly-ubuntu-application-tutorial.xml:169(para)
241msgid "Use the <application>Quickly</application> edit command to start editing your code files:"
242msgstr ""
243
244#: quickly-ubuntu-application-tutorial.xml:170(code) quickly-ubuntu-application-tutorial.xml:899(code) quickly-ubuntu-application-tutorial.xml:928(code) quickly-ubuntu-application-tutorial.xml:952(code)
245msgid "<placeholder-1/> edit"
246msgstr ""
247
248#: quickly-ubuntu-application-tutorial.xml:171(para)
249msgid "This will open the default Ubuntu text editor \"Gedit\" with any python files in the python directory."
250msgstr ""
251
252#: quickly-ubuntu-application-tutorial.xml:175(para)
253msgid "JottyWindow.ui is now expecting to find a function JottyWindow.save_file(), so we simply add one to the JottyWindow class in the jotty file right under the on_destroy funtion.:"
254msgstr ""
255
256#: quickly-ubuntu-application-tutorial.xml:177(code)
257msgid "def save_file(self, widget, data=None): print \"save\""
258msgstr ""
259
260#: quickly-ubuntu-application-tutorial.xml:179(para)
261msgid "This will print the word \"save\" to the terminal when run. The method signature is the standard signature expected in a signal handler. If you are new to python, be sure to copy the indentations exactly, as the indentation level is very important in python."
262msgstr ""
263
264#: quickly-ubuntu-application-tutorial.xml:180(para)
265msgid "Save the file, and run it again:"
266msgstr ""
267
268#: quickly-ubuntu-application-tutorial.xml:184(para)
269msgid "Choose \"File-&gt;Save\" from the menu, and you'll see the word \"save\" printing out interminal. That's all there is to hookig up the functions!"
270msgstr ""
271
272#: quickly-ubuntu-application-tutorial.xml:188(title)
273msgid "Implementing Save"
274msgstr ""
275
276#: quickly-ubuntu-application-tutorial.xml:188(para)
277msgid "<placeholder-1/> Now we'll write a little code in the signal handler to actually save the text. Because we want it to be easy for users to do things like syncronize their Jotty documents between computers, back it up, etc... we'll use couchdb as our backend, and we'll use desktopcouch for our api. Note that if you are not interested in learning about how to save to and read from couchdb, you can just snipe the code. Mostly likely you already have everything you need installed when you installed <application>Quickly</application>. But, you may need to install couchdb, desktopcouch, and the desktopcouch records api. The fastest way to do this is from the terminal:"
278msgstr ""
279
280#: quickly-ubuntu-application-tutorial.xml:191(code)
281msgid "sudo apt-get install python-desktopcouch-records"
282msgstr ""
283
284#: quickly-ubuntu-application-tutorial.xml:194(para)
285msgid "This will install the api, and everything you need for the api to run. After desktopcouch is installed, you can write the code. The code will do the following:"
286msgstr ""
287
288#: quickly-ubuntu-application-tutorial.xml:197(para)
289msgid "Import the stuff you'll need from desktopcouch."
290msgstr ""
291
292#: quickly-ubuntu-application-tutorial.xml:200(para)
293msgid "Get a reference to the couchdb database to save into."
294msgstr ""
295
296#: quickly-ubuntu-application-tutorial.xml:203(para)
297msgid "Get the title of the document and the text from the user interface."
298msgstr ""
299
300#: quickly-ubuntu-application-tutorial.xml:206(para)
301msgid "Check if there is already a document with the same title, and if so overwrite it."
302msgstr ""
303
304#: quickly-ubuntu-application-tutorial.xml:209(para)
305msgid "If there is not a document already, create one."
306msgstr ""
307
308#: quickly-ubuntu-application-tutorial.xml:212(title)
309msgid "Import the stuff you'll need from python-desktopcouch-records."
310msgstr ""
311
312#: quickly-ubuntu-application-tutorial.xml:212(para)
313msgid "<placeholder-1/> Add these import statements along with the other imports to the top of the jotty file:"
314msgstr ""
315
316#: quickly-ubuntu-application-tutorial.xml:214(code)
317msgid "from desktopcouch.records.server import CouchDatabase from desktopcouch.records.record import Record"
318msgstr ""
319
320#: quickly-ubuntu-application-tutorial.xml:216(title)
321msgid "Get a Reference to the Database"
322msgstr ""
323
324#: quickly-ubuntu-application-tutorial.xml:216(para)
325msgid "<placeholder-1/> Desktopcouch will set up a database for us, or create a new one if it's needed. We'll use \"jotty\" for the name of the database. Since we want this line to run every time the Jotty Window is created, put it at the end of the finish_initializing function:"
326msgstr ""
327
328#: quickly-ubuntu-application-tutorial.xml:218(code)
329msgid "self.database = CouchDatabase(\"jotty\", create=True)"
330msgstr ""
331
332#: quickly-ubuntu-application-tutorial.xml:221(para)
333msgid "Now that we have an instance-wide reference to the database, we'll add code to the save_file function to run whenever the Save command is issued."
334msgstr ""
335
336#: quickly-ubuntu-application-tutorial.xml:222(para)
337msgid "Here's the code to pull the title out of the title entry:"
338msgstr ""
339
340#: quickly-ubuntu-application-tutorial.xml:224(code)
341msgid "#get the title for the note title = self.builder.get_object(\"entry1\").get_text()"
342msgstr ""
343
344#: quickly-ubuntu-application-tutorial.xml:226(title)
345msgid "Here's the code to get pull the text out of the TextView:"
346msgstr ""
347
348#: quickly-ubuntu-application-tutorial.xml:226(para)
349msgid "<placeholder-1/> In pygtk, TextView widgets have a text buffer that stores the text. So you ask the TextView for it's TextBuffer, and then you ask the TextBuffer for the text. You use iters to determine from which part of the text buffer you want text. Since we want all the text, it's easy to just get the start and end iters."
350msgstr ""
351
352#: quickly-ubuntu-application-tutorial.xml:229(code)
353msgid "#get the string buff = self.builder.get_object(\"textview1\").get_buffer() start_iter = buff.get_start_iter() end_iter = buff.get_end_iter() text = buff.get_text(start_iter,end_iter)"
354msgstr ""
355
356#: quickly-ubuntu-application-tutorial.xml:235(title)
357msgid "Saving a document to Couchdb"
358msgstr ""
359
360#: quickly-ubuntu-application-tutorial.xml:235(para)
361msgid "<placeholder-1/> A record in couch is essentially a python dictionary with some extra key/value pairs to make the database work. So we can save the document to couch like this:"
362msgstr ""
363
364#: quickly-ubuntu-application-tutorial.xml:238(code)
365msgid "record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" new_rec = Record({\"record_type\": record_type,\"title\":title, \"text\":text}) self.database.put(new_rec)"
366msgstr ""
367
368#: quickly-ubuntu-application-tutorial.xml:241(para)
369msgid "The \"record_type\" field is not strictly required, but among other things, it makes it easy to fetch the documents later. By convention, we use a url to specify the record type. This provides a place for other developers to go to read about the record type. The description only needs to be human readable. Couchdb is not a typed database, so don't expect that the url will have any kind of schema definition or anything. You can use whatever url you want, and put whatever you want at that URL."
370msgstr ""
371
372#: quickly-ubuntu-application-tutorial.xml:242(title)
373msgid "Check for a pre-existing note with the same title"
374msgstr ""
375
376#: quickly-ubuntu-application-tutorial.xml:242(para)
377msgid "<placeholder-1/> Before we just write the new document though, we have to take note of the fact that couch will allow you to create as many documents as you want with the same title. We probably don't want this, so we we'll have to write a little code to check if there is already a document in couch with the same title, and if there is, update that document rather than create a new one."
378msgstr ""
379
380#: quickly-ubuntu-application-tutorial.xml:244(para)
381msgid "In CouchDB, you don't do a lot of data processing in the database like you would with a relational database. To be most efficient, we could use the desktopcouch API to create a view in CouchDB, but it's probably simplest just to do the necessary processing on the client for now. To do this, we'll use a desktopcouch function to retrieve all of the records of a specified record type."
382msgstr ""
383
384#: quickly-ubuntu-application-tutorial.xml:245(para)
385msgid "To find and update documents with a matching title we will:"
386msgstr ""
387
388#: quickly-ubuntu-application-tutorial.xml:248(para) quickly-ubuntu-application-tutorial.xml:308(para)
389msgid "Retrieve all of the documents with the CouchDatabase.get_records function."
390msgstr ""
391
392#: quickly-ubuntu-application-tutorial.xml:251(para) quickly-ubuntu-application-tutorial.xml:311(para)
393msgid "Check each of the returned records for a matching title."
394msgstr ""
395
396#: quickly-ubuntu-application-tutorial.xml:254(para)
397msgid "If there is a match, update the record using the CouchDatabase.update_fields function and return."
398msgstr ""
399
400#: quickly-ubuntu-application-tutorial.xml:257(para)
401msgid "This all may sound very weird, but in code, it's not quite so complicated:"
402msgstr ""
403
404#: quickly-ubuntu-application-tutorial.xml:259(code)
405msgid "#get all the records record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" results = self.database.get_records(record_type = record_type,create_view = True) #update a record that has the same title for result in results: document = result.value if document[\"title\"] == title: key = document[\"_id\"] self.database.update_fields(key, {\"text\":text}) return"
406msgstr ""
407
408#: quickly-ubuntu-application-tutorial.xml:269(para)
409msgid "So the whole function should look like this:"
410msgstr ""
411
412#: quickly-ubuntu-application-tutorial.xml:271(code)
413msgid "def save_file(self, widget, data=None): #get the title for the note title = self.builder.get_object(\"entry1\").get_text() #get the text to save buff = self.builder.get_object(\"textview1\").get_buffer() start_iter = buff.get_start_iter() end_iter = buff.get_end_iter() text = buff.get_text(start_iter,end_iter) #get all the records record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" results = self.database.get_records(record_type = record_type,create_view = True) #update a record that has the same title for result in results: document = result.value if document[\"title\"] == title: key = result.key self.database.update_fields(key, {\"text\":text}) return #if no records had the title, create it new_rec = Record({\"record_type\":record_type,\"title\":title, \"text\":text}) self.database.put_record(new_rec)"
414msgstr ""
415
416#: quickly-ubuntu-application-tutorial.xml:293(para)
417msgid "Couchdb makes it really easy to see if your save function is working. You can just point your web browser at it and explore the database:"
418msgstr ""
419
420#: quickly-ubuntu-application-tutorial.xml:294(para)
421msgid "file:///home/your_user_name&gt;/.local/share/desktop-couch/couchdb.html"
422msgstr ""
423
424#: quickly-ubuntu-application-tutorial.xml:298(para)
425msgid "If you are redirected to a page that doesn't work, you probably just need to clear your browser cache and try again."
426msgstr ""
427
428#: quickly-ubuntu-application-tutorial.xml:299(title)
429msgid "Implementing Open and New"
430msgstr ""
431
432#: quickly-ubuntu-application-tutorial.xml:299(para)
433msgid "<placeholder-1/> To open a saved document, the user will type the title of the document that they want to open in the text entry, and choose \"Open\" from the main menu. If there is no matching document there, it will just clear out the text view, ready for input. This is probably not too intuitive, so we'll add a dialog box for prompting the user for the title, but that's for later in the tutorial. For now, we'll just use the same text entry field."
434msgstr ""
435
436#: quickly-ubuntu-application-tutorial.xml:301(title)
437msgid "Implementing Open is essentially the reverse of Save:"
438msgstr ""
439
440#: quickly-ubuntu-application-tutorial.xml:301(para)
441msgid "<placeholder-1/> Follow these steps:"
442msgstr ""
443
444#: quickly-ubuntu-application-tutorial.xml:305(para)
445msgid "Add the open_file signal to the menu item in Glade."
446msgstr ""
447
448#: quickly-ubuntu-application-tutorial.xml:314(para)
449msgid "If there is a match, pull out the text and display it in the text view."
450msgstr ""
451
452#: quickly-ubuntu-application-tutorial.xml:317(para)
453msgid "So the open_file function looks like so:"
454msgstr ""
455
456#: quickly-ubuntu-application-tutorial.xml:319(code)
457msgid "def open_file(self, widget, data=None): #get the name of the document to open title = self.builder.get_object(\"entry1\").get_text() text = \"\" #get all the records record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" results = self.database.get_records(record_type = record_type,create_view = True) #get the text if there is a matching title for result in results: document = result.value if document[\"title\"] == title: text = document[\"text\"] #set the UI to display the string buff = self.builder.get_object(\"textview1\").get_buffer() buff.set_text(text)"
458msgstr ""
459
460#: quickly-ubuntu-application-tutorial.xml:337(title)
461msgid "Implement New"
462msgstr ""
463
464#: quickly-ubuntu-application-tutorial.xml:337(para)
465msgid "<placeholder-1/> First, add the new_file signal to the menu item in Glade, then add this code to clear out the text:"
466msgstr ""
467
468#: quickly-ubuntu-application-tutorial.xml:340(code)
469msgid "def new_file(self, widget, data=None): self.builder.get_object(\"entry1\").set_text(\"Note Title\") buff = self.builder.get_object(\"textview1\").get_buffer() buff.set_text(\"\")"
470msgstr ""
471
472#: quickly-ubuntu-application-tutorial.xml:344(para)
473msgid "To make them work, add these functions to the JottyWindow class, and save. Then go back and connect the functions to the activate signals for the Open and New menu items."
474msgstr ""
475
476#: quickly-ubuntu-application-tutorial.xml:345(ulink)
477msgid "Complete jotty file"
478msgstr ""
479
480#: quickly-ubuntu-application-tutorial.xml:346(title)
481msgid "Saving Your Work"
482msgstr ""
483
484#: quickly-ubuntu-application-tutorial.xml:346(para)
485msgid "<placeholder-1/> When <application>Quickly</application> created your application, it automatically added it to Bazaar, a source code versioning system. You can use Bazaar to roll back mistake, see code history, compare versions, etc... <application>Quickly</application> has a convenience function for backing up your work:"
486msgstr ""
487
488#: quickly-ubuntu-application-tutorial.xml:348(code)
489msgid "<placeholder-1/> save \"First working version of Jotty\""
490msgstr ""
491
492#: quickly-ubuntu-application-tutorial.xml:351(para)
493msgid "This will call <code>bzr add</code> and then <code>bzr commit -m [your message]</code> for you."
494msgstr ""
495
496#: quickly-ubuntu-application-tutorial.xml:354(title)
497msgid "Introduction to <application>Quickly</application> Part 2"
498msgstr ""
499
500#: quickly-ubuntu-application-tutorial.xml:355(para)
501msgid "In part 1, we created an application that can read and write text files, and persist them in the couchdb backend. However, the application has a hideous usability flaw, in the text box for specifying titles when saving and opening files is very confusing. In part 2, we'll fix that by adding a save and an open dialog."
502msgstr ""
503
504#: quickly-ubuntu-application-tutorial.xml:357(title)
505msgid "Creating a <application>Quickly</application> Dialog"
506msgstr ""
507
508#: quickly-ubuntu-application-tutorial.xml:358(title)
509msgid "Creating the Empty Dialog"
510msgstr ""
511
512#: quickly-ubuntu-application-tutorial.xml:358(para)
513msgid "<placeholder-1/> It's simple to add an empty, but working dialog to your project. Simply specify the name of the new dialog, and it will be added automatically. Assuming that you are in the jotty project directory:"
514msgstr ""
515
516#: quickly-ubuntu-application-tutorial.xml:360(code)
517msgid "<placeholder-1/> dialog save"
518msgstr ""
519
520#: quickly-ubuntu-application-tutorial.xml:363(para)
521msgid "This will add the dialog to your project."
522msgstr ""
523
524#: quickly-ubuntu-application-tutorial.xml:364(title) quickly-ubuntu-application-tutorial.xml:479(title)
525msgid "Editing the New Dialog"
526msgstr ""
527
528#: quickly-ubuntu-application-tutorial.xml:364(para)
529msgid "<placeholder-1/> To edit the UI for the dialog, you'll need to load it into Glade again. If you already have an instance of glade running, you might want to go ahead and close it first, as it may get confusing if you have more than one open at a time. After closing glade, simply open it again:"
530msgstr ""
531
532#: quickly-ubuntu-application-tutorial.xml:366(code)
533msgid "<placeholder-1/> Design"
534msgstr ""
535
536#: quickly-ubuntu-application-tutorial.xml:369(para)
537msgid "Then use the project menu to switch to newly created SaveDialog.ui file."
538msgstr ""
539
540#: quickly-ubuntu-application-tutorial.xml:373(para)
541msgid "Then add some widgets for the UI. Start with a Vertical Box (VBox) with two items. Put a label in the top, and an HBox in the bottom slot. In the HBox, add a label and an edit widget, just like you did for JottyWindow in part 1. Set the padding and expand properties as well."
542msgstr ""
543
544#: quickly-ubuntu-application-tutorial.xml:377(title)
545msgid "Code the Dialog"
546msgstr ""
547
548#: quickly-ubuntu-application-tutorial.xml:377(para)
549msgid "<placeholder-1/> You can use the \"<application>Quickly</application> edit\" command to open the SaveDialog.py file. This dialog needs very little additional code to work. Essentially, you just need a way to retrieve the string specified by the user. We'll add a qiuck accessor method for this:"
550msgstr ""
551
552#: quickly-ubuntu-application-tutorial.xml:380(code)
553msgid "@property def title_text(self): return self.builder.get_object(\"entry1\").get_text()"
554msgstr ""
555
556#: quickly-ubuntu-application-tutorial.xml:383(para)
557msgid "We don't need to write any code for the Ok and Cancel buttons, as they were automatically hooked up by <application>Quickly</application> when it created the dialog."
558msgstr ""
559
560#: quickly-ubuntu-application-tutorial.xml:384(para)
561msgid "Before we go on to invoking the dialog, delete HBox from JottyWindow that holds the text entry and label, as we won't be needing those."
562msgstr ""
563
564#: quickly-ubuntu-application-tutorial.xml:388(title)
565msgid "Calling the Save Dialog"
566msgstr ""
567
568#: quickly-ubuntu-application-tutorial.xml:388(para)
569msgid "<placeholder-1/> To use the dialog in JottyWindow, we need to follow these steps:"
570msgstr ""
571
572#: quickly-ubuntu-application-tutorial.xml:392(para)
573msgid "Import SaveDialog in JottyWindow"
574msgstr ""
575
576#: quickly-ubuntu-application-tutorial.xml:395(para)
577msgid "In the save_file function, create an instance of SaveDialog"
578msgstr ""
579
580#: quickly-ubuntu-application-tutorial.xml:398(para) quickly-ubuntu-application-tutorial.xml:558(para)
581msgid "Run the Dialog"
582msgstr ""
583
584#: quickly-ubuntu-application-tutorial.xml:401(para)
585msgid "Get the String"
586msgstr ""
587
588#: quickly-ubuntu-application-tutorial.xml:404(para) quickly-ubuntu-application-tutorial.xml:564(para)
589msgid "Destroy the dialog"
590msgstr ""
591
592#: quickly-ubuntu-application-tutorial.xml:408(title)
593msgid "Importing the SaveDialog"
594msgstr ""
595
596#: quickly-ubuntu-application-tutorial.xml:408(para)
597msgid "<placeholder-1/> Add the SaveDialog to the list of the imported modules at the top of the bin file of your project, so it looks like this:"
598msgstr ""
599
600#: quickly-ubuntu-application-tutorial.xml:410(code)
601msgid "from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog"
602msgstr ""
603
604#: quickly-ubuntu-application-tutorial.xml:414(title) quickly-ubuntu-application-tutorial.xml:583(title)
605msgid "Create an instance of the dialog and run it"
606msgstr ""
607
608#: quickly-ubuntu-application-tutorial.xml:414(para)
609msgid "<placeholder-1/> When the user chooses Save, we want to open the SaveDialog and collect the title of the note from the user. So we need to modify our save_file function."
610msgstr ""
611
612#: quickly-ubuntu-application-tutorial.xml:417(para)
613msgid "To create an instance of the dialog, use the NewSaveDialog() function in the SaveDialog module. It's important that you don't create an instance of SaveDialog directly, as it won't have a chance to load up it's UI that way, and it won't work. So whenever you use a <application>Quickly</application> dialog, do it like this:"
614msgstr ""
615
616#: quickly-ubuntu-application-tutorial.xml:418(code)
617msgid "saver = SaveDialog.NewSaveDialog()"
618msgstr ""
619
620#: quickly-ubuntu-application-tutorial.xml:421(para)
621msgid "To make the dialog appear, simply use the run() method. However, we want to check the result, so we'll need to store that in a variable. After it runs, we want to collect the string from the user, like this:"
622msgstr ""
623
624#: quickly-ubuntu-application-tutorial.xml:422(code)
625msgid "result = saver.run() title = saver.title_text"
626msgstr ""
627
628#: quickly-ubuntu-application-tutorial.xml:426(title)
629msgid "Clean up the dialog"
630msgstr ""
631
632#: quickly-ubuntu-application-tutorial.xml:426(para)
633msgid "<placeholder-1/> We need to tell the dialog to not show itself anymore. We could call saver.hide() to make it hide, but since we don't need it hanging around, we'll just destroy it. Before we go on, though, we need to ensure that the user actually wants to save, so if we didn't get the Ok result, we should just return out of the function:"
634msgstr ""
635
636#: quickly-ubuntu-application-tutorial.xml:429(code)
637msgid "saver.destroy() if result != gtk.RESPONSE_OK: return"
638msgstr ""
639
640#: quickly-ubuntu-application-tutorial.xml:433(para)
641msgid "Since we're now getting the title from the dialog instead of the text entry, we should delete the line of the code that sents it from entry1. So except for the addition of the dialog code, the save_file function looks pretty much the same as it did in part 1:"
642msgstr ""
643
644#: quickly-ubuntu-application-tutorial.xml:436(code)
645msgid "def save_file(self, widget, data=None): #get the titel from the user saver = SaveDialog.NewSaveDialog() result = saver.run() title = saver.title_text saver.destroy() if result != gtk.RESPONSE_OK: return #get the text to save buff = self.builder.get_object(\"textview1\").get_buffer() start_iter = buff.get_start_iter() end_iter = buff.get_end_iter() text = buff.get_text(start_iter,end_iter) #get all the records record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" results = self.database.get_records(record_type = record_type,create_view = True) #update a record that has the same title for result in results: record = result.value if record[\"title\"] == title: key = result.key self.database.update_fields(key, {\"text\":text}) return #if no records had the title, create it new_rec = Record({\"record_type\":record_type,\"title\":title, \"text\":text}) self.database.put_record(new_rec)"
646msgstr ""
647
648#: quickly-ubuntu-application-tutorial.xml:467(para)
649msgid "Now when we choose save, we get the SaveDialog instead:"
650msgstr ""
651
652#: quickly-ubuntu-application-tutorial.xml:472(title)
653msgid "Creating a Dialog with a CouchGrid"
654msgstr ""
655
656#: quickly-ubuntu-application-tutorial.xml:472(para)
657msgid "<placeholder-1/> We'll use a similar approach in the Open dialog that we did with Save. However, there is one big difference, we want to provide the user with a list of documents that you could choose to open. We'll use a widget called CouchGrid, which is included in the desktopcouch api for this."
658msgstr ""
659
660#: quickly-ubuntu-application-tutorial.xml:475(title)
661msgid "Create the Open Dialog"
662msgstr ""
663
664#: quickly-ubuntu-application-tutorial.xml:476(code)
665msgid "<placeholder-1/> dialog open"
666msgstr ""
667
668#: quickly-ubuntu-application-tutorial.xml:479(para)
669msgid "<placeholder-1/> Start out by closing, and then reopening glade again:"
670msgstr ""
671
672#: quickly-ubuntu-application-tutorial.xml:484(para)
673msgid "Start by adding a VBox and a label in the same manner as in the Save Dialog above. Leave an empty space in the VBox. We will use code to put the CouchGrid there."
674msgstr ""
675
676#: quickly-ubuntu-application-tutorial.xml:488(title)
677msgid "Coding the Open Dialog"
678msgstr ""
679
680#: quickly-ubuntu-application-tutorial.xml:489(title)
681msgid "Creating and Adding a CouchGrid"
682msgstr ""
683
684#: quickly-ubuntu-application-tutorial.xml:489(para)
685msgid "<placeholder-1/> It just takes a little bit of code to add a CouchGrid to the dialog. We need to:"
686msgstr ""
687
688#: quickly-ubuntu-application-tutorial.xml:493(para)
689msgid "Import the CouchGrid class."
690msgstr ""
691
692#: quickly-ubuntu-application-tutorial.xml:496(para)
693msgid "Create a CouchGrid pointing at the jotty database, and the desired record type."
694msgstr ""
695
696#: quickly-ubuntu-application-tutorial.xml:499(para)
697msgid "Add the CouchGrid to the dialog."
698msgstr ""
699
700#: quickly-ubuntu-application-tutorial.xml:503(title)
701msgid "Import the CouchGrid class"
702msgstr ""
703
704#: quickly-ubuntu-application-tutorial.xml:503(para)
705msgid "<placeholder-1/> CouchGrid is part of the desktopcouch records api, so we import it like this:"
706msgstr ""
707
708#: quickly-ubuntu-application-tutorial.xml:505(code)
709msgid "from desktopcouch.records.couchgrid import CouchGrid"
710msgstr ""
711
712#: quickly-ubuntu-application-tutorial.xml:508(title)
713msgid "Create the CouchGrid"
714msgstr ""
715
716#: quickly-ubuntu-application-tutorial.xml:508(para)
717msgid "<placeholder-1/> A CouchGrid needs to know three things, the name of the database, the name of the record type, and the name of the keys to use. \"keys\" is a list of fields that the widget will display, and by default will also use the same text for the heading of any columns. This set up should be done in the OpenDialog's finish_initalizing function. All this is easily done in code like this:"
718msgstr ""
719
720#: quickly-ubuntu-application-tutorial.xml:512(code)
721msgid "database = \"jotty\" keys = [\"title\"] record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" self.couchgrid = CouchGrid(database, record_type=record_type,keys=keys)"
722msgstr ""
723
724#: quickly-ubuntu-application-tutorial.xml:516(title)
725msgid "Add the CouchGrid to the Dialog"
726msgstr ""
727
728#: quickly-ubuntu-application-tutorial.xml:516(para)
729msgid "<placeholder-1/> we added the VBox to the dialog, we left an open space at the bottom. We'll use this by \"packing\" the CouchGrid into the VBox. We need to show it as well. So add the following lines to the finish_initializing function as well:"
730msgstr ""
731
732#: quickly-ubuntu-application-tutorial.xml:520(code)
733msgid "self.couchgrid.show() self.builder.get_object(\"vbox1\").pack_end(self.couchgrid)"
734msgstr ""
735
736#: quickly-ubuntu-application-tutorial.xml:523(title)
737msgid "Create the get_selection function"
738msgstr ""
739
740#: quickly-ubuntu-application-tutorial.xml:523(para)
741msgid "<placeholder-1/> The dialog still needs a bit more code to work. It needs to return the user's selection, if there is one. To do this, we need to ask the CouchGrid what is selected. This is easy using the widgets selected_record_ids function. But the CouchGrid supports multiple selection, so we'll do the following:"
742msgstr ""
743
744#: quickly-ubuntu-application-tutorial.xml:527(para)
745msgid "Use a decorator to define the function as a property accessor."
746msgstr ""
747
748#: quickly-ubuntu-application-tutorial.xml:530(para)
749msgid "Get all the selected record ids."
750msgstr ""
751
752#: quickly-ubuntu-application-tutorial.xml:533(para)
753msgid "If none are selected, return None."
754msgstr ""
755
756#: quickly-ubuntu-application-tutorial.xml:536(para)
757msgid "Pick the first one and return it."
758msgstr ""
759
760#: quickly-ubuntu-application-tutorial.xml:539(para)
761msgid "So the function to add to OpenDialog looks like this:"
762msgstr ""
763
764#: quickly-ubuntu-application-tutorial.xml:541(code)
765msgid "@property def selected_record_id(self): ids = self.couchgrid.selected_record_ids if len(ids) &lt; 1: return None else: return ids[0]"
766msgstr ""
767
768#: quickly-ubuntu-application-tutorial.xml:548(title)
769msgid "Using the Open Dialog"
770msgstr ""
771
772#: quickly-ubuntu-application-tutorial.xml:548(para)
773msgid "<placeholder-1/> Now we want to use the Open Dialog in the JottyWindow open_file function. To use it,we'll follow these steps:"
774msgstr ""
775
776#: quickly-ubuntu-application-tutorial.xml:552(para)
777msgid "Import OpenDialog in JottyWindow"
778msgstr ""
779
780#: quickly-ubuntu-application-tutorial.xml:555(para)
781msgid "In the open_file function, create an instance of OpenDialog"
782msgstr ""
783
784#: quickly-ubuntu-application-tutorial.xml:561(para)
785msgid "Get the id for the selected title."
786msgstr ""
787
788#: quickly-ubuntu-application-tutorial.xml:567(para)
789msgid "Check the response before proceeding"
790msgstr ""
791
792#: quickly-ubuntu-application-tutorial.xml:570(para) quickly-ubuntu-application-tutorial.xml:600(title)
793msgid "Use the id to get the record from CouchDB"
794msgstr ""
795
796#: quickly-ubuntu-application-tutorial.xml:573(para) quickly-ubuntu-application-tutorial.xml:609(title)
797msgid "Update the UI"
798msgstr ""
799
800#: quickly-ubuntu-application-tutorial.xml:577(title)
801msgid "Import OpenDialog"
802msgstr ""
803
804#: quickly-ubuntu-application-tutorial.xml:577(para)
805msgid "<placeholder-1/> Just like the SaveDialog, add the import line to the list of imports:"
806msgstr ""
807
808#: quickly-ubuntu-application-tutorial.xml:579(code)
809msgid "from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog, OpenDialog"
810msgstr ""
811
812#: quickly-ubuntu-application-tutorial.xml:583(para)
813msgid "<placeholder-1/> So now we're ready to call the dialog from the JottyWindow's open_file function. Creating the OpenDialog is exactly the same as creating the SaveDialog, except we also want to tell it to load the titles before we run it:"
814msgstr ""
815
816#: quickly-ubuntu-application-tutorial.xml:586(code)
817msgid "opener = OpenDialog.NewOpenDialog() result = opener.run()"
818msgstr ""
819
820#: quickly-ubuntu-application-tutorial.xml:589(title)
821msgid "Get the id for the selected title"
822msgstr ""
823
824#: quickly-ubuntu-application-tutorial.xml:589(para)
825msgid "<placeholder-1/> Now use the property that we created to retrieve the title and text from the dialog. Don't forget to check the response type before going on."
826msgstr ""
827
828#: quickly-ubuntu-application-tutorial.xml:592(code)
829msgid "rec_id = opener.selected_record_id #close the dialog, and check whether to proceed opener.destroy() if result != gtk.RESPONSE_OK: return"
830msgstr ""
831
832#: quickly-ubuntu-application-tutorial.xml:600(para)
833msgid "<placeholder-1/> If nothing was selected, we'll just return. Otherwise, we'll retrieve the record from CouchDB and pull out the text for the document:"
834msgstr ""
835
836#: quickly-ubuntu-application-tutorial.xml:603(code)
837msgid "#get the record from CouchDB and extract the text if rec_id == None: return record = self.database.get_record(rec_id) text = record[\"text\"]"
838msgstr ""
839
840#: quickly-ubuntu-application-tutorial.xml:609(para)
841msgid "<placeholder-1/> Now just put the text into the texview:"
842msgstr ""
843
844#: quickly-ubuntu-application-tutorial.xml:612(code)
845msgid "#set the UI to display the string buff = self.builder.get_object(\"textview1\").get_buffer() buff.set_text(text)"
846msgstr ""
847
848#: quickly-ubuntu-application-tutorial.xml:615(para)
849msgid "That's all there is to it. So the whole open_file function looks like this:"
850msgstr ""
851
852#: quickly-ubuntu-application-tutorial.xml:617(code)
853msgid "def open_file(self, widget, data=None): #run the open dialog opener = OpenDialog.NewOpenDialog() result = opener.run() #get the record id from the dialog rec_id = opener.selected_record_id #close the dialog, and check whether to proceed opener.destroy() if result != gtk.RESPONSE_OK: return #get the record from CouchDB and extract the text if rec_id == None: return record = self.database.get_record(rec_id) text = record[\"text\"] #set the UI to display the string buff = self.builder.get_object(\"textview1\").get_buffer() buff.set_text(text)"
854msgstr ""
855
856#: quickly-ubuntu-application-tutorial.xml:639(para)
857msgid "Now users get a nice open dialog:"
858msgstr ""
859
860#: quickly-ubuntu-application-tutorial.xml:644(para)
861msgid "However, the application is not complete. There are a few things left for you to do:"
862msgstr ""
863
864#: quickly-ubuntu-application-tutorial.xml:647(para)
865msgid "Set the title of the JottyWindow to display the note title. Try self.set_text(title)."
866msgstr ""
867
868#: quickly-ubuntu-application-tutorial.xml:650(para)
869msgid "The Save command works more like \"Save As\". The application probably shouldn't pop up a SaveDialog every time you want to save. If it's already been saved, you probably just want to save it, but use a SaveDialog when the user choose Save As, or is saving a document for the first time."
870msgstr ""
871
872#: quickly-ubuntu-application-tutorial.xml:653(para)
873msgid "The OpenDialog should probably return when the user double clicks on an item in the list. Try connecting to the \"select-cursor-row\" signal on the TreeView, and calling self.response(gtk.RESPONSE_OK) in the handler."
874msgstr ""
875
876#: quickly-ubuntu-application-tutorial.xml:656(para)
877msgid "Perhaps the Ok button in the OpenDialog should be disabled if nothing is selected. Try setting the \"sensitivity\" in Glade, and the set_sensitive function for the Ok button."
878msgstr ""
879
880#: quickly-ubuntu-application-tutorial.xml:659(para)
881msgid "It would be more consistent for the Open and Close dialogs to have \"Open\" and \"Close\" for buttons instead of \"Ok\". You can set a different type in the properties window in Glade."
882msgstr ""
883
884#: quickly-ubuntu-application-tutorial.xml:662(para)
885msgid "Loading every document into the open dialog is probably a bit inefficient. Perhaps storing the document id and using that to retrieve the document would be a better implementation."
886msgstr ""
887
888#: quickly-ubuntu-application-tutorial.xml:668(title)
889msgid "Introduction to <application>Quickly</application> Part 3"
890msgstr ""
891
892#: quickly-ubuntu-application-tutorial.xml:669(para)
893msgid "In parts 1 and 2, we showed how to create a simple Ubuntu application using <application>Quickly</application>. This section will cover how to package an application so that it is easy for you to share, and easy for other people to install."
894msgstr ""
895
896#: quickly-ubuntu-application-tutorial.xml:670(title)
897msgid "License your Application"
898msgstr ""
899
900#: quickly-ubuntu-application-tutorial.xml:670(para)
901msgid "<placeholder-1/> It's important to license your code so users and other programmers know their rights in terms of redistributing or modifying it. To <application>Quickly</application> grant a GPL license to your code, simply:"
902msgstr ""
903
904#: quickly-ubuntu-application-tutorial.xml:674(para)
905msgid "Specify your name and email address in the Copyright file."
906msgstr ""
907
908#: quickly-ubuntu-application-tutorial.xml:677(para)
909msgid "Run the \"license\" command."
910msgstr ""
911
912#: quickly-ubuntu-application-tutorial.xml:681(title)
913msgid "Specify your name and email"
914msgstr ""
915
916#: quickly-ubuntu-application-tutorial.xml:681(para)
917msgid "<placeholder-1/> When <application>Quickly</application> created your ubuntu application, it added a file named Copyright in the top level of the directory. Open this file in your text editor, and modify the top line so it has your name and email included. Be sure not to modify other lines as it will interfere with the next step. For example, I would change the entire file to look like this:"
918msgstr ""
919
920#: quickly-ubuntu-application-tutorial.xml:684(code)
921msgid "# Copyright (C) 2009 Rick Spencer rick.spencer@canonical.com ### BEGIN AUTOMATIC LICENSE GENERATION ### END AUTOMATIC LICENSE GENERATION"
922msgstr ""
923
924#: quickly-ubuntu-application-tutorial.xml:688(title)
925msgid "Run the \"License\" Command"
926msgstr ""
927
928#: quickly-ubuntu-application-tutorial.xml:688(para)
929msgid "<placeholder-1/> By default, <application>Quickly</application> will use a GPL 3 license for your project. To use this license, use this command:"
930msgstr ""
931
932#: quickly-ubuntu-application-tutorial.xml:690(code) quickly-ubuntu-application-tutorial.xml:712(code)
933msgid "<placeholder-1/> license"
934msgstr ""
935
936#: quickly-ubuntu-application-tutorial.xml:693(para)
937msgid "This will add the GPL 3 license to all of your code files that you've added to your project using <application>Quickly</application>."
938msgstr ""
939
940#: quickly-ubuntu-application-tutorial.xml:694(para)
941msgid "Keep in mind a couple of things:"
942msgstr ""
943
944#: quickly-ubuntu-application-tutorial.xml:697(para)
945msgid "This is a one way trip. Once you license the project, changes to the license must be done manually."
946msgstr ""
947
948#: quickly-ubuntu-application-tutorial.xml:700(para)
949msgid "If you prefer a GPL 2 license, you can specify that when you issue the license command:"
950msgstr ""
951
952#: quickly-ubuntu-application-tutorial.xml:701(code)
953msgid "<placeholder-1/> license GPL-2"
954msgstr ""
955
956#: quickly-ubuntu-application-tutorial.xml:706(para)
957msgid "<application>Quickly</application> doesn't care what license you use, but only knows natively what files and headers to include for BSD, GPL-2, GPL-3, LGPL-2 and LGPL-3. If you prefer another license, you can simply add whatever you license you like by adding your own license in the Copyright file:"
958msgstr ""
959
960#: quickly-ubuntu-application-tutorial.xml:708(code)
961msgid "### BEGIN AUTOMATIC LICENSE GENERATION # My personal license here ### END AUTOMATIC LICENSE GENERATION"
962msgstr ""
963
964#: quickly-ubuntu-application-tutorial.xml:711(para)
965msgid "and then run:"
966msgstr ""
967
968#: quickly-ubuntu-application-tutorial.xml:715(para)
969msgid "to license every files."
970msgstr ""
971
972#: quickly-ubuntu-application-tutorial.xml:718(para)
973msgid "If you've added code files or other files to your project manually, you will need to add the license to those files manually or add those tags at the beginning of the file:"
974msgstr ""
975
976#: quickly-ubuntu-application-tutorial.xml:720(code)
977msgid "### BEGIN LICENSE ### END LICENSE"
978msgstr ""
979
980#: quickly-ubuntu-application-tutorial.xml:725(title)
981msgid "Translate Your Application"
982msgstr ""
983
984#: quickly-ubuntu-application-tutorial.xml:725(para)
985msgid "<placeholder-1/> To allow for users from other countries to use your application you may want to translate it. Glade automatically creates a pot file for you but to translate strings in your code you have to:"
986msgstr ""
987
988#: quickly-ubuntu-application-tutorial.xml:727(code)
989msgid "import gettext"
990msgstr ""
991
992#: quickly-ubuntu-application-tutorial.xml:728(code)
993msgid "gettext.gettext(\"What you want translated\")"
994msgstr ""
995
996#: quickly-ubuntu-application-tutorial.xml:730(title)
997msgid "Specify Application Settings"
998msgstr ""
999
1000#: quickly-ubuntu-application-tutorial.xml:730(para)
1001msgid "<placeholder-1/> You should personalize your application a little before creating the archive. This is very easy to do, as all of the files that you need have already been created, and only need a few lines changed to make them your own. To do this you should:"
1002msgstr ""
1003
1004#: quickly-ubuntu-application-tutorial.xml:734(para)
1005msgid "Personalize the Application Icon"
1006msgstr ""
1007
1008#: quickly-ubuntu-application-tutorial.xml:735(para) quickly-ubuntu-application-tutorial.xml:749(title)
1009msgid "Edit the Desktop File"
1010msgstr ""
1011
1012#: quickly-ubuntu-application-tutorial.xml:736(para)
1013msgid "Edit the setup.py File"
1014msgstr ""
1015
1016#: quickly-ubuntu-application-tutorial.xml:739(title)
1017msgid "Personalize your Application Icon"
1018msgstr ""
1019
1020#: quickly-ubuntu-application-tutorial.xml:739(para)
1021msgid "<placeholder-1/> When users install your application, Ubuntu will display an icon next to it in the menus. You can create your own icon or edit the file called \"icon.png\" in the media directory (jotty/data/media). Ubuntu comes with a great image editing program called \"Gimp.\" So you can go:"
1022msgstr ""
1023
1024#: quickly-ubuntu-application-tutorial.xml:741(code)
1025msgid "gimp data/media/icon.png"
1026msgstr ""
1027
1028#: quickly-ubuntu-application-tutorial.xml:747(para)
1029msgid "If you don't personalize the icon, it's ok, your app will just have the default icon, such as in the image below."
1030msgstr ""
1031
1032#: quickly-ubuntu-application-tutorial.xml:749(para)
1033msgid "<placeholder-1/> By default, <application>Quickly</application> Ubuntu applications are classified as \"utilities\", so they show up under the Accessories menu in Ubuntu. If we wanted to make Jotty show up in another category, we can do this by editing the desktop file. A desktop file is a file that describes your application to a Linux desktop. The file \"jottydesktop.in\" was automatically created in the jotty project directory. To change Jotty from a Utility to an Office application, edit jotty.desktop.in and change this:"
1034msgstr ""
1035
1036#: quickly-ubuntu-application-tutorial.xml:753(code)
1037msgid "[Desktop Entry] Name=Jotty Comment=Jotty application Categories=GNOME;Utility; Exec=jotty Icon=jotty Terminal=false Type=Application"
1038msgstr ""
1039
1040#: quickly-ubuntu-application-tutorial.xml:763(para)
1041msgid "to this:"
1042msgstr ""
1043
1044#: quickly-ubuntu-application-tutorial.xml:767(code)
1045msgid "[Desktop Entry] Name=Jotty Comment=Jotty application Categories=GNOME;Office; Exec=jotty Icon=jotty Terminal=false Type=Application"
1046msgstr ""
1047
1048#: quickly-ubuntu-application-tutorial.xml:775(para)
1049msgid "There are lots more categories that you can use, all defined by the FreeDesktop spec. You can see the complete list in the <ulink url=\"http://standards.freedesktop.org/menu-spec/latest/apa.html\">menu spec</ulink>."
1050msgstr ""
1051
1052#: quickly-ubuntu-application-tutorial.xml:779(title)
1053msgid "Edit Setup.py"
1054msgstr ""
1055
1056#: quickly-ubuntu-application-tutorial.xml:778(para)
1057msgid "<placeholder-1/> Finally, you should include some information in the setup.py file to tell your users a little about yourself. The setup.py file was created for you, just like the desktop file. Most of of the setup.py file shouldn't be modified, as it is just boiler plate that makes your application work properly after it has been installed. However, there is a section at the bottom of the setup.py file that you should edit to describe yourself and the application."
1058msgstr ""
1059
1060#: quickly-ubuntu-application-tutorial.xml:782(para)
1061msgid "So I would change this section:"
1062msgstr ""
1063
1064#: quickly-ubuntu-application-tutorial.xml:786(code)
1065msgid "DistUtilsExtra.auto.setup( name='jotty', version='0.1', license='GPL v3', #author='Your Name', #author_email='email@ubuntu.com', #description='UI for managing …', #long_description='Here a longer description', #url='https://launchpad.net/jotty', cmdclass={'install': InstallAndUpdateDataDirectory} )"
1066msgstr ""
1067
1068#: quickly-ubuntu-application-tutorial.xml:798(para)
1069msgid "To look like this:"
1070msgstr ""
1071
1072#: quickly-ubuntu-application-tutorial.xml:802(code)
1073msgid "DistUtilsExtra.auto.setup( name='jotty', version='0.1', license='GPL v3', author='Rick Spencer', author_email='rick.spencer@canonical.com', description='Note taking application', long_description='Note taking application that uses CouchDB as the backend to support easy replication across users and computers.', #url='https://launchpad.net/jotty', cmdclass={'install': InstallAndUpdateDataDirectory} )"
1074msgstr ""
1075
1076#: quickly-ubuntu-application-tutorial.xml:813(para)
1077msgid "Note that the license has already been set up for you. author and author_email are updated each time you connect to Launchpad (with <application>Quickly</application> release or <application>Quickly</application> share) with your Launchpad real name and preferred email adress."
1078msgstr ""
1079
1080#: quickly-ubuntu-application-tutorial.xml:814(para)
1081msgid "Notice that Jotty doesn't have a web page yet, so I just left that line commented out. Also, you don't have to increment version number as <application>Quickly</application> share and <application>Quickly</application> release commands will make it for you.."
1082msgstr ""
1083
1084#: quickly-ubuntu-application-tutorial.xml:818(title)
1085msgid "Create and Test the Debian Archive"
1086msgstr ""
1087
1088#: quickly-ubuntu-application-tutorial.xml:818(para)
1089msgid "<placeholder-1/> After personalizing the project, we are now ready to create the package. This is easily done by issuing the package command:"
1090msgstr ""
1091
1092#: quickly-ubuntu-application-tutorial.xml:821(code) quickly-ubuntu-application-tutorial.xml:1023(code)
1093msgid "<placeholder-1/> package"
1094msgstr ""
1095
1096#: quickly-ubuntu-application-tutorial.xml:824(para)
1097msgid "This command will take a little while to discover dependencies and create all the required archives, etc... It will also report some errors as we haven't created a PGP key, for instance. None the less, when it is done, the package will be created. Using the file browser, you can see the created package next to the project directory:"
1098msgstr ""
1099
1100#: quickly-ubuntu-application-tutorial.xml:828(para)
1101msgid "Right now, the specific file we are interested in is \"jotty_0.1_all.deb\". To test it out, double click on it, to open it in Ubuntu's graphical installer program:"
1102msgstr ""
1103
1104#: quickly-ubuntu-application-tutorial.xml:832(para)
1105msgid "Click \"Install Package\" to see how it installs onto your desktop. After chugging for a bit, you'll see that it is installed in the Applications-&gt;Office menu. If you customized your icon, you'll see that the menu uses your custom icon as well."
1106msgstr ""
1107
1108#: quickly-ubuntu-application-tutorial.xml:836(title)
1109msgid "Now that you have a package"
1110msgstr ""
1111
1112#: quickly-ubuntu-application-tutorial.xml:836(para)
1113msgid "<placeholder-1/> Now that you've packaged your application, you can share the .deb file. However, if your users install their application this way, and you update the application, your users will have to find this out and resinstall. This hassle can be avoided in Ubuntu by using Personal Package Archives (or PPAs). Distrubuting your applications in this manner is covered in section 4 (not yet available)."
1114msgstr ""
1115
1116#: quickly-ubuntu-application-tutorial.xml:840(title)
1117msgid "<application>Quickly</application>: <application>Quickly</application> Command Reference"
1118msgstr ""
1119
1120#: quickly-ubuntu-application-tutorial.xml:841(para)
1121msgid "The ubuntu-application template template contains the following commands."
1122msgstr ""
1123
1124#: quickly-ubuntu-application-tutorial.xml:844(xref) quickly-ubuntu-application-tutorial.xml:877(title) quickly-ubuntu-application-tutorial.xml:878(title)
1125msgid "create"
1126msgstr ""
1127
1128#: quickly-ubuntu-application-tutorial.xml:847(xref) quickly-ubuntu-application-tutorial.xml:904(title) quickly-ubuntu-application-tutorial.xml:905(title)
1129msgid "dialog"
1130msgstr ""
1131
1132#: quickly-ubuntu-application-tutorial.xml:850(xref) quickly-ubuntu-application-tutorial.xml:949(title) quickly-ubuntu-application-tutorial.xml:950(title)
1133msgid "edit"
1134msgstr ""
1135
1136#: quickly-ubuntu-application-tutorial.xml:853(xref)
1137msgid "design"
1138msgstr ""
1139
1140#: quickly-ubuntu-application-tutorial.xml:856(xref) quickly-ubuntu-application-tutorial.xml:973(title) quickly-ubuntu-application-tutorial.xml:974(title)
1141msgid "help"
1142msgstr ""
1143
1144#: quickly-ubuntu-application-tutorial.xml:859(xref) quickly-ubuntu-application-tutorial.xml:982(title) quickly-ubuntu-application-tutorial.xml:983(title)
1145msgid "license"
1146msgstr ""
1147
1148#: quickly-ubuntu-application-tutorial.xml:862(xref) quickly-ubuntu-application-tutorial.xml:1021(title) quickly-ubuntu-application-tutorial.xml:1022(title)
1149msgid "package"
1150msgstr ""
1151
1152#: quickly-ubuntu-application-tutorial.xml:865(xref) quickly-ubuntu-application-tutorial.xml:1038(title) quickly-ubuntu-application-tutorial.xml:1039(title)
1153msgid "release"
1154msgstr ""
1155
1156#: quickly-ubuntu-application-tutorial.xml:868(xref) quickly-ubuntu-application-tutorial.xml:1073(title) quickly-ubuntu-application-tutorial.xml:1074(title)
1157msgid "run"
1158msgstr ""
1159
1160#: quickly-ubuntu-application-tutorial.xml:871(xref) quickly-ubuntu-application-tutorial.xml:1083(title) quickly-ubuntu-application-tutorial.xml:1084(title)
1161msgid "save"
1162msgstr ""
1163
1164#: quickly-ubuntu-application-tutorial.xml:874(xref) quickly-ubuntu-application-tutorial.xml:1098(title) quickly-ubuntu-application-tutorial.xml:1100(title)
1165msgid "share"
1166msgstr ""
1167
1168#: quickly-ubuntu-application-tutorial.xml:878(para) quickly-ubuntu-application-tutorial.xml:905(para) quickly-ubuntu-application-tutorial.xml:950(para) quickly-ubuntu-application-tutorial.xml:961(para) quickly-ubuntu-application-tutorial.xml:974(para) quickly-ubuntu-application-tutorial.xml:983(para) quickly-ubuntu-application-tutorial.xml:1022(para) quickly-ubuntu-application-tutorial.xml:1039(para) quickly-ubuntu-application-tutorial.xml:1074(para) quickly-ubuntu-application-tutorial.xml:1084(para) quickly-ubuntu-application-tutorial.xml:1099(para)
1169msgid "<placeholder-1/> Usage:"
1170msgstr ""
1171
1172#: quickly-ubuntu-application-tutorial.xml:880(code)
1173msgid "<placeholder-1/> create ubuntu-application path/to/project_name"
1174msgstr ""
1175
1176#: quickly-ubuntu-application-tutorial.xml:882(para)
1177msgid "where \"project_name\" is one or more words separated by an underscore and path/to can be any existing path."
1178msgstr ""
1179
1180#: quickly-ubuntu-application-tutorial.xml:885(para)
1181msgid "This will create and run a new project, including Python code, Glade files, and packaging files to make the project work. After creating the project, get started by:"
1182msgstr ""
1183
1184#: quickly-ubuntu-application-tutorial.xml:891(para)
1185msgid "Changing your working directory to the new project:"
1186msgstr ""
1187
1188#: quickly-ubuntu-application-tutorial.xml:893(code)
1189msgid "cd path/to/project_name"
1190msgstr ""
1191
1192#: quickly-ubuntu-application-tutorial.xml:895(para)
1193msgid "Edit the UI with Glade:"
1194msgstr ""
1195
1196#: quickly-ubuntu-application-tutorial.xml:898(para)
1197msgid "Edit the Python code:"
1198msgstr ""
1199
1200#: quickly-ubuntu-application-tutorial.xml:907(code)
1201msgid "<placeholder-1/> dialog dialog_name"
1202msgstr ""
1203
1204#: quickly-ubuntu-application-tutorial.xml:908(para)
1205msgid "where dialog_name is one or more words seperated with underscore"
1206msgstr ""
1207
1208#: quickly-ubuntu-application-tutorial.xml:909(para)
1209msgid "This will create:"
1210msgstr ""
1211
1212#: quickly-ubuntu-application-tutorial.xml:913(para)
1213msgid "A subclass of gtk.Dialog called DialogNameDialog in the module DialogNameDialog.py"
1214msgstr ""
1215
1216#: quickly-ubuntu-application-tutorial.xml:916(para)
1217msgid "A glade file called DialogNameDialog.ui in the ui directory"
1218msgstr ""
1219
1220#: quickly-ubuntu-application-tutorial.xml:919(para)
1221msgid "A catalog file called dialog_name_dialog.xml also in the ui directory"
1222msgstr ""
1223
1224#: quickly-ubuntu-application-tutorial.xml:922(para)
1225msgid "To edit the UI for the dialog, run:"
1226msgstr ""
1227
1228#: quickly-ubuntu-application-tutorial.xml:926(para)
1229msgid "To edit the behavior, run:"
1230msgstr ""
1231
1232#: quickly-ubuntu-application-tutorial.xml:929(para)
1233msgid "To use the dialog you have to invoke it from another python file:"
1234msgstr ""
1235
1236#: quickly-ubuntu-application-tutorial.xml:933(code)
1237msgid "Import the dialog import DialogNameDialog"
1238msgstr ""
1239
1240#: quickly-ubuntu-application-tutorial.xml:937(code)
1241msgid "Create an instance of the dialog dialog = DialogNameDialog.NewDialogNameDialog()"
1242msgstr ""
1243
1244#: quickly-ubuntu-application-tutorial.xml:941(code)
1245msgid "Run the dialog and hide the dialog result = dialog.run() dialog.hide()"
1246msgstr ""
1247
1248#: quickly-ubuntu-application-tutorial.xml:954(para)
1249msgid "A convenience command to open all of your python files in your project directory in your default editor, ready for editing."
1250msgstr ""
1251
1252#: quickly-ubuntu-application-tutorial.xml:960(title) quickly-ubuntu-application-tutorial.xml:961(title)
1253msgid "glade"
1254msgstr ""
1255
1256#: quickly-ubuntu-application-tutorial.xml:964(para)
1257msgid "Opens Glade UI editor so that you can edit the UI for dialogs and windows in your project. Note that you *must* open Glade in this manner for <application>Quickly</application> to work. If you try to open Glade directly, and the open the UI files, Glade will throw errors and won't open the files."
1258msgstr ""
1259
1260#: quickly-ubuntu-application-tutorial.xml:975(code)
1261msgid "<placeholder-1/> help"
1262msgstr ""
1263
1264#: quickly-ubuntu-application-tutorial.xml:977(para)
1265msgid "Opens a web browser with the help index."
1266msgstr ""
1267
1268#: quickly-ubuntu-application-tutorial.xml:984(code)
1269msgid "<placeholder-1/> license &lt;Your_Licence="
1270msgstr ""
1271
1272#: quickly-ubuntu-application-tutorial.xml:986(para)
1273msgid "Adds license to project files. Before using this command, you should:"
1274msgstr ""
1275
1276#: quickly-ubuntu-application-tutorial.xml:990(para)
1277msgid "run <application>Quickly</application> save in case something goes wrong"
1278msgstr ""
1279
1280#: quickly-ubuntu-application-tutorial.xml:993(para)
1281msgid "Edit the file Copyright to include your authorship."
1282msgstr ""
1283
1284#: quickly-ubuntu-application-tutorial.xml:995(para)
1285msgid "If you want to put your own <application>Quickly</application> unsupported Licence, remove and replace the tags ### BEGIN AUTOMATIC LICENCE GENERATION and ### END AUTOMATIC LICENCE GENERATION in it by your own licence."
1286msgstr ""
1287
1288#: quickly-ubuntu-application-tutorial.xml:999(para)
1289msgid "Executes either <code><application>Quickly</application> license</code> or <code><application>Quickly</application> licence &lt;License=</code> where &lt;License= can be either: - GPL-3 (default) - GPL-2"
1290msgstr ""
1291
1292#: quickly-ubuntu-application-tutorial.xml:1006(para)
1293msgid "This will modify the Copyright file with the chosen licence (with GPL-3 by default). Updating previous chosen Licence if needed. If you previously removed the tags to add your own licence, it will leave it pristine. If no name is attributed to the Copyright, it will try to retrieve it from Launchpad (in <application>Quickly</application> release or <application>Quickly</application> share command only)"
1294msgstr ""
1295
1296#: quickly-ubuntu-application-tutorial.xml:1012(para)
1297msgid "Finally, this will copy the Copyright at the head of every files."
1298msgstr ""
1299
1300#: quickly-ubuntu-application-tutorial.xml:1014(para)
1301msgid "Note that if you don't run <application>Quickly</application> licence before calling <application>Quickly</application> release or <application>Quickly</application> share, this one will execute it for you and guess the copyright holder from your launchpad account if you didn't update it."
1302msgstr ""
1303
1304#: quickly-ubuntu-application-tutorial.xml:1025(para)
1305msgid "Creates a debian file (deb) from your project. Before running the package command you can edit the Icon and Category entry of *.desktop.in file, where * is the name of your project."
1306msgstr ""
1307
1308#: quickly-ubuntu-application-tutorial.xml:1029(para)
1309msgid "Note that if you didn't run <application>Quickly</application> release, <application>Quickly</application> share or <application>Quickly</application> change-lp-project you may miss the name, email in setup.py. You can edit them if you don't want to use any of these commands afterwards. Those changes are not a mandatory at all for testing purpose."
1310msgstr ""
1311
1312#: quickly-ubuntu-application-tutorial.xml:1040(code)
1313msgid "<placeholder-1/> release"
1314msgstr ""
1315
1316#: quickly-ubuntu-application-tutorial.xml:1042(para)
1317msgid "Posts a release of your project to a PPA on launchpad so that users can install the application on their system."
1318msgstr ""
1319
1320#: quickly-ubuntu-application-tutorial.xml:1045(para)
1321msgid "You can also execute: <code><application>Quickly</application> release &lt;release_number=</code> of you don't want to use current release_number. The release_number must be a number."
1322msgstr ""
1323
1324#: quickly-ubuntu-application-tutorial.xml:1049(para)
1325msgid "<code><application>Quickly</application> release &lt;release_number=</code> notes about changes where \"notes about changes\" is optional text describing what changes were made since the last save"
1326msgstr ""
1327
1328#: quickly-ubuntu-application-tutorial.xml:1053(para)
1329msgid "Before running <application>Quickly</application> release, you should: create your account and a project page on http://launchpad.net. You also have to add a PPA to your launchpad account."
1330msgstr ""
1331
1332#: quickly-ubuntu-application-tutorial.xml:1057(para)
1333msgid "Name, email and version setup.py will be automatically changed. (version will be &lt;current_release= and bzr will commit and tagged. Once the release is done, &lt;current_release= will be incremented by 0.1 to be ready for next release."
1334msgstr ""
1335
1336#: quickly-ubuntu-application-tutorial.xml:1062(para)
1337msgid "If you previously used <application>Quickly</application> shared &lt;current_release=~publicX will be dropped to release &lt;current_release= version (&lt;current_release=~publicX &lt;current_release=) You can modify the description and long description if you wish."
1338msgstr ""
1339
1340#: quickly-ubuntu-application-tutorial.xml:1067(para)
1341msgid "You can run <code><application>Quickly</application> package</code> and test your package to make sure it installs as expected. (This is not mandatory)"
1342msgstr ""
1343
1344#: quickly-ubuntu-application-tutorial.xml:1077(para)
1345msgid "Runs your application. This is the best way to try test it out while you are developing it. It starts up the main project window."
1346msgstr ""
1347
1348#: quickly-ubuntu-application-tutorial.xml:1085(code)
1349msgid "<placeholder-1/> save notes about changes"
1350msgstr ""
1351
1352#: quickly-ubuntu-application-tutorial.xml:1087(para)
1353msgid "where \"notes about changes\" is optional text describing what changes were made since the last save."
1354msgstr ""
1355
1356#: quickly-ubuntu-application-tutorial.xml:1090(para)
1357msgid "This command commits all changes since the last save to bzr. Note that it does not push changes to any back up location. If you need revert or otherwise use the revision control, use bzr directly: <code>bzr help</code>"
1358msgstr ""
1359
1360#: quickly-ubuntu-application-tutorial.xml:1101(code)
1361msgid "<placeholder-1/> share"
1362msgstr ""
1363
1364#: quickly-ubuntu-application-tutorial.xml:1103(para)
1365msgid "Updates your PPA with the the latest saved project changes."
1366msgstr ""
1367
1368#: quickly-ubuntu-application-tutorial.xml:1105(para)
1369msgid "Before running <application>Quickly</application> release, you should: create your account on http://launchpad.net. You also have to add a PPA to your launchpad account."
1370msgstr ""
1371
1372#: quickly-ubuntu-application-tutorial.xml:1109(para)
1373msgid "Name, email and version setup.py will be automatically changed. (version will be &lt;current_release~publicX= where X will be incremented at each <application>Quickly</application> share execution) You can modify the description and long description if you wish."
1374msgstr ""
1375
1376#: quickly-ubuntu-application-tutorial.xml:1119(title)
1377msgid "Links"
1378msgstr ""
1379
1380#: quickly-ubuntu-application-tutorial.xml:1121(link)
1381msgid "<placeholder-1/>: <placeholder-2/> Command Reference"
1382msgstr ""
1383
1384#: quickly-ubuntu-application-tutorial.xml:1124(ulink)
1385msgid "Blog post on <placeholder-1/>"
1386msgstr ""
1387
1388#: quickly-ubuntu-application-tutorial.xml:1127(ulink)
1389msgid "Language: Python Language Reference"
1390msgstr ""
1391
1392#: quickly-ubuntu-application-tutorial.xml:1130(ulink)
1393msgid "Core Library: Python 2.6 Library Reference"
1394msgstr ""
1395
1396#: quickly-ubuntu-application-tutorial.xml:1133(ulink)
1397msgid "UI Library: PyGtk"
1398msgstr ""
1399
1400#: quickly-ubuntu-application-tutorial.xml:1136(ulink)
1401msgid "Database: CouchDB Reference"
1402msgstr ""
1403
1404#: quickly-ubuntu-application-tutorial.xml:1139(ulink)
1405msgid "UI Editing: Glade User Documenation"
1406msgstr ""
1407
1408#: quickly-ubuntu-application-tutorial.xml:1142(ulink)
1409msgid "Editor: Gedit Help"
1410msgstr ""
1411
1412#: quickly-ubuntu-application-tutorial.xml:1145(ulink)
1413msgid "Version Control: Bazaar"
1414msgstr ""
1415
1416#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2
1417#: quickly-ubuntu-application-tutorial.xml:0(None)
1418msgid "translator-credits"
1419msgstr ""
1420
01421
=== added file 'data/templates/ubuntu-application/help/po/quickly-ubuntu-application-tutorial.pot'
--- data/templates/ubuntu-application/help/po/quickly-ubuntu-application-tutorial.pot 1970-01-01 00:00:00 +0000
+++ data/templates/ubuntu-application/help/po/quickly-ubuntu-application-tutorial.pot 2010-03-12 17:35:32 +0000
@@ -0,0 +1,2387 @@
1# SOME DESCRIPTIVE TITLE.
2# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
3#
4#, fuzzy
5msgid ""
6msgstr ""
7"Project-Id-Version: PACKAGE VERSION\n"
8"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
9"POT-Creation-Date: 2010-03-04 15:22+0000\n"
10"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
13"MIME-Version: 1.0\n"
14"Content-Type: application/x-xml2pot; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16
17#. Tag: author
18#: quickly-ubuntu-application-tutorial.xml:12
19#, no-c-format
20msgid "<firstname>Shane</firstname> <surname>Fagan</surname>"
21msgstr ""
22
23#. Tag: author
24#: quickly-ubuntu-application-tutorial.xml:16
25#, no-c-format
26msgid "<firstname>Rick</firstname> <surname>Spencer</surname>"
27msgstr ""
28
29#. Tag: corpauthor
30#: quickly-ubuntu-application-tutorial.xml:20
31#, no-c-format
32msgid "Canonical ltd"
33msgstr ""
34
35#. Tag: title
36#: quickly-ubuntu-application-tutorial.xml:30
37#, no-c-format
38msgid "&appname; &appversion; User Guide"
39msgstr ""
40
41#. Tag: title
42#: quickly-ubuntu-application-tutorial.xml:35
43#, no-c-format
44msgid "About This Guide"
45msgstr ""
46
47#. Tag: para
48#: quickly-ubuntu-application-tutorial.xml:36
49#, no-c-format
50msgid "<application>Quickly</application> is a set of choices about writing apps for Ubuntu. Out of all the wonderful richness and variety of programming for Linux, <application>Quickly</application> make some very opinionated choices about what tools to use, and how to combine them. The criteria for these choices was to make it easy and fun to write and release Linux applications, even if it's your first time trying, but also in a way that delivers the full power and flexibility of the platform. One benefit of these choices, is that it's also easier to write tools that make it even easier and more fun. So <application>Quickly</application> is also a set of commands."
51msgstr ""
52
53#. Tag: link
54#: quickly-ubuntu-application-tutorial.xml:39
55#, no-c-format
56msgid "<link>Getting Started</link>"
57msgstr ""
58
59#. Tag: title
60#: quickly-ubuntu-application-tutorial.xml:45
61#, no-c-format
62msgid "<title>Getting Started</title>"
63msgstr ""
64
65#. Tag: para
66#: quickly-ubuntu-application-tutorial.xml:46
67#, no-c-format
68msgid "Welcome to the <application>Quickly</application> tutorial. In this guide you will learn how to get started using <application>Quickly</application>."
69msgstr ""
70
71#. Tag: link
72#: quickly-ubuntu-application-tutorial.xml:49
73#, no-c-format
74msgid "<link>Introduction to <application>Quickly</application> Part 1</link>"
75msgstr ""
76
77#. Tag: link
78#: quickly-ubuntu-application-tutorial.xml:52
79#, no-c-format
80msgid "<link>Introduction to <application>Quickly</application> Part 2</link>"
81msgstr ""
82
83#. Tag: link
84#: quickly-ubuntu-application-tutorial.xml:55
85#, no-c-format
86msgid "<link>Introduction to <application>Quickly</application> Part 3</link>"
87msgstr ""
88
89#. Tag: title
90#: quickly-ubuntu-application-tutorial.xml:61
91#, no-c-format
92msgid "<title>Introduction to <application>Quickly</application> Part 1</title>"
93msgstr ""
94
95#. Tag: para
96#: quickly-ubuntu-application-tutorial.xml:62
97#, no-c-format
98msgid "This part 1 of the <application>Quickly</application> tutorial. This part is will introduce some key <application>Quickly</application> commands, editing a user interface in Glade, and editing code in Gedit. This part of the tutorial will familiarize you with these three tools, and how they work together with python and pygtk so that you can <application>Quickly</application> build applications."
99msgstr ""
100
101#. Tag: title
102#: quickly-ubuntu-application-tutorial.xml:64
103#, no-c-format
104msgid "Creating a <application>Quickly</application> Project"
105msgstr ""
106
107#. Tag: para
108#: quickly-ubuntu-application-tutorial.xml:64
109#, no-c-format
110msgid "Creating an empty but working program couldn't be simpler. First, open a terminal window to type commands into. When it's open, type the command:"
111msgstr ""
112
113#. Tag: code
114#: quickly-ubuntu-application-tutorial.xml:65
115#, no-c-format
116msgid "<application>Quickly</application> create ubuntu-application jotty"
117msgstr ""
118
119#. Tag: para
120#: quickly-ubuntu-application-tutorial.xml:69
121#, no-c-format
122msgid "This will create a jotty sub directory containing a complete directory tree and files for an empty python application. The command finishes by running the newly created empty application."
123msgstr ""
124
125#. Tag: title
126#: quickly-ubuntu-application-tutorial.xml:73
127#, no-c-format
128msgid "Testing the Empty Application"
129msgstr ""
130
131#. Tag: para
132#: quickly-ubuntu-application-tutorial.xml:73
133#, no-c-format
134msgid "They are populated and set up, and you can resize the window. Notice that <application>Quickly</application> inferred that the application title is \"Jotty\". Only a few of menu items do anything in the empty application, Help->About, Edit->Preferences, and File->Quit."
135msgstr ""
136
137#. Tag: title
138#: quickly-ubuntu-application-tutorial.xml:77
139#, no-c-format
140msgid "Running the Application"
141msgstr ""
142
143#. Tag: para
144#: quickly-ubuntu-application-tutorial.xml:77
145#, no-c-format
146msgid "Close the application by closing the window or using the Quit command. Since the empty application isn't installed into Ubuntu yet, you can't start the application from the application menu yet. To start the applicaton, use the terminal to first cd into the new subdirectory, and then use \"<application>Quickly</application> run\" to start the program."
147msgstr ""
148
149#. Tag: code
150#: quickly-ubuntu-application-tutorial.xml:79
151#, no-c-format
152msgid "cd jotty"
153msgstr ""
154
155#. Tag: code
156#: quickly-ubuntu-application-tutorial.xml:80 quickly-ubuntu-application-tutorial.xml:180 quickly-ubuntu-application-tutorial.xml:897
157#, no-c-format
158msgid "<application>Quickly</application> run"
159msgstr ""
160
161#. Tag: title
162#: quickly-ubuntu-application-tutorial.xml:84
163#, no-c-format
164msgid "Editing an Application"
165msgstr ""
166
167#. Tag: title
168#: quickly-ubuntu-application-tutorial.xml:85
169#, no-c-format
170msgid "Edit the User Interface in Glade"
171msgstr ""
172
173#. Tag: para
174#: quickly-ubuntu-application-tutorial.xml:85
175#, no-c-format
176msgid "<application>Quickly</application> programs use Glade to edit the user interface. Start Glade with <application>Quickly</application> in order to set up Glade for editing the empty applicaton. Don't start glade directly, or it won't load the necessary catalogue files for editing the classes that were automaticaly generated by <application>Quickly</application>."
177msgstr ""
178
179#. Tag: code
180#: quickly-ubuntu-application-tutorial.xml:87 quickly-ubuntu-application-tutorial.xml:142 quickly-ubuntu-application-tutorial.xml:388 quickly-ubuntu-application-tutorial.xml:718 quickly-ubuntu-application-tutorial.xml:746 quickly-ubuntu-application-tutorial.xml:784
181#, no-c-format
182msgid "<application>Quickly</application> design"
183msgstr ""
184
185#. Tag: para
186#: quickly-ubuntu-application-tutorial.xml:91
187#, no-c-format
188msgid "Glade will open with the project loaded up and ready to edit."
189msgstr ""
190
191#. Tag: para
192#: quickly-ubuntu-application-tutorial.xml:95
193#, no-c-format
194msgid "Use the Project Menu to choose \"JottytWindow.ui\" for editing."
195msgstr ""
196
197#. Tag: para
198#: quickly-ubuntu-application-tutorial.xml:99
199#, no-c-format
200msgid "We want to create a text area for typing into. There are some default Widgets added to the Window. We won't need these so we'll start with deleting them. Click on the label, and press delete, and it will disappear from the window."
201msgstr ""
202
203#. Tag: para
204#: quickly-ubuntu-application-tutorial.xml:106
205#, no-c-format
206msgid "Do the same with the image widget. This leave us two free slots."
207msgstr ""
208
209#. Tag: para
210#: quickly-ubuntu-application-tutorial.xml:110
211#, no-c-format
212msgid "We'll use the bottom slot to add a TextView widget for the user to type into. In the toolbox, click on the TextView widget. Then click in the empty slot."
213msgstr ""
214
215#. Tag: para
216#: quickly-ubuntu-application-tutorial.xml:114
217#, no-c-format
218msgid "Make sure you save the file in Glade, or your changes won't take! Then run the application from terminal again. The window now has a place where the user can type."
219msgstr ""
220
221#. Tag: para
222#: quickly-ubuntu-application-tutorial.xml:118
223#, no-c-format
224msgid "Now we'll add the entry field for the title, and also a label for it. We'll use the top empty slot for that. First, click on Horizontal Box (HBox) from the \"Containers\" section of the pallette, and then click on the top slot. A dialog box will open, tell it that you want two items."
225msgstr ""
226
227#. Tag: para
228#: quickly-ubuntu-application-tutorial.xml:122
229#, no-c-format
230msgid "The HBox is a container that arranges it's children horizontally. Add a label to the empty left hand box, and a Text Entry to the right hand one."
231msgstr ""
232
233#. Tag: para
234#: quickly-ubuntu-application-tutorial.xml:126
235#, no-c-format
236msgid "Before going on, let's clean up the UI just a tad here. Select the new HBox from the treeview in the inspector window. Then go to the Packing tab, and set Expand and Fill to \"No\"."
237msgstr ""
238
239#. Tag: para
240#: quickly-ubuntu-application-tutorial.xml:130
241#, no-c-format
242msgid "Go to the General tab, and set spacing to 5."
243msgstr ""
244
245#. Tag: para
246#: quickly-ubuntu-application-tutorial.xml:134
247#, no-c-format
248msgid "Select the label. On the general tab, set \"Label\" to \"Name:\". Set expand and fill to \"no\" for the label, but keep it \"yes\" for the entry. Set the padding for both to 5 (also on the Packing tab)."
249msgstr ""
250
251#. Tag: title
252#: quickly-ubuntu-application-tutorial.xml:138
253#, no-c-format
254msgid "Add the Save, Open, and New Features"
255msgstr ""
256
257#. Tag: para
258#: quickly-ubuntu-application-tutorial.xml:138
259#, no-c-format
260msgid "After the user types something, they may want to save it. A File->Save menu item was automatically created when the empty applicaton was created, but it's not hooked up to any code. To make Save work, we need tell the menu item what function to call, and then create a function to actually do the saving."
261msgstr ""
262
263#. Tag: title
264#: quickly-ubuntu-application-tutorial.xml:140
265#, no-c-format
266msgid "Set the Signal Handler in Glade"
267msgstr ""
268
269#. Tag: para
270#: quickly-ubuntu-application-tutorial.xml:140
271#, no-c-format
272msgid "To tell the menu item what function to call. If glade is not still open, open up the application in glade:"
273msgstr ""
274
275#. Tag: para
276#: quickly-ubuntu-application-tutorial.xml:143
277#, no-c-format
278msgid "Click on the file menu, and the menu opens as if the application were running."
279msgstr ""
280
281#. Tag: para
282#: quickly-ubuntu-application-tutorial.xml:147
283#, no-c-format
284msgid "Choose the Save menu item, and it will be selected in Glade."
285msgstr ""
286
287#. Tag: para
288#: quickly-ubuntu-application-tutorial.xml:151
289#, no-c-format
290msgid "Then choose the \"Signals\" tab of the properties window."
291msgstr ""
292
293#. Tag: para
294#: quickly-ubuntu-application-tutorial.xml:155
295#, no-c-format
296msgid "In pygtk, 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. We'll call the function \"save_file\". Simply type the function name into the box for the activate signal.Make sure to save the glade file."
297msgstr ""
298
299#. Tag: para
300#: quickly-ubuntu-application-tutorial.xml:159
301#, no-c-format
302msgid "Note that you will need to setup the \"open_file\" signal and the \"new_file\" signal as well when you get to those functions later."
303msgstr ""
304
305#. Tag: title
306#: quickly-ubuntu-application-tutorial.xml:160
307#, no-c-format
308msgid "Edit the Code in Gedit"
309msgstr ""
310
311#. Tag: title
312#: quickly-ubuntu-application-tutorial.xml:161
313#, no-c-format
314msgid "Set Up Tabs Correctly"
315msgstr ""
316
317#. Tag: para
318#: quickly-ubuntu-application-tutorial.xml:161
319#, no-c-format
320msgid "Note a major gotcha here. In python spaces and tabs are totally different, but they look just the same in an editor. So being indented one tab stop is not the same as being indented four spaces, even though they might look the same. And indentation level is very important in python. You will get a lot of errors if you mix tab indentation with space indentation. Your generated project follows the python standard of using four spaces for each indentation level. So you'll either have to hit the space bar four time every time you indent, or set up your editor to use the right number of spaces for tabs."
321msgstr ""
322
323#. Tag: para
324#: quickly-ubuntu-application-tutorial.xml:163
325#, no-c-format
326msgid "The upshot is that you should take a moment to set up your Gedit (or whatever editor you are using) to use spaces for tabs. In Gedit, select Preferences from the Edit menu, and choose the Editor tab. Then set Tab width to 4, and turn on \"Insert spaces instead of tabs\". Your preferences should look like this:"
327msgstr ""
328
329#. Tag: title
330#: quickly-ubuntu-application-tutorial.xml:167
331#, no-c-format
332msgid "Create the Save File Signal Handler"
333msgstr ""
334
335#. Tag: para
336#: quickly-ubuntu-application-tutorial.xml:167
337#, no-c-format
338msgid "Now you're ready to write some code. Of course just telling the glade file what signal to emit won't make the file actually save, because we haven't created the \"save_file\" function yet. The code for JottyWindow is stored in the file jotty. jotty is a special python file that is the entry point for your application. Other python files in your application have the \".py\" suffix."
339msgstr ""
340
341#. Tag: para
342#: quickly-ubuntu-application-tutorial.xml:169
343#, no-c-format
344msgid "Use the <application>Quickly</application> edit command to start editing your code files:"
345msgstr ""
346
347#. Tag: code
348#: quickly-ubuntu-application-tutorial.xml:170 quickly-ubuntu-application-tutorial.xml:721 quickly-ubuntu-application-tutorial.xml:750 quickly-ubuntu-application-tutorial.xml:774
349#, no-c-format
350msgid "<application>Quickly</application> edit"
351msgstr ""
352
353#. Tag: para
354#: quickly-ubuntu-application-tutorial.xml:171
355#, no-c-format
356msgid "This will open the default Ubuntu text editor \"Gedit\" with any python files in the python directory."
357msgstr ""
358
359#. Tag: para
360#: quickly-ubuntu-application-tutorial.xml:175
361#, no-c-format
362msgid "JottyWindow.ui is now expecting to find a function JottyWindow.save_file(), so we simply add one to the JottyWindow class in the jotty file right under the on_destroy funtion.:"
363msgstr ""
364
365#. Tag: literallayout
366#: quickly-ubuntu-application-tutorial.xml:177
367#, no-c-format
368msgid ""
369 "<code>def save_file(self, widget, data=None):\n"
370 " print \"save\"</code>"
371msgstr ""
372
373#. Tag: para
374#: quickly-ubuntu-application-tutorial.xml:178
375#, no-c-format
376msgid "This will print the word \"save\" to the terminal when run. The method signature is the standard signature expected in a signal handler. If you are new to python, be sure to copy the indentations exactly, as the indentation level is very important in python."
377msgstr ""
378
379#. Tag: para
380#: quickly-ubuntu-application-tutorial.xml:179
381#, no-c-format
382msgid "Save the file, and run it again:"
383msgstr ""
384
385#. Tag: para
386#: quickly-ubuntu-application-tutorial.xml:183
387#, no-c-format
388msgid "Choose \"File->Save\" from the menu, and you'll see the word \"save\" printing out interminal. That's all there is to hookig up the functions!"
389msgstr ""
390
391#. Tag: title
392#: quickly-ubuntu-application-tutorial.xml:187
393#, no-c-format
394msgid "Implementing Save"
395msgstr ""
396
397#. Tag: para
398#: quickly-ubuntu-application-tutorial.xml:187
399#, no-c-format
400msgid "Now we'll write a little code in the signal handler to actually save the text. Because we want it to be easy for users to do things like syncronize their Jotty documents between computers, back it up, etc... we'll use couchdb as our backend, and we'll use desktopcouch for our api. Note that if you are not interested in learning about how to save to and read from couchdb, you can just snipe the code. Mostly likely you already have everything you need installed when you installed <application>Quickly</application>. But, you may need to install couchdb, desktopcouch, and the desktopcouch records api. The fastest way to do this is from the terminal:"
401msgstr ""
402
403#. Tag: code
404#: quickly-ubuntu-application-tutorial.xml:190
405#, no-c-format
406msgid "sudo apt-get install python-desktopcouch-records"
407msgstr ""
408
409#. Tag: para
410#: quickly-ubuntu-application-tutorial.xml:193
411#, no-c-format
412msgid "This will install the api, and everything you need for the api to run. After desktopcouch is installed, you can write the code. The code will do the following:"
413msgstr ""
414
415#. Tag: para
416#: quickly-ubuntu-application-tutorial.xml:196
417#, no-c-format
418msgid "Import the stuff you'll need from desktopcouch."
419msgstr ""
420
421#. Tag: para
422#: quickly-ubuntu-application-tutorial.xml:199
423#, no-c-format
424msgid "Get a reference to the couchdb database to save into."
425msgstr ""
426
427#. Tag: para
428#: quickly-ubuntu-application-tutorial.xml:202
429#, no-c-format
430msgid "Get the title of the document and the text from the user interface."
431msgstr ""
432
433#. Tag: para
434#: quickly-ubuntu-application-tutorial.xml:205
435#, no-c-format
436msgid "Check if there is already a document with the same title, and if so overwrite it."
437msgstr ""
438
439#. Tag: para
440#: quickly-ubuntu-application-tutorial.xml:208
441#, no-c-format
442msgid "If there is not a document already, create one."
443msgstr ""
444
445#. Tag: title
446#: quickly-ubuntu-application-tutorial.xml:211
447#, no-c-format
448msgid "Import the stuff you'll need from python-desktopcouch-records."
449msgstr ""
450
451#. Tag: para
452#: quickly-ubuntu-application-tutorial.xml:211
453#, no-c-format
454msgid "Add these import statements along with the other imports to the top of the jotty file:"
455msgstr ""
456
457#. Tag: literallayout
458#: quickly-ubuntu-application-tutorial.xml:213
459#, no-c-format
460msgid ""
461 "<code>from desktopcouch.records.server import CouchDatabase\n"
462 "from desktopcouch.records.record import Record</code>"
463msgstr ""
464
465#. Tag: title
466#: quickly-ubuntu-application-tutorial.xml:214
467#, no-c-format
468msgid "Get a Reference to the Database"
469msgstr ""
470
471#. Tag: para
472#: quickly-ubuntu-application-tutorial.xml:214
473#, no-c-format
474msgid "Desktopcouch will set up a database for us, or create a new one if it's needed. We'll use \"jotty\" for the name of the database. Since we want this line to run every time the Jotty Window is created, put it at the end of the finish_initializing function:"
475msgstr ""
476
477#. Tag: code
478#: quickly-ubuntu-application-tutorial.xml:216
479#, no-c-format
480msgid "self.database = CouchDatabase(\"jotty\", create=True)"
481msgstr ""
482
483#. Tag: para
484#: quickly-ubuntu-application-tutorial.xml:219
485#, no-c-format
486msgid "Now that we have an instance-wide reference to the database, we'll add code to the save_file function to run whenever the Save command is issued."
487msgstr ""
488
489#. Tag: para
490#: quickly-ubuntu-application-tutorial.xml:220
491#, no-c-format
492msgid "Here's the code to pull the title out of the title entry:"
493msgstr ""
494
495#. Tag: literallayout
496#: quickly-ubuntu-application-tutorial.xml:222
497#, no-c-format
498msgid ""
499 "<code>#get the title for the note\n"
500 "title = self.builder.get_object(\"entry1\").get_text()</code>"
501msgstr ""
502
503#. Tag: title
504#: quickly-ubuntu-application-tutorial.xml:223
505#, no-c-format
506msgid "Here's the code to get pull the text out of the TextView:"
507msgstr ""
508
509#. Tag: para
510#: quickly-ubuntu-application-tutorial.xml:223
511#, no-c-format
512msgid "In pygtk, TextView widgets have a text buffer that stores the text. So you ask the TextView for it's TextBuffer, and then you ask the TextBuffer for the text. You use iters to determine from which part of the text buffer you want text. Since we want all the text, it's easy to just get the start and end iters."
513msgstr ""
514
515#. Tag: literallayout
516#: quickly-ubuntu-application-tutorial.xml:226
517#, no-c-format
518msgid ""
519 "<code>#get the string\n"
520 "buff = self.builder.get_object(\"textview1\").get_buffer()\n"
521 "start_iter = buff.get_start_iter()\n"
522 "end_iter = buff.get_end_iter()\n"
523 "text = buff.get_text(start_iter,end_iter)\n"
524 "</code>"
525msgstr ""
526
527#. Tag: title
528#: quickly-ubuntu-application-tutorial.xml:227
529#, no-c-format
530msgid "Saving a document to Couchdb"
531msgstr ""
532
533#. Tag: para
534#: quickly-ubuntu-application-tutorial.xml:227
535#, no-c-format
536msgid "A record in couch is essentially a python dictionary with some extra key/value pairs to make the database work. So we can save the document to couch like this:"
537msgstr ""
538
539#. Tag: literallayout
540#: quickly-ubuntu-application-tutorial.xml:230
541#, no-c-format
542msgid ""
543 "<code>record_type = \"http://wiki.ubuntu.com/<application>Quickly</application>/JottyDoc\"\n"
544 "new_rec = Record({\"record_type\": record_type,\"title\":title, \"text\":text})\n"
545 "self.database.put(new_rec)</code>"
546msgstr ""
547
548#. Tag: para
549#: quickly-ubuntu-application-tutorial.xml:231
550#, no-c-format
551msgid "The \"record_type\" field is not strictly required, but among other things, it makes it easy to fetch the documents later. By convention, we use a url to specify the record type. This provides a place for other developers to go to read about the record type. The description only needs to be human readable. Couchdb is not a typed database, so don't expect that the url will have any kind of schema definition or anything. You can use whatever url you want, and put whatever you want at that URL."
552msgstr ""
553
554#. Tag: title
555#: quickly-ubuntu-application-tutorial.xml:232
556#, no-c-format
557msgid "Check for a pre-existing note with the same title"
558msgstr ""
559
560#. Tag: para
561#: quickly-ubuntu-application-tutorial.xml:232
562#, no-c-format
563msgid "Before we just write the new document though, we have to take note of the fact that couch will allow you to create as many documents as you want with the same title. We probably don't want this, so we we'll have to write a little code to check if there is already a document in couch with the same title, and if there is, update that document rather than create a new one."
564msgstr ""
565
566#. Tag: para
567#: quickly-ubuntu-application-tutorial.xml:234
568#, no-c-format
569msgid "In CouchDB, you don't do a lot of data processing in the database like you would with a relational database. To be most efficient, we could use the desktopcouch API to create a view in CouchDB, but it's probably simplest just to do the necessary processing on the client for now. To do this, we'll use a desktopcouch function to retrieve all of the records of a specified record type."
570msgstr ""
571
572#. Tag: para
573#: quickly-ubuntu-application-tutorial.xml:235
574#, no-c-format
575msgid "To find and update documents with a matching title we will:"
576msgstr ""
577
578#. Tag: para
579#: quickly-ubuntu-application-tutorial.xml:238 quickly-ubuntu-application-tutorial.xml:269
580#, no-c-format
581msgid "Retrieve all of the documents with the CouchDatabase.get_records function."
582msgstr ""
583
584#. Tag: para
585#: quickly-ubuntu-application-tutorial.xml:241 quickly-ubuntu-application-tutorial.xml:272
586#, no-c-format
587msgid "Check each of the returned records for a matching title."
588msgstr ""
589
590#. Tag: para
591#: quickly-ubuntu-application-tutorial.xml:244
592#, no-c-format
593msgid "If there is a match, update the record using the CouchDatabase.update_fields function and return."
594msgstr ""
595
596#. Tag: para
597#: quickly-ubuntu-application-tutorial.xml:247
598#, no-c-format
599msgid "This all may sound very weird, but in code, it's not quite so complicated:"
600msgstr ""
601
602#. Tag: literallayout
603#: quickly-ubuntu-application-tutorial.xml:249
604#, no-c-format
605msgid ""
606 "<code>#get all the records\n"
607 "record_type = \"http://wiki.ubuntu.com/<application>Quickly</application>/JottyDoc\"\n"
608 "results = self.database.get_records(record_type = record_type,create_view = True)\n"
609 "#update a record that has the same title\n"
610 "for result in results:\n"
611 " document = result.value\n"
612 " if document[\"title\"] == title:\n"
613 " key = document[\"_id\"]\n"
614 " self.database.update_fields(key, {\"text\":text})\n"
615 " return</code>"
616msgstr ""
617
618#. Tag: para
619#: quickly-ubuntu-application-tutorial.xml:250
620#, no-c-format
621msgid "So the whole function should look like this:"
622msgstr ""
623
624#. Tag: literallayout
625#: quickly-ubuntu-application-tutorial.xml:252
626#, no-c-format
627msgid ""
628 "<code>def save_file(self, widget, data=None): \n"
629 "#get the title for the note \n"
630 " title = self.builder.get_object(\"entry1\").get_text() \n"
631 "#get the text to save \n"
632 " buff = self.builder.get_object(\"textview1\").get_buffer() \n"
633 " start_iter = buff.get_start_iter() \n"
634 " end_iter = buff.get_end_iter() \n"
635 " text = buff.get_text(start_iter,end_iter) \n"
636 "#get all the records \n"
637 " record_type = \"http://wiki.ubuntu.com/<application>Quickly</application>/JottyDoc\" \n"
638 " results = self.database.get_records(record_type = record_type,create_view = True) \n"
639 "#update a record that has the same title \n"
640 " for result in results: \n"
641 " document = result.value \n"
642 " if document[\"title\"] == title: \n"
643 " key = result.key \n"
644 " self.database.update_fields(key, {\"text\":text}) \n"
645 " return \n"
646 "#if no records had the title, create it \n"
647 " new_rec = Record({\"record_type\":record_type,\"title\":title, \"text\":text})\n"
648 " self.database.put_record(new_rec)</code>"
649msgstr ""
650
651#. Tag: para
652#: quickly-ubuntu-application-tutorial.xml:254
653#, no-c-format
654msgid "Couchdb makes it really easy to see if your save function is working. You can just point your web browser at it and explore the database:"
655msgstr ""
656
657#. Tag: para
658#: quickly-ubuntu-application-tutorial.xml:255
659#, no-c-format
660msgid "file:///home/your_user_name>/.local/share/desktop-couch/couchdb.html"
661msgstr ""
662
663#. Tag: para
664#: quickly-ubuntu-application-tutorial.xml:259
665#, no-c-format
666msgid "If you are redirected to a page that doesn't work, you probably just need to clear your browser cache and try again."
667msgstr ""
668
669#. Tag: title
670#: quickly-ubuntu-application-tutorial.xml:260
671#, no-c-format
672msgid "Implementing Open and New"
673msgstr ""
674
675#. Tag: para
676#: quickly-ubuntu-application-tutorial.xml:260
677#, no-c-format
678msgid "To open a saved document, the user will type the title of the document that they want to open in the text entry, and choose \"Open\" from the main menu. If there is no matching document there, it will just clear out the text view, ready for input. This is probably not too intuitive, so we'll add a dialog box for prompting the user for the title, but that's for later in the tutorial. For now, we'll just use the same text entry field."
679msgstr ""
680
681#. Tag: title
682#: quickly-ubuntu-application-tutorial.xml:262
683#, no-c-format
684msgid "Implementing Open is essentially the reverse of Save:"
685msgstr ""
686
687#. Tag: para
688#: quickly-ubuntu-application-tutorial.xml:262
689#, no-c-format
690msgid "Follow these steps:"
691msgstr ""
692
693#. Tag: para
694#: quickly-ubuntu-application-tutorial.xml:266
695#, no-c-format
696msgid "Add the open_file signal to the menu item in Glade."
697msgstr ""
698
699#. Tag: para
700#: quickly-ubuntu-application-tutorial.xml:275
701#, no-c-format
702msgid "If there is a match, pull out the text and display it in the text view."
703msgstr ""
704
705#. Tag: para
706#: quickly-ubuntu-application-tutorial.xml:278
707#, no-c-format
708msgid "So the open_file function looks like so:"
709msgstr ""
710
711#. Tag: literallayout
712#: quickly-ubuntu-application-tutorial.xml:280
713#, no-c-format
714msgid ""
715 "<code>def open_file(self, widget, data=None):\n"
716 " #get the name of the document to open\n"
717 " title = self.builder.get_object(\"entry1\").get_text()\n"
718 " text = \"\"\n"
719 " \n"
720 " #get all the records\n"
721 " record_type = \"http://wiki.ubuntu.com/<application>Quickly</application>/JottyDoc\"\n"
722 " results = self.database.get_records(record_type = record_type,create_view = True)\n"
723 " \n"
724 " #get the text if there is a matching title\n"
725 " for result in results:\n"
726 " document = result.value\n"
727 " if document[\"title\"] == title:\n"
728 " text = document[\"text\"]\n"
729 " \n"
730 " #set the UI to display the string\n"
731 " buff = self.builder.get_object(\"textview1\").get_buffer()\n"
732 " buff.set_text(text)</code>"
733msgstr ""
734
735#. Tag: title
736#: quickly-ubuntu-application-tutorial.xml:281
737#, no-c-format
738msgid "Implement New"
739msgstr ""
740
741#. Tag: para
742#: quickly-ubuntu-application-tutorial.xml:281
743#, no-c-format
744msgid "First, add the new_file signal to the menu item in Glade, then add this code to clear out the text:"
745msgstr ""
746
747#. Tag: literallayout
748#: quickly-ubuntu-application-tutorial.xml:284
749#, no-c-format
750msgid ""
751 "<code>def new_file(self, widget, data=None):\n"
752 " self.builder.get_object(\"entry1\").set_text(\"Note Title\")\n"
753 " buff = self.builder.get_object(\"textview1\").get_buffer()\n"
754 " buff.set_text(\"\")</code>"
755msgstr ""
756
757#. Tag: para
758#: quickly-ubuntu-application-tutorial.xml:285
759#, no-c-format
760msgid "To make them work, add these functions to the JottyWindow class, and save. Then go back and connect the functions to the activate signals for the Open and New menu items."
761msgstr ""
762
763#. Tag: ulink
764#: quickly-ubuntu-application-tutorial.xml:286
765#, no-c-format
766msgid "Complete jotty file"
767msgstr ""
768
769#. Tag: title
770#: quickly-ubuntu-application-tutorial.xml:287
771#, no-c-format
772msgid "Saving Your Work"
773msgstr ""
774
775#. Tag: para
776#: quickly-ubuntu-application-tutorial.xml:287
777#, no-c-format
778msgid "When <application>Quickly</application> created your application, it automatically added it to Bazaar, a source code versioning system. You can use Bazaar to roll back mistake, see code history, compare versions, etc... <application>Quickly</application> has a convenience function for backing up your work:"
779msgstr ""
780
781#. Tag: code
782#: quickly-ubuntu-application-tutorial.xml:289
783#, no-c-format
784msgid "<application>Quickly</application> save \"First working version of Jotty\""
785msgstr ""
786
787#. Tag: para
788#: quickly-ubuntu-application-tutorial.xml:292
789#, no-c-format
790msgid "This will call <code>bzr add</code> and then <code>bzr commit -m [your message]</code> for you."
791msgstr ""
792
793#. Tag: title
794#: quickly-ubuntu-application-tutorial.xml:295
795#, no-c-format
796msgid "<title>Introduction to <application>Quickly</application> Part 2</title>"
797msgstr ""
798
799#. Tag: para
800#: quickly-ubuntu-application-tutorial.xml:296
801#, no-c-format
802msgid "In part 1, we created an application that can read and write text files, and persist them in the couchdb backend. However, the application has a hideous usability flaw, in the text box for specifying titles when saving and opening files is very confusing. In part 2, we'll fix that by adding a save and an open dialog."
803msgstr ""
804
805#. Tag: title
806#: quickly-ubuntu-application-tutorial.xml:298
807#, no-c-format
808msgid "Creating a <application>Quickly</application> Dialog"
809msgstr ""
810
811#. Tag: title
812#: quickly-ubuntu-application-tutorial.xml:299
813#, no-c-format
814msgid "Creating the Empty Dialog"
815msgstr ""
816
817#. Tag: para
818#: quickly-ubuntu-application-tutorial.xml:299
819#, no-c-format
820msgid "It's simple to add an empty, but working dialog to your project. Simply specify the name of the new dialog, and it will be added automatically. Assuming that you are in the jotty project directory:"
821msgstr ""
822
823#. Tag: code
824#: quickly-ubuntu-application-tutorial.xml:301
825#, no-c-format
826msgid "<application>Quickly</application> dialog save"
827msgstr ""
828
829#. Tag: para
830#: quickly-ubuntu-application-tutorial.xml:304
831#, no-c-format
832msgid "This will add the dialog to your project."
833msgstr ""
834
835#. Tag: title
836#: quickly-ubuntu-application-tutorial.xml:305 quickly-ubuntu-application-tutorial.xml:386
837#, no-c-format
838msgid "Editing the New Dialog"
839msgstr ""
840
841#. Tag: para
842#: quickly-ubuntu-application-tutorial.xml:305
843#, no-c-format
844msgid "To edit the UI for the dialog, you'll need to load it into Glade again. If you already have an instance of glade running, you might want to go ahead and close it first, as it may get confusing if you have more than one open at a time. After closing glade, simply open it again:"
845msgstr ""
846
847#. Tag: code
848#: quickly-ubuntu-application-tutorial.xml:307
849#, no-c-format
850msgid "<application>Quickly</application> Design"
851msgstr ""
852
853#. Tag: para
854#: quickly-ubuntu-application-tutorial.xml:310
855#, no-c-format
856msgid "Then use the project menu to switch to newly created SaveDialog.ui file."
857msgstr ""
858
859#. Tag: para
860#: quickly-ubuntu-application-tutorial.xml:314
861#, no-c-format
862msgid "Then add some widgets for the UI. Start with a Vertical Box (VBox) with two items. Put a label in the top, and an HBox in the bottom slot. In the HBox, add a label and an edit widget, just like you did for JottyWindow in part 1. Set the padding and expand properties as well."
863msgstr ""
864
865#. Tag: title
866#: quickly-ubuntu-application-tutorial.xml:318
867#, no-c-format
868msgid "Code the Dialog"
869msgstr ""
870
871#. Tag: para
872#: quickly-ubuntu-application-tutorial.xml:318
873#, no-c-format
874msgid "You can use the \"<application>Quickly</application> edit\" command to open the SaveDialog.py file. This dialog needs very little additional code to work. Essentially, you just need a way to retrieve the string specified by the user. We'll add a qiuck accessor method for this:"
875msgstr ""
876
877#. Tag: literallayout
878#: quickly-ubuntu-application-tutorial.xml:321
879#, no-c-format
880msgid ""
881 "<code>@property\n"
882 " def title_text(self):\n"
883 " return self.builder.get_object(\"entry1\").get_text()</code>"
884msgstr ""
885
886#. Tag: para
887#: quickly-ubuntu-application-tutorial.xml:322
888#, no-c-format
889msgid "We don't need to write any code for the Ok and Cancel buttons, as they were automatically hooked up by <application>Quickly</application> when it created the dialog."
890msgstr ""
891
892#. Tag: para
893#: quickly-ubuntu-application-tutorial.xml:323
894#, no-c-format
895msgid "Before we go on to invoking the dialog, delete HBox from JottyWindow that holds the text entry and label, as we won't be needing those."
896msgstr ""
897
898#. Tag: title
899#: quickly-ubuntu-application-tutorial.xml:327
900#, no-c-format
901msgid "Calling the Save Dialog"
902msgstr ""
903
904#. Tag: para
905#: quickly-ubuntu-application-tutorial.xml:327
906#, no-c-format
907msgid "To use the dialog in JottyWindow, we need to follow these steps:"
908msgstr ""
909
910#. Tag: para
911#: quickly-ubuntu-application-tutorial.xml:331
912#, no-c-format
913msgid "Import SaveDialog in JottyWindow"
914msgstr ""
915
916#. Tag: para
917#: quickly-ubuntu-application-tutorial.xml:334
918#, no-c-format
919msgid "In the save_file function, create an instance of SaveDialog"
920msgstr ""
921
922#. Tag: para
923#: quickly-ubuntu-application-tutorial.xml:337 quickly-ubuntu-application-tutorial.xml:455
924#, no-c-format
925msgid "Run the Dialog"
926msgstr ""
927
928#. Tag: para
929#: quickly-ubuntu-application-tutorial.xml:340
930#, no-c-format
931msgid "Get the String"
932msgstr ""
933
934#. Tag: para
935#: quickly-ubuntu-application-tutorial.xml:343 quickly-ubuntu-application-tutorial.xml:461
936#, no-c-format
937msgid "Destroy the dialog"
938msgstr ""
939
940#. Tag: title
941#: quickly-ubuntu-application-tutorial.xml:347
942#, no-c-format
943msgid "Importing the SaveDialog"
944msgstr ""
945
946#. Tag: para
947#: quickly-ubuntu-application-tutorial.xml:347
948#, no-c-format
949msgid "Add the SaveDialog to the list of the imported modules at the top of the bin file of your project, so it looks like this:"
950msgstr ""
951
952#. Tag: code
953#: quickly-ubuntu-application-tutorial.xml:349
954#, no-c-format
955msgid "from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog"
956msgstr ""
957
958#. Tag: title
959#: quickly-ubuntu-application-tutorial.xml:353 quickly-ubuntu-application-tutorial.xml:480
960#, no-c-format
961msgid "Create an instance of the dialog and run it"
962msgstr ""
963
964#. Tag: para
965#: quickly-ubuntu-application-tutorial.xml:353
966#, no-c-format
967msgid "When the user chooses Save, we want to open the SaveDialog and collect the title of the note from the user. So we need to modify our save_file function."
968msgstr ""
969
970#. Tag: para
971#: quickly-ubuntu-application-tutorial.xml:356
972#, no-c-format
973msgid "To create an instance of the dialog, use the NewSaveDialog() function in the SaveDialog module. It's important that you don't create an instance of SaveDialog directly, as it won't have a chance to load up it's UI that way, and it won't work. So whenever you use a <application>Quickly</application> dialog, do it like this:"
974msgstr ""
975
976#. Tag: code
977#: quickly-ubuntu-application-tutorial.xml:357
978#, no-c-format
979msgid "saver = SaveDialog.NewSaveDialog()"
980msgstr ""
981
982#. Tag: para
983#: quickly-ubuntu-application-tutorial.xml:360
984#, no-c-format
985msgid "To make the dialog appear, simply use the run() method. However, we want to check the result, so we'll need to store that in a variable. After it runs, we want to collect the string from the user, like this:"
986msgstr ""
987
988#. Tag: code
989#: quickly-ubuntu-application-tutorial.xml:361
990#, no-c-format
991msgid "result = saver.run() title = saver.title_text"
992msgstr ""
993
994#. Tag: title
995#: quickly-ubuntu-application-tutorial.xml:365
996#, no-c-format
997msgid "Clean up the dialog"
998msgstr ""
999
1000#. Tag: para
1001#: quickly-ubuntu-application-tutorial.xml:365
1002#, no-c-format
1003msgid "We need to tell the dialog to not show itself anymore. We could call saver.hide() to make it hide, but since we don't need it hanging around, we'll just destroy it. Before we go on, though, we need to ensure that the user actually wants to save, so if we didn't get the Ok result, we should just return out of the function:"
1004msgstr ""
1005
1006#. Tag: literallayout
1007#: quickly-ubuntu-application-tutorial.xml:368
1008#, no-c-format
1009msgid ""
1010 "<code>saver.destroy()\n"
1011 " if result != gtk.RESPONSE_OK:\n"
1012 " return</code>"
1013msgstr ""
1014
1015#. Tag: para
1016#: quickly-ubuntu-application-tutorial.xml:370
1017#, no-c-format
1018msgid "Since we're now getting the title from the dialog instead of the text entry, we should delete the line of the code that sents it from entry1. So except for the addition of the dialog code, the save_file function looks pretty much the same as it did in part 1:"
1019msgstr ""
1020
1021#. Tag: literallayout
1022#: quickly-ubuntu-application-tutorial.xml:373
1023#, no-c-format
1024msgid ""
1025 "<code>def save_file(self, widget, data=None):\n"
1026 " #get the titel from the user\n"
1027 " saver = SaveDialog.NewSaveDialog()\n"
1028 " result = saver.run()\n"
1029 " title = saver.title_text\n"
1030 "\n"
1031 " saver.destroy()\n"
1032 " if result != gtk.RESPONSE_OK:\n"
1033 " return\n"
1034 "\n"
1035 " #get the text to save\n"
1036 " buff = self.builder.get_object(\"textview1\").get_buffer()\n"
1037 " start_iter = buff.get_start_iter()\n"
1038 " end_iter = buff.get_end_iter()\n"
1039 " text = buff.get_text(start_iter,end_iter)\n"
1040 "\n"
1041 " #get all the records\n"
1042 " record_type = \"http://wiki.ubuntu.com/<application>Quickly</application>/JottyDoc\"\n"
1043 " results = self.database.get_records(record_type = record_type,create_view = True)\n"
1044 "\n"
1045 " #update a record that has the same title\n"
1046 " for result in results:\n"
1047 " record = result.value\n"
1048 " if record[\"title\"] == title:\n"
1049 " key = result.key\n"
1050 " self.database.update_fields(key, {\"text\":text})\n"
1051 " return\n"
1052 " \n"
1053 " #if no records had the title, create it \n"
1054 " new_rec = Record({\"record_type\":record_type,\"title\":title, \"text\":text})\n"
1055 " self.database.put_record(new_rec)</code>"
1056msgstr ""
1057
1058#. Tag: para
1059#: quickly-ubuntu-application-tutorial.xml:374
1060#, no-c-format
1061msgid "Now when we choose save, we get the SaveDialog instead:"
1062msgstr ""
1063
1064#. Tag: title
1065#: quickly-ubuntu-application-tutorial.xml:379
1066#, no-c-format
1067msgid "Creating a Dialog with a CouchGrid"
1068msgstr ""
1069
1070#. Tag: para
1071#: quickly-ubuntu-application-tutorial.xml:379
1072#, no-c-format
1073msgid "We'll use a similar approach in the Open dialog that we did with Save. However, there is one big difference, we want to provide the user with a list of documents that you could choose to open. We'll use a widget called CouchGrid, which is included in the desktopcouch api for this."
1074msgstr ""
1075
1076#. Tag: title
1077#: quickly-ubuntu-application-tutorial.xml:382
1078#, no-c-format
1079msgid "Create the Open Dialog"
1080msgstr ""
1081
1082#. Tag: code
1083#: quickly-ubuntu-application-tutorial.xml:383
1084#, no-c-format
1085msgid "<application>Quickly</application> dialog open"
1086msgstr ""
1087
1088#. Tag: para
1089#: quickly-ubuntu-application-tutorial.xml:386
1090#, no-c-format
1091msgid "Start out by closing, and then reopening glade again:"
1092msgstr ""
1093
1094#. Tag: para
1095#: quickly-ubuntu-application-tutorial.xml:391
1096#, no-c-format
1097msgid "Start by adding a VBox and a label in the same manner as in the Save Dialog above. Leave an empty space in the VBox. We will use code to put the CouchGrid there."
1098msgstr ""
1099
1100#. Tag: title
1101#: quickly-ubuntu-application-tutorial.xml:395
1102#, no-c-format
1103msgid "Coding the Open Dialog"
1104msgstr ""
1105
1106#. Tag: title
1107#: quickly-ubuntu-application-tutorial.xml:396
1108#, no-c-format
1109msgid "Creating and Adding a CouchGrid"
1110msgstr ""
1111
1112#. Tag: para
1113#: quickly-ubuntu-application-tutorial.xml:396
1114#, no-c-format
1115msgid "It just takes a little bit of code to add a CouchGrid to the dialog. We need to:"
1116msgstr ""
1117
1118#. Tag: para
1119#: quickly-ubuntu-application-tutorial.xml:400
1120#, no-c-format
1121msgid "Import the CouchGrid class."
1122msgstr ""
1123
1124#. Tag: para
1125#: quickly-ubuntu-application-tutorial.xml:403
1126#, no-c-format
1127msgid "Create a CouchGrid pointing at the jotty database, and the desired record type."
1128msgstr ""
1129
1130#. Tag: para
1131#: quickly-ubuntu-application-tutorial.xml:406
1132#, no-c-format
1133msgid "Add the CouchGrid to the dialog."
1134msgstr ""
1135
1136#. Tag: title
1137#: quickly-ubuntu-application-tutorial.xml:410
1138#, no-c-format
1139msgid "Import the CouchGrid class"
1140msgstr ""
1141
1142#. Tag: para
1143#: quickly-ubuntu-application-tutorial.xml:410
1144#, no-c-format
1145msgid "CouchGrid is part of the desktopcouch records api, so we import it like this:"
1146msgstr ""
1147
1148#. Tag: code
1149#: quickly-ubuntu-application-tutorial.xml:412
1150#, no-c-format
1151msgid "from desktopcouch.records.couchgrid import CouchGrid"
1152msgstr ""
1153
1154#. Tag: title
1155#: quickly-ubuntu-application-tutorial.xml:415
1156#, no-c-format
1157msgid "Create the CouchGrid"
1158msgstr ""
1159
1160#. Tag: para
1161#: quickly-ubuntu-application-tutorial.xml:415
1162#, no-c-format
1163msgid "A CouchGrid needs to know three things, the name of the database, the name of the record type, and the name of the keys to use. \"keys\" is a list of fields that the widget will display, and by default will also use the same text for the heading of any columns. This set up should be done in the OpenDialog's finish_initalizing function. All this is easily done in code like this:"
1164msgstr ""
1165
1166#. Tag: literallayout
1167#: quickly-ubuntu-application-tutorial.xml:419
1168#, no-c-format
1169msgid ""
1170 "<code>database = \"jotty\"\n"
1171 " keys = [\"title\"]\n"
1172 " record_type = \"http://wiki.ubuntu.com/<application>Quickly</application>/JottyDoc\"\n"
1173 " self.couchgrid = CouchGrid(database, record_type=record_type,keys=keys)</code>"
1174msgstr ""
1175
1176#. Tag: title
1177#: quickly-ubuntu-application-tutorial.xml:420
1178#, no-c-format
1179msgid "Add the CouchGrid to the Dialog"
1180msgstr ""
1181
1182#. Tag: para
1183#: quickly-ubuntu-application-tutorial.xml:420
1184#, no-c-format
1185msgid "we added the VBox to the dialog, we left an open space at the bottom. We'll use this by \"packing\" the CouchGrid into the VBox. We need to show it as well. So add the following lines to the finish_initializing function as well:"
1186msgstr ""
1187
1188#. Tag: literallayout
1189#: quickly-ubuntu-application-tutorial.xml:424
1190#, no-c-format
1191msgid ""
1192 "<code>self.couchgrid.show()\n"
1193 " self.builder.get_object(\"vbox1\").pack_end(self.couchgrid)</code>"
1194msgstr ""
1195
1196#. Tag: title
1197#: quickly-ubuntu-application-tutorial.xml:426
1198#, no-c-format
1199msgid "Create the get_selection function"
1200msgstr ""
1201
1202#. Tag: para
1203#: quickly-ubuntu-application-tutorial.xml:426
1204#, no-c-format
1205msgid "The dialog still needs a bit more code to work. It needs to return the user's selection, if there is one. To do this, we need to ask the CouchGrid what is selected. This is easy using the widgets selected_record_ids function. But the CouchGrid supports multiple selection, so we'll do the following:"
1206msgstr ""
1207
1208#. Tag: para
1209#: quickly-ubuntu-application-tutorial.xml:430
1210#, no-c-format
1211msgid "Use a decorator to define the function as a property accessor."
1212msgstr ""
1213
1214#. Tag: para
1215#: quickly-ubuntu-application-tutorial.xml:433
1216#, no-c-format
1217msgid "Get all the selected record ids."
1218msgstr ""
1219
1220#. Tag: para
1221#: quickly-ubuntu-application-tutorial.xml:436
1222#, no-c-format
1223msgid "If none are selected, return None."
1224msgstr ""
1225
1226#. Tag: para
1227#: quickly-ubuntu-application-tutorial.xml:439
1228#, no-c-format
1229msgid "Pick the first one and return it."
1230msgstr ""
1231
1232#. Tag: para
1233#: quickly-ubuntu-application-tutorial.xml:442
1234#, no-c-format
1235msgid "So the function to add to OpenDialog looks like this:"
1236msgstr ""
1237
1238#. Tag: literallayout
1239#: quickly-ubuntu-application-tutorial.xml:444
1240#, no-c-format
1241msgid ""
1242 "<code>@property\n"
1243 " def selected_record_id(self):\n"
1244 " ids = self.couchgrid.selected_record_ids\n"
1245 " if len(ids) &#60; 1:\n"
1246 " return None\n"
1247 " else:\n"
1248 " return ids[0]</code>"
1249msgstr ""
1250
1251#. Tag: title
1252#: quickly-ubuntu-application-tutorial.xml:445
1253#, no-c-format
1254msgid "Using the Open Dialog"
1255msgstr ""
1256
1257#. Tag: para
1258#: quickly-ubuntu-application-tutorial.xml:445
1259#, no-c-format
1260msgid "Now we want to use the Open Dialog in the JottyWindow open_file function. To use it,we'll follow these steps:"
1261msgstr ""
1262
1263#. Tag: para
1264#: quickly-ubuntu-application-tutorial.xml:449
1265#, no-c-format
1266msgid "Import OpenDialog in JottyWindow"
1267msgstr ""
1268
1269#. Tag: para
1270#: quickly-ubuntu-application-tutorial.xml:452
1271#, no-c-format
1272msgid "In the open_file function, create an instance of OpenDialog"
1273msgstr ""
1274
1275#. Tag: para
1276#: quickly-ubuntu-application-tutorial.xml:458
1277#, no-c-format
1278msgid "Get the id for the selected title."
1279msgstr ""
1280
1281#. Tag: para
1282#: quickly-ubuntu-application-tutorial.xml:464
1283#, no-c-format
1284msgid "Check the response before proceeding"
1285msgstr ""
1286
1287#. Tag: para
1288#: quickly-ubuntu-application-tutorial.xml:467
1289#, no-c-format
1290msgid "<para>Use the id to get the record from CouchDB</para>"
1291msgstr ""
1292
1293#. Tag: para
1294#: quickly-ubuntu-application-tutorial.xml:470
1295#, no-c-format
1296msgid "<para>Update the UI</para>"
1297msgstr ""
1298
1299#. Tag: title
1300#: quickly-ubuntu-application-tutorial.xml:474
1301#, no-c-format
1302msgid "Import OpenDialog"
1303msgstr ""
1304
1305#. Tag: para
1306#: quickly-ubuntu-application-tutorial.xml:474
1307#, no-c-format
1308msgid "Just like the SaveDialog, add the import line to the list of imports:"
1309msgstr ""
1310
1311#. Tag: code
1312#: quickly-ubuntu-application-tutorial.xml:476
1313#, no-c-format
1314msgid "from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog, OpenDialog"
1315msgstr ""
1316
1317#. Tag: para
1318#: quickly-ubuntu-application-tutorial.xml:480
1319#, no-c-format
1320msgid "So now we're ready to call the dialog from the JottyWindow's open_file function. Creating the OpenDialog is exactly the same as creating the SaveDialog, except we also want to tell it to load the titles before we run it:"
1321msgstr ""
1322
1323#. Tag: literallayout
1324#: quickly-ubuntu-application-tutorial.xml:483
1325#, no-c-format
1326msgid ""
1327 "<code>opener = OpenDialog.NewOpenDialog()\n"
1328 " result = opener.run()</code>"
1329msgstr ""
1330
1331#. Tag: title
1332#: quickly-ubuntu-application-tutorial.xml:485
1333#, no-c-format
1334msgid "Get the id for the selected title"
1335msgstr ""
1336
1337#. Tag: para
1338#: quickly-ubuntu-application-tutorial.xml:485
1339#, no-c-format
1340msgid "Now use the property that we created to retrieve the title and text from the dialog. Don't forget to check the response type before going on."
1341msgstr ""
1342
1343#. Tag: literallayout
1344#: quickly-ubuntu-application-tutorial.xml:488
1345#, no-c-format
1346msgid ""
1347 "<code>rec_id = opener.selected_record_id\n"
1348 "\n"
1349 " #close the dialog, and check whether to proceed\n"
1350 " opener.destroy()\n"
1351 " if result != gtk.RESPONSE_OK:\n"
1352 " return</code>"
1353msgstr ""
1354
1355#. Tag: title
1356#: quickly-ubuntu-application-tutorial.xml:491
1357#, no-c-format
1358msgid "<title>Use the id to get the record from CouchDB</title>"
1359msgstr ""
1360
1361#. Tag: para
1362#: quickly-ubuntu-application-tutorial.xml:491
1363#, no-c-format
1364msgid "If nothing was selected, we'll just return. Otherwise, we'll retrieve the record from CouchDB and pull out the text for the document:"
1365msgstr ""
1366
1367#. Tag: literallayout
1368#: quickly-ubuntu-application-tutorial.xml:494
1369#, no-c-format
1370msgid ""
1371 "<code>#get the record from CouchDB and extract the text\n"
1372 " if rec_id == None:\n"
1373 " return\n"
1374 " record = self.database.get_record(rec_id)\n"
1375 " text = record[\"text\"]</code>"
1376msgstr ""
1377
1378#. Tag: title
1379#: quickly-ubuntu-application-tutorial.xml:496
1380#, no-c-format
1381msgid "<title>Update the UI</title>"
1382msgstr ""
1383
1384#. Tag: para
1385#: quickly-ubuntu-application-tutorial.xml:496
1386#, no-c-format
1387msgid "Now just put the text into the texview:"
1388msgstr ""
1389
1390#. Tag: literallayout
1391#: quickly-ubuntu-application-tutorial.xml:499
1392#, no-c-format
1393msgid ""
1394 "<code>#set the UI to display the string\n"
1395 " buff = self.builder.get_object(\"textview1\").get_buffer()\n"
1396 " buff.set_text(text)</code>"
1397msgstr ""
1398
1399#. Tag: para
1400#: quickly-ubuntu-application-tutorial.xml:500
1401#, no-c-format
1402msgid "That's all there is to it. So the whole open_file function looks like this:"
1403msgstr ""
1404
1405#. Tag: literallayout
1406#: quickly-ubuntu-application-tutorial.xml:502
1407#, no-c-format
1408msgid ""
1409 "<code>def open_file(self, widget, data=None):\n"
1410 " #run the open dialog\n"
1411 " opener = OpenDialog.NewOpenDialog()\n"
1412 " result = opener.run()\n"
1413 "\n"
1414 " #get the record id from the dialog\n"
1415 " rec_id = opener.selected_record_id\n"
1416 "\n"
1417 " #close the dialog, and check whether to proceed\n"
1418 " opener.destroy()\n"
1419 " if result != gtk.RESPONSE_OK:\n"
1420 " return\n"
1421 "\n"
1422 " #get the record from CouchDB and extract the text\n"
1423 " if rec_id == None:\n"
1424 " return\n"
1425 " record = self.database.get_record(rec_id)\n"
1426 " text = record[\"text\"]\n"
1427 "\n"
1428 " #set the UI to display the string\n"
1429 " buff = self.builder.get_object(\"textview1\").get_buffer()\n"
1430 " buff.set_text(text)</code>"
1431msgstr ""
1432
1433#. Tag: para
1434#: quickly-ubuntu-application-tutorial.xml:503
1435#, no-c-format
1436msgid "Now users get a nice open dialog:"
1437msgstr ""
1438
1439#. Tag: para
1440#: quickly-ubuntu-application-tutorial.xml:508
1441#, no-c-format
1442msgid "However, the application is not complete. There are a few things left for you to do:"
1443msgstr ""
1444
1445#. Tag: para
1446#: quickly-ubuntu-application-tutorial.xml:511
1447#, no-c-format
1448msgid "Set the title of the JottyWindow to display the note title. Try self.set_text(title)."
1449msgstr ""
1450
1451#. Tag: para
1452#: quickly-ubuntu-application-tutorial.xml:514
1453#, no-c-format
1454msgid "The Save command works more like \"Save As\". The application probably shouldn't pop up a SaveDialog every time you want to save. If it's already been saved, you probably just want to save it, but use a SaveDialog when the user choose Save As, or is saving a document for the first time."
1455msgstr ""
1456
1457#. Tag: para
1458#: quickly-ubuntu-application-tutorial.xml:517
1459#, no-c-format
1460msgid "The OpenDialog should probably return when the user double clicks on an item in the list. Try connecting to the \"select-cursor-row\" signal on the TreeView, and calling self.response(gtk.RESPONSE_OK) in the handler."
1461msgstr ""
1462
1463#. Tag: para
1464#: quickly-ubuntu-application-tutorial.xml:520
1465#, no-c-format
1466msgid "Perhaps the Ok button in the OpenDialog should be disabled if nothing is selected. Try setting the \"sensitivity\" in Glade, and the set_sensitive function for the Ok button."
1467msgstr ""
1468
1469#. Tag: para
1470#: quickly-ubuntu-application-tutorial.xml:523
1471#, no-c-format
1472msgid "It would be more consistent for the Open and Close dialogs to have \"Open\" and \"Close\" for buttons instead of \"Ok\". You can set a different type in the properties window in Glade."
1473msgstr ""
1474
1475#. Tag: para
1476#: quickly-ubuntu-application-tutorial.xml:526
1477#, no-c-format
1478msgid "Loading every document into the open dialog is probably a bit inefficient. Perhaps storing the document id and using that to retrieve the document would be a better implementation."
1479msgstr ""
1480
1481#. Tag: title
1482#: quickly-ubuntu-application-tutorial.xml:532
1483#, no-c-format
1484msgid "<title>Introduction to <application>Quickly</application> Part 3</title>"
1485msgstr ""
1486
1487#. Tag: para
1488#: quickly-ubuntu-application-tutorial.xml:533
1489#, no-c-format
1490msgid "In parts 1 and 2, we showed how to create a simple Ubuntu application using <application>Quickly</application>. This section will cover how to package an application so that it is easy for you to share, and easy for other people to install."
1491msgstr ""
1492
1493#. Tag: title
1494#: quickly-ubuntu-application-tutorial.xml:534
1495#, no-c-format
1496msgid "License your Application"
1497msgstr ""
1498
1499#. Tag: para
1500#: quickly-ubuntu-application-tutorial.xml:534
1501#, no-c-format
1502msgid "It's important to license your code so users and other programmers know their rights in terms of redistributing or modifying it. To <application>Quickly</application> grant a GPL license to your code, simply:"
1503msgstr ""
1504
1505#. Tag: para
1506#: quickly-ubuntu-application-tutorial.xml:538
1507#, no-c-format
1508msgid "Specify your name and email address in the Copyright file."
1509msgstr ""
1510
1511#. Tag: para
1512#: quickly-ubuntu-application-tutorial.xml:541
1513#, no-c-format
1514msgid "Run the \"license\" command."
1515msgstr ""
1516
1517#. Tag: title
1518#: quickly-ubuntu-application-tutorial.xml:545
1519#, no-c-format
1520msgid "Specify your name and email"
1521msgstr ""
1522
1523#. Tag: para
1524#: quickly-ubuntu-application-tutorial.xml:545
1525#, no-c-format
1526msgid "When <application>Quickly</application> created your ubuntu application, it added a file named Copyright in the top level of the directory. Open this file in your text editor, and modify the top line so it has your name and email included. Be sure not to modify other lines as it will interfere with the next step. For example, I would change the entire file to look like this:"
1527msgstr ""
1528
1529#. Tag: literallayout
1530#: quickly-ubuntu-application-tutorial.xml:548
1531#, no-c-format
1532msgid ""
1533 "<code># Copyright (C) 2009 Rick Spencer rick.spencer@canonical.com\n"
1534 "### BEGIN AUTOMATIC LICENSE GENERATION\n"
1535 "### END AUTOMATIC LICENSE GENERATION\n"
1536 "</code>"
1537msgstr ""
1538
1539#. Tag: title
1540#: quickly-ubuntu-application-tutorial.xml:549
1541#, no-c-format
1542msgid "Run the \"License\" Command"
1543msgstr ""
1544
1545#. Tag: para
1546#: quickly-ubuntu-application-tutorial.xml:549
1547#, no-c-format
1548msgid "By default, <application>Quickly</application> will use a GPL 3 license for your project. To use this license, use this command:"
1549msgstr ""
1550
1551#. Tag: code
1552#: quickly-ubuntu-application-tutorial.xml:551 quickly-ubuntu-application-tutorial.xml:571
1553#, no-c-format
1554msgid "<application>Quickly</application> license"
1555msgstr ""
1556
1557#. Tag: para
1558#: quickly-ubuntu-application-tutorial.xml:554
1559#, no-c-format
1560msgid "This will add the GPL 3 license to all of your code files that you've added to your project using <application>Quickly</application>."
1561msgstr ""
1562
1563#. Tag: para
1564#: quickly-ubuntu-application-tutorial.xml:555
1565#, no-c-format
1566msgid "Keep in mind a couple of things:"
1567msgstr ""
1568
1569#. Tag: para
1570#: quickly-ubuntu-application-tutorial.xml:558
1571#, no-c-format
1572msgid "This is a one way trip. Once you license the project, changes to the license must be done manually."
1573msgstr ""
1574
1575#. Tag: para
1576#: quickly-ubuntu-application-tutorial.xml:561
1577#, no-c-format
1578msgid "If you prefer a GPL 2 license, you can specify that when you issue the license command:"
1579msgstr ""
1580
1581#. Tag: code
1582#: quickly-ubuntu-application-tutorial.xml:562
1583#, no-c-format
1584msgid "<application>Quickly</application> license GPL-2"
1585msgstr ""
1586
1587#. Tag: para
1588#: quickly-ubuntu-application-tutorial.xml:567
1589#, no-c-format
1590msgid "<application>Quickly</application> doesn't care what license you use, but only knows natively what files and headers to include for BSD, GPL-2, GPL-3, LGPL-2 and LGPL-3. If you prefer another license, you can simply add whatever you license you like by adding your own license in the Copyright file:"
1591msgstr ""
1592
1593#. Tag: literallayout
1594#: quickly-ubuntu-application-tutorial.xml:569
1595#, no-c-format
1596msgid ""
1597 "<code>### BEGIN AUTOMATIC LICENSE GENERATION\n"
1598 "# My personal license here\n"
1599 "### END AUTOMATIC LICENSE GENERATION</code>"
1600msgstr ""
1601
1602#. Tag: para
1603#: quickly-ubuntu-application-tutorial.xml:570
1604#, no-c-format
1605msgid "and then run:"
1606msgstr ""
1607
1608#. Tag: para
1609#: quickly-ubuntu-application-tutorial.xml:574
1610#, no-c-format
1611msgid "to license every files."
1612msgstr ""
1613
1614#. Tag: para
1615#: quickly-ubuntu-application-tutorial.xml:577
1616#, no-c-format
1617msgid "If you've added code files or other files to your project manually, you will need to add the license to those files manually or add those tags at the beginning of the file:"
1618msgstr ""
1619
1620#. Tag: literallayout
1621#: quickly-ubuntu-application-tutorial.xml:579
1622#, no-c-format
1623msgid ""
1624 "<code>### BEGIN LICENSE\n"
1625 "### END LICENSE</code>"
1626msgstr ""
1627
1628#. Tag: title
1629#: quickly-ubuntu-application-tutorial.xml:583
1630#, no-c-format
1631msgid "Translate Your Application"
1632msgstr ""
1633
1634#. Tag: para
1635#: quickly-ubuntu-application-tutorial.xml:583
1636#, no-c-format
1637msgid "To allow for users from other countries to use your application you may want to translate it. Glade automatically creates a pot file for you but to translate strings in your code you have to:"
1638msgstr ""
1639
1640#. Tag: code
1641#: quickly-ubuntu-application-tutorial.xml:585
1642#, no-c-format
1643msgid "import gettext"
1644msgstr ""
1645
1646#. Tag: code
1647#: quickly-ubuntu-application-tutorial.xml:586
1648#, no-c-format
1649msgid "gettext.gettext(\"What you want translated\")"
1650msgstr ""
1651
1652#. Tag: title
1653#: quickly-ubuntu-application-tutorial.xml:588
1654#, no-c-format
1655msgid "Specify Application Settings"
1656msgstr ""
1657
1658#. Tag: para
1659#: quickly-ubuntu-application-tutorial.xml:588
1660#, no-c-format
1661msgid "You should personalize your application a little before creating the archive. This is very easy to do, as all of the files that you need have already been created, and only need a few lines changed to make them your own. To do this you should:"
1662msgstr ""
1663
1664#. Tag: para
1665#: quickly-ubuntu-application-tutorial.xml:592
1666#, no-c-format
1667msgid "Personalize the Application Icon"
1668msgstr ""
1669
1670#. Tag: para
1671#: quickly-ubuntu-application-tutorial.xml:593
1672#, no-c-format
1673msgid "<para>Edit the Desktop File</para>"
1674msgstr ""
1675
1676#. Tag: para
1677#: quickly-ubuntu-application-tutorial.xml:594
1678#, no-c-format
1679msgid "Edit the setup.py File"
1680msgstr ""
1681
1682#. Tag: title
1683#: quickly-ubuntu-application-tutorial.xml:597
1684#, no-c-format
1685msgid "Personalize your Application Icon"
1686msgstr ""
1687
1688#. Tag: para
1689#: quickly-ubuntu-application-tutorial.xml:597
1690#, no-c-format
1691msgid "When users install your application, Ubuntu will display an icon next to it in the menus. You can create your own icon or edit the file called \"icon.png\" in the media directory (jotty/data/media). Ubuntu comes with a great image editing program called \"Gimp.\" So you can go:"
1692msgstr ""
1693
1694#. Tag: code
1695#: quickly-ubuntu-application-tutorial.xml:599
1696#, no-c-format
1697msgid "gimp data/media/icon.png"
1698msgstr ""
1699
1700#. Tag: para
1701#: quickly-ubuntu-application-tutorial.xml:605
1702#, no-c-format
1703msgid "If you don't personalize the icon, it's ok, your app will just have the default icon, such as in the image below."
1704msgstr ""
1705
1706#. Tag: title
1707#: quickly-ubuntu-application-tutorial.xml:607
1708#, no-c-format
1709msgid "<title>Edit the Desktop File</title>"
1710msgstr ""
1711
1712#. Tag: para
1713#: quickly-ubuntu-application-tutorial.xml:607
1714#, no-c-format
1715msgid "By default, <application>Quickly</application> Ubuntu applications are classified as \"utilities\", so they show up under the Accessories menu in Ubuntu. If we wanted to make Jotty show up in another category, we can do this by editing the desktop file. A desktop file is a file that describes your application to a Linux desktop. The file \"jottydesktop.in\" was automatically created in the jotty project directory. To change Jotty from a Utility to an Office application, edit jotty.desktop.in and change this:"
1716msgstr ""
1717
1718#. Tag: literallayout
1719#: quickly-ubuntu-application-tutorial.xml:611
1720#, no-c-format
1721msgid ""
1722 "<code>[Desktop Entry]\n"
1723 "Name=Jotty\n"
1724 "Comment=Jotty application\n"
1725 "Categories=GNOME;Utility;\n"
1726 "Exec=jotty\n"
1727 "Icon=jotty\n"
1728 "Terminal=false\n"
1729 "Type=Application\n"
1730 "</code>"
1731msgstr ""
1732
1733#. Tag: para
1734#: quickly-ubuntu-application-tutorial.xml:613
1735#, no-c-format
1736msgid "to this:"
1737msgstr ""
1738
1739#. Tag: literallayout
1740#: quickly-ubuntu-application-tutorial.xml:617
1741#, no-c-format
1742msgid ""
1743 "<code>[Desktop Entry]\n"
1744 "Name=Jotty\n"
1745 "Comment=Jotty application\n"
1746 "Categories=GNOME;Office;\n"
1747 "Exec=jotty\n"
1748 "Icon=jotty\n"
1749 "Terminal=false\n"
1750 "Type=Application</code>"
1751msgstr ""
1752
1753#. Tag: para
1754#: quickly-ubuntu-application-tutorial.xml:618
1755#, no-c-format
1756msgid "There are lots more categories that you can use, all defined by the FreeDesktop spec. You can see the complete list in the <ulink url=\"http://standards.freedesktop.org/menu-spec/latest/apa.html\">menu spec</ulink>."
1757msgstr ""
1758
1759#. Tag: title
1760#: quickly-ubuntu-application-tutorial.xml:622
1761#, no-c-format
1762msgid "Edit Setup.py"
1763msgstr ""
1764
1765#. Tag: para
1766#: quickly-ubuntu-application-tutorial.xml:622
1767#, no-c-format
1768msgid "Finally, you should include some information in the setup.py file to tell your users a little about yourself. The setup.py file was created for you, just like the desktop file. Most of of the setup.py file shouldn't be modified, as it is just boiler plate that makes your application work properly after it has been installed. However, there is a section at the bottom of the setup.py file that you should edit to describe yourself and the application."
1769msgstr ""
1770
1771#. Tag: para
1772#: quickly-ubuntu-application-tutorial.xml:625
1773#, no-c-format
1774msgid "So I would change this section:"
1775msgstr ""
1776
1777#. Tag: literallayout
1778#: quickly-ubuntu-application-tutorial.xml:629
1779#, no-c-format
1780msgid ""
1781 "<code>DistUtilsExtra.auto.setup(\n"
1782 " name='jotty',\n"
1783 " version='0.1',\n"
1784 " license='GPL v3',\n"
1785 " #author='Your Name',\n"
1786 " #author_email='email@ubuntu.com',\n"
1787 " #description='UI for managing …',\n"
1788 " #long_description='Here a longer description',\n"
1789 " #url='https://launchpad.net/jotty',\n"
1790 " cmdclass={'install': InstallAndUpdateDataDirectory}\n"
1791 " )\n"
1792 "</code>"
1793msgstr ""
1794
1795#. Tag: para
1796#: quickly-ubuntu-application-tutorial.xml:630
1797#, no-c-format
1798msgid "To look like this:"
1799msgstr ""
1800
1801#. Tag: literallayout
1802#: quickly-ubuntu-application-tutorial.xml:634
1803#, no-c-format
1804msgid ""
1805 "<code>DistUtilsExtra.auto.setup(\n"
1806 " name='jotty',\n"
1807 " version='0.1',\n"
1808 " license='GPL v3',\n"
1809 " author='Rick Spencer',\n"
1810 " author_email='rick.spencer@canonical.com',\n"
1811 " description='Note taking application',\n"
1812 " long_description='Note taking application that uses CouchDB as the backend to support easy replication across users and computers.',\n"
1813 " #url='https://launchpad.net/jotty',\n"
1814 " cmdclass={'install': InstallAndUpdateDataDirectory}\n"
1815 " )</code>"
1816msgstr ""
1817
1818#. Tag: para
1819#: quickly-ubuntu-application-tutorial.xml:635
1820#, no-c-format
1821msgid "Note that the license has already been set up for you. author and author_email are updated each time you connect to Launchpad (with <application>Quickly</application> release or <application>Quickly</application> share) with your Launchpad real name and preferred email adress."
1822msgstr ""
1823
1824#. Tag: para
1825#: quickly-ubuntu-application-tutorial.xml:636
1826#, no-c-format
1827msgid "Notice that Jotty doesn't have a web page yet, so I just left that line commented out. Also, you don't have to increment version number as <application>Quickly</application> share and <application>Quickly</application> release commands will make it for you.."
1828msgstr ""
1829
1830#. Tag: title
1831#: quickly-ubuntu-application-tutorial.xml:640
1832#, no-c-format
1833msgid "Create and Test the Debian Archive"
1834msgstr ""
1835
1836#. Tag: para
1837#: quickly-ubuntu-application-tutorial.xml:640
1838#, no-c-format
1839msgid "After personalizing the project, we are now ready to create the package. This is easily done by issuing the package command:"
1840msgstr ""
1841
1842#. Tag: code
1843#: quickly-ubuntu-application-tutorial.xml:643 quickly-ubuntu-application-tutorial.xml:845
1844#, no-c-format
1845msgid "<application>Quickly</application> package"
1846msgstr ""
1847
1848#. Tag: para
1849#: quickly-ubuntu-application-tutorial.xml:646
1850#, no-c-format
1851msgid "This command will take a little while to discover dependencies and create all the required archives, etc... It will also report some errors as we haven't created a PGP key, for instance. None the less, when it is done, the package will be created. Using the file browser, you can see the created package next to the project directory:"
1852msgstr ""
1853
1854#. Tag: para
1855#: quickly-ubuntu-application-tutorial.xml:650
1856#, no-c-format
1857msgid "Right now, the specific file we are interested in is \"jotty_0.1_all.deb\". To test it out, double click on it, to open it in Ubuntu's graphical installer program:"
1858msgstr ""
1859
1860#. Tag: para
1861#: quickly-ubuntu-application-tutorial.xml:654
1862#, no-c-format
1863msgid "Click \"Install Package\" to see how it installs onto your desktop. After chugging for a bit, you'll see that it is installed in the Applications->Office menu. If you customized your icon, you'll see that the menu uses your custom icon as well."
1864msgstr ""
1865
1866#. Tag: title
1867#: quickly-ubuntu-application-tutorial.xml:658
1868#, no-c-format
1869msgid "Now that you have a package"
1870msgstr ""
1871
1872#. Tag: para
1873#: quickly-ubuntu-application-tutorial.xml:658
1874#, no-c-format
1875msgid "Now that you've packaged your application, you can share the .deb file. However, if your users install their application this way, and you update the application, your users will have to find this out and resinstall. This hassle can be avoided in Ubuntu by using Personal Package Archives (or PPAs). Distrubuting your applications in this manner is covered in section 4 (not yet available)."
1876msgstr ""
1877
1878#. Tag: title
1879#: quickly-ubuntu-application-tutorial.xml:662
1880#, no-c-format
1881msgid "<title><application>Quickly</application>: <application>Quickly</application> Command Reference</title>"
1882msgstr ""
1883
1884#. Tag: para
1885#: quickly-ubuntu-application-tutorial.xml:663
1886#, no-c-format
1887msgid "The ubuntu-application template template contains the following commands."
1888msgstr ""
1889
1890#. Tag: listitem
1891#: quickly-ubuntu-application-tutorial.xml:665
1892#, no-c-format
1893msgid "<listitem>create</listitem>"
1894msgstr ""
1895
1896#. Tag: listitem
1897#: quickly-ubuntu-application-tutorial.xml:668
1898#, no-c-format
1899msgid "<listitem>dialog</listitem>"
1900msgstr ""
1901
1902#. Tag: listitem
1903#: quickly-ubuntu-application-tutorial.xml:671
1904#, no-c-format
1905msgid "<listitem>edit</listitem>"
1906msgstr ""
1907
1908#. Tag: listitem
1909#: quickly-ubuntu-application-tutorial.xml:674
1910#, no-c-format
1911msgid "design"
1912msgstr ""
1913
1914#. Tag: listitem
1915#: quickly-ubuntu-application-tutorial.xml:677
1916#, no-c-format
1917msgid "<listitem>help</listitem>"
1918msgstr ""
1919
1920#. Tag: listitem
1921#: quickly-ubuntu-application-tutorial.xml:680
1922#, no-c-format
1923msgid "<listitem>license</listitem>"
1924msgstr ""
1925
1926#. Tag: listitem
1927#: quickly-ubuntu-application-tutorial.xml:683
1928#, no-c-format
1929msgid "<listitem>package</listitem>"
1930msgstr ""
1931
1932#. Tag: listitem
1933#: quickly-ubuntu-application-tutorial.xml:686
1934#, no-c-format
1935msgid "<listitem>release</listitem>"
1936msgstr ""
1937
1938#. Tag: listitem
1939#: quickly-ubuntu-application-tutorial.xml:689
1940#, no-c-format
1941msgid "<listitem>run</listitem>"
1942msgstr ""
1943
1944#. Tag: listitem
1945#: quickly-ubuntu-application-tutorial.xml:692
1946#, no-c-format
1947msgid "<listitem>save</listitem>"
1948msgstr ""
1949
1950#. Tag: listitem
1951#: quickly-ubuntu-application-tutorial.xml:695
1952#, no-c-format
1953msgid "<listitem>share</listitem>"
1954msgstr ""
1955
1956#. Tag: title
1957#: quickly-ubuntu-application-tutorial.xml:699 quickly-ubuntu-application-tutorial.xml:700
1958#, no-c-format
1959msgid "<title>create</title>"
1960msgstr ""
1961
1962#. Tag: para
1963#: quickly-ubuntu-application-tutorial.xml:700 quickly-ubuntu-application-tutorial.xml:727 quickly-ubuntu-application-tutorial.xml:772 quickly-ubuntu-application-tutorial.xml:783 quickly-ubuntu-application-tutorial.xml:796 quickly-ubuntu-application-tutorial.xml:805 quickly-ubuntu-application-tutorial.xml:844 quickly-ubuntu-application-tutorial.xml:861 quickly-ubuntu-application-tutorial.xml:896 quickly-ubuntu-application-tutorial.xml:906 quickly-ubuntu-application-tutorial.xml:922
1964#, no-c-format
1965msgid "Usage:"
1966msgstr ""
1967
1968#. Tag: code
1969#: quickly-ubuntu-application-tutorial.xml:702
1970#, no-c-format
1971msgid "<application>Quickly</application> create ubuntu-application path/to/project_name"
1972msgstr ""
1973
1974#. Tag: para
1975#: quickly-ubuntu-application-tutorial.xml:704
1976#, no-c-format
1977msgid "where \"project_name\" is one or more words separated by an underscore and path/to can be any existing path."
1978msgstr ""
1979
1980#. Tag: para
1981#: quickly-ubuntu-application-tutorial.xml:707
1982#, no-c-format
1983msgid "This will create and run a new project, including Python code, Glade files, and packaging files to make the project work. After creating the project, get started by:"
1984msgstr ""
1985
1986#. Tag: para
1987#: quickly-ubuntu-application-tutorial.xml:713
1988#, no-c-format
1989msgid "Changing your working directory to the new project:"
1990msgstr ""
1991
1992#. Tag: code
1993#: quickly-ubuntu-application-tutorial.xml:715
1994#, no-c-format
1995msgid "cd path/to/project_name"
1996msgstr ""
1997
1998#. Tag: para
1999#: quickly-ubuntu-application-tutorial.xml:717
2000#, no-c-format
2001msgid "Edit the UI with Glade:"
2002msgstr ""
2003
2004#. Tag: para
2005#: quickly-ubuntu-application-tutorial.xml:720
2006#, no-c-format
2007msgid "Edit the Python code:"
2008msgstr ""
2009
2010#. Tag: title
2011#: quickly-ubuntu-application-tutorial.xml:726 quickly-ubuntu-application-tutorial.xml:727
2012#, no-c-format
2013msgid "<title>dialog</title>"
2014msgstr ""
2015
2016#. Tag: code
2017#: quickly-ubuntu-application-tutorial.xml:729
2018#, no-c-format
2019msgid "<application>Quickly</application> dialog dialog_name"
2020msgstr ""
2021
2022#. Tag: para
2023#: quickly-ubuntu-application-tutorial.xml:730
2024#, no-c-format
2025msgid "where dialog_name is one or more words seperated with underscore"
2026msgstr ""
2027
2028#. Tag: para
2029#: quickly-ubuntu-application-tutorial.xml:731
2030#, no-c-format
2031msgid "This will create:"
2032msgstr ""
2033
2034#. Tag: para
2035#: quickly-ubuntu-application-tutorial.xml:735
2036#, no-c-format
2037msgid "A subclass of gtk.Dialog called DialogNameDialog in the module DialogNameDialog.py"
2038msgstr ""
2039
2040#. Tag: para
2041#: quickly-ubuntu-application-tutorial.xml:738
2042#, no-c-format
2043msgid "A glade file called DialogNameDialog.ui in the ui directory"
2044msgstr ""
2045
2046#. Tag: para
2047#: quickly-ubuntu-application-tutorial.xml:741
2048#, no-c-format
2049msgid "A catalog file called dialog_name_dialog.xml also in the ui directory"
2050msgstr ""
2051
2052#. Tag: para
2053#: quickly-ubuntu-application-tutorial.xml:744
2054#, no-c-format
2055msgid "To edit the UI for the dialog, run:"
2056msgstr ""
2057
2058#. Tag: para
2059#: quickly-ubuntu-application-tutorial.xml:748
2060#, no-c-format
2061msgid "To edit the behavior, run:"
2062msgstr ""
2063
2064#. Tag: para
2065#: quickly-ubuntu-application-tutorial.xml:751
2066#, no-c-format
2067msgid "To use the dialog you have to invoke it from another python file:"
2068msgstr ""
2069
2070#. Tag: code
2071#: quickly-ubuntu-application-tutorial.xml:755
2072#, no-c-format
2073msgid "Import the dialog import DialogNameDialog"
2074msgstr ""
2075
2076#. Tag: code
2077#: quickly-ubuntu-application-tutorial.xml:759
2078#, no-c-format
2079msgid "Create an instance of the dialog dialog = DialogNameDialog.NewDialogNameDialog()"
2080msgstr ""
2081
2082#. Tag: code
2083#: quickly-ubuntu-application-tutorial.xml:763
2084#, no-c-format
2085msgid "Run the dialog and hide the dialog result = dialog.run() dialog.hide()"
2086msgstr ""
2087
2088#. Tag: title
2089#: quickly-ubuntu-application-tutorial.xml:771 quickly-ubuntu-application-tutorial.xml:772
2090#, no-c-format
2091msgid "<title>edit</title>"
2092msgstr ""
2093
2094#. Tag: para
2095#: quickly-ubuntu-application-tutorial.xml:776
2096#, no-c-format
2097msgid "A convenience command to open all of your python files in your project directory in your default editor, ready for editing."
2098msgstr ""
2099
2100#. Tag: title
2101#: quickly-ubuntu-application-tutorial.xml:782 quickly-ubuntu-application-tutorial.xml:783
2102#, no-c-format
2103msgid "glade"
2104msgstr ""
2105
2106#. Tag: para
2107#: quickly-ubuntu-application-tutorial.xml:786
2108#, no-c-format
2109msgid "Opens Glade UI editor so that you can edit the UI for dialogs and windows in your project. Note that you *must* open Glade in this manner for <application>Quickly</application> to work. If you try to open Glade directly, and the open the UI files, Glade will throw errors and won't open the files."
2110msgstr ""
2111
2112#. Tag: title
2113#: quickly-ubuntu-application-tutorial.xml:795 quickly-ubuntu-application-tutorial.xml:796
2114#, no-c-format
2115msgid "<title>help</title>"
2116msgstr ""
2117
2118#. Tag: code
2119#: quickly-ubuntu-application-tutorial.xml:797
2120#, no-c-format
2121msgid "<application>Quickly</application> help"
2122msgstr ""
2123
2124#. Tag: para
2125#: quickly-ubuntu-application-tutorial.xml:799
2126#, no-c-format
2127msgid "Opens a web browser with the help index."
2128msgstr ""
2129
2130#. Tag: title
2131#: quickly-ubuntu-application-tutorial.xml:804 quickly-ubuntu-application-tutorial.xml:805
2132#, no-c-format
2133msgid "<title>license</title>"
2134msgstr ""
2135
2136#. Tag: code
2137#: quickly-ubuntu-application-tutorial.xml:806
2138#, no-c-format
2139msgid "<application>Quickly</application> license &#60;Your_Licence&#61;"
2140msgstr ""
2141
2142#. Tag: para
2143#: quickly-ubuntu-application-tutorial.xml:808
2144#, no-c-format
2145msgid "Adds license to project files. Before using this command, you should:"
2146msgstr ""
2147
2148#. Tag: para
2149#: quickly-ubuntu-application-tutorial.xml:812
2150#, no-c-format
2151msgid "run <application>Quickly</application> save in case something goes wrong"
2152msgstr ""
2153
2154#. Tag: para
2155#: quickly-ubuntu-application-tutorial.xml:815
2156#, no-c-format
2157msgid "Edit the file Copyright to include your authorship."
2158msgstr ""
2159
2160#. Tag: para
2161#: quickly-ubuntu-application-tutorial.xml:817
2162#, no-c-format
2163msgid "If you want to put your own <application>Quickly</application> unsupported Licence, remove and replace the tags ### BEGIN AUTOMATIC LICENCE GENERATION and ### END AUTOMATIC LICENCE GENERATION in it by your own licence."
2164msgstr ""
2165
2166#. Tag: para
2167#: quickly-ubuntu-application-tutorial.xml:821
2168#, no-c-format
2169msgid "Executes either <code><application>Quickly</application> license</code> or <code><application>Quickly</application> licence &#60;License&#61;</code> where &#60;License&#61; can be either: - GPL-3 (default) - GPL-2"
2170msgstr ""
2171
2172#. Tag: para
2173#: quickly-ubuntu-application-tutorial.xml:828
2174#, no-c-format
2175msgid "This will modify the Copyright file with the chosen licence (with GPL-3 by default). Updating previous chosen Licence if needed. If you previously removed the tags to add your own licence, it will leave it pristine. If no name is attributed to the Copyright, it will try to retrieve it from Launchpad (in <application>Quickly</application> release or <application>Quickly</application> share command only)"
2176msgstr ""
2177
2178#. Tag: para
2179#: quickly-ubuntu-application-tutorial.xml:834
2180#, no-c-format
2181msgid "Finally, this will copy the Copyright at the head of every files."
2182msgstr ""
2183
2184#. Tag: para
2185#: quickly-ubuntu-application-tutorial.xml:836
2186#, no-c-format
2187msgid "Note that if you don't run <application>Quickly</application> licence before calling <application>Quickly</application> release or <application>Quickly</application> share, this one will execute it for you and guess the copyright holder from your launchpad account if you didn't update it."
2188msgstr ""
2189
2190#. Tag: title
2191#: quickly-ubuntu-application-tutorial.xml:843 quickly-ubuntu-application-tutorial.xml:844
2192#, no-c-format
2193msgid "<title>package</title>"
2194msgstr ""
2195
2196#. Tag: para
2197#: quickly-ubuntu-application-tutorial.xml:847
2198#, no-c-format
2199msgid "Creates a debian file (deb) from your project. Before running the package command you can edit the Icon and Category entry of *.desktop.in file, where * is the name of your project."
2200msgstr ""
2201
2202#. Tag: para
2203#: quickly-ubuntu-application-tutorial.xml:851
2204#, no-c-format
2205msgid "Note that if you didn't run <application>Quickly</application> release, <application>Quickly</application> share or <application>Quickly</application> change-lp-project you may miss the name, email in setup.py. You can edit them if you don't want to use any of these commands afterwards. Those changes are not a mandatory at all for testing purpose."
2206msgstr ""
2207
2208#. Tag: title
2209#: quickly-ubuntu-application-tutorial.xml:860 quickly-ubuntu-application-tutorial.xml:861
2210#, no-c-format
2211msgid "<title>release</title>"
2212msgstr ""
2213
2214#. Tag: code
2215#: quickly-ubuntu-application-tutorial.xml:862
2216#, no-c-format
2217msgid "<application>Quickly</application> release"
2218msgstr ""
2219
2220#. Tag: para
2221#: quickly-ubuntu-application-tutorial.xml:864
2222#, no-c-format
2223msgid "Posts a release of your project to a PPA on launchpad so that users can install the application on their system."
2224msgstr ""
2225
2226#. Tag: para
2227#: quickly-ubuntu-application-tutorial.xml:867
2228#, no-c-format
2229msgid "You can also execute: <code><application>Quickly</application> release &#60;release_number&#61;</code> of you don't want to use current release_number. The release_number must be a number."
2230msgstr ""
2231
2232#. Tag: para
2233#: quickly-ubuntu-application-tutorial.xml:871
2234#, no-c-format
2235msgid "<code><application>Quickly</application> release &#60;release_number&#61;</code> notes about changes where \"notes about changes\" is optional text describing what changes were made since the last save"
2236msgstr ""
2237
2238#. Tag: para
2239#: quickly-ubuntu-application-tutorial.xml:875
2240#, no-c-format
2241msgid "Before running <application>Quickly</application> release, you should: create your account and a project page on http://launchpad.net. You also have to add a PPA to your launchpad account."
2242msgstr ""
2243
2244#. Tag: para
2245#: quickly-ubuntu-application-tutorial.xml:879
2246#, no-c-format
2247msgid "Name, email and version setup.py will be automatically changed. (version will be &#60;current_release&#61; and bzr will commit and tagged. Once the release is done, &#60;current_release&#61; will be incremented by 0.1 to be ready for next release."
2248msgstr ""
2249
2250#. Tag: para
2251#: quickly-ubuntu-application-tutorial.xml:884
2252#, no-c-format
2253msgid "If you previously used <application>Quickly</application> shared &#60;current_release&#61;~publicX will be dropped to release &#60;current_release&#61; version (&#60;current_release&#61;~publicX &#60;current_release&#61;) You can modify the description and long description if you wish."
2254msgstr ""
2255
2256#. Tag: para
2257#: quickly-ubuntu-application-tutorial.xml:889
2258#, no-c-format
2259msgid "You can run <code><application>Quickly</application> package</code> and test your package to make sure it installs as expected. (This is not mandatory)"
2260msgstr ""
2261
2262#. Tag: title
2263#: quickly-ubuntu-application-tutorial.xml:895 quickly-ubuntu-application-tutorial.xml:896
2264#, no-c-format
2265msgid "<title>run</title>"
2266msgstr ""
2267
2268#. Tag: para
2269#: quickly-ubuntu-application-tutorial.xml:899
2270#, no-c-format
2271msgid "Runs your application. This is the best way to try test it out while you are developing it. It starts up the main project window."
2272msgstr ""
2273
2274#. Tag: title
2275#: quickly-ubuntu-application-tutorial.xml:905 quickly-ubuntu-application-tutorial.xml:906
2276#, no-c-format
2277msgid "<title>save</title>"
2278msgstr ""
2279
2280#. Tag: code
2281#: quickly-ubuntu-application-tutorial.xml:907
2282#, no-c-format
2283msgid "<application>Quickly</application> save notes about changes"
2284msgstr ""
2285
2286#. Tag: para
2287#: quickly-ubuntu-application-tutorial.xml:909
2288#, no-c-format
2289msgid "where \"notes about changes\" is optional text describing what changes were made since the last save."
2290msgstr ""
2291
2292#. Tag: para
2293#: quickly-ubuntu-application-tutorial.xml:912
2294#, no-c-format
2295msgid "This command commits all changes since the last save to bzr. Note that it does not push changes to any back up location. If you need revert or otherwise use the revision control, use bzr directly: <code>bzr help</code>"
2296msgstr ""
2297
2298#. Tag: title
2299#: quickly-ubuntu-application-tutorial.xml:920 quickly-ubuntu-application-tutorial.xml:922
2300#, no-c-format
2301msgid "<title>share</title>"
2302msgstr ""
2303
2304#. Tag: code
2305#: quickly-ubuntu-application-tutorial.xml:923
2306#, no-c-format
2307msgid "<application>Quickly</application> share"
2308msgstr ""
2309
2310#. Tag: para
2311#: quickly-ubuntu-application-tutorial.xml:925
2312#, no-c-format
2313msgid "Updates your PPA with the the latest saved project changes."
2314msgstr ""
2315
2316#. Tag: para
2317#: quickly-ubuntu-application-tutorial.xml:927
2318#, no-c-format
2319msgid "Before running <application>Quickly</application> release, you should: create your account on http://launchpad.net. You also have to add a PPA to your launchpad account."
2320msgstr ""
2321
2322#. Tag: para
2323#: quickly-ubuntu-application-tutorial.xml:931
2324#, no-c-format
2325msgid "Name, email and version setup.py will be automatically changed. (version will be &#60;current_release~publicX&#61; where X will be incremented at each <application>Quickly</application> share execution) You can modify the description and long description if you wish."
2326msgstr ""
2327
2328#. Tag: title
2329#: quickly-ubuntu-application-tutorial.xml:941
2330#, no-c-format
2331msgid "Links"
2332msgstr ""
2333
2334#. Tag: link
2335#: quickly-ubuntu-application-tutorial.xml:943
2336#, no-c-format
2337msgid "<link><application>Quickly</application>: <application>Quickly</application> Command Reference</link>"
2338msgstr ""
2339
2340#. Tag: ulink
2341#: quickly-ubuntu-application-tutorial.xml:946
2342#, no-c-format
2343msgid "Blog post on <application>Quickly</application>"
2344msgstr ""
2345
2346#. Tag: ulink
2347#: quickly-ubuntu-application-tutorial.xml:949
2348#, no-c-format
2349msgid "Language: Python Language Reference"
2350msgstr ""
2351
2352#. Tag: ulink
2353#: quickly-ubuntu-application-tutorial.xml:952
2354#, no-c-format
2355msgid "Core Library: Python 2.6 Library Reference"
2356msgstr ""
2357
2358#. Tag: ulink
2359#: quickly-ubuntu-application-tutorial.xml:955
2360#, no-c-format
2361msgid "UI Library: PyGtk"
2362msgstr ""
2363
2364#. Tag: ulink
2365#: quickly-ubuntu-application-tutorial.xml:958
2366#, no-c-format
2367msgid "Database: CouchDB Reference"
2368msgstr ""
2369
2370#. Tag: ulink
2371#: quickly-ubuntu-application-tutorial.xml:961
2372#, no-c-format
2373msgid "UI Editing: Glade User Documenation"
2374msgstr ""
2375
2376#. Tag: ulink
2377#: quickly-ubuntu-application-tutorial.xml:964
2378#, no-c-format
2379msgid "Editor: Gedit Help"
2380msgstr ""
2381
2382#. Tag: ulink
2383#: quickly-ubuntu-application-tutorial.xml:967
2384#, no-c-format
2385msgid "Version Control: Bazaar"
2386msgstr ""
2387
02388
=== removed file 'data/templates/ubuntu-application/help/quickly-dialogs.html'
--- data/templates/ubuntu-application/help/quickly-dialogs.html 2010-02-26 20:43:39 +0000
+++ data/templates/ubuntu-application/help/quickly-dialogs.html 1970-01-01 00:00:00 +0000
@@ -1,286 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Quickly Tutorial Part 2</TITLE>
4<STYLE>
5img
6{
7 display: block;
8 width:668px;
9 padding-top:10px;
10}
11p
12{
13 width: 800px;
14}
15
16</STYLE>
17</HEAD>
18<BODY>
19<H1>Introduction to Part 2</H1>
20<P>In part 1, we created an application that can read and write text files, and persist them in the couchdb backend. However, the application has a hideous usability flaw, in the text box for specifying titles when saving and opening files is very confusing. In part 2, we'll fix thay by adding a save and an open dialog.
21
22</P>
23
24<H1>Creating a Quickly Dialog</H1>
25<H2>Creating the Empty Dialog</H2>
26<P>It's simple to add an empty, but working dialog to your project. Simply specify the name of the new dialog, and it will be added automatically. Assuming that you are in the jotty project directory:</P>
27<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
28$quickly dialog save
29</TEXTAREA></DIV>
30<P>This will add the dialog to your project.</P>
31<H2>Editing the New Dialog</H2>
32<P>To edit the UI for the dialog, you'll need to load it into Glade again. If you already have an instance of glade running, you might want to go ahead and close it first, as it may get confusing if you have more than one open at a time. After closing glade, simply open it again:</P>
33<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
34$quickly design
35</TEXTAREA></DIV>
36<P>Then use the project menu to switch to newly created SaveDialog.ui file.</P>
37<IMG SRC="./images/glade17.png" ALT="save dialog ready to edit" />
38<P>Then add some widgets for the UI. Start with a Vertical Box (VBox) with two items. Put label in the top, and an HBox in the bottom slot. In the HBox, add a label and an edit widget, just like you did for JottyWindow in part 1. Set the padding and expand properties as well.</P>
39<IMG SRC="./images/glade18.png" ALT="save dialog all edited" />
40<H2>Code the Dialog</H2>
41<P>You can use the "quickly edit" command to open the SaveDialoy.py file. This dialog needs very little additional code to work. Essentially, you just need a way to retrieve the string specified by the user. We'll add a qiuck accessor method for this:</P>
42<DIV class="code"><TEXTAREA rows="2" cols="80">
43 @property
44 def title_text(self):
45 return self.builder.get_object("entry1").get_text()
46</TEXTAREA></DIV>
47<P>We don't need to write any code for the Ok and Cancel buttons, as they were automatically hooked up by quickly when it created the dialog.</P>
48<P>Before we go on to invoking the dialog, delete HBox from JottyWindow that holds the text entry and label, as we won't be needing those.</P>
49<IMG SRC="./images/glade19.png" ALT="text entry now deleted" />
50
51<H1>Calling the Save Dialog</H1>
52<P>To use the dialog in JottyWindow, we need to follow these steps:</P>
53<OL>
54<LI>Import SaveDialog in JottyWindow</LI>
55<LI>In the save_file function, create an instance of SaveDialog</LI>
56<LI>Run the Dialog</LI>
57<LI>Get the String</LI>
58<LI>Destroy the dialog</LI>
59</OL>
60<H2>Importing the SaveDialog</H2>
61Add the SaveDialog to the list of imported modules at the top of the, so it looks like this:
62<DIV class="code"><TEXTAREA rows="1" cols="80">
63from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog
64</TEXTAREA></DIV>
65
66<H2>Create an instance of the dialog and run it</H2>
67<P>When the user chooses Save, we want to open the SaveDialog and collect the title of the note from the user. So we need to modify our save_file function.</P>
68
69<P>To create an instance of the dialog, use the NewSaveDialog() function in the SaveDialog module. It's important that you don't create an instance of SaveDialog directly, as it won't have a chance to load up it's UI that way, and it won't work. So whenever you use a quickly dialog, do it like this:</P>
70<DIV class="code"><TEXTAREA rows="1" cols="80">
71 saver = SaveDialog.NewSaveDialog()
72</TEXTAREA></DIV>
73<P>To make the dialog appear, simply use the run() method. However, we want to check the result, so we'll need to store that in a variable. After it runs, we want to collect the string from the user, like this:</P>
74<DIV class="code"><TEXTAREA rows="2" cols="80">
75 result = saver.run()
76 title = saver.title_text
77</TEXTAREA></DIV>
78
79<H2>Clean up the dialog</H2>
80<P>We need to tell the dialog to not show itself anymore. We could call saver.hide() to make it hide, but since we don't need it hanging around, we'll just destroy it. Before we go on, though, we need to ensure that the user actually wants to save, so if we didn't get the Ok result, we should just return out of the function:</P>
81<DIV class="code"><TEXTAREA rows="2" cols="80">
82 saver.destroy()
83 if result != gtk.RESPONSE_OK:
84 return
85</TEXTAREA></DIV>
86
87<P>Since we're now getting the title from the dialog instead of the text entry, we should delete the line of the code that sents it from entry1. So except for the addition of the dialog code, the save_file function looks pretty much the same as it did in part 1:</P>
88
89<DIV class="code"><TEXTAREA rows="32" cols="80">
90 def save_file(self, widget, data=None):
91 #get the titel from the user
92 saver = SaveDialog.NewSaveDialog()
93 result = saver.run()
94 title = saver.title_text
95
96 saver.destroy()
97 if result != gtk.RESPONSE_OK:
98 return
99
100 #get the text to save
101 buff = self.builder.get_object("textview1").get_buffer()
102 start_iter = buff.get_start_iter()
103 end_iter = buff.get_end_iter()
104 text = buff.get_text(start_iter,end_iter)
105
106 #get all the records
107 record_type = "http://wiki.ubuntu.com/Quickly/JottyDoc"
108 results = self.database.get_records(record_type = record_type,
109 create_view = True)
110
111 #update a record that has the same title
112 for result in results:
113 record = result.value
114 if record["title"] == title:
115 key = result.key
116 self.database.update_fields(key, {"text":text})
117 return
118
119 #if no records had the title, create it
120 new_rec = Record({"record_type":record_type ,
121 "title":title, "text":text})
122 self.database.put_record(new_rec)
123</TEXTAREA></DIV>
124
125Now when we choose save, we get the SaveDialog instead:
126<IMG SRC="./images/application4_5.png" ALT="save file dialog works much better" />
127
128<H1>Creating a Dialog with a CouchGrid</H1>
129<P>
130We'll use a similar approach in the Open dialog that we did with Save. However, there is one big difference, we want to provide the user with a list of documents that you could choose to open. We'll use a widget called CouchGrid, which is included in the desktopcouch api for this.
131</P>
132<H2>Create the Open Dialog</H2>
133<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
134$quickly dialog open
135</TEXTAREA></DIV>
136<H2>Editing the New Dialog</H2>
137<P>Start out by closing, and then reopening glade again:</P>
138<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
139$quickly design
140</TEXTAREA></DIV>
141<P>Start by adding an HBox and label in the sammer manner as in the Save Dialog above. Leave an empty space in the HBox. We will use code to put the CouchGrid there.</P>
142<IMG SRC="./images/glade20.png" ALT="save space for the CouchGrid" />
143
144<H2>Coding the Open Dialog</H2>
145<H3>Creating and Adding a CouchGrid</H3>
146<P>It just takes a little bit of code to add a CouchGrid to the dialog. We need to:</P>
147<OL>
148<LI>Import the CouchGrid class.</LI>
149<LI>Create a CouchGrid pointing at the jotty database, and the desired record type.</LI>
150<LI>Add the CouchGrid to the dialog.</LI>
151</OL>
152<H4>Import the CouchGrid class</H4>
153<P>CouchGrid is part of the desktopcouch records api, so we import it like this:</P>
154<DIV class="code"><TEXTAREA rows="1" cols="80">
155from desktopcouch.records.couchgrid import CouchGrid
156</TEXTAREA></DIV>
157<H4>Create the CouchGrid</H4>
158<P>A CouchGrid needs to know three things, the name of the database, the name of the record type to, and the name of the keys to use. "keys" is a list of fields that the widget will display, and by default will also use the same text for the heading of any columns. This set up should be done in the OpenDialog's finish_initalizing function. All this is easily done in code like this:
159<DIV class="code"><TEXTAREA rows="4" cols="80">
160 database = "jotty"
161 keys = ["title"]
162 record_type = "http://wiki.ubuntu.com/Quickly/JottyDoc"
163 self.couchgrid = CouchGrid(database, record_type=record_type,keys=keys)
164</TEXTAREA></DIV>
165<H4>Add the CouchGrid to the Dialog</H4>
166<P>When we added the HBox to the dialog, we left an open space at the bottom. We'll use this by "packing" the CouchGrid into the HBox. We need to show it as well. So add the following lines to the finish_initializing function as well:
167<DIV class="code"><TEXTAREA rows="2" cols="80">
168 self.couchgrid.show()
169 self.builder.get_object("vbox1").pack_end(self.couchgrid)
170</TEXTAREA></DIV>
171
172<H3>Create the get_selection function</H3>
173<P>The dialog still needs a bit more code to work. It needs to return the user's selection, if there is one. To do this, we need to ask the CouchGrid what is selected. This is easy using the widgets selected_record_ids function. But the CouchGrid supports multiple selection, so we'll do the following:</P>
174<OL>
175<LI>Use a decorator to define the function as a property accessor.</LI>
176<LI>Get all the selected record ids.</LI>
177<LI>If none are selected, return None.</LI>
178<LI>Pick the first one and return it.</LI>
179</OL>
180<P>So the function to add to OpenDialog looks like this:</P>
181<DIV class="code"><TEXTAREA rows="7" cols="80">
182 @property
183 def selected_record_id(self):
184 ids = self.couchgrid.selected_record_ids
185 if len(ids) < 1:
186 return None
187 else:
188 return ids[0]
189</TEXTAREA></DIV>
190<H1>Using the Open Dialog</H1>
191<P>Now we want to use the Open Dialog in the JottyWindow open_file function. To use it,we'll follow these steps:</P>
192<OL>
193<LI>Import OpenDialog in JottyWindow</LI>
194<LI>In the open_file function, create an instance of OpenDialog</LI>
195<LI>Run the Dialog</LI>
196<LI>Get the id for the selected title.</LI>
197<LI>Destroy the dialog</LI>
198<LI>Check the response before proceeding</LI>
199<LI>Use the id to get the record from CouchDB</LI>
200<LI>Update the UI</LI>
201</OL>
202
203<H2>Import OpenDialog</H2>
204<P>Just like the SaveDialog, add the import line to the list of imports:</P>
205<DIV class="code"><TEXTAREA rows="1" cols="80">
206from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog, OpenDialog
207</TEXTAREA></DIV>
208
209<H2>Create an instance of the dialog and run it</H2>
210<P>So now we're ready to call the dialog from the JottyWindow's open_file function. Creating the OpenDialog is exactly the same as creating the SaveDialog, except we also want to tell it to load the titles before we run it:</P>
211<DIV class="code"><TEXTAREA rows="3" cols="80">
212 opener = OpenDialog.NewOpenDialog()
213 result = opener.run()
214</TEXTAREA></DIV>
215
216<H2>Get the id for the selected title</H2>
217<P>Now use the property that we created to retrieve the title and text from the dialog. Don't forget to check the response type before going on.</P>
218<DIV class="code"><TEXTAREA rows="5" cols="80">
219 rec_id = opener.selected_record_id
220
221 #close the dialog, and check whether to proceed
222 opener.destroy()
223 if result != gtk.RESPONSE_OK:
224 return
225</TEXTAREA></DIV>
226
227
228<H2>Use the id to get the record from CouchDB</H2>
229<P>If nothing was selected, we'll just return. Otherwise, we'll retrieve the record from CouchDB and pull out the text for the document:</P>
230<DIV class="code"><TEXTAREA rows="5" cols="80">
231 #get the record from CouchDB and extract the text
232 if rec_id == None:
233 return
234 record = self.database.get_record(rec_id)
235 text = record["text"]
236</TEXTAREA></DIV>
237
238<H2>Update the UI</H2>
239<P>Now just put the text into the texview:</P>
240<DIV class="code"><TEXTAREA rows="3" cols="80">
241 #set the UI to display the string
242 buff = self.builder.get_object("textview1").get_buffer()
243 buff.set_text(text)
244</TEXTAREA></DIV>
245<P>That's all there is to it. So the whole open_file function looks like this:</P>
246<DIV class="code"><TEXTAREA rows="21" cols="80">
247 def open_file(self, widget, data=None):
248 #run the open dialog
249 opener = OpenDialog.NewOpenDialog()
250 result = opener.run()
251
252 #get the record id from the dialog
253 rec_id = opener.selected_record_id
254
255 #close the dialog, and check whether to proceed
256 opener.destroy()
257 if result != gtk.RESPONSE_OK:
258 return
259
260 #get the record from CouchDB and extract the text
261 if rec_id == None:
262 return
263 record = self.database.get_record(rec_id)
264 text = record["text"]
265
266 #set the UI to display the string
267 buff = self.builder.get_object("textview1").get_buffer()
268 buff.set_text(text)
269</TEXTAREA></DIV>
270<P>Now users get a nice open dialog:</P>
271<IMG SRC="./images/application5.png" ALT="open dialog works much better" />
272
273
274<H1>Finishing the Application</H1>
275<P>Now opening a saved document is much more intuitive.</P>
276<IMG SRC="./images/application6.png" ALT="open file dialog works much better" />
277<P>However, the application is not complete. There are a few things left for you to do:</P>
278<UL>
279<LI>Set the title of the JottyWindow to display the note title. Try self.set_text(title).</LI>
280<LI>The Save command works more like "Save As". The application probably shouldn't pop up a SaveDialog every time you want to save. If it's already been saved, you probably just want to save it, but use a SaveDialog when the user choose Save As, or is saving a document for the first time.</LI>
281<LI>The OpenDialog should probably return when the user double clicks on an item in the list. Try connecting to the "select-cursor-row" signal on the TreeView, and calling self.response(gtk.RESPONSE_OK) in the handler.</LI>
282<LI>Perhaps the Ok button in the OpenDialog should be disabled if nothing is selected. Try setting the "sensitivity" in Glade, and the set_sensitive function for the Ok button.</LI>
283<LI>It would be more consistent for the Open and Close dialogs to have "Open" and "Close" for buttons instead of "Ok". You can set a different type in the properties window in Glade.</LI>
284<LI>Loading every document into the open dialog is probably a bit inefficient. Perhaps storing the document id and using that to retrieve the document would be a better implementation.</LI>
285</UL>
286</BODY>
2870
=== removed file 'data/templates/ubuntu-application/help/quickly-getting-started.html'
--- data/templates/ubuntu-application/help/quickly-getting-started.html 2010-02-26 20:43:39 +0000
+++ data/templates/ubuntu-application/help/quickly-getting-started.html 1970-01-01 00:00:00 +0000
@@ -1,315 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Quickly Tutorial Part 1</TITLE>
4<STYLE>
5img
6{
7 display: block;
8 width:668px;
9 padding-top:10px;
10}
11p
12{
13 width: 800px;
14}
15
16</STYLE>
17</HEAD>
18<BODY>
19<H1>Introduction to Part 1</H1>
20<P>This part 1 of the Quickly tutorial. This part is will introduce some key quickly commands, editing a user interface in Glade, and editing code in Gedit. This part of the tutorial will familiarize you with these three tools, and how they work together with python and pygtk so that you can quickly build applications.</P>
21
22
23<H1>Creating a Quickly Project</H1>
24<H2>Creating the Empty Project</H2>
25<P>Creating an empty but working program couldn't be simpler. First, open a terminal window to type commands into. When it's open, type the command:</P>
26<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
27$quickly create ubuntu-application jotty
28</TEXTAREA></DIV>
29<IMG SRC="./images/terminal1.png" ALT="type 'quickly create ubuntu-application jotty' into terminal" />
30<P>This will create a jotty sub directory containing a complete directory tree and files for an empty python application. The command finishes by running the newly created empty application.</P>
31<IMG SRC="./images/application1.png" ALT="The command finishes by running the empty application." />
32
33<H2>Testing the Empty Application</H2>
34<P>They are populated and set up, and you can resize the window. Notice that quickly inferred that the application title is "Jotty". Only a few of menu items do anything in the empty application, Help->About, Edit->Preferences, and File->Quit.</P>
35<IMG SRC="./images/application2.png" ALT="The menus are populated and set up." />
36
37<H2>Running the Application</H2>
38<P>Close the application by closing the window or using the Quit command. Since the empty application isn't installed into Ubuntu yet, you can't start the application from the application menu yet. To start the applicaton, use the terminal to first cd into the new subdirectory, and then use "quickly run" to start the program.</P>
39<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
40$cd jotty
41jottyt$quickly run
42</TEXTAREA></DIV>
43<IMG SRC="./images/terminal3.png" ALT="run the empty application from the terminal" />
44
45<H1>Editing an Application</H1>
46<H2>Edit the User Interface in Glade</H2>
47<P>Quickly programs use Glade to edit the user interface. Start Glade with quickly in order to set up Glade for editing the empty applicaton. Don't start glade directly, or it won't load the necessary catalogue files for editing the classes that were automaticaly generated by quickly.</P>
48<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
49jotty$ quickly design
50</TEXTAREA></DIV>
51<IMG SRC="./images/terminal4.png" ALT="start glade with the 'quickly glade' command " />
52<P>Glade will open with the project loaded up and ready to edit.</P>
53<IMG SRC="./images/glade1.png" ALT="glade loads the project " />
54<P>Use the Project Menu to choose "JottytWindow.ui" for editing.</P>
55<IMG SRC="./images/glade2.png" ALT="choose JottyWindow.ui from the project menu " />
56<P>We want to create a text area for typing into. There are some default Widgets added to the Window. We won't need these so we'll start with deleting them. Click on the label, and press delete, and it will disappear from the window.</P>
57<IMG SRC="./images/glade3.png" ALT="select the label" />
58
59<IMG SRC="./images/glade4.png" ALT="delete the label from the window" />
60<P>Do the same with the image widget. This leave us two free slots.</P>
61<IMG SRC="./images/glade6.png" ALT="two empty slots in the window" />
62<P>We'll use the bottom slot to add a TextView widget for the user to type into. In the toolbox, click on the TextView widget. Then click in the empty slot.</P>
63<IMG SRC="./images/glade7.png" ALT="click on the text view widget" />
64
65<P>Make sure you save the file in Glade, or your changes won't take! Then run the application from terminal again. The window now has a place where the user can type.</P>
66<IMG SRC="./images/application3.png" ALT="the applicaton permits typing" />
67
68<P>Now we'll add the entry field for the title, and also a label for it. We'll use the top empty slot for that. First, click on Horizontal Box (HBox) from the "Containers" section of the pallette, and then click on the top slot. A dialog box will open, tell it that you want two items.</P>
69<IMG SRC="./images/glade8.png" ALT="tell the hbox you want two items" />
70<P>The HBox is a container that arranges it's children horizontally. Add a label to the empty left hand box, and a Text Entry to the right hand one.</P>
71<IMG SRC="./images/glade9.png" ALT="text entry is added" />
72
73<P>Before going on, let's clean up the UI just a tad here. Select the new HBox from the treeview in the inspector window. Then go to the Packing tab, and set Expand and Fill to "No".</P>
74<IMG SRC="./images/glade10.png" ALT="no expand and fill" />
75
76<P>Go to the General tab, and set spacing to 5.</P>
77<IMG SRC="./images/glade11.png" ALT="spacing is 5" />
78
79<P>Select the label. On the general tab, set "Label" to "Name:". Set expand and fill to "no" for the label, but keep it "yes" for the entry. Set the padding for both to 5 (also on the Packing tab).</P>
80<IMG SRC="./images/glade12.png" ALT="glade all cleaned up" />
81
82<H2>Add the Save, Open, and New Features</H2>
83<P>After the user types something, they may want to save it. A File->Save menu item was automatically created when the empty applicaton was created, but it's not hooked up to any code. To make Save work, we need tell the menu item what function to call, and then create a function to actually do the saving.</P>
84
85<H3>Set the Signal Handler in Glade</H3>
86<P>To tell the menu item what function to call. If glade is not still open, open up the application in glade:</P>
87<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
88jotty$ quickly design
89</TEXTAREA></DIV>
90
91<P>Click on the file menu, and the menu opens as if the application were running.</P>
92<IMG SRC="./images/glade13.png" ALT="choose the menu item" />
93
94<P>Choose the Save menu item, and it will be selected in Glade.</P>
95<IMG SRC="./images/glade14.png" ALT="the menu item is selcted in glade" />
96
97<P>Then choose the "Signals" tab of the properties window.</P>
98<IMG SRC="./images/glade15.png" ALT="signals tab in glade" />
99<P>In pygtk, 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. We'll call the function "save_file". Simply type the function name into the box for the activate signal.Make sure to save the glade file.</P>
100<IMG SRC="./images/glade16.png" ALT="activate signal set to 'save_file'" />
101<P>Note that you will need to setup the "open_file" signal and the "new_file" signal as well when you get to those functions later.</P>
102
103<H2>Edit the Code in Gedit</H2>
104<H3>Set Up Tabs Correctly</H3>
105<P>Note a major gotcha here. In python spaces and tabs are totally different, but they look just the same in an editor. So being indented one tab stop is not the same as being indented four spaces, even though they might look the same. And indentation level is very important in python. You will get a lot of errors if you mix tab indentation with space indentation. Your generated project follows the python standard of using four spaces for each indentation level. So you'll either have to hit the space bar four time every time you indent, or set up your editor to use the right number of spaces for tabs.</P>
106<P>The upshot is that you should take a moment to set up your Gedit (or whatever editor you are using) to use spaces for tabs. In Gedit, select Preferences from the Edit menu, and choose the Editor tab. Then set Tab width to 4, and turn on "Insert spaces instead of tabs". Your preferences should look like this:</P>
107<IMG SRC="./images/gedit2.png" ALT="python files ready to edit" />
108
109<H3>Create the Save File Signal Handler</H3>
110<P>Now you're ready to write some code. Of course just telling the glade file what signal to emit won't make the file actually save, because we haven't created the "save_file" function yet. The code for JottyWindow is stored in the file jotty. jotty is a special python file that is the entry point for your application. Other python files in your application have the ".py" suffix.</P>
111
112<P>Use the quickly edit command to start editing your code files:</P>
113<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
114jotty$ quickly edit
115</TEXTAREA></DIV>
116<P>This will open the default Ubuntu text editor "Gedit" with any python files in the python directory.</P>
117<IMG SRC="./images/gedit1.png" ALT="python files ready to edit" />
118
119
120<P>JottyWindow.ui is now expecting to find a function JottyWindow.save_file(), so we simply add one to the JottyWindow class in the jotty file right under the on_destroy funtion.:</P>
121<DIV class="code"><TEXTAREA rows="3" cols="80">
122 def save_file(self, widget, data=None):
123 print "save"
124</TEXTAREA></DIV>
125<P>This will print the word "save" to the terminal when run. The method signature is the standard signature expected in a signal handler. If you are new to python, be sure to copy the indentations exactly, as the indentation level is very important in python.</P>
126
127<P>Save the file, and run it again:</P>
128<DIV class="termnial"><TEXTAREA rows = "2" cols="80">
129jotty$ quickly run
130</TEXTAREA></DIV>
131<P>Choose "File->Save" from the menu, and you'll see the word "save" printing out interminal. That's all there is to hookig up the functions!</P>
132<IMG SRC="./images/application3_5.png" ALT="'save' gets printed to the terminal" />
133
134<H3>Implementing Save</H3>
135<P>Now we'll write a little code in the signal handler to actually save the text. Because we want it to be easy for users to do things like syncronize their Jotty documents between computers, back it up, etc... we'll use couchdb as our backend, and we'll use desktopcouch for our api. Note that if you are not interested in learning about how to save to and read from couchdb, you can just snipe the code.
136
137Mostly likely you already have everything you need installed when you installed quickly. But, you may need to install couchdb, desktopcouch, and the desktopcouch records api. The fastest way to do this is from the terminal:</P>
138<DIV class="termnial"><TEXTAREA rows = "1" cols="80">
139$sudo apt-get install python-desktopcouch-records
140</TEXTAREA></DIV>
141
142<P>This will install the api, and everything you need for the api to run. After desktopcouch is installed, you can write the code. The code will do the following:</P>
143<OL>
144<LI>Import the stuff you'll need from desktopcouch.</LI>
145<LI>Get a reference to the couchdb database to save into.</LI>
146<LI>Get the title of the document and the text from the user interface.</LI>
147<LI>Check if there is already a document with the same title, and if so overwrite it.</LI>
148<LI>If there is not a document already, create one.</LI>
149</OL>
150
151<H4>Import the stuff you'll need from python-desktopcouch-records.</H4>
152<P>Add these import statements along with the other imports to the top of the jotty file:</P>
153<DIV class="code"><TEXTAREA rows="3" cols="80">
154from desktopcouch.records.server import CouchDatabase
155from desktopcouch.records.record import Record
156</TEXTAREA></DIV>
157
158<H4>Get a Reference to the Database</H4>
159<P>Desktopcouch will set up a database for us, or create a new one if it's needed. We'll use "jotty" for the name of the database. Since we want this line to run every time the Jotty Window is created, put it at the end of the finish_initializing function:</P>
160<DIV class="code"><TEXTAREA rows="1" cols="80">
161 self.database = CouchDatabase("jotty", create=True)
162</TEXTAREA></DIV>
163
164<P>Now that we have an instance-wide reference to the database, we'll add code to the save_file function to run whenever the Save command is issued.</P>
165<H4>Here's the code to pull the title out of the title entry:</H4>
166<DIV class="code"><TEXTAREA rows="2" cols="80">
167 #get the title for the note
168 title = self.builder.get_object("entry1").get_text()
169</TEXTAREA></DIV>
170
171<H4>Here's the code to get pull the text out of the TextView:</H4>
172<P>In pygtk, TextView widgets have a text buffer that stores the text. So you ask the TextView for it's TextBuffer, and then you ask the TextBuffer for the text. You use iters to determine from which part of the text buffer you want text. Since we want all the text, it's easy to just get the start and end iters.</P>
173<DIV class="code"><TEXTAREA rows="7" cols="80">
174 #get the string
175 buff = self.builder.get_object("textview1").get_buffer()
176 start_iter = buff.get_start_iter()
177 end_iter = buff.get_end_iter()
178
179 text = buff.get_text(start_iter,end_iter)
180</TEXTAREA></DIV>
181
182<H4>Saving a document to Couchdb</H4>
183<P>A record in couch is essentially a python dictionary with some extra key/value pairs to make the database work. So we can save the document to couch like this:</P>
184<DIV class="code"><TEXTAREA rows="4" cols="80">
185 record_type = "http://wiki.ubuntu.com/Quickly/JottyDoc"
186 new_rec = Record({"record_type": record_type,
187 "title":title, "text":text})
188 self.database.put(new_rec)
189</TEXTAREA></DIV>
190<P>The "record_type" field is not strictly required, but among other things, it makes it easy to fetch the documents later. By convention, we use a url to specify the record type. This provides a place for other developers to go to read about the record type. The description only needs to be human readable. Couchdb is not a typed database, so don't expect that the url will have any kind of schema definition or anything. You can use whatever url you want, and put whatever you want at that URL.</P>
191
192<H4>Check for a pre-existing note with the same title</H4>
193<P>Before we just write the new document though, we have to take note of the fact that couch will allow you to create as many documents as you want with the same title. We probably don't want this, so we we'll have to write a little code to check if there is already a document in couch with the same title, and if there is, update that document rather than create a new one.</P>
194<P>In CouchDB, you don't do a lot of data processing in the database like you would with a relational database. To be most efficient, we could use the desktopcouch API to create a view in CouchDB, but it's probably simplest just to do the necessary processing on the client for now. To do this, we'll use a desktopcouch function to retrieve all of the records of a specified record type.</P>
195
196<P>To find and update documents with a matching title we will:</P>
197<OL>
198<LI>Retrieve all of the documents with the CouchDatabase.get_records function.</LI>
199<LI>Check each of the returned records for a matching title.</LI>
200<LI>If there is a match, update the record using the CouchDatabase.update_fields function and return.</LI>
201</OL>
202
203<P>This all may sound very weird, but in code, it's not quite so complicated:</P>
204<DIV class="code"><TEXTAREA rows="9" cols="80">
205 #get all the records
206 record_type = "http://wiki.ubuntu.com/Quickly/JottyDoc"
207 results = self.database.get_records(record_type = record_type,
208 create_view = True)
209
210 #update a record that has the same title
211 for result in results:
212 document = result.value
213 if document["title"] == title:
214 key = document["_id"]
215 self.database.update_fields(key, {"text":text})
216 return
217
218</TEXTAREA></DIV>
219
220<H4>So the whole function should look like this:</H4>
221<DIV class="code"><TEXTAREA rows="20" cols="80">
222 def save_file(self, widget, data=None):
223 #get the title for the note
224 title = self.builder.get_object("entry1").get_text()
225
226 #get the text to save
227 buff = self.builder.get_object("textview1").get_buffer()
228 start_iter = buff.get_start_iter()
229 end_iter = buff.get_end_iter()
230 text = buff.get_text(start_iter,end_iter)
231
232 #get all the records
233 record_type = "http://wiki.ubuntu.com/Quickly/JottyDoc"
234 results = self.database.get_records(record_type = record_type,
235 create_view = True)
236
237 #update a record that has the same title
238 for result in results:
239 document = result.value
240 if document["title"] == title:
241 key = result.key
242 self.database.update_fields(key, {"text":text})
243 return
244
245 #if no records had the title, create it
246 new_rec = Record({"record_type":record_type ,
247 "title":title, "text":text})
248 self.database.put_record(new_rec)
249
250</TEXTAREA></DIV>
251
252<P>Couchdb makes it really easy to see if your save function is working. You can just point your web browser at it and explore the database:</P>
253<DIV><A HREF="file:///home/your_user_name>/.local/share/desktop-couch/couchdb.html">file:///home/rick/.local/share/desktop-couch/couchdb.html</A></DIV>
254<IMG SRC="./images/couch1.png" ALT="open couchdb in a browser" />
255<P>If you are redirected to a page that doesn't work, you probably just need to clear your browser cache and try again.</P>
256
257<H3>Implementing Open and New</H3>
258<P>To open a saved document, the user will type the title of the document that they want to open in the text entry, and choose "Open" from the main menu. If there is no matching document there, it will just clear out the text view, ready for input. This is probably not too intuitive, so we'll add a dialog box for prompting the user for the title, but that's for later in the tutorial. For now, we'll just use the same text entry field.</P>
259
260<H4>Implementing Open is essentially the reverse of Save:</H4>
261<P>Follow these steps:</P>
262<OL>
263<LI>Add the open_file signal to the menu item in Glade.</LI>
264<LI>Retrieve all of the documents with the CouchDatabase.get_records function.</LI>
265<LI>Check each of the returned records for a matching title.</LI>
266<LI>If there is a match, pull out the text and display it in the text view.</LI>
267</OL>
268
269<P>So the open_file function looks like so:</P>
270<DIV class="code"><TEXTAREA rows="20" cols="80">
271 def open_file(self, widget, data=None):
272 #get the name of the document to open
273 title = self.builder.get_object("entry1").get_text()
274 text = ""
275
276 #get all the records
277 record_type = "http://wiki.ubuntu.com/Quickly/JottyDoc"
278 results = self.database.get_records(record_type = record_type,
279 create_view = True)
280
281 #get the text if there is a matching title
282 for result in results:
283 document = result.value
284 if document["title"] == title:
285 text = document["text"]
286
287 #set the UI to display the string
288 buff = self.builder.get_object("textview1").get_buffer()
289 buff.set_text(text)
290</TEXTAREA></DIV>
291
292<H4>Implement New</H4>
293<P>First, add the new_file signal to the menu item in Glade, then add this code to clear out the text:</P>
294<DIV class="code"><TEXTAREA rows="4" cols="80">
295 def new_file(self, widget, data=None):
296 self.builder.get_object("entry1").set_text("Note Title")
297 buff = self.builder.get_object("textview1").get_buffer()
298 buff.set_text("")
299</TEXTAREA rows="20" cols="80"></DIV>
300
301<P>To make them work, add these functions to the JottyWindow class, and save. Then go back and connect the functions to the activate signals for the Open and New menu items.</P>
302
303<DIV class="ref_link">
304<A HREF="./code/jotty">Complete jotty file</A>
305</DIV>
306
307<H1>Saving Your Work</H1>
308<P>When Quickly created your application, it automatically added it to Bazaar, a source code versioning system. You can use Bazaar to roll back mistake, see code history, compare versions, etc... Quickly has a convenience function for backing up your work:</P>
309<DIV class="termina"><TEXTAREA rows="1" cols="80">
310$ quickly save "First working version of Jotty"
311</TEXTAREA></DIV>
312<P>This will call "$ bzr add" and then "$ bzr commit -m [your message]" for you.</P>
313
314</BODY>
315</HTML>
3160
=== removed file 'data/templates/ubuntu-application/help/quickly-package.html'
--- data/templates/ubuntu-application/help/quickly-package.html 2009-12-27 10:37:40 +0000
+++ data/templates/ubuntu-application/help/quickly-package.html 1970-01-01 00:00:00 +0000
@@ -1,176 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Quickly Tutorial Part 3</TITLE>
4<STYLE>
5img
6{
7 display: block;
8 width:668px;
9 padding-top:10px;
10}
11p
12{
13 width: 800px;
14}
15
16</STYLE>
17</HEAD>
18<BODY>
19<H1>Introduction to Part 3</H1>
20<P>In parts 1 and 2, we showed how to create a simple Ubuntu application using Quickly. This section will cover how to package an application so that it is easy for you to share, and easy for other people to install.</P>
21<H1>License your Application</H1>
22<P>It's important to license your code so users and other programmers know their rights in terms of redistributing or modifying it. To quickly grant a GPL license to your code, simply:</P>
23<OL>
24<LI>Specify your name and email address in the Copyright file.</LI>
25<LI>Run the "license" command.</LI>
26</OL>
27<H2>Specify your name and email</H2>
28<P>When Quickly created your ubuntu application, it added a file named Copyright in the top level of the directory. Open this file in your text editor, and modify the top line so it has your name and email included. Be sure not to modify other lines as it will interfere with the next step. For example, I would change the entire file to look like this:</P>
29<DIV class="code"><TEXTAREA rows="3" cols="80">
30# Copyright (C) 2009 Rick Spencer rick.spencer@canonical.com
31### BEGIN AUTOMATIC LICENSE GENERATION
32### END AUTOMATIC LICENSE GENERATION
33</TEXTAREA></DIV>
34<H2>Run the "License" Command</H2>
35<P>By default, Quickly will use a GPL 3 license for your project. To use this license, use this command:</P>
36<DIV class="terminal"><TEXTAREA rows="1" cols="80">
37$quickly license
38</TEXTAREA></DIV>
39This will add the GPL 3 license to all of your code files that you've added to your project using Quickly.
40
41<P>Keep in mind a couple of things:<P>
42<UL>
43<LI>This is a one way trip. Once you license the project, changes to the license must be done manually.</LI>
44<LI>If you prefer a GPL 2 license, you can specify that when you issue the license command:
45<DIV class="terminal"><TEXTAREA rows="1" cols="80">
46$quickly license GPL-2
47</TEXTAREA></DIV>
48</LI>
49<LI>Quickly doesn't care what license you use, but only knows natively what files and headers to include for BSD, GPL-2, GPL-3, LGPL-2 and LGPL-3. If you prefer another license, you can simply add whatever you license you like by adding your own license in the Copyright file:
50<DIV class="code"><TEXTAREA rows="3" cols="80">
51### BEGIN AUTOMATIC LICENSE GENERATION
52# My personal license here
53### END AUTOMATIC LICENSE GENERATION
54</TEXTAREA></DIV>
55and then run:
56<DIV class="code"><TEXTAREA rows="1" cols="80">
57quickly license
58</TEXTAREA></DIV>
59to license every files.
60</LI>
61<LI>If you've added code files or other files to your project manually, you will need to add the license to those files manually or add those tags at the beginning of the file:
62<DIV class="code"><TEXTAREA rows="2" cols="80">
63### BEGIN LICENSE
64### END LICENSE
65</TEXTAREA></DIV>
66</LI>
67</UL>
68<H1>Specify Application Settings</H1>
69<P>
70You should personalize your application a little before creating the archive. This is very easy to do, as all of the files that you need have already been created, and only need a few lines changed to make them your own. To do this you should:
71</P>
72<OL>
73<LI>Personalize the Application Icon</LI>
74<LI>Edit the Desktop File</LI>
75<LI>Edit the setup.py File</LI>
76</OL>
77<H2>Personalize your Application Icon</H2>
78<P>
79When users install your application, Ubuntu will display an icon next to it in the menus. You can create your own icon or edit the file called "icon.png" in the media directory (jotty/data/media). Ubuntu comes with a great image editing program called "Gimp." So you can go:</P>
80<DIV class="terminal"><TEXTAREA rows="1" cols="80">
81$gimp data/media/icon.png
82</TEXTAREA></DIV>
83<IMG SRC="./images/package0.png" ALT="customized jotty icon" />
84</P>
85<P>
86If you don't personalize the icon, it's ok, your app will just have the default icon, such as in the image below.
87</P>
88<H2>Edit the Desktop File</H2>
89<P>
90By default, Quickly Ubuntu applications are classified as "utilities", so they show up under the Accessories menu in Ubuntu. If we wanted to make Jotty show up in another category, we can do this by editing the desktop file. A desktop file is a file that describes your application to a Linux desktop. The file "jottydesktop.in" was automatically created in the jotty project directory. To change Jotty from a Utility to an Office application, edit jotty.desktop.in and change this:
91</P>
92<DIV class="code"><TEXTAREA rows="8" cols="80">
93[Desktop Entry]
94Name=Jotty
95Comment=Jotty application
96Categories=GNOME;Utility;
97Exec=jotty
98Icon=jotty
99Terminal=false
100Type=Application
101</TEXTAREA></DIV>
102
103<P>
104to this:
105</P>
106<DIV class="code"><TEXTAREA rows="8" cols="80">
107[Desktop Entry]
108Name=Jotty
109Comment=Jotty application
110Categories=GNOME;Office;
111Exec=jotty
112Icon=jotty
113Terminal=false
114Type=Application
115</TEXTAREA></DIV>
116<P>
117There are lots more categories that you can use, all defined by the FreeDesktop spec. You can see the complete list in the <A HREF="http://standards.freedesktop.org/menu-spec/latest/apa.html">menu spec</A>.
118</P>
119<H2>Edit Setup.py</H2>
120<P>
121Finally, you should include some information in the setup.py file to tell your users a little about yourself. The setup.py file was created for you, just like the desktop file. Most of of the setup.py file shouldn't be modified, as it is just boiler plate that makes your application work properly after it has been installed. However, there is a section at the bottom of the setup.py file that you should edit to describe yourself and the application.
122</P>
123<P>
124So I would change this section:
125</P>
126<DIV class="code"><TEXTAREA rows="8" cols="80">
127DistUtilsExtra.auto.setup(
128 name='jotty',
129 version='0.1',
130 license='GPL v3',
131 #author='Your Name',
132 #author_email='email@ubuntu.com',
133 #description='UI for managing …',
134 #long_description='Here a longer description',
135 #url='https://launchpad.net/jotty',
136 cmdclass={'install': InstallAndUpdateDataDirectory}
137 )
138</TEXTAREA></DIV>
139<P>
140To look like this:
141</P>
142<DIV class="code"><TEXTAREA rows="8" cols="80">
143DistUtilsExtra.auto.setup(
144 name='jotty',
145 version='0.1',
146 license='GPL v3',
147 author='Rick Spencer',
148 author_email='rick.spencer@canonical.com',
149 description='Note taking application',
150 long_description='Note taking application that uses CouchDB as the backend to support easy replication across users and computers.',
151 #url='https://launchpad.net/jotty',
152 cmdclass={'install': InstallAndUpdateDataDirectory}
153 )
154</TEXTAREA></DIV>
155<P>Note that the license has already been set up for you. author and author_email are updated each time you connect to Launchpad (with quickly release or quickly share) with your Launchpad real name and preferred email adress.</P>
156<P>
157Notice that Jotty doesn't have a web page yet, so I just left that line commented out. Also, you don't have to increment version number as quickly share and quickly release commands will make it for you..
158</P>
159
160</TEXTAREA></DIV>
161<H1>Create and Test the Debian Archive</H1>
162<P>
163After personalizing the project, we are now ready to create the package. This is easily done by issuing the package command:
164</P>
165<DIV class="terminal"><TEXTAREA rows="1" cols="80">
166$quickly package
167</TEXTAREA></DIV>
168<P>This command will take a little while to discover dependencies and create all the required archives, etc... It will also report some errors as we haven't created a PGP key, for instance. None the less, when it is done, the package will be created. Using the file browser, you can see the created package next to the project directory:</P>
169<IMG SRC="./images/package1.png" ALT="package command creates .deb archive" />
170<P>Right now, the specific file we are interested in is "jotty_0.1_all.deb". To test it out, double click on it, to open it in Ubuntu's graphical installer program:</P>
171<IMG SRC="./images/package2.png" ALT="deb opened in gdebi" />
172<P>Click "Install Package" to see how it installs onto your desktop. After chugging for a bit, you'll see that it is installed in the Applications->Office menu. If you customized your icon, you'll see that the menu uses your custom icon as well.</p>
173<IMG SRC="./images/package3.png" ALT="jotty installed" />
174<H1>Now that you have a package</H1>
175<P>Now that you've packaged your application, you can share the .deb file. However, if your users install their application this way, and you update the application, your users will have to find this out and resinstall. This hassle can be avoided in Ubuntu by using Personal Package Archives (or PPAs). Distrubuting your applications in this manner is covered in section 4 (not yet available).</P>
176</BODY>
1770
=== removed file 'data/templates/ubuntu-application/help/quickly-reference.html'
--- data/templates/ubuntu-application/help/quickly-reference.html 2010-02-26 20:43:39 +0000
+++ data/templates/ubuntu-application/help/quickly-reference.html 1970-01-01 00:00:00 +0000
@@ -1,278 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Quickly ubuntu-application template Command Reference</TITLE>
4<STYLE>
5img
6{
7 display: block;
8 width:668px;
9 padding-top:10px;
10}
11p
12{
13 width: 800px;
14}
15
16</STYLE>
17</HEAD>
18<BODY>
19<P>The ubuntu-application template template contains the following commands.</P>
20<OL>
21<LI><A HREF="#create">create</A></LI>
22<LI><A HREF="#dialog">dialog</A></LI>
23<LI><A HREF="#edit">edit</A></LI>
24<LI><A HREF="#design">design</A></LI>
25<LI><A HREF="#help">help</A></LI>
26<LI><A HREF="#license">license</A></LI>
27<LI><A HREF="#package">package</A></LI>
28<LI><A HREF="#release">release</A></LI>
29<LI><A HREF="#run">run</A></LI>
30<LI><A HREF="#save">save</A></LI>
31<LI><A HREF="#share">share</A></LI>
32</OL>
33<A name="create">
34<H1>create</H1>
35</A>
36<P>
37Usage:
38$quickly create ubuntu-application path/to/project_name
39</P><P>
40where "project_name" is one or more words separated by an underscore and
41path/to can be any existing path.
42</P><P>
43This will create and run a new project, including Python code,
44Glade files, and packaging files to make the project work. After
45creating the project, get started by:
46</P>
47<OL
48<LI>
49Changing your working directory to the new project:
50$cd path/to/project_name
51</LI><LI>
52Edit the UI with Glade:
53$quickly design
54</LI><LI>
55Edit the Python code:
56$quickly edit
57</LI>
58</OL>
59
60<A name="dialog">
61<H1>dialog</H1>
62</A>
63<P>
64Usage:
65$quickly dialog dialog_name
66where dialog_name is one or more words seperated with underscore
67</P><P>
68This will create:
69</P>
70<OL>
71<LI>
72A subclass of gtk.Dialog called DialogNameDialog in the module DialogNameDialog.py
73</LI><LI>
74A glade file called DialogNameDialog.ui in the ui directory
75</LI><LI>
76A catalog file called dialog_name_dialog.xml also in the ui directory
77</LI>
78</OL>
79<P>
80To edit the UI for the dialog, run:
81$quickly design
82</P>
83<P>
84To edit the behavior, run:
85$quickly edit
86</P>
87<P>
88To use the dialog you have to invoke it from another python file:
89</P>
90<OL>
91<LI>
92Import the dialog
93import DialogNameDialog
94</LI><LI>
95Create an instance of the dialog
96dialog = DialogNameDialog.NewDialogNameDialog()
97</LI><LI>
98Run the dialog and hide the dialog
99result = dialog.run()
100dialog.hide()
101</LI>
102</OL>
103
104<A name="design">
105<H1>design</H1>
106</A>
107<P>
108Usage:
109$quickly design
110</P><P>
111Opens Glade UI editor so that you can edit the UI for dialogs
112and windows in your project. Note that you *must* open Glade
113in this manner for quickly to work. If you try to open Glade
114directly, and the open the UI files, Glade will throw errors
115and won't open the files.
116</P>
117
118<A name="edit">
119<H1>edit</H1>
120</A>
121<P>
122Usage:
123$quickly edit
124</P><P>
125A convenience command to open all of your python files in your project
126directory in your default editor, ready for editing.
127</P>
128
129
130<A name="help">
131<H1>help</H1>
132</A>
133<P>
134Usage:
135$quickly help
136</P><P>
137Opens a web browser with the help index.
138</P>
139
140<A name="license">
141<H1>license</H1>
142</A>
143<P>
144Usage:
145$quickly license <Your_Licence>
146</P><P>
147Adds license to project files. Before using this command, you should:
148</P>
149<OL>
150<LI>
151run $ quickly save in case something goes wrong
152</LI><LI>
153Edit the file Copyright to include your authorship.
154</LI><LI>
155If you want to put your own quickly unsupported Licence, remove and replace the tags
156 ### BEGIN AUTOMATIC LICENCE GENERATION and ### END AUTOMATIC LICENCE GENERATION
157 in it by your own licence.
158</LI><LI>
159Executes either $ quickly license or $ quickly licence <License>
160 where <License> can be either:
161 - GPL-3 (default)
162 - GPL-2
163</LI>
164</OL>
165<P>
166This will modify the Copyright file with the chosen licence (with GPL-3 by default).
167Updating previous chosen Licence if needed.
168If you previously removed the tags to add your own licence, it will leave it pristine.
169If no name is attributed to the Copyright, it will try to retrieve it from Launchpad
170(in quickly release or quickly share command only)
171</P><P>
172Finally, this will copy the Copyright at the head of every files.
173</P><P>
174Note that if you don't run quickly licence before calling quickly release or quickly
175share, this one will execute it for you and guess the copyright holder from your
176launchpad account if you didn't update it.
177</P>
178
179<A name="package">
180<H1>package</H1>
181</A>
182<P>
183Usage:
184$quickly package
185</P><P>
186Creates a debian file (deb) from your project. Before running
187the package command you can edit the Icon and Category entry of *.desktop.in
188file, where * is the name of your project.
189</P><P>
190Note that if you didn't run quickly release, quickly share
191or quickly change-lp-project you may miss the name, email in
192setup.py. You can edit them if you don't want to use any of these
193commands afterwards. Those changes are not a mandatory at all for
194testing purpose.
195</P>
196
197
198<A name="release">
199<H1>release</H1>
200</A>
201<P>
202Usage:
203$quickly release
204</P><P>
205Posts a release of your project to a PPA on launchpad so that
206users can install the application on their system.
207</P><P>
208You can also execute:
209$quickly release <release_number> of you don't want to use current
210release_number. The release_number must be a number.
211</P><P>
212$quickly release <release_number> notes about changes
213where "notes about changes" is optional text describing what changes
214were made since the last save
215</P><P>
216Before running quickly release, you should: create your account
217and a project page on http://launchpad.net.
218You also have to add a PPA to your launchpad account.
219</P><P>
220Name, email and version setup.py will be automatically changed.
221(version will be <current_release> and bzr will commit and tagged.
222Once the release is done, <current_release> will be incremented
223by 0.1 to be ready for next release.
224</P><P>
225If you previously used quickly shared <current_release>~publicX
226will be dropped to release <current_release> version
227(<current_release>~publicX < <current_release>)
228You can modify the description and long description if you wish.
229</P><P>
230You can run $quickly package and test your package to make sure it
231installs as expected. (This is not mandatory)
232</P>
233
234<A name="run">
235<H1>run</H1>
236</A>
237<P>
238Usage:
239$quickly run
240</P><P>
241Runs your application. This is the best way to try test it out
242while you are developing it. It starts up the main project window.
243</P>
244<A name="save">
245<H1>save</H1>
246</A>
247<P>
248Usage:
249$quickly save notes about changes
250<BR>
251where "notes about changes" is optional text describing what changes
252were made since the last save.
253</P><P>
254This command commits all changes since the last save to bzr. Note that
255it does not push changes to any back up location. If you need revert
256or otherwise use the revision control, use bzr directly:
257$bzr help
258</P>
259
260<A name="share">
261<H1>share</H1>
262</A>
263<P>
264Usage:
265$quickly share
266</P><P>
267Updates your PPA with the the latest saved project changes.
268</P><P>
269Before running quickly release, you should: create your account
270on http://launchpad.net.
271You also have to add a PPA to your launchpad account.
272</P><P>
273Name, email and version setup.py will be automatically changed.
274(version will be <current_release~publicX> where X will be incremented
275at each quickly share execution)
276You can modify the description and long description if you wish.
277</P>
278</BODY>
2790
=== removed file 'data/templates/ubuntu-application/help/quickly-release.html'
--- data/templates/ubuntu-application/help/quickly-release.html 2009-06-27 21:00:23 +0000
+++ data/templates/ubuntu-application/help/quickly-release.html 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Quickly Tutorial Part 4</TITLE>
4<STYLE>
5img
6{
7 display: block;
8 width:668px;
9 padding-top:10px;
10}
11p
12{
13 width: 800px;
14}
15
16</STYLE>
17</HEAD>
18<BODY>
19<H1>Introduction to Part 3</H1>
20<P>This section will show you how to set up a launchpad account, and create a project. Then, how to use that project to deliver your application to users, and to easily keep it up to date.</P>
21
22<H1>Create a Launchpad Account</H1>
23<H1>Set up a Project and a PPA</H1>
24<H1>Publish the Project to the PPA</H1>
25<H1>Install from the PPA</H1>
26<H1>Update the Project</H1>
27</BODY>
280
=== added file 'data/templates/ubuntu-application/help/quickly-ubuntu-application-tutorial.xml'
--- data/templates/ubuntu-application/help/quickly-ubuntu-application-tutorial.xml 1970-01-01 00:00:00 +0000
+++ data/templates/ubuntu-application/help/quickly-ubuntu-application-tutorial.xml 2010-03-12 17:35:32 +0000
@@ -0,0 +1,1150 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
4
5 <!ENTITY appname "<application>Quickly</application>" >
6 <!ENTITY appversion "0.4" >
7] >
8
9<book lang="en" id="index">
10 <bookinfo id="Front">
11 <authorgroup>
12 <author role="maintainer">
13 <firstname>Shane</firstname>
14 <surname>Fagan</surname>
15 </author>
16 <author role="maintainer">
17 <firstname>Rick</firstname>
18 <surname>Spencer</surname>
19 </author>
20 <corpauthor>
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches