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

Add the welcome and error screen #84

Merged
merged 6 commits into from
Aug 9, 2017
Merged

Add the welcome and error screen #84

merged 6 commits into from
Aug 9, 2017

Conversation

Hjdskes
Copy link
Member

@Hjdskes Hjdskes commented Aug 2, 2017

No description provided.

@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 2, 2017

Still need to test this with more than one device, but for that I'm going to need to get ratbagd.devel running with at least one test device.

Also the MousePerspective is going to need a back button in case there is more than one connected device, and the WelcomePerspective needs to look a bit better still.

@julianrichen
Copy link
Contributor

Hello I have a Corsair Raptor M45 Gaming Mouse which isn't supported by ratbag and the screen seems to be working as intended :)

piper-welcome-screen-no-device

I would recommend making the ratbag icon symbolic and put the text under. Like so:

               +----------+
               |          |
               |   icon   |
               |          |
               +----------+
                 
             No devices found
Your device might not be plugged-in or support.

It would more closely follow GNOME's empty state & explain why it's not working.

See: https://github.com/gnome-design-team/gnome-mockups/tree/master/empty-app-states

@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 3, 2017

Hello I have a Corsair Raptor M45 Gaming Mouse which isn't supported by ratbag and the screen seems to be working as intended :)

That's good news, thanks for trying :)

I would recommend making the ratbag icon symbolic and put the text under. It would more closely follow GNOME's empty state & explain why it's not working.

Thanks, that's a good suggestion. For the symbolic icon, see #87.

The welcome and error screens both require a different "perspective"
into Piper, while being in the same window. For this reason, we
introduce a titlebar and a regular stack and the concept of a
"perspective", which is defined as a certain view into Piper.

A perspective needs to implement an interface of sorts of two methods:
one to retrieve its string name, and another to retrieve its widget titlebar.

Different scenarios can then show different perspectives, that have full
control over the main widget and the titlebar displayed. This commit
introduces the MousePerspective, which is a perspective showing the
mouse configuration. Future commits will add an ErrorPerspective and a
WelcomePerspective, and even further into the future we can add a
KeyboardPerspective as well.
This is weirdly necessary in order to show all the widgets when the
MousePerspective is opened from the WelcomePerspective; it doesn't seem
to be required when the MousePerspective is started straight away as was
the case before the introduction of perspectives.
@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 3, 2017

Only a single issue with the welcome screen remaining: the device SVGs used to display connected devices all have the device in a different position (due to some having left- and right-aligned leaders and others only right-aligned):

screenshot from 2017-08-03 15-15-12

Not sure there's a good way to solve this.

@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 3, 2017

I'll do the back button later when I have more in the works for #89 and #90.

This is then ready for review :)

This size is determined to be the best one with the current set of
device SVGs in libratbag. It is set to ensure that the jump in size
caused by the MousePerspective populating itself when switched to is
minimal and the least disturbing. We can't populate the MousePerspective
in advance because we need to know the device.
@whot
Copy link
Member

whot commented Aug 4, 2017

can we detect the device (it's on its own layer after all) and crop the SVG?

@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 4, 2017

I'm already retrieving the device on its own layer, but it keeps its "global" coordinates from the complete SVG it seems. Hence the issue.

@whot
Copy link
Member

whot commented Aug 6, 2017

any way we can crop the image? or not with the current architecture?

@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 7, 2017

any way we can crop the image? or not with the current architecture?

Doesn't look like it :\ I've tried a few things within the SVG, but ultimately it comes down to librsvg reporting the sub's position relative within the "global" SVG space. Gtk.Image doesn't allow you to reposition elements within its image (and rightfully so, that's none of its business), and neither does GdkPixbuf.Pixbuf as far as I can see. That means we'd need to solve it with Cairo, but I'm not too familiar with that. I've asked on #cairo but have yet receive a reply there.

@julianrichen
Copy link
Contributor

I'm not really sure about the limitations of Rsvg as I briefly read the docs but in SVG you can place groups inside of <defs> and retrieve just the group with <use>. Would that work?

<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg">
    <style>
        ...
    </style> 
    <defs>
        <g id="Device">
            ...
        </g>
        <g id="Buttons">
            ...
        </g>
        <g id="LEDs">
            ...
        </g>
    </defs>

    <use x="0" y="0" href="#Device" />
</svg>

Maybe only have the groups inside of <defs> in the file (ex. logitech-g303.svg) and then let Rsvg create a new SVG document and import the file and declare the image with <use>? Would require changing the current SVG files.

@Hjdskes
Copy link
Member Author

Hjdskes commented Aug 7, 2017

Would that work?

A quick test shows that librsvg doesn't support this; the SVG comes up empty now, but weirdly it does have the right dimensions.

@whot
Copy link
Member

whot commented Aug 9, 2017

Merging this for now because it works, the welcome screen is a niche case anyway and we don't have a solution for the svg just yet. I'd still like you to figure out a solution for that, but for now let's get this in.

@whot whot merged commit bdc11e2 into libratbag:master Aug 9, 2017
@Hjdskes Hjdskes deleted the welcome branch August 9, 2017 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants