Skip to content

Conversation

@mleo2003
Copy link

Based on #59 , but updated to work with latest code.

I'm not happy with one part of it, but it works on my machine (both Windows compiled, and running via Linux WSL). May need more testing.

nvpy/view.py Outdated
try:
if config.pixel_width:
sentence = 'MmMmMmMmMmMmMmMmMmMmMmMmMmMmMm'
text_width = int(float(config.pixel_width)/((float(f.measure(sentence)))*.64)*len(sentence))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuuki0xff I really hate this calculation. I had to add the *.64 on my machine to get the pixel width calculated to be anywhere near what the vale is saved to in the file from one time opening the app to the next. If you know a better way to figure out how wide it should be (or how to make the Frame width be what this follows), I'm all for it. That, or take out this try/except, and let the default just be what it is on start.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can specify width and height in pixels by using Frame. See https://stackoverflow.com/a/14897186 for details.

Changing the initial size of the Frame should work.

nvpy/nvpy/view.py

Line 1417 in 272f6df

list_frame = tk.Frame(paned_window, width=100)

self.notes_list_width = nl_width
if self.notes_list_height != nl_height and self.config.layout == 'vertical':
self.config.write_setting('windows', 'notes_list_height', nl_height)
self.notes_list_height = nl_height
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each time you change the window size, nvPY writes configurations to a file. I think that it can reduce configuration write and complex processes by writing configuration just before closing the window. Maybe just change the handler_close().

nvpy/view.py Outdated
try:
if config.pixel_width:
sentence = 'MmMmMmMmMmMmMmMmMmMmMmMmMmMmMm'
text_width = int(float(config.pixel_width)/((float(f.measure(sentence)))*.64)*len(sentence))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can specify width and height in pixels by using Frame. See https://stackoverflow.com/a/14897186 for details.

Changing the initial size of the Frame should work.

nvpy/nvpy/view.py

Line 1417 in 272f6df

list_frame = tk.Frame(paned_window, width=100)

@yuuki0xff yuuki0xff self-assigned this Mar 14, 2020
@mleo2003
Copy link
Author

@yuuki0xff Thanks for the pointers, that is smarter for saving. As for the frame trick, I had to add the propagate false statement, as well as +17 on save to keep the frame from shrinking on every save (it always shrunk by 17 on save).

@yuuki0xff yuuki0xff merged commit 5f956c6 into cpbotha:master Mar 15, 2020
@yuuki0xff
Copy link
Collaborator

Thank you for contributions.

@mleo2003 mleo2003 deleted the remember_window_details branch March 15, 2020 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants