Adding HorizontalRule and VerticalRule widgets#3060
Adding HorizontalRule and VerticalRule widgets#3060scriptogre wants to merge 2 commits intoTextualize:mainfrom
Conversation
- Added a new file `_rules.py` in the `src/textual/widgets` directory to define the base `Rule` widget and the `HorizontalRule` and `VerticalRule` widgets. - Modified the `__init__.py` and `__init__.pyi` files in the `src/textual/widgets` directory to import and include the `HorizontalRule` and `VerticalRule` widgets. The purpose of these changes is to provide support for the `HorizontalRule` and `VerticalRule` widgets in the `textual` library. These widgets allow for the creation of horizontal and vertical lines, similar to the `<hr>` HTML tag. Related to Textualize#2982
|
Hey Chris, I've gone through your code (only briefly) and I think I found the issue. If you take your PR as it stands, right now, and if you try to run your file Another thing you can try is adding a So, the importing issue you are seeing isn't really an issue with the imports. Spoiler for the issueThe problem is in how you defined |
Status: this PR is stale but close to being finished.
This PR introduces two new widgets,
HorizontalRuleandVerticalRule, into the Textual library.I've opted for two distinct classes instead of a single
Ruleclass to improve intuitiveness and readability. A baseRuleclass encapsulates common functionality, and HorizontalRule and VerticalRule extend from this.Both widgets are defined in
_rule.py, akin to the multi-class file_tabbed_content.py. To work with the widget lazy loading mechanism inwidgets/__init__.py, I created_horizontal_rule.pyand_vertical_rule.py. I've also updatedwidgets/__init__.pyiaccordingly.Despite these efforts, I'm facing import issues in
_rules.pywhen trying to rundocs/examples/widgets/rules.py.Any insights into the potential cause or solutions would be appreciated!
I have not forgotten about documentation and tests, but I wish to solve this issue first.
Related to #2982
Please review the following checklist.