-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Object coordinates R2: rebased from master in 2018 Re #2559, #6078 #8457
Conversation
…n using object navigation commands (rebased with master in June 2016). re nvaccess#2559
…vObj event. re nvaccess#2559 As object coordinate announcement will be done regardless of focus movement, it was decided to let becomeNavObject event call call object coordinate player function in screen explorer. This means global commands will not use this method (this decisoin was made after talking to Jamie Teh and others).
…ec module (after rebasing with master). re nvaccess#2559.
…access#2559. In NVDA 2017.1, it is possible to hear mouse coordinates on multi-monitor systems. Thus object coordinate announcement function has been modified to take advantage of this. To ensure backward compatibility, minimum screen position paremeter will be a keyword argument, ready to become mandatory if obj coordinate announcement from multi-monitor set ups is desired.
nvaccess#2559. Reviewed by Mick Curran (NV Access)L due to some issues, object brightness won't make sense when playing coordinates, so tell coordinates player function to ignore this. Also updated copyright year.
…ovided. Re nvaccess#2559. In some cases, obj.location is None, which means TypeError is raised because there's nothing to iterate ovdr. Thus, for cases like this, do not play coordinate beep.
Reviewed by @LeonarddeR: if braille is set to auto-tether and if this is a focused object, tones will not play because the event returns early. To get around this, play the tone first.
Hi, In addition to rebasing on master, it also removes mouseHandler.playAudioCoordinates function as no other module uses this function in Core. Mouse handler itself will call screen explorer function. Thanks. |
source/gui/settingsDialogs.py
Outdated
@@ -1487,10 +1487,16 @@ def makeSettings(self, settingsSizer): | |||
|
|||
# Translators: This is the label for a checkbox in the | |||
# object presentation settings panel. | |||
objCoordinatesText = _("&Play object coordinates")) | |||
self.playObjectCoordinatesCheckBox=sHelper.addItem(wx.CheckBox(self,label=objCoordinatesText)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the implementation in becomeNavigatorObject stays as it is, I'd prefer not to have coordinates played for focus changes. May be it is a good idea to make this option a combo box, as you suggested earlier.
@type obj: int | ||
""" | ||
# Have a fake wx.Point in case min pos is not defined on multiple monitors. | ||
if screenMinPos is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should this be allowed? See my comment below about the way you calculate the screen width and height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
This came about due to wx.Point fix in order to support mouse tracking on multiple monitors (Reef knows more about this than I do).
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we should step away from getting this information from wx and use GetSystemMetrics instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, see the SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN and SM_YVIRTUALSCREEN. If I understand the code correctly (and probably I don't), throwing these four constants at GetSystemMetrics would make mouseHandler.getTotalWidthAndHeightAndMinimumPosition obsolete.
source/screenExplorer.py
Outdated
if screenMinPos is None: | ||
screenMinPos = wx.Point() | ||
# Do not play any tone if offscreen. | ||
if 0 <= x <= screenWidth or 0 <= y <= screenHeight: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a matter of style, but personally I'd prefer this to return early.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Ah, the chained comparison: my message in that fragment was that it should play coordinate beep as long as x and y are referring to things on screen. It was done like this because in browse mode, things will show up offscreen.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would also prefer that the logic in this if
statement was reversed and just had an early return. This reduces the indentation level of everything below.
source/screenExplorer.py
Outdated
startY=min(max(y-blurFactor,0),screenHeight)+screenMinPos.y | ||
width=min(blurFactor+1,screenWidth) | ||
height=min(blurFactor+1,screenHeight) | ||
grey=screenBitmap.rgbPixelBrightness(mouseHandler.scrBmpObj.captureImage( startX, startY, width, height)[0][0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move the scrBmpObj to screenExplorer as well? It currently makes no sense within the scope of mouseHandler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Hmmm, the object itself is initialized and nullified when mouse handler starts and ends, respectively. We need to gather more feedback regarding this, as it could break features if this is moved without careful thinking. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no other references to scrBmpObj
outside of mouseHandler.py
, you can confirm with git grep -i scrBmpObj
.
Are you worried that addons are using it? My preference would be to understand its usage, and what the intention was behind initialising it this way, with the goal of moving it out of mouseHandler
source/screenExplorer.py
Outdated
l,t,w,h=obj.location | ||
x = l+(w/2) | ||
y = t+(h/2) | ||
screenWidth, screenHeight = api.getDesktopObject().location[-2:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually the main concern I mentioned earlier. Could you please bring this in line with how mouseHandler does this (i.e. use mouseHandler.getTotalWidthAndHeightAndMinimumPosition)
I think it makes sense to move some functionality to a new module. May be locationHelper could be a fit for this. I propose at least moving the following functions, as they aren't specific to the mouseHandler.
- getTotalWidthAndHeightAndMinimumPosition
- getMinMaxPoints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Code reorg: I propose putting this as part of Python 3 transition.
Thanks.
source/screenExplorer.py
Outdated
screenWidth, screenHeight = api.getDesktopObject().location[-2:] | ||
try: | ||
playLocationCoordinates(x, y, screenWidth, screenHeight, detectBrightness=False) | ||
except AttributeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What could cause the AttributeError here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Bad assumptions from my part: it was added because it was originally part of mouse handler. Testing shows this is no needed anymore.
Thanks for catching this and helping me update my assumptions.
Reviewed by @LeonarddeR (Babbage) and catching log errors: * screenExplorer.playObjectCoordinates: catching attribute error is no longer necessary (born from old assumptions as the code was part of mouse handler at first). * gui/settingsDialogs: remove extra right parenthesis from object coordinate control label.
Reviewed by @LeonarddeR (Babbage): make object coordinate announcement a combo box: * Config spec: object coordinates is now an option list. * Settings: checkbox -> combo box, using same logic as progress bar output setting. * NVDAObbjects/event_becomeNavigatorObject: detect different coordinate announcement settings and play coordinate beep if appropriate (for example, only play beeps if focus has moved and is told to play it when focus moves or both object navigation and focus).
…oggle this setting. Re nvaccess#2559.
Reviewed by @LeonarddeR 9Babbage): pull in multiple displays support from mouse handler. This reolsves a potential problem where coordinates will not be played if moving to an object located on secondary displays.
Hi, To @LeonarddeR: hope I addressed your comments. Thanks. |
source/globalCommands.py
Outdated
@@ -1463,6 +1463,29 @@ def script_toggleProgressBarOutput(self,gesture): | |||
script_toggleProgressBarOutput.__doc__=_("Toggles between beeps, speech, beeps and speech, and off, for reporting progress bar updates") | |||
script_toggleProgressBarOutput.category=SCRCAT_SPEECH | |||
|
|||
def script_togglePlayObjectCoordinates(self,gesture): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change this implementation to follow the implementation strategy of script_braille_toggleFocusContextPresentation? This includes creating constants for objFocus, objNav, both, etc.
Alternatively, you can choose the implementation of script_toggleReportLineIndentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, perhaps define a dictionary first with the expected values and the ui messages, then you can get the index of the current playObjectCoordinates
value increment it, and fetch the ui message from the dictionary for the new playObjextCoordinates
value.
Hi, I'm willing to yield this pull request to higher priority work. in the meantime, I'll generate a try build for adventurers to test with. Thanks. |
Hi,, That high-priority work (Python 3) is done, so I'm coming back to this. I'll do something about this PR this week. Thanks. |
PR introduces Flake8 errors 😲 See test results for Failed build of commit abbd8791b5 |
Lint work include: * Global commands: convert the script to use script decorator. * Spacing around operators. * Split long lines.
Hi, Being considered for abandoning it in light of #11006. Thanks. |
If you are no longer interested in making this change, please do say so. Otherwise please continue to work on this PR. #11006 requests no new PR's. This PR already exists and is thus in the backlog of PR's that we want to address before accepting new ones. We are trying to stop PR's from going stale, and then becoming hard to merge. Forgive me for replying to you multiple times, I want to avoid the community being mislead. |
I’ll do another rebase attempt and see if it is feasible to continue this work.
|
See test results for failed build of commit fb09f17911 |
Hi, Update: yep, the PR is back. At least until coordinates-based audio themes comes to NVDA (there is an add-on out there already), I think this PR would serve useful purposes. Thanks. |
We have discussed this and have decided that although interesting it would be better as an addon to explore the user experience. If necessary, we would accept a PR to enable support for an addon such as this. |
Hi, the add-on is already available: Object Location Tones, or better yet, Audio Themes 3D. Thanks.
|
Hi,
As requested by @michaelDCurran in #6078:
Link to issue number:
Fixes #2559
Summary of the issue:
Play object coordiantes R2: rebased on 2018 master (see #2559 for details).
Description of how this pull request fixes the issue:
See #6078 discussion history.
Testing performed:
Same as #6078.
Known issues with pull request:
None, although @LeonarddeR raised concerns which should be addressed.
Change log entry:
Same as #6078, although the scope can cover focus movement as well.