Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tooltip and show weather condition correctly #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dospuntos
Copy link

This PR fixes a few minor issues:

  • The tooltip will show a description of the condition, not a number
  • The entire tooltip is translatable (as a single string)
  • Remove empty space after the icon (replicants added after Weather will have a lot of empty space in front of them)

There is a pending issue with scaling, the constant kSizeDeskBarIcon in ForecastView.h will cause the generated icon to 16x16 pixels. It can be scaled, but that makes it look blurred. The icon should be generated to the value of maxHeight from instantiate_deskbar_item(float maxWidth, float maxHeight)

@@ -156,5 +156,5 @@ extern "C" BView* instantiate_deskbar_item(float maxWidth, float maxHeight);
BView*
instantiate_deskbar_item(float maxWidth, float maxHeight)
{
return new ForecastDeskbarView(BRect(0, 0, maxWidth - 1, maxHeight - 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use something like std::min(maxWidth, maxHeight), to compute the largest square that can fit in the space allowed by DeskBar.

This makes the replicant usable no matter what layout DeskBar decides to use in future versions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pulkomandy, I've updated the code

@dospuntos dospuntos force-pushed the deskbar_replicant_fixes_v2 branch from 71f6d3c to dfd4f69 Compare November 10, 2023 16:55
Copy link
Member

@humdingerb humdingerb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replicant appears to be stuck on "Condition: Loading..."
It's also too small, still getting the icon in size kSizeDeskBarIcon, see https://github.com/HaikuArchives/Weather/blob/master/Source/ForecastView.cpp#L695

The menu item should be sentence case: "Deskbar replicant".

Include a re-generated en.catkeys.

@@ -18,7 +18,7 @@
class ForecastDeskbarView : public BView
{

public:
public:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove stray tab (in the line above too)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the PR based on your comments. The main branch was updated recently, so I ditched my first PR and created a new one.

  • Icon size is now correct
  • Changed menu item to sentence case
  • Regenerated en.catkeys
  • Removed stray tab

@dospuntos dospuntos force-pushed the deskbar_replicant_fixes_v2 branch 2 times, most recently from 77b33d8 to b84d3b6 Compare November 14, 2023 21:58
@humdingerb
Copy link
Member

The replicant icon size appears to be correct now, resized with tray size.
Still, it always shows the sun symbol, when the main window shows clouds and rain, as is usual over here for the time... :|
Also, still stuck at "Condition: Loading..."

@pulkomandy
Copy link
Member

To clarify, is the wrong weather and "condition loading..." caused by this change, or is it an independant regression? If it's the latter, maybe we can merge this still?

@humdingerb
Copy link
Member

Both. :)
Current master build also shows the wrong weather - always sunny at least. But there, the condition shown in the tooltip is "0", whereas in this PR it's always "loading...".

SetToolTip(weatherDetailsText.String());
weatherDetailsText.SetToFormat(B_TRANSLATE("Temperature: %s\nCondition: %s\nLocation: %s"),
FormatString(fForecastView->Unit(), fForecastView->Temperature()).String(),
fForecastView->GetStatus().String(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the "condition" (sunny, rainy, ...) was replaced by the status (loading, up to date). I guess this should be reverted, but I don't know if there is a way to convert the condition into a string.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply :(
fForecastView->GetStatus() will return the status (loading, no network, connection error), but also the correct condition (sunny, rainy etc.) as a translatable string when available.
I'm puzzled as to why @humdingerb isn't getting the correct forecast. On my machine it works (both VM and natively), but after changing the code I have to open the app, enable and disable the Desktop replicant, and then restart the app to make sure the replicant is running the new code. I also uninstalled the Weather app from HaikuDepot to avoid any conflicts.

screenshot2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea either. I checked out PR #103, built cleanly and there is no other Weather binary on the system. Still the same: the Deskbar replicant always shows the sun and "Condition" says "Loading...".

@dospuntos dospuntos force-pushed the deskbar_replicant_fixes_v2 branch from b84d3b6 to 41c4131 Compare March 6, 2024 23:27
@dospuntos
Copy link
Author

To clarify, is the wrong weather and "condition loading..." caused by this change, or is it an independant regression? If it's the latter, maybe we can merge this still?

I think it is an independent regression, my changes are only related to the deskbar icon size and other visuals.

WRT the eternal "Loading..." status, I have confirmed that @humdingerb is right, on a clean install the deskbar never shows the actual weather data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants