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

Update gui.py #218

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Update gui.py #218

wants to merge 12 commits into from

Conversation

saddy001
Copy link

allow treeopen keyword for TreeItem

allow treeopen keyword for TreeItem
add text_align keyword to TableEditableItem
add text_align keyword to TableEditableItem
remi/gui.py Outdated
@@ -2733,8 +2733,9 @@ def __init__(self, text, **kwargs):
"sendCallback('%s','%s');" \
"event.stopPropagation();event.preventDefault();" % (self.identifier, self.EVENT_ONCLICK)
self.set_text(text)
self.treeopen = False
self.attributes['treeopen'] = 'false'
treeopen = kwargs.get('treeopen', False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It could be ok to have a treeopen parameter, but it's better to have it as an explicit optional parameter.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. At the moment I don't know how to make a pull request after committing, so here's the link:
saddy001@3c5cb94#diff-4be7e258419023f7dad3cc9f659df8b9

@@ -2119,15 +2119,15 @@ class TableEditableItem(Widget, _MixinTextualWidget):
"""item widget for the TableRow."""

@decorate_constructor_parameter_types([str])
def __init__(self, text='', text_align='left', **kwargs):
def __init__(self, text='', text_style={}, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

A more proficient way to do styling would be to use css stylesheet. Otherwise we should add a style parameter for each widget in a container, like TableItem in Tables, ListItem in ListView and so on... Doesn't it?

Copy link
Author

Choose a reason for hiding this comment

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

I don't know how to use separate stylesheets, because at the moment, there is no documentation about it ;-)
If it means that the whole original stylesheet has to be copied, I don't think it's a good idea...

@dddomodossola
Copy link
Collaborator

@saddy001 I really like the changes you made. I will review and test this, than I will merge. Thank you for this contribution.

@@ -2119,15 +2128,15 @@ class TableEditableItem(Widget, _MixinTextualWidget):
"""item widget for the TableRow."""

@decorate_constructor_parameter_types([str])
def __init__(self, text='', **kwargs):
def __init__(self, text='', text_style={}, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

mutable functions args (dict in signature) are not a good idea

Copy link
Author

Choose a reason for hiding this comment

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

Yep. If you have your hands already on this, could you change it to None and assign
text_style = text_style or {}
?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants