After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735918 - demo: revamp and modernize demo code
demo: revamp and modernize demo code
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-02 18:44 UTC by Simon Feltman
Modified: 2017-12-06 16:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
demo: Rename demos/gtk-demo to simply demo (19.97 KB, patch)
2014-09-02 21:06 UTC, Simon Feltman
committed Details | Review
demo: Rename gtk-demo.py to demo.py (614 bytes, patch)
2014-09-02 21:06 UTC, Simon Feltman
committed Details | Review
demo: PyFlakes and PEP8 fixes (4.28 KB, patch)
2014-09-02 21:06 UTC, Simon Feltman
committed Details | Review
demo: Cleanup app title and application id (1.84 KB, patch)
2014-09-02 21:06 UTC, Simon Feltman
rejected Details | Review
demo: Use different Gtk.SourceView color scheme (1.72 KB, patch)
2014-09-02 21:07 UTC, Simon Feltman
rejected Details | Review
demo: Use HeaderBar for main app window (2.14 KB, patch)
2014-09-02 21:07 UTC, Simon Feltman
committed Details | Review
demo: Use main demo program as the first demo (2.06 KB, patch)
2014-09-02 21:07 UTC, Simon Feltman
rejected Details | Review
Add Gtk.FlowBox example (17.08 KB, patch)
2014-09-04 07:59 UTC, Gian Mario Tagliaretti
none Details | Review
demo: Add new Gtk.FlowBox example (17.20 KB, patch)
2014-09-06 05:07 UTC, Simon Feltman
committed Details | Review

Description Simon Feltman 2014-09-02 18:44:18 UTC
The demo code is a bit out of date in terms of modern GTK+ style usage. We should revamp the demo to follow the newer HIG as well as clean things up. Some initial thoughts:

* Move the pygobject/demos/gtk-demo to pygobject/demo since we only have one demo and it should be the launching app for any platform related demos we want to show.

* Use better color scheme for Gtk.SourceView which takes into account dark themes. The default Gtk.SourceView has way too much contrast in terms of color scheme. "oblivion" and "kate" for dark and light respectively are much more reasonable.

* Remove usage of deprecated APIs, specifically usage of stock id's need to be updated.

* Use a HeaderBar for the main window.

* Change the side panel TreeView to a ListBox

* Use GMenuModel to at least show an about dialog for the demo.

* Add demos for new widgets: Gtk.FlowBox, Gtk.ActionBar, Gtk.Revealer, Gtk.Popover, Gtk.Switch.
Comment 1 Simon Feltman 2014-09-02 21:06:47 UTC
Created attachment 285195 [details] [review]
demo: Rename demos/gtk-demo to simply demo

Move the entire "pygobject/demos/gtk-demo" folder to "pygobject/demo".
Since we only have a single demo app which should be used for all
platform demos we can remove the diectory obfuscation.
Comment 2 Simon Feltman 2014-09-02 21:06:51 UTC
Created attachment 285196 [details] [review]
demo: Rename gtk-demo.py to demo.py

Remove GTK+ specificity which also allows the demo app to be used as
one of the demos itself.
Comment 3 Simon Feltman 2014-09-02 21:06:54 UTC
Created attachment 285197 [details] [review]
demo: PyFlakes and PEP8 fixes

Since PyFlakes and PEP8 are not currently run on the demo due to it
not being packaged, manually check and fix this for now.
Comment 4 Simon Feltman 2014-09-02 21:06:58 UTC
Created attachment 285198 [details] [review]
demo: Cleanup app title and application id

Change demo application title to "PyGI Code Demos" and app id to
"org.gnome.pygi.demo". Additionally remove __gtype_name__ since
this is not needed.
Comment 5 Simon Feltman 2014-09-02 21:07:01 UTC
Created attachment 285199 [details] [review]
demo: Use different Gtk.SourceView color scheme

Change color scheme based on 'gtk-application-prefer-dark-theme'
using schemes with less contrast than the Gtk.SourceView defaults.
Comment 6 Simon Feltman 2014-09-02 21:07:04 UTC
Created attachment 285200 [details] [review]
demo: Use HeaderBar for main app window
Comment 7 Simon Feltman 2014-09-02 21:07:08 UTC
Created attachment 285201 [details] [review]
demo: Use main demo program as the first demo
Comment 8 Simon Feltman 2014-09-02 21:08:18 UTC
Review of attachment 285200 [details] [review]:

Note the StackSwitcher should eventually be centered over the main view which can be done in follow up patches.
Comment 9 Gian Mario Tagliaretti 2014-09-04 07:59:35 UTC
Created attachment 285314 [details] [review]
Add Gtk.FlowBox example

Added a new example for the Gtk.FlowBox class added in GTK+ 3.12. This example already makes use of Gtk.HeaderBar.
Comment 10 Gian Mario Tagliaretti 2014-09-04 09:53:30 UTC
(In reply to comment #1)
> Created an attachment (id=285195) [details] [review]
> demo: Rename demos/gtk-demo to simply demo

Hi Simon,
 
> Move the entire "pygobject/demos/gtk-demo" folder to "pygobject/demo".
> Since we only have a single demo app which should be used for all
> platform demos we can remove the diectory obfuscation.

I wouldn't change this, what if in the near future we will add another demo such as the icon browser and/or the widget factory (or anything else)? We would have to move it again.

I don't see the plural "demos" a big issue.
Comment 11 Simon Feltman 2014-09-04 20:50:46 UTC
(In reply to comment #10)
> (In reply to comment #1)
> > Created an attachment (id=285195) [details] [review] [details] [review]
> > demo: Rename demos/gtk-demo to simply demo
> 
> Hi Simon,
> 
> > Move the entire "pygobject/demos/gtk-demo" folder to "pygobject/demo".
> > Since we only have a single demo app which should be used for all
> > platform demos we can remove the diectory obfuscation.
> 
> I wouldn't change this, what if in the near future we will add another demo
> such as the icon browser and/or the widget factory (or anything else)? We would
> have to move it again.

Part of the idea here is our demo is a singular launch pad for anything we want to demo (anything in the GNOME-platform not just specific to GTK+), which in this case would include the icon browser or widget factory. Do you see a problem with this idea?

> I don't see the plural "demos" a big issue.

We already have the plurality underneath gtk-demo, so it just seemed like overkill to have demos/gtk-demo/demos.

The other part of this was preliminary work on packaging the demo as an installable bin. So perhaps pygobject/demo is actually wrong and it should be pygobject/gidemo or pygobject/gi/demo:

pygobject/bin/pygi-demo  # executable shim for the Python app
pygobject/gi/demo        # what gets imported by the executable shim
Comment 12 Simon Feltman 2014-09-04 21:15:53 UTC
An additional idea for the singular demo launcher idea is we can add a filter/search feature to the hierarchy panel. So I can then search for "headerbar" and only demos which include the case insensitive text (in the code and description) would show up in the left panel.
Comment 13 Simon Feltman 2014-09-04 22:37:59 UTC
Notes from pbor:

<pbor> sfeltman: please not the kate scheme :-)
<pbor> it is there just for historical reasons
 I'd either go classic on white and oblivion on dark or solarized and solarized dark if you want to look fancy

Classic on white and oblivion on dark seems fine. My main gripe is default dark is basically unreadable in terms of the blue comments (at least on my monitory).

Solarized looks interesting as well though.
Comment 14 Simon Feltman 2014-09-06 05:07:43 UTC
Created attachment 285551 [details] [review]
demo: Add new Gtk.FlowBox example

Added a new example for the Gtk.FlowBox class added in GTK+ 3.12.
This example additionally makes use of Gtk.HeaderBar.
Comment 15 Simon Feltman 2014-09-06 05:09:38 UTC
Review of attachment 285551 [details] [review]:

The usage of a DrawingArea and Button are just too slow for this demo. I've simplified it by limiting the swatch to a single Label with text. I think it's important we don't leave people with the impression that pygi is slow.
Comment 16 Gian Mario Tagliaretti 2014-09-06 09:09:20 UTC
(In reply to comment #15)
> Review of attachment 285551 [details] [review]:
> 
> The usage of a DrawingArea and Button are just too slow for this demo. I've
> simplified it by limiting the swatch to a single Label with text. I think it's

On my hardware the usage of Button and Drawing area is pretty fast, I haven't noticed a sloppy performance.

> important we don't leave people with the impression that pygi is slow.

Sure that makes sense, everybody likes to blame python :)
Comment 17 Gian Mario Tagliaretti 2014-09-06 09:13:58 UTC
(In reply to comment #11)

> this case would include the icon browser or widget factory. Do you see a
> problem with this idea?

Probably I was just focusing on replicating the same structure that GTK+ has, not a big deal after all.

> The other part of this was preliminary work on packaging the demo as an
> installable bin. So perhaps pygobject/demo is actually wrong and it should be
> pygobject/gidemo or pygobject/gi/demo:
> 
> pygobject/bin/pygi-demo  # executable shim for the Python app
> pygobject/gi/demo        # what gets imported by the executable shim

Shipping the demo code is for sure a good idea, a lot of people are not aware that this code even exist.
Comment 18 Christoph Reiter (lazka) 2017-12-06 16:36:45 UTC
Comment on attachment 285198 [details] [review]
demo: Cleanup app title and application id

Imo we are stuck with "pygobject" now. Adding pygi to pygobject/gi adds just one more name and potential confusion. Since that is the main change here, dropping this.
Comment 19 Christoph Reiter (lazka) 2017-12-06 16:40:04 UTC
Comment on attachment 285199 [details] [review]
demo: Use different Gtk.SourceView color scheme

This seems like a rare corner case as the default is not to prefer dark.
Comment 20 Christoph Reiter (lazka) 2017-12-06 16:41:31 UTC
Comment on attachment 285201 [details] [review]
demo: Use main demo program as the first demo

I don't think the demo code is a good example.
Comment 21 Christoph Reiter (lazka) 2017-12-06 16:45:43 UTC
I went ahead and pushed most of this before it bit rots. Hope that's OK.

If there are any other ideas for improving/adding demos or pursuing an installed version of this I think it's best if that gets handled in separate/new bug reports.