-
Notifications
You must be signed in to change notification settings - Fork 259
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 Cell Level Controll for Table Borders #1192
Comments
@bbrenter are you interested in implementing the feature and submitting a PR? |
Hi I'm new to open source, but I'm eager to dive in and help out. I came across this issue and I think I can tackle it. Can I work on it? |
Yes, given the history on this issue, you are very welcome to tackle this @Kaustbh 🙂 As a minor change to the interface suggested by @bbrenter,
A starting point for you @Kaustbh could to be to read our development guidelines. Then, you could add a new unit test to Please ask away if you have any question! 🙂 |
Hi @Lucas-C , I'm currently working on implementing the |
I understood the logic of rendering and get_cell_border function, can you please tell me how should I write |
Please reply on how I should implement |
Hi @Kaustbh , The CellBordersLayout enum could be a good use case for CoerciveIntFlag if it wasn't for the |
But |
@Lucas-C can you please tell me the right way to do it? |
Hi @Kaustbh A quick test revealed that with class CellBordersLayout(CoerciveIntFlag):
NONE = 0
LEFT = 1
RIGHT = 2
TOP = 4
BOTTOM = 8
ALL = 15
INHERIT = 16
@classmethod
def coerce(cls, value):
if isinstance(value, int) and value > 16:
raise ValueError("INHERIT cannot be combined with other values")
return super(cls, cls).coerce(value)
def __and__(self, value):
value = super(CellBordersLayout, self).__and__(value)
if value > 16:
raise ValueError("INHERIT cannot be combined with other values")
return value
def __or__(self, value):
value = super(CellBordersLayout, self).__or__(value)
if value > 16:
raise ValueError("INHERIT cannot be combined with other values")
return value
print(CellBordersLayout.NONE)
print(CellBordersLayout.BOTTOM)
print(CellBordersLayout.coerce("LEFT"))
print(CellBordersLayout.INHERIT)
print(CellBordersLayout.ALL)
print(CellBordersLayout.LEFT | CellBordersLayout.RIGHT | CellBordersLayout.TOP | CellBordersLayout.BOTTOM)
print(CellBordersLayout.coerce(12))
print(CellBordersLayout.NONE | 1)
print(CellBordersLayout.coerce(17)) # <- this raises an error, as expected
print(CellBordersLayout.INHERIT | 1) # <- this raises an error, as expected |
Hi @Kaustbh Did my last answer help you to move forward on this implementation? |
Yes, I am working on this issue, and yes your last answer helped me move forward. |
Great 🙂 I'm assigning this issue to you then! |
This feature has been included in the new release published today: |
Intent
It would be great to have control over table borders by defining them for each cell.
Describe the solution you'd like
This could for example be implemented by adding the border string slot to the Cell Class and use it inside the get_cell_border function to determine the border for each cell. A possible implementation could look like this...
The text was updated successfully, but these errors were encountered: