Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bug fix related #5479#6047

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 12 commits intomatplotlib:masterfromryanbelt:master
Mar 7, 2016
Merged

bug fix related #5479#6047

tacaswell merged 12 commits intomatplotlib:masterfromryanbelt:master
Mar 7, 2016

Conversation

ryanbelt
Copy link
Contributor

Table: auto_set_column_width not working#5479

As before, it append the whole parameter(col) into the_autoColumns evencol is a list object.
attable.py line 490 inside function_update_position

forcolinself._autoColumns:self._auto_set_column_width(col,renderer)

_auto_set_column_width are not able to manipulate with the index number as list rather then int passed from line490.

So, I decide to append number to _autoColumns as usual if and only if the parameter is integer. If it is a list, we will append each integer inside the parameter into_autoColumns

@@ -410,7 +410,13 @@ def _do_cell_alignment(self):

def auto_set_column_width(self, col):

self._autoColumns.append(col)
# col is a list of column index
if isinstance(col, list):
Copy link
Member

Choose a reason for hiding this comment

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

This is probably better to do as

try:self._autoColumns.extend(cell)exceptCORRECT_EXCEPTION:self._autoColumns.append(col)

@ryanbelt
Copy link
ContributorAuthor

I have change the format from type checking to exception checking.
This would allow not onlylist obj as the parameter, but also any kinds of iterable object suchtuple etc.

table.auto_set_column_width(-1)# Default inputtable.auto_set_column_width([-1,0,1])# List inputtable.auto_set_column_width((-1,0,1))# Tuple input

except (TypeError, AttributeError):
self._autoColumns.append(col)
else:
for cell in col:
Copy link
Member

Choose a reason for hiding this comment

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

This indentation is funny and you can useextend.

@tacaswelltacaswell mentioned this pull requestFeb 25, 2016
@ryanbelt
Copy link
ContributorAuthor

I have just seen the comment from#6059. I am going to add the specific test case for this PR.

@ryanbelt
Copy link
ContributorAuthor

@tacaswell ,
Test case for this specific bug has been added. Bascially testing every single column be able to auto_width. By using List, Tuple and single integer as input. I think those are the main issue on this bug.
Thank you

@dashed
Copy link
Contributor

Strings are also iterable. Should that be also supported?

@tacaswelltacaswell added this to the2.1 (next point release) milestoneFeb 28, 2016
@ryanbelt
Copy link
ContributorAuthor

@dashed , inside the_auto_set_column_width. if the object inside the_autoColumns is not an integer(index), It will not able to do the width adjustment and remain as default width (will causing content go out the box). So, it will not crash the program. It just skip all those string object until next integer found or stop at the end of the_autoColumns.

@dashed
Copy link
Contributor

@ryanbelt Ah ok. Then should there be a test case for the behaviour you've just described?

@ryanbelt
Copy link
ContributorAuthor

@dashed , thank you for the tips. Unexpected test case for iterable input asstring has been added for this bug.

@@ -410,7 +410,15 @@ def _do_cell_alignment(self):

def auto_set_column_width(self, col):

self._autoColumns.append(col)
# check for col possibility on iteration
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be worded in another way. Suggestion:

Ifcol is iterable, concatenate to self._autoColumns. Otherwise, append it to self._autoColumns.

@dashed
Copy link
Contributor

@ryanbelt Awesome. 👍 Unfortunately you beat us to the punch on this PR for d01. But I'll throw some suggestions your way for this PR 😄 .

tacaswell added a commit that referenced this pull requestMar 7, 2016
@tacaswelltacaswell merged commit963e51d intomatplotlib:masterMar 7, 2016
@tacaswell
Copy link
Member

Thanks!

Would one of you@dashed or@ryanbelt be willing to write a docstring forauto_set_column_width?

@dashed
Copy link
Contributor

I'll leave that for@ryanbelt 😄

@ryanbelt
Copy link
ContributorAuthor

"""Given column indexs in either List, Tuple or int. Will be able to        autonatically set the columns into optimal sizes.        """

@tacaswell ,
How should I added into the table.py since this pull request is closed?
Thank you.

@tacaswell
Copy link
Member

@ryanbelt Make a new pull request. They are (more-or-less) free and the smaller the change, the easier it is to review.

Could you also explain themeaning of the values that are expected to be passed in?

@ryanbeltryanbelt mentioned this pull requestMar 7, 2016
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestAug 3, 2023
When iterables were added inmatplotlib#6047, the test added a string. Typingcorrectly points out that that is not accepted, and in fact it does notdo anything (as shown in the test image) because column keys are ints,not strings.
@QuLogicQuLogic mentioned this pull requestAug 3, 2023
3 tasks
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestAug 3, 2023
When iterables were added inmatplotlib#6047, the test added a string. Typingcorrectly points out that that is not accepted, and in fact it does notdo anything (as shown in the test image) because column keys are ints,not strings.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

4 participants
@ryanbelt@dashed@tacaswell@mdboom

[8]ページ先頭

©2009-2025 Movatter.jp