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"
9
"Content-Type: text/plain; charset=UTF-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
12
#: quickly-ubuntu-application-tutorial.xml:13(firstname)
16
#: quickly-ubuntu-application-tutorial.xml:14(surname)
20
#: quickly-ubuntu-application-tutorial.xml:17(firstname)
24
#: quickly-ubuntu-application-tutorial.xml:18(surname)
28
#: quickly-ubuntu-application-tutorial.xml:20(corpauthor)
32
#: quickly-ubuntu-application-tutorial.xml:24(date) quickly-ubuntu-application-tutorial.xml:29(invpartnumber)
36
#: quickly-ubuntu-application-tutorial.xml:30(title)
37
msgid "<application>Quickly</application> 0.4 User Guide"
40
#: quickly-ubuntu-application-tutorial.xml:35(title)
41
msgid "About This Guide"
42
msgstr "Maidir leis an treoir"
44
#: quickly-ubuntu-application-tutorial.xml:36(para)
45
msgid "<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."
48
#: quickly-ubuntu-application-tutorial.xml:39(link) quickly-ubuntu-application-tutorial.xml:45(title)
49
msgid "Getting Started"
52
#: quickly-ubuntu-application-tutorial.xml:46(para)
53
msgid "Welcome to the <application>Quickly</application> tutorial. In this guide you will learn how to get started using <application>Quickly</application>."
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)
60
#: quickly-ubuntu-application-tutorial.xml:49(link)
61
msgid "Introduction to <placeholder-1/> Part 1"
64
#: quickly-ubuntu-application-tutorial.xml:52(link)
65
msgid "Introduction to <placeholder-1/> Part 2"
68
#: quickly-ubuntu-application-tutorial.xml:55(link)
69
msgid "Introduction to <placeholder-1/> Part 3"
72
#: quickly-ubuntu-application-tutorial.xml:61(title)
73
msgid "Introduction to <application>Quickly</application> Part 1"
76
#: quickly-ubuntu-application-tutorial.xml:62(para)
77
msgid "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."
80
#: quickly-ubuntu-application-tutorial.xml:64(title)
81
msgid "Creating a <application>Quickly</application> Project"
84
#: quickly-ubuntu-application-tutorial.xml:64(para)
85
msgid "<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:"
88
#: quickly-ubuntu-application-tutorial.xml:65(code)
89
msgid "<placeholder-1/> create ubuntu-application jotty"
92
#: quickly-ubuntu-application-tutorial.xml:69(para)
93
msgid "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."
96
#: quickly-ubuntu-application-tutorial.xml:73(title)
97
msgid "Testing the Empty Application"
100
#: quickly-ubuntu-application-tutorial.xml:73(para)
101
msgid "<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->About, Edit->Preferences, and File->Quit."
104
#: quickly-ubuntu-application-tutorial.xml:77(title)
105
msgid "Running the Application"
108
#: quickly-ubuntu-application-tutorial.xml:77(para)
109
msgid "<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."
112
#: quickly-ubuntu-application-tutorial.xml:79(code)
116
#: quickly-ubuntu-application-tutorial.xml:80(code) quickly-ubuntu-application-tutorial.xml:181(code) quickly-ubuntu-application-tutorial.xml:1075(code)
117
msgid "<placeholder-1/> run"
120
#: quickly-ubuntu-application-tutorial.xml:84(title)
121
msgid "Editing an Application"
124
#: quickly-ubuntu-application-tutorial.xml:85(title)
125
msgid "Edit the User Interface in Glade"
128
#: quickly-ubuntu-application-tutorial.xml:85(para)
129
msgid "<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>."
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)
133
msgid "<placeholder-1/> design"
136
#: quickly-ubuntu-application-tutorial.xml:91(para)
137
msgid "Glade will open with the project loaded up and ready to edit."
140
#: quickly-ubuntu-application-tutorial.xml:95(para)
141
msgid "Use the Project Menu to choose \"JottytWindow.ui\" for editing."
144
#: quickly-ubuntu-application-tutorial.xml:99(para)
145
msgid "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."
148
#: quickly-ubuntu-application-tutorial.xml:106(para)
149
msgid "Do the same with the image widget. This leave us two free slots."
152
#: quickly-ubuntu-application-tutorial.xml:110(para)
153
msgid "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."
156
#: quickly-ubuntu-application-tutorial.xml:114(para)
157
msgid "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."
160
#: quickly-ubuntu-application-tutorial.xml:118(para)
161
msgid "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."
164
#: quickly-ubuntu-application-tutorial.xml:122(para)
165
msgid "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."
168
#: quickly-ubuntu-application-tutorial.xml:126(para)
169
msgid "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\"."
172
#: quickly-ubuntu-application-tutorial.xml:130(para)
173
msgid "Go to the General tab, and set spacing to 5."
176
#: quickly-ubuntu-application-tutorial.xml:134(para)
177
msgid "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)."
180
#: quickly-ubuntu-application-tutorial.xml:138(title)
181
msgid "Add the Save, Open, and New Features"
184
#: quickly-ubuntu-application-tutorial.xml:138(para)
185
msgid "<placeholder-1/> 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."
188
#: quickly-ubuntu-application-tutorial.xml:140(title)
189
msgid "Set the Signal Handler in Glade"
192
#: quickly-ubuntu-application-tutorial.xml:140(para)
193
msgid "<placeholder-1/> To tell the menu item what function to call. If glade is not still open, open up the application in glade:"
196
#: quickly-ubuntu-application-tutorial.xml:143(para)
197
msgid "Click on the file menu, and the menu opens as if the application were running."
200
#: quickly-ubuntu-application-tutorial.xml:147(para)
201
msgid "Choose the Save menu item, and it will be selected in Glade."
204
#: quickly-ubuntu-application-tutorial.xml:151(para)
205
msgid "Then choose the \"Signals\" tab of the properties window."
208
#: quickly-ubuntu-application-tutorial.xml:155(para)
209
msgid "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."
212
#: quickly-ubuntu-application-tutorial.xml:159(para)
213
msgid "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."
216
#: quickly-ubuntu-application-tutorial.xml:160(title)
217
msgid "Edit the Code in Gedit"
220
#: quickly-ubuntu-application-tutorial.xml:161(title)
221
msgid "Set Up Tabs Correctly"
224
#: quickly-ubuntu-application-tutorial.xml:161(para)
225
msgid "<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."
228
#: quickly-ubuntu-application-tutorial.xml:163(para)
229
msgid "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:"
232
#: quickly-ubuntu-application-tutorial.xml:167(title)
233
msgid "Create the Save File Signal Handler"
236
#: quickly-ubuntu-application-tutorial.xml:167(para)
237
msgid "<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."
240
#: quickly-ubuntu-application-tutorial.xml:169(para)
241
msgid "Use the <application>Quickly</application> edit command to start editing your code files:"
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)
245
msgid "<placeholder-1/> edit"
248
#: quickly-ubuntu-application-tutorial.xml:171(para)
249
msgid "This will open the default Ubuntu text editor \"Gedit\" with any python files in the python directory."
252
#: quickly-ubuntu-application-tutorial.xml:175(para)
253
msgid "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.:"
256
#: quickly-ubuntu-application-tutorial.xml:177(code)
257
msgid "def save_file(self, widget, data=None): print \"save\""
260
#: quickly-ubuntu-application-tutorial.xml:179(para)
261
msgid "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."
264
#: quickly-ubuntu-application-tutorial.xml:180(para)
265
msgid "Save the file, and run it again:"
268
#: quickly-ubuntu-application-tutorial.xml:184(para)
269
msgid "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!"
272
#: quickly-ubuntu-application-tutorial.xml:188(title)
273
msgid "Implementing Save"
276
#: quickly-ubuntu-application-tutorial.xml:188(para)
277
msgid "<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:"
280
#: quickly-ubuntu-application-tutorial.xml:191(code)
281
msgid "sudo apt-get install python-desktopcouch-records"
284
#: quickly-ubuntu-application-tutorial.xml:194(para)
285
msgid "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:"
288
#: quickly-ubuntu-application-tutorial.xml:197(para)
289
msgid "Import the stuff you'll need from desktopcouch."
292
#: quickly-ubuntu-application-tutorial.xml:200(para)
293
msgid "Get a reference to the couchdb database to save into."
296
#: quickly-ubuntu-application-tutorial.xml:203(para)
297
msgid "Get the title of the document and the text from the user interface."
300
#: quickly-ubuntu-application-tutorial.xml:206(para)
301
msgid "Check if there is already a document with the same title, and if so overwrite it."
304
#: quickly-ubuntu-application-tutorial.xml:209(para)
305
msgid "If there is not a document already, create one."
308
#: quickly-ubuntu-application-tutorial.xml:212(title)
309
msgid "Import the stuff you'll need from python-desktopcouch-records."
312
#: quickly-ubuntu-application-tutorial.xml:212(para)
313
msgid "<placeholder-1/> Add these import statements along with the other imports to the top of the jotty file:"
316
#: quickly-ubuntu-application-tutorial.xml:214(code)
317
msgid "from desktopcouch.records.server import CouchDatabase from desktopcouch.records.record import Record"
320
#: quickly-ubuntu-application-tutorial.xml:216(title)
321
msgid "Get a Reference to the Database"
324
#: quickly-ubuntu-application-tutorial.xml:216(para)
325
msgid "<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:"
328
#: quickly-ubuntu-application-tutorial.xml:218(code)
329
msgid "self.database = CouchDatabase(\"jotty\", create=True)"
332
#: quickly-ubuntu-application-tutorial.xml:221(para)
333
msgid "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."
336
#: quickly-ubuntu-application-tutorial.xml:222(para)
337
msgid "Here's the code to pull the title out of the title entry:"
340
#: quickly-ubuntu-application-tutorial.xml:224(code)
341
msgid "#get the title for the note title = self.builder.get_object(\"entry1\").get_text()"
344
#: quickly-ubuntu-application-tutorial.xml:226(title)
345
msgid "Here's the code to get pull the text out of the TextView:"
348
#: quickly-ubuntu-application-tutorial.xml:226(para)
349
msgid "<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."
352
#: quickly-ubuntu-application-tutorial.xml:229(code)
353
msgid "#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)"
356
#: quickly-ubuntu-application-tutorial.xml:235(title)
357
msgid "Saving a document to Couchdb"
360
#: quickly-ubuntu-application-tutorial.xml:235(para)
361
msgid "<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:"
364
#: quickly-ubuntu-application-tutorial.xml:238(code)
365
msgid "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)"
368
#: quickly-ubuntu-application-tutorial.xml:241(para)
369
msgid "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."
372
#: quickly-ubuntu-application-tutorial.xml:242(title)
373
msgid "Check for a pre-existing note with the same title"
376
#: quickly-ubuntu-application-tutorial.xml:242(para)
377
msgid "<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."
380
#: quickly-ubuntu-application-tutorial.xml:244(para)
381
msgid "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."
384
#: quickly-ubuntu-application-tutorial.xml:245(para)
385
msgid "To find and update documents with a matching title we will:"
388
#: quickly-ubuntu-application-tutorial.xml:248(para) quickly-ubuntu-application-tutorial.xml:308(para)
389
msgid "Retrieve all of the documents with the CouchDatabase.get_records function."
392
#: quickly-ubuntu-application-tutorial.xml:251(para) quickly-ubuntu-application-tutorial.xml:311(para)
393
msgid "Check each of the returned records for a matching title."
396
#: quickly-ubuntu-application-tutorial.xml:254(para)
397
msgid "If there is a match, update the record using the CouchDatabase.update_fields function and return."
400
#: quickly-ubuntu-application-tutorial.xml:257(para)
401
msgid "This all may sound very weird, but in code, it's not quite so complicated:"
404
#: quickly-ubuntu-application-tutorial.xml:259(code)
405
msgid "#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"
408
#: quickly-ubuntu-application-tutorial.xml:269(para)
409
msgid "So the whole function should look like this:"
412
#: quickly-ubuntu-application-tutorial.xml:271(code)
413
msgid "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)"
416
#: quickly-ubuntu-application-tutorial.xml:293(para)
417
msgid "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:"
420
#: quickly-ubuntu-application-tutorial.xml:294(para)
421
msgid "file:///home/your_user_name>/.local/share/desktop-couch/couchdb.html"
424
#: quickly-ubuntu-application-tutorial.xml:298(para)
425
msgid "If you are redirected to a page that doesn't work, you probably just need to clear your browser cache and try again."
428
#: quickly-ubuntu-application-tutorial.xml:299(title)
429
msgid "Implementing Open and New"
432
#: quickly-ubuntu-application-tutorial.xml:299(para)
433
msgid "<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."
436
#: quickly-ubuntu-application-tutorial.xml:301(title)
437
msgid "Implementing Open is essentially the reverse of Save:"
440
#: quickly-ubuntu-application-tutorial.xml:301(para)
441
msgid "<placeholder-1/> Follow these steps:"
444
#: quickly-ubuntu-application-tutorial.xml:305(para)
445
msgid "Add the open_file signal to the menu item in Glade."
448
#: quickly-ubuntu-application-tutorial.xml:314(para)
449
msgid "If there is a match, pull out the text and display it in the text view."
452
#: quickly-ubuntu-application-tutorial.xml:317(para)
453
msgid "So the open_file function looks like so:"
456
#: quickly-ubuntu-application-tutorial.xml:319(code)
457
msgid "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)"
460
#: quickly-ubuntu-application-tutorial.xml:337(title)
461
msgid "Implement New"
464
#: quickly-ubuntu-application-tutorial.xml:337(para)
465
msgid "<placeholder-1/> First, add the new_file signal to the menu item in Glade, then add this code to clear out the text:"
468
#: quickly-ubuntu-application-tutorial.xml:340(code)
469
msgid "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(\"\")"
472
#: quickly-ubuntu-application-tutorial.xml:344(para)
473
msgid "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."
476
#: quickly-ubuntu-application-tutorial.xml:345(ulink)
477
msgid "Complete jotty file"
480
#: quickly-ubuntu-application-tutorial.xml:346(title)
481
msgid "Saving Your Work"
484
#: quickly-ubuntu-application-tutorial.xml:346(para)
485
msgid "<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:"
488
#: quickly-ubuntu-application-tutorial.xml:348(code)
489
msgid "<placeholder-1/> save \"First working version of Jotty\""
492
#: quickly-ubuntu-application-tutorial.xml:351(para)
493
msgid "This will call <code>bzr add</code> and then <code>bzr commit -m [your message]</code> for you."
496
#: quickly-ubuntu-application-tutorial.xml:354(title)
497
msgid "Introduction to <application>Quickly</application> Part 2"
500
#: quickly-ubuntu-application-tutorial.xml:355(para)
501
msgid "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."
504
#: quickly-ubuntu-application-tutorial.xml:357(title)
505
msgid "Creating a <application>Quickly</application> Dialog"
508
#: quickly-ubuntu-application-tutorial.xml:358(title)
509
msgid "Creating the Empty Dialog"
512
#: quickly-ubuntu-application-tutorial.xml:358(para)
513
msgid "<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:"
516
#: quickly-ubuntu-application-tutorial.xml:360(code)
517
msgid "<placeholder-1/> dialog save"
520
#: quickly-ubuntu-application-tutorial.xml:363(para)
521
msgid "This will add the dialog to your project."
524
#: quickly-ubuntu-application-tutorial.xml:364(title) quickly-ubuntu-application-tutorial.xml:479(title)
525
msgid "Editing the New Dialog"
528
#: quickly-ubuntu-application-tutorial.xml:364(para)
529
msgid "<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:"
532
#: quickly-ubuntu-application-tutorial.xml:366(code)
533
msgid "<placeholder-1/> Design"
536
#: quickly-ubuntu-application-tutorial.xml:369(para)
537
msgid "Then use the project menu to switch to newly created SaveDialog.ui file."
540
#: quickly-ubuntu-application-tutorial.xml:373(para)
541
msgid "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."
544
#: quickly-ubuntu-application-tutorial.xml:377(title)
545
msgid "Code the Dialog"
548
#: quickly-ubuntu-application-tutorial.xml:377(para)
549
msgid "<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:"
552
#: quickly-ubuntu-application-tutorial.xml:380(code)
553
msgid "@property def title_text(self): return self.builder.get_object(\"entry1\").get_text()"
556
#: quickly-ubuntu-application-tutorial.xml:383(para)
557
msgid "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."
560
#: quickly-ubuntu-application-tutorial.xml:384(para)
561
msgid "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."
564
#: quickly-ubuntu-application-tutorial.xml:388(title)
565
msgid "Calling the Save Dialog"
568
#: quickly-ubuntu-application-tutorial.xml:388(para)
569
msgid "<placeholder-1/> To use the dialog in JottyWindow, we need to follow these steps:"
572
#: quickly-ubuntu-application-tutorial.xml:392(para)
573
msgid "Import SaveDialog in JottyWindow"
576
#: quickly-ubuntu-application-tutorial.xml:395(para)
577
msgid "In the save_file function, create an instance of SaveDialog"
580
#: quickly-ubuntu-application-tutorial.xml:398(para) quickly-ubuntu-application-tutorial.xml:558(para)
581
msgid "Run the Dialog"
584
#: quickly-ubuntu-application-tutorial.xml:401(para)
585
msgid "Get the String"
588
#: quickly-ubuntu-application-tutorial.xml:404(para) quickly-ubuntu-application-tutorial.xml:564(para)
589
msgid "Destroy the dialog"
592
#: quickly-ubuntu-application-tutorial.xml:408(title)
593
msgid "Importing the SaveDialog"
596
#: quickly-ubuntu-application-tutorial.xml:408(para)
597
msgid "<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:"
600
#: quickly-ubuntu-application-tutorial.xml:410(code)
601
msgid "from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog"
604
#: quickly-ubuntu-application-tutorial.xml:414(title) quickly-ubuntu-application-tutorial.xml:583(title)
605
msgid "Create an instance of the dialog and run it"
608
#: quickly-ubuntu-application-tutorial.xml:414(para)
609
msgid "<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."
612
#: quickly-ubuntu-application-tutorial.xml:417(para)
613
msgid "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:"
616
#: quickly-ubuntu-application-tutorial.xml:418(code)
617
msgid "saver = SaveDialog.NewSaveDialog()"
620
#: quickly-ubuntu-application-tutorial.xml:421(para)
621
msgid "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:"
624
#: quickly-ubuntu-application-tutorial.xml:422(code)
625
msgid "result = saver.run() title = saver.title_text"
628
#: quickly-ubuntu-application-tutorial.xml:426(title)
629
msgid "Clean up the dialog"
632
#: quickly-ubuntu-application-tutorial.xml:426(para)
633
msgid "<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:"
636
#: quickly-ubuntu-application-tutorial.xml:429(code)
637
msgid "saver.destroy() if result != gtk.RESPONSE_OK: return"
640
#: quickly-ubuntu-application-tutorial.xml:433(para)
641
msgid "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:"
644
#: quickly-ubuntu-application-tutorial.xml:436(code)
645
msgid "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)"
648
#: quickly-ubuntu-application-tutorial.xml:467(para)
649
msgid "Now when we choose save, we get the SaveDialog instead:"
652
#: quickly-ubuntu-application-tutorial.xml:472(title)
653
msgid "Creating a Dialog with a CouchGrid"
656
#: quickly-ubuntu-application-tutorial.xml:472(para)
657
msgid "<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."
660
#: quickly-ubuntu-application-tutorial.xml:475(title)
661
msgid "Create the Open Dialog"
664
#: quickly-ubuntu-application-tutorial.xml:476(code)
665
msgid "<placeholder-1/> dialog open"
668
#: quickly-ubuntu-application-tutorial.xml:479(para)
669
msgid "<placeholder-1/> Start out by closing, and then reopening glade again:"
672
#: quickly-ubuntu-application-tutorial.xml:484(para)
673
msgid "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."
676
#: quickly-ubuntu-application-tutorial.xml:488(title)
677
msgid "Coding the Open Dialog"
680
#: quickly-ubuntu-application-tutorial.xml:489(title)
681
msgid "Creating and Adding a CouchGrid"
684
#: quickly-ubuntu-application-tutorial.xml:489(para)
685
msgid "<placeholder-1/> It just takes a little bit of code to add a CouchGrid to the dialog. We need to:"
688
#: quickly-ubuntu-application-tutorial.xml:493(para)
689
msgid "Import the CouchGrid class."
692
#: quickly-ubuntu-application-tutorial.xml:496(para)
693
msgid "Create a CouchGrid pointing at the jotty database, and the desired record type."
696
#: quickly-ubuntu-application-tutorial.xml:499(para)
697
msgid "Add the CouchGrid to the dialog."
700
#: quickly-ubuntu-application-tutorial.xml:503(title)
701
msgid "Import the CouchGrid class"
704
#: quickly-ubuntu-application-tutorial.xml:503(para)
705
msgid "<placeholder-1/> CouchGrid is part of the desktopcouch records api, so we import it like this:"
708
#: quickly-ubuntu-application-tutorial.xml:505(code)
709
msgid "from desktopcouch.records.couchgrid import CouchGrid"
712
#: quickly-ubuntu-application-tutorial.xml:508(title)
713
msgid "Create the CouchGrid"
716
#: quickly-ubuntu-application-tutorial.xml:508(para)
717
msgid "<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:"
720
#: quickly-ubuntu-application-tutorial.xml:512(code)
721
msgid "database = \"jotty\" keys = [\"title\"] record_type = \"http://wiki.ubuntu.com/<placeholder-1/>/JottyDoc\" self.couchgrid = CouchGrid(database, record_type=record_type,keys=keys)"
724
#: quickly-ubuntu-application-tutorial.xml:516(title)
725
msgid "Add the CouchGrid to the Dialog"
728
#: quickly-ubuntu-application-tutorial.xml:516(para)
729
msgid "<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:"
732
#: quickly-ubuntu-application-tutorial.xml:520(code)
733
msgid "self.couchgrid.show() self.builder.get_object(\"vbox1\").pack_end(self.couchgrid)"
736
#: quickly-ubuntu-application-tutorial.xml:523(title)
737
msgid "Create the get_selection function"
740
#: quickly-ubuntu-application-tutorial.xml:523(para)
741
msgid "<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:"
744
#: quickly-ubuntu-application-tutorial.xml:527(para)
745
msgid "Use a decorator to define the function as a property accessor."
748
#: quickly-ubuntu-application-tutorial.xml:530(para)
749
msgid "Get all the selected record ids."
752
#: quickly-ubuntu-application-tutorial.xml:533(para)
753
msgid "If none are selected, return None."
756
#: quickly-ubuntu-application-tutorial.xml:536(para)
757
msgid "Pick the first one and return it."
760
#: quickly-ubuntu-application-tutorial.xml:539(para)
761
msgid "So the function to add to OpenDialog looks like this:"
764
#: quickly-ubuntu-application-tutorial.xml:541(code)
765
msgid "@property def selected_record_id(self): ids = self.couchgrid.selected_record_ids if len(ids) < 1: return None else: return ids[0]"
768
#: quickly-ubuntu-application-tutorial.xml:548(title)
769
msgid "Using the Open Dialog"
772
#: quickly-ubuntu-application-tutorial.xml:548(para)
773
msgid "<placeholder-1/> Now we want to use the Open Dialog in the JottyWindow open_file function. To use it,we'll follow these steps:"
776
#: quickly-ubuntu-application-tutorial.xml:552(para)
777
msgid "Import OpenDialog in JottyWindow"
780
#: quickly-ubuntu-application-tutorial.xml:555(para)
781
msgid "In the open_file function, create an instance of OpenDialog"
784
#: quickly-ubuntu-application-tutorial.xml:561(para)
785
msgid "Get the id for the selected title."
788
#: quickly-ubuntu-application-tutorial.xml:567(para)
789
msgid "Check the response before proceeding"
792
#: quickly-ubuntu-application-tutorial.xml:570(para) quickly-ubuntu-application-tutorial.xml:600(title)
793
msgid "Use the id to get the record from CouchDB"
796
#: quickly-ubuntu-application-tutorial.xml:573(para) quickly-ubuntu-application-tutorial.xml:609(title)
797
msgid "Update the UI"
800
#: quickly-ubuntu-application-tutorial.xml:577(title)
801
msgid "Import OpenDialog"
804
#: quickly-ubuntu-application-tutorial.xml:577(para)
805
msgid "<placeholder-1/> Just like the SaveDialog, add the import line to the list of imports:"
808
#: quickly-ubuntu-application-tutorial.xml:579(code)
809
msgid "from jotty import AboutJottyDialog, PreferencesJottyDialog, SaveDialog, OpenDialog"
812
#: quickly-ubuntu-application-tutorial.xml:583(para)
813
msgid "<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:"
816
#: quickly-ubuntu-application-tutorial.xml:586(code)
817
msgid "opener = OpenDialog.NewOpenDialog() result = opener.run()"
820
#: quickly-ubuntu-application-tutorial.xml:589(title)
821
msgid "Get the id for the selected title"
824
#: quickly-ubuntu-application-tutorial.xml:589(para)
825
msgid "<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."
828
#: quickly-ubuntu-application-tutorial.xml:592(code)
829
msgid "rec_id = opener.selected_record_id #close the dialog, and check whether to proceed opener.destroy() if result != gtk.RESPONSE_OK: return"
832
#: quickly-ubuntu-application-tutorial.xml:600(para)
833
msgid "<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:"
836
#: quickly-ubuntu-application-tutorial.xml:603(code)
837
msgid "#get the record from CouchDB and extract the text if rec_id == None: return record = self.database.get_record(rec_id) text = record[\"text\"]"
840
#: quickly-ubuntu-application-tutorial.xml:609(para)
841
msgid "<placeholder-1/> Now just put the text into the texview:"
844
#: quickly-ubuntu-application-tutorial.xml:612(code)
845
msgid "#set the UI to display the string buff = self.builder.get_object(\"textview1\").get_buffer() buff.set_text(text)"
848
#: quickly-ubuntu-application-tutorial.xml:615(para)
849
msgid "That's all there is to it. So the whole open_file function looks like this:"
852
#: quickly-ubuntu-application-tutorial.xml:617(code)
853
msgid "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)"
856
#: quickly-ubuntu-application-tutorial.xml:639(para)
857
msgid "Now users get a nice open dialog:"
860
#: quickly-ubuntu-application-tutorial.xml:644(para)
861
msgid "However, the application is not complete. There are a few things left for you to do:"
864
#: quickly-ubuntu-application-tutorial.xml:647(para)
865
msgid "Set the title of the JottyWindow to display the note title. Try self.set_text(title)."
868
#: quickly-ubuntu-application-tutorial.xml:650(para)
869
msgid "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."
872
#: quickly-ubuntu-application-tutorial.xml:653(para)
873
msgid "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."
876
#: quickly-ubuntu-application-tutorial.xml:656(para)
877
msgid "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."
880
#: quickly-ubuntu-application-tutorial.xml:659(para)
881
msgid "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."
884
#: quickly-ubuntu-application-tutorial.xml:662(para)
885
msgid "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."
888
#: quickly-ubuntu-application-tutorial.xml:668(title)
889
msgid "Introduction to <application>Quickly</application> Part 3"
892
#: quickly-ubuntu-application-tutorial.xml:669(para)
893
msgid "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."
896
#: quickly-ubuntu-application-tutorial.xml:670(title)
897
msgid "License your Application"
900
#: quickly-ubuntu-application-tutorial.xml:670(para)
901
msgid "<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:"
904
#: quickly-ubuntu-application-tutorial.xml:674(para)
905
msgid "Specify your name and email address in the Copyright file."
908
#: quickly-ubuntu-application-tutorial.xml:677(para)
909
msgid "Run the \"license\" command."
912
#: quickly-ubuntu-application-tutorial.xml:681(title)
913
msgid "Specify your name and email"
916
#: quickly-ubuntu-application-tutorial.xml:681(para)
917
msgid "<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:"
920
#: quickly-ubuntu-application-tutorial.xml:684(code)
921
msgid "# Copyright (C) 2009 Rick Spencer rick.spencer@canonical.com ### BEGIN AUTOMATIC LICENSE GENERATION ### END AUTOMATIC LICENSE GENERATION"
924
#: quickly-ubuntu-application-tutorial.xml:688(title)
925
msgid "Run the \"License\" Command"
928
#: quickly-ubuntu-application-tutorial.xml:688(para)
929
msgid "<placeholder-1/> By default, <application>Quickly</application> will use a GPL 3 license for your project. To use this license, use this command:"
932
#: quickly-ubuntu-application-tutorial.xml:690(code) quickly-ubuntu-application-tutorial.xml:712(code)
933
msgid "<placeholder-1/> license"
936
#: quickly-ubuntu-application-tutorial.xml:693(para)
937
msgid "This will add the GPL 3 license to all of your code files that you've added to your project using <application>Quickly</application>."
940
#: quickly-ubuntu-application-tutorial.xml:694(para)
941
msgid "Keep in mind a couple of things:"
944
#: quickly-ubuntu-application-tutorial.xml:697(para)
945
msgid "This is a one way trip. Once you license the project, changes to the license must be done manually."
948
#: quickly-ubuntu-application-tutorial.xml:700(para)
949
msgid "If you prefer a GPL 2 license, you can specify that when you issue the license command:"
952
#: quickly-ubuntu-application-tutorial.xml:701(code)
953
msgid "<placeholder-1/> license GPL-2"
956
#: quickly-ubuntu-application-tutorial.xml:706(para)
957
msgid "<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:"
960
#: quickly-ubuntu-application-tutorial.xml:708(code)
961
msgid "### BEGIN AUTOMATIC LICENSE GENERATION # My personal license here ### END AUTOMATIC LICENSE GENERATION"
964
#: quickly-ubuntu-application-tutorial.xml:711(para)
965
msgid "and then run:"
968
#: quickly-ubuntu-application-tutorial.xml:715(para)
969
msgid "to license every files."
972
#: quickly-ubuntu-application-tutorial.xml:718(para)
973
msgid "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:"
976
#: quickly-ubuntu-application-tutorial.xml:720(code)
977
msgid "### BEGIN LICENSE ### END LICENSE"
980
#: quickly-ubuntu-application-tutorial.xml:725(title)
981
msgid "Translate Your Application"
984
#: quickly-ubuntu-application-tutorial.xml:725(para)
985
msgid "<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:"
988
#: quickly-ubuntu-application-tutorial.xml:727(code)
989
msgid "import gettext"
992
#: quickly-ubuntu-application-tutorial.xml:728(code)
993
msgid "gettext.gettext(\"What you want translated\")"
996
#: quickly-ubuntu-application-tutorial.xml:730(title)
997
msgid "Specify Application Settings"
1000
#: quickly-ubuntu-application-tutorial.xml:730(para)
1001
msgid "<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:"
1004
#: quickly-ubuntu-application-tutorial.xml:734(para)
1005
msgid "Personalize the Application Icon"
1008
#: quickly-ubuntu-application-tutorial.xml:735(para) quickly-ubuntu-application-tutorial.xml:749(title)
1009
msgid "Edit the Desktop File"
1012
#: quickly-ubuntu-application-tutorial.xml:736(para)
1013
msgid "Edit the setup.py File"
1016
#: quickly-ubuntu-application-tutorial.xml:739(title)
1017
msgid "Personalize your Application Icon"
1020
#: quickly-ubuntu-application-tutorial.xml:739(para)
1021
msgid "<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:"
1024
#: quickly-ubuntu-application-tutorial.xml:741(code)
1025
msgid "gimp data/media/icon.png"
1028
#: quickly-ubuntu-application-tutorial.xml:747(para)
1029
msgid "If you don't personalize the icon, it's ok, your app will just have the default icon, such as in the image below."
1032
#: quickly-ubuntu-application-tutorial.xml:749(para)
1033
msgid "<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:"
1036
#: quickly-ubuntu-application-tutorial.xml:753(code)
1037
msgid "[Desktop Entry] Name=Jotty Comment=Jotty application Categories=GNOME;Utility; Exec=jotty Icon=jotty Terminal=false Type=Application"
1040
#: quickly-ubuntu-application-tutorial.xml:763(para)
1044
#: quickly-ubuntu-application-tutorial.xml:767(code)
1045
msgid "[Desktop Entry] Name=Jotty Comment=Jotty application Categories=GNOME;Office; Exec=jotty Icon=jotty Terminal=false Type=Application"
1048
#: quickly-ubuntu-application-tutorial.xml:775(para)
1049
msgid "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>."
1052
#: quickly-ubuntu-application-tutorial.xml:779(title)
1053
msgid "Edit Setup.py"
1056
#: quickly-ubuntu-application-tutorial.xml:778(para)
1057
msgid "<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."
1060
#: quickly-ubuntu-application-tutorial.xml:782(para)
1061
msgid "So I would change this section:"
1064
#: quickly-ubuntu-application-tutorial.xml:786(code)
1065
msgid "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} )"
1068
#: quickly-ubuntu-application-tutorial.xml:798(para)
1069
msgid "To look like this:"
1072
#: quickly-ubuntu-application-tutorial.xml:802(code)
1073
msgid "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} )"
1076
#: quickly-ubuntu-application-tutorial.xml:813(para)
1077
msgid "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."
1080
#: quickly-ubuntu-application-tutorial.xml:814(para)
1081
msgid "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.."
1084
#: quickly-ubuntu-application-tutorial.xml:818(title)
1085
msgid "Create and Test the Debian Archive"
1088
#: quickly-ubuntu-application-tutorial.xml:818(para)
1089
msgid "<placeholder-1/> After personalizing the project, we are now ready to create the package. This is easily done by issuing the package command:"
1092
#: quickly-ubuntu-application-tutorial.xml:821(code) quickly-ubuntu-application-tutorial.xml:1023(code)
1093
msgid "<placeholder-1/> package"
1096
#: quickly-ubuntu-application-tutorial.xml:824(para)
1097
msgid "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:"
1100
#: quickly-ubuntu-application-tutorial.xml:828(para)
1101
msgid "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:"
1104
#: quickly-ubuntu-application-tutorial.xml:832(para)
1105
msgid "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."
1108
#: quickly-ubuntu-application-tutorial.xml:836(title)
1109
msgid "Now that you have a package"
1112
#: quickly-ubuntu-application-tutorial.xml:836(para)
1113
msgid "<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)."
1116
#: quickly-ubuntu-application-tutorial.xml:840(title)
1117
msgid "<application>Quickly</application>: <application>Quickly</application> Command Reference"
1120
#: quickly-ubuntu-application-tutorial.xml:841(para)
1121
msgid "The ubuntu-application template template contains the following commands."
1124
#: quickly-ubuntu-application-tutorial.xml:844(xref) quickly-ubuntu-application-tutorial.xml:877(title) quickly-ubuntu-application-tutorial.xml:878(title)
1128
#: quickly-ubuntu-application-tutorial.xml:847(xref) quickly-ubuntu-application-tutorial.xml:904(title) quickly-ubuntu-application-tutorial.xml:905(title)
1132
#: quickly-ubuntu-application-tutorial.xml:850(xref) quickly-ubuntu-application-tutorial.xml:949(title) quickly-ubuntu-application-tutorial.xml:950(title)
1136
#: quickly-ubuntu-application-tutorial.xml:853(xref)
1140
#: quickly-ubuntu-application-tutorial.xml:856(xref) quickly-ubuntu-application-tutorial.xml:973(title) quickly-ubuntu-application-tutorial.xml:974(title)
1144
#: quickly-ubuntu-application-tutorial.xml:859(xref) quickly-ubuntu-application-tutorial.xml:982(title) quickly-ubuntu-application-tutorial.xml:983(title)
1148
#: quickly-ubuntu-application-tutorial.xml:862(xref) quickly-ubuntu-application-tutorial.xml:1021(title) quickly-ubuntu-application-tutorial.xml:1022(title)
1152
#: quickly-ubuntu-application-tutorial.xml:865(xref) quickly-ubuntu-application-tutorial.xml:1038(title) quickly-ubuntu-application-tutorial.xml:1039(title)
1156
#: quickly-ubuntu-application-tutorial.xml:868(xref) quickly-ubuntu-application-tutorial.xml:1073(title) quickly-ubuntu-application-tutorial.xml:1074(title)
1160
#: quickly-ubuntu-application-tutorial.xml:871(xref) quickly-ubuntu-application-tutorial.xml:1083(title) quickly-ubuntu-application-tutorial.xml:1084(title)
1164
#: quickly-ubuntu-application-tutorial.xml:874(xref) quickly-ubuntu-application-tutorial.xml:1098(title) quickly-ubuntu-application-tutorial.xml:1100(title)
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)
1169
msgid "<placeholder-1/> Usage:"
1172
#: quickly-ubuntu-application-tutorial.xml:880(code)
1173
msgid "<placeholder-1/> create ubuntu-application path/to/project_name"
1176
#: quickly-ubuntu-application-tutorial.xml:882(para)
1177
msgid "where \"project_name\" is one or more words separated by an underscore and path/to can be any existing path."
1180
#: quickly-ubuntu-application-tutorial.xml:885(para)
1181
msgid "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:"
1184
#: quickly-ubuntu-application-tutorial.xml:891(para)
1185
msgid "Changing your working directory to the new project:"
1188
#: quickly-ubuntu-application-tutorial.xml:893(code)
1189
msgid "cd path/to/project_name"
1192
#: quickly-ubuntu-application-tutorial.xml:895(para)
1193
msgid "Edit the UI with Glade:"
1196
#: quickly-ubuntu-application-tutorial.xml:898(para)
1197
msgid "Edit the Python code:"
1200
#: quickly-ubuntu-application-tutorial.xml:907(code)
1201
msgid "<placeholder-1/> dialog dialog_name"
1204
#: quickly-ubuntu-application-tutorial.xml:908(para)
1205
msgid "where dialog_name is one or more words seperated with underscore"
1208
#: quickly-ubuntu-application-tutorial.xml:909(para)
1209
msgid "This will create:"
1212
#: quickly-ubuntu-application-tutorial.xml:913(para)
1213
msgid "A subclass of gtk.Dialog called DialogNameDialog in the module DialogNameDialog.py"
1216
#: quickly-ubuntu-application-tutorial.xml:916(para)
1217
msgid "A glade file called DialogNameDialog.ui in the ui directory"
1220
#: quickly-ubuntu-application-tutorial.xml:919(para)
1221
msgid "A catalog file called dialog_name_dialog.xml also in the ui directory"
1224
#: quickly-ubuntu-application-tutorial.xml:922(para)
1225
msgid "To edit the UI for the dialog, run:"
1228
#: quickly-ubuntu-application-tutorial.xml:926(para)
1229
msgid "To edit the behavior, run:"
1232
#: quickly-ubuntu-application-tutorial.xml:929(para)
1233
msgid "To use the dialog you have to invoke it from another python file:"
1236
#: quickly-ubuntu-application-tutorial.xml:933(code)
1237
msgid "Import the dialog import DialogNameDialog"
1240
#: quickly-ubuntu-application-tutorial.xml:937(code)
1241
msgid "Create an instance of the dialog dialog = DialogNameDialog.NewDialogNameDialog()"
1244
#: quickly-ubuntu-application-tutorial.xml:941(code)
1245
msgid "Run the dialog and hide the dialog result = dialog.run() dialog.hide()"
1248
#: quickly-ubuntu-application-tutorial.xml:954(para)
1249
msgid "A convenience command to open all of your python files in your project directory in your default editor, ready for editing."
1252
#: quickly-ubuntu-application-tutorial.xml:960(title) quickly-ubuntu-application-tutorial.xml:961(title)
1256
#: quickly-ubuntu-application-tutorial.xml:964(para)
1257
msgid "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."
1260
#: quickly-ubuntu-application-tutorial.xml:975(code)
1261
msgid "<placeholder-1/> help"
1264
#: quickly-ubuntu-application-tutorial.xml:977(para)
1265
msgid "Opens a web browser with the help index."
1268
#: quickly-ubuntu-application-tutorial.xml:984(code)
1269
msgid "<placeholder-1/> license <Your_Licence="
1272
#: quickly-ubuntu-application-tutorial.xml:986(para)
1273
msgid "Adds license to project files. Before using this command, you should:"
1276
#: quickly-ubuntu-application-tutorial.xml:990(para)
1277
msgid "run <application>Quickly</application> save in case something goes wrong"
1280
#: quickly-ubuntu-application-tutorial.xml:993(para)
1281
msgid "Edit the file Copyright to include your authorship."
1284
#: quickly-ubuntu-application-tutorial.xml:995(para)
1285
msgid "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."
1288
#: quickly-ubuntu-application-tutorial.xml:999(para)
1289
msgid "Executes either <code><application>Quickly</application> license</code> or <code><application>Quickly</application> licence <License=</code> where <License= can be either: - GPL-3 (default) - GPL-2"
1292
#: quickly-ubuntu-application-tutorial.xml:1006(para)
1293
msgid "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)"
1296
#: quickly-ubuntu-application-tutorial.xml:1012(para)
1297
msgid "Finally, this will copy the Copyright at the head of every files."
1300
#: quickly-ubuntu-application-tutorial.xml:1014(para)
1301
msgid "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."
1304
#: quickly-ubuntu-application-tutorial.xml:1025(para)
1305
msgid "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."
1308
#: quickly-ubuntu-application-tutorial.xml:1029(para)
1309
msgid "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."
1312
#: quickly-ubuntu-application-tutorial.xml:1040(code)
1313
msgid "<placeholder-1/> release"
1316
#: quickly-ubuntu-application-tutorial.xml:1042(para)
1317
msgid "Posts a release of your project to a PPA on launchpad so that users can install the application on their system."
1320
#: quickly-ubuntu-application-tutorial.xml:1045(para)
1321
msgid "You can also execute: <code><application>Quickly</application> release <release_number=</code> of you don't want to use current release_number. The release_number must be a number."
1324
#: quickly-ubuntu-application-tutorial.xml:1049(para)
1325
msgid "<code><application>Quickly</application> release <release_number=</code> notes about changes where \"notes about changes\" is optional text describing what changes were made since the last save"
1328
#: quickly-ubuntu-application-tutorial.xml:1053(para)
1329
msgid "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."
1332
#: quickly-ubuntu-application-tutorial.xml:1057(para)
1333
msgid "Name, email and version setup.py will be automatically changed. (version will be <current_release= and bzr will commit and tagged. Once the release is done, <current_release= will be incremented by 0.1 to be ready for next release."
1336
#: quickly-ubuntu-application-tutorial.xml:1062(para)
1337
msgid "If you previously used <application>Quickly</application> shared <current_release=~publicX will be dropped to release <current_release= version (<current_release=~publicX <current_release=) You can modify the description and long description if you wish."
1340
#: quickly-ubuntu-application-tutorial.xml:1067(para)
1341
msgid "You can run <code><application>Quickly</application> package</code> and test your package to make sure it installs as expected. (This is not mandatory)"
1344
#: quickly-ubuntu-application-tutorial.xml:1077(para)
1345
msgid "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."
1348
#: quickly-ubuntu-application-tutorial.xml:1085(code)
1349
msgid "<placeholder-1/> save notes about changes"
1352
#: quickly-ubuntu-application-tutorial.xml:1087(para)
1353
msgid "where \"notes about changes\" is optional text describing what changes were made since the last save."
1356
#: quickly-ubuntu-application-tutorial.xml:1090(para)
1357
msgid "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>"
1360
#: quickly-ubuntu-application-tutorial.xml:1101(code)
1361
msgid "<placeholder-1/> share"
1364
#: quickly-ubuntu-application-tutorial.xml:1103(para)
1365
msgid "Updates your PPA with the the latest saved project changes."
1368
#: quickly-ubuntu-application-tutorial.xml:1105(para)
1369
msgid "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."
1372
#: quickly-ubuntu-application-tutorial.xml:1109(para)
1373
msgid "Name, email and version setup.py will be automatically changed. (version will be <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."
1376
#: quickly-ubuntu-application-tutorial.xml:1119(title)
1380
#: quickly-ubuntu-application-tutorial.xml:1121(link)
1381
msgid "<placeholder-1/>: <placeholder-2/> Command Reference"
1384
#: quickly-ubuntu-application-tutorial.xml:1124(ulink)
1385
msgid "Blog post on <placeholder-1/>"
1388
#: quickly-ubuntu-application-tutorial.xml:1127(ulink)
1389
msgid "Language: Python Language Reference"
1392
#: quickly-ubuntu-application-tutorial.xml:1130(ulink)
1393
msgid "Core Library: Python 2.6 Library Reference"
1396
#: quickly-ubuntu-application-tutorial.xml:1133(ulink)
1397
msgid "UI Library: PyGtk"
1400
#: quickly-ubuntu-application-tutorial.xml:1136(ulink)
1401
msgid "Database: CouchDB Reference"
1404
#: quickly-ubuntu-application-tutorial.xml:1139(ulink)
1405
msgid "UI Editing: Glade User Documenation"
1408
#: quickly-ubuntu-application-tutorial.xml:1142(ulink)
1409
msgid "Editor: Gedit Help"
1412
#: quickly-ubuntu-application-tutorial.xml:1145(ulink)
1413
msgid "Version Control: Bazaar"
1416
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2
1417
#: quickly-ubuntu-application-tutorial.xml:0(None)
1418
msgid "translator-credits"