Gajim - 2023-07-25


  1. kurion

    Could you please explain why TreeView was preferred over ListBox for the roster?

  2. lovetox

    It's faster with many entries and you can group entries under names, like members, admins, etc

  3. kurion

    Got it.

  4. kurion

    I was looking for a way to remove a contact

  5. kurion

    I see that the roster menu is only _evokable_ with a mouse right click on a contact item in the treeview

  6. kurion

    Since I need a way to evoke the roster menu without the mouse, I looked for ways so that the menu can be evoked with Gdk.KEY_Menu

  7. kurion

    But I see that getting the content of treeview item currently under focus is done with checking the position of the cursor

  8. kurion

    But I see that getting the content of treeview item currently under focus is done with checking the position of the cursor (event.x and event.y)

  9. kurion

    So It seems to me that getting the current roster item from `roster_treeview` is not doable without querying cursor position

  10. kurion

    And I think it implies that evoking the roster menu for a specific contact item is not doable solely using keyboard events

  11. kurion

    Please correct me if I'm wrong

  12. lovetox

    It is. Select with keyboard a contact and on keypress open the menu

  13. cal0pteryx

    kurion: focus the roster, navigate using arrow keys, press right click button on keyboard, move to correct item by arrow key, enter ?

  14. kurion

    I tried

  15. kurion

    But if the cursor is elsewhere (even if roster item is highlighted when navigating with keyboard)

  16. lovetox

    Menu can not only be opened with cursor position

  17. kurion

    a right click does not invoke the roster menu for that item

  18. lovetox

    Read the docs for GTK menu or gio.menu

  19. kurion

    I see in `_on_roster_button_press_event` that the logical process of determining the jid of the currently selected roster item uses `treeview.get_path_at_pos` first.

  20. kurion

    Which of course works with cursor position

  21. kurion

    What I am looking for is something like `treeview.get_selected_child()`

  22. kurion

    But there is no such method available for treeviews

  23. kurion

    How can I bypass `get_path_at_pos` and still somehow determine the jid of currently selected/highlighted roster item so that I can call `_show_contact_menu` with the jid?

  24. lovetox

    You can get the selected node, look better in the docs

  25. kurion

    I looked for it.

  26. kurion

    Should I use `get_selected()` from Gtk.TreeSelection class?

  27. lovetox

    Yes

  28. whitepaperkat

    That's not good

  29. whitepaperkat

    Yup

  30. meson

    kurion: will you open some PR later? :)

  31. kurion

    Still not sure.

  32. kurion

    Actually, some of my code contains bad practises like using underscored methods outside of the parent class

  33. meson

    I'm sure those things can be improved during a review

  34. meson

    I'm sure those things can be improved during the review process

  35. Kris

    someone is sending spam messages on disroot.org mucs that crash Gajim. Probably too long or so. the messages are random garbage as far as I can tell

  36. Kris

    other clients seem uneffected

  37. ☭Mike Yellow

    I guess Gajim is difficult to solve it. But it does not matter, I think it is a good thing to urge inexperienced room owners to learn how to prevent from being spammed.

  38. kurion

    meson: That

  39. kurion

    meson: That's really nice to know. I'll have to learn how to make PRs :P

  40. cal0pteryx

    Kris: should not be the case with newer gajim versions

  41. Kris

    I am on 1.7.3

  42. Kris

    ah I guess the fedora repos are not up to date 😓️

  43. Kris

    I'll switch to the flatpack 🤷‍♂️️

  44. nicoco

    Given how active the development of gajim has been for the past months, thanks to the amazing work by its devs, I’ve happily switched to flatpak for a while. The only annoying issue I have is drag’n’dropping attachments to the chat window does not work for me, but ctrl+C ctrl+V is usually good enough for images.

  45. hannibal

    nicoco: you need a recent version of gtk on your host system for drag and drop to work with flatpak

  46. meson

    kurion: one way is to fork Gajim on Gitlab, create a branch for your feature, commit and push your changes to your fork on Gitlab. On Gitlab you'll then find a dialog to create a PR for your changes of your feature branch.

  47. jstein

    Hi, someone with write access may want to add add https://packages.gentoo.org/packages/net-im/gajim in Packages section on https://dev.gajim.org/gajim/gajim/-/blob/master/README.md

  48. cal0pteryx

    jstein: dp you know about repology.org ?

  49. kurion

    After long search sessions and trial-and-error, finally came up with the following: ``` def _on_roster_key_press_event(self, treeview: Gtk.TreeView, event: Gdk.EventKey) -> None: if event.keyval == Gdk.KEY_Menu: selection = treeview.get_selection() (model, iter_)= selection.get_selected() assert iter_ is not None jid = model.get_value(iter_, 3) self._show_contact_menu(jid, treeview, None) ```

  50. kurion

    TreeViews are complicated indeed

  51. kurion

    ` jid = model.get_value(iter_, 3)` - I admit this line is not great to read.

  52. kurion

    `contact_store` is defined inside `roster.ui`. So it is not apparently clear to a reader what 3 actually refers to.

  53. kurion

    will have to add a conditional to check for Groupchat though

  54. kurion

    IMHO, this short code block looks nicer than the process of determining the jid in `_on_roster_button_press_event`

  55. kurion

    But I agree that you need to get cursor position to determine exactly where to popup the contact menu

  56. kurion

    The above method, funny enough, pops up the contact menu pointing to the the middle of the pane/grig divider.

  57. kurion

    The above method, funny enough, pops up the contact menu pointing to the the middle of the pane/grid divider.

  58. kurion

    Now I will have to do somewhat of a gymnastics exercise to ensure a fluid UX

  59. jstein

    cal0pteryx, yes. Great project. Perhaps even better to drop all distributions from that list and simply add one repology link or badge https://repology.org/project/gajim/versions

  60. lovetox

    kurion, why would a blind person care where a popup is located?

  61. kurion

    The blind person will not care, tbh\

  62. kurion

    But if I want to make a PR, I guess I should care

  63. Link Mauve

    lovetox, some people might be blind, but they can still see a tiny bit.

  64. Link Mauve

    For instance changes in luminosity (imagine an extremely blurry screen for instance), or generic shapes (like a rectangle in some corner).

  65. Link Mauve

    Some can even read if they put their eye extremely close to the screen, with extremely zoomed in everything.

  66. Link Mauve

    It always depends from person to person, but some handicaps aren’t on or off.

  67. altblex

    I need help, whenever I type some words and press space, my entire message gets changed to something else

  68. Link Mauve

    It also depends on their current state of fatigue, stuff like that.

  69. kurion

    altblex: do you have acronym expander plugin turned on?

  70. kurion

    Link Mauve: yes, you could say there's a continuous spectrum of degree of blindness.

  71. altblex

    Yes, removing that fixed it

  72. altblex

    Thanks

  73. kurion

    finally have a working `_on_roster_key_press_event` method. I am hoping that the little bit of hardcoding I used here is harmless

  74. kurion

    ``` https://conference.gajim.org:5281/pastebin/1d88e322-1c49-47e6-bfab-a00179774580

  75. kurion

    Still missing the check for Groupchat. But I'm not sure how to do it.

  76. kurion

    didn't want to touch any other method to accept a Gdk.EventKey along with the Gdk.EventButton

  77. kurion

    So ended up creating an EventButton

  78. kurion

    Very non-standard, I admit

  79. kurion

    If this little UX thing is worth the time and effort of a PR review process, I will make a PR. What do you say?

  80. kurion

    I have made several other modifications (mostly EventKey handling) during the last month. I will try push most of them eventually.

  81. lovetox

    im working since 20 years with computers

  82. lovetox

    TIL there is a menu button

  83. lovetox

    its not on my keyboard though

  84. lovetox

    i think its useful feature, but we have many context menus ..

  85. lovetox

    hard to keep all working with a menu button if only very few people use this

  86. lovetox

    i think if you make just for that a PR we could work to get it in, to have at least an example how to make a menu key for context menus work

  87. lovetox

    about the code

  88. lovetox

    look at _on_roster_button_press_event(), use the Column Enum to access columns in a more readable way

  89. lovetox

    Column.IS_CONTACT tells you if its a group or contact

  90. lovetox

    you need to convert the path with path = self._modelfilter.convert_path_to_child_path(path)

  91. lovetox

    otherwise your code will show a wrong menu, when a filter is applied to the roster

  92. lovetox

    further if we do this more often the GajimPopover should be refactored to take a rectangle instead of a EventButton

  93. lovetox

    then we can save the dummy EventButton creation