Skip to content

Fix reading empty columns in Windows Explorer on Windows 7#8316

Merged
michaelDCurran merged 2 commits into
nvaccess:masterfrom
lukaszgo1:EmptyColumnsWin7
May 29, 2018
Merged

Fix reading empty columns in Windows Explorer on Windows 7#8316
michaelDCurran merged 2 commits into
nvaccess:masterfrom
lukaszgo1:EmptyColumnsWin7

Conversation

@lukaszgo1

Copy link
Copy Markdown
Contributor

Link to issue number:

None

Summary of the issue:

After Merging #5729 it was no longer possible to read empty columns Such as size for folders in Windows Explorer on Windows 7, because those columns haven't got value under this OS.

Description of how this pull request fixes the issue:

I've added conditional, which checks if value exist, and if not simply returns it without removing LTR and RTL marks.

Testing performed:

Successfully read size column for folder in Windows 7

Known issues with pull request:

None

Change log entry:

None needed, because #5729 wasn't in a release yet.

@LeonarddeR LeonarddeR requested a review from dkager May 21, 2018 17:40
@LeonarddeR

Copy link
Copy Markdown
Collaborator

Could you please provide the steps to reproduce in order to reproduce the issue you're trying to solve?

@lukaszgo1

Copy link
Copy Markdown
Contributor Author

Sure

STR

  • Install recent NVDA next or Master on Windows 7
  • Open Windows Explorer
  • move with the arrows to the size column for folder

Expected

Size read only should be read

Actual

The error sound is played and the following is recorded in the log
ERROR - eventHandler.executeEvent (16:31:14.671):
error executing event: gainFocus on <appModules.explorer.UIProperty object at 0x0503C370> with extra args of {}
Traceback (most recent call last):
File "eventHandler.pyc", line 152, in executeEvent
File "eventHandler.pyc", line 92, in init
File "eventHandler.pyc", line 100, in next
File "appModules\explorer.pyc", line 299, in event_gainFocus
File "eventHandler.pyc", line 100, in next
File "NVDAObjects_init_.pyc", line 961, in event_gainFocus
File "NVDAObjects_init_.pyc", line 849, in reportFocus
File "speech.pyc", line 383, in speakObject
File "speech.pyc", line 275, in speakObjectProperties
File "baseObject.pyc", line 34, in get
File "baseObject.pyc", line 115, in _getPropertyViaCache
File "appModules\explorer.pyc", line 177, in _get_value
AttributeError: 'NoneType' object has no attribute 'replace'

@josephsl

Copy link
Copy Markdown
Contributor

Hi,

To @dkager and @michaelDCurran: can we get this as a fast tract pull request for 2018.2 please? Thanks.

@dkager dkager left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some style comments.

Comment thread source/appModules/explorer.py Outdated
def _get_value(self):
value = super(UIProperty, self).value
return value.replace(CHAR_LTR_MARK,'').replace(CHAR_RTL_MARK,'')
if value == None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is not really enforced, is None seems to be much more common in the source code than == None.

Comment thread source/appModules/explorer.py Outdated
return value.replace(CHAR_LTR_MARK,'').replace(CHAR_RTL_MARK,'')
if value == None:
return value
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal style would be to remove this else statement and just have the two return statements on consecutive lines, with the first one indented of course.

@lukaszgo1

Copy link
Copy Markdown
Contributor Author

@dkager Thanks for your comments. I've applied your suggestions in the recent commit.


def _get_value(self):
value = super(UIProperty, self).value
if value is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure whether this is always None, i.e. why wouldn't this be an empty string?

@LeonarddeR LeonarddeR May 21, 2018

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A never mind, I see you got a "none type object has no attribute replace" error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean before applying my fix yes.

@LeonarddeR

LeonarddeR commented May 21, 2018 via email

Copy link
Copy Markdown
Collaborator

LeonarddeR pushed a commit that referenced this pull request May 21, 2018
Merge remote-tracking branch 'origin/pr/8316' into next
@Brian1Gaff

Brian1Gaff commented May 22, 2018 via email

Copy link
Copy Markdown

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