RadQuickly
Current Session: Rapid App Development with Quickly - Instructors: mterry
1 [17:00] <dpm> So if there are no more questions, the last bit is just to thank you for your participation and hope you've enjoyed the session! :-)
2 [17:00] <ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2011/09/08/%23ubuntu-classroom.html following the conclusion of the session.
3 [17:01] <mterry> Hello, everyone!
4 [17:01] <mterry> Thanks to dpm and johnoxton for the awesome session
5 [17:01] <mterry> Mine piggybacks on that by giving more information about quickly
6 [17:01] <mterry> I'm a maintainer of quickly and will give a brief overview of what it is, how to use it
7 [17:02] <mterry> Please ask questions in the chatroom, I'll try to answer them
8 [17:02] <mterry> So first, here's a link for the wiki page of quickly: https://wiki.ubuntu.com/Quickly
9 [17:03] <mterry> Quickly is at its heart a templating system. It is designed to give a user a quick start of sample code and allow you to modify it easily and quickly(!) into a full program
10 [17:04] <mterry> It has a lot of boiler plate code that gets you started, and commands to simplify common application tasks like packaging it up, saving to bzr, publishing to users in a PPA
11 [17:04] <mterry> It's designed, as is developer.ubuntu.com, to make opinionated choices about technologies (which makes the task of teaching new users a lot easier -- just teach one thing)
12 [17:05] <mterry> But since new quickly templates can be written, new sets of opinionated choices are easy too
13 [17:05] <mterry> For example, someone might one day write a Kubuntu template, to make app dev on Kubuntu easier
14 [17:06] <mterry> And lastly, quickly is supposed to make app dev on Ubuntu fun, by letting the user focus on the good stuff, not the boring administrative stuff
15 [17:06] <mterry> In 11.04, we have four templates: ubuntu-application, ubuntu-cli, ubuntu-flash-game, ubuntu-pygame
16 [17:06] <mterry> ubuntu-application is PyGTK based to make graphical apps
17 [17:06] <mterry> ubuntu-cli is Python based for making command line apps
18 [17:07] <mterry> ubuntu-flash-game is like it sounds, you drop a flash file into place and quickly handles the rest
19 [17:07] <mterry> ubuntu-pygame is pygame based, which is a Python library for making games easy
20 [17:07] <mterry> There was a question last session about why PyGTK and not GObject Introspection
21 [17:08] <mterry> We'd like to use PyGI, but due to technical details (it's difficult to automatically guess dependencies then), we haven't made that jump yet
22 [17:08] <mterry> Hopefully we will during the 12.04 cycle
23 [17:08] <mterry> Our goals for 11.10 are rather modest, focusing just on some outstanding bugs
24 [17:09] <mterry> OK, enough intro. Let's do something!
25 [17:09] <mterry> You can install it easily enough by running: "sudo apt-get install quickly"
26 [17:09] <mterry> This will install all sorts of programming goodies
27 [17:10] <mterry> Once installed, try running "quickly create ubuntu-application test-project"
28 [17:10] <mterry> The 'create' is the command to quickly to say "start a project", the 'ubuntu-application' tells which kind of project, and the last argument names the project
29 [17:11] <mterry> You'll now have a folder called "test-project" with a bunch of files
30 [17:11] <mterry> It will also open a window
31 [17:11] <mterry> This is what your project looks like already! It has a window, menubar, etc
32 [17:12] <mterry> This will all be easy to change, but it's a quick start, something to modify
33 [17:12] <mterry> So why don't we try doing that
34 [17:12] <mterry> We'll look into changing the UI a bit
35 [17:12] <mterry> Run "quickly design" to open Glade, which is a graphical UI builder
36 [17:13] <mterry> Using glade well is a whole 'nother talk, but if you have any questions, I'll be happy to answer them
37 [17:13] <mterry> For now, just note that you can select things, change properties on the right, and add new widgets from the toolbox on the left
38 [17:14] <mterry> Quickly automatically hooks your Glade UI files together with your code
39 [17:14] <mterry> I'll give a brief overview of what you can do in Glade
40 [17:15] <mterry> Layout in Glade (and in GTK in general) is done via Boxes (like VBox or HBox) that arrange them in rows or columns
41 [17:15] <mterry> You can change a widget's position in a box in the properties dialog (2nd packing tab)
42 [17:16] <mterry> The packing tab is where you can adjust a lot of the layout of a widget. The first tab is where you control specific widget functionality (like the text on a label, etc)
43 [17:16] <mterry> OK, so enough Glade.
44 [17:16] <mterry> I'll briefly mention here, to learn more about quickly, you can also run "quickly help" to get an overview of commands
45 [17:17] <mterry> Or you can run "quickly tutorial" to get a more complete tutorial that you can walk through at your own pace
46 [17:17] <mterry> That will walk you through creating a full app
47 [17:18] <mterry> Back to my overview, another important command is "quickly add dialog dialog-name"
48 [17:18] <mterry> Let's say you want to add a quit-confirmation dialog or something
49 [17:19] <mterry> By running the above command, quickly will generate a new Glade file and a new Python file to handle any special code you may want for the dialog
50 [17:19] <mterry> After running the command, you may want to close out Glade and reopen it with "quickly design" to open the new Glade file that you just created
51 [17:20] <mterry> Now to use that new dialog from code, open your code with "quickly edit"
52 [17:20] <mterry> This opens all your Python files in the gedit text editor
53 [17:21] <mterry> You can open your new dialog from existing code by doing something as simple as "from project_name.DialogName import DialogName"
54 [17:22] <mterry> Then creating new dialogs with DialogName()
55 [17:22] <mterry> Another thing Quickly makes easy for you is signals
56 [17:23] <mterry> Whenever a user clicks on a button, starts typing in a field, or closes a window, a signal is generated inside GTK
57 [17:23] <mterry> If you want to run some code in response to an action, you need to add a signal handler in code
58 [17:23] <mterry> Normally, this is a bit tricky to coordinate between Glade's files and Python's files
59 [17:24] <mterry> But Quickly will automatically join widgets in Glade to Python code if you name your signal handler correctly
60 [17:24] <mterry> Let's say you want to do something in response to a widget you named "button1" being clicked
61 [17:24] <mterry> Open the widget window's Python file, and add a function called "on_button1_clicked(self, widget, data=None)"
62 [17:25] <mterry> The trick is to name it on_WIDGETNAME_SIGNALNAME
63 [17:25] <mterry> And Quickly will find it and join it up
64 [17:25] <mterry> Another thing to note about Quickly is how your code is even organized
65 [17:26] <mterry> I've talked about opening a window's Python file, but what does that mean?
66 [17:26] <mterry> You'll have three subfolders in your project folder
67 [17:26] <mterry> One is "bin", one is "project_name", and the last is "project_name_lib"
68 [17:26] <mterry> Quickly 'owns' files in bin and project_name_lib
69 [17:27] <mterry> 'bin' holds a wrapper that Quickly uses to find the rest of your files once it's installed on disk
70 [17:27] <mterry> 'project_name_lib' holds a bunch of convenience boiler plate code that Quickly provides. But you shouldn't modify it, as Quickly may update that code on you
71 [17:27] <mterry> The real goods are in the 'project_name' folder
72 [17:28] <mterry> There you'll find a file with some utility code (like command line argument handling) and a file for each window in your project
73 [17:28] <mterry> And a file for your preferences
74 [17:29] <mterry> The wrapper will create ProjectWindow class, and that's the entry point to your program
75 [17:29] <mterry> If you wanted to take an existing project and drop it into a Quickly shell project, or even wanted to start with a Quickly project but not really use any of the code, the only actual requirement is that you have a ProjectWindow class
76 [17:30] <mterry> Once that code runs, you can do whatever you like
77 [17:30] <mterry> Another thing Quickly does for you is use a logging framework
78 [17:30] <mterry> You'll see existing code use log calls
79 [17:31] <mterry> Run your project ("quickly run") in verbose mode ("quickly run -- --verbose") to see the log output
80 [17:31] <mterry> When debugging, you can add new log calls (or just use plain old print statements)
81 [17:32] <mterry> Another, more precise, method of debugging is to use the command line python debugger pdb
82 [17:32] <mterry> Acts like gdb but for python
83 [17:32] <mterry> I've not used it a bunch (print statements tend to be quicker and easier)
84 [17:32] <mterry> But if you have a really tough bug, pdb can be a help
85 [17:33] <mterry> OK, so let's say you have your app, version 1.0
86 [17:33] <mterry> You'll want to start being able to release it
87 [17:34] <mterry> In general, there are three levels of testing a finished program: (1) locally, by the developer, (2) a wider, but still limited, group of testers, and (3) everyone (an actual release)
88 [17:34] <mterry> Quickly will help with all 3
89 [17:35] <mterry> But before we create any packages at all, let's set up a bit of metadata about your project
90 [17:35] <mterry> Add your name and email to the AUTHORS file that Quickly created for yu
91 [17:35] <mterry> you
92 [17:35] <mterry> Also define a license for your project with "quickly license BSD" or similar.
93 [17:35] <mterry> GPL-3 is the default
94 [17:35] <mterry> So no need to run anything if that suits you fine
95 [17:36] <mterry> Open the project-name.desktop.in file in your project directory too
96 [17:36] <mterry> It has a Categories line that you can edit to adjust where in the menu structure it will show up
97 [17:36] <mterry> See defined categories here: http://standards.freedesktop.org/menu-spec/latest/apa.html
98 [17:36] <mterry> And finally, edit setup.py in your project directory
99 [17:37] <mterry> Near the bottom are some metadata bits like description, website, author name again
100 [17:37] <mterry> With all that in place, let's make a package!
101 [17:37] <mterry> For local testing by you yourself, "quickly package" will create a package
102 [17:37] <mterry> It will create it in the directory above your project folder
103 [17:38] <mterry> So install it with "sudo dpkg -i ../test-project_0.1_all.deb" or some such
104 [17:38] <mterry> Then it should appear in your menu
105 [17:38] <mterry> And be runnable from the Terminal with "test-project"
106 [17:38] <mterry> Once you think it seems alright, you're ready to distribute to the rest of your testers
107 [17:38] <mterry> This involves a PPA
108 [17:39] <mterry> A Personal Package Archive
109 [17:39] <mterry> In your Launchpad account, you can create new PPAs
110 [17:39] <mterry> First you need SSH and GPG keys, explained in the Launchpad help:
111 [17:39] <mterry> https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
112 [17:39] <mterry> https://help.launchpad.net/YourAccount/ImportingYourPGPKey
113 [17:40] <mterry> Also set DEBEMAIL and DEBFULLNAME in .bashrc, the same as what was in your GPG key
114 [17:40] <mterry> And then run ". ~/.bashrc" to pick up the new settings in your current Terminal
115 [17:41] <mterry> (that's a period as a command)
116 [17:41] <mterry> Just a bash trick to run a script in the current environment
117 [17:41] <mterry> For instructions on actually creating a PPA: https://help.launchpad.net/Packaging/PPA
118 [17:41] <mterry> Phew
119 [17:42] <mterry> With that all set up, all you need to do to publish a new testing version of your project is "quickly share"
120 [17:42] <mterry> This will package up your current code and put it in your PPA
121 [17:42] <mterry> It will pick its own version (though you can provide one, see "quickly help share")
122 [17:43] <mterry> The version used will be based on the last release
123 [17:43] <mterry> It won't increment the actual version number, but just a version suffix
124 [17:43] <mterry> Since it's just a testing package
125 [17:44] <mterry> If you want to make a full release to the wider public, use "quickly release"
126 [17:44] <mterry> It helps to have a project created in Launchpad and associated with your quickly project
127 [17:44] <mterry> (use "quickly configure lp-project project-name" for that)
128 [17:45] <mterry> Then Quickly can automatically make project release announcements for you
129 [17:45] <ClassBot> dpm asked: I've been reading the quickly help, and I'm still not sure I get it: what's the difference between the 'quickly share' and 'quickly release' commands?
130 [17:46] <mterry> So "share" uses a version suffix like -public1
131 [17:46] <mterry> It releases into your PPA, but that's it
132 [17:46] <mterry> "release" will actually increment your main version number to something like 11.09
133 [17:47] <mterry> (These version changes can be overridden on the command line)
134 [17:47] <mterry> Release will also, if a Launchpad project is associated, make a release announcement and close the milestone
135 [17:48] <mterry> So there isn't *much* difference, more of a semantic one. Release just does a few thing extra
136 [17:48] <mterry> I also recommend using different PPAs for "sharing" and "releasing"
137 [17:48] <mterry> You can specify a ppa with "quickly share --ppa mterry/testing" for example
138 [17:48] <mterry> That way, you can have a "testing" PPA and a "stable" PPA
139 [17:49] <mterry> So it's good to get in the mental habit of thinking that there are two types of publishing
140 [17:49] <mterry> One for testers, one for everyone
141 [17:50] <mterry> I suppose there's one more level of publishing actually
142 [17:50] <mterry> And that's to the Software Center
143 [17:50] <mterry> Quickly has a few tools to help you prepare your app for the Software Center (whether it's a free or proprietary one)
144 [17:50] <mterry> There is the "submitubuntu" command
145 [17:50] <ClassBot> There are 10 minutes remaining in the current session.
146 [17:51] <mterry> This will publish to a PPA just as "release" does
147 [17:51] <mterry> But it will do some of the legwork to prepare the package for the App Review process
148 [17:51] <mterry> Notably, it will install everything into /opt
149 [17:51] <mterry> And it will set some bits of packaging metadata up like "where is the app screenshot" and such
150 [17:52] <mterry> You can prepare a local deb with such changes by using "quickly package --extras"
151 === wangerin1 is now known as wangerin
152 [17:52] <mterry> See https://wiki.ubuntu.com/AppReviews for more information about such requirements
153 [17:53] <mterry> That's all I had prepared!
154 [17:53] <mterry> I'm happy to answer Quickly questions if ya'll have any
155 [17:55] <ClassBot> There are 5 minutes remaining in the current session.
156 [17:56] <ClassBot> MDesigner asked: what resources do you recommend for learning Glade and Python, specifically geared toward Ubuntu/Unity development?
157 [17:56] <mterry> Heh, well, the previous session was on developer.ubuntu.com
158 [17:57] <mterry> That aims to be the answer to that question
159 [17:57] <mterry> It already has some content, but it's hoped to flesh that out a bit
160 [17:57] <mterry> For example, I'll be writing a tutorial for it on how to integrate Ubuntu One Files in your app using Python (I also have a talk on that tomorrow)
161 [17:58] <mterry> For learning Python in general, Dive into Python is a great resource
162 [17:58] <mterry> Google that and you'll get results
163 [17:58] <mterry> I'm not sure there are great tutorials out there for Glade specifically
164 [18:00] <mterry> For Unity integration, http://unity.ubuntu.com/ has some info. Like http://unity.ubuntu.com/projects/appindicators/ has links for documentation
MeetingLogs/appdevweek1109/RadQuickly (last edited 2011-09-09 18:23:10 by dpm)