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

Problem of override default __eq__ in Panel #21

Open
louxiu opened this issue Apr 25, 2024 · 0 comments
Open

Problem of override default __eq__ in Panel #21

louxiu opened this issue Apr 25, 2024 · 0 comments

Comments

@louxiu
Copy link

louxiu commented Apr 25, 2024

	def __eq__(self, other):
		return all(
			[
				abs(self.x - other.x) < self.wt(),
				abs(self.y - other.y) < self.ht(),
				abs(self.r - other.r) < self.wt(),
				abs(self.b - other.b) < self.ht(),
			]
		)

Override __eq__ of Panel cause problem. Assume panel_a is __eq__ to panel_b and panel_b is __eq__ to panel_c, but it is may not true that panel_a is __eq__ to panel_c.
If panel_a, panel_b, panel_c are in panels array(order a b c) and we remove it with.order panel_b, panel_c, panel_a, then panel_a, panel_b will be remove in order, and error will occur when try to remove pane_a because panel_c is left in panels array. This may happens in merge_panes in page.py

Maybe we should avoid override default __eq__ (lt) etc and use explicit func with similar top_left etc

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

No branches or pull requests

1 participant