Ghini / ghini.desktop

plant collections manager (desktop version)
http://ghini.github.io/
GNU General Public License v2.0
24 stars 14 forks source link

consider unicode spinner #420

Closed mfrasca closed 6 years ago

mfrasca commented 6 years ago

we have a small spinner, built on braille characters, showing in sequence one of ⣄⡆⠇⠋⠙⠸⢰⣠ this has the advantage that it can be part of any string, at any place, for these characters all use up the same space in the string. for isolated spinners, what about we use the angle property of Gtk.Label? not all characters are equally usable, for not all stay at the same spot when rotated. the one I like most: I think this is funny: (tea) these look fine as long as they aren't rotating: and if we were Chinese, we could consider: (wait)

you make this easily spin, by adding this code to a presenter initializer:

    self.spinner = self.view.widgets.<spinning label id>
    self.angle = 0
    GLib.timeout_add(20, self.rotate)

and the callback would look like this:

def rotate(self):
    self.angle -= 5
    self.angle %= 360
    self.spinner.set_angle(self.angle)
    return True

right, maybe 5 degrees is too smooth, and 20ms is too often, but see it for yourself.

mfrasca commented 6 years ago

Used it in #421 - #328 (Pocket Server) and it looks quite nice. The main problem with it is that when you set the angle of a label to 45 (135, etc), it might become higher than it is at angle=0°, 90°, etc. in PocketServer I put the label in a double-height button in a grid, so this does not become noticeable. But in a normal label no, it won't easily work.