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

[RFC] new UI #571

Closed
wants to merge 36 commits into from
Closed

Conversation

benoit-pierre
Copy link
Member

@benoit-pierre benoit-pierre commented Aug 7, 2016

The goal of this PR is get feedback on the new UI rewrite.

Test builds

Note: the new UI is available for the Python 3 builds on Windows and OS X. For Linux, the Debian package still uses Python 2, and provide both the (old) WX UI and the new PyQt5 based UI, launch Plover with plover -g qt to select the new UI (and of course Python 3 is supported if you run from source). The Debian package now uses Python 3 too, and the new UI is automatically selected.

Major differences

  • The engine uses a dedicated thread.
  • The UI is localized: for now only full localization for French is available. For testing purpose, the LANGUAGE environment variable can be set to override the locale detection. Note that part of some dialogs will already be automatically localized thanks to Qt own localizations (e.g. standard OK/Cancel buttons labels), or by the OS (e.g. on Windows a native file browser is used).
  • window states (size and position, fonts used) are saved using Qt settings' API (instead of Plover's configuration); rational: make it easier to use the same configuration on different devices (using different fonts for different display DPI..., window sizes, etc...).

Known issues

  • [OS X] there's no differentiation between a right and left click on the tray icon.
  • [OS X] on quitting with Ctrl+Q, the warning about closing the main window is shown.
  • [OS X] the default font in the paper tape is not monospaced (not a major issue as it's now user configurable).
  • [Windows] one report of various crashes when using the 64bits build on Windows 7 (e.g. when re-ordering in the dictionaries manager).
  • [Linux] the tray icon does not work right on Ubuntu 14.04 Trusty (the PyQt5 version available is really old).
  • [Linux] minimize on start does not work when tray icon support is not available

Main window

main_window

Menu layout:

File
  Toggle output
  Reconnect machine
  -----------------
  Configure
  -----------------
  Show/Hide
  Quit Plover
Tools
  New translation
  Lookup
  Manage dictionaries
  -------------------
  Paper tape
  Suggestions
Help
  About

Tray icon

The tray icon is automatically enabled when supported.

3 different state icons (reused from #263, as I'm not much of an artist, I hope it's all right @gcr) are used:

  • machine disconnected:

state-disconnected

  • machine connected, output disabled:

state-disabled

  • machine connected, output enabled:

state-enabled

Context menu layout:

Toggle output
Reconnect machine
-----------------
Tools
  New translation
  Lookup
  Manage dictionaries
  -------------------
  Paper tape
  Suggestions
-----------------
Configure
-----------------
Help
  About
-----------------
Show/Hide
Quit Plover

Configuration

configuration

Dictionaries Manager

dictionaries_manager

Note:

  • I kept the original ordering, about flipping it: highest priority (user) dictionary on top? This way the top (visible on open) of the list will contain the dictionaries the user is more likely to interact with, and the list will match the order the dictionaries are searched.
  • Drag & dropping a dictionary file from an external file manager on to the list should add it to Plover.

Dictionary Editor

dictionary_editor

Add Translation

add_translation

Lookup

lookup

Paper Tape

paper_tape

Suggestions

suggestions

About

about

@benoit-pierre
Copy link
Member Author

The behavior of the old UI with regard to focusing back the previous window has been kept when a dialog was triggered through a translation command (for lookup, add translation, and configure), but I really think it should be possible to disable it. IMHO it's not needed on Linux; as any good window manager already does what's right, and our code as some annoying side effects (like raising the previous window when focusing it back, which can result in some previous visible windows getting hidden), how about a new interface setting?

Similarly, remembering window positions/sizes can be annoying when you want to use your window manager facilities to automatically layout Plover's windows in a set way.

@morinted
Copy link
Member

morinted commented Aug 8, 2016

I noticed today that I can't write emoji into the Add Translation dialog box on Mac with Plover, but I can paste them in. Can you reproduce this on Windows or Linux?

@benoit-pierre
Copy link
Member Author

It works fine on Linux with "SHR*UG/SHR*UG": "¯\\_(ツ)_/¯", but not with my Windows 10 VM...

@benoit-pierre
Copy link
Member Author

benoit-pierre commented Aug 8, 2016

New release: ui_preview_2: include a fixed pyobjc-core version so emojis work on OS X.

@morinted
Copy link
Member

morinted commented Aug 8, 2016

So "¯_(ツ)_/¯" works on OS X, but the emoji don't register at all. Also of
note, I can't get the character viewer to show up:
https://support.apple.com/en-ca/HT201586

This makes me think that maybe QT is missing a flag or something to allow
this behavior. On Windows it might just not handle attaching a character to
a string like we found with older applications.

On Mon, Aug 8, 2016 at 11:39 AM, Benoit Pierre notifications@github.com
wrote:

New release: ui_preview_2
https://github.com/benoit-pierre/plover/releases/tag/ui_preview_2:
include a fixed pyobjc-core version so emojis work in OS X.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#571 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFkgSi6uZ0FewOuv0SisHtHJJ1flOiSWks5qd02_gaJpZM4Jed8j
.

@benoit-pierre
Copy link
Member Author

How about when running from source?

@morinted
Copy link
Member

morinted commented Aug 8, 2016

The behavior is the same when running from source.

@benoit-pierre
Copy link
Member Author

OK, so the build is not missing a library.

@morinted
Copy link
Member

morinted commented Aug 8, 2016

This is ancient: https://bugreports.qt.io/browse/QTBUG-8979

@morinted
Copy link
Member

morinted commented Aug 8, 2016

Maybe we can also get @gcr to make some visually simpler tray icons, like a simplified steno layout so that it isn't as cramped as the full layout in the tray. I did this once before for a simplified hardware button on the open steno site: http://www.openstenoproject.org/images/icon-hardware-2x.png

Ideally the icons would be square as well but I acknowledge that that's a lot to ask 😁

@benoit-pierre
Copy link
Member Author

Yeah, I also wonder how they look on a white background: needs some border on all elements.

@SyntaxBlitz
Copy link

Pretty bad!
image

This, when I hold down my mouse on the icon:
image

@morinted
Copy link
Member

morinted commented Aug 8, 2016

In the machine configuration, the machine options are under an "options"
section. Would it be possible to simply place the options in the top-level
of the machine config? Something about the nesting looks particularly off
on Mac. I don't think the grouping is particularly valuable either since
the only other option is the key map which is an option anyway. And the
Tréal just shouldn't show anything other than the key map since it has no
options.

On Mon, Aug 8, 2016 at 11:59 AM, Timothy Aveni notifications@github.com
wrote:

Pretty bad!
[image: image]
https://cloud.githubusercontent.com/assets/1474671/17486635/92b4f988-5d5f-11e6-8072-d79674bab656.png

This, when I hold down my mouse on the icon:
[image: image]
https://cloud.githubusercontent.com/assets/1474671/17486646/9d93f0e8-5d5f-11e6-815f-eb52bc779b9b.png


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#571 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFkgSh4fHvy2Arehh9YS0IRHg2dmy2nJks5qd1J7gaJpZM4Jed8j
.

@morinted
Copy link
Member

morinted commented Aug 8, 2016

I can get the character viewer to work on Mac by including an empty "Edit" menu entry next to File, Dictionaries, and Tools. This is discussed in this QT issue: https://bugreports.qt.io/browse/QTBUG-40514?jql=text%20~%20%22character%20viewer%22%20ORDER%20BY%20created%20DESC

Unfortunately I still can't write emoji with Plover into the application, but at least I can bring up the character selector to select them.

There are also many good human interface guidelines that I'll probably have to peruse in order to improve Plover's behavior according to Mac standards.

@morinted
Copy link
Member

morinted commented Aug 8, 2016

Here's what it looks like:

edit menu

Of note, the edit menu doesn't show until OS X attaches the emoji & symbols item (about 1 to 2 seconds after start up)

@morinted
Copy link
Member

morinted commented Aug 8, 2016

It's also strange to me how the output check box is just hanging out in the center of the window. I'm not quite sure what the solution is…but because the UI is somewhat malleable you can get into a weird state like:

I'm splitting hairs

I'm downloading the QT creator so I'll have a chance to play with some of this stuff.

@morinted
Copy link
Member

morinted commented Aug 8, 2016

When editing dictionaries, the dictionary editor opens inline, and shares the dictionary manager's window. This means that the only way to close the dictionary editor is with the escape key.

screen shot 2016-08-08 at 3 00 52 pm

screen shot 2016-08-08 at 3 01 08 pm

@morinted
Copy link
Member

morinted commented Aug 8, 2016

I dislike the gradient given to the toolbar all over the place. I've implemented a workaround.

  • All the windows have default 12 padding which looks very big on OS X. I think a better default would be 6 if possible.

Next, for the toolbar:

diff --git a/plover/gui_qt/utils.py b/plover/gui_qt/utils.py
index b36273b..e68a0c0 100644
--- a/plover/gui_qt/utils.py
+++ b/plover/gui_qt/utils.py
@@ -1,12 +1,15 @@

-from PyQt5.QtCore import QSettings
+from PyQt5.QtCore import QSettings, QSize
 from PyQt5.QtWidgets import (
     QMainWindow,
     QMenu,
     QToolBar,
     QToolButton,
+    QStyleFactory,
 )

+import sys
+

 def ToolButton(action):
     button = QToolButton()
@@ -18,6 +21,9 @@ def ToolBar(*action_list):
     toolbar = QToolBar()
     for action in action_list:
         toolbar.addWidget(ToolButton(action))
+    if sys.platform.startswith('darwin'):
+        toolbar.setStyle(QStyleFactory.create('windows'))
+        toolbar.setIconSize(QSize(23, 16))
     return toolbar

screen shot 2016-08-08 at 6 20 04 pm

@morinted
Copy link
Member

morinted commented Aug 9, 2016

I've made some changes for OS X, all of them bundled into this commit: morinted@933784e

Icons

  • I changed to an SVG icon pack -- https://materialdesignicons.com/ which are MIT licensed (which is OK to use in our project, I believe since GPL is a more restrictive license) I think these are a little more modern than the set used previously and I gave some thought as to which icons to use.

To do that required a loader, which renders the icons at 2x the resolution required (Mac need 2x for retina, which is activated for Pixmaps with self._app.setAttribute(Qt.AA_UseHighDpiPixmaps)

screen shot 2016-08-08 at 10 43 32 pm

screen shot 2016-08-08 at 10 59 34 pm

- You can see the pin in/out icon change

screen shot 2016-08-08 at 10 59 39 pm

screen shot 2016-08-08 at 10 59 43 pm

- I also implemented coloring the SVG in case we decided to use different colors (I noticed the menu icons are black which isn't ideal)

screen shot 2016-08-08 at 11 01 29 pm

Tray Icon Mask

The tray icon in QT can mask to black or white depending on the user's menu bar coloring if we use icon.setIsMask(True)

Padding

The padding has been adjusted for what I think looks good on Mac.


The commit is really messy. Just let me know what you think before we continue.

EDIT: I removed the add translation button from the dictionary manager because it's confusing out of context (it's on the main window and available through many windows anyway)

@stenoknight
Copy link
Member

That new icon pack is a huge improvement!!! It looks really, really nice.

On Aug 8, 2016 11:23 PM, "Ted Morin" notifications@github.com wrote:

I've made some changes for OS X, all of them bundled into this commit:
morinted/plover@933784e
morinted@933784e
Icons

  • I changed to an SVG icon pack -- https://materialdesignicons.com/
    which are MIT licensed (which is OK to use in our project, I believe since
    GPL is a more restrictive license) I think these are a little more
    modern than the set used previously and I gave some thought as to which
    icons to use.

To do that required a loader, which renders the icons at 2x the resolution
required (Mac need 2x for retina, which is activated for Pixmaps with
self._app.setAttribute(Qt.AA_UseHighDpiPixmaps)

[image: screen shot 2016-08-08 at 10 43 32 pm]
https://cloud.githubusercontent.com/assets/5840970/17503401/8f7d9884-5dbd-11e6-9024-77864b2fe808.png
[image: screen shot 2016-08-08 at 10 59 34 pm]
https://cloud.githubusercontent.com/assets/5840970/17503400/8f7a49f4-5dbd-11e6-98e3-11d0940af714.png

  • You can see the pin in/out icon change

[image: screen shot 2016-08-08 at 10 59 39 pm]
https://cloud.githubusercontent.com/assets/5840970/17503399/8f73482a-5dbd-11e6-9520-4ffcf3c8f2f6.png
[image: screen shot 2016-08-08 at 10 59 43 pm]
https://cloud.githubusercontent.com/assets/5840970/17503397/8f70997c-5dbd-11e6-93c8-68c1b5b4d4ba.png

  • I also implemented coloring the SVG in case we decided to use
    different colors (I noticed the menu icons are black which isn't ideal)

[image: screen shot 2016-08-08 at 11 01 29 pm]
https://cloud.githubusercontent.com/assets/5840970/17503398/8f7240a6-5dbd-11e6-83e4-1b0fdc0e2f9b.png
Tray Icon Mask

In OSX you can made the icon look better on the light-bar by setting:
icon.setIsMask(True)
Padding

The padding has been adjusted for what I think looks good on Mac.

The commit is really messy. Just let me know what you think before we
continue.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#571 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMvPmjuiTGYybJOQdfozuuCaghb5Tlgks5qd_J7gaJpZM4Jed8j
.

@morinted
Copy link
Member

morinted commented Aug 9, 2016

I was thinking, too, that the icon color could be configurable for users who have dark themes. Not sure if we can decouple the icon color in menus from the one in the UI but that would also be useful on macOS

@morinted
Copy link
Member

The icons above are no good because they don't work well on light/dark themes. I really like icons8, but they are non-free and so even though they "support" open source projects, I don't see how we can release them with a GPL-licensed Plover.

Therefore, I'm going to try and use their MIT-licensed icons instead, and create new icons based off of those: https://github.com/icons8/flat-color-icons

It will take a couple days for me to get them to a point that I'm happy. In the meanwhile, here are a couple of them in use (I'm going to be adjusting some of them and swapping out others…)

screen shot 2016-08-10 at 3 25 13 pm

@morinted
Copy link
Member

  1. Would it be possible for the machine options to be inlined instead of nested? Or is that two tough because one is a list and the other a grid?
  2. In the dictionary editor, you cannot undo after deleting one entry → you can undo after deleting two entries, which then allows you to undo the first deletion as well.
  3. Continuing to work with the icons, it feels good working with the MIT and GPL-licensed icons—I don't feel guilty for modifying and morphing them into something new. Here is what I've got so far, what's left is keep on top, choose font, clear, and save:
    plover_icons

@benoit-pierre
Copy link
Member Author

Would it be possible for the machine options to be inlined instead of nested? Or is that two tough because one is a list and the other a grid?

No, the machine options are one widget. Changing that would break the whole "programatically create/layout the configuration dialog".

In the dictionary editor, you cannot undo after deleting one entry → you can undo after deleting two entries, which then allows you to undo the first deletion as well.

Fixed.

@benoit-pierre
Copy link
Member Author

New preview: ui_preview_3

@morinted
Copy link
Member

Tray icon attempts:

screen shot 2016-08-12 at 9 45 38 am


I've completed my icon set:

screen shot 2016-08-12 at 9 47 54 am


I was brain storming as to what we could do with the main window, if we decide to drop the minimalist interface in favor of the tray icon's menu: please excuse poor proportions and penmanship

screen shot 2016-08-12 at 9 38 46 am

The machine drop down lets you change between configured machines, but the settings gear takes you to that machine's configuration in case it doesn't connect right away. The dictionary manager is below. The priority dictionary has a star next to it to say that it has priority (probably user configurable since "real" steno software always has things ordered opposite)

The up/down arrows are there in case the user doesn't want to drag-and-drop to reorder.

@benoit-pierre
Copy link
Member Author

New preview: ui_preview_7

@benoit-pierre
Copy link
Member Author

Closing this, a new PR will be prepared for merging to master.

@benoit-pierre benoit-pierre mentioned this pull request Oct 2, 2016
@benoit-pierre benoit-pierre mentioned this pull request May 12, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants