/srv/irclogs.ubuntu.com/2010/09/29/#ubuntu-classroom.txt

=== uchobby_afk is now known as uchobby
=== tenach_ is now known as tenach
sKuarecircle_Hello12:40
serfussKuarecircle_, hey there, what are you looking for?12:42
=== harry is now known as Guest1771
=== Mohan_chml is now known as IAmNotThatGuy
=== ApOgEE__ is now known as ApOgEE
=== IAmNotThatGuy is now known as Mohan_chml
=== MAfifi is now known as MSK61
=== alecu_ is now known as alecu
=== 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: Manage your source code history! - Version Control with Bazaar - Instructors: MSK61
MSK61Welcome, everybody.15:01
MSK61May I know who's there by saying hi?15:02
MSK61OK. Seems good. Let's tatart.15:02
MSK61Start*.15:02
MSK61Today's session is about source control(aka other names like revision control, version control, ...etc).15:03
MSK61So what's source control? It's the ability to keep the history of how a software project evolved through different stages.15:03
MSK61It maintains information about who contributed to each feature, when different releases were available, ...etc.15:04
MSK61As if someone were able to take snapshots for a software project across different instants of time.15:04
MSK61Historically, there were two models for version control: centralized and distributed.15:05
MSK61Centralized version control works in a client-server fashion, with the server having all the meta-data for the project, while different contributors check out a working tree for the trunk(or a specific version).15:06
MSK61And every time someone wants to commit, he/she must be connected to the server.15:06
MSK61Distributed, on the other hand, worked on peer-to-peer like fashion.15:07
MSK61Each contributor had the full source tree(with all revisions and history), and any contributor can pull from/push to other contributors.15:07
MSK61Clear so far?15:07
MSK61So which model does bzr follow?15:08
MSK61Fine, it follows the latter model, distributed.15:08
MSK61And this has the benenfit that you don't have to be connected to a server to commit; you can just commit as many versions as you can offline, and then push to another repository when you get connected.15:09
MSK61OK. To start, we first need to install bzr.15:09
MSK61In a terminal, type "yum install bzr".15:10
MSK61Should be pretty fast.15:10
MSK61We'll base our example on plain-text files, but of course it should work with any type of files.15:12
MSK61Now create a directory called "myProj" for example.15:12
MSK61mkdir myProj.15:12
MSK61Now, cd myProj.15:13
MSK61mkdir trunk.15:14
MSK61To crearte a trunk branch(; it may be called anythin).15:14
MSK61Now, in the terminal type echo "Thi's the first line" > hello.txt15:15
ClassBotmaheshmohan asked: What is a trunk?15:15
MSK61A trunk is conventionally the branch which holds the development(read most recent) snapshot of the software project.15:16
MSK61You can give it any name, but trunk is a famous convention.15:16
MSK61Other SCM(source control management) tools might call it tip, or so,.15:17
MSK61Now inside trunk when you list the files you should see hello.txt15:17
MSK61OK for all?15:18
MSK61So everyone is now inside trunk the trunk folder and sees hello.txt file?15:19
MSK61OK. Now we've created a source file(hello.txt in our case).15:20
MSK61ls -AR should produce something like this http://paste.ubuntu.com/502649/15:21
MSK61Now issue the command bzr stat15:21
MSK61Get out of the trunk folder.15:23
MSK61Remove it with "rm -r trunk".15:23
MSK61OK?15:24
MSK61Now, being inside myProj, issue the command "bzr init-repo ."15:24
MSK61This's needed to tell bzr to create a repository(a place where it'll maintain a project history in).15:25
MSK61ls -AR should yield http://paste.ubuntu.com/502652/15:25
MSK61OK?15:26
MSK61I'll illustrate what the steps we did so far were for.15:32
MSK61From scratch:15:33
MSK61mkdir myProj => Create a directory for the bzr repository.15:33
MSK61cd myProj => Enter the directory.15:33
MSK61bzr init-repo . => Tell bzr to initialize the repository with metadata.15:34
MSK61Clear so far?15:34
MSK61Anyone missing should be OK by executing these steps from scratch.15:34
MSK61Now, issue15:34
MSK61mkdir trunk => conventional trunk(development) branch15:35
MSK61A repository can hold several branches, for example branches for different releases, different platforms, ...etc.15:35
MSK61But a repository should contain at least one branch(trunk in our case).15:36
MSK61cd trunk => Enter the branch directory.15:36
MSK61bzr init => Initialize the branch metadata.15:36
MSK61You notice now that two different commands for metada are used, one previously for the repository, and one for each branch you create(just trunk in our case).15:37
MSK61And for the branch, if you're inside the branch directory, you don't have to specify the location(like we did with . in the repo).15:37
MSK61Now, create a source file.15:38
MSK61echo "This's the first line." >> hello.txt15:38
MSK61This command created a source file called hello.txt.15:38
MSK61OK?15:38
MSK61Now issue the long awaited command15:39
MSK61bzr stat => Show the status of changed files in the branch.15:39
MSK61You should get this http://paste.ubuntu.com/502661/15:40
MSK61This means that bzr has found a strange file(a file that hasn't been added to the source control).15:41
MSK61Now to add it, issue15:41
MSK61bzr add => Add all unknown(new, strange) files to the source control.15:42
MSK61bzr stat => This time it'll show http://paste.ubuntu.com/502663/15:42
MSK61Which means bzr shows that the file has been added.15:43
MSK61However, all these changes have been made into the working tree.15:43
MSK61Everybody is aware of the working tree concept?15:44
MSK61OK. A working tree is the copy of the source files you're locally using on your computer.15:45
MSK61When you change anything there, it doesn't mean it'll be retained by bzr history management.15:45
MSK61Until you tell bzr to do.15:45
MSK61Clear?15:45
MSK61Now we want to tell bzr to add it as a history point in the history log.15:46
MSK61Issue the command:15:47
MSK61bzr commit => Add the changes as a revision in the history.15:47
MSK61You'll be introuduced by an editor to write a description message for what's been done in this revision.15:48
MSK61Type in any message, like "first release"(without the quotes), and save and close.15:48
MSK61Before, at the very first line.15:50
ClassBotrooligan_ asked: before or after the "--------" line?15:50
MSK61Before, at the very first line.15:50
MSK61Now issue the command15:50
MSK61bzr log => Brwose the history of our project.15:50
MSK61http://paste.ubuntu.com/502666/15:51
MSK61Everyone got that?15:51
MSK61The committer would be different in your case of course.15:52
MSK61Congratulations, you've just created your first release.15:52
MSK61Fine, you don't have to check out because you already have all the history locally.15:53
MSK61If you want to make changes, just make changes and commit again.15:53
MSK61A new release, with a new description message.15:53
MSK61OK. I had many other things to talk about, but there isn't really much time left.15:54
MSK61So I just skim on them.15:54
MSK61For pushes, you can push to a remoate or local branch with bzr push command.15:54
ClassBotmaheshmohan asked: How can I make my code to colloborate with other developers?15:54
MSK61Basically, bzr push and bzr pull.15:55
MSK61bzr push to publish your changes to another branch, bzr pull to get the recent changes from another branch to your local one.15:55
MSK61Remember that you can always commit locally(as many times as you want), and then push later.15:56
MSK61Now to get help about available commands, just type bzr help.15:57
MSK61bzr help commands.15:57
MSK61The online documentation is also very useful and detailed.15:58
MSK61Other useful, widely used commands, are ls, info, remove, ignore, push, pull, annotate.15: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: Integrate Ubuntu One in your applications - Instructors: rodrigo
=== MSK61 is now known as MAfifi
rodrigo_ah, hello!16:04
rodrigo_shall I start?16:04
Pendulumrodrigo_: it's all yours!16:04
rodrigo_ok, so hi everyone16:04
rodrigo_my name is Rodrigo Moya, and I work for the online services team at Canonical16:05
rodrigo_working on GNOME integration of U116:05
rodrigo_I guess you all know what Ubuntu One is, but just in case, I'll do a small introduction16:05
rodrigo_U1 is your personal cloud, a place where you can store your files and other data that you can sync between machines16:06
rodrigo_apart from syncing your files, it has integration of syncing of other data, like Tomboy notes, Evolution contacts16:07
rodrigo_as well as syncing from mobile phones16:07
rodrigo_so, my talk is about a new library I wrote during Maverick cycle with 2 goals:16:07
rodrigo_* first, avoid duplication of lots of code in our projects (U1-related)16:08
rodrigo_* and 2nd, but most important, allow 3rd parties to integrate their apps with U116:08
rodrigo_so, a bit of background16:08
rodrigo_U1 has 2 components on the desktop, a daemon that takes care of syncing your files16:08
rodrigo_and a personal CouchDB server to sync notes, contacts, bookmarks, gwibber messages, etc16:09
rodrigo_for the CouchDB part, we already have good APIs, like couchdb-glib, which is a C GObject-based API with introspection (so has bindings automatically for several languages)16:09
rodrigo_and desktopcouch, which is a Python API, about which aquarius has already given talks at other developer weeks16:10
rodrigo_for the file syncing daemon, we already had an API, but it was a DBus API16:10
rodrigo_while it is great to be able to communicate with it via DBus16:10
rodrigo_time has proven that 3rd parties don't want to deal with low level details of a DBus API16:11
rodrigo_also, DBus needs you to take care of asynchronous calls, error reporting, data marshaling, etc16:11
rodrigo_that's the code we were duplicating in our U1-related projects16:11
rodrigo_so, the Nautilus plugin and the music store widget (yeah, I forgot to say U1 also has a music store!) and other parts of the system were using this DBus API16:12
rodrigo_but no 3rd party, till now that I know, has made use of it16:12
rodrigo_so, I started writing a library (libsyncdaemon) which is a layer on top of this DBus API16:12
rodrigo_it hides all the complexity16:13
rodrigo_like async calls, data marshalling, etc16:13
rodrigo_and offers a GObject-based C API, with introspection for automatic generation of bindings for several languages16:13
rodrigo_btw, if there are questions, feel free to interrupt me, ping me on #ubuntu-classroom-chat16:14
rodrigo_so, any question so far?16:14
rodrigo_ok, no questions :)16:14
rodrigo_btw, alecu is giving a talk about DBus later on :)16:15
rodrigo_ok, so this library, given the time constraints I had for maverick, only wraps the low level DBus API, so that's what we'll be looking at16:15
rodrigo_but I already started adding high level stuff to the API, so for Natty, there should be much easier ways of doing what we'll be showing during the talk16:16
rodrigo_so, what does wrapping the DBus API mean?16:17
rodrigo_it means that it provides a similar API than what the DBus thuing offers16:17
rodrigo_but with a few helpers16:17
rodrigo_for instance, you don't have to deal with data marshalling16:17
rodrigo_this is very important, since the DBus API returns a lot of data in dictionaries16:18
rodrigo_to read the data in the dictionaries, you need to understand what each field means, apart from knowing the names of the fields16:18
rodrigo_also, it deals with service lifecycle16:18
rodrigo_it shouldn't happen, but sometimes DBus services die16:18
rodrigo_there is a way in Dbus to detect that, but it's a bit lowlevel16:19
rodrigo_so libsyncdaemon does it for you16:19
rodrigo_so, if the dbus sertvice dies and is restarted, libsyncdaemon will keep working, you won't have to recreate the objects, connect to the signals again, etc16:19
rodrigo_so, this for some background, so if there are no questions, we can go to see actual code16:20
rodrigo_ok, seems no questions16:21
rodrigo_so, let's see some code16:21
rodrigo_I'll show the C code, and I'll try to guess the Python code equivalent to the C code16:22
rodrigo_so, in C:16:22
rodrigo_#include <libsyncdaemon/libsyncdaemon.h>16:22
rodrigo_in Python: from gi.repository import SyncDaemon16:22
rodrigo_btw, to see the actual code: bzr get lp:ubuntuone-client16:23
rodrigo_or if you just want the headers/introspection stuff:16:23
rodrigo_sudo apt-get install gir1.0-syncdaemon-1.0 libsyncdaemon-1.0-dev16:23
rodrigo_so, the main object you want to start with is, in C, SyncdaemonDaemon (yeah, redundant :-)16:24
rodrigo_in Python: SyncDaemon.Daemon()16:24
rodrigo_this is the main class, and has access to all the functionalities16:24
rodrigo_first, it provides some functions of its own, not very interesting:16:25
rodrigo_syncdaemon_daemon_connect (or daemon.connect() in python)16:25
rodrigo_syncdaemon_daemon_disconnect16:25
rodrigo_syncdaemon_daemon_quit16:25
rodrigo_it also deals with the startup problem in u1 syncdaemon itself16:25
rodrigo_it needs to do a lot of things before he can respond to the DBus calls, so SyncdaemonDaemon object has a "ready" signal16:26
rodrigo_which signals apps when they can start calling it16:26
rodrigo_so, for instance, you would do in your app:16:26
rodrigo_daemon = syncdaemon_daemon_new ();16:26
rodrigo_g_signal_connect (daemon, "ready", daemon_is_ready_cb, my_data);16:27
rodrigo_and when your callback is called, you can start doing whatever you want with syncdaemon16:27
rodrigo_SyncdaemonDaemon also has a lot of signals for notifying the app about status changes, transfers, etc16:27
rodrigo_so, this is the main object16:28
rodrigo_and since it wraps the dbus API completely, it provides access to the different interfaces implemented by syncdaemon (the dbus service)16:28
rodrigo_there are 6 of them, but only a few of them are of interest to us16:29
rodrigo_there is the config interface, which allows you to check/change the configuration of syncdaemon16:29
rodrigo_like how much bandwidth to use, etc16:29
rodrigo_this is not very interesting to apps, so I'll skip it16:29
rodrigo_ditto for the events interface, it provides notifications of different low level events, so, since we have some high-level ones, I'll skip this one also16:30
rodrigo_the next one is the filesystem interface16:30
rodrigo_you can get a handle to it with:16:30
rodrigo_interface = syncdaemon_daemon_get_filesystem_interface (daemon) <- C16:31
rodrigo_interface = daemon.get_filesystem_interface () <- python16:31
rodrigo_this interface allows you to retrieve metadata for a given file or folder16:32
rodrigo_to get information like whether the file is synced or not, for instance16:32
rodrigo_metadata = syncdaemon_filesystem_interface_get_metadata (interface, path, TRUE or FALSE)16:32
rodrigo_this returns a SyncdaemonMetadata object, which contains that information I was talking about16:33
rodrigo_the next interface is a bit more interesting, so if you're not asleep yet, please listen :)16:33
rodrigo_this next interface is the folders interface, which allows you to synchronize any folder on your $HOME with Ubuntu On16:34
rodrigo_that's interesting, because a photo app, for instance, could easily provide a way for synchronizing a photo album to your personal cloud16:35
rodrigo_(that's the kind of 3rd parties we are looking for, as an example)16:35
rodrigo_this interface, like all others, is retrieved with:16:35
rodrigo_interface = syncdaemon_daemon_get_folders_interface (daemon);16:35
rodrigo_with this interface, you can retrieve the list of folders set up for syncing already:16:36
rodrigo_GSList                     *syncdaemon_folders_interface_get_folders (SyncdaemonFoldersInterface *interface);16:36
rodrigo_or add new folders (your photo album):16:36
rodrigo_void                        syncdaemon_folders_interface_create (SyncdaemonFoldersInterface *interface, const gchar *path);16:37
rodrigo_or delete folders you don't want to be synced anymore:16:37
rodrigo_void                        syncdaemon_folders_interface_delete (SyncdaemonFoldersInterface *interface, const gchar *folder_id);16:37
rodrigo_you can also do things that are not available in the current GUI for maverick16:37
rodrigo_like subscribing/unsubscribing a folder16:37
rodrigo_unsubscribing means that you don't want a specific folder to be copied to this machine16:38
rodrigo_imagine a netbook with very little disk space, you might not want to sync your huge music collection to it16:38
rodrigo_now, to the most interesting one, since it allows to do a lot of nice things16:39
rodrigo_there is the notion of public files, whcih are files that you publish via U1 and that everyone can see, no matter if they have an U1 account or not16:40
rodrigo_this is very nice for, "I'll take a screenshot and show you' kind of things16:40
rodrigo_this is, again, retrived with:16:40
rodrigo_interface = syncdaemon_daemon_get_publicfiles_interface (daemon);16:40
rodrigo_and has a simple call that does everything:16:41
rodrigo_void                            syncdaemon_publicfiles_interface_change_public_access (SyncdaemonPublicfilesInterface *interface,16:41
rodrigo_       const gchar *share_id,16:41
rodrigo_       const gchar *node_id,16:41
rodrigo_       gboolean is_public);16:41
rodrigo_as you can see, it is low level, since it includes stuff you shouldn't be dealing with16:41
rodrigo_I tried to add a simple publish_file API, where you pass a path only, but it's not as easy as that16:41
rodrigo_first, publishing a file only works on folders that are setup to be synced to U116:42
rodrigo_but I plan to add it to the high level API16:42
rodrigo_so, in a screenshot app, for instance, you could add a button that said 'Publish in U1'16:42
rodrigo_and just call that imaginary high level API (syncdaemon_daemon_publish_file) and the file will be published at a given url16:43
rodrigo_something like http://one.ubuntu.com/p/Df3dr16:43
rodrigo_a lot of examples about this raise, like publishing photos from the photo app16:44
rodrigo_and I'm sure you can find a lot16:44
rodrigo_the last interface we're going to see is the shares ones, which allows you to share a folder already in U1 with someone else16:44
rodrigo_as well as deal with shares offered by other users to you16:45
rodrigo_void                       syncdaemon_shares_interface_accept (SyncdaemonSharesInterface *interface, const gchar *share_id);16:45
rodrigo_void                       syncdaemon_shares_interface_reject (SyncdaemonSharesInterface *interface, const gchar *share_id);16:45
rodrigo_these 2 are for accepting or rejecting shares by other users16:45
rodrigo_void                       syncdaemon_shares_interface_create (SyncdaemonSharesInterface *interface,16:46
rodrigo_                                                               const gchar *path,16:46
rodrigo_                                                               GSList *usernames,16:46
rodrigo_                                                               const gchar *name,16:46
rodrigo_                                                               gboolean allow_modifications);16:46
rodrigo_void                       syncdaemon_shares_interface_delete (SyncdaemonSharesInterface *interface, const gchar *share_id);16:46
rodrigo_and these 2 for sharing with someone or deleting a share16:46
rodrigo_to finish, I'll talk a little bit about libubuntuone, which was supposed to be a widget library for easy use of U1 features in GTK apps16:47
rodrigo_there was a contacts picker (the one you see when you click on Ubuntu One->Share in Nautilus16:47
rodrigo_and a music store widget16:47
rodrigo_thanks to that music store widget, banshee plugin for the U1 music store was written by directhex in a few days16:48
rodrigo_so, I think that's all, I'll leave the rest for questions, if there are any16:48
rodrigo_hmm, no questions, is anyone listening :)16:49
rodrigo_ah, a question:16:49
rodrigo_<zinga49> QUESTION: so this will be available in maverick then?16:49
rodrigo_zinga49, yes, it already is16:49
rodrigo_what is not available in maverick is a better high level API, but it should probablt be (or part of it) for natty16:50
rodrigo_ QUESTION: and to use it in pyhton i install the above 2 modules?16:50
rodrigo_well, for only python, you don't need the -dev package, so gir1.0-syncdaemon-1.0 should be enough16:51
rodrigo_rye (in #ubuntuone) had some code using the automatic Python bindings, so ask him for an example16:51
rodrigo_so, with this, it should be easy to provide high level stuff integrating with U116:52
rodrigo_I already mentioned some simple examples, but I'm sure you can find lots of apps in Ubuntu that would make sense to have something like that16:52
rodrigo_like publishing files, etc16:53
rodrigo_f-spot, gnome-screenshot, etc16:53
rodrigo_ok, so no more questions?16:54
rodrigo_<ara> QUESTION: rodrigo_, is the client code in maverick already using your library?16:55
rodrigo_ara, the C parts of it are, like nautilus plugin, tomboy (using a part of the API I didn't mention, which is for registering a user with U1) and the music store widget16:56
rodrigo_the rest of the client code in maverick is either the daemon itself, which doesn't need this api16:56
rodrigo_and u1-prefs, which doesn't use the DBus service16:57
rodrigo_<ara> QUESTION: rodrigo_: so, no Python example code yet ;-)16:57
rodrigo_ara, yes, ask rye in #ubuntuone, he wrote an app to automatically publish files, I think16:58
rodrigo_also, worthy to say that this has been added in maverick, so the only place that I changed to use it was the nautilus plugin16:59
rodrigo_which had a lots of complicated code to deal with the DBus stuff16:59
rodrigo_and the music store widget, which only needed a couple of calls (mainly for tracking transfers)16:59
rodrigo_so, the already existing code wasn't changed, but I would do asap if I had time :-)16: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: Hacking on 'testdrive' - Instructors: andreserl
rodrigo_ok, I think we're out of time17:00
=== RoAkSoAx is now known as andreserl
=== andreserl is now known as RoAkSoAx
RoAkSoAxAlright :)17:01
RoAkSoAxHi everybody! Welcome to the Hacking on TestDrive Session.17:01
RoAkSoAxMy Name is Andres Rodriguez and I'm a community member. My areas of contribution are MOTU, the Server Team, and the Cluster Stack! (And now application17:01
RoAkSoAxprogramming :))17:01
RoAkSoAxI want to know who's here for the session so that I can begin17:02
RoAkSoAxOk, let's get started then17:03
RoAkSoAxUnfortunately, due to some unexpected situations (Fumigation at my place, and Ubuntu won't connect to Wireless-N Router where I'm at), I won't be able to do17:03
RoAkSoAxall I wanted to do today. Anyways, today's session is going to be:17:03
RoAkSoAx1. Introduction17:03
RoAkSoAx2. My Experience17:03
RoAkSoAx3. How to Contribute17:03
RoAkSoAx4. Questions17:03
RoAkSoAxNOTE: I'll reply any of your questions at the end of the session.17:04
RoAkSoAxJust before I begin, please install "quickly" given that it may take some time.17:04
RoAkSoAxsudo apt-get install quickly17:04
RoAkSoAxlet me know when you have quickly installing17:04
RoAkSoAxrooligan_: Ok, for those who don't know what quickly is. Quickly is a tool that allows the creation of Ubuntu Apps easily you can read more about it here: https://wiki.ubuntu.com/Quickly17:06
RoAkSoAx== Introduction ==17:06
RoAkSoAxTestDrive is a tool that was originally developed by Dustin Kirkland to test Ubuntu ISO images. He presented the tool at the Ubuntu Developer Summit in17:06
RoAkSoAxDallas last year. Back then, the tool was a shell script. Then, he decided to change it to a single file python script. Nowadays, and with the creation of17:06
RoAkSoAxTestDrive PyGTK, it is a collection of classes/modules. It is not perfect, but it works.17:06
RoAkSoAxBtw, I'm glad to say that TestDrive PyGTK was my GSoC2010 project for Ubuntu, and my first real experience with python and GTK.17:07
RoAkSoAx, though I started working on17:07
RoAkSoAxit way before the GSoC.17:07
RoAkSoAxnow, how many of you here have used or currently use TestDrive?17:07
RoAkSoAxok well, now we all know what TestDrive is: And App to test Ubuntu ISO images, but it is not limited to Ubuntu specific only17:09
RoAkSoAxgiven that we can test other ISO's that are in our harddrive, or even in any other repository17:09
RoAkSoAxSo anywa,s I'd like now to tell you in a short summary my experience coding it :)17:09
RoAkSoAx== My Experience with App Development for/in Ubuntu ==17:09
RoAkSoAxFirst of all, I'd like to say that my experience developing TestDrive for Ubuntu was really fun and satisfactory.17:09
RoAkSoAxAnd well it all started when I grabbed the TestDrive python script. The objectives were:17:09
RoAkSoAx1. Modify TestDrive in such a way that it would be easy to attach different fron-ends.17:09
RoAkSoAx2. Add the PyGTK Front-end.17:10
RoAkSoAxThe first, so called modularization, was to separate the python script's UI code with the "back-end's" code. This would be what we all call MVC. By17:10
RoAkSoAxseparating this code, I was making sure that I could re-use most of it when Implementing the Front-end.17:10
RoAkSoAxModularization, step 1: So, a class TestDrive was created to handle all the "back-end" work of testdrive, having an UI that just instances an object of the17:10
RoAkSoAxclass, and access this class' methods to do most of the work. At this point, I had separated TestDrive code in two, a binary (testdrive) and a module17:10
RoAkSoAx(testdrive.py).17:10
RoAkSoAxModularization, step 2: Now, given that we use different virtualization methods and that it would be nice to add new ones, we also decided to separate the17:11
RoAkSoAxvirt method from the testdrive module. For this, we created three virt modules (kvm.py, vbox.py, parallels.py). These modules, do all the configuration17:11
RoAkSoAxnecessary to run an ISO in the VM, and return a command ready to launch the VM.17:11
RoAkSoAxSo, so far, we are learning that TestDrive test's ISO by running them in a VM, either using KVM, VirtualBox or Parallellels17:12
RoAkSoAxthe preferred method is, of course, KVM17:12
RoAkSoAxSo, what about the PyGTK. Well, after the first step of the modularization, I started working on the Front-end. before starting with it, I figured that it17:13
RoAkSoAxwould be a good idea to use quickly to create the front-end, and so I did. Quickly is such an amazing tool!! Anyways, I started the front-end with a single17:13
RoAkSoAxlist of ISOs, then turned into separated categories of ISO's, and so on.17:13
RoAkSoAxNow, up to this point, we not only had a command line tool to test ISO, but a simple PyGTK tool with the same purpose17:14
RoAkSoAxI faced one problem though! Which was being able to Sync and Run Multiple ISO/VM's at the same time. For that I implemented python threading for Syncing17:14
RoAkSoAxISO's, and that's when I also decided to go for the modularization of Virt Methods, to provide better threading support.17:14
RoAkSoAxAfter this, I also implemented the posibility to add Other ISO's not in the Ubuntu repository. Of course, along all this I worked on other stuff such as17:14
RoAkSoAximplementeing the preferences, improving the UI, improving the preferences methods and changed the configuration to configparser, logging capabilities, bug17:14
RoAkSoAxfixing, etc etc.17:14
RoAkSoAxso, TestDrive PyGTK ended up being a cool tool where I could launch multiple ISO in a VM, or sync them. I also have the possiblity to change preference17:15
RoAkSoAxsuch as how much disk size per VM image, how much RAM to assign, How many CPUs, at all sort of that stuff17:15
RoAkSoAxSO, to do all this I pretty much had to learn python and GTK from scratch; and in only three months I learned a lot!! and it was Super FUN. A cool tool that helped me in the process was Acire!!17:16
=== JanC_ is now known as JanC
RoAkSoAxI'm sure that all of you know what Acire is, if not... it is a toold that puts together lots of python snippets that can help any developer by showing them how to implement these snippets17:16
RoAkSoAxSo yes, this a kinda confusing sum up of how TestDrive PyGTK came to live... anyone has any questions so far?17:17
RoAkSoAxOk then17:19
RoAkSoAxOK so now, you might wonder... how can I contribute ??17:20
RoAkSoAxWell, there are many ways to contribute with TestDrive... In fact, couple people already contributed, and471_ is one, am I correct :)17:21
RoAkSoAxanyways, to code testdrive I created a Blueprint to track all what was necessary. We had a session at UDS-M in Belgium where we talked about what were the features that ppl wanted to see in teh PyGTK17:22
RoAkSoAxmost of these features are detailed in:17:22
RoAkSoAxhttps://blueprints.launchpad.net/ubuntu/+spec/desktop-maverick-testdrive-frontend-gsoc17:22
RoAkSoAxIf you can see in the section "Work items for ubuntu-later:"17:23
RoAkSoAxall those work items are to be done17:23
RoAkSoAxmost of them is adding simple features or improvements17:23
RoAkSoAxHowever, contributions are not only limited to do that17:24
RoAkSoAxThere're some other things to be done such as17:24
RoAkSoAx - Maintainance and improvements of other Virtualization Methods (VBox and Parallels) - Add new Virtualization Methods (Such as VMWare) - Various other improvements - PyQT4 Front-end17:24
RoAkSoAxAs I mentioned earlier, TestDrive can either work with KVM, Vbox and Parallels, being KVM the preferred method17:24
RoAkSoAxbut, I'm not a VBox user and there are lots of VBox users out there17:25
RoAkSoAxthat use TestDrive with VBox, but since I'm not a user17:25
RoAkSoAxI can't always maintain the VBox (or Parallels code) as I can with KVM17:26
RoAkSoAxso, we are always looking for people to work on VBox or Parallels, or even, to implement other virtualizations, such as VMWare17:26
RoAkSoAxWe actually have a bug report asking us to do that, but we (Dustin and me), prefer having someone contribute on that part17:27
RoAkSoAxso if you are really interes in crontributed on that,and use VBox, Parallels, or VMWare... jsut ping me sometime17:27
RoAkSoAxand you can get started :)17:27
RoAkSoAxNow, one things that would be cool too is to have a PyQT4 front-end for Kubuntu17:28
RoAkSoAxthat would be great front-end to have for those users17:28
RoAkSoAxso, there's another place where people who works with PyQT can contribute17:28
RoAkSoAxand well, I'll guide you through the development if you wish17:29
RoAkSoAxanywas, we also need testers to test and report bugs agains testdrive17:29
RoAkSoAxto report any bugs that I might have missed17:29
RoAkSoAxI know there are a few, which I'm already planing to address17:30
RoAkSoAxbut if someone wants to chip in17:31
RoAkSoAxyou are more than welcom :)17:31
RoAkSoAxmost of these are mainly improvements to the current code17:31
RoAkSoAxhowever, if you have more ideas that you think might be interesting to have in TestDrive, please bring them on17:32
RoAkSoAxwell now we;ve been over a few things that it's needed to be done17:32
RoAkSoAxbut, if you'd like to contribute, how can you get started???17:32
RoAkSoAxit is easy!!17:32
RoAkSoAxI'll give you a guided tour through the code :)17:32
RoAkSoAxfirst step is to get the source17:33
RoAkSoAxso place yourself in whatever folder you like from your terminal17:33
RoAkSoAxand get the latest branch:17:33
RoAkSoAxbzr branch lp:testdrive17:33
RoAkSoAxand then enter the created folder17:33
RoAkSoAxcd testdrive17:33
RoAkSoAxrooligan_: :)17:34
RoAkSoAxanywas, do you all now have the branch?17:34
RoAkSoAxok while you get it, I'll continue with teh explanation17:35
RoAkSoAxwhen I created the PyGTK with quickly, I did it as a separate project17:35
RoAkSoAxand then I had to merge it altogether17:36
RoAkSoAxthe meging was quite easy17:36
RoAkSoAxit was just a correct organization17:37
RoAkSoAxof the code in the source directory17:37
RoAkSoAxonce that was done, everything is done quickly17:37
RoAkSoAx:)17:37
RoAkSoAxthe code is somehow divided like this:17:38
RoAkSoAxbin -> contains testdrive-gtk and testdrive binaries17:38
RoAkSoAxtestdrive -> contains the testdrive.py, and virt modules17:38
RoAkSoAxtestdrivegtk -> contains all the classes related to the gtk17:38
RoAkSoAxdata -> contains two directories, media and ui17:39
RoAkSoAxmedia contains all the iamges17:39
RoAkSoAxand ui contains the .glade and .xml files for the UI17:39
RoAkSoAxso, how can I start working on them17:40
RoAkSoAxit is really simple17:40
RoAkSoAxfirst of all17:40
RoAkSoAxlets set up our python path17:40
RoAkSoAxwe are placed somewhere here: '/home/<user>/<whatever>/testdrive'17:40
RoAkSoAxso we will set it up like: export PYTHONPATH=/home/<user>/<whatever>/testdrive17:41
RoAkSoAxor export PYTHONPATH=`pwd`17:41
RoAkSoAxonce that is done17:41
=== asd is now known as Guest84970
RoAkSoAxdo this "quickly run"17:41
RoAkSoAxthat should launch testdrive17:41
RoAkSoAxdoes it? :)17:41
RoAkSoAxok so by doing quickly run from the source directory of testdrive's branch17:42
RoAkSoAxit launched testdrive17:42
RoAkSoAxhow quick and easy is that17:42
RoAkSoAxnow, what if we wanna launch the command line app?17:43
RoAkSoAxthat';s more complicated: python bin/testdrive17:43
RoAkSoAxbut easy as well17:43
RoAkSoAxso ok, now I want to do changes17:43
RoAkSoAxlets do "quickly edit"17:43
RoAkSoAxwhat this will do is open all related testdrive files in your default editor17:43
RoAkSoAxshould be gedit17:43
RoAkSoAxbut now, I want to do changes to the UI specifcally17:44
RoAkSoAxwell... "quickly design"17:44
RoAkSoAxrooligan_: that means it does not support kvm... so probaly you'll need to isntall virtualbox17:45
RoAkSoAxso well, I used 3 simple quickly commands17:45
RoAkSoAxto get started17:45
RoAkSoAxnow, if I make any changes to any of the files17:45
RoAkSoAxor UI17:45
RoAkSoAxI simply do "quickly run" again to see the changes17:45
RoAkSoAxbut how can I see the diff17:45
RoAkSoAxthe way I do it is: bzr diff17:46
RoAkSoAxor bzr status to see which files where modified17:46
RoAkSoAxunfortunately I was planning to go a little bit more over this, but as per unexpected events I'm sshing into my VPS from a Windows  machine17:46
RoAkSoAxanywas, it ios really simple to start hacking on testdrive17:47
RoAkSoAxnow you have the code layout17:47
RoAkSoAxhow to start running it17:47
RoAkSoAxhow to open all editable files17:47
RoAkSoAxhow to open the UI17:47
RoAkSoAxin an easy way17:47
RoAkSoAxall using quickly17:47
RoAkSoAxhow fun is that?? :)17:47
RoAkSoAxNow, to finalize17:47
RoAkSoAx== Questions ==17:48
RoAkSoAxAnyone?17:48
RoAkSoAxzinga49: shoot17:49
RoAkSoAxzinga49: when I say "synced" I mean, obtain the Ubuntu ISO image from a given repository. For example, by default when ever I sync an ISO Image it will obtain, or download it from http://cdimage.ubuntu.com17:50
RoAkSoAxand that's what the "Sync" button means at the main UI17:50
RoAkSoAxIn other words, download the ISO Image from the repository17:50
RoAkSoAxzinga49: If it is already downloaded, it will update it, if there were any changes17:51
RoAkSoAxoff course, this is something that we have to decide to do17:51
RoAkSoAxfor example, in testdrive command line, what was done, was to synchronize (or download the changes) every time we were about to run an ISO17:52
RoAkSoAxbut it came to the point "What if I want to run yesterday's ISO and not Today's ISO"17:52
RoAkSoAxso in the Front-end, we have the option to Sync, or to launch17:52
RoAkSoAxSync will obtain the latest ISO from the repo , which by default is the daily Ubuntu ISO (cdimage.ubuntu.com)17:53
RoAkSoAxAnymore questions?17:54
RoAkSoAxzinga49: not really. It is just peronal preference. In fact, quicly AFAIK defaults to gedit but if you set export EDITOR=vim, it should use vum as the editor17:55
RoAkSoAxand so on17:55
RoAkSoAxzinga49: and I do code using a combination of vim/gedit depending on how I feel like that day :)17:56
RoAkSoAxok then we have 3 more minutes17:57
RoAkSoAxany other question?17:57
RoAkSoAxOk I guess not. thank you all :) Enjoy the App Dev Week, and ping me if you awnt to get involved with TestDrive17:58
=== 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 with DBus - Instructors: alecu
alecuhello all18:00
alecumy name is alecu, but some people know me as Alejandro J. Cura as well18:01
alecuI'm a Canonical developer working on Ubuntu One18:01
alecuand also a Python Argentina member18:01
alecutoday I'll be giving some tips on how to get started using DBus18:01
alecuDBus is a way so programs can talk to programs18:02
alecuit's composed of a daemon and many program speaking to that daemon18:02
alecuand the daemon will route what one program is saying to some other programs that want to listen to that18:03
alecuthis way all the apps that make up your desktop can talk to each other, independently of the language they are coded on,18:03
alecuand no matter if they are kde apps or gnome apps or system daemons.18:04
=== Goomba is now known as Guest678
=== alecu__ is now known as alecu
alecuso, regarding what apps use dbus...18:27
alecu just a few I've been looking at:18:27
alecu upstart, gnome-display-manager, telepathy, networkmanager, pulseaudio, vlc18:27
alecu there are lots!18:27
alecu so, you can use dbus to export services that your app provides18:27
alecu and you can use dbus to use those services from other apps or scripts.18:27
alecud-feet is a great way to learn about dbus18:27
alecu let's all install it:18:27
alecu sudo apt-get install d-feet18:27
alecu and meanwhile you can all tell me what is your main development language.18:27
alecud-feet is a great way to learn about dbus18:27
alecu  let's all install it:18:27
alecu  sudo apt-get install d-feet18:27
alecu  and meanwhile you can all tell me what is your main development language.18:27
alecuso, let's open d-feet18:27
alecu go to file->connect to Session bus18:27
alecu on the right hand you'll see a lot of Bus Names18:27
alecu sorry18:27
alecu left hand18:27
alecu clicking on one of the bus names you'll see the paths exported by the objects on that bus18:27
alecu (I know I'm talking on the wrong channel, but I'm getting disconnected very often, and the nick registered on the main channel is only one)18:28
alecu each object may implement several interfaces18:28
alecu in the interfaces you'll find methods and signals18:28
alecu those are the bits that make up dbus:18:28
alecu Buses -> object paths -> interfaces -> [methods, signals, properties]18:28
alecu does it make sense?18:28
alecu let's try playing with some interface18:28
alecu so... make sure you have vlc installed, and fire it up18:28
alecuIn vlc the dbus control interface has to be manually activated from tools->preferences->show settings:All->Interface->control interface->D-Bus control interface18:28
alecu(most other apps already have dbus plugged in, but vlc makes for a nicer experiment)18:28
alecu so, after restarting vlc (just close it and open it again), go to dfeet18:28
alecu bus: org.mpris.vlc -> path: /TrackList -> Interfaces -> org.freedesktop.MediaPlayer -> Methods -> AddTrack18:28
alecu so, double click on "AddTrack" in dfeet18:28
alecu and put: "http://upload.wikimedia.org/wikipedia/commons/7/79/Big_Buck_Bunny_small.ogv", True18:28
alecu in parameters18:28
alecu and click on "Execute"18:28
alecu it should start playing18:28
alecu then let's close that dialog18:28
alecu and go to the object path /Player18:28
alecu on the org.freedesktop.MediaPlayer interface we'll find18:28
alecu Pause18:28
alecu Play18:28
alecu PositionGet18:29
alecu PositionSet18:29
alecu let's play a bit with those18:29
alecuwell, this is what dbus is used for.18:29
alecu to let very different programs, coded in different languages, even belonging to different desktop environments talk to each other.18:29
alecu(sorry, catching up with the logs)18:29
alecuso...18:30
alecuthe common use case for dbus is to have two instances of the dbus daemon running18:30
alecuone instance is the system bus: used for daemons that run as root or having to do privileged operations18:31
alecuthe other is the session bus, (well, one is started per logged in user)18:31
alecuthe apps that run as your unix user are all using that session bus18:31
alecu(you can start up other daemon instances in order to run functional tests and so on)18:32
aleculet's get back to the dbus parts18:33
alecuwe already said we have a bus, with a bus name18:33
alecuand we have objects exported thru some object path18:34
alecuand those objects implement some interfaces18:34
alecumost of this is just for having some order18:34
alecuthere's nowhere set in stone how this should be partitioned. And you don't need to register anywhere in order to ask for a name to use here (unlike dnss or some other ipc systems)18:35
alecuyou just pick a few names, and you are ready to go.18:35
alecuBut it really makes sense to write some spec so other apps can easily use your services.18:36
alecuFor instance, for the vlc demo we were doing we were using the services in this spec: http://xmms2.org/wiki/MPRIS18:36
alecua few media playing apps developers wrote that spec so different remote control programs can control different media playing programs.18:37
alecuany questions?18:37
ClassBotMAfifi asked: Do all players provide such a specification?18:39
alecuMAfifi, many players are moving to it. I'm not sure if all will18:39
alecuMAfifi, anyway, not all dbus services are specced at all.18:40
alecuMAfifi, I try to make a spec for the services I write, for instance the ubuntu-sso-client dbus service... let me fetch the link18:40
alecuhttps://wiki.ubuntu.com/SingleSignOn/UbuntuSsoClient18:41
aleculet's branch some sample code...18:41
alecubzr branch lp:~alecu/+junk/dbus-lessons18:41
alecuin the first example, 01-call_method.py we'll see how we connect to a bus, and call a method on that bus18:43
alecuI'm using the /org/gnome/PowerManager/Backlight dbus object, that exports a way to set the display brightness18:43
alecuI know it works on my lenovo laptop, and I know it won't work on my old compaq one, so if it does not work for you, try adapting it to control vlc18:44
alecuin this sample I'm using the dbus integration with the gtk main loop (the lower level gobject main loop in fact)18:45
alecudbus has integration with qt as well, and with twisted, and probably some other frameworks too.18:45
ClassBotpapibe asked: how do I see the sample code?18:46
alecupapibe, try running this in a terminal:18:47
alecu bzr branch lp:~alecu/+junk/dbus-lessons18:47
alecupapibe, it will fetch the sample code from its bazaar repository on launchpad18:47
alecuso, the code gets at a bus, looks up an object in that bus given the object path18:48
alecuand gets an interface implemented by that object18:48
alecuthen it starts calling the SetBrightness method in that interface18:48
alecuand that's how you call a method provided by some other app.18:50
alecunow, it may be the case that the app wants to tell you something18:51
alecufor instance, a media player app may want to tell you that it has finished playing a file18:51
alecuor perhaps you are listening on the bus for an instant messaging app and want to know when a message arrives...18:52
alecufor this DBus provides Signals18:52
alecuSignals are specified by the app providing a service, and are fired in response to some action happening in the app.18:53
alecuyour program or script may listen to some those signals.18:53
alecuwe can see that in the 02-listen_signal.py script18:54
alecuin the line: iface.connect_to_signal("BrightnessChanged", brightness_changed_callback)18:54
alecuwe are hooking a function to a signal18:54
alecuif I run that sample, I see the signal being fired when I change the brightness using my keyboard18:55
alecuand finally, on 03-export_object.py we can see a sample of exporting a method and a signal on the bus18:55
alecuwe didn't got around to explaining Data Types on Dbus, but if this all was interesting, you may continue here: http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html18:56
ClassBotMAfifi asked: How may I make my program emit a signal?18:58
alecuMAfifi, great question18:58
alecuMAfifi, your program can only emit signals that it implements itself18:59
alecuMAfifi, it cannot fire signals implemented by other modules18:59
alecuMAfifi, the way to fire the signals, is to just call the method where they are defined18:59
alecuMAfifi, in the python dbus, a signal is emmited if the method decorated with @signal returns properly (ie, it does not fire an exception)19:00
=== 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 ||
alecuMAfifi, thought the python method may be blank, in which case it will just work.19:00
alecuI hope you liked this session, thanks all for attending.19:01
jcastrothanks alecu!19:01
alecumy mail is alecu@canonical.com or alecu@protocultura.net19:01
alecuin case you have some other Q19:01
alecubye!19:01
jcastrook so we have a last minute change, due to Seif having to reschedule his class. So the session on Zeitgeist will be moved to tomorrow19:01
jcastroplease see the /topic for the session19:01
jcastroso since this was kind of last minute, we're going to take a break19:02
jcastroHOWEVER19:02
seiflotfyjcastro, I can answer general zeitgeist questions19:02
jcastroJono is doing open Ubuntu Q+A if you want to participate there for this hour: http://www.ustream.tv/channel/at-home-with-jono-bacon19:02
jcastroseiflotfy: sure!19:02
seiflotfyjcastro, do i have the mic19:02
seiflotfy?19:02
jcastroit's all yours19:02
seiflotfyok19:03
seiflotfyso guys i will be doing a real tutorial tomorrow19:03
seiflotfytoday i will just fill the gap by explaining zeitgeist19:03
seiflotfyand answering questions19:03
seiflotfyso let me start19:03
seiflotfyMy name is Seif Lotfy19:03
seiflotfyI am a GNOME member, and mostly known for being the initiator of the zeitgeist project19:04
seiflotfyI am one of the lead developers and maintainers19:04
seiflotfywe are 4 maintainers19:04
seiflotfyMarkus Korn (thekorn) is responsible for the QA19:05
seiflotfyMikkel Kamstrup (kamstrup) is the guy behind the architecture19:05
seiflotfyand Siegfried Gevatter (RainCT) mostly DB work19:05
seiflotfyhowever we all work on all aspects of zeitgeist19:06
seiflotfyits just that these are the areas in which each developer proved himself very capable19:06
seiflotfyso what is zeitgeist?19:06
seiflotfydoes any1 care to explain?19:06
seiflotfyZeitgeist is a service which logs the users's activities and events, anywhere from files opened to websites visited and conversations.19:07
seiflotfyIt makes this information readily available for other applications to use.19:07
seiflotfyIt is able to establish relationships between items based on similarity and usage patterns.19:07
seiflotfyso its ur personal spyware :P19:08
seiflotfyit is now part of unit19:08
seiflotfy*unity19:08
seiflotfyyou can think of it as the gtk.RecentlyUsed19:09
=== 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: Zeitgeist Q &amp\; A - Instructors: seiflotfy
seiflotfybut on steroids19:09
seiflotfyso who has a question ?19:09
=== 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: Zeitgeist Q and A - Instructors: seiflotfy
seiflotfy!q19:10
seiflotfyClassBot !q19:10
seiflotfyhow do i work the classbot19:10
seiflotfy?19:10
seiflotfyok got it19:11
seiflotfyhmmm this class seems empty19:12
seiflotfysorry guys but the real talk is tomorrow19:12
seiflotfyi will show you how to extend your applications to make use of zeitgeist19:13
ClassBottiteuf_87 asked: How is privacy/security handled: will all apps be allowed to access everything by default? Or do you first have to allow them to?19:15
seiflotfytiteuf_87, its a globael history19:15
seiflotfytiteuf_87, zeitgeist allows applications to push data into it19:16
seiflotfyonce its in zeitgeist its available for everyone19:16
seiflotfyso zeitgeist doesnt really look at what the applications are doing19:16
seiflotfybut rather lets applications store their history into zeitgeist using a specific template19:17
seiflotfywe also support blacklisting19:17
seiflotfyso applications can tell zeitgeist "never log uri's with porn"19:17
seiflotfyas well as registrations such as "Only totem is allowed to push events for media files"19:18
ClassBotmeebey asked: why did we have to wait for this amazing project to show up after all those years and what brought this project to life?19:19
seiflotfymeebey, first thanks for the compliments19:19
seiflotfywell there are many aspects to how it started19:20
seiflotfyi used to work for an institute in germany that wrote similar software19:20
seiflotfyand i also worked on Gimmie which sorted things based on time using gtk.RecentlyUsed19:20
seiflotfythen Federico Mena came up with an Idea to write a Journal for GNOME19:20
seiflotfyso i took the initiative to develop it19:21
seiflotfybasically in my bedroom19:21
seiflotfythen during the course of time aantn and RainCT started hacking19:22
seiflotfyshortly afterwards thekorn and kamstrup started hacking on it too19:22
seiflotfyand its from there where I personally consider zeitgeist being born (everything before that was just a working prototype)19:22
=== asd is now known as Guest61364
ClassBotsinisterstuf asked: Is it obvious if a program is able to use zeitgeist or not without reading the source?19:23
seiflotfyi dont get the question sinisterstuf19:23
ClassBotzinga49 asked: do i get this right: a popular app (e.g. a game) could spy sensible data like browser history of thousands of users though?19:24
seiflotfyzinga49, uhm yes but its possible over the firefox history too :)19:24
seiflotfyzinga49, we actually have a an old sample code where we hooked into the firefox DB and sent everything to zeitgeist19:25
ClassBotsinisterstuf asked: Well maybe I don't quite get it, what I mean is, if any program can read zeitgeist's journal of activities and stuff and do things with it, is there a way for the average user to know if a program is able to do that or not?19:27
seiflotfysinisterstuf, well the idea is to have zeitgeist integrated into the apps without popping out (ZEITGEIST IS LOGGING)19:27
seiflotfysinisterstuf, what we are adding is a zeitgeist-manager UI where u can see which applications are pushing information into Zeitgeist etc...19:28
seiflotfysinisterstuf, you can use GNOME Activity Journal to figure out what is being logged19:28
ClassBotmeebey asked: does zeitgeist have some kind of protocol / log that could be checked in order to find out which application has added or fetched information from/to zeitgeist?19:29
seiflotfymeebey, well the log tells you who added info to zeitgeist (its usually the actor in our DB tables)19:29
ClassBotsinisterstuf asked: I see. Do you aim to have zeitgeist integrated into EVERYTHING?19:30
seiflotfysinisterstuf, well its opensource19:30
seiflotfyso 1) its transparent19:30
seiflotfy2) yes we would like to but its always an option to disallow applications from pushing info into zeitgeist19:30
seiflotfyRainCT, can u write up a quick template that is sent to our blacklist manager to stop logging firefox history19:31
seiflotfythis way we can show it to sinisterstuf19:31
ClassBotmeebey asked: well, say I want to debug or audit my application with zeitgeist, is there some log file that could be consulted to find out whats going on, besides the general information zeitgeist provides by it's database?19:32
seiflotfymeebey, the more info you push into zeitgeist from you application the more u can use it for auditing19:32
seiflotfybut i wouldnt recommend doing so19:33
ClassBotzinga49 asked: will the blacklisting be possible for the user from a central place? so that the user has really control over every program. not just only if the program itself decides to let the user choose...19:33
seiflotfyzinga49, yes its possible19:33
seiflotfywe already support this over the engine19:33
seiflotfywe just need a UI for it19:33
seiflotfybut AFAIK m4n1sh (one of our new hackers) is working on the new blacklist stuff19:34
seiflotfyand shortly after we will have a central UI to stop applications from logging19:34
seiflotfyas well as stop zeitgeist completely from logging anything19:35
ClassBotsinisterstuf asked: is there a zeitgeist 'journal' for each user or is it all lumped together in a common place?19:35
seiflotfysinisterstuf, per user19:35
seiflotfy:)19:35
seiflotfyif u want a log of several users you will need something called teamgeist (but this is a different story)19:36
seiflotfysinisterstuf, an example on how to make zeitgeist stop logging firefox is written here19:37
seiflotfyhttp://paste.ubuntu.com/502775/19:37
seiflotfyany other questions?19:40
ClassBotsinisterstuf asked: could admin use this to check what people use their computers for the most to see what type of people use what apps and how much and to do what with? that way he would know what to focus on, which things are not as important what other apps he might want to install… eg. for an internet cafe, library, or any company. (is that ethical, if the users don't know‽)19:41
seiflotfysinisterstuf, its not ethical but on the other hand it does make people's life much easier19:43
seiflotfysinisterstuf, yes admins could do that19:43
seiflotfybut hey19:43
seiflotfyadmins at your company can also read your mails19:43
seiflotfya quote from spiderman:19:44
seiflotfy Uncle Ben: Remember, with great power. comes great responsibility19:44
seiflotfyso sinisterstuf you better hope your admin is a good guy19:44
ClassBotnzmm asked: I have heard of teamgeist where does this fit in?19:45
seiflotfynzmm, teamgeist was an idea we had before guadec 200919:45
seiflotfythe guys from collabora helped us out make it possible19:45
seiflotfywhat it does is really simple19:45
seiflotfyits a service that uses zeitgeist19:46
seiflotfyand telepathy19:46
seiflotfyand ALLOWS you to decide what "events" you want to share with whom19:46
seiflotfyso lets say me and thekorn want to plan a trip19:46
seiflotfywe decide to share "all events from firefox with the words BRAZIL or SPAIN"19:46
seiflotfyand then anything i do on firefox with BRAZIL or SPAIN is shared wit him19:47
seiflotfyso its a log for a whole team for a specific topic19:47
seiflotfyit can be very useful for developer19:47
seiflotfyknowing who is working on which file in realtime19:47
ClassBotsinisterstuf asked: do you know anything about this reward system I heard about, I think it'd use zeitgeist. Based of rewards in games it let's your computer award you for your actinos, eg. you used GIMP 50 times you won the artist award, your screensaver has been on more than 50% of the time you've achieved the laziness award?19:51
seiflotfysinisterstuf, yes its called OMG19:51
seiflotfyit was something initiated but now its being developed and maintained by m4n1sh19:52
seiflotfyit will be using zeitgeist intensivly19:52
seiflotfyit actually is done19:52
seiflotfybut needs a UI to show the toprhies19:52
seiflotfyi just never got around to do that19:52
ClassBotsinisterstuf asked: is it available to be used/tested?19:54
seiflotfysure19:55
seiflotfylp:omg :)19:55
=== 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: Custom widgets - Instructors: nzmm
nzmmhey folks!20:01
nzmmmy name is Matthew McGowan, I help out a bit with the Software Center UI20:01
nzmmI am going to give a basic introduction on custom widgets in pygtk20:02
nzmmI have notes up here:20:03
nzmmhttp://nzmm.blogspot.com/2010/09/custom-widgets-notes-plain-text-version.html20:03
nzmmif you would like to refer to them at a later date20:03
nzmmso firstly why would we want to write our own widget?20:04
nzmmwith custom widgets you can potentially solve UI problems more elegantly or in more intersting ways20:05
nzmmit adds flare to your application, a bit of bling perhaps20:06
nzmmwriting custom widgets is also a great way to get to know the gtk toolkit20:06
nzmmbut you need to be aware that a widget is a very user facing thing20:08
nzmmso you need to ensure they are well tested and implement all the behaviours a user will expect from a widget, ie. keyboard shortcuts20:09
nzmmAlso, when it comes to colourising a custom widget you need to take care that you select appropriate colours that fit in with the widgets surroundings20:10
nzmmand a big one that is easily overlooked is provided accessibility20:10
nzmm*providing accessibility20:10
nzmmfor users who rely on apps such as the Orca screen-reader20:11
nzmmso i hope with my chat, i will cover some of these basics20:11
nzmmbefore you get started with a custom widget, get familiar with the gtk.Widget class20:13
nzmmit provides a lot of methods, so it pays to know whats on offer, to avoid duplicating stuff in your own widget20:14
nzmmalso investigate other widgets, as their api may provide an insight into things you may need to consider writing your own widget20:14
nzmmalso you'll want to decide which widget you want to base your widget on20:16
nzmmdo you want to start with a gtk.EventBox or a gtk.DrawingArea or some other widget20:16
nzmm!q20:16
ClassBotsinisterstuf asked: what do I need in order to do this?20:17
nzmmso i forgot to mention: to write a custom widget in pygtk, you dont need to install anything really, as the default Ubuntu install provides what you need out of the box20:19
nzmmif you have bzr installed i have some sample code that shows the basics20:20
nzmmbzr branch lp:~mmcg069/+junk/custom-widget-examples20:21
=== harrisonk_away is now known as harrisonk
nzmmor if bzr is a bit daunting, i have an example here: http://dl.dropbox.com/u/123544/custom-widget-1.py20:21
nzmmso in this example a simple push-button type widget is written20:22
nzmmthe important parts are that we import gtk and cairo20:23
nzmmgtk provides the 'windows'20:23
nzmmcairo provides a the drawing operations20:23
nzmmthe method rounded_rect at the top of the file, is a helper method for drawing rounded rectangle20:24
nzmmthe guts of this example though is the class MyCustomWidget20:24
nzmmnotice that i have subclassed a gtk.EventBox20:24
nzmmIMHO subclassing a gtk.EventBox is a great foundation for a custom widget20:25
nzmmas the name suggests an EventBox allows you to be notified of events such as20:25
nzmmbutton-presses, key-presses, motion, enter & leave events, focus events and many more20:26
nzmmoh btw to run this file, simply > python custom-widget-1.py20:26
nzmmthe other great thing about EventBoxes is that with the method set_visible_window(True|False)20:27
nzmmyou can hide the EventBox 'background' window20:27
nzmmthis can be great for a number of reasons20:28
nzmma hidden background window can allow for a pseudo compositing effect20:28
nzmmif the container you are putting your custom widget is a gradient or if you want to paint a shape to your custom widget that is non-rectangular20:29
nzmmyou can do so without unsightly little colour mismatches between the container widget and your custom widget20:30
nzmmmoving on20:30
nzmmself.set_flags(gtk.CAN_FOCUS)20:30
nzmmis important because this tells gtk that your widget wants to be in the focus-chain20:30
nzmmthe focus-chain it the order widgets are cycled through when you press Tab or Shift+Tab20:31
nzmmself.set_size_request(36, 64)20:31
nzmmrequests a minimum size for your widget20:31
nzmmin your own widget you'd want to calculate this based on the contents of your widget20:32
nzmmits important to note that your widget can still grow to fill space, so keep that in mind20:32
nzmmself.set_events(gtk.gdk.KEY_PRESS_MASK| ...20:33
nzmmyou need  to also specify which events you want your widget to be sensitive to20:33
ClassBotgaberlunzie asked: how to peek at available methods in the Widget class?20:34
nzmma good way would be dir(Widget)20:34
nzmmthat would list methods etc20:34
ClassBotsinisterstuf asked: Can you set a max size for the widget too?20:35
nzmmtbh, you cant really enforce a max or min on a widget20:36
nzmmthe size allocated to a widget depends a lot on how other widgets surrounding it are behaving20:36
nzmmso yo need to design your widget to handle different sizes as gracefully as possible20:37
nzmmnext, you want to connect to signals that are issues when events occur, such as expose20:38
nzmmself.connect('expose-event', self._on_expose)20:38
nzmmexpose-event is an important one as it is issued when a redraw is required20:38
nzmmyour signal handler, in my case def _on_expose(self, widget, event):20:39
nzmmis where you want to handle the drawing20:39
nzmmdrawing is where custom widgets get really fun20:40
nzmmin my case i do my drawing with cairo20:40
nzmm        # first we need to create a Cairo Context20:40
nzmm        cr = widget.window.cairo_create()20:40
nzmm        cr.rectangle(event.area)20:40
nzmm        cr.clip()20:40
nzmmthe event.area is the area of the widget that needs a redraw20:40
nzmmusually because the contents have been changed or resized20:41
nzmmwidget.allocation is the space your widget occupies in the window20:42
nzmmits a gtk.gdk.Rectangle()20:42
nzmmit offers an x, y coord20:42
nzmm and also the width and height dimensions20:42
nzmmbe aware that event.area and widget.allocation can differ20:43
nzmmin this example we used fixed colours to the drawing, this most likely does not play well with gtk-themes20:44
nzmmhttp://dl.dropbox.com/u/123544/custom-widget-2.py20:45
nzmmin the above example however we prefer to use colours from gtk.Style20:45
nzmmgtk.Style offers a palatte of colours derived from the current gtk-theme20:46
nzmmfor instance widget.style.mid[gkt.STATE_NORMAL]20:46
=== asd is now known as Guest93109
nzmmwill return the mid gtk.gdk.Color for your theme20:46
nzmmbg = self.style.mid[self.state]20:47
nzmmnotice the self.state20:47
nzmmthe mid color selection offers a range of colours for each 'state'20:48
nzmmstates include gtk.STATE_PRELIGHT (onhover) gtk.STATE_ACTIVE (clicked) gtk.STATE_INSENSITIVE (inactive widget)20:48
nzmmso mid will return slightly different colours depending on the state specified20:49
nzmmto take advantage of this fact in your custom widget, you need to set the state depending on how the user is interacting with your widget20:50
nzmm    def _on_enter(self, widget, event):20:50
nzmm        # set state to enter. an expose event is generated20:50
nzmm        self.set_state(gtk.STATE_PRELIGHT)20:50
nzmm        return20:50
nzmmthe above code is the signal handler for the 'enter' event, i.e. when the user mouses over your widget20:50
nzmmnotice the set_state method20:51
nzmmi set the state to gtk.STATE_PRELIGHT20:51
nzmmthis automatically triggers an expose event as well20:51
nzmmresulting in a slightly different shade of colour when the user mouses over the widget20:52
nzmmi am getting low on time so i want to move on to accessibility20:52
nzmmhttp://dl.dropbox.com/u/123544/custom-widget-3.py20:52
nzmmi changed the widget only slightly to provide some really basic accessibility information20:53
ClassBotgaberlunzie asked: gtk.Style exempts cairo from being imported?20:53
nzmmyou can use both cairo drawing and gtk.STyle.paint_* methods in teh expose handler, for instance you can draw the rounded rectangle with cairo, the use gtk.Style.paint_layout to draw some text with the correct hinting etc20:54
nzmmback to accessibility20:54
nzmmaccessibility allows you to provide additional contextual information about what your widget is for and how it behaves20:55
nzmm        acc = self.get_accessible()20:56
nzmm        # define an accessible name20:56
nzmm        acc.set_name('Big accessible button')20:56
nzmm        # define an accessible description20:56
nzmm        acc.set_description('An example custom widget in gtk')20:56
nzmm        # define the widgets role in terms of Atk Role Constants20:56
nzmm        acc.set_role(atk.ROLE_PUSH_BUTTON)20:56
nzmmthese are definately the basic methods you want to include in your widget20:56
nzmmits should be obvious what they provide in terms of accessibility info20:56
nzmmthis info is then consumed by apps such as Orca to aid some disabled users of your widget20:58
nzmmyou can test your app for accessibility using the application Accerciser, which is available fromt he repositories20:58
nzmmlooks like i am out of time20:59
nzmmi hope that was helpful starter20: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 ||
=== yofel_ is now known as yofel
=== tj is now known as Guest83474

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