=== nigelbabu is now known as nigelb === 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: From mockup to bling - Instructors: MacSlow [16:01] Welcome to Ubuntu App Developer week! (Formally known as Ubuntu Opportunistic Developer Week). [16:01] Ubuntu App Developer Week is a week of sessions aimed at enabling and inspiring developers to write applications that scratch their itches. Our goal is to give all attendees a taste of the wide variety of tools on the Ubuntu platform that can be used to create awesome applications, and to showcase some applications that have been created and explain how they were put together. [16:01] to ask questions please ask in ubuntu-classroom-chat [16:02] and form the questions using QUESTION: in front of your questions [16:02] So lets start scratching some itches, sharing some tools, creating awesome applications and showcasing others. [16:02] Welcome - Mirco "MacSlow" Müller who will be opening Ubuntu App Developer Week with a session on "From mockup to bling. [16:02] Micro if you are ready the floor is yours! [16:02] ah ok... thanks akgraner [16:03] So in this session I will talk about general principles, common practises, helpful workflows and tips/tricks to go "from mockup to bling" [16:04] meaning pretty designer drawn images to working apps/code [16:05] as akgraner said questions can come in anytime, right? [16:05] As an example for "from mockup to bling" I'll use unity's quicklist [16:05] I hope by everybody knows what unity is :) [16:06] take a look at this image http://macslow.net/images/quicklist-mockup.png [16:06] That's a mock of of the designers idea of what quicklists should look like [16:07] but for the person meant to make that into working code it's not really the full story [16:07] becasue it needs to be a bit more "systematic" [16:09] to implement this one needs hard facts (numbers for radii, widths, lenghts, etc) [16:09] which much easier flow into code [16:11] what you need to create (or ask from the designers) is a more schematic drawing like this... [16:11] http://macslow.net/images/quicklist-schematic.png [16:12] That looks less shiny but is a lot simpler to put into code (what up with "em" I'll get to after this) [16:13] in this drawing you see what's important and one can almost right away start codeing that as it easily maps to drawing-calls from e.g. cairo or QPainter [16:14] With colors, gradients, patterns and opacity you need to deal in the same way. === MSK61 is now known as MAfifi [16:15] Everything clear up to know? [16:16] So what's with EM stuff in the schematic you ask. [16:16] That's the measurement for making all your UI-elements resolution-independent. [16:17] Most of the time one gets only discrete pixel-values (by measureing that in gimp in the mockup-graphic) [16:18] an implemented UI-element based on that will only work as the end-user will not have a dramatically different screen (with super high DPI) and/or a different font-size set [16:19] UIs implemented in a resolution-independent fashion will automatically adapt to new conditions like those. If only based on hard-coded pixel-sizes it can break in a nasty (visual) way. [16:20] So what is an EM now? [16:20] It's the unity-size of the set system-font (height) === parth is now known as Guest41067 [16:20] usually 10 points [16:21] I will bore you with the formular for this now... :) [16:21] pixels_per_em = font_point_size * screen_dpi / 72.0f; [16:22] Where all those are floats... but pixels_per_em should be rounded to int of course [16:23] font_point_size and screen_dpi you can query via you toolkit api of choice (gtk+ and Qt have means for that) [16:24] A good way to provide artwork for the real app and stay resolution-indepdented is to use SVGs. [16:25] For static parts that perfectly ok. If animated elements are needed this will not fully fit the bill. [16:26] Animated SVG, while spec'ed out, are still a dream for day-to-day use in UI-development [16:27] Let's move to some common practises. [16:27] I mentioned cairo and QPainter earlier. [16:28] Those are currently the best choices on the Linux desktop of doing custom UI/widget development... [16:28] to fill in the "rects" [16:28] If you look at any application they are 2D and made up of rectangular regions. [16:29] What you need to do is fill them with "meat" [16:29] This meat is either an image, text, gradient, some sort of line-drawing [16:29] for this nothing beats cairo (or QPainter) [16:33] Some interesting things to do with you "rects" then before they land on the screen is to "post-process" them [16:33] Of course depending what the initial design ask for. [16:33] Commong are fade-out masks... [16:33] http://macslow.net/clips/animated-text.ogv [16:34] blurs, glows, drop-shadows [16:35] that screencast example shows fade-out masks (see top and bottom of scrolling text), drop-shadows and glows (very subtle in the text) [16:35] for those you'll need to deal with offscreen-rendering === Rusty is now known as Guest21431 [16:42] jledbetter_ asked: Which is better: Cairo or QPainter? [16:42] Ok, let's continue [16:44] so offscreen-rendering... [16:45] This "draws" into an non-visible memory area where you can perform any kind of manipulation before finally blitting the end-result to the screen for the user to see. [16:47] With the scrolling-text example from the last screencast, the text is drawn offscreen (with a transparent background) and then the upper and lower edges are earased using a gradient mask (about 10 pixels high) going from full to 0 opacity [16:47] after that's done it is then put on screen with the visual result of the text dissolving at the top and bottom edge [16:50] This approach is also used for doing the "glow" behind the text there. The glow is actually dark (almost) black to make the white text appear crisper. [16:50] In that case the text is initially rendered offscreen as a mask... [16:51] That mask is used to draw (offscreen again) the text in dark-grey... [16:51] This is blurred to give it the "glow"... [16:51] then the same text-mask is used to paint in white over it... [16:52] only now the assembled result is them blit on screen [16:54] Ok, so much for this short glimpse into the world of UI/bling hacking. [16:55] Now is hte time to ask any sort of UI/graphics related questions you didn't see fitting before. [16:58] AlanBell_ asked: does the bling slow things down? all that double rendering and blurring sounds like a lot of work [16:58] Of course there is a burden for doing this. [16:58] But with clever caching you can eliminate some of the CPU/GPU-load [16:59] First of all if you on a CPU try to restrict the area to blur as much as you can... and cache the result, if you can/need to reuse it later. [17:00] next thing is to be clever about the algorithm to blur [17:00] it's easier on the CPU to do a box-blur than a full gaussian-blur === 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: Hello World in Python (and maybe a bit more) - Instructors: AlanBell [17:03] Hello and welcome to this Application Developer week session on Python. [17:03] This session is an introduction to Python from the very very beginning, I going to do my best to assume no prior knowledge at all. [17:03] just so I can see who is here say hi in the #ubuntu-classroom-chat channel o/ [17:04] great, good to see you all [17:04] Python is a programming language, but not a scary hard one. [17:04] nitrat_gray asked: hello [17:05] oh, clever nitrat_gray, and yes, that is a good demo of how to ask a question! [17:05] Python is kind of like BASIC, except you don't have to be embarrassed about saying you are a Python programmer! [17:05] OK, so lets get started. [17:05] So we are going to write a computer program, which is a set of instructions to the computer to tell it to do some interesting stuff for us. [17:06] Lets get set up first, we are going to need a text editor to write the instructions in and a terminal to tell the computer to do the instructions. [17:06] You will find the text editor and the terminal next to each other in the Applications-Accessories menu [17:06] go open both now and arrange the screen so you can see the IRC classroom and the editor and the terminal all at once [17:07] are we sitting comfortably with three windows on screen? [17:07] plain old text editor is perfect, none of your fancy IDEs for this session [17:08] Traditionally the first program you should write in any language is one to get the computer to say hello to the world! so lets do that. [17:08] in the text editor type the following: [17:08] print "Hello, World!" [17:09] that is it, your first program, now lets save it and run it (I did tell you it looked like BASIC) [17:09] file-save as and call it hello.py [17:09] this will save it into your home directory by default, fine for now, but you would probably want to be a bit more organised when doing something serious [17:10] jledbetter_ asked: Does it have to be in a certain dir? [17:10] no, not particularly [17:10] ok, now in the terminal lets run the program [17:10] python hello.py [17:11] doesn't matter so much where you save the program, but always save your python programs with a name ending in .py [17:11] It should respond by greeting the world in a friendly fashion [17:11] so at the $ prompt in the terminal you just type "python hello.py" [17:12] as we saved the hello.py in the home directory and the termial opens by default to the home directory it should just kinda work [17:12] if you save it somewhere else you would use the cd command in the terminal to go to the right place === harry is now known as Guest9592 [17:13] ok, so that was running the program by running python then the name of our application, but we can do it a different way, by telling Ubuntu that our program is executable [17:14] What we are going to do now is try to make our program directly executable, in the terminal we are going to CHange the MODe of the program to tell Ubuntu that it is eXecutable [17:14] so at the $ prompt of the terminal type: [17:14] chmod +x hello.py === Mrokii_ is now known as Mrokii [17:14] now we can try to run it [17:14] again at the $ prompt [17:14] ./hello.py [17:15] oh noes!!! [17:15] Warning: unknown mime-type for "Hello, World!" -- using "application/octet-stream" [17:15] ubuntu doesn't know how to run this application yet, we need to add some extra magic at the top of our program to help it understand what to do with it. [17:16] back in the editor, above the print "Hello, World!" add the following line [17:16] #!/usr/bin/env python [17:17] so the /usr/bin/env bit is some magic that helps it find stuff, and the thing it needs to run this application is python [17:17] now you should be able to save that and flip back to the terminal and run your program [17:17] ./hello.py [17:18] ok, so the magic line at the top you don't need to worry about too much, it just has to be there or you might end up seeing that error message [17:19] AbhiJit asked: i remember that '#' is used to comment something. but here why we have commented? and if we commented then how ubuntu knows what to do? [17:19] excellent question [17:19] from the point of view of python that is indeed a comment that it ignores [17:19] so when you run python hello.py it will ignore the first line, it doesn't care [17:20] the #!something bit is read by bash (I think) [17:20] it checks the first two bytes for #! then looks at the rest of the line for instructions on what to do with it [17:20] quite a lot of different file types start with #! [17:21] ok, everyone have a running program now? [17:22] OK, lets go on to the next concept, giving our program some structure [17:22] back to the editor, and between the two lines we have already add a new line [17:22] while 2+2==4: [17:22] and on the next line put four spaces before the print "Hello, World!" [17:23] save that [17:23] so the while statement starts a loop, in this instance it will carry on until 2+2 is equal to something other than 4 [17:23] the double equals means "is equal to" a single equals is used to assign a value to something (more on that later) [17:24] the colon at the end is an important part of the while statement. [17:24] There is no "until" "wend" "end while" type statement at the end, as you might expect to find in lesser languages :) [17:24] the indentation of the print statement is not just cosmetic and for our benefit [17:25] the indentation level is part of the language, when the indentation stops that is the end of the loop (or other structure that you might expect to have an end) [17:25] this means that python always looks neat and tidy (or it doesn't work) [17:26] Always use four spaces to indent, not three, not five and certainly not a tab. [17:26] Other indentations will work, but if you ever have to work with anyone else you must always be using the same indentation, so we all get in the habit of using four spaces. [17:26] Lets run our new program, just save it in the editor and run it again in the terminal with ./hello.py [17:26] jledbetter_ asked: 4 always? So if nesting, 8 spaces? [17:27] yes, 4 spaces per level of indentation [17:27] so if you have a for loop inside a while loop the inner code would be 8 spaces deep [17:27] skkeeper asked: not using a TAB is a matter guaranteeing the code works on multiple platforms right? [17:28] no, not so much, tabs are portable. In fact I kinda wish the convention was tabs. [17:28] the issue is portability amongst humans [17:28] if you have two humans working on some code, one likes 4 spaces the other likes tabs you are going to get a ton of errors [17:29] in gedit if you go to the preferences window, editor tab [17:29] you can set the tab width to 4 and check the box Insert spaces instead of tabs [17:29] ok, so you have the program running now? [17:30] now we can wait for 2+2 to be something other than 4. [17:30] or, if you are in a hurry, you can press ctrl+c [17:31] ok, so ctrl+c is handy for breaking in to an out-of-control python program [17:31] you can do other fun stuff with the print statement, if you change it to read: === david is now known as Guest1580 [17:31] print "Ubuntu totally rocks! ", [17:32] and run it again (note the comma at the end) [17:32] you will see it doesn't do a newline and fills your terminal with stuff [17:32] ctrl+c again to break out of it [17:32] OK, that was fun wasn't it! [17:33] lets do something different now [17:33] in the terminal, type python at the $ prompt and hit return [17:33] you should have a >>> prompt and a cursor [17:33] this is the interactive python console [17:34] you can type print "hello" here if you want [17:34] or do some maths like: [17:34] print 2**1000 [17:34] which will show you the result of 2 multiplied by itself a thousand times [17:34] python is kinda good at maths [17:35] you could even try "print 2**100000" it won't take long, and you can always stop it with ctrl+c [17:35] AbhiJit asked: what does ** means in 2**1000? [17:35] 2 to the power of 1000 [17:35] or 2*2*2*2 . . . . [17:36] as mhall119 points out, in the console you don't really need the print statement (but I like it) [17:37] while we are on the subject of maths, lets get the value of pi [17:37] print pi won't do anything useful (but feel free to try it) [17:37] we need more maths ability than the python language has built in [17:37] so we need to get a library of specialist maths stuff, so type [17:37] import math [17:38] it will look like it did nothing, but don't worry [17:38] print math.pi [17:38] that should return 3.14159265359 [17:38] So we have seen here how to import a library of functions to do something, and called one of the functions from the library [17:38] resno asked: How do you know where packages are and which to import? [17:39] there are stacks of python packages in Ubuntu, have a look in synaptic at everything starting "python-" as to what is in them, just getting to that . . . [17:40] ok, so what is in the math package, apart from pi? [17:40] try typing dir(math) at the python console [17:40] ['__doc__', '__name__', '__package__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'hypot', 'isinf', 'isnan', 'ldexp', 'log', 'log10', 'log1p', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc'] [17:41] you can also look at http://docs.python.org/library/math.html [17:42] skkeeper asked: How can I ask for a more precise value of pi? [17:42] skkeeper: I have no idea! I am sure there is a library for that [17:43] dir() is a good way to find out what something can do for you [17:43] there is also a help() command which is useful [17:45] All this command line stuff is all very well, but we want to do applications that have pretty windows and stuff! [17:45] In the interactive console type or paste the following [17:45] import gtk [17:45] which will load a library full of stuff to do with the gtk toolkit that powers the gnome desktop [17:45] foo=gtk.Window(gtk.WINDOW_TOPLEVEL) [17:46] that assigns a window object to a variable called foo [17:46] (the name doesn't matter, the single equals does) [17:46] but nothing much seems to have happened yet, so type: [17:46] foo.show() [17:46] yay, a real live little window should be on screen now! [17:47] lets see what we can do to it with dir(foo) [17:47] quite a lot! lets try: [17:47] foo.set_title("my little window") [17:47] I think you have to click on your window for the title to update [17:48] go ahead and change the title a few times [17:48] nitrat_gray asked: are all the class references case-sensitive? [17:48] bas89 asked: is it with Qt as easy as with gtk? [17:49] there is a certain amount of case sensitivity, but there are conventions on how to use case [17:49] http://www.python.org/dev/peps/pep-0008/ [17:49] the style guide has more detail on case conventions [17:50] yes, I believe QT is just as easy as GTK [17:50] when developing applications you would generally use an IDE and a user interface builder like Glade, what I want to show today is the relationship between command line code and windowing code and the lack of special magic required! [17:51] resno asked: What is the best source to learn more python? python.net? [17:51] there are a number of books that are good [17:51] I like Snake Wrangling for kids [17:52] also there is a book in the repos called dive into python [17:52] as to the snake questions, python is indeed a snake, but it was named after the Monty Python comedy series [17:53] I should really have used spam as my window variable name rather than foo [17:53] oh yeah, the oreilly learning python book with a rat on the cover is on my desk [17:53] ok, so now lets recap on what we have covered [17:53] #!/usr/bin/env python goes at the top of your file [17:54] loops don't have end statements, the indentation is part of the syntax and makes end statements redundant [17:54] indentation is 4 spaces [17:54] not 3, not 5 [17:54] not tabs [17:54] 4 [17:54] libraries are collections of useful stuff, loaded with the import statement [17:54] Python is easy and fun! [17:55] oh yeah, and as mentioned in the -chat to get out of the interactive python console do ctrl+d or exit() [17:55] or quit() [17:55] great, 5 minutes or so for questions, and keep them easy because I am not that good a programmer :) [17:56] recommended IDE, well I like gedit, it does python syntax highlighting which is awesome (does it automatically on files ending in .py) [17:56] there is also SPE which used to be my favorite [17:57] stani's python editor [17:57] and stani is the person who designed an awesome bit of dutch currency [17:57] !info spe [17:57] oh, no bot to do that :( [17:58] AbhiJit asked: is for(i=0;i<=10;i++): is right? [17:58] lmh74 asked: best IDE for python in my opinion is Geany with the VTE, very light weight but effective [17:58] AbhiJit asked: i actually wanted for,while,do while syntax. please? [17:58] bas89 asked: What software is good for designing GUIs? [17:58] AbhiJit: nope, not quite [17:59] try this [17:59] for i in range(10): [18:00] the for statement itterates over arrays and collections, range makes an array of the numbers 0 to 10 [18:00] geany sounds good === 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: Contributing without the Command Line - Instructors: doctormo - Slides: http://divajutta.com/doctormo/foo/slides/ [18:00] oh I am done! [18:00] Slides for Contributing without the Command Line: http://divajutta.com/doctormo/foo/slides/ [18:02] thanks AlanBell! [18:02] Next up is doctormo with Contributing without the Command Line [18:02] Hello everyone [18:03] Once you have something to contribute to a project, or a project of your own to get busy with. You need to be able to store your files and share them with outs. [18:03] others* [18:03] Traditionally in programming this is done with a repository system. This is a system which logs your files and the changes you make to them. [18:04] The system used in Ubuntu is bazaar (bzr) but it's quite possible to do development with git or mecural. there does exist other repositories cvs and svn but use is discouraged now that we have good distributed repositories. [18:05] The problem with all of these systems for storing files [18:05] Is that they all use the command line [18:05] And many programmers like the command line [18:05] With is fine [18:05] Which is fine* [18:05] But there are plenty of contributions, developing an application which are not programming and could quite reasonably be done by someone who has never used the command line. [18:06] which is why I'll be talking about how you can contribute to a project and use these repositories without ever touching the command line. [18:07] http://divajutta.com/doctormo/foo/slides/slide-00.png [18:07] OK so first, show of hands who's listening in on chat? [18:09] OK so for this exercise we have some requirements [18:09] http://divajutta.com/doctormo/foo/slides/slide-01.png [18:09] You'll need Ubuntu or Design with gnome and we'll be using you launchpad account. [18:11] OK so the first thing to do is to install groundcontrol, you can install this package via the command line or via the Software Center. [18:12] Ground control was designed to let users interact with launchpad and bazaar in a way that made it fun and easy to code, design and do other things. [18:12] http://divajutta.com/doctormo/foo/slides/slide-02.png [18:13] If you've got groundcontrol installed, then let's begin [18:13] http://divajutta.com/doctormo/foo/slides/slide-03.png [18:13] Go to System > Preferences > Ground Control Configuration [18:14] In here you will press the button to log onto your language account, enter your email address and password and wait for launchpad to give your keys. [18:15] Now for those who have not done development on launchpad before, you will be asked to create some ssh keys. These are keys that allow you to securely interact with launchpad bzr branches. [18:16] Once complete, you should have a fully set up development environment. Congratulations! [18:17] Now all you have to do is go to Places > Home Folder. You will get a nautilus window and in there you should have a new Projects folder [18:17] this folder will be used to hold projects downloaded from launchpad (you can rename it and move it anywhere you like) [18:20] Once inside the Projects folder you will find a bar on the top, in that bar will be two buttons. [18:21] Something like this: http://doctormo.ubuntu-ma.us/wp-content/uploads/2010/01/screenshot1.png [18:21] The Get Project button will pop up a window to search for a launchpad project. We're going to do a search for groundcontrol it's self. [18:22] Fetch Project* [18:23] If you don't see that bar then it's because nautilus needs to restart, you could do this with a computer restart, but we'll just do this: Alt+F2 and type in nautilus --quit [18:23] It'll automatically reload. [18:23] Normally the groundcontrol packagaing restarts nautilus for you, but restarting nautilus is a known hazard. [18:26] OK so I'll let those people catch up http://divajutta.com/doctormo/foo/slides/Screenshot.png [18:27] Now once you've pressed ok on the project search/select window, ground control will download the project from launchpad and make a new groundcontrol folder. [18:28] Navigating into that directory will give you a new set of buttons, one of which is "Fetch Branch" [18:28] Click on that [18:28] When it loads, click on the Trunk branch, give it a name or put your name in the "local branch name:" field. [18:29] When you press ok it's download the branch [18:29] http://divajutta.com/doctormo/foo/slides/Screenshot-1.png [18:30] you will have new folder [18:30] What will will do is go into this folder and edit the README file === pedro__ is now known as pedro3005 [18:31] this is a very important point about ground control and the "Desktop as your IDE" theme. [18:31] GC and projects like her do not reinvent the IDE wheel by trying to manage your code, or giving you editors. There are far too many types of files to make an IDE with all kinds of editors possible. [18:31] So use what you like to edit the files you want to. [18:32] when you save the file, you should notice that the buttons in this bar have changed to "Commit Files" [18:32] Commit Changes* [18:34] I just discovered there is an error here, but it's new and never been seen before. So it'll have to be reported after this session ends. [18:34] You should still have downloaded a branch however. [18:36] If you see a "Read Only Branch" message, this is because the error causes the configuration to be wrong, it never sets a push location so you can't commit code. [18:39] So you can show hidden files, go into a directory called .bzr then into brach and edit a file called branch.conf [18:40] In here there should have been set the push_location = bzr+ssh://bazaar.launchpad.net/~[username]/groundcontrol/[your-banch-name]/ [18:41] If you do manage to set that and tell natulus to browse the branch directory again, you should have a commit button instead of a read only warning. [18:42] Pressing the commit button will allow you to specify what you changed: http://divajutta.com/doctormo/foo/slides/Screenshot-2.png [18:42] Once that's done we'll need to upload, it's a simple matter of pressing the Upload Branch button that appears. === linux is now known as azubit [18:48] OK I tried this with another project and it worked fine... something about ground control's lp project perhaps. If you are having dificulty then please download the ubuntu-learning-materials project using the method above. [18:48] And download the website branch and modify that and continue on from there... [18:49] Once you've uploaded your changes you'll be presented with a Request Merge button, this part is not in bzr. [18:50] http://divajutta.com/doctormo/foo/slides/Screenshot-3.png [18:50] This will let the project owners know that you've completed some work and you'd like it to be reviewed and merged in. [18:51] Congratulations, if you've managed to dodge the trip wires in this session, you'll have contributed to ubuntu and it's projects. [18:51] There is more functionality to groundcontrol that allows project maintainers to merge-in, and you can specify bugs and so on when doing commits. play with it. [18:51] Now I will answer some questions. [18:53] Question: Can I erase the groundcontrol folder whit nautilus? or I have to use another method? [18:53] I don't understand this question [18:53] QUESTION: can name contain spaces? do they need to be escaped or quoted or can they just be typed normally? [18:53] Branch names should probably not contain spaces. [18:54] QUESTION: So once I download a project and modify its source (lets say fix a big, implement a feature, etc), all I have to do is commit it for review? The file I modified will be uploaded for review? [18:54] Yes, you've made a branch of the original code and the project owners can see the changes you've made. [18:54] Question: Is there a way to views diffs from within nautilus (right-click/diffs with previous version...)? [18:54] Use the commit window, clicking on any file will show you a diff [18:54] QUESTION: What does GC do when it say "Loading Launchpad"? Why does it take so long and why is there a need for GC to do that just to search for a project on launchpad? [18:55] It's getting a brand new OAuth token each time, it takes time and isn't very good. [18:55] MAfifi asked: How's that different from the explorer plugin in bzr for example? [18:56] the bzr explorer and gtk-bazaar plugins are designed around the idea of providing ALL of bazaar functionality into nautilus with very little workflow design. It's the command line for your browser. [18:56] GC on the otherhand is more a tool for the launchpad/bazaar development workflow rather than just being a bzr tool. [18:57] It has all the social rules built in and best practices. [18:57] MAfifi asked: How's that different from the explorer plugin in bzr for example? [18:57] MAfifi asked: Does it work with nautilus only? Can it work with dolphin in KDE as well? [18:58] the version in lucid and maverick only work in gnome/nautilus. There is no reason it couldn't work in kde/dolphin. Just needs a developer to do the work. === sdonatas is now known as donatas-lt [19:00] CajunTechie asked: Can I create a new project using GC? I notice that was scheduled for inclusion but don't see it anywhere [19:00] The current version in lucid can not create projects. [19:00] sinisterstuf asked: Can I delete my local branch just by selecting the folder in nautilus and moving it to the deleted items folder? === 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: Writing a dataprovider for Zeitgeist - Instructors: thekorn [19:03] Okidoki, I guess it's my turn now.... [19:04] Hi, everybody, my name is Markus Korn, I'm one of the Maintainers of zeitgeist, and I would like to talk to you about ways to get your apps data into zeitgeist [19:04] so, first of all, What's zeitgeist? [19:05] zeitgeist started as one result of the 2008 Boston user experience hackfest [19:05] it started with a full featured UI, which was call gnome-journal [19:05] and it's basic idea ist to track 'events' on your desktop [19:05] so, first of all, what's an event [19:05] . [19:06] An event is something you do on your computer, [19:06] like opening files, visting web pages, swithing the focus of your application, and so on [19:07] GNOME (and I'm sure other systems like KDE have one too) has something called "recently used documents" [19:07] you can see them in the places menu [19:07] but zeitgeist is more than that [19:07] it tries to provide a unified way for ALL your events [19:08] so yo don't have the history of all your browsers, the history of played songs, etc. [19:08] . [19:08] And zeitgeist needs the applications to feed their events into the zeitgeist system, [19:09] and that's what this talk is baout [19:09] any question so far? [19:09] or can we start with some coding ;) [19:10] augdawg> what webrowsers use zeitgeist? [19:10] right now we support firefox, chromium, epiphany, and support for opera is in developemnt [19:11] . [19:11] so that's the plan for this Session: we all know this beautiful app called software-center [19:12] and how cool would it be if we can track the applications you visit in the app by zeitgeist [19:12] so whenever you open an app page there, track a zeitgeist event [19:12] . [19:12] to follow this example, you have to option, [19:12] +s [19:13] 1.) try to follow the steps I do here on this channel locally, [19:13] or [19:14] 2.) just read, and I will try to paste as much code as possible on the internet, I'll give you links [19:14] . [19:14] first of all, we need some software installed, so please run [19:14] sudo apt-get install intltool raptor-utils python-sphinx bzr [19:14] . [19:14] btw, please tell me when I'm too fast/slow [19:14] . [19:15] augdawg asked: what language will we be using? [19:15] in this example we will use python, [19:16] but as you find out soon, you talk to zeitgeist using dbus, [19:16] so you can basically try to reproduce the examples in any language which has dbus support [19:16] . [19:17] just a small note to the users using unity, or which have zeitgeist already installed and running on their system, [19:17] you might want to backup your activity log, so just incase we insert some garbage, you can restore your old database after this session, [19:17] to do so please run [19:18] cp ~/.local/share/zeitgeist/activity.sqlite ~/Desktop [19:18] . [19:18] I think everybody should now have the app installed, let's get started [19:19] cd ~ [19:19] (so we are all in the same dir, please use any other dir if you like) [19:19] now we get the zeitgeist source [19:19] wget http://edge.launchpad.net/zeitgeist/0.5/0.5.2/+download/zeitgeist-0.5.2.tar.gz [19:19] tar xzf zeitgeist-0.5.2.tar.gz [19:19] cd zeitgeist-0.5.2 [19:19] ...and unpack it [19:20] ...and now we just build zeitgeist [19:20] ./configure [19:20] make [19:20] this might take a while [19:23] ok, next step is to run zeitgeist [19:24] upps, I'm too fast :( [19:24] loet's have some questions first [19:24] sinisterstuf asked: What is dbus? [19:24] dbus is a way for applications to communicate to each other using a socket [19:26] QUESTION : so zeitgeist is written in python? [19:26] yes it is [19:27] to run zeitgeist, we need a clean environment [19:27] mkdir /tmp/zeitgeist-data [19:27] export ZEITGEIST_DATA_PATH=/tmp/zeitgeist-data [19:27] this tells zeitgeist where to write the data [19:28] and now we can run the daemon [19:28] ./zeitgeist-daemon --no-datahub --replace [19:28] --replace should kill any running zeitgeist instances [19:28] so far so good, we now have a running zeitgeist instace, which we can feed data into [19:29] let's open a new terminal, and start writing a plugin to software-center which does the job [19:29] . [19:30] . [19:31] ok, let's say the deamon is running, open a new terminal, and run [19:31] export PYTHONPATH=~/zeitgeist-0.5.2 [19:32] this will tell software-center where to find the zeitgeist modul [19:33] and now we can start writing the software-center plugin.... [19:33] let's get a first version [19:33] bzr cat -r 1 http://bazaar.launchpad.net/~thekorn/+junk/softwarecenter-zeitgeist-plugin/softwarecenter-zeitgeist-plugin.py > ~/zeitgeist-plugin.py [19:34] (or for the people who just want to see the code http://bazaar.launchpad.net/~thekorn/%2Bjunk/softwarecenter-zeitgeist-plugin/annotate/1/softwarecenter-zeitgeist-plugin.py) [19:34] this is a *very* minimal plugin for software-center [19:34] . [19:35] unfortunatly s-c has no other way to load the plugin then loading it from some system dir [19:35] so, let's symlink this file to the right place [19:36] sudo mkdir -p /usr/share/software-center/plugins [19:36] cd /usr/share/software-center/plugins [19:36] sudo ln -s ~/zeitgeist-plugin.py . [19:36] cd ~ [19:37] . [19:37] has everybody done this successfully? [19:37] . [19:38] if you now run software-center --debug from the terminal you should see the loading message somewhere [19:38] . [19:39] but anyway, this plugin does nothing so far [19:39] let's pimp it [19:39] bzr cat -r 2 http://bazaar.launchpad.net/~thekorn/+junk/softwarecenter-zeitgeist-plugin/softwarecenter-zeitgeist-plugin.py > ~/zeitgeist-plugin.py [19:39] or [19:39] http://bazaar.launchpad.net/~thekorn/%2Bjunk/softwarecenter-zeitgeist-plugin/annotate/2/softwarecenter-zeitgeist-plugin.py [19:39] for the reader out there ;) [19:40] this code does two things [19:40] 1.) it creates a connection to the zeitgeist daemon, [19:40] by running ZeitgeistClient() [19:41] 2.) it connects to the signal of software-center which indicates a user switching the view [19:42] now run software-center --debug again, and you should see some logging when you swith between applications [19:42] by switching I mean "clicking the "read more" button [19:42] . [19:43] is it working so far for everybody? [19:43] great [19:45] aseem24 asked: it's working but i get this on my terminal..DEBUG:root:run_thumb_missing_js [19:45] this just sounds like a debugging message from s-c, nothing to care about [19:46] let's just ignore it for now [19:46] iamlouis asked: when I change view should I see anything in the zeitgeist terminal output? Using rev 2 of the plugin [19:46] nothing yet, we come to it NOW! [19:47] bzr cat -r 3 http://bazaar.launchpad.net/~thekorn/+junk/softwarecenter-zeitgeist-plugin/softwarecenter-zeitgeist-plugin.py > ~/zeitgeist-plugin.py [19:47] (or, again: http://bazaar.launchpad.net/~thekorn/%2Bjunk/softwarecenter-zeitgeist-plugin/annotate/3/softwarecenter-zeitgeist-plugin.py) [19:48] now, this change actually tells s-c which event to insert into zeitgeist === harry is now known as Guest47664 [19:48] I'll paste it here, because it's important ;) [19:48] event = Event.new_for_values( [19:48] interpretation=Interpretation.ACCESS_EVENT, [19:48] manifestation=Manifestation.USER_ACTIVITY, [19:48] actor="application://software-center.desktop", [19:48] subject_uri="application://%s" %app.pkgname, [19:48] subject_interpretation=Interpretation.SOFTWARE, [19:48] subject_manifestation=Manifestation.SOFTWARE_ITEM, [19:48] ) [19:48] as you can see, Events do have a certain structure [19:52] thekorn is after losing connection so he cant type in here :/ === thekorn_ is now known as thekorn [19:53] * thekorn checks the mic... [19:53] let's continue with the structure of Events [19:54] event = Event.new_for_values( [19:54] interpretation=Interpretation.ACCESS_EVENT, [19:54] manifestation=Manifestation.USER_ACTIVITY, [19:54] actor="application://software-center.desktop", [19:54] subject_uri="application://%s" %app.pkgname, [19:54] subject_interpretation=Interpretation.SOFTWARE, [19:54] subject_manifestation=Manifestation.SOFTWARE_ITEM, [19:54] ) [19:54] events have na interpretation, [19:54] which means: what is the event about [19:54] a manifestation, which is: who does something [19:54] and it has an actor [19:55] which is, who does something [19:55] so in this case, the s-c app visits an application page on behalf of the user [19:56] testtest asked: ?:Thoughts on privacy, user opt-out? [19:56] yes, we have ways to blacklist certain events [19:56] and there are already UIs implementing this [19:56] it is call Backlist in our terms [19:57] okidoki, I've only four minutes left [19:57] and I'm a bit running out of time [19:57] the last revision (revno 3) is basically a working dataprovider for s-c [19:58] so whenever you start s-c now, and visit an application's page [19:58] an event should be inserted into zeitgeist [19:59] one of our devs Seif Lotfy will talk about ways to get this data back later this week [19:59] . [19:59] I would like to end this session with some ressource: [19:59] first of all, if you are interressted in this project, or have any questions, please join us in the #zeitgeist channel [20:00] or visit our webpage at www.zeitgeist-project.com [20:00] or our launchpad page at launchpad.net/zeitgeist === 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: Making Programs with Quickly in Vala - Instructors: fagan [20:00] we also have bindings for other languages like C, C#, vala, java, etc. [20:00] * fagan loves vala [20:01] thanks thekorn :) [20:01] Ok hi everyone [20:01] and im going to talk about the infamous quickly [20:02] So to start this is a preview release of the Quickly Vala template. [20:02] Its not in the repo yet and is very very new. It has a good lot of things working so far but not packaging or building. [20:02] Also translations are not working yet properly because it relies on the build systems for Vala. [20:03] Its still a good start and is usable at the moment for little projects that you want to do. [20:03] Oh and if you have questions ill be looking at the chat so ill get to them as soon as i can. [20:03] So lets get this started then [20:04] first we need to prepare a little to run this template you need quickly and Valac installed so if you don't have them run this command please: [20:04] sudo apt-get install quickly valac [20:05] augdawg asked: when it hits the repos, i assume it wil do this automatically right? [20:05] Well I didnt want it in the maverick repos [20:05] Im waiting for the build issues and other stuff to be fixed first [20:06] Now lets start get the template [20:06] so open up the terminal and type: [20:06] mkdir quickly-templates;cd quickly-templates;bzr branch lp:~shanepatrickfagan/quickly/Quickly-vala [20:07] (in the root directory of your home) [20:07] Now you should have everything you need [20:07] Is everyone good? [20:07] Ok ill slow down a bit :) [20:08] ok so moving on [20:08] lets get making programs then [20:08] ok get out of the quickly templates directory: cd .. [20:08] run this command in terminal to get your project created: [20:09] quickly create Quickly-vala [20:09] Good? [20:10] Now our project is set up and the directory is created. [20:10] So now go into your project directory [20:10] cd [20:10] So are you all there? [20:11] So in this directory you will see a /bin /data and two text files so its very similar to the other quickly projects that you may have used before. [20:11] you can now run the project with [20:11] quickly run [20:11] just like the python templates [20:12] This command does a few things it compiles the .vala file and runs it. [20:12] so it needs to do a few things to get the .vala file up and running but its in the background so its all good [20:12] Ill get into the problems with doing this in a little while but first ill get you developing. [20:12] Oki doke so moving on [20:13] anymore questions? [20:13] ok so [20:14] So do get editing your code use: [20:14] quickly edit [20:14] Just like the python template :) [20:14] At the moment I only have 1 .vala project file I plan on adding the about box very soon too. [20:15] augdawg asked: can you use glade to desgin a gui? [20:15] yep [20:15] So in gedit you should see the base of a class. So to start developing all you need to do is scroll down to the bottom of the page and look for the line that says "write your code here". [20:15] beardygnome asked: i'm running xubuntu - do i need to install gedit? [20:15] sorry about that [20:15] its a bug [20:16] Ill be fixing it later in the week [20:16] beardygnome asked: or can i use geany? [20:16] Yep you can [20:16] you just have to double click on the .vala files to edit it [20:16] but still thats a bug [20:16] my bad [20:17] the warning you can ignore [20:17] its a problem with glade and vala not being entirely in sync [20:17] So in gedit you should see the base of a class. So to start developing all you need to do is scroll down to the bottom of the page and look for the line that says "write your code here". [20:17] so its fairly easy to use [20:17] and hopefully there is enough comments to guide you guys [20:18] Oh and on that I tried to use xdg-open instead of just using gedit *.vala but it wasnt working right so I left it. [20:18] thats the way I was originally going to do it [20:18] it doesnt handle multiple files [20:18] so thats why I dropped it [20:19] anyway all the other stuff on the page is gtk and glade stuff [20:19] so you can ignore all of that [20:19] just write your code below the comment saying write your code here [20:19] Here is the link to the Vala docs to get started and developing with code examples: [20:19] augdawg asked: what is this written in? [20:19] Well thats a good question actually [20:20] the template is written in sh scripts really [20:20] and the template is for vala so its vala there [20:20] and the create command is pulled from quickly itself so its in python [20:20] and the ui is glade [20:20] ok so [20:20] moving on [20:20] Here is the link to the Vala docs to get started and developing with code examples: [20:20] http://live.gnome.org/Vala/Documentation [20:21] They have most of the code that you will be looking for already there. So just have a poke about and they will give you tutorials on everything [20:21] for beginners to more advanced stuff [20:21] So I should say how to do the glade thing and can you guess what the command is? [20:21] quickly design [20:22] just like the python quickly projects [20:22] :) [20:22] Oh I should say how to add your listeners to the code for glade events [20:22] If you want to create listeners for the widgets you add you just have to use code similar to how I wrote the quit menu item handler in the template itself. Like this: [20:23] [CCode (cname = "G_MODULE_EXPORT name_of_event")] [20:23] public void name_of_event () { [20:23] // code here [20:23] } [20:23] You put the name of your event in there instead for both bits. [20:23] (the name in glade itself) [20:23] oh and the CCode bit is just so it will work on windows too but I like leaving it in anyway even though I wont be porting anything to windows. [20:24] so is everyone still with me? [20:24] * fagan moves very fast [20:25] ok I broke quickly design yesterday [20:25] its just the wrong directoy [20:25] ill fix it after this [20:25] my bad [20:26] or data [20:26] sorry [20:26] damn [20:26] anyhow ill move on [20:26] :P [20:26] So we now have you guys editing your projects so what if you add extra classes to the project or you start using an external binding other than gtk+ or glib? [20:27] thats the problem with vala [20:27] You will have to add the binding to the run method with this command: [20:27] quickly edit_run [20:27] and then you will get your editor and have to add the --pkg to compile it properly [20:27] so if you have used Vala before you would know what to add but if you don't its just: [20:27] --pkg [20:28] and I have the code commented so you guys should find it fairly easily [20:28] Sorry about this problem but we are going to work on this for 11.04 and was the main reason we haven't released it yet. [20:28] its a challenge for me to fix :) [20:28] ok so thats most of the work so far [20:29] is anyone having problems with anything other the quickly design command [20:29] ? [20:29] or do you guys have any questions? [20:29] testtest asked: how many terminals should I have open for this [20:30] Well only 1 is needed [20:30] you can type them in a line [20:30] beardygnome asked: what should quickly edit_run have done? it just ran the app when i tried it. [20:30] huh [20:31] oh now I get why it did that [20:31] its not picking it up as a text file [20:31] fail [20:31] :) [20:31] just gedit .run [20:31] and it will do it [20:31] I used xdg-open and it didnt open the text file :/ [20:32] anyhow if there are no more questions ill get into what my plans are [20:32] any takers? [20:32] good good [20:32] Ok so my plans are for 11.04 and beyond. [20:32] Well like quickly itself I really want to make things easy. I want everything to be automated and done for the user without much input. [20:33] So my plan for the end is to have 1 config file for the users to edit and all that needs to be inputted is authors info like email and name, category (for the menu entry), URL, description and long description. [20:33] so that packaging and building is as easy as possable [20:34] So all of that is in the python template now but you have to edit the authors file, desktop.in and the setup.py file. The way im thinking is to do it in 1 file and make it more invisible how the magic is done. [20:34] so the python template is a little bit hard if you didnt see any tutorials on how to do it [20:35] My idea is to have that all in one text file. How its displayed is up for discussion and ill talk about that at the UDS probably. (ill be participating remotely). [20:35] I also plan on having packaging and building done properly for 11.04 which is going to take most of the cycle and involves a lot of things. [20:36] 1. Detecting depends so the user doesn't have to do the --pkg thing or have to use makefiles and all of that crap. [20:36] (this is a big problem with vala in terms of new developers) [20:36] 2. a great build system (this is going to be done with buildj hopefully) and a standard project directory layout so we just have to scan the dirs for files to detect what to add to the build. [20:37] 3. packaging stuff but since this really relies on 1 and 2 its going to be done last. Plus im not a motu or do any packaging in general so the tools are quite new for me so it will take a little bit of fiddling. (if anyone wants to help with this ill buy you a drink sometime for your trouble) [20:37] thats a lot of hard work for 1 cycle :) [20:38] ohter than that and some other boring stuff ill just be updating the template a little [20:38] to make it a little bit more like the python template [20:39] which is awesome [20:39] and I might give desktopcouch a try in vala [20:39] if the binding is there [20:39] ok any more questions? [20:39] I have just a little bit more [20:40] ok so no questions? [20:40] moving on then [20:40] oooh [20:40] someone has one [20:41] beardygnome > can we use pdb for debugging (i see there's a session on this later this week) [20:41] well debugging is built into the valac compiler [20:41] and it does give out some awesome info [20:42] so there is no reason to use phb [20:42] anyhow [20:42] so im starting to run out of things to talk about so ill just go into the "why use Vala over python?" question [20:43] Well the simplest answer is that Vala is a lot lot faster than python and its very well integrated into the gnome platform. [20:43] The other answer is that its the perfect language to got to if you started programming in Java or C# (if you don't want to use mono) oh and did I say its faster than both of those languages too. [20:44] beardygnome asked: i have one [20:44] lol [20:45] Didnt mean to paste that one :/ [20:45] QUESTION : there is no intermediate language in vala right ? [20:45] I dont have a clue what the question is :) [20:45] If anyone is wondering how its faster its because Vala is more or less a big wrapper over C. [20:46] Valac the Vala complier converts your code to to C then uses the C complier to make the binary. C is one of the oldest modern languages (its about 40 years old now) and is by a good stretch the fastest. [20:46] jthompson asked: Did you mention Vala run in Windows? Does it use GTK for the GUI layer? [20:46] I kinda glossed over the vala on windows thing [20:46] but yeah it does work on windows [20:46] and it does use GTK [20:46] you can get an installer for both im pretty sure on windows [20:47] but you do have to change your / to \ [20:47] so the directories work [20:47] since windows is backwards [20:47] augdawg asked: is there a valac for windows? [20:47] yes [20:47] :) [20:48] http://live.gnome.org/Vala/ValaOnWindows [20:48] thanks for the link wutzara [20:48] thoughts on quickly work-flow, e.g. multiple terminals <-> new developers? [20:48] Well you can use quickly with a single terminal [20:49] but I have a small bug at the moment where it only allows one command at a time [20:49] so its a little bit bad [20:49] any more questions [20:49] I flew through the whole session [20:49] so im sorry if I was a little fast [20:50] w1ngnut asked: Don't know if was asked. Is there any IDE with code-completion for vala? [20:50] Yep geany is nice for that [20:50] and valide (I think thats the name) [20:51] valide is a plugin for gedit and it has autocompletion just like netbeans or visual studio [20:51] so its very nice [20:51] http://code.google.com/p/vtg/ [20:51] http://www.valaide.org/ [20:51] thanks chat for the links :) [20:52] augdawg asked: what do yu use? [20:52] well I use gedit [20:52] but I turn on the line numbering and i use different colours because the default ones are ugly [20:52] oh and I should give the tools page too http://live.gnome.org/Vala/Tools [20:53] jiga asked: I was previously using QT with c++, and I'm wondering, what are the benefits of quickly-vala over QT [20:53] great question [20:53] Well I dont have a clue about QT really or the state of its bindings with vala [20:53] but id say there are [20:53] so you wouldnt really need to use one or the other [20:54] well im almost out of time but keep the questions coming if you have them [20:54] :) [20:55] wutzara asked: is there autotools support in quickly-vala [20:56] Well I hate autotools [20:56] So im working with buildj for 11.04 hopefully [20:56] so we can have an easier way to build programs [20:56] augdawg asked: does vala have alot of module type thingies? [20:57] Well you have a lot of classes and bindings and stuff but all of them are similar to that in python [20:57] so its not any more than any other language [20:57] w1ngnut asked: Vala seems a good alternative for one coming from C# or java but the namespaces/methods inherit more from glib than the java-c# pattern. Do you have any tip for someone with experience on java-c# wanting to migrate/start learning vala? [20:57] Well the easiest way is to dive in [20:58] the tutorials are on the vala website [20:58] and since its very similar to C# and java its easy to switch to [20:58] the only major difference is instead of swing in java its GTK [20:58] but thats awesome [20:59] well since the syntax is very similar its fairly easy to switch [20:59] Ok so thanks for listening and if you have any problems with my template go to #quickly on freenode or if you want help with Vala itself go to #vala on gimpnet. Of course patches are welcome and I hope you guys like it. [20:59] Anyhow im out of time [20:59] :) [20:59] thanks everyone :P === 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 === Mahara is now known as Guest43620 === gorilla is now known as monkey_gorilla [23:51] what are you talking about now