Bug 345506

Summary: YaST-GTK: Support 'Image' widget disabling (dim, grey...)
Product: [openSUSE] openSUSE 11.0 Reporter: Lukas Ocilka <locilka>
Component: YaST2Assignee: Forgotten User h13THG8RK1 <forgotten_h13THG8RK1>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P5 - None CC: coolo, forgotten_h13THG8RK1, tgoettlicher
Version: Alpha 2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Core
Qt (3)

Description Lukas Ocilka 2007-12-03 12:15:01 UTC
Coolo has implemented a new Image functionality to Qt (3,4) to support Image-Dimming this support is still missing in $other UIs (and the future support is unclear) so I've prepared a patch for Core + Qt that adds another boolean to UI::GetDisplayInfo();

Would it be possible to add it there, please? (see the proposed patches)
Anyway, if there was a better way, I'd like it too :))) This was the only method I was able to use.
Comment 1 Lukas Ocilka 2007-12-03 12:15:32 UTC
Created attachment 185609 [details]
Core
Comment 2 Lukas Ocilka 2007-12-03 12:15:57 UTC
Created attachment 185610 [details]
Qt (3)

Might be the same for Qt4...
Comment 3 Lukas Ocilka 2007-12-03 12:17:45 UTC
Coolo: could you please write more details on the implemented feature? Ricardo might be so kind and implement it also in GTK UI :)
Comment 4 Stephan Kulow 2007-12-03 15:54:34 UTC
I talked with Huha about it and the general agreement was that ycp should not cover for this. gtk still needs to implement it though - the thing is YImage::setEnabled(false) should update the displayed pixmap to appear in gray
 and YImage::setEnabled(true) should reenable the original pixmap.

Qt implements it in reloading the pixmap, with a filter applied if it's disabled.
Comment 5 Lukas Ocilka 2007-12-03 15:59:43 UTC
Er, ... anyway, I need to control the image enabling/disabling or dimming or whatever you call that from YCP :) How do I do that, please?
Comment 6 Lukas Ocilka 2007-12-03 16:03:09 UTC
My patch (proposal) was about this:

if (UI_supports_image_disabling) {
  use_image_enabling_disabling_method();
} else {
  use_another_method();
  // for instance replace_point/replace(widget)
}

but I know that is quite specific and maybe I'm the only one who wants it :)
I wanted to have it easy for myself :))) heh
I do accept any solution ;)
Comment 7 Stephan Kulow 2007-12-03 16:35:54 UTC
just blindly assume UIs with image support will dim if you disable I would say.
Comment 8 Stefan Hundhammer 2007-12-03 16:37:00 UTC
Yes.
Comment 9 Lukas Ocilka 2007-12-03 16:42:11 UTC
Well, and what do do if it doesn't support dimming :)?
Just ignore it? OK.
In that case, it is "fixed" :)
Comment 10 Forgotten User h13THG8RK1 2007-12-03 20:47:37 UTC
I read this on the mailing list. This is a pretty trivial feature. What about other effects like gray, btw?

I won't implement this on yast-gtk because it doesn't even work against recent versions of libyui. But sure, this can be done. We even have code for this from the find entry icons on the help dialog. I'll point that out on a comment on our YImage implementation.

Something is wrong about the libyui attachment, right? Or have you just added those fallback hooks for now? Btw, I'd use a more generic name like UI::HasImageEffectsSupport(). Whats important is whether the UI code can do pixel manipulation. Qt and GTK+ can. Wt can't. (needless to say, ncurses doesn't even support images, so it would return false too.)

How do you intend to enable this feature from the code? If you add an `opt option at the widget constructor, then of course will have to construct several widgets, which means using ReplacePoints. Maybe we could add a UI::ImageApplyEffect(image, `dim|`grey...) ?
The UI could even optimize this by keeping the several transformations in memory, as demanded, until the image is destructed.
Comment 11 Lukas Ocilka 2007-12-04 08:37:22 UTC
Ricardo, this feature was about dimming an image if it is disabled:

  * `Image (... `opt (`disabled) ...)
  * UI::ChangeWidget (`id (img_id), `Enabled, false);

UI should be able to dim (turn into gray-scale, darken, ...) an image when it is disabled and swap it with the original one if enabled again. The implementation depends on the respective UI. Just the API (widget, widget manipulation) is the same.

We've decided not to add any other output key to the UI::GetDisplayInfo() because all UIs that support images can also somehow dim them.

My patch is not going to be used. According to comment #7 we expect that UI support that. That's also why we don't need to implement any other UI functions.

In my opinion, we don't need to implement any other `opt (...) parameters such as `dim or `grey. The reason is simple: UI developers don't need to be bothered by implementation details. They just want to disable the image and let UI to deal with it somehow. Internally, the UI can, of course, have several `dim or `grey options but for UI transparency (across all UIs) they shouldn't be visible externally.

--- --- ---
So, Ricardo, could you, please, implement the Image widget disabling? In my opinion all widgets should support it but I've just found that we hadn't needed it so far (but now we/I do :)...).
--- --- ---

See commits: r42530, r42531, r42532 (Qt3, Qt4: made by Coolo)
Comment 12 Forgotten User h13THG8RK1 2007-12-04 22:05:14 UTC
Right, didn't read the thread carefully. Implemented it. GTK Image widget behaves the same as you say, but we don't use it, as yast-ui needs more stuff than it features, the scaling and tiling.
Used its code. Its interesting that GtkImage asks the current Style to render it, so a style could make it slightly blue or whatever. Most will just default though, to gray.
Comment 13 Lukas Ocilka 2007-12-05 13:29:55 UTC
Let's close it 'FIXED' if 'implemented' :)))

Additional features and ideas are just being discussed on yast-devel mailing list ;)