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

Merge shell into master to add Shell widget #63

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

Conversation

sbordeyne
Copy link
Member

For new widgets only:

PR Details:

  • Widget name: Shell
  • Author: Dogeek

Description

A terminal-like shell widget

Checklist

  • Widget in a separate file in the appropriate folder
  • Widget functions properly on both Windows and Linux
  • Widget code includes docstrings with parameter descriptions
  • Included an example file in /examples
  • Widget is covered by unitttests in /tests
  • Widget includes required assets files
  • Reference to widget in AUTHORS.md
  • Entry in sphinx documentation

Copy link
Member

@RedFantom RedFantom left a comment

Choose a reason for hiding this comment

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

In the current state, to me the widget feels unfinished. Then again, when I wanted to create a widget with similar functionality, it was intended to be pretty huge from the outset, so perhaps that is not what this widget is intended for in the first place.

There are some things I think must be addressed, but particularly the comments about functionality are kind of open. Just things to consider, not necessarily required, as they depend on what you want the widget to be able to do. I do think a catch-all is necessary, though.

from collections import defaultdict


class Shell(tk.Canvas):
Copy link
Member

Choose a reason for hiding this comment

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

Quite some time ago I started implementing a similar widget on the Console branch. Personally, I would add quite some features, including pressing up and down to cycle through command history, using the tab to have some form of completion...
The textvariable is modifiable by the creator of the widget, which inherently allows the creator to implement all these things. It is, however, not easy to do things with \b or other special characters. Perhaps it is worth considering to implement these things in the base widget.

return

def on_configure(self, event):
padding = 4
Copy link
Member

Choose a reason for hiding this comment

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

On Ubuntu 20.04, GNOME, Python 3.8.2, a padding value of 4 makes the widget disappear until manually resized. A padding size of 2 solves this issue. I understand that this is here for stretching the widget to the size of its master, but, speaking from personal experience, this introduces head-aches like this when working with Canvases.
This code should be tested on different platforms in order to make sure that the widget does not resize itself out of visibility.

Copy link
Member Author

Choose a reason for hiding this comment

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

On windows, a padding of 2 makes the widget grow indefinitely

ttkwidgets/shell.py Outdated Show resolved Hide resolved
ttkwidgets/shell.py Outdated Show resolved Hide resolved
ttkwidgets/shell.py Outdated Show resolved Hide resolved
self.text_update()


if __name__ == '__main__':
Copy link
Member

Choose a reason for hiding this comment

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

The example has been moved to a separate file so may be removed here.

ttkwidgets/shell.py Show resolved Hide resolved
ttkwidgets/shell.py Outdated Show resolved Hide resolved
ttkwidgets/shell.py Show resolved Hide resolved
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.

None yet

2 participants