-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add a new widget and a new feature #66
base: main
Are you sure you want to change the base?
Add a new widget and a new feature #66
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
|
有没有一种可能,不需要新增控件,优化原有的就行?还是说,你这个有什么特殊的地方? |
我去掉了外壳,也就是说Feature必须更改 |
有没有一种可能,外壳可以直接通过指定 |
Feature会报错 |
我有个想法,不如随着“典型自定义”的那几个控件,一起移动到扩展包里去吧? 详细内容见上面链接的中的橙色警告提示框。 |
可以的 |
正式版前不考虑添加新控件,正式版之后再处理该 PR |
建议将 |
capture_events=capture_events, gradient_animation=gradient_animation, | ||
auto_update=auto_update, style=style) | ||
if style is None: | ||
self.style = styles.TextStyle(self) if borderless else styles.IconButtonStyle(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处应该不需要 Style
了,因为只有图片的控件或许不会涉及到样式。
在其超类 virtual.Widget
中会提供默认的 Style
实例以供用户扩展功能。
if style is None: | ||
self.style = styles.TextStyle(self) if borderless else styles.IconButtonStyle(self) | ||
if image is not None: | ||
images.StillImage(self, ((size[1]-size[0]) / 2, 0), image=image) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处以及上面的参数部分应该改一改,参数 image
不允许为 None
了,如果没有图片,那这个控件的意义在哪里呢?所以应该强制指定,参数 image
必须为对应的实例。
*, | ||
command: collections.abc.Callable | None = None, | ||
image: enhanced.PhotoImage | None = None, | ||
borderless=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处缺少类型提示,请完善。
@@ -98,6 +98,30 @@ def _button_release_1(self, event: tkinter.Event) -> bool: | |||
return flag | |||
|
|||
|
|||
class IconOnlyFeature(ButtonFeature): | |||
"""Feature of Icon Only Button""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring 里面的类名不要拆开来写。
可能还有其它问题,你先改,我后面再看 |
待该 PR 完成之后,后续操作我会处理 |
PR Summary
This change provides a new button IconOnlyButton, which allows development to place a separate icon only button on the interface.
此更改提供了一个新的按钮IconOnlyButton,这使得开发时可以在界面上放置一个单独的纯图标按钮。
Below are examples:
以下是示例:
Extra Information
This button is not very commonly used, but it is still very handy in some cases.
这个按钮虽然不是非常常用,但部分情况下还是非常方便的。
PR Checklist
The PR doesn't duplicate another PR which is already open
"closes #0000"
is in the body of the PR description to link the related issueNew or changed code has been tested
When it comes to API modifications, the docstrings of related classes or functions are also modified
I have read the contribution guide and followed all the instructions