=== yofel_ is now known as yofel === Jr is now known as Jrsquee === soreau_ is now known as soreau === _LibertyZero is now known as LibertyZero === msnsachin12 is now known as msnsachin === jhernandez_afk is now known as jhernandez === davidcalle_ is now known as davidcalle [16:39] The next day of App Developer Week is starting in ~20 minutes! [16:39] Everyone ready? :-) [16:46] I'm ready. kind of ;) [16:46] ah, hi jryannel, welcome! :-) [16:46] thx [16:52] jryannel: could you also join #ubuntu-classroom-backstage ? :) [16:59] How's everyone? [16:59] Are you all ready for some more development goodness on Ubuntu App Developer Week? [17:00] Ok, let's start the day with one of the newest and coolest technologies in Free Software today: [17:01] Qt Quick, and in particular the QML language === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu App Developer Week - Current Session: Qt Quick: QML the Language - Instructors: jryannel [17:01] jryannel, from the makers of Qt knows all about it and will be thrilled to tell you [17:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session. [17:02] Ok. Hi I'm jryannel from QtDF acting as Training Manager. This is my first irc training session so bear with me [17:02] I want to give short intro to Qt Quick's QML language and how to use it [17:02] First things first [17:03] You need Qt + Qt Creator, easiest [17:03] install - QtSDK (http://labs.qt.nokia.com/2011/04/06/qt-sdk-1-1-rc-released/) [17:03] or on ubuntu search for apt-cache search qt4; apt-cache search creator [17:04] To run QtQuick you need Qt 4.7.0 or better, latest is Qt 4.7.3 [17:04] or grab it from gitorious [17:04] So what is Qt Quick? [17:05] It's based on GraphicsView as 2.5d canvas API with graphics items [17:05] the graphicsview was developed in c++ and creating rich ui takes a long time [17:06] So our developers came up with a declarative way. [17:06] It looks like CSS or JSON [17:06] import QtQuick 1.0 [17:06] Rectangle { [17:06] width: 360 [17:06] height: 360 [17:06] } [17:07] First you import QtQuick module with major and minor version than you define a root element. [17:07] In this case a rectangle with a width of 360 and height of 360. [17:08] But live is easier if I don't type a book here; [17:08] Please visit: http://developer.qt.nokia.com/wiki/Qt_Quick_Tutorial_Basics [17:08] I will walk you through this and then another example [17:09] the qmlviewer is the declarative runner for developing purposes [17:09] it has many options, which you can ask with --help [17:09] It comes with Qt (in the bin folder) [17:10] qmlviewer main.qml will interpret the qml file and show the ui [17:10] The qmlviewer is made with the Qt Declarative module [17:10] a C++ module. You can write your own declarative viewer [17:11] see here how: http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeview.html#details [17:11] It's 3 lines of code [17:11] QDeclarativeView *view = new QDeclarativeView; [17:11] view->setSource(QUrl::fromLocalFile("myqmlfile.qml")); [17:11] view->show(); [17:12] That's in essence it the qmlviewer, which interprets the qml file. [17:12] But back to the qml side of coding [17:13] width : 300 means a property binding [17:14] It's different from assignment. It's kind of a contract. [17:14] So you can write "width: 2 * height" [17:14] with this width is always 2 times the height. [17:15] When the height changes the right side will be re-evaluated and assigned to the left [17:15] Another aspect width: 2 * height" shows: [17:15] JavaScript. Every right side can contain any kind of javascript code [17:16] A good javascript tutorial is at [17:16] https://developer.mozilla.org/en/JavaScript [17:17] Qt Quick is finally a declartive UI (QML) with C++ backend and JavaScript enhanced [17:18] Let's jump to "Composition of Components" on the wiki page I posted earlier [17:18] You can nest qml elements [17:18] A element has a name and propertis and child elments, like HTMl has [17:19] (I hope someone is correcting my spelling mistakes later :) ) [17:19] 1 [17:19] 2 [17:19] 3 [17:19] 4 [17:19] 5 [17:19] 6 [17:19] 7 [17:19] 8 [17:19] 9 [17:19] 10 [17:19] 11 [17:19] 12 [17:19] 13 [17:19] 14 [17:19] 15 [17:19] 16 [17:19] 17 [17:19] 18 [17:19] / File: BasicSteps_2.qml [17:19] import Qt 4.7 [17:19]   [17:19] Rectangle { [17:19]     width: 300 [17:19]     height: 300 [17:19]     color: "#FFF8DC"    // cornsilk [17:19]   [17:19]     Image { [17:19]         x: 10; y: 45 [17:20]         source: "voringsfossen1.jpg" [17:20]     } [17:20]   [17:20]     Text { [17:20]         x: 10; y: 265 [17:20]         text: "Voringsfossen" [17:20]     } [17:20] } [17:20] ohh, sorry [17:20] so we have a rectangle with an image and text child [17:20] The child elements have a corrdinate system relative to the parents [17:21] so a x:10, means 10 px relative to parent. [17:22] E.g. all elements are derived from the Item element: http://doc.qt.nokia.com/4.7-snapshot/qml-item.html [17:22] You find an overview about which items are available here: http://doc.qt.nokia.com/4.7-snapshot/qmlbasicelements.html [17:23] so when you write "x:10" you actually overwrite the default property value (in this case "x:0"). [17:24] For example if you don't specify a width or height to an element, it will be invisible! [17:25] Let's come back to "http://developer.qt.nokia.com/wiki/Qt_Quick_Tutorial_Basics" -> Custom Properties [17:26] besides the default properties you can add own properties. [17:26] E.g. "property int frameSize: 300" [17:27] which data types are supported? See here: http://doc.qt.nokia.com/4.7-snapshot/qdeclarativebasictypes.html [17:27] Can I add own data types. Sure. You can extend Qt Quick from the C++ side: http://doc.qt.nokia.com/4.7-snapshot/qml-extending.html [17:28] Even you can write own elements. E.g. a chart type or everything what can be painted. [17:29] Besides visual items you can also use non-visual items, e.g. timer (http://doc.qt.nokia.com/4.7-snapshot/qml-timer.html) [17:30] And you can also push QObjects from the c++ world into Qt Quick, e.g. for example for a D-Bus binding, or... [17:30] Now visit shortly http://doc.qt.nokia.com/4.7-snapshot/qml-tutorial1.html for another start into qt quick [17:31] It's just another hello world in qt quick [17:32] In Qt Creator our ide you can create a qt quick project with "New Project" -> "Qt Quick UI" [17:32] If you choose Qt Quick Application, it will generate a C++ qml viewer for you additional [17:33] So just copy the helloworld from (http://doc.qt.nokia.com/4.7-snapshot/qml-tutorial1.html) in your new project and run the project (no need for compilation) [17:34] Qt Creator (http://doc.qt.nokia.com/qtcreator-snapshot/index.html) is very much keyboard driven [17:34] It has also support got git, mercurial and I think svn and some other version control systems [17:35] Also for pastebin. Which I need to remember to use more [17:35] Here is a list of shortcuts: http://doc.qt.nokia.com/qtcreator-snapshot/creator-keyboard-shortcuts.html [17:36] One of our partners has created a reference card: http://www.kdab.com/index.php?option=com_content&view=article&id=126 [17:36] for Qt Creator. [17:36] But now back to qml... [17:37] http://doc.qt.nokia.com/4.7-snapshot/qml-tutorial2.html shows how to create a custom qml component [17:37] A component is a piece of qml code in a separate qml file [17:38] E.g. if you want create your own button you write a "Button.qml" file [17:38] Inside would be possible a Rectangle a Mousearea (which receives mouse clicks). [17:39] In the example tutorial they create a Cell in a "Cell.qml" file [17:39] The signal keyword allows to emit signal from a qml element. Just by calling the function name [17:40] The id property is a special property. It allows to identify an element inside a qml file ... [17:40] ... but also across other qml files. [17:40] As a convention I always give my root element the "id: root" [17:41] I give application wide used components a nice name so that I can reference them from other qml files. [17:42] When referencing an id from another qml file you make yourself depending. So think about if you really want to be dependent on the other qml (component). [17:42] Id's are only known to the qml runtime when the qml file is actually loaded [17:42] Have a look at the "The main QML file" section [17:43] There we use the "Cell.qml" component with a simple call to "Cell". [17:43] Any qml file (with upper-camelcase" ) in the same folder can be used directly. (Others need to imported) [17:44] "onClicked: helloText" - is a handler to the signal clicked() from Cell.qml [17:44] Great. We can make some rectangles and text and place them somewhere so what? [17:45] With a little bit of C++ and some motivated developers you can make something more ... [17:45] ... see here http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/ [17:46] Jens presents the desktop components (a little bit more complicated Cell.qml with some C++ backend) [17:48] It's a research project (that's why it's on labs). But I think they will be happy about feewdback [17:48] But in general Qt Quick is a very much design driven easy to code ui language. Where the heavy lifting is done in C++ [17:49] It's very flexible. With flexibility also comes a price [17:50] There are many solutions to the same problem. So you need a good practice to master the different elements and C++ extension possibilities to come to a good solution [17:50] Not every solution is simple and beautiful [17:51] There are 10 minutes remaining in the current session. [17:51] http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeexamples.html here you find more examples [17:52] Tomorrow we will go into the dynamic side of Qt Quick. Animations - States - Transitions [17:53] You can find learning material (e.g. videos and whole courses) here: http://qt.nokia.com/developer/learning/elearning [17:53] I hope I haven't confused you all to much. Qml is simple [17:53] Elements, Properties, Child Elements, [17:54] Property Binding [17:54] and JavaScript + C++ for application logic. [17:54] Take care. [17:54] Python and Qt Quick. Yes [17:55] There is PyQt and PySide [17:55] checkout: http://developer.qt.nokia.com/wiki/Category:LanguageBindings::PySide [17:56] There are 5 minutes remaining in the current session. [17:56] Sorry question was: Can I use Qt Quick with a python backend instead of C++? === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu App Developer Week - Current Session: Make your applications work in the cloud with Ubuntu One - Instructors: aquarius [18:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session. [18:02] Hi, all! [18:02] I'm Stuart Langridge, from the Ubuntu One team, and I'm here to talk about our upcoming app developer programme. [18:02] Do please ask questions throughout the talk: in the #ubuntu-classroom-chat channel, write QUESTION: here is my question [18:02] and so, on with the show. :) [18:02] Up until now, your ability as developers to do cool things with Ubuntu One has been limited. [18:02] But I'm going to change all that. [18:03] We want to make it possible, and easy, for you to add the cloud to your apps and to make new apps for the cloud [18:03] So we do all the heavy lifting, and your users (and you!) get the benefits. [18:03] Imagine, for example, you've made a recipe manager application. [18:03] So you can type in all the recipes you like to cook, and you've got a permanent record of them. [18:04] (For me, that would be: get a pizza base; put pepperoni on it. You'll be better at that than me.) [18:04] Don't really want to take your laptop into the kitchen, though, of course. [18:04] So, build a mobile app which you sign into with Ubuntu One, and have that show all your recipes too. [18:04] And a web app which you sign into with Ubuntu One, so that you can look up recipes while you're at a friend's house. [18:04] This is the sort of thing that we want to make easy; giving your users and you quick access to the Ubuntu One technology. [18:05] Mobile access to your data; web app access to your data; saving files direct into Ubuntu One; publishing files and photos from all your apps; adding playlists to the Ubuntu One music streaming app; streaming the user's own music into a game you've written. [18:06] Bringing all that stuff into apps on Ubuntu; Quickly apps or Qt Quick apps or Flash apps or C apps or JavaScript apps or Air apps or whatever you want to develop. [18:06] We give you the APIs to do it; you build cool stuff. Deal? Deal. [18:06] This stuff is all being heavily worked on right now as we speak. [18:06] So this talk won't be too detailed with specifics, because they might change. [18:06] I want to give you a flavour of what will soon be possible, and answer questions, and give some pointers, and get your thoughts. [18:07] Also, this is App Developer Week, so I can talk about what the components we're working on are and then admire all the cool ways you all come up with for snapping them together, rather than waiting for marketing to come up with a "product" for you to use :) [18:07] So, some components that can be snapped together. [18:07] You'll be able to sign in to a web application with Ubuntu One. [18:08] This means that you don't have to manage your own identity system, think about password renewal, all that. [18:08] And that's the hard annoying part of running web apps; working out what to do if a user forgets their password, etc, etc. "Enter the name of your first pet", etc. [18:08] This is just like "sign in with Facebook" or "sign in with Twitter"; it's OpenID-based, and lets your users sign in to a web app and you'll know their Ubuntu identity. [18:09] Once you've signed in to an app with Ubuntu One, that app can ask for permission to work with your data. [18:09] This lets you, developers, build applications that work on the desktop, on the web, on mobile phones. [18:10] The recipe manager example I mentioned above is one sort of thing you could do, there [18:11] Your users use the nice recipe manager app on Ubuntu, which you've built with Quickly or whatever you prefer [18:11] (QML, now that you're all experts in it :)) [18:11] And then they can go to yourrecipemanager.com and sign in with Ubuntu One [18:11] yourrecipemanager.com then asks them for permission to access their "recipes" database [18:11] and can then show them all their recipes on the web! [18:12] Your app (yourrecipemanager.com) does this via OAuth; it goes through the standard OAuth dance to get an OAuth token which can be used to access the user's recipes CouchDB database [18:12] And your users can be happy that it's secure, because yourrecipemanager.com will only have access to their recipes database; it can't read their contacts, or their files, or their credit card info. [18:13] So, this gives you the chance to build a brilliant Ubuntu app and yet still extend that app out to other platforms, for people who end up sometimes being away from their Ubuntu machine [18:13] so they can use the website when they're at work, and the Ubuntu app when they're at home [18:14] But you can imagine sharing other sorts of data between applications. [18:14] Imagine, for example, an achievements system. [18:14] You write a few games; some on the web, some on mobile phones, some on the Ubuntu desktop, some on Windows. [18:15] And every time the user achieves something in a game, you save that achievement to that user's "achievements" database. [18:15] ("100 levels completed!", or perhaps "100 enemies killed" if it's that sort of game...) [18:16] On Ubuntu, you'd save it into desktopcouch, and Ubuntu One will take care of synchronising that into the cloud. [18:16] On Android, your game would include the DroidCouch library which gives you simple access to save data directly into the user's personal cloud databases. [18:17] On the web, your game's backend could use the u1couch Python library to do the same thing, save directly into the cloud, or you could just use the underlying REST API (which is just standard CouchDB with OAuth signing; u1couch is just a wrapper) [18:17] The u1couch library is at https://launchpad.net/ubuntuone-couch for people who want to play with it. [18:18] it's Python, but it provides a good example of how to take a request to Ubuntu One, discover the user's Ubuntu One tokens, and maek requests using them [18:18] Or you could write your own wrapper library for PHP or Rails or Flash or whatever you prefer (and then tell me about it so I can point to the documentation for it!) [18:18] (feel free to use u1couch as a basis, or develop your own if you prefer) [18:18] At that point, all your games save achievements to the same place, so all your games can show you the achievements you've won in any game [18:19] And, as before, you can set up yourachievements.com where a user can log in and see all their achievements. [18:19] There's loads of stuff you can do with shared data. [18:19] The idea here is that all your stuff is everywhere -- more importantly, all your users' stuff is everywhere. [18:19] So they get the benefit of all their machines sharing the same information. [18:20] win an achievement in a game on your Ubuntu laptop, and your Ubuntu netbook also knows you've won that achievement, and which level you got up to [18:20] and so does your port of the game to a tablet or a web app or whichever other platform you want. [18:21] and you, developer with limited time, can concentrate on the stuff you're interested in -- making your app, your game, your program -- be great, and just not have to worry about all this data storage stuff. [18:21] your apps look better because they handle all this, and you don't have to worry about how to do it. :) [18:22] But Ubuntu One's not just about data. [18:23] Take the music streaming service, for example. [18:23] You can currently stream music to Android and iPhone, and you'll be able to add that music to the cloud from Ubuntu and Windows. [18:24] any music your users have got, that they've purchased from U1 or from elsewhere or ripped from their own CDs or whatever, they sync with U1, and then they can stream it to their mobiles. [18:24] Maybe you want to be able to stream music back to your Ubuntu machine without syncing it, or your Mac, or your Palm Pre, or your LG mobile phone, or your toaster. [18:24] So, just use the music streaming API, which is a simple REST HTTP API, based on the Subsonic API, or help people to get at their music by showing them our HTML5 web player for streaming music. [18:25] But there's more interesting ideas around music streaming than just "listen to the music". [18:26] Playlists, for example. The Ubuntu One Streaming apps on Android and iPhone know how to create playlists. [18:26] But how they do that is not a secret. Your playlists are just stored in your cloud databases. [18:27] So, why not sync your playlists from Banshee or Rhythmbox or Amarok or Exaile or Quod Libet or iTunes or Windows Media Player? [18:27] (or whichever music player you use yourself. :)) [18:27] Copy the playlists from your media player into desktopcouch on Ubuntu or into the cloud directly with u1couch on Windows or the Mac or anywhere else, in the correct format, and those playlists will instantly show up on your phone! [18:28] A simple example of this is https://code.launchpad.net/~sil/%2Bjunk/m3u2u1ms/ which is a quick script I wrote to take an m3u playlist and store it in desktopcouch on Ubuntu. [18:29] the whole script is about 200 lines, so as you can see this isn't hard [18:29] it just walks through an m3u file, finds a reference to all the songs in it, and creates that as a U1 playlist [18:29] So you can make your Banshee playlists available to the Ubuntu One app on your Android phone by exporting them as m3u and then importing them with the script. [18:31] Tighter integration is great, here; what we want to do is to make it easy for you all to build the stuff that you want on top of Ubuntu One. [18:31] So if you want to have your Amarok playlists available for streaming, it should be possible to do. [18:31] I rather like the idea of playing a Flash game on the web and having the background music be the most appropriate music chosen from *my* music collection. That'd be cool. [18:32] Ubuntu One also, as you know, does file sync. === tubadaz is now known as tubadaz_away [18:32] But just syncing files is already taken care of by Ubuntu One itself, on Ubuntu and Windows. [18:33] What's more interesting is working with those files. [18:33] So, for example, imagine being able to instantly, one-click-ly, publish a file from your application to a public URL and then tweet that URL. [18:34] Instant get-this-out-there-ness from your apps. [18:34] The screenshot tool Shutter, for example, can do this already; PrtSc to take a screenshot, then "Export > Ubuntu One". [18:34] They did a bunch of hard work to do that, and I massively applaud them; nice one Shutter team! [18:34] Based on what they did, that's the sort of thing that should be easier to do. [18:35] The shutter team built U1 publishing into their app, and it was harder than it should have been because the APIs were very much in flux, and they weren't very well documented [18:35] and we recognised that that needs fixing :) [18:36] So there will be easy-to-use APIs so your apps can do the same. Imagine quickly sharing your newly created image or document or recipe with the world. [18:36] Your app could have a button to "store all my files in the cloud", or "publish all my files when I save them", or "automatically share files that are part of Project X with my boss". [18:37] More to the point, you'll be able to work with files directly *in* the cloud. [18:37] So a backup program, for example, could back up your files straight into Ubuntu One and not sync them to your local machines. [18:38] that makes it easy for your app's files to be saved away from the local machine if that's what you want [18:39] which is ideal if you're a backup program, as mentioned [18:39] so your users can just say "yeah, save this straight into my online storage, I don't need it locally" [18:40] And of course being able to save things in and out of the cloud means that you can get an Ubuntu One sync solution on other platforms. [18:40] So you could work with your files from your non-Android mobile phone (we've already got the great mkarnicki working on that for Android!) [18:40] Build a fuse or gvfs backend for Ubuntu or Fedora or SuSE or Arch Linux. Build a WebDAV server which works with Ubuntu One and mount your Ubuntu One storage as a remote folder on your Mac. [18:41] so if you prefer to think of your online storage as a drive, rather than something which files are synced to, you can make that happen for yourself and for your users if you want to [18:42] And web apps can work with your cloud too, for files as well as data. [18:45] Imagine, say, a torrent client, running on the web, which can download something like a movie or music from legittorrents.info and save it directly into your cloud storage. [18:45] So you see an album you want on that torrent site (say, Ghosts I by Nine Inch Nails) and go tell this web torrent client about it (and you've signed in to that web torrent client with Ubuntu One) [18:46] And the website then downloads that NIN album directly into your personal cloud -- which of course makes it available for streaming direct to your phone. [18:47] You could do that with videos as well: choose a torrentable video (say, Beyond the Game, the documentary about World of Warcraft) and download that directly into your cloud, if someone built the web torrent client. [18:47] (Of course, that would be cooler if Ubuntu One offered a video streaming service as well as music streaming, wouldn't it. Hm... ;-) [18:47] But it's not just about your content for yourself; think about sharing. === tubadaz_away is now known as tubadaz [18:48] Ubuntu One lets you share a folder with people. This would be great for distribution. [18:48] Imagine that you publish an online magazine. [18:48] So, you create a folder on your desktop, and put issues of the magazine in it. [18:48] Then, you put a button on your website saying "Sign in with Ubuntu One to get our magazine". [18:49] When someone signs in, your website connects to the Ubuntu One files API, with your private OAuth token, and adds that signed-in user to the list of people that your magazine folder is shared with. [18:49] Then, whenever your magazine has a new issue, you just drop it into that folder on your desktop. [18:49] (Or even upload it to Ubuntu One directly through the website.) [18:49] All the subscribed people will get the new issue instantly, on all the machines they want it on, and in the cloud. [18:50] No-one has to do anything. No polling of RSS feeds, no bandwidth use by your website [18:51] You could build a cool Ubuntu app for your readers which would see that a new issue of the magazine has arrived on the machine and lets them read it [18:51] You could distribute anything like this. Imagine a podcast, or chapters of a novel. [18:51] It would also work for paid-for content; when someone pays, have your code share a folder with them, and put their paid-for stuff in that folder. That's all doable through the files API. [18:51] There are 10 minutes remaining in the current session. [18:51] We're building the files API itself (an HTTP-based REST API) and also some wrappers for it to make it easier to use in your apps from Python and the like. [18:52] OK, I've talked about a blizzard of ideas that'll be made possible, and shown you almost no code. [18:52] Which is because, as mentioned at the beginning, a lot of this code is currently being written and tested as part of the 11.04 release :) [18:52] However, code is nothing without documentation, and that's really important. [18:52] My main task for this cycle is to build documentation for all of this stuff; how to use Ubuntu One and all the APIs we provide in the cloud, on Android, on Windows, on iOS, on Ubuntu. [18:52] So there'll be documentation for all this stuff so all of you clever people can build things that I haven't even dreamed of. [18:52] We did some user research (thanks ivanka and the user research team!) on which sites have great API documentation and which don't, so we have an idea of good directions to go in. [18:53] And I'm working away feverishly on getting an alpha version out! [18:53] So, what I'd like to know is: what are your cool ideas? What help do you need from me in making them happen? What do you want to use Ubuntu One for in your apps and your scripts and your work? [18:53] and I've got about five minutes left, I think, so I'm happy to answer questions if anyone has any [18:54] otherwise, thanks for listening and I can hand over to alecu who is going to talk about DBus :) [18:56] hello all [18:56] There are 5 minutes remaining in the current session. [18:56] let's wait a couple more minutes and then we'll start [18:58] chadadavis asked: What's the best way to stay up to date on the API documentation status? [18:58] chadadavis, watch the U1 blog where we'll announce that the developer site is available [19:01] hello all === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu App Developer Week - Current Session: Take control of your desktop easily with DBus - Instructors: alecu [19:01] My name is alecu, some people also call me "Alejandro J. Cura" [19:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session. [19:02] I'm a developer on the Ubuntu One team, currently working on the desktop side of Ubuntu One. [19:03] For the past year or so I've been using DBus a lot to do bits and pieces of my work, so I'd like to share a bit of that during this session. [19:03] As you all probably know, DBus is a way for applications to request services from other applications. [19:04] For instance, Ubuntu One asks the gnome-keyring daemon for passwords. [19:04] Or the sound menu asks the music players to start playing or to change tracks. [19:04] so, let's dive into an example... [19:04] for this we need to have d-feet installed [19:05] sudo apt-get install d-feet [19:05] so, everybody has d-feet installed by now? [19:06] open it, and let's browse the Dbus bus a bit [19:06] go to File -> Connect to Session [19:06] and we will be able to explore the Session Bus [19:07] on the left we have a list of Bus Names. It's common for each application that's providing a service to use one, but some apps export more than one Bus Name. [19:07] clicking on one of the Bus Names, we'll see a list of Object Paths on the right [19:08] it's very common for one application to export more than one Object Path [19:09] if you click on one Bus Name and no object paths appear, that means that the application is not providing introspection data, and that means that we'll need to ask the app developers for more info on how to use those services thru dbus. [19:09] but the common case is to have both introspection data and some dbus documentation... [19:10] let's look at one example [19:10] let's open banshee, or some rhythmbox [19:11] when we run banshee, we'll see on d-feet that a new "Bus Name" was published to provide services to other apps [19:11] try clicking on d-feet on it: org.bansheeproject.Banshee [19:12] on the right hand we'll see a few Object Paths [19:12] let's open /org/mpris/MediaPlayer2 [19:12] and open the "org.mpris.MediaPlayer2.Player" interface === kevin4896 is now known as kdemarest [19:13] Inside that interface we'll see a list of Methods, Properties and Signals === tubadaz is now known as tubadaz_away [19:13] let's try one Method: play [19:13] sorry, Play() [19:14] double click on it, and a new small window opens "Execute D-Bus Method" [19:14] just click on Execute [19:14] banshee should start playing [19:15] (if it does not, try making it play some song by hand, then pausing it thru d-feet) [19:17] and then try playing with the other methods [19:17] for instance, Seek takes a parameter, try 30000000 [19:18] or -30000000 [19:18] chadadavis asked: there are a few 'play' methods under other object paths. Why are there so many? What's the difference, in the case of banshee here? [19:18] chadadavis, you mean Play and PlayPause? [19:19] I think Play always plays, but PlayPause is like a toggle. [19:19] chadadavis, the thing is that I don't know exactly how that works, and since it won't be documented in a DBus browser like d-feet we need to find some spec [19:20] and I was just pointing all of you to this example, because there's a lovely documentation for this interface, and it's common to many-many media players. [19:21] it's http://xmms2.org/wiki/MPRIS [19:22] and for the work I've been doing for the gnome-keyring and kwallet, I've been using the "Secrets Service API" http://people.collabora.co.uk/~stefw/secret-service/ === tubadaz_away is now known as tubadaz [19:23] so you'll probably need some similar docs for the service you are trying to use [19:23] or just use an explorer like d-feet to experiment with the interface you want. [19:24] So, after finding some service that you want to use, and some docs on it, you'll want to use DBus from your own application. [19:24] I've mostly used python for this, but I understand that other bindings are similar. [19:25] Here's a few examples I've made, so we can go over: [19:25] bzr branch lp:~alecu/+junk/dbus-lessons [19:26] crazedpsyc asked: if credentials are transported through DBus, can't I, or anyone else see them by using something like dbus-monitor? [19:27] crazedpsyc, there is one instance of DBus running for the system, and an instance per user that's logged in. [19:28] crazedpsyc, DBus connections are always local, and are either in the context of your computer or your session. [19:28] crazedpsyc, there are security rules on the system DBus, so apps are limited on what they can listen to. [19:29] crazedpsyc, for the session DBus I haven't seen any security restrictions, so afaict any app can listen for all the Dbus traffic for every other app. [19:30] crazedpsyc, that includes listening for the same logged in user credentials, but any X window app can capture all keystrokes anyway, so there's no point in securing that. [19:30] crazedpsyc, makes sense? [19:31] crazedpsyc, we can discuss this on much detail later, since app sandboxing is an issue I find very interesting to work on. [19:32] anyway, let's go back to the samples [19:32] let's look at the first one: 01-call_method.py [19:34] DBus usually has to work together with the main loop of your application [19:34] usually it's the gtk or kde main loop, and DBus supports it. [19:34] But you can also use the twisted reactor as a main loop, and we'll be able to integrate that as well. [19:35] in this example I'm using the gobject main loop, as used by gtk. [19:35] this line joins dbus with the loop: "DBusGMainLoop(set_as_default=True)" [19:36] and on the following lines we get at the "Session Bus", get an object from it using a "Bus Name" and an "Object Path" [19:36] and we get an "Interface" from that object. [19:36] as you can see, it all matches what we are able to see on d-feet. [19:37] once we get an Interface, we can call on the Methods on it, and access its Properties [19:38] in this example I'm just changing the brightness of my laptop display, and depending on your hardware it might not work. [19:38] So I'll ask you all for homework to modify it so it changes the volume of the music player. [19:39] psusi asked: What is the use of naming the Interface of an object separtely from the name of the object itself? Can this be used to publish versioned interfaces to, for instance, add a new argument to a signal without breaking applications that depend on the interface without the argument? [19:41] psusi, exactly. We can add more than one interface for an object, to group interfaces per intent, so for instance the MPRIS spec separates the methods in the Player from the Playlist interfaces, and also as you very correctly point out to create a new interface and not break compatibility with older interfaces. [19:42] Ok, let's look a bit further into arguments for the Methods === crazedpsyc is now known as crazedpsyc_away [19:43] since DBus is language agnostic, it defines a way to specify the types of the arguments and return values of DBus Methods [19:44] each language binding will try to match it to native types. For instance the python binding will usually transform DBus byte arrays into python strings [19:44] (python 2 strings, that is :-) ) [19:45] so Dbus has a way of specifying a small string that will act as the signature for the types in a DBus method call === crazedpsyc_away is now known as crazedpsyc [19:47] for instance let's browse with d-feet the org.mpris.MediaPlayer2.Playlists interface [19:47] the GetPlaylists method has a very complicated signature [19:47] Uint32 index, Uint32 maxcount, String order, Boolean reverse_order [19:48] in dbus you'll usually see this as "uusb" [19:49] and the return value for that method is array of [struct of (object path, string, string)] [19:49] you'll see it defined as "a(oss)" [19:50] for a complete reference of this, and much more, try this tutorial: http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#data-types [19:50] we'll need to define strings similar to this when we export our own objects on DBus as services [19:51] so let's look at example 03-export_object.py [19:51] There are 10 minutes remaining in the current session. [19:52] in this example I'm exporting a DBus object on a given "Bus Name" and with a given "Object Path" [19:52] and when I run the example, I can use d-feet to call the example_method. Go ahead, try it. [19:53] In addition to the Method, I'm also exporting a "Signal" [19:53] Signals work backwards [19:54] Usually a dbus client calls a method. [19:54] But the clients subscribe to signals, and the dbus service calls them. [19:54] We can see how to subscribe to a signal in example 2 [19:55] in 02-listen_signal.py we connect to the bus, and using a "Bus Name", an "Object Path" and an "Interface", we connect a function of our code to a DBus signal. [19:56] There are 5 minutes remaining in the current session. [19:56] in this example I also use the BackLight, but as homework as well you may change listen to media player signals as well. [19:57] ok, this was a brief overview of how to use DBus in your code. [19:57] I hope you follow the examples and start using DBus to take control of all the apps in your desktop. [19:58] Let's do a bit of Q/A if we have a bit more time. [19:58] And don't hesitate to ask me more questions by mail if you have any problems when working with DBus. === gerhardsiegesmun is now known as Jerriman [20:00] and please let me know what you ended up doing with DBus! :-) [20:01] chadadavis asked: so, when you setup a signal for others to subscribe to, you're responsible for sending them? Can you chain signals, with intermediate changes, to provide variations of existing signals from other services? === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu App Developer Week - Current Session: Touchégg: Bringing Multitouch Gestures to your Desktop - Instructors: JoseExposito [20:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session. [20:02] Hello everyone! [20:02] Thank you very much for joining in this session [20:03] I'm José Expósito and I'm the developer of Touchégg (https://code.google.com/p/touchegg/) [20:03] I'm an independent developper that tries to add more multitouch capabilities to Ubuntu/Linux desktops [20:03] and I'll try to explain what is Touchégg, how it works [20:04] how you can add multitouch support to your computer [20:04] and what technologies it uses. [20:05] And of course I will leave at the final of the session a bit of time for questions. [20:05] Ok, there we go :) [20:05] [20:05] [+] Introduction to Touchégg: what is it and features [20:05] [20:06] If you have a touch screen or a trackpad with multitouch capabilities [20:06] probably you know the options that this devices offers in others platforms [20:06] like MacOS or Windows [20:07] but we are Ubuntu/Linux users, we can't use this devices? [20:07] Yes, we can use the maximum capabilities of this kind of devices with Touchégg [20:07] and of course thanks to the work of the uTouch guys. [20:07] So, what is Touchégg? [20:08] Touchégg is a program that offer just that [20:08] the option to squeeze your trackpad or your touch screen capabilities. [20:09] You can think in your touch screen or trackpad like [20:09] a device that allows you to make a number of predefined gestures [20:09] for example drag two fingers, pinch with five fingers or tap with four finger. [20:10] Normally, making this gestures, one expects to see that the computer reacts to them and takes some action [20:10] for example, if you drag two fingers over a PDF, [20:11] you expect that the text begin to scroll or if you pinch three fingers over a window, [20:12] you expect that the windows become to resize. [20:13] Touchégg makes exactly this, is responsible of recognize this multitouch gestures [20:13] and make a configurable action. [20:14] In adition, Touchégg has a GUI (graphical user interface) [20:14] that allow you to configure this gestures and action in a very simple way [20:15] you can see here an screenshot: [20:15] https://lh3.googleusercontent.com/_ReRtolbPWnI/TXpw1FD8jAI/AAAAAAAAAGs/g2d7SUaCPow/touchegg-gui-kde1.png [20:16] Ok, but what gestures it support? [20:21] These gestures can be divided in four big families: [20:21] Tap: A tap gesture is, at this name suggests, a “click” over your trackpad with one to five fingers. [20:21] Drag: Again the name is self-descriptive [20:22] to make this gesture you only need to move two [20:22] to five fingers over your trackpad. [20:22] In addition this gesture allow to define directions, [20:22] ie drag three fingers up, for example to maximize a window [20:22] or drag three fingers down, for example to minimize a window. [20:22] Pinch: Pinch is... a pinch! [20:23] You just only have to imagine the tipical gesture [20:23] that you can make in you smartphone to zoom the window... [20:23] If you have one, my phone still have keys ;) [20:23] In the future this gesture will allow directions (in and out) [20:23] like the drag gesture [20:24] for example to integrate Touchégg with your favorite photo viewer [20:24] to zoom in or zoom out your photos. [20:24] Tap&hold: This is a composite gesture with a tap and a drag [20:24] I think that everyone has used it for example to select text [20:24] but of course Touchégg allows to personalize this gesture with any action and use it with up to five fingers. [20:25] In the future, I hope that when Natty will be ready, Touchégg will support more gestures, such as “Rotate” or “Double Tap”. [20:25] And what about the actions? [20:25] Touchégg allow you to make 14 differents actions [20:25] that you can be associe to the gestures [20:26] This is the full list: [20:26] MOUSE_CLICK – This action allows you to emulate the mouse [20:26] Tipically are assigned to a one, two and three fingers tap to make left, right and middle mouse click respectively [20:27] but of course you can assign this action to any gesture [20:27] VERTICAL_SCROLL and HORIZONTAL_SCROLL – As the name suggest [20:27] these actions allows you to make a scroll, like with your mouse wheel. Tipically asigned to the two fingers drag gesture [20:28] MINIMIZE_WINDOW – To minimize the window under cursor. [20:28] MAXIMIZE_RESTORE_WINDOW – To maximize the window under the cursor or, if is already maximized, to restore it. [20:28] CLOSE_WINDOW – To close the window under the cursor. [20:29] MOVE_WINDOW – Allows you to move a window across the screen. [20:29] RESIZE_WINDOW – To change the size of the window under the cursor, should be used with a pinch gesture. [20:29] SHOW_DESKTOP – In the first execution shows the desktop, in the second execution restores all windows. [20:30] CHANGE_DESKTOP and CHANGE_VIEWPORT – These actions allows you to change between virtual desktops [20:30] the difference is that some window managers, like Compiz uses by default “viewports” and other like KWin uses “virtual desktops” [20:30] SEND_KEYS – Probably one of the most versatile actions [20:31] allows you to assign a shortcut to a gesture for example to use Compiz effects or any specifies application shortcut. [20:31] RUN_COMMAND – Another of the most versatile actions [20:31] This actions allows you to run a command making a gesture, not only useful to run applications, using dbus or custom scrips this action can be really useful. [20:32] DRAG_AND_DROP – Allows you to emulate the classical one finger tap hold gesture [20:32] for example to select text but also with the mouse right or middle button. [20:33] With this combination of gestures and actions [20:33] you can get all the capabilities of your trackpad [20:33] with the more classical and basic gestures [20:33] like make a right buttons click tapping with two fingers [20:33] or other more advanced like resize a window pinching with three fingers, [20:34] use the “Exposse” Compiz effect dragging four fingers up [20:34] move a windows making a tap&hold gesture with two fingers [20:34] or zooming your photos making a double tap with five fingers... [20:35] And make this is very easy, you only need to select the gesture and their associated action in the Touchégg-GUI. [20:35] I recomend you to try Touchégg, especially in Natty [20:35] where the uTouch team guys have done an excellent job with the multitouch support [20:35] but if you are fearful, you can see Touchégg in action in this video: [20:35] http://www.youtube.com/watch?v=1Ek4QaFQ1qo [20:36] Common, go to see the video! [20:37] Ok, and this is all? [20:37] No :P [20:37] In my humble opinion, the multitouch interface is the future [20:38] but for the moment not all applications have support for this gestures [20:38] This suppose a problem, imagine that you want to zoom your photos making a two fingers pinch gesture [20:38] but in adition you want to zoom a web page making also a two fingers pinch [20:39] Well, in this moment probably you think [20:39] no problem, I can go to the Touchégg-GUI and assign the shorcut to this gesture [20:39] but... [20:39] OMG, the shorcut is different in your photo viewer and in your web explorer! [20:40] For this reason Touchégg incorporates a new feature in the next version [20:40] a new option that allow you to assing diferent actions for different applications [20:40] Thus now you can assing a different shortcut to the two fingers pinch gesture [20:41] in your photo viewer and in your web browser [20:41] With this new option, Touchégg lets you to add a multitouch layer easyly in your desktop. [20:41] And basically this is Touchégg and these are their options [20:41] In conclusion, the main idea is that you have global gestures [20:41] application specific gestures [20:42] and actions that should be executed with these gestures [20:42] and Touchégg brings you the option to manage all with a simple and intuitive graphical user interface. [20:42] [20:42] [+] Technologies used to develop Touchégg: uTouch-GEIS and Qt [20:42] [20:42] For now we have talked about what is Touchégg and what it makes but no about how it makes that [20:43] This part is more technical that the previous part and probably will be more interesting for developers [20:43] anyway I'll try to make it easy to understand and funny as possible for the non-developers attendees [20:43] Touchégg is developed in C++ and it uses two mainly tecnologies: Qt and uTouch-GEIS. [20:43] First I'm going to talk briefly about Qt [20:44] becouse I think that is a very popular workspace and many people will know it [20:44] Many people thinks that Qt is only a framework to build graphical interfaces [20:44] and of course, Touchégg-GUI uses Qt to make one, but Qt is more than this [20:45] Qt have many classes that facilitates programming, like work with XML, threads, sockets, dbus, etc, etc [20:46] And the better is that is multiplatform and binaries generated using this technology are small and fast! [20:47] Talk about the advantages of Qt probably need other complete conference, in fact this year Qt is the issue of many conferences, so I'm going to talk about uTouch-GEIS. [20:47] In Ubuntu 10.10 Canonical made an important contribution to the open source comunity with uTouch [20:47] a complete framework composed by many differents tools to bringing Linux multitouch support. [20:48] Touchégg uses uTouch-GEIS, that is an API that makes very easy to developers get the produced gestures in the multitouch devices. [20:48] Now in Ubuntu 11.04 Natty, the new multitouch support is awesome [20:48] the uTouch-team has done an excellent job. I can't talk about the technical part of uTouch-GEIS [20:48] anyway you can see an excellent explanation about it here: [20:49] https://wiki.ubuntu.com/MeetingLogs/appdevweek1104/Multitouch [20:49] For developers uTouch-GEIS bring two differents interfaces, one simplified and other more complex [20:49] For the objetives of Touchégg, the simpified interface is more than sufficient, you can see a little example code here: [20:49] https://bugs.launchpad.net/utouch-geis/+bug/754135/+attachment/2004778/+files/test.cpp [20:49] And ofcourse the Touchégg source code: [20:50] https://code.google.com/p/touchegg/source/browse/#svn%2Ftouchegg%2Fsrc%2Ftouchegg [20:51] I think that for a C or C++ developer beging to use uTouch is really easy and in adition the documentation is excellent: [20:51] http://people.canonical.com/~stephenwebb/geis-v2-api/ [20:51] There are 10 minutes remaining in the current session. [20:52] And well, this is all, you can make now questions [20:52] and remember that you can contact with me to make more questions, report a bug or request new features for Touchégg here: [20:52] https://code.google.com/p/touchegg/issues/list [20:56] There are 5 minutes remaining in the current session. [20:58] alecu asked: what API are you using to get the multi touch events? [20:59] alecu asked: I'm developing a game that will use multitouch directly, so will it be possible to disable TouchEgg events for one specific window? === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu App Developer Week - Current Session: Unity: Integrating with Launcher and Places - Instructors: kamstrup [21:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session. [21:02] Hi all! [21:02] So I guess I am up now [21:02] My name is Mikkel Kamstrup Erlandsen and i work for Canonical on the DX team [21:02] In my spare time I also dabble with software, namely Zeitgeist and search engines [21:03] On the DX team I am working on all the backend and infrastructure stuff [21:03] so not so much all the fancy graphics you see in Unity [21:03] but all that goes on beneath it :-) [21:03] In particular relevant for this session libunity [21:04] libunity is a library with the purpose of instrumenting and integrating with Unity [21:04] For the Natty cycle you'll be able to integrate with the Launcher and the Places/Lenses [21:05] (btw for this session I'll call it Places - but in the Oneriric cycle we'll officially change to Lenses) [21:05] (it's just that "places" is in my muscle memory right now :-)) [21:05] One big caveat emptor before we proceed too far [21:06] libunity does not currently have API or ABI stability guarantees [21:06] we will work on that - promised - but we also want to ensure that the API is really really nice before we freeze it [21:06] and in fact [21:06] I can already guarantee that there will be slight changes when we begin the Oneiric cycle [21:07] but that said [21:07] You can already take libunity for a spin and do some pretty impressive stuff with it [21:07] fx. both the Apps and Files places are implemented with libunity [21:07] there's no "priviledged" Unity API for those two buggers [21:08] anyone here will be able to do exactly what they do [21:08] Before we start talking about the places let's talk about the Launcher integration [21:08] The Launcher integration is a lot simpler than the places [21:09] So enough with the intro talk [21:09] -------------------- [21:09] The Unity Launcher [21:09] The simplest way you can integrate with the launcher is via what is called "static quicklists" [21:09] https://wiki.ubuntu.com/Unity/LauncherAPI#Static%20Quicklist%20entries [21:10] If you follow that link you'll see a snippet from a normal .desktop file [21:10] If you take a normal .desktop file and add [Foo Shortcut Group] entries to it like shown [21:10] you can add quicklist right there [21:11] Look at your own /usr/share/applications/evolution.desktop for a live example [21:12] What static quicklist elements can basically do is launch an executable [21:12] so very simple [21:12] no programming required [21:12] If you want to get a bit more power [21:12] you need to use libunity [21:13] More specifically the LauncherEntry API [21:13] For the sake of the examples we'll use Python examples today, but you can also code in Vala, C [21:13] (or C++ if you manually write the C calls out) [21:14] You'll see the API here http://developer.ubuntu.com/api/ubuntu-11.04/GIR/python/Unity-3.0.html#Unity.LauncherEntry [21:14] it may deserve mention that we are starting to push up Python docs for the libs generated via GObject Introspection to http://developer.ubuntu.com/api/ [21:14] Anyway [21:15] Looking at the LauncherEntry docs you'll see that it only has static constructors - not conventional constructors [21:15] that's because you always get a "singleton" back for the particular app [21:15] Let me find an example [21:16] Here http://bazaar.launchpad.net/~unity-team/libunity/trunk/view/head:/examples/launcher.py [21:16] You can set 3 main properties on the launcher entry [21:16] A "count" that will be displayed as a number on the top part of the tile [21:17] you may have seen this on apps like Evolution displaying the number of unread mails this way [21:17] Then you can add a progress bar [21:17] the values for progress must be between 0 and 1 [21:17] (and it's a float) [21:17] You can also set the urgency hint [21:18] Some may know that an "urgency hint" is something you normally have on X11 windows [21:18] it makes the WM flash the window icon [21:18] the difference here is that the libunity urgency doesn't require a window on the screen in order to mark an app as requiring attention [21:19] this can be useful for background processes like Ubuntu One or others that need to draw your attention to their icon when they don't have a window on screen somewhere [21:20] The last part of the LauncherEntry API is that you can set a "dynamic quicklist" [21:20] The dynamic quicklists differ from the static ones in that you can build and update them programmatically at runtime [21:21] You simply have access to a libdbusmenu DbusmenuMenuItem instance that you can populate how you like [21:21] ok [21:21] any questions on the laucnher api before we move on? [21:22] ------------ [21:22] so now to Places [21:22] As said before the situation here is slightly regretable [21:22] It's known both as Lenses and Places in Natty [21:23] For Oneiric we'll change to Lenses only [21:23] (also in the all the public APIs) [21:23] but for now let me call them Places [21:23] Places run outside the core Unity process [21:24] Think of them very much like remote database that provides data for Unity to render [21:24] if you've worked with modern web development frameworks or MVC in UIs think that the place provides the *model* and Unity is a generic View [21:25] Of course we have the standard Apps and Files places [21:25] they are not very good beginner examples unfortunately [21:25] but there are a few simple examples to start from that lots of ppl have found instructive [21:25] If we stick to the Python example again [21:26] you can check it out from lp:~unity-team/unity-place-sample/unity-place-python [21:26] or for now just browse it online at http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/files [21:27] First look at python.place [21:27] All places register themselves to unity via a .place file [21:27] installed under /usr/share/unity/places [21:27] in a .place file you specify some contact info for Unity to find you on dbus [21:28] Then each place has one or more PlaceEntries [21:28] A placeentry is prettymuch what maps to an icon in the launcher [21:28] You'll probably have the Apps and Files entries in your launcher at the bottom [21:29] For each entry you want to expose from your place's process you need a [Entry:Foo] line in the .place file [21:29] The only place that actually has more than one place entry is the Apps place [21:30] although the second one is hidden [21:30] Try looking at /usr/share/unity/places/applications.place [21:30] you'll see that [Entry:Runner] has ShowEntry=false and ShowGlobal=false [21:31] First ShowEntry=false tells unity to not put a tile in the launcher bar for this place entry [21:31] the ShowGlobal=false clause tells Unity to not include this entry's results when searching from the Dash [21:31] aka home screen [21:31] (the one you get when you hit ) [21:32] There is in fact a spec for these .place files [21:32] Check https://wiki.ubuntu.com/Unity/Lenses#Registration [21:32] You'll also note that you can define a keyboard shortcut for you place [21:33] And now we're talking about this [21:33] A general best-practice is to *not* include your search results in the Dash [21:33] that is please set ShowGlobal=false [21:34] When I write my code I am as excited as anyone to get people using it [21:34] but people really want a fast Dash [21:34] and if we have Dash searches laucnhing off 3 http requests, 5 disk searches, and whatnot for each letter typed... [21:34] so if you want to integrate with the Dash results make sure your results are: [21:35] 1) almost always relevant [21:35] 2) Super snappy [21:35] 3) Doesn't use to many resources to compute [21:35] and 1) is probably the key point [21:35] So most places would just have their tile in the launcher and a keyboard shortcut [21:36] Ok back to the code [21:36] In the .place file you specify the dbus contact details for your place daemon [21:36] this means that Unity will start your daemon via dbus activation [21:37] no need to start it yourself on login or anything [21:37] this way unity has a chance of not starting all daemons at once when you log in [21:37] which would run the risk of hogging your disk [21:38] ok [21:38] now look at http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/view/head:/unity-place-python.py [21:38] This is the code for the sample place daemon [21:38] There are 3 concepts you need to know about when writing a place dameon [21:38] that is 1) results 2) groups 3) sections [21:39] each of these three have a Dee.Model associated with them [21:39] Dee.Model is implement by a library called libdee which we use for almost all of the data sharing behind Unity [21:39] Dee.Model is like a table that is shared between multiple processes [21:40] if any one changes, adds, or removes from the model all the other processes watching that model will be notified of what's changed [21:40] pretty powerful stuff [21:40] this allows us to do a kind of "distributed MVC" [21:41] so in one we have the place daemon that updates the results Dee.Model and Unity is watching that same model, updating the View whenever it changes [21:41] So obviously the results_model contains all the search results [21:41] then we have a sections_model [21:42] the sections partition the results into disjoint logical components [21:42] A sections should represent a "browsable" subset of the result space [21:42] If you consider the space of all apps then the sections could be Video, Audio, Games, Office [21:42] etc [21:43] The sections contribute the elements of the dropdown embedded in the search bar [21:43] you can also access the sections of a place via the right-click context menu on a place entry in the laucncher [21:43] then there a groups [21:44] the groups partition the visible result set into meaning subgroups [21:44] If you are watching all hits from a file search the groups could be Today, Yesterdat, Last Week, Last Month, ... etc [21:45] the groups_model and results_model both have a _global_ counterparts [21:46] the global models are the ones used for searching from the dash [21:46] (so you normally don't need those) [21:46] btw [21:46] the API docs for Dee.Model are here http://developer.ubuntu.com/api/ubuntu-11.04/GIR/python/Dee-0.5.html#Dee.Model [21:46] The API docs for Dee are not fully true though [21:47] it has been augmented with some Python sweetness [21:48] There is currenlty no easy way to document this Python magic, but you can find a demo of the Python magic for Dee.Model here http://bazaar.launchpad.net/~unity-team/dee/trunk/view/head:/examples/pythontricks.py [21:49] You can also find the docs for what exactly the columns are in all the different models on https://wiki.ubuntu.com/Unity/Lenses#Results%20Model [21:49] One last thing I want to mention is "Activation" [21:50] So places require special callbacks when activating some special results [21:50] Fx. [21:50] the apps place returns Apps Available for Download that open in the Software Center when you click the,m [21:50] this is achieved via the Activation API [21:51] you basically register a handler for a regex matching URIs or mimetypes [21:51] There are 10 minutes remaining in the current session. [21:51] then when unity tries to laucnh a it it looks for any places registered for launchoing that hit [21:51] and does a Dbus callback to the place daemon giving it the URI to activate [21:52] the place daemon then responds whether Unity should hide the Dash as a response or if the Dash should still be shown [21:52] in case for Apps Availabale for Download we ask Unity to hide the dash [21:52] (so we can load S-C) [21:53] but if we fx. wanted to implemen [21:53] implement [21:53] a file browser fx [21:53] then we could ask unity to keep the dash on screen, and then just clear our results_model and repopulate it with the contents of the clicked directory [21:54] I guess I'll leave the rest for your own exploration [21:54] So if anyone has questions don't hold back [21:55] if that's not the case then let me take 2 minutes to talk about "renderers" [21:56] if you browse https://wiki.ubuntu.com/Unity/Lenses#Renderers [21:56] you'll see that we have a concept called renderers which you can specify in various places in the API [21:56] There are 5 minutes remaining in the current session. [21:57] tronda asked: How much focus is the Python based API getting? [21:57] Almost as much as the C/Vala API [21:58] we really want it to be a 1st class experience [21:58] and honestly i almost think that the Python API is better than the Vala/C api right now :-O) [21:58] tronda asked: Any plans to get browser to work with the libunity for web applications? [21:59] not short term [21:59] there are some far out plans, but nothing to hold your breath for :-) [21:59] tronda asked: If working with a web service which is potentially slow - would one use Tracker/Zeitgest to index content. Any help from Unity to make this simpler? [22:00] Because the place daemon is another process than Unity it's not super critical if web services are slow [22:00] so I'd say "don't worry in most cases" [22:01] alecu asked: when a lens adds item, I see that it can add a url to get the item picture from it, like the books lens does with book covers. Will this be standard? [22:01] yes, yes it will === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu App Developer Week - Current Session: Tracking Source Code History with Bazaar - Instructors: jelmer [22:01] i believe that you can simply insert a URL as icon and Unity will try and load it [22:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session. [22:02] hello [22:03] I'll be talking to you today about Bazaar, the version control system. [22:04] My name is Jelmer Vernooij and I'm one of the Bazaar hackers. I'll quickly go over what Bazaar is and some of the basics before briefly discussing some of the more advanced features that I think might be interesting to app developers. [22:04] Please ask questions, and if there are other features you're interested in and would like me to cover, please mention so. I'm more than happy to cover other Bazaar-related topics instead. [22:05] Bazaar is version control system, which can track the changes of your source code over time. You might be familiar with other version control systems such Subversion, CVS, Perforce or Visual Sourcesafe. [22:06] Like many current generation version control systems, such as Git or Mercurial, Bazaar is distributed. This means that somebody who checks out the source code gets a full copy of the history on their local machine rather than having a central location with the full history and requiring all changes to happen on that central server. [22:07] Every clone of your source history will have a hidden .bzr/ subdirectory which contains Bazaar metadata. You can use the bzr command to inspect and add to the history of your tree. [22:07] To version a tree using Bazaar, run "bzr init" in the root followed by "bzr add" to add the files you would like Bazaar to track. When you're happy, run "bzr commit" to store the first revision of your tree. [22:08] Bazaar will ask you for a description of your changes. Later on, when you've changed files you can run "bzr commit" again to store those changes as a new revision. [22:08] This creates a series of revisions, named a branch. [22:08] Let's try this with a simple hello world program: [22:08] $ mkdir hello [22:08] $ cd hello [22:08] $ bzr init [22:09] Bazaar should now tell you that it's created a branch and what file format it used. [22:09] After you've done this you should see a .bzr/ meta directory if you run "ls -a". [22:10] Now, create a file and tell Bazaar to track its history. I'm creating hello.sh which simply prints "Hello, World" on standard out. [22:10] $ bzr add hello.sh [22:11] You can now use "bzr commit" to store this as your first revision. [22:11] are there any questions so far ? Am going too fast, should I skip the basics? [22:12] Sorry, s/Am/Am I/ [22:13] $ bzr commit [22:13] This will launch your editor and allow you to specify a message describing your changes. Since this is our original commit, I usually just type "Initial commit" [22:13] To look at the history of your source code later, you can use various bzr subcommands. Mostly commonly used are "bzr log", "bzr diff", "bzr cat" and the graphical "bzr qlog" (a QT revision browser) and "bzr viz" (a GTK+ revision browser). [22:15] If you change your file again you can run "bzr commit" to store your new changes. [22:15] "bzr log" should show you two revisions at this point. [22:15] To share code, you can push your branch somewhere using the "bzr push" command, pull in new changes from somebody else using the "bzr pull" command or create a clone of a branch found elsewhere using "bzr branch". [22:16] Bazaar allows you to push over the HTTP, SSH, SFTP and FTP transports as well as to local paths. [22:19] "bzr push" and "bzr pull" only allow you to add new revisions to existing history. If two branches have different changes, then you can use "bzr merge" to merge the two branches. If you merge somebody else's branch then their changes will be merged into your local tree. When you're happy with the way the trees were merged, you can run "bzr commit" to create a new revision that joins the changes. [22:19] Bazaar integrates with various other Ubuntu related tools. For example, Launchpad uses Bazaar as its version control system. You can push branches to Launchpad so others can access them. [22:19] Launchpad can also import branches from other version control systems like Git, Subversion, Mercurial or CVS for you. Launchpad will automatically add links on a branch page for bugs that have been marked as fixed by that branch. You can use a shorthand ("lp:") to address Launchpad from within Bazaar. [22:20] Let's try to push the branch we created earlier to Launchpad. Assuming you're already logged in to Launchpad you can run "bzr push lp:~YOURNAME/+junk/hello". [22:21] Where YOURNAME is your Launchpad user name. If you get an error about logging in, you need to tell Bazaar about your Launchpad id by running "bzr lp-login". [22:21] This will create a branch named hello in your area of Launchpad that's not tied to a particular project. Use "bzr lp-open" to see Launchpad's page for your newly created branch. [22:22] QUESTION: So, you generally don't push from your working directory to someone else's, but rather to a common directory that you use for accumulating and tracking versions? === binfalse_ is now known as binfalse [22:24] There is no right answer to this, but usually you push to a central location, where all developers pull in new upstream changes from that central location and their branches eventually get merged into the upstream location again. [22:24] For more information on the possible workflows, see this wiki page: http://wiki.bazaar.canonical.com/Workflows [22:25] What works best for you depends on the goals of your project, the number of developers, etc. [22:26] For example, in Bazaar we have a robot that is the only one with write access to our main branch. When a developer makes a change they push their branch to Launchpad, send an email to the robot and the robot will merge their branch, run the testsuite and only push to the main branch if all tests passed. [22:26] QUESTION: what does the --use-existing mean? when you bzr push --use-existing lp:~YOURNAME/=junk [22:27] --use-existing means that Bazaar will push to a location, even if that location is a directory with existing files. You shouldn't have to use it for Launchpad [22:29] To clone an existing branch on Launchpad, you can use "bzr branch" as I mentioned earlier. For example, you can make a clone of pydoctor project by running "bzr branch lp:pydoctor pydoctor". [22:30] There are several useful plugins available for Bazaar. If you're a web developer, you might want to have a look at bzr-upload. If you are doing Ubuntu or Debian packaging you might be interested in the bzr-builddeb plugin. [22:31] "bzr plugins" will print a list of plugins you currently have installed. [22:32] For a full list of the available plugins, have a look at this page: http://wiki.bazaar.canonical.com/BzrPlugins [22:32] The most commonly used ones are also packaged separately in Ubuntu. [22:33] You might in particular be interested in the bzr-gtk or qbzr plugins, which provide a graphical interface on top of Bazaar. [22:34] ("bzr-gtk" and "qbzr" are also the names of their respective packages in Ubuntu) [22:35] E.g. qbzr provides the "bzr qlog" command I mentioned earlier which allows you to browse history. Another useful command is "bzr qannotate" which will show you for each line in a file in which revision it was last modified, as well as the author of that revision and the message associated with that revision. [22:38] As I mentioned earlier, Launchpad can import revision history from other version control systems. It has upstream imports of a lot of upstream projects. [22:38] For example, lp:bzr is the upstream Bazaar source code, and lp:samba is the upstream Samba source code (Samba's source code is maintained in Git). [22:39] Launchpad also has branches for all source packages in Ubuntu. If you have a recent version of Bazaar installed, you can check out these branches by using "bzr branch ubuntu:PACKAGENAME" [22:40] One of the latest cool features of Launchpad are source recipes. Recipes are simple scripts of a couple of lines that can combine branches and build Debian source packages from them. [22:41] Launchpad can regularly (usually once a day, if one of the branches changed) build recipes for you. This is really useful if you want to regularly build Ubuntu packages of revisions of your application. It allows users to easily run the latest revision of your application. [22:42] The recipes are built at most once a day, when one of the branches in the recipe changes. [22:42] The resulting packages end up in a PPA. [22:42] Let's have a look at a recipe for the pydoctor tool - https://code.launchpad.net/~jelmer/+recipe/pydoctor-daily [22:43] At the bottom of the page you can see that this recipe combines two branches: [22:43] lp:pydoctor, which contains the upstream source code and lp:~jelmer/pydoctor/unstable which contains packaging metadata. [22:44] This recipe is built daily without any intervention from anybody other than new revisions being pushed to Launchpad. As you can see, the last time it was built was on March 21, when Michael Hudson (the developer of pydoctor) made a change to the upstream branch. This caused a new package to be built into my PPA. [22:45] Packaging is outside of the scope of this session, as are recipes, but if you're interested I'd recommend watching Matthew Revell's screencast that explains recipes in more detail. [22:45] http://blog.launchpad.net/cool-new-stuff/source-package-recipes [22:46] Speaking about documentation... Bazaar has a lot of good user documentation, most of which can be found on our web site: http://doc.bazaar.canonical.com/bzr.dev/en/ [22:46] Is there anything else you would like me to cover? [22:47] If you're already using Bazaar, is there anything that you find problematic? Perhaps I can give hints to improve your workflow. [22:48] QUESTION: how would i "bzr push" behind a proxy/firewall? [22:50] That's a good question. For just pushing over HTTP (which we support too, but which is not supported by Launchpad), you can set the http_proxy environment variable. [22:51] There are 10 minutes remaining in the current session. [22:51] Looking at the docs quickly I can't find any details on using SSH over a proxy. [22:52] You should be able to use corkscrew, see http://www.omappedia.org/wiki/Using_bzr_and_launchpad_behind_a_proxy for details. [22:53] Are there any other questions? [22:56] QUESTION: outside of hosting sites like launchpad, how does one traditionally send a merge request? Is there a way to link repositories? Or do you just simply pull from it and see? [22:57] You can either just ask the person that you would like to do the merge informally. ("I have fixed bug X and my branch is at location http://..../, please merge"); or you can send them an email that contains the changes ("bzr send --mail-to=their-email-address") [22:58] There are 5 minutes remaining in the current session. [23:00] Only one minute remaining.. thanks for attending. If you have any further questions, don't hesitate to ask in #bzr [23:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat ||