Closed leftbones closed 2 years ago
Could you show me an example of the behaviour you are experiencing? There might have been a change ~4.x.x-5.0.0 that changed the default window borders, but I can't quite remember now.
I was literally in the middle of typing this out as you responded, good timing!
This is my exact code:
import os, sys
import pytermgui as ptg
def main():
if len(sys.argv) == 2: filepath = sys.argv[1]
else: filepath = None
rows = ptg.terminal.height
cols = ptg.terminal.width
with ptg.WindowManager() as manager:
editor = ptg.Window(
title = filepath,
is_noresize = True,
is_static = True,
is_noblur = True,
)
manager.layout = ptg.Layout()
manager.layout.add_slot("editor")
manager.add(editor, assign="editor")
manager.run()
if __name__ == '__main__':
main()
I was able to alleviate the issue by adding the following to the editor ptg.Window
definition:
chars = {
'border': ['\u2502', '\u2500', '\u2502', '\u2500'],
'corner': ['\u250c', '\u2510', '\u2518', '\u2514']
}
Yup, getting the same behaviour.
I think what could be happening is the last time you used the library was before the 5.0.0 update, as that one got rid of the default window box setting. Not sure how much I intended this, but it can be pretty easily mitigated:
You can either give the name of a box in the window constructor:
window = ptg.Window(..., box="SINGLE")
or define a global box to use:
ptg.boxes.SINGLE.set_chars_of(ptg.Window)
Any window constructed after this second example will use the same box. You can see all the available boxes here, and how to create a custom one.
Sorry for the inconvenience!
Ah yes, it has been a few months since I last checked this out. Glad to know it's a simple fix.
Personally, I think that the "SINGLE" box setting should be default, since it's in all of the screenshots. A new user going through the demos then trying out the code and seeing something that looks wrong might lead them to the same conclusion as it did for me.
Plus, the single line box just looks way way nicer. Thanks for the help though!
Good call!
AFAIK the reason it was removed originally is that in the old window manager module it was set by the WindowManager and not the window itself, and I was so confuffled by that concept that I removed it so hard I forgot to put it back. I also think single should be the setting for both Container
and Window
, but I would prefer to set it as a default box
attribute which isn't possible ATM.
Going on the 'ole Notion TODO board! I'll close this now and make some plans to allow the behaviour I described above in the near future. Thanks for using the library :)
I've just started with this, so the extent of the code I have is basically just the manager, a layout, and a single window within that layout. Before updating to 6.0.0, the window had the default smooth borders you see in all of the screenshots. After updating, the border is now made up of regular characters.
Just to test, I tried removing the layout and doing things basically exactly as the documentation states, and still have the same issue. I don't believe this was intentional, I didn't see anything about it in the changelog.