=== 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
dpmThe next day of App Developer Week is starting in ~20 minutes!16:39
dpmEveryone ready? :-)16:39
jryannelI'm ready. kind of ;)16:46
dpmah, hi jryannel, welcome! :-)16:46
nigelbjryannel: could you also join #ubuntu-classroom-backstage ? :)16:52
dpmHow's everyone?16:59
dpmAre you all ready for some more development goodness on Ubuntu App Developer Week?16:59
dpmOk, let's start the day with one of the newest and coolest technologies in Free Software today:17:00
dpmQt Quick, and in particular the QML language17:01
=== 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
dpmjryannel, from the makers of Qt knows all about it and will be thrilled to tell you17:01
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session.17:01
jryannelOk. Hi I'm jryannel from QtDF acting as Training Manager. This is my first irc training session so bear with me17:02
jryannelI want to give short intro to Qt Quick's QML language and how to use it17:02
jryannelFirst things first17:02
jryannelYou need Qt + Qt Creator, easiest17:03
jryannelinstall - QtSDK (http://labs.qt.nokia.com/2011/04/06/qt-sdk-1-1-rc-released/)17:03
jryannelor on ubuntu search for apt-cache search qt4; apt-cache search creator17:03
jryannelTo run QtQuick you need Qt 4.7.0 or better, latest is Qt 4.7.317:04
jryannelor grab it from gitorious17:04
jryannelSo what is Qt Quick?17:04
jryannelIt's based on GraphicsView as 2.5d canvas API with graphics items17:05
jryannelthe graphicsview was developed in c++ and creating rich ui takes a long time17:05
jryannelSo our developers came up with a declarative way.17:06
jryannelIt looks like CSS  or JSON17:06
jryannelimport QtQuick 1.017:06
jryannelRectangle {17:06
jryannel    width: 36017:06
jryannel    height: 36017:06
jryannelFirst you import QtQuick module with major and minor version than you define a root element.17:07
jryannelIn this case a rectangle with a width of 360 and height of 360.17:07
jryannelBut live is easier if I don't type a book here;17:08
jryannelPlease visit: http://developer.qt.nokia.com/wiki/Qt_Quick_Tutorial_Basics17:08
jryannelI will walk you through this and then another example17:08
jryannelthe qmlviewer is the declarative runner for developing purposes17:09
jryannelit has many options, which you can ask with --help17:09
jryannelIt comes with Qt (in the bin folder)17:09
jryannelqmlviewer main.qml will interpret the qml file and show the ui17:10
jryannelThe qmlviewer is made with the Qt Declarative module17:10
jryannela C++ module. You can write your own declarative viewer17:10
jryannelsee here how: http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeview.html#details17:11
jryannelIt's 3 lines of code17:11
jryannelQDeclarativeView *view = new QDeclarativeView;17:11
jryannel view->setSource(QUrl::fromLocalFile("myqmlfile.qml"));17:11
jryannel view->show();17:11
jryannelThat's in essence it the qmlviewer, which interprets the qml file.17:12
jryannelBut back to the qml side of coding17:12
jryannelwidth : 300 means a property binding17:13
jryannelIt's different from assignment. It's kind of a contract.17:14
jryannelSo you can write "width:  2 * height"17:14
jryannelwith this width is always 2 times the height.17:14
jryannelWhen the height changes the right side will be re-evaluated and assigned to the left17:15
jryannelAnother aspect width:  2 * height" shows:17:15
jryannelJavaScript. Every right side can contain any kind of javascript code17:15
jryannelA good javascript tutorial is at17:16
jryannelQt Quick is finally a declartive UI (QML) with C++ backend and JavaScript enhanced17:17
jryannelLet's jump to "Composition of Components" on the wiki page I posted earlier17:18
jryannelYou can nest qml elements17:18
jryannelA element has a name and propertis and child elments, like HTMl has17:18
jryannel(I hope someone is correcting my spelling mistakes later :) )17:19
jryannel/ File: BasicSteps_2.qml17:19
jryannelimport Qt 4.717:19
jryannel 17:19
jryannelRectangle {17:19
jryannel    width: 30017:19
jryannel    height: 30017:19
jryannel    color: "#FFF8DC"    // cornsilk17:19
jryannel 17:19
jryannel    Image {17:19
jryannel        x: 10; y: 4517:19
jryannel        source: "voringsfossen1.jpg"17:20
jryannel    }17:20
jryannel 17:20
jryannel    Text {17:20
jryannel        x: 10; y: 26517:20
jryannel        text: "Voringsfossen"17:20
jryannel    }17:20
jryannelohh, sorry17:20
jryannelso we have a rectangle with an image and text child17:20
jryannelThe child elements have a corrdinate system relative to the parents17:20
jryannelso a x:10, means 10 px relative to parent.17:21
jryannelE.g. all elements are derived from the Item element: http://doc.qt.nokia.com/4.7-snapshot/qml-item.html17:22
jryannelYou find an overview about which items are available here: http://doc.qt.nokia.com/4.7-snapshot/qmlbasicelements.html17:22
jryannelso when you write "x:10" you actually overwrite the default property value (in this case "x:0").17:23
jryannelFor example if you don't  specify a width or height to an element, it will be invisible!17:24
jryannelLet's come back to "http://developer.qt.nokia.com/wiki/Qt_Quick_Tutorial_Basics" -> Custom Properties17:25
jryannelbesides the default properties you can add own properties.17:26
jryannelE.g. "property int frameSize: 300"17:26
jryannelwhich data types are supported? See here: http://doc.qt.nokia.com/4.7-snapshot/qdeclarativebasictypes.html17:27
jryannelCan 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.html17:27
jryannelEven you can write own elements. E.g. a chart type or everything what can be painted.17:28
jryannelBesides visual items you can also use non-visual items, e.g. timer (http://doc.qt.nokia.com/4.7-snapshot/qml-timer.html)17:29
jryannelAnd you can also push QObjects from the c++ world into Qt Quick, e.g. for example for a D-Bus binding, or...17:30
jryannelNow visit shortly http://doc.qt.nokia.com/4.7-snapshot/qml-tutorial1.html for another start into qt quick17:30
jryannelIt's just another hello world in qt quick17:31
jryannelIn Qt Creator our ide you can create a qt quick project with "New Project" -> "Qt Quick UI"17:32
jryannelIf you choose Qt Quick Application, it will generate a C++ qml viewer for you additional17:32
jryannelSo 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:33
jryannelQt Creator (http://doc.qt.nokia.com/qtcreator-snapshot/index.html) is very much keyboard driven17:34
jryannelIt has also support got git, mercurial and I think svn and some other version control systems17:34
jryannelAlso for pastebin. Which I need to remember to use more17:35
jryannelHere is a list of shortcuts: http://doc.qt.nokia.com/qtcreator-snapshot/creator-keyboard-shortcuts.html17:35
jryannelOne of our partners has created a reference card: http://www.kdab.com/index.php?option=com_content&view=article&id=12617:36
jryannelfor Qt Creator.17:36
jryannelBut now back to qml...17:36
jryannelhttp://doc.qt.nokia.com/4.7-snapshot/qml-tutorial2.html shows how to create a custom qml component17:37
jryannelA component is a piece of qml code in a separate qml file17:37
jryannelE.g. if you want create your own button you write a "Button.qml" file17:38
jryannelInside would be possible a Rectangle a Mousearea (which receives mouse clicks).17:38
jryannelIn the example tutorial they create a Cell in a "Cell.qml" file17:39
jryannelThe signal keyword allows to emit signal from a qml element. Just by calling the function name17:39
jryannelThe id property is a special property. It allows to identify an element inside a qml file ...17:40
jryannel... but also across other qml files.17:40
jryannelAs a convention I always give my root element the "id: root"17:40
jryannelI give application wide used components a nice name so that I can reference them from other qml files.17:41
jryannelWhen 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
jryannelId's are only known to the qml runtime when the qml file is actually loaded17:42
jryannelHave a look at the "The main QML file" section17:42
jryannelThere we use the "Cell.qml" component with a simple call to "Cell".17:43
jryannelAny qml file (with upper-camelcase" ) in the same folder can be used directly. (Others need to imported)17:43
jryannel"onClicked: helloText" - is a handler to the signal clicked() from Cell.qml17:44
jryannelGreat. We can make some rectangles and text and place them somewhere so what?17:44
jryannelWith a little bit of C++ and some motivated developers you can make something more ...17:45
jryannel... see here http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/17:45
jryannelJens presents the desktop components (a little bit more complicated Cell.qml with some C++ backend)17:46
jryannelIt's a research project (that's why it's on labs). But I think they will be happy about feewdback17:48
jryannelBut in general Qt Quick is a very much design driven easy to code ui language. Where the heavy lifting is done in C++17:48
jryannelIt's very flexible. With flexibility also comes a price17:49
jryannelThere 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 solution17:50
jryannelNot every solution is simple and beautiful17:50
ClassBotThere are 10 minutes remaining in the current session.17:51
jryannelhttp://doc.qt.nokia.com/4.7-snapshot/qdeclarativeexamples.html here you find more examples17:51
jryannelTomorrow we will go into the dynamic side of Qt Quick. Animations - States - Transitions17:52
jryannelYou can find learning material (e.g. videos and whole courses) here: http://qt.nokia.com/developer/learning/elearning17:53
jryannelI hope I haven't confused you all to much. Qml is simple17:53
jryannelElements, Properties, Child Elements,17:53
jryannelProperty Binding17:54
jryanneland JavaScript + C++ for application logic.17:54
jryannelTake care.17:54
jryannelPython and Qt Quick. Yes17:54
jryannelThere is PyQt and PySide17:55
jryannelcheckout: http://developer.qt.nokia.com/wiki/Category:LanguageBindings::PySide17:55
ClassBotThere are 5 minutes remaining in the current session.17:56
jryannelSorry question was: Can I use Qt Quick with a python backend instead of C++?17:56
=== 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
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session.18:01
aquariusHi, all!18:02
aquariusI'm Stuart Langridge, from the Ubuntu One team, and I'm here to talk about our upcoming app developer programme.18:02
aquariusDo please ask questions throughout the talk: in the #ubuntu-classroom-chat channel, write QUESTION: here is my question18:02
aquariusand so, on with the show. :)18:02
aquariusUp until now, your ability as developers to do cool things with Ubuntu One has been limited.18:02
aquariusBut I'm going to change all that.18:02
aquariusWe want to make it possible, and easy, for you to add the cloud to your apps and to make new apps for the cloud18:03
aquariusSo we do all the heavy lifting, and your users (and you!) get the benefits.18:03
aquariusImagine, for example, you've made a recipe manager application.18:03
aquariusSo you can type in all the recipes you like to cook, and you've got a permanent record of them.18:03
aquarius(For me, that would be: get a pizza base; put pepperoni on it. You'll be better at that than me.)18:04
aquariusDon't really want to take your laptop into the kitchen, though, of course.18:04
aquariusSo, build a mobile app which you sign into with Ubuntu One, and have that show all your recipes too.18:04
aquariusAnd 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
aquariusThis is the sort of thing that we want to make easy; giving your users and you quick access to the Ubuntu One technology.18:04
aquariusMobile 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:05
aquariusBringing 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
aquariusWe give you the APIs to do it; you build cool stuff. Deal? Deal.18:06
aquariusThis stuff is all being heavily worked on right now as we speak.18:06
aquariusSo this talk won't be too detailed with specifics, because they might change.18:06
aquariusI want to give you a flavour of what will soon be possible, and answer questions, and give some pointers, and get your thoughts.18:06
aquariusAlso, 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
aquariusSo, some components that can be snapped together.18:07
aquariusYou'll be able to sign in to a web application with Ubuntu One.18:07
aquariusThis means that you don't have to manage your own identity system, think about password renewal, all that.18:08
aquariusAnd 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
aquariusThis 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:08
aquariusOnce you've signed in to an app with Ubuntu One, that app can ask for permission to work with your data.18:09
aquariusThis lets you, developers, build applications that work on the desktop, on the web, on mobile phones.18:09
aquariusThe recipe manager example I mentioned above is one sort of thing you could do, there18:10
aquariusYour users use the nice recipe manager app on Ubuntu, which you've built with Quickly or whatever you prefer18:11
aquarius(QML, now that you're all experts in it :))18:11
aquariusAnd then they can go to yourrecipemanager.com and sign in with Ubuntu One18:11
aquariusyourrecipemanager.com then asks them for permission to access their "recipes" database18:11
aquariusand can then show them all their recipes on the web!18:11
aquariusYour 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 database18:12
aquariusAnd 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:12
aquariusSo, 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 machine18:13
aquariusso they can use the website when they're at work, and the Ubuntu app when they're at home18:13
aquariusBut you can imagine sharing other sorts of data between applications.18:14
aquariusImagine, for example, an achievements system.18:14
aquariusYou write a few games; some on the web, some on mobile phones, some on the Ubuntu desktop, some on Windows.18:14
aquariusAnd every time the user achieves something in a game, you save that achievement to that user's "achievements" database.18:15
aquarius("100 levels completed!", or perhaps "100 enemies killed" if it's that sort of game...)18:15
aquariusOn Ubuntu, you'd save it into desktopcouch, and Ubuntu One will take care of synchronising that into the cloud.18:16
aquariusOn 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:16
aquariusOn 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
aquariusThe u1couch library is at https://launchpad.net/ubuntuone-couch for people who want to play with it.18:17
aquariusit'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 them18:18
aquariusOr 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
aquarius(feel free to use u1couch as a basis, or develop your own if you prefer)18:18
aquariusAt 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 game18:18
aquariusAnd, as before, you can set up yourachievements.com where a user can log in and see all their achievements.18:19
aquariusThere's loads of stuff you can do with shared data.18:19
aquariusThe idea here is that all your stuff is everywhere -- more importantly, all your users' stuff is everywhere.18:19
aquariusSo they get the benefit of all their machines sharing the same information.18:19
aquariuswin 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 to18:20
aquariusand so does your port of the game to a tablet or a web app or whichever other platform you want.18:20
aquariusand 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
aquariusyour apps look better because they handle all this, and you don't have to worry about how to do it. :)18:21
aquariusBut Ubuntu One's not just about data.18:22
aquariusTake the music streaming service, for example.18:23
aquariusYou 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:23
aquariusany 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
aquariusMaybe 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
aquariusSo, 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:24
aquariusBut there's more interesting ideas around music streaming than just "listen to the music".18:25
aquariusPlaylists, for example. The Ubuntu One Streaming apps on Android and iPhone know how to create playlists.18:26
aquariusBut how they do that is not a secret. Your playlists are just stored in your cloud databases.18:26
aquariusSo, why not sync your playlists from Banshee or Rhythmbox or Amarok or Exaile or Quod Libet or iTunes or Windows Media Player?18:27
aquarius(or whichever music player you use yourself. :))18:27
aquariusCopy 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:27
aquariusA 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:28
aquariusthe whole script is about 200 lines, so as you can see this isn't hard18:29
aquariusit just walks through an m3u file, finds a reference to all the songs in it, and creates that as a U1 playlist18:29
aquariusSo 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:29
aquariusTighter 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
aquariusSo if you want to have your Amarok playlists available for streaming, it should be possible to do.18:31
aquariusI 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:31
aquariusUbuntu One also, as you know, does file sync.18:32
=== tubadaz is now known as tubadaz_away
aquariusBut just syncing files is already taken care of by Ubuntu One itself, on Ubuntu and Windows.18:32
aquariusWhat's more interesting is working with those files.18:33
aquariusSo, 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:33
aquariusInstant get-this-out-there-ness from your apps.18:34
aquariusThe screenshot tool Shutter, for example, can do this already; PrtSc to take a screenshot, then "Export > Ubuntu One".18:34
aquariusThey did a bunch of hard work to do that, and I massively applaud them; nice one Shutter team!18:34
aquariusBased on what they did, that's the sort of thing that should be easier to do.18:34
aquariusThe 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 documented18:35
aquariusand we recognised that that needs fixing :)18:35
aquariusSo 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
aquariusYour 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:36
aquariusMore to the point, you'll be able to work with files directly *in* the cloud.18:37
aquariusSo a backup program, for example, could back up your files straight into Ubuntu One and not sync them to your local machines.18:37
aquariusthat makes it easy for your app's files to be saved away from the local machine if that's what you want18:38
aquariuswhich is ideal if you're a backup program, as mentioned18:39
aquariusso your users can just say "yeah, save this straight into my online storage, I don't need it locally"18:39
aquariusAnd 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
aquariusSo 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
aquariusBuild 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:40
aquariusso 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 to18:41
aquariusAnd web apps can work with your cloud too, for files as well as data.18:42
aquariusImagine, 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
aquariusSo 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:45
aquariusAnd 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:46
aquariusYou 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
aquarius(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
aquariusBut it's not just about your content for yourself; think about sharing.18:47
=== tubadaz_away is now known as tubadaz
aquariusUbuntu One lets you share a folder with people. This would be great for distribution.18:48
aquariusImagine that you publish an online magazine.18:48
aquariusSo, you create a folder on your desktop, and put issues of the magazine in it.18:48
aquariusThen, you put a button on your website saying "Sign in with Ubuntu One to get our magazine".18:48
aquariusWhen 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
aquariusThen, whenever your magazine has a new issue, you just drop it into that folder on your desktop.18:49
aquarius(Or even upload it to Ubuntu One directly through the website.)18:49
aquariusAll the subscribed people will get the new issue instantly, on all the machines they want it on, and in the cloud.18:49
aquariusNo-one has to do anything. No polling of RSS feeds, no bandwidth use by your website18:50
aquariusYou 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 it18:51
aquariusYou could distribute anything like this. Imagine a podcast, or chapters of a novel.18:51
aquariusIt 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
ClassBotThere are 10 minutes remaining in the current session.18:51
aquariusWe'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:51
aquariusOK, I've talked about a blizzard of ideas that'll be made possible, and shown you almost no code.18:52
aquariusWhich 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
aquariusHowever, code is nothing without documentation, and that's really important.18:52
aquariusMy 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
aquariusSo 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
aquariusWe 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:52
aquariusAnd I'm working away feverishly on getting an alpha version out!18:53
aquariusSo, 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
aquariusand I've got about five minutes left, I think, so I'm happy to answer questions if anyone has any18:53
aquariusotherwise, thanks for listening and I can hand over to alecu who is going to talk about DBus :)18:54
alecuhello all18:56
ClassBotThere are 5 minutes remaining in the current session.18:56
aleculet's wait a couple more minutes and then we'll start18:56
ClassBotchadadavis asked: What's the best way to stay up to date on the API documentation status?18:58
aquariuschadadavis, watch the U1 blog where we'll announce that the developer site is available18:58
alecuhello all19:01
=== 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
alecuMy name is alecu, some people also call me "Alejandro J. Cura"19:01
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session.19:01
alecuI'm a developer on the Ubuntu One team, currently working on the desktop side of Ubuntu One.19:02
alecuFor 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
alecuAs you all probably know, DBus is a way for applications to request services from other applications.19:03
alecuFor instance, Ubuntu One asks the gnome-keyring daemon for passwords.19:04
alecuOr the sound menu asks the music players to start playing or to change tracks.19:04
alecuso, let's dive into an example...19:04
alecufor this we need to have d-feet installed19:04
alecusudo apt-get install d-feet19:05
alecuso, everybody has d-feet installed by now?19:05
alecuopen it, and let's browse the Dbus bus a bit19:06
alecugo to File -> Connect to Session19:06
alecuand we will be able to explore the Session Bus19:06
alecuon 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
alecuclicking on one of the Bus Names, we'll see a list of Object Paths on the right19:07
alecuit's very common for one application to export more than one Object Path19:08
alecuif 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
alecubut the common case is to have both introspection data and some dbus documentation...19:09
aleculet's look at one example19:10
aleculet's open banshee, or some rhythmbox19:10
alecuwhen we run banshee, we'll see on d-feet that a new "Bus Name" was published to provide services to other apps19:11
alecutry clicking on d-feet on it: org.bansheeproject.Banshee19:11
alecuon the right hand we'll see a few Object Paths19:12
aleculet's open /org/mpris/MediaPlayer219:12
alecuand open the "org.mpris.MediaPlayer2.Player" interface19:12
=== kevin4896 is now known as kdemarest
alecuInside that interface we'll see a list of Methods, Properties and Signals19:13
=== tubadaz is now known as tubadaz_away
aleculet's try one Method: play19:13
alecusorry, Play()19:13
alecudouble click on it, and a new small window opens "Execute D-Bus Method"19:14
alecujust click on Execute19:14
alecubanshee should start playing19:14
alecu(if it does not, try making it play some song by hand, then pausing it thru d-feet)19:15
alecuand then try playing with the other methods19:17
alecufor instance, Seek takes a parameter, try 3000000019:17
alecuor -3000000019:18
ClassBotchadadavis 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
alecuchadadavis, you mean Play and PlayPause?19:18
alecuI think Play always plays, but PlayPause is like a toggle.19:19
alecuchadadavis, 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 spec19:19
alecuand 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:20
alecuit's http://xmms2.org/wiki/MPRIS19:21
alecuand 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/19:22
=== tubadaz_away is now known as tubadaz
alecuso you'll probably need some similar docs for the service you are trying to use19:23
alecuor just use an explorer like d-feet to experiment with the interface you want.19:23
alecuSo, 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
alecuI've mostly used python for this, but I understand that other bindings are similar.19:24
alecuHere's a few examples I've made, so we can go over:19:25
alecubzr branch lp:~alecu/+junk/dbus-lessons19:25
ClassBotcrazedpsyc asked: if credentials are transported through DBus, can't I, or anyone else see them by using something like dbus-monitor?19:26
alecucrazedpsyc, there is one instance of DBus running for the system, and an instance per user that's logged in.19:27
alecucrazedpsyc, DBus connections are always local, and are either in the context of your computer or your session.19:28
alecucrazedpsyc, there are security rules on the system DBus, so apps are limited on what they can listen to.19:28
alecucrazedpsyc, 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:29
alecucrazedpsyc, 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
alecucrazedpsyc, makes sense?19:30
alecucrazedpsyc, we can discuss this on much detail later, since app sandboxing is an issue I find very interesting to work on.19:31
alecuanyway, let's go back to the samples19:32
aleculet's look at the first one: 01-call_method.py19:32
alecuDBus usually has to work together with the main loop of your application19:34
alecuusually it's the gtk or kde main loop, and DBus supports it.19:34
alecuBut you can also use the twisted reactor as a main loop, and we'll be able to integrate that as well.19:34
alecuin this example I'm using the gobject main loop, as used by gtk.19:35
alecuthis line joins dbus with the loop: "DBusGMainLoop(set_as_default=True)"19:35
alecuand 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
alecuand we get an "Interface" from that object.19:36
alecuas you can see, it all matches what we are able to see on d-feet.19:36
alecuonce we get an Interface, we can call on the Methods on it, and access its Properties19:37
alecuin this example I'm just changing the brightness of my laptop display, and depending on your hardware it might not work.19:38
alecuSo I'll ask you all for homework to modify it so it changes the volume of the music player.19:38
ClassBotpsusi 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:39
alecupsusi, 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:41
alecuOk, let's look a bit further into arguments for the Methods19:42
=== crazedpsyc is now known as crazedpsyc_away
alecusince DBus is language agnostic, it defines a way to specify the types of the arguments and return values of DBus Methods19:43
alecueach language binding will try to match it to native types. For instance the python binding will usually transform DBus byte arrays into python strings19:44
alecu(python 2 strings, that is :-) )19:44
alecuso Dbus has a way of specifying a small string that will act as the signature for the types in a DBus method call19:45
=== crazedpsyc_away is now known as crazedpsyc
alecufor instance let's browse with d-feet the org.mpris.MediaPlayer2.Playlists interface19:47
alecuthe GetPlaylists method has a very complicated signature19:47
alecuUint32 index, Uint32 maxcount, String order, Boolean reverse_order19:47
alecuin dbus you'll usually see this as "uusb"19:48
alecuand the return value for that method is array of [struct of (object path, string, string)]19:49
alecuyou'll see it defined as "a(oss)"19:49
alecufor a complete reference of this, and much more, try this tutorial: http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#data-types19:50
alecuwe'll need to define strings similar to this when we export our own objects on DBus as services19:50
alecuso let's look at example 03-export_object.py19:51
ClassBotThere are 10 minutes remaining in the current session.19:51
alecuin this example I'm exporting a DBus object on a given "Bus Name" and with a given "Object Path"19:52
alecuand when I run the example, I can use d-feet to call the example_method. Go ahead, try it.19:52
alecuIn addition to the Method, I'm also exporting a "Signal"19:53
alecuSignals work backwards19:53
alecuUsually a dbus client calls a method.19:54
alecuBut the clients subscribe to signals, and the dbus service calls them.19:54
alecuWe can see how to subscribe to a signal in example 219:54
alecuin 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:55
ClassBotThere are 5 minutes remaining in the current session.19:56
alecuin this example I also use the BackLight, but as homework as well you may change listen to media player signals as well.19:56
alecuok, this was a brief overview of how to use DBus in your code.19:57
alecuI hope you follow the examples and start using DBus to take control of all the apps in your desktop.19:57
alecuLet's do a bit of Q/A if we have a bit more time.19:58
alecuAnd don't hesitate to ask me more questions by mail if you have any problems when working with DBus.19:58
=== gerhardsiegesmun is now known as Jerriman
alecuand please let me know what you ended up doing with DBus! :-)20:00
ClassBotchadadavis 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?20:01
=== 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
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session.20:01
JoseExpositoHello everyone!20:02
JoseExpositoThank you very much for joining in this session20:02
JoseExpositoI'm José Expósito and I'm the developer of Touchégg (https://code.google.com/p/touchegg/)20:03
JoseExpositoI'm an independent developper that tries to add more multitouch capabilities to Ubuntu/Linux desktops20:03
JoseExpositoand I'll try to explain what is Touchégg, how it works20:03
JoseExpositohow you can add multitouch support to your computer20:04
JoseExpositoand what technologies it uses.20:04
JoseExpositoAnd of course I will leave at the final of the session a bit of time for questions.20:05
JoseExpositoOk, there we go :)20:05
JoseExposito 20:05
JoseExposito[+] Introduction to Touchégg: what is it and features20:05
JoseExposito 20:05
JoseExpositoIf you have a touch screen or a trackpad with multitouch capabilities20:06
JoseExpositoprobably you know the options that this devices offers in others platforms20:06
JoseExpositolike MacOS or Windows20:06
JoseExpositobut we are Ubuntu/Linux users, we can't use this devices?20:07
JoseExpositoYes, we can use the maximum capabilities of this kind of devices with Touchégg20:07
JoseExpositoand of course thanks to the work of the uTouch guys.20:07
JoseExpositoSo, what is Touchégg?20:07
JoseExpositoTouchégg is a program that offer just that20:08
JoseExpositothe option to squeeze your trackpad or your touch screen capabilities.20:08
JoseExpositoYou can think in your touch screen or trackpad like20:09
JoseExpositoa device that allows you to make a number of predefined gestures20:09
JoseExpositofor example drag two fingers, pinch with five fingers or tap with four finger.20:09
JoseExpositoNormally, making this gestures, one expects to see that the computer reacts to them and takes some action20:10
JoseExpositofor example, if you drag two fingers over a PDF,20:10
JoseExpositoyou expect that the text begin to scroll or if you pinch three fingers over a window,20:11
JoseExpositoyou expect that the windows become to resize.20:12
JoseExpositoTouchégg makes exactly this, is responsible of recognize this multitouch gestures20:13
JoseExpositoand make a configurable action.20:13
JoseExpositoIn adition, Touchégg has a GUI (graphical user interface)20:14
JoseExpositothat allow you to configure this gestures and action in a very simple way20:14
JoseExpositoyou can see here an screenshot:20:15
JoseExpositoOk, but what gestures it support?20:16
JoseExpositoThese gestures can be divided in four big families:20:21
JoseExpositoTap: A tap gesture is, at this name suggests, a “click” over your trackpad with one to five fingers.20:21
JoseExpositoDrag: Again the name is self-descriptive20:21
JoseExpositoto make this gesture you only need to move two20:22
JoseExpositoto five fingers over your trackpad.20:22
JoseExpositoIn addition this gesture allow to define directions,20:22
JoseExpositoie drag three fingers up, for example to maximize a window20:22
JoseExpositoor drag three fingers down, for example to minimize a window.20:22
JoseExpositoPinch: Pinch is... a pinch!20:22
JoseExpositoYou just only have to imagine the tipical gesture20:23
JoseExpositothat you can make in you smartphone to zoom the window...20:23
JoseExpositoIf you have one, my phone still have keys ;)20:23
JoseExpositoIn the future this gesture will allow directions (in and out)20:23
JoseExpositolike the drag gesture20:23
JoseExpositofor example to integrate Touchégg with your favorite photo viewer20:24
JoseExpositoto zoom in or zoom out your photos.20:24
JoseExpositoTap&hold: This is a composite gesture with a tap and a drag20:24
JoseExpositoI think that everyone has used it for example to select text20:24
JoseExpositobut of course Touchégg allows to personalize this gesture with any action and use it with up to five fingers.20:24
JoseExpositoIn the future, I hope that when Natty will be ready, Touchégg will support more gestures, such as “Rotate” or “Double Tap”.20:25
JoseExpositoAnd what about the actions?20:25
JoseExpositoTouchégg allow you to make 14 differents actions20:25
JoseExpositothat you can be associe to the gestures20:25
JoseExpositoThis is the full list:20:26
JoseExpositoMOUSE_CLICK – This action allows you to emulate the mouse20:26
JoseExpositoTipically are assigned to a one, two and three fingers tap to make left, right and middle mouse click respectively20:26
JoseExpositobut of course you can assign this action to any gesture20:27
JoseExpositoVERTICAL_SCROLL and HORIZONTAL_SCROLL – As the name suggest20:27
JoseExpositothese actions allows you to make a scroll, like with your mouse wheel. Tipically asigned to the two fingers drag gesture20:27
JoseExpositoMINIMIZE_WINDOW – To minimize the window under cursor.20:28
JoseExpositoMAXIMIZE_RESTORE_WINDOW – To maximize the window under the cursor or, if is already maximized, to restore it.20:28
JoseExpositoCLOSE_WINDOW – To close the window under the cursor.20:28
JoseExpositoMOVE_WINDOW – Allows you to move a window across the screen.20:29
JoseExpositoRESIZE_WINDOW – To change the size of the window under the cursor, should be used with a pinch gesture.20:29
JoseExpositoSHOW_DESKTOP – In the first execution shows the desktop, in the second execution restores all windows.20:29
JoseExpositoCHANGE_DESKTOP and CHANGE_VIEWPORT – These actions allows you to change between virtual desktops20:30
JoseExpositothe difference is that some window managers, like Compiz uses by default “viewports” and other like KWin uses “virtual desktops”20:30
JoseExpositoSEND_KEYS – Probably one of the most versatile actions20:30
JoseExpositoallows you to assign a shortcut to a gesture for example to use Compiz effects or any specifies application shortcut.20:31
JoseExpositoRUN_COMMAND – Another of the most versatile actions20:31
JoseExpositoThis 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:31
JoseExpositoDRAG_AND_DROP – Allows you to emulate the classical one finger tap hold gesture20:32
JoseExpositofor example to select text but also with the mouse right or middle button.20:32
JoseExpositoWith this combination of gestures and actions20:33
JoseExpositoyou can get all the capabilities of your trackpad20:33
JoseExpositowith the more classical and basic gestures20:33
JoseExpositolike make a right buttons click tapping with two fingers20:33
JoseExpositoor other more advanced like resize a window pinching with three fingers,20:33
JoseExpositouse the “Exposse” Compiz effect dragging four fingers up20:34
JoseExpositomove a windows making a tap&hold gesture with two fingers20:34
JoseExpositoor zooming your photos making a double tap with five fingers...20:34
JoseExpositoAnd make this is very easy, you only need to select the gesture and their associated action in the Touchégg-GUI.20:35
JoseExpositoI recomend you to try Touchégg, especially in Natty20:35
JoseExpositowhere the uTouch team guys have done an excellent job with the multitouch support20:35
JoseExpositobut if you are fearful, you can see Touchégg in action in this video:20:35
JoseExpositoCommon, go to see the video!20:36
JoseExpositoOk, and this is all?20:37
JoseExpositoNo :P20:37
JoseExpositoIn my humble opinion, the multitouch interface is the future20:37
JoseExpositobut for the moment not all applications have support for this gestures20:38
JoseExpositoThis suppose a problem, imagine that you want to zoom your photos making a two fingers pinch gesture20:38
JoseExpositobut in adition you want to zoom a web page making also a two fingers pinch20:38
JoseExpositoWell, in this moment probably you think20:39
JoseExpositono problem, I can go to the Touchégg-GUI and assign the shorcut to this gesture20:39
JoseExpositoOMG, the shorcut is different in your photo viewer and in your web explorer!20:39
JoseExpositoFor this reason Touchégg incorporates a new feature in the next version20:40
JoseExpositoa new option that allow you to assing diferent actions for different applications20:40
JoseExpositoThus now you can assing a different shortcut to the two fingers pinch gesture20:40
JoseExpositoin your photo viewer and in your web browser20:41
JoseExpositoWith this new option, Touchégg lets you to add a multitouch layer easyly in your desktop.20:41
JoseExpositoAnd basically this is Touchégg and these are their options20:41
JoseExpositoIn conclusion, the main idea is that you have global gestures20:41
JoseExpositoapplication specific gestures20:41
JoseExposito and actions that should be executed with these gestures20:42
JoseExpositoand Touchégg brings you the option to manage all with a simple and intuitive graphical user interface.20:42
JoseExposito 20:42
JoseExposito[+] Technologies used to develop Touchégg: uTouch-GEIS and Qt20:42
JoseExposito 20:42
JoseExpositoFor now we have talked about what is Touchégg and what it makes but no about how it makes that20:42
JoseExpositoThis part is more technical that the previous part and probably will be more interesting for developers20:43
JoseExpositoanyway I'll try to make it easy to understand and funny as possible for the non-developers attendees20:43
JoseExpositoTouchégg is developed in C++ and it uses two mainly tecnologies: Qt and uTouch-GEIS.20:43
JoseExpositoFirst I'm going to talk briefly about Qt20:43
JoseExpositobecouse I think that is a very popular workspace and many people will know it20:44
JoseExpositoMany people thinks that Qt is only a framework to build graphical interfaces20:44
JoseExpositoand of course, Touchégg-GUI uses Qt to make one, but Qt is more than this20:44
JoseExpositoQt have many classes that facilitates programming, like work with XML, threads, sockets, dbus, etc, etc20:45
JoseExpositoAnd the better is that is multiplatform and binaries generated using this technology are small and fast!20:46
JoseExpositoTalk 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
JoseExpositoIn Ubuntu 10.10 Canonical made an important contribution to the open source comunity with uTouch20:47
JoseExpositoa complete framework composed by many differents tools to bringing Linux multitouch support.20:47
JoseExpositoTouchégg uses uTouch-GEIS, that is an API that makes very easy to developers get the produced gestures in the multitouch devices.20:48
JoseExpositoNow in Ubuntu 11.04 Natty, the new multitouch support is awesome20:48
JoseExpositothe uTouch-team has done an excellent job. I can't talk about the technical part of uTouch-GEIS20:48
JoseExpositoanyway you can see an excellent explanation about it here:20:48
JoseExpositoFor developers uTouch-GEIS bring two differents interfaces, one simplified and other more complex20:49
JoseExpositoFor the objetives of Touchégg, the simpified interface is more than sufficient, you can see a little example code here:20:49
JoseExpositoAnd ofcourse the Touchégg source code:20:49
JoseExpositoI think that for a C or C++ developer beging to use uTouch is really easy and in adition the documentation is excellent:20:51
ClassBotThere are 10 minutes remaining in the current session.20:51
JoseExpositoAnd well, this is all, you can make now questions20:52
JoseExpositoand remember that you can contact with me to make more questions, report a bug or request new features for Touchégg here:20:52
ClassBotThere are 5 minutes remaining in the current session.20:56
ClassBotalecu asked: what API are you using to get the multi touch events?20:58
ClassBotalecu asked: I'm developing a game that will use multitouch directly, so will it be possible to disable TouchEgg events for one specific window?20:59
=== 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
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session.21:01
kamstrupHi all!21:02
kamstrupSo I guess I am up now21:02
kamstrupMy name is Mikkel Kamstrup Erlandsen and i work for Canonical on the DX team21:02
kamstrupIn my spare time I also dabble with software, namely Zeitgeist and search engines21:02
kamstrupOn the DX team I am working on all the backend and infrastructure stuff21:03
kamstrupso not so much all the fancy graphics you see in Unity21:03
kamstrupbut all that goes on beneath it :-)21:03
kamstrupIn particular relevant for this session libunity21:03
kamstruplibunity is a library with the purpose of instrumenting and integrating with Unity21:04
kamstrupFor the Natty cycle you'll be able to integrate with the Launcher and the Places/Lenses21:04
kamstrup(btw for this session I'll call it Places - but in the Oneriric cycle we'll officially change to Lenses)21:05
kamstrup(it's just that "places" is in my muscle memory right now :-))21:05
kamstrupOne big caveat emptor before we proceed too far21:05
kamstruplibunity does not currently have API or ABI stability guarantees21:06
kamstrupwe will work on that - promised - but we also want to ensure that the API is really really nice before we freeze it21:06
kamstrupand in fact21:06
kamstrupI can already guarantee that there will be slight changes when we begin the Oneiric cycle21:06
kamstrupbut that said21:07
kamstrupYou can already take libunity for a spin and do some pretty impressive stuff with it21:07
kamstrupfx. both the Apps and Files places are implemented with libunity21:07
kamstrupthere's no "priviledged" Unity API for those two buggers21:07
kamstrupanyone here will be able to do exactly what they do21:08
kamstrupBefore we start talking about the places let's talk about the Launcher integration21:08
kamstrupThe Launcher integration is a lot simpler than the places21:08
kamstrupSo enough with the intro talk21:09
kamstrupThe Unity Launcher21:09
kamstrupThe simplest way you can integrate with the launcher is via what is called "static quicklists"21:09
kamstrupIf you follow that link you'll see a snippet from a normal .desktop file21:10
kamstrupIf you take a normal .desktop file and add [Foo Shortcut Group] entries to it like shown21:10
kamstrupyou can add quicklist right there21:10
kamstrupLook at your own /usr/share/applications/evolution.desktop for a live example21:11
kamstrupWhat static quicklist elements can basically do is launch an executable21:12
kamstrupso very simple21:12
kamstrupno programming required21:12
kamstrupIf you want to get a bit more power21:12
kamstrupyou need to use libunity21:12
kamstrupMore specifically the LauncherEntry API21:13
kamstrupFor the sake of the examples we'll use Python examples today, but you can also code in Vala, C21:13
kamstrup(or C++ if you manually write the C calls out)21:13
kamstrupYou'll see the API here http://developer.ubuntu.com/api/ubuntu-11.04/GIR/python/Unity-3.0.html#Unity.LauncherEntry21:14
kamstrupit 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
kamstrupLooking at the LauncherEntry docs you'll see that it only has static constructors - not conventional constructors21:15
kamstrupthat's because you always get a "singleton" back for the particular app21:15
kamstrupLet me find an example21:15
kamstrupHere http://bazaar.launchpad.net/~unity-team/libunity/trunk/view/head:/examples/launcher.py21:16
kamstrupYou can set 3 main properties on the launcher entry21:16
kamstrupA "count" that will be displayed as a number on the top part of the tile21:16
kamstrupyou may have seen this on apps like Evolution displaying the number of unread mails this way21:17
kamstrupThen you can add a progress bar21:17
kamstrupthe values for progress must be between 0 and 121:17
kamstrup(and it's a float)21:17
kamstrupYou can also set the urgency hint21:17
kamstrupSome may know that an "urgency hint" is something you normally have on X11 windows21:18
kamstrupit makes the WM flash the window icon21:18
kamstrupthe difference here is that the libunity urgency doesn't require a window on the screen in order to mark an app as requiring attention21:18
kamstrupthis 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 somewhere21:19
kamstrupThe last part of the LauncherEntry API is that you can set a "dynamic quicklist"21:20
kamstrupThe dynamic quicklists differ from the static ones in that you can build and update them programmatically at runtime21:20
kamstrupYou simply have access to a libdbusmenu DbusmenuMenuItem instance that you can populate how you like21:21
kamstrupany questions on the laucnher api before we move on?21:21
kamstrupso now to Places21:22
kamstrupAs said before the situation here is slightly regretable21:22
kamstrupIt's known both as Lenses and Places in Natty21:22
kamstrupFor Oneiric we'll change to Lenses only21:23
kamstrup(also in the all the public APIs)21:23
kamstrupbut for now let me call them Places21:23
kamstrupPlaces run outside the core Unity process21:23
kamstrupThink of them very much like remote database that provides data for Unity to render21:24
kamstrupif you've worked with modern web development frameworks or MVC in UIs think that the place provides the *model* and Unity is a generic View21:24
kamstrupOf course we have the standard Apps and Files places21:25
kamstrupthey are not very good beginner examples unfortunately21:25
kamstrupbut there are a few simple examples to start from that lots of ppl have found instructive21:25
kamstrupIf we stick to the Python example again21:25
kamstrupyou can check it out from lp:~unity-team/unity-place-sample/unity-place-python21:26
kamstrupor for now just browse it online at http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/files21:26
kamstrupFirst look at python.place21:27
kamstrupAll places register themselves to unity via a .place file21:27
kamstrupinstalled under /usr/share/unity/places21:27
kamstrupin a .place file you specify some contact info for Unity to find you on dbus21:27
kamstrupThen each place has one or more PlaceEntries21:28
kamstrupA placeentry is prettymuch what maps to an icon in the launcher21:28
kamstrupYou'll probably have the Apps and Files entries in your launcher at the bottom21:28
kamstrupFor each entry you want to expose from your place's process you need a [Entry:Foo] line in the .place file21:29
kamstrupThe only place that actually has more than one place entry is the Apps place21:29
kamstrupalthough the second one is hidden21:30
kamstrupTry looking at /usr/share/unity/places/applications.place21:30
kamstrupyou'll see that [Entry:Runner] has ShowEntry=false and ShowGlobal=false21:30
kamstrupFirst ShowEntry=false tells unity to not put a tile in the launcher bar for this place entry21:31
kamstrupthe ShowGlobal=false clause tells Unity to not include this entry's results when searching from the Dash21:31
kamstrupaka home screen21:31
kamstrup(the one you get when you hit <super>)21:31
kamstrupThere is in fact a spec for these .place files21:32
kamstrupCheck https://wiki.ubuntu.com/Unity/Lenses#Registration21:32
kamstrupYou'll also note that you can define a keyboard shortcut for you place21:32
kamstrupAnd now we're talking about this21:33
kamstrupA general best-practice is to *not* include your search results in the Dash21:33
kamstrupthat is please set ShowGlobal=false21:33
kamstrupWhen I write my code I am as excited as anyone to get people using it21:34
kamstrupbut people really want a fast Dash21:34
kamstrupand if we have Dash searches laucnhing off 3 http requests, 5 disk searches, and whatnot for each letter typed...21:34
kamstrupso if you want to integrate with the Dash results make sure your results are:21:34
kamstrup1) almost always relevant21:35
kamstrup2) Super snappy21:35
kamstrup3) Doesn't use to many resources to compute21:35
kamstrupand 1) is probably the key point21:35
kamstrupSo most places would just have their tile in the launcher and a keyboard shortcut21:35
kamstrupOk back to the code21:36
kamstrupIn the .place file you specify the dbus contact details for your place daemon21:36
kamstrupthis means that Unity will start your daemon via dbus activation21:36
kamstrupno need to start it yourself on login or anything21:37
kamstrupthis way unity has a chance of not starting all daemons at once when you log in21:37
kamstrupwhich would run the risk of hogging your disk21:37
kamstrupnow look at http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/view/head:/unity-place-python.py21:38
kamstrupThis is the code for the sample place daemon21:38
kamstrupThere are 3 concepts you need to know about when writing a place dameon21:38
kamstrupthat is 1) results 2) groups 3) sections21:38
kamstrupeach of these three have a Dee.Model associated with them21:39
kamstrupDee.Model is implement by a library called libdee which we use for almost all of the data sharing behind Unity21:39
kamstrupDee.Model is like a table that is shared between multiple processes21:39
kamstrupif any one changes, adds, or removes from the model all the other processes watching that model will be notified of what's changed21:40
kamstruppretty powerful stuff21:40
kamstrupthis allows us to do a kind of "distributed MVC"21:40
kamstrupso 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 changes21:41
kamstrupSo obviously the results_model contains all the search results21:41
kamstrupthen we have a sections_model21:41
kamstrupthe sections partition the results into disjoint logical components21:42
kamstrupA sections should represent a "browsable" subset of the result space21:42
kamstrupIf you consider the space of all apps then the sections could be Video, Audio, Games, Office21:42
kamstrupThe sections contribute the elements of the dropdown embedded in the search bar21:43
kamstrupyou can also access the sections of a place via the right-click context menu on a place entry in the laucncher21:43
kamstrupthen there a groups21:43
kamstrupthe groups partition the visible result set into meaning subgroups21:44
kamstrupIf you are watching all hits from a file search the groups could be Today, Yesterdat, Last Week, Last Month, ... etc21:44
kamstrupthe groups_model and results_model both have a _global_ counterparts21:45
kamstrupthe global models are the ones used for searching from the dash21:46
kamstrup(so you normally don't need those)21:46
kamstrupthe API docs for Dee.Model are here http://developer.ubuntu.com/api/ubuntu-11.04/GIR/python/Dee-0.5.html#Dee.Model21:46
kamstrupThe API docs for Dee are not fully true though21:46
kamstrupit has been augmented with some Python sweetness21:47
kamstrupThere 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.py21:48
kamstrupYou can also find the docs for what exactly the columns are in all the different models on https://wiki.ubuntu.com/Unity/Lenses#Results%20Model21:49
kamstrupOne last thing I want to mention is "Activation"21:49
kamstrupSo places require special callbacks when activating some special results21:50
kamstrupthe apps place returns Apps Available for Download that open in the Software Center when you click the,m21:50
kamstrupthis is achieved via the Activation API21:50
kamstrupyou basically register a handler for a regex matching URIs or mimetypes21:51
ClassBotThere are 10 minutes remaining in the current session.21:51
kamstrupthen when unity tries to laucnh a it it looks for any places registered for launchoing that hit21:51
kamstrupand does a Dbus callback to the place daemon giving it the URI to activate21:51
kamstrupthe place daemon then responds whether Unity should hide the Dash as a response or if the Dash should still be shown21:52
kamstrupin case for Apps Availabale for Download we ask Unity to hide the dash21:52
kamstrup(so we can load S-C)21:52
kamstrupbut if we fx. wanted to implemen21:53
kamstrupa file browser fx21:53
kamstrupthen 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 directory21:53
kamstrupI guess I'll leave the rest for your own exploration21:54
kamstrupSo if anyone has questions don't hold back21:54
kamstrupif that's not the case then let me take 2 minutes to talk about "renderers"21:55
kamstrupif you browse https://wiki.ubuntu.com/Unity/Lenses#Renderers21:56
kamstrupyou'll see that we have a concept called renderers which you can specify in various places in the API21:56
ClassBotThere are 5 minutes remaining in the current session.21:56
ClassBottronda asked: How much focus is the Python based API getting?21:57
kamstrupAlmost as much as the C/Vala API21:57
kamstrupwe really want it to be a 1st class experience21:58
kamstrupand honestly i almost think that the Python API is better than the Vala/C api right now :-O)21:58
ClassBottronda asked: Any plans to get browser to work with the libunity for web applications?21:58
kamstrupnot short term21:59
kamstrupthere are some far out plans, but nothing to hold your breath for :-)21:59
ClassBottronda 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?21:59
kamstrupBecause the place daemon is another process than Unity it's not super critical if web services are slow22:00
kamstrupso I'd say "don't worry in most cases"22:00
ClassBotalecu 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
kamstrupyes, yes it will22:01
=== 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
kamstrupi believe that you can simply insert a URL as icon and Unity will try and load it22:01
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html following the conclusion of the session.22:01
jelmerI'll be talking to you today about Bazaar, the version control system.22:03
jelmerMy 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
jelmerPlease 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:04
jelmerBazaar 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:05
jelmerLike 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:06
jelmerEvery 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
jelmerTo 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:07
jelmerBazaar 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
jelmerThis creates a series of revisions, named a branch.22:08
jelmerLet's try this with a simple hello world program:22:08
jelmer$ mkdir hello22:08
jelmer$ cd hello22:08
jelmer$ bzr init22:08
jelmerBazaar should now tell you that it's created a branch and what file format it used.22:09
jelmerAfter you've done this you should see a .bzr/ meta directory if you run "ls -a".22:09
jelmerNow, 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
jelmer$ bzr add hello.sh22:10
jelmerYou can now use "bzr commit" to store this as your first revision.22:11
jelmerare there any questions so far ? Am going too fast, should I skip the basics?22:11
jelmerSorry, s/Am/Am I/22:12
jelmer$ bzr commit22:13
jelmerThis 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
jelmerTo 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:13
jelmerIf you change your file again you can run "bzr commit" to store your new changes.22:15
jelmer"bzr log" should show you two revisions at this point.22:15
jelmerTo 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:15
jelmerBazaar allows you to push over the HTTP, SSH, SFTP and FTP transports as well as to local paths.22:16
jelmer"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
jelmerBazaar 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
jelmerLaunchpad 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:19
jelmerLet'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:20
jelmerWhere 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
jelmerThis 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:21
jelmerQUESTION: 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?22:22
=== binfalse_ is now known as binfalse
jelmerThere 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
jelmerFor more information on the possible workflows, see this wiki page: http://wiki.bazaar.canonical.com/Workflows22:24
jelmerWhat works best for you depends on the goals of your project, the number of developers, etc.22:25
jelmerFor 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
jelmerQUESTION: what does the --use-existing mean? when you bzr push --use-existing lp:~YOURNAME/=junk22:26
jelmer--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 Launchpad22:27
jelmerTo 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:29
jelmerThere 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:30
jelmer"bzr plugins" will print a list of plugins you currently have installed.22:31
jelmerFor a full list of the available plugins, have a look at this page: http://wiki.bazaar.canonical.com/BzrPlugins22:32
jelmerThe most commonly used ones are also packaged separately in Ubuntu.22:32
jelmerYou might in particular be interested in the bzr-gtk or qbzr plugins, which provide a graphical interface on top of Bazaar.22:33
jelmer("bzr-gtk" and "qbzr" are also the names of their respective packages in Ubuntu)22:34
jelmerE.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:35
jelmerAs 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
jelmerFor 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:38
jelmerLaunchpad 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:39
jelmerOne 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:40
jelmerLaunchpad 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:41
jelmerThe recipes are built at most once a day, when one of the branches in the recipe changes.22:42
jelmerThe resulting packages end up in a PPA.22:42
jelmerLet's have a look at a recipe for the pydoctor tool - https://code.launchpad.net/~jelmer/+recipe/pydoctor-daily22:42
jelmerAt the bottom of the page you can see that this recipe combines two branches:22:43
jelmerlp:pydoctor, which contains the upstream source code and  lp:~jelmer/pydoctor/unstable which contains packaging metadata.22:43
jelmerThis 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:44
jelmerPackaging 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
jelmerSpeaking 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
jelmerIs there anything else you would like me to cover?22:46
jelmerIf you're already using Bazaar, is there anything that you find problematic? Perhaps I can give hints to improve your workflow.22:47
jelmerQUESTION: how would i "bzr push" behind a proxy/firewall?22:48
jelmerThat'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:50
ClassBotThere are 10 minutes remaining in the current session.22:51
jelmerLooking at the docs quickly I can't find any details on using SSH over a proxy.22:51
jelmerYou should be able to use corkscrew, see http://www.omappedia.org/wiki/Using_bzr_and_launchpad_behind_a_proxy for details.22:52
jelmerAre there any other questions?22:53
jelmerQUESTION: 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:56
jelmerYou 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:57
ClassBotThere are 5 minutes remaining in the current session.22:58
jelmerOnly one minute remaining.. thanks for attending. If you have any further questions, don't hesitate to ask in #bzr23:00
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/04/13/%23ubuntu-classroom.html23:01
=== 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 ||

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!