On 07/26/2015 04:50 AM, John Whitmore wrote: > I've followed the instructions [1] but that has raised more questions then > it's answered. That wiki page is supposed to help, not hinder, so the more specifics you provide, the more help you're likely to get. Ask away!
> I'm on Arch Linux on a RaspberryPi and to play with my new panel plugin I > created a new panel on the top of the screen so I'm not messing with the > existing panel on the bottom with all the default plugins in place. Problem > with that was that as soon as I executed the command "lxpanelctl restart" as > suggested in [1] it destroyed the bottom, existing, panel for it never to > return. I might have to re-install Arch on the SD card again, to get it back. I don't know if it has to be that drastic of a fix. You may have to manually edit the bottom panel config to bring it back to a usable state, though. You'll be able to find it in ${HOME}/.config/lxpanel/SESSION/panels (for me SESSION is LXDE). > Another question there is that [1] has added text "TP-1" to the panel plugin > but that text is not showing up for me :-( Not sure where to start. Might have > to read a whole volume on GTK Development. A plugin is just a widget inside of an EventBox used to handle user interactions. It seems that the pre-0.7 version of the wiki page[1] had a gtk_widget_show_all() call, whereas the post-0.7 version does not have it[2]. I've updated the page -- see if gtk_widget_show_all(p) makes the label appear. Also, I'd suggest downloading something like vmplayer or virtualbox and deploying a development virtual machine. This way, if anything goes wrong you can always go back to a snapshot, or just blow the thing away and start fresh :). > The last question would be how does that plugin get updated? I can't see any > mechanism to update the status of the displayed info. I really want to use > this plugin to display the status of a connected device. So A Daemon, probably > python, would monitor the device and notify the plugin of changes in > status. What would be used there? DBus to talk to the panel plugin? But how do > you get the plugin to check every few seconds? Updating the GUI can get a bit tricky. One thing to keep in mind is that the GUI operates on one thread and only that thread should update the widgets (you can update the GUI from other threads, but it requires playing with things like g_threads_init, gdk_thread_enter and _leave[3]). Your best bet (in my opinion) would be to: 1) kick off a separate thread on startup. 2) have that thread monitor your device(s) periodically 3) if an update needs to happen, call g_idle_add()[4] with appropriate function/data and update the GUI in the supplied function This is the exact mechanism I have inside the weather plugin. There is a background thread which waits for a timer to pop (or a user action) and then goes off to fetch an updated forecast. > Sorry much words No worries, asking questions is the best way to get going ;) Hope this helps a bit. Post up once you get the test plugin working and/or if you need more help in general. Cheers, Piotr [1]: http://wiki.lxde.org/en/How_to_write_plugins_for_LXPanel:_pre-0.7_version [2]: http://wiki.lxde.org/en/How_to_write_plugins_for_LXPanel [3]: http://developer.gimp.org/api/2.0/gdk/gdk-Threads.html [4]: https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-idle-add ------------------------------------------------------------------------------ _______________________________________________ Lxde-list mailing list Lxde-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxde-list