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

Miscellaneous bugs in Tableview #114

Closed
israel-dryer opened this issue Jan 3, 2022 · 13 comments · Fixed by #117
Closed

Miscellaneous bugs in Tableview #114

israel-dryer opened this issue Jan 3, 2022 · 13 comments · Fixed by #117
Assignees
Labels
bug Something isn't working

Comments

@israel-dryer
Copy link
Owner

I did some tests (Linux Mint x64 Cinnamon X11), some suggestions for change:

Sorting image was cut off when doing autofit_columns. I changed
pad = utility.scale_size(self, 10)

for this and fixed the problem:
pad = utility.scale_size(self, 20)


Changed menu post method to tk_popup, several lines. Thus, the dropdown menu is displayed when hovering over the parent.
And mainly the menu is closed when clicking anywhere on the screen outside of it

example:
def post(self, event):

to: (in every 'post' to tk_popup)
def tk_popup(self, event):


I also changed the way to write csv.

writer = csv.writer(f)

for

CSV_DELIMITER = ';'
CSV_QUOTECHAR = '"'
writer = csv.writer(f, delimiter=CSV_DELIMITER, quotechar=CSV_QUOTECHAR, quoting=csv.QUOTE_NONNUMERIC)

Because depending on the country's local currency, using ',' as a delimiter can cause csv conflicts
ex: In Brazil the float separator is ',' and not '.'

bugs:
https://www.mediafire.com/file/0oil09c4i9vcif6/bug_tableview.mp4/file

modified:
https://www.mediafire.com/file/50e4b5qog148l9u/modified_tableview.mp4/file


There is also a bug with 'hide select rows'.
After applying this filter and trying to clean. It does not return the hidden line.
https://www.mediafire.com/file/hyhakz2oyi8lmd3/bug_hide.mp4/file

Another problem if the user hides all the rows there is no way for him to reload the data. It would be nice to have a reload/refresh data button as suggested before

reload


A complement.

The header separator could be in a different color than the header. For the program user, it is difficult to identify where this separator to double-click

separator

See the image. When the program is loaded. The separator is in an unexpected position for the user to find. If the separator were a line with a different color from the header, it would be easier to find.

Originally posted by @antrrax in #110 (comment)

@israel-dryer israel-dryer changed the title Miscellaneous bugs in treeview Miscellaneous bugs in Tableview Jan 3, 2022
@antrrax
Copy link
Contributor

antrrax commented Jan 3, 2022

Feature implementation suggestion.

Add option to copy selection to clipboard.

A code example (maybe there are other better ways), I don't know what it's like on Windows and Mac. But on Linux you need to use pyperclip to keep the data on the clipboard after closing the program. And on linux you also need to do this 'update()' twice and need the
return 'break'

example:

import pyperclip

def tvw_item_ckick(self, event=None):
    self.tvw.selection()
    str_all_columns = ''
    for n in self.tvw.selection():
        str_columns = '\t'.join(self.tvw.item(n, 'values'))
        str_all_columns += f'''{str_columns}\n'''

    self.clipboard_clear()
    self.update()

    try:
        pyperclip.copy(str_all_columns)
    except TclError as e:
        raise e
    
    self.update()
    return 'break'

self.tvw.bind('<Control-c>', self.tvw_item_ckick)
self.tvw.bind('<Control-C>', self.tvw_item_ckick)

@israel-dryer israel-dryer added the bug Something isn't working label Jan 3, 2022
@israel-dryer israel-dryer self-assigned this Jan 3, 2022
@israel-dryer
Copy link
Owner Author

israel-dryer commented Jan 3, 2022

  • change autofit pad scaling to 20 pad = utility.scale_size(self, 20)
  • investigate post vs tk_popup
  • change csv delimiter to something internationally accepted
  • investigate bug with hide select rows & clear filter combination
  • make vertical separator visible on Tableview header (also treeview?)
  • add refresh type button to pagination frame (similar to searchbar)

@rdbende
Copy link

rdbende commented Jan 3, 2022

Actually Tk's clipboard stuff works really weird on Linux (KDE neon with Plasma). Sometimes everything's fine, sometimes nothing happens, sometimes only within the Tk application and outside the it, the previous content is on the clipboard, and sometimes everywhere but it doesn't show up in the clipboard history. However, I haven't experienced that it keeps the content only until closing.

@antrrax
Copy link
Contributor

antrrax commented Jan 3, 2022

@israel-dryer

make vertical separator visible on Tableview header (also treeview?)

I found this widget has the grid drawn in the treeview, maybe it will serve as an inspiration
https://github.com/ragardner/tksheet/blob/master/tests/test_tksheet.py


I haven't experienced that it keeps the content only until closing.

On the desktop this is my experience with Linux Mint 20.2 x64 Cinnamon X11, Python 3.8.10. If you use tk's default clipboard when closing the program the clipboard is cleared.

@israel-dryer
Copy link
Owner Author

I was able to get something that looks ok on the headers while still appearing as a 'flat' theme.

python_12bd0WmzFA

Question is... should I apply this to Treeview as well?
@antrrax, @rdbende, @daniilS, @jongbatax

Another question of style... sort indicator on the left or right of the text?

@daniilS
Copy link
Contributor

daniilS commented Jan 3, 2022

Indicators to the right is what I've usually seen elsewhere. No personal preference for Treeview atm.

@antrrax
Copy link
Contributor

antrrax commented Jan 3, 2022

Question is... should I apply this to Treeview as well?

In the widget I commented on earlier:
https://github.com/ragardner/tksheet

pip install tksheet

Demo:
https://github.com/ragardner/tksheet/blob/master/tests/test_tksheet.py

on line 23 and 24 of the demo we have the option to show or hide the grid lines
#show_vertical_grid = False,
#show_horizontal_grid = False,

In the file below see line 3820:
https://github.com/ragardner/tksheet/blob/master/tksheet/_tksheet_main_table.py

gridlines

The grid lines option used in this example looks very smooth. But they seem very complex to be carried out.

For the complexity. I think just the gridline in the header would be enough.


Another question of style... sort indicator on the left or right of the text?

More suitable is to be to the right of the text.

@israel-dryer
Copy link
Owner Author

I'll look into gridlines in the Tableview. It appears that table above is being drawn with labels, so it's a different build altogether.

A "reset" button is configured in several areas. The reason is that the searchbar is optional, as well as the pagination frame.

  • A reset table option is now available in the right-click header menu
  • The reset filters is still available in the cell right-click menu (now fixed)
  • A reset button will appear in the pagination frame to the right
  • A reset button will appear in the searchbar (ONLY IF THERE IS NO PAGINATION FRAME)

A reset button appears in the pagination frame (not in the searchbar).

python_sFYQ7zcYSP

A reset button appears in the searchbar when there is no pagination frame.

python_2OQLzqY042

A reset table button is now in the header right-click menu and will remove all filters and sorts.

python_jCxBp4p8ne

Also, I decided to comment out the "pagesize" combobox for the moment. That option is configurable via the constructor, and the pageframe was getting really cluttered.

@israel-dryer
Copy link
Owner Author

israel-dryer commented Jan 3, 2022

@antrrax, how does post behave differently than tk_popup?

At least on Windows, there doesn't appear to be a noticeable change in behavior.

@rdbende
Copy link

rdbende commented Jan 3, 2022

With tk_popup you can specify the menuitem index menu should pop up

def tk_popup(self, x, y, entry=""):
    """Post the menu at position X,Y with entry ENTRY."""
    self.tk.call('tk_popup', self._w, x, y, entry)

with post you also can, but it's not implemented in tkinter

def post(self, x, y):
    """Display a menu at position X,Y."""
    self.tk.call(self._w, 'post', x, y)

In behavior the only difference (on Linux) is how it disappears

simplescreenrecorder-2022-01-03_22.00.04.mp4

@israel-dryer israel-dryer linked a pull request Jan 3, 2022 that will close this issue
@antrrax
Copy link
Contributor

antrrax commented Jan 3, 2022

https://www.mediafire.com/file/pko7umva7b5waup/bug_post.mp4/file

See the behavior of the post in the video, pay attention to mouse clicks.

When the menu is displayed and hover over the menu items.
Submenus are not displayed.
If I click anywhere on the screen outside the menu, the menu doesn't close. It remains visible.

The menu is only responsive from the moment I click on it. Then it displays the submenus when hovering over the items
Now if I click outside the menu I can close it.


With tk_popup the menu is responsive right when it is displayed.

@antrrax
Copy link
Contributor

antrrax commented Jan 4, 2022

I have a suggestion for the tableview, but I don't think it would be the case to open a new issue.

The suggestion would be, in the entry of the number of pages restrict to typing only numbers.

The original code looks like this:

index = ttk.Entry(pageframe, textvariable=self._pageindex, width=4)

just change it like this:

vcmd = (self.register(self.only_digits))
index = ttk.Entry(pageframe, textvariable=self._pageindex, width=4, validate='all', validatecommand=(vcmd, '%P'))


def only_digits(self, P):
    if str.isdigit(P) or P == "":
        return True
    else:
        return False

@israel-dryer
Copy link
Owner Author

@antrrax, I think this is related to the validation issue and can probably be implemented with that addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants