Merge lp://staging/~rafalcieslak256/ubuntu-accomplishments-viewer/uav-display-modes into lp://staging/ubuntu-accomplishments-viewer

Proposed by Rafał Cieślak
Status: Merged
Merged at revision: 209
Proposed branch: lp://staging/~rafalcieslak256/ubuntu-accomplishments-viewer/uav-display-modes
Merge into: lp://staging/ubuntu-accomplishments-viewer
Diff against target: 1635 lines (+702/-460)
3 files modified
Changelog (+5/-0)
accomplishments_viewer/AccomplishmentsViewerWindow.py (+499/-383)
data/ui/AccomplishmentsViewerWindow.ui (+198/-77)
To merge this branch: bzr merge lp://staging/~rafalcieslak256/ubuntu-accomplishments-viewer/uav-display-modes
Reviewer Review Type Date Requested Status
Matt Fischer Approve
Review via email: mp+133583@code.staging.launchpad.net

Description of the change

This branch introduces lighting-fast filtering (fixes: #1076574), as well as search feature (#1076561) (which are actually fairly related).

It saves lots of time by not recreating treemodels everytime the filters change. Instead, this implementation makes heavy use of GtkTreeModelFilters. There are just two treemodels used (one for opportunities, one for trophies), and there are several overlay filters applied for them. As filter parameters change, we ask GTK to check which rows should be hidden. GTK calls our functions to check that, they simply return true/false having checked for desired conditions.

Another mass efficiency gain is from dropping that terrible update_views function, which used to recreate all data we had from scratch, and is was called far too frequently. I solved that by implementing set_display(...) function, that takes a lot of optional arguments which are used to set new filter details. Usually called with just one parameter that has to be changed in the filter, it determines how to apply that change, and what will need refiltering. It also hides unnecesary UI elements. It's quite elegant, and very clear to use from many other places in code. It's also easily extensible, if one day we'll want to add a 'welcome' page, or implement help within the main window, it will be a piece of cake.

The search bar UI design is a suggestion, we may want to reorder the entry field with label, place them horisontally etc. Note that searching works for both opportunities and trophies (I find it most amazing in the "latest trophies view", as searching through it may cause some groups of accomplishments to appear/hide).

I have tested this branch carefully on both Quantal and Precise. I might have missed some UX details, let me know about any concerns you have and we'll discuss solutions.

To post a comment you must log in.
Revision history for this message
Matt Fischer (mfisch) wrote :

I don't claim to understand all the GTK stuff here, but the theory makes sense to me. I do have a few questions.

What about the XXX on line 178? I don't follow what the optimization is?

Q: Why is the code in on_window_resized() all moved into a string?

I see this note about making these global, I think they'd make sense as global:
951 + today = datetime.date.today()
952 + margin_today = datetime.timedelta(days = 1)
953 + margin_week = datetime.timedelta(days = 7)
954 + margin_month = datetime.timedelta(days = 31)
955 + margin_sixmonths = datetime.timedelta(days = 180)

Why did you remove all these lines? What did they do?
 <property name="use_action_appearance">False</property>

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Great thanks for taking time to look as this, Matt! :)

To answer your questions:

The XXX note in this diff's line 178 is an annotation for following prepare_models() call. The prepare_models() function is the only time-consuming bit now, as it initializes both treemodels. The call in line 178 is within function that runs when a new trophy is received. The point is that it makes no sense to clear both treemodels and recreating them from scratch when a new trophy is awarded, instead, we might just remove that new trophy from opprotunities list and add it to mytrophies. We do know the accomID of that new trophy, as daemon provides us with that data, so it's just a matter of implementing support for such action. It would be just faster.

Code in on_window_resized() is moved to a string because I wanted to remove it, but moving it to a comment looked to me as a more appropriate way of disabling it, so that the original code is left in case we wanted to reuse it some time. Currently it's not needed, as GTK now correctly manages iconview's width, and we don't need any silly workarounds to have the window properly resizing. Moreover, that trick we used as a workaround based on clearing and recreating all treemodels - and that's what this branch wants to avoid, since it's a very time-consuming operation.

I have not changed any of the "use_action_appearance", I am pretty sure Glade has edited that on it's own. Most likely a new version of glade finally recognizes that there is not much sense in specifying explicitly that "use_action_appearance" should be false, as that's GTK's default behavior. Thus, the removal of these lines shouldn't change anything.

If you want to, I can provide some more detail on how the GTK stuff works here.

218. By Rafał Cieślak

Using GtkSearchEntry instead of GtkEntry for the searchbar, it's much more intuitive this way

Revision history for this message
Matt Fischer (mfisch) wrote :

I think you should just remove the on_window_resized code, we can get it back via bzr history if we need to, otherwise it looks good. I don't figure you're going to get an in depth review from Jono anytime soon, maybe Michael Hall could review it? Personally I think you should just push it in, we'll need to do extensive testing on this code before 0.4 anyway and now is the time for major changes like this.

review: Approve
Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Thank you for the review. I'll push these changes, it's the first major thing for 0.4 so we'll have lots of time to test it afterwards.

219. By Rafał Cieślak

Finalising fix; added changelog entry and ironed out minor cosmetics

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: