fedora-flock-ectr101
LOGS
17:31:06 <mizmo> #startmeeting
17:31:06 <zodbot> Meeting started Sun Aug 11 17:31:06 2013 UTC.  The chair is mizmo. Information about MeetBot at http://wiki.debian.org/MeetBot.
17:31:06 <zodbot> Useful Commands: #action #agreed #halp #info #idea #link #topic.
17:31:22 <mizmo> Graduating to GUI: A PyGTK/PyGObject Workshop for Beginners
17:31:27 <mizmo> Presented by Paul Frields
17:31:28 <mizmo> Slides: http://flocktofedora.org/wp-content/uploads/2013/08/flock-2013-PyGObject-workshop1.pdf
17:31:36 <mizmo> Schedule Description: http://flock2013.sched.org/event/2c1b90de8c79a909b22a52cc35cd7416?iframe=no
17:31:44 <mizmo> Video stream: http://www.youtube.com/watch?v=CWcy3sgOWDQ&feature=youtu.be
17:31:48 * stickster now on IRC
17:32:06 <mizmo> stickster, ive got the slides open here in another window so if they cant be synched into g+ it's all good
17:33:36 <mizmo> (just let me know if you change the slide
17:34:09 <mizmo> We're going to give people a few more minutes to show up because there are 20 RSVPs and 3 people in the room. I'd like to have at least 6 people in here because of the way the workshop is structured.
17:34:10 <ianweller> mizmo: working fine?
17:34:16 <mizmo> ianweller, yep!!
17:34:23 <ianweller> woop woop
17:34:28 <ianweller> thx stickster
17:34:35 <ianweller> and mizmo of course :)
17:34:38 <stickster> OF course!
17:34:57 <mizmo> should we post hangout url then?
17:35:03 * mizmo has never tried that with hangout but is willing to try
17:36:10 <stickster> Yes, we probably should
17:36:20 <stickster> I didn't plan well on how to do remote collaboration for the exercises
17:36:23 <stickster> :-\
17:36:31 <stickster> I haven't either! It will be an adventure!
17:37:11 <mizmo> i found this https://plus.google.com/116045043409715285264/posts/9XnGzPvAUjL
17:37:32 <mizmo> grr not working now
17:38:10 <mizmo> stickster, can you grab the hangout url from the laptop?
17:38:26 <mizmo> it's not findable if you're not logged into the fedora admin account and the url i snagged from then isnt working
17:39:15 <mizmo> halp!
17:40:10 * mizmo still needs google hangout link
17:40:11 <mizmo> halp?
17:40:16 <mizmo> langdon, ^ ? :)
17:40:20 <langdon> asking
17:40:24 <mizmo> thanks
17:40:34 <stickster> that link you posted worked for me
17:40:43 <mizmo> it doesn't work for me
17:40:43 <stickster> If you have G+ it should work
17:40:50 <mizmo> when im logged in as me instead of fedora
17:40:56 <stickster> Oh
17:40:59 <mizmo> but i cant do it logged in as fedora it'll mess u up
17:41:12 <mizmo> it should be in the admin page
17:41:17 <mizmo> thanks
17:41:34 <mizmo> it only works if you're logged in as fedora
17:41:44 <mizmo> sorry :(
17:42:01 <mizmo> thanks!!
17:42:47 <mizmo> still borked
17:42:47 <stickster> Will you be OK?
17:43:08 <mizmo> mairin@gmail.com ?
17:43:09 * mizmo shrugs
17:43:16 <mizmo> i can just watch the stream and not hangout
17:43:23 <mizmo> dont want to mess everything up
17:43:32 <mizmo> it's all good
17:43:47 <mizmo> yeh g+ has privacy setting issues with their UI
17:43:54 <mizmo> well
17:43:59 <mizmo> maybe ill try the hangout as fedora and hope it doesnt mess u up
17:44:22 <mizmo> okay
17:44:23 <langdon> x-ing fingers :)
17:44:25 <mizmo> #topic Slides
17:44:39 * mizmo will just go off of stream for now, try hangout later
17:44:47 <mizmo> I've been working on variations of this talk fo ra couple of years now
17:44:57 <mizmo> The workshop format tends to work well, bc you tend to learn skills like this thru hands on
17:45:08 <mizmo> I'm going to spend 30 minutes on the slides and go quickly
17:45:19 <mizmo> I want to take a temperature on people's skill in here to now where I shuld spend more time
17:45:45 * mizmo occasional python script writer/reader
17:45:51 * mizmo read dive into python a long time ago
17:46:00 <mizmo> seems most people in the room have some familiarity
17:46:07 <mizmo> Paul recommends rading chapters 2-5 of diveintopython.org
17:46:12 <mizmo> it's a very quick read, very well-written
17:46:17 <mizmo> shows you elementary programming concepts in python
17:46:27 <mizmo> go through conditionals and loops and how they work in python
17:46:34 <mizmo> talks about object oriented programming and python as well
17:46:47 <mizmo> <slide 3>
17:47:42 <mizmo> yum install glade pygobject3 gtk3-devel-docs diveintopython
17:47:50 <mizmo> diveintopython available in many formats via yum too
17:47:58 <mizmo> consider ubying paper book to support author
17:48:05 <mizmo> don't have to be a super skilled programmer to do what we'll do today
17:48:22 <mizmo> if you're like matthias - he's a world renowed expert in the toolkit
17:48:27 <mizmo> dont need to be him :)
17:48:35 <mizmo> for hands on here, you'll need a few things installed -
17:48:49 <mizmo> yum groupinstall gnome-software-development
17:48:54 <mizmo> (i think i got the collection name wrong)
17:49:15 <mizmo> first we'll cover some concepts
17:49:21 <kilted1> "GNOME Software Development"
17:49:26 <mizmo> thanks kilted1
17:49:31 <mizmo> first i recommend you design your UI
17:49:33 <mizmo> design the flow
17:49:37 <mizmo> what are they supposed to see
17:49:42 <mizmo> what task are they trying to accomplish
17:49:48 <mizmo> draw on paper first if you need to
17:49:51 <mizmo> i have an app i wrote
17:49:55 <mizmo> hi :)
17:50:09 <mizmo> it didn't exist until i sat down at a conference, we talked about what i wanted to accomplish, and she helped sketch it out and simplify it -
17:50:32 <mizmo> i started implementing, then over time we figured out how to add in more features to the design
17:50:42 <mizmo> there's a tool that's helpful that will help design the bolts of the UI, it's called glade
17:51:01 <mizmo> spits out a UI file which is an xml definition
17:51:11 <mizmo> everything you draw glade can represent as an xml tree
17:51:17 <mizmo> in python you load that XML file
17:51:28 <mizmo> so anything you want user to interact with
17:51:34 <mizmo> you can reference using the name you gave that widget in glade
17:51:48 <mizmo> <slide 5 btw>
17:52:03 <mizmo> python treats them as objects
17:52:28 <mizmo> and then you'll assign functions to happen when the user interacts with an element in the UI
17:52:39 <mizmo> next slide <slide 6> is a picture of the glade UI
17:52:40 <mizmo> on the left
17:52:43 <mizmo> there's collections of widgets
17:52:49 <mizmo> those are basically drawing elements that you can stick into the UI
17:52:56 <mizmo> if you hover over each one it has a tooltip to tell you what it is
17:53:06 <mizmo> there's a picture here on the right, a tree when you have an object selected
17:53:11 <mizmo> it's a semi-graphical representation of the XML tree
17:53:29 <mizmo> at the bottom-right is a useful area that gives you options for each widget - help control appearance, scale, borders, etc
17:53:54 <mizmo> really clever, very easy button will give you a help section in developre help docs that referes to the object you're working with
17:54:06 <mizmo> review concept:
17:54:10 <mizmo> 1) create interface in glade
17:54:14 <mizmo> 2) save as XML file
17:54:15 <mizmo> <slide 8>
17:54:26 <mizmo> we'll cover key / high level GTK info
17:54:27 <mizmo> objects/widgets
17:54:29 <mizmo> signals
17:54:30 <mizmo> mainloop
17:54:49 <mizmo> there's a lot more to GTK and GObject but I'm keeping it simple for this workshop
17:55:11 <mizmo> gtk object model based on abstract classes
17:55:17 <mizmo> each object may have any number of properties
17:55:18 <mizmo> for example
17:55:25 <mizmo> a property of a checkbox is whether or not it's checked
17:55:28 <mizmo> <slide 9> btw
17:55:39 <mizmo> it also inherits methods and properties from the class it's subclassed from
17:55:50 <mizmo> so they go pretty far back - a huge rich hierarchy of properties that each object has
17:55:53 <mizmo> stupid real life example
17:55:57 <mizmo> think of definition of a Chair object
17:56:01 <mizmo> chairs have many properties
17:56:08 <mizmo> coordinates in space
17:56:19 <mizmo> does it have legs
17:56:20 <mizmo> a back
17:56:24 <mizmo> you can subclass a chair
17:56:30 <mizmo> FoldingChair adds a fold() function
17:56:36 <mizmo> SwivelChair adds a rotate() function
17:56:50 <mizmo> this is just a little bit of the object oriented programming philosophy
17:56:58 <mizmo> Chair itself may be a subclass of sometihng else - Furniture
17:57:01 <mizmo> <slide 10>
17:57:08 <mizmo> run devhelp
17:57:12 <mizmo> provides hierarchical listing of inheritance
17:57:19 <mizmo> <slide 11>
17:57:26 <mizmo> here's an example of how the hierarchy works
17:57:32 <mizmo> look up the tree from GtkButton
17:57:46 <mizmo> GtkButton is subclasses from GtkBin so it gets methods and props from that
17:57:50 <mizmo> GtkBin inherits from GtkContainer
17:57:52 <mizmo> so on and so forth
17:57:59 <mizmo> anything you can do with GtkContainer, you can do with GtkButton
17:58:02 <mizmo> it's additive as you go down the tree
17:58:08 <mizmo> <slide 12>
17:58:12 <mizmo> your application can be an object
17:58:21 <mizmo> typically the UI is an object that you create an instance of a class that you define
17:58:25 <mizmo> that's how the application actually starts
17:58:34 <mizmo> so you might define your UI as a subclass of the Gtk.Application object
17:58:45 <mizmo> then you inherit things that the Application obejct has, like set the icon for the app
17:59:12 <mizmo> subclass so you can get the things an helpers and things already written for the parent class you're subclassing from
17:59:19 <mizmo> that's just a python feature / OOP feature
17:59:22 <mizmo> <slide 13>
17:59:28 <mizmo> how do you get from this XML file to a working application
17:59:29 <mizmo> ?
17:59:37 <mizmo> again, use glade, build your UI, you saved it as an XML file
17:59:43 <mizmo> how do you get that file as something to work in python?
17:59:53 <mizmo> first you load the GIR / Gobject introspection repository
17:59:58 <mizmo> the following line in your python:
18:00:02 <mizmo> from gi.repository import Gtk
18:00:13 <mizmo> then youcreate a GtkBuilder object and use it to add from the UI file
18:00:29 <mizmo> Gtk.Builder.add_from_file('<your glade .ui file goes here>')
18:00:40 <mizmo> now any of the elements in your ui are in the python and you can work with them!
18:00:45 <mizmo> will demo this in a bit
18:00:50 <mizmo> <slide 14>
18:00:58 <mizmo> now how to you make the objects react to things the user does?
18:01:01 <mizmo> it doesn't come for free
18:01:16 <mizmo> just because you created a window with a button in it, doesn't mean it'll do anything if the user presses it unless you connect a signal to that element
18:01:22 <mizmo> for example with a button, you'd connect the 'click' signa
18:01:23 <mizmo> l
18:01:31 <mizmo> the way something happens, connect your signal to a callback function
18:01:45 <mizmo> the reaosn that things are interactive is because there's a main loop running
18:01:54 <mizmo> it picks up things that happen
18:01:54 <mizmo> if the user moves the mouse
18:01:57 <mizmo> clicks the mouse
18:01:59 <mizmo> hits the keyboard
18:02:01 <mizmo> it listens
18:02:14 <mizmo> if you have a dialog up you dont normally care if the users mouse is in the dialog or outside
18:02:20 <mizmo> you mostly care whether or not they clicked the button
18:02:30 <mizmo> but note there's a realy rich set of activites you can listen for using signals / the main loop
18:02:34 <mizmo> so the interaction generates a signal
18:02:39 <mizmo> which can be caught and used to trigger a function
18:02:51 <mizmo> the signals are emitted by widgets... but where do we get the widgets?
18:02:52 <mizmo> remember when we used the GtkBuilder?
18:02:58 <mizmo> that gives us access to the objects
18:03:05 <mizmo> there's a get_object() function that'll grab the objects for us
18:03:10 <mizmo> <slide 15>
18:03:11 <mizmo> eg
18:03:22 <mizmo> Gtk.Builder.get_object() retrurns an object based on its name
18:03:25 <mizmo> eg self.close_button = self.builder.get_object('close')
18:03:36 <mizmo> now you can reference that GUI element in Python and do things with it
18:03:50 <mizmo> if you did a nice job naming the objectsin your glade file, this part will be easier :)
18:04:03 <mizmo> <slide 16>
18:04:13 <mizmo> just about anything in the toolkit can use the connect() function to map a signal to a callback function
18:04:22 <mizmo> the callback is where you write the code the user interacts with
18:04:29 <mizmo> ex. self.close_button.connect(‘clicked’, self.hide_dialog)
18:04:41 <mizmo> i'm getting the signal that the user clicked the close button, so i'm connecting that signal to the hide_dialog() function
18:04:46 <mizmo> so if the user clicks close, the dialog will hide
18:04:56 <mizmo> thi sis not just limited to clicks!
18:04:56 <mizmo> theres a rich set of things
18:05:02 <mizmo> interface element can react if pointer drifts over it or away from it
18:05:07 <mizmo> <slide 17>
18:05:10 <mizmo> writing callback function
18:05:23 <mizmo> the callback functoin can receive additoinal argments
18:05:40 <mizmo> if you dont care about the args... im not following
18:06:13 <mizmo> eg
18:06:18 <mizmo> this function set three arguments, you're only providing one
18:06:24 <mizmo> if you dont care about them what do you do? <== question
18:06:36 <mizmo> <slide 18>
18:06:38 <mizmo> gtk main loop
18:06:45 <mizmo> allows your app to accept input from user
18:07:23 <mizmo> main_quit() function
18:07:26 <mizmo> cleans up screen when app exits
18:07:28 <mizmo> important to use
18:08:10 <mizmo> i sometimes forget to connect the simplest signals, that the app actually quits when they click close button... without running main_quit() <= symptom of tihs is that the term it was running in hangs
18:08:23 <mizmo> <Slide 19>
18:08:24 <mizmo> another hint
18:08:26 <mizmo> show_all()
18:08:35 <mizmo> show widgets before the main loop runs using show_all()
18:08:47 <mizmo> choose what to show and hide for mult. window or paned apps using hide/show methods or visible properties
18:09:00 * mizmo wonders what is diff between hide and not visibile
18:09:23 <mizmo> if app has help, about, main window, you dont want to show all three windows at same time when app first runs
18:09:30 <mizmo> visibility is not automatic
18:09:33 <mizmo> you actually control that
18:10:16 <mizmo> <slide 20>
18:10:20 <mizmo> how do i know what widgets i need?
18:10:24 <mizmo> dont need to memorize whole toolkit
18:10:32 <mizmo> use glade, use devhelp to investigate widgets as you use them in glade
18:10:37 <mizmo> as you use it you'll get more familiar with them
18:10:46 <mizmo> there are heavy duty ones you use all the time - button and click signal
18:11:00 <mizmo> keep in mind widgets inherit things from their parnets
18:11:26 <mizmo> so when you look at widget in devhelp - understand it can do things its parent can too, devhelp only displays functions/properties specific to the object you're looking at
18:11:33 <mizmo> so go up the hierarchy to look for other props/funcs
18:11:44 <mizmo> anything you can do in glade, you can do directly in python via GTK
18:11:48 <mizmo> so you can change your interface as you run
18:11:51 <langdon> mizmo: should we omve hte camera to point "more" at paul?
18:11:58 <mizmo> yeh if you dont mind
18:12:08 <mizmo> also i had some q's
18:12:12 <langdon> shoot
18:12:25 <langdon> you are laggy so tough to see result
18:12:31 <mizmo> q1: if a callback function give syou 3 args but you only care about one of them... what do you do?
18:12:49 <mizmo> q2: is there a difference between hiding a window and marking it as not visible?
18:12:54 <caeshmer> ignore the other args
18:12:54 <langdon> he is answering someone else right this sec
18:13:02 <mizmo> <slide 21> summary/review
18:13:14 <mizmo> q: do you always want to do outside of... ?
18:13:31 <mizmo> a: not a good person to answer that but i always do in main... i might want to use that UI as a class somewhere else
18:13:41 <mizmo> i think question about where do you use GtkBuilder to pull in objects
18:14:04 <mizmo> q: show_all also show. why use on eor the other?
18:14:08 <mizmo> a: diff between show and show
18:14:10 <mizmo> _all
18:14:27 <mizmo> show_all guarantees that any of widgets contained inside widget itself (eg window with buttons in it) - show_all will gaurantee all contents will show
18:15:17 <mizmo> if you have an app that has a pane in it or a box that things change as user does stuff - you'll want to use show, not show_all so user will only get the one thing you're doing at that time
18:15:29 <mizmo> q: python take advantage of... raising dot classes?
18:15:40 <mizmo> a: ive been using python for a while but im not sure how .. that it necessarily does all the same
18:16:08 <mizmo> q: is there a difference between hiding a window and marking it as not visible?
18:16:13 <mizmo> a: no dont think there is any real difference?
18:16:26 <mizmo> a: gtk widget hide... end effect is same but difference has to do with signal?
18:16:31 * mizmo not following completely but its ok
18:16:40 <mizmo> matthias is hard to hear on mic
18:17:02 <langdon> mizmo: if you set the property no "event" is fired.. so ifyou want to chaing things based on the hide... it won't "work"
18:17:04 <mizmo> <end of slides>
18:17:16 <mizmo> langdon, ohhhhhhh okay
18:17:17 <mizmo> makes sense
18:17:23 <mizmo> we'll split into teams to build a UI
18:17:57 <langdon> mizmo: in other words, sometimes you want other parts of your app to know you hide something and sometimes you don't want to trigger the "normal result" .. but as far as the UI is concerned (like for the user) the result is the same
18:18:19 <langdon> mizmo: i was 1/2 way through when you said you got it.. but i was COMMITTED ;)
18:18:24 <mizmo> lol
18:18:44 <mizmo> whoever is on matthias' team has an unfair advantage
18:18:57 <mizmo> all of these are simple one window apps
18:19:09 <mizmo> <slide 25> for team 1
18:19:46 <mizmo> <slide 26> for team 2
18:20:42 <mizmo> <slide 27> for team 3
18:22:03 <langdon> hopefully the video is better.. and not just someone's back.. but the video may not be much use any which way soon..
18:22:08 <mizmo> oh much better
18:22:11 <mizmo> yeh its all good tho
18:22:43 <mizmo> slides: http://flocktofedora.org/wp-content/uploads/2013/08/flock-2013-PyGObject-workshop1.pdf
18:23:14 <mizmo> question about exercise 3... you're printing the output to the dialog and to standard output?
18:23:20 <mizmo> standard output as on the term?
18:24:26 <stickster> Just as standard out on the terminal... so in other words, you'll launch the app from the terminal, and you'll see 'yes' or 'no' pop out there as well
18:24:37 <mizmo> okay cool
18:25:05 <mizmo> is it hard to make answer appear in gui?
18:25:38 <stickster> mizmo: Not at all -- you could make a Gtk.Label and use Gtk.Label.set_text('...') to put the answer there
18:25:41 <davelab6> mizmo: i can doa  g+ hangout with you
18:25:48 <davelab6> my gmail is d.crossland@gmail.com
18:25:49 <mizmo> any suggestions for naming in the hierarchy? eg i know what to name the window, but then i have a grid and i dont know what to name the grid
18:25:49 <stickster> davelab6: That would be awesome!
18:25:54 <mizmo> okay cool
18:26:11 <stickster> mizmo: I often won't worry about setting specific names for widgets I don't care about
18:26:14 <stickster> Like boxes or grids
18:26:21 <stickster> That may be crappy programming practice, though :-)
18:26:23 <mizmo> you wont need to access in py so it doesnt matter the name
18:27:12 <mizmo> davelab6, it says its dialing
18:27:29 <mizmo> says youre not available
18:27:33 <mizmo> its all good tho
18:27:42 <mizmo> oh there is goes i think
18:29:09 <davelab6> for sharing https://github.com/davelab6/flock-gobject-exercise.git ?
18:29:11 <stickster> http://pfrields.fedorapeople.org/presentations/Flock2013/
18:29:21 <stickster> ^^ you can find a trivial little app example there
18:29:35 <stickster> spin-me.py is the app, spin-me.ui is the Glade (GtkBuilder) UI file
18:29:48 <stickster> I have that on screen here in the room
18:31:28 <mizmo> the face in the ui is so sad
18:31:29 <mizmo> in spin-me
18:31:48 <langdon> mizmo: if you click the on button he smiles!
18:32:30 <davelab6> mizmo: or maybe etherpad woud be better?
18:32:35 <mizmo> hrm
18:32:43 <mizmo> yeh im not getting much out of the hangout maybe etherpad better
18:32:44 <mizmo> sec
18:32:53 <davelab6> the audio is kinda garbled
18:33:05 <davelab6> g+ can do screen sharing
18:33:12 <davelab6> 2 way vnc style
18:33:15 <mizmo> http://piratepad.net/pygobject-flock
18:33:19 <mizmo> oh i closed it lol
18:33:28 <mizmo> should i do the call again?
18:33:35 <davelab6> ok
18:34:15 <mizmo> ok back
18:34:29 <mizmo> are you turning screenshare on?
18:37:48 <stickster> mizmo: How is this working for you? I haven't tried hangouts for this before but I hear the GNOME guys use it a lot
18:37:58 <mizmo> so far it's confusing but i only have one screen here
18:38:03 <stickster> Oh
18:38:03 <mizmo> i think if i had dual monitor it'd be a lot easier
18:38:12 <stickster> Maybe someone can invite me, so I can see what it looks like
19:01:42 <davelab6> stickster: hangouts screensharing is not ideal compared to a genuine shared desktop... it has VNC style remote input but we didnt use that....
19:02:27 <davelab6> really we were using piratepad as the main collaboration point
19:24:55 <stickster> davelab6: Aha
19:25:35 <stickster> I will really need to play around with it and see how to do remote better with this. It would be fun to offer additional "courses"
19:36:45 <stickster> mizmo: Thank you for transcribing! Hope I wasn't too hard on you
19:38:46 * stickster heads over to auditorium
19:48:51 <puiterwijk> Hi, is there still a talk going on here?
19:49:11 <nb> I do not think so
19:49:15 <nb> .listmeetings
19:49:15 <zodbot> nb: ('#fedora-flock-auditorium', 'freenode'), ('#fedora-flock-ectr101', 'freenode')
19:49:19 <puiterwijk> #endmeeting
19:49:29 <nb> puiterwijk, you will have to .addchair yourself
19:49:31 <nb> .misc help addchair
19:49:31 <zodbot> nb: (addchair <channel> <network> <nick>) -- Add a nick as a chair to the meeting.
19:49:32 <puiterwijk> nb: I don't think so either
19:49:48 <puiterwijk> .addchair #fedora-flock-ectr101 freenode puiterwijk
19:49:48 <zodbot> puiterwijk: Chair added: puiterwijk on (#fedora-flock-ectr101, freenode).
19:49:53 <puiterwijk> #endmeeting