weeks[5].toString(); // Navigation

First of all, the good news: I’ve passed the midterm evaluation, so the project goes on! 🙂

I want to thank Marc Sabatella for all his help and patience so far! He is a great mentor and I’m very happy to work with him! 🙂

This week I’ve continued working at the navigation commands.

1. Navigation

1.1 What I’ve done

– Finished the home command

– Finished the end command

– Finished the next element command

– Finished the previous element command

1.2 Problems

– There were some problems with the barlines, because they weren’t traversed just for the first staff, since the assigned voice was voice 0. To fix this problem I’ve created a variable that keeps the track of the previous element selected. In this way I can “look behind” and to find on what staff I am. I just finished writing the code for this, so I still need to do a bit of testing.

– I made a wrong assumption that in a ChordRest segment, on a staff can be either chords, or a rest. I fixed this problem, but I didn’t like the fact that I was jumping from one voice to another with my functions, so I used Marc Sabatella’s functions upAlt and downAlt.

– I found a solution to the segment problem that I’ve stated in the previous post. To find the segment for any element, for spanners I’m using the starting/ending segment – depending on the direction of navigation – and for other elements I’m going from parent to parent until I find the element that inherits the Segment class.

1.3 What else needs to be done

– I still need to implement a way to traverses articulations and annotations, but I think I will do this after I implement the screen-reader feedback. There are to ways to do this: either implement a diferent command, or add them to this command. For now, if an element from those to groups is selected the navigation command finds the first non-attached element and selects it. For note-attached elements, it goes to the note, for segment attached elements, it goes to the first element from that segment, etc. Like Marc said, it would be best to implement both variants and pick one after that, but I’m not yet sure how to do them, so as I said, I’m moving to the screen-reader feedback for now. This will also be a factor in deciding how to implement the traversing.

 

That’s all for this week! See you next Sunday!

weeks[4].toString(); // More Dialogs and Navigation

It’s time for a new weekly blogpost! 🙂

This week I’ve continued working on dialogs and I started implementing new navigation commands.

1. Dialogs

1.1 What I’ve done

As usual I’ve made sure that the focus policies and the tabbing order are correct and also that the appropriate screen-reader is provided for the next dialogs/wizards:

– Inspector (all UIs)

– Instrurment Wizard

– New Wizard

– Time Signature wizard

– Create new score dialog

1.2 Problems

–  I fixed two minor bugs in the shorcut capture dialog: Clear button was a QToolButton instead of a QPushButton, so when pressing Enter, the Add button was pressed, also pressing Clear button did not disable the Add and Replace buttons.

– I’ve found a Qt bug regarding the QTreeWidget object. When pressing Enter the QTreeWidget object handles the key press event, but doesn’t stop it, so the event goes to the next object. This is why, if you select an instrument in the Create new score dialog and press Enter, the instrument is added, but also the Next button is pressed. The same thing happens in the Prefferences dialog with shotcuts, if you press Enter the shorcut capture dialog is opened, but when it’s closed, the Ok button is pressed as well and the Prefferences dialog closes too.

– I also have some problems with the screen-reader feedback for the added instruments

1.3 What else needs to be done

– Fix the last two problems mentioned

– Since the key signature is added using the palettes, that part will work once I start working at them

– Other dialogs

– Now that the focus policy for every individual element of the Inspector has been set, I’m waiting for the branch with the action restructuring to be merged into the main repository, so that I can rebase this branch on top of those changes and add the Inspector to the tabbing order

 

2. Navigation

The goal here is to create some commands that will enable blind users to traverse all the score elements. This week I familiarized with how the score is stored.

2.1 What I’ve done

I’ve almost finished writing a command that will enable blind users to “read” the score. This command traverses staff by staff all the main (non attached) elements: clefs, key signatures, notes (from top to buttom in a chord), rests, barlines, breaths. This command will work great in combination with the screen-reader feedback that I will implement later, since the screen-reader will have to tell not only the main elements, but also the attached elements. For example, if I have a C note, with a # accidental, I don’t want to have to traverse the C note, and after that the accidental, to find out the pitch. I want to traverse the note and the screen-reader should tell me C#. Of course, I will implement another command to traverse this element’s attached elements, since users don’t need just to know that they are there, they have to be able to select them and edit them, without using the mouse.

2.2 Problems

– The implemented command works well when the selected element is one of those enumerated above, the problem appears when the selected element is not of them. To solve this I need to find a way to get to the parent segment of every element, prefferably with as few ifs as possible.

2.3 What else needs to be done

– Now, the command, only traverses one staff and I need to implement something to make it go to the next staff as well

– Implement the command for traversing the attached elements

 

That’s all for this week! 🙂

 

 

weeks[3].toString(); //Actions, shortcuts and dialogs

I would like to start this post by saying that I’ve finished my finals. Starting from now, I’m going to dedicate my full time to this project. 🙂

This week I’ve worked on the following issues:

1. Actions and shorcuts

1.1 What I’ve done

I’ve implemented the solution that I’ve talked about in the previous post.

Here is the discussion from the mailing list[0]. You will find there more details then in my previous blog post.

Remainder:

There were three steps in this solution

I.  Move every QAction that affects the score in the ScoreTab object and change their shorcutcontext from WindowShortcut to WidgetWithChildrenShortcut, leaving in the MuseScore object (Main window) just those that open subwindows, dialogs,etc.
II.  Set the focus policy for all the other subwindows of the main window so that the they don’t receive focus by clicking on their elements (except for the case when text editing is necesary)
III. (optional) Restrict the user from assigning keys like Return, Tab, Arrow keys as shortcuts.

After talking to Marc, I’ve only created a restriction for the Tab key, because there was not way for a blind user to move around the shortcut capture dialog. Before, if the Tab key was pressed it was seen as a shorcut assignement and it was not ok, since it is crucial for blind users to be able to configure their preffered shorctus.

1.2 Problems

The only problem here was knowing which action should go where. There wasn’t an exact criteria for this.

You can find a google doc with the shorcut asiggnmets here[1]:

 

And with this solution I’ve created my first pull request for the accessible-toolbar. 🙂

 

2. Dialogs

2.1 What I’ve done

I’ve finished adding the screen-reader feedback for all the elements of the prefferences dialog and also for the shorcut capture dialog.

2.2 Problems

I didn’t have big problems, but there are some glitches.

– One of the things is that the screen-reader doesn’t tell the new values of the combo boxes when they are changed

– The second one is a two way street. On one hand I don’t like that in dialogs like Preferences the screen-reader reads the QLabels, but on the other hand it is importand that it reads them in small dialog windows, like shortcut capture dialog, or warning/error dialogs

2.3 What else needs to be done

Here the next will be to start working on the Inspector.

[0] http://dev-list.musescore.org/Keyboard-usability-and-accessibility-tt7578844.html

[1] https://docs.google.com/spreadsheets/d/1RbOLweFvoXxSYrJ-BMFmUiL1_b0lgzJvlDjPbbRcCew/edit?usp=sharing

weeks[2].toString(); //Keyboard control (Actions and shortcuts)

It’s time for a new weekly blog post. 🙂

This week was a bit unusual, so I can’t structure this blog post in the way that I did before. I’ve mostly worked on tabbing through the main window. I’ve managed to remove from the tabbing order every subwindow of the main window that doesn’t have yet support for accessibility. These are: MuseScore Connect, Palette, Piano and Inspector. Everything looked good at this point, I was preparing to make my first Pull Request and just when I was thinking about it, I started talking to Marc Sabatella, telling him what I’ve did, what works and what are my concernes. At the end of this conversation, we both understood that the Return key problem was just a piece of the bigger picture. There is the same problem with the arrow keys and some other shortcuts used for editing and selecting text (like Ctrl+A, Shift+RightArrow, etc).

It was clear that I could not treat every shortcut that creates conflicts like a KeyPressEvent for two main reasons:
– first of all this would meant that a lot of shortcuts would have been hardcoded. Shortcuts are now configurable through the preferences dialog, using the shortcuts tab, or using directly the shortcuts.xml file
– secondly, there was no way of knowing what shortcuts would every user add/change. I’ve removed that Enter key from being a shortcut, but that doesn’t stop any user to add it again .

Remainder: The problem with the Return key was that the shortcut was global and other objects did not receive an event when it was pressed, because Qt was sending the event to the QAction object that had the key assigned to instead of seding it to the widget that had focus at that moment.
The bigger picture: All shortcuts are global and any key or key sequence that is assigned as shortcut will be sent to the QAction object, instead of the widget that has focus.

I needed to find a new solution, that was general enough to cover if not all, at least most of the usecases. This is the solution that I was able to come up with:
1. Move every QAction that affects the score in the ScoreTab object and change their shorcutcontext from WindowShortcut to WidgetWithChildrenShortcut, leaving in the MuseScore object (Main window) just those that open subwindows, dialogs,etc.
2. Set the focus policy for all the other subwindows of the main window so that the they don’t receive focus by clicking on their elements (except for the case when text editing is necesary)
3. (optional) Restrict the user from assigning keys like Return, Tab, Arrow keys as shortcuts.

Details:
For 1. I will create a global enum that will specify for what window/object is the QAction intended. In this way, if in the future other actions will be added that are supposed to go in other objects, the only thing that will be needed is to add a new value for that enum. Since every action is instantiated in the action.cpp file using a Shortcut object, I will put a variable of that enum type as field in the Shortcut object.

For 2. : Since all actions are in the main window at the moment and their shortcut context is WindowShortcut, the focus *appears* to be always in the scoretab. In order to preserve this behavior where this is desired and avoid the bad examples I’ve given above I need to set the focus policy for all the other objects so that they don’t give away the focus to other elements. It would be nice to set a property for scoretab so that it doesn’t give away the focus, but this is not possible. The only usecase I see when the focus should leave the scoretab is when editing text in another subwindow.

For 3: This step is debatable. With the default shortcuts assigned in the way they are now, everything will work as desired, but this doesn’t mean that a user cannot reassign keys like: Return, Tab, Arrow keys as shortcuts for other actions and create problems. This is a question if we consider that is MuseScore’s responsability to restrict the user from poorly assigning shortcuts, or it is the user’s responsability. In the first case, the above mentioned keys will be handled like KeyPressEvents in the scoretab object and their behavior for the scoretab will be hardcoded.

I’ve sent this proposal to the MuseScore mailing list hoping that it will be aproved by the community, since it is a big change. I also asked the following questions:

Q1: What do you think about step 3?
Q2: Do you know other usecases in which  the scoretab should give away the focus, except when editing text?

What I forgot to mention on the mailing list is that this change will only affect the way in which the actions are triggered. The chain of functions and verifications that an action travels through for something to actually happen will remain exactly the same. They will be passed as before to the cmd function from the main window using a signal.

The good part is that the time I’ve spent on what I worked until now was not wasted. I implemented enough of the solution so that I can test it and I’ve done this by applying few changes to the code that I’ve already wrote. For step 2 of the solution I’ve used the knowledge that I’ve gain by trying to remove the subwindows from the tabbing order.

Now, I have to make a list of the actions that will remain in the main window. 

As Marc said, things might get even more complicated when I get to the Palettes, but hopefully this solution will be good enough and it will not need (many 🙂 ) changes.

I know I promissed a howto post this week, but as it turns out, it is a good thing that I didn’t publish it, since it would have lacked many usefull informations.

Some good news: Thursday I will have my last exam, so after that I’m going to devote all my time to this project.

Thank you for taking the time to read this! 🙂

 

weeks[1].toString(); //Tool Bar and Dialogs

Hello everyone!

Before the weekly update, I would like to thank Jaffar Ahmad Sidek for all his help. Jaffar is a blind musician and programmer who is helping me and Marc Sabatella when we are not sure about the details of how an aspect of accessibility should be addressed. By consulting with him we make sure that when this project is finished, MuseScore’s support for accessibility will be what visual impaired musicians expect. Thank you, Jaffar! 🙂

Let’s start with the progress update:

1. Tool Bar

1.1 What I’ve done:

– In the last post I’ve said that there are 5 more objects in the tabbing order that should not be there, now there is only one and with help from Marc, we narrowed down the search place to the Palettes.

– I have fixed the problem of Return key being a global shortcut for the system break command. Remainder: This meant that other objects would not receive any event if the Return key was being pressed. 

Here the problem was a bit more complicated, as David Bolton pointed out some programs choose to create a whole new state for tabbing throught the toolbar when the ALT key is pressed and we weren’t sure if it was a good idea to create a new state for MuseScore. Also the Space key is used for clicking buttons in other programs and in MuseScore it is set as shortcut for score playback.  I’ve asked Jaffar about this issues and here are his answers:

Q: It is expected for the ALT key to be pressed before starting the tabbing?
a: No it is not necessary.
Q: Should tabbing start from the first menu and continue to the tool bar, or it is better like I did it to keep the Tool bar and the menu bar separated?
a: I guess this is a sort of in between answer.  Most modern apps have their menus and tool bars in sync, but older apps have their menu and tool bars separately.  but I think most blind users would prefer to have menus and tool bars separate.
Q: Is it ok if we keep the Space key mapped for Play/Pause score playback? I saw that this is how other programs do it too.
A: Please do.  You are right. most music related apps have the space bar as the play/pause button so most blind users would find it comfortable.
 
Taking his advice, I’ve kept the the tool bar and the menu bar separeted and the Space key mapped as shorcut for score playback. When it comes to the Return key problem, I’ve removed it as a shortcut and now it is treated as a Key Press Event in the scoretab object. The only object who receives a Key Press Event from Qt (by default) is the object that has focus. Now, when a toolbar button has focus and the Return key is pressed, the button will be clicked(his action will be triggered), when the scoretab has focus the system break action is triggered, later if a palette option has focus it will be applied to the score, etc.
You can see the commit here [0] .
1.2 Problems
-The only problem that I’ve encountered here was with Qt. I needed a pointer to the main window (the parent of the scoretab object) so that I could check its state and see if matches the states when the system-break action should be triggered. Even if the constructor of the scoretab was passing the parent pointer to QWidget ( ScoreTab(QList<Score*>* sl, QWidget* parent) : QWidget(parent)  ) and when calling it from the main window like this: new ScoreTab(&scoreList, this); , later on when asking for the parent pointer ( this->parent() ), the result was not what I would’ve expect.I was unable to see the changes made to the main window (like state change) from the pointer. The solution was to create my own pointer in the ScoreTab class and then everything worked perfectly.
 
1.3 What else needs to be done:
– Make the buttons be highlighted when Shift+Tab is pressed ( reverse tabbing)
– After talking to Marc, we’ve concluded that there should be a way to move from subwindow to subwindow (workspace, palettes, toolbar, inspector, etc), using a key sequence and the elements included in the tabbing order should be only those from the current selected subwindow. This is provided out of the box from Qt if the subwindow is undocked, but if not, all it’s objects are included in the tabbing order. Also, the solution for this should be something maintanable, something that should not be changed for every element, button, or new window that will be added to MuseScore in the future.
 
2. Dialogs
2.1 What I’ve done
– I began with the New Score dialog, I’ve set the tabbing order and the screen-reader feedback for the first part of it, but when I’ve moved to the other parts, I’ve noticed that there are dependencies with the clef palette and the instruments dialog and I’ve decided to take more time to carefully read the code before making any changes there.
– In the mean time I’ve set the tabbing order for the whole prefferences dialog and I’ve added the screen-reader feedback for the first tab of the dialog (general).
 
2.2 Problems
The following are problems from Qt:
– The screen-reader tells the text from all the QLabels when the dialog is openend
– Even if the tabbing order is set, you cannot go from button to button in a group if it is set as exclusive. You can only enter the group and move from one button to another using the arrow keys. I have to look more into accessibility guidelines and see how should I address this issue.
 
2.3 What else needs to be done:
– Finnish adding screen-reader support for prefferences dialog
– Finnish setting the tab order and adding screen-reader support for new score dialog
 
Other things worth mentioning:
I’ve looked more into the behavior of the ALT key. When this key is pressed, the first menu should be selected (in MuseScore’s case File menu). This is implemented as default behavior by Qt, so if I create a new application with a menu bar, I get the expected behavior. For some reason this doesn’t happen in MuseScore. Somewhere this behavior is overriden, but I wasn’t able yet to figure out where.
 
Marc Sabatella has approved the changes that I’ve made so far, so I’ve started working on the first “how to” blog post and I will post it during this week.
 
Thank you for taking the time to read this! 🙂