alejandroautalan / pygubu-designer

A simple GUI designer for the python tkinter module
GNU General Public License v3.0
794 stars 97 forks source link

Delete the element using delete/backspace button #267

Open Tweety24655 opened 1 month ago

Tweety24655 commented 1 month ago

Hi Pygubu-designer community!

I am currently taking an open source software course and the main requirement that they have is contributing to one of the open source software on the Internet. I have decided to pick this project since it is related to Python which is the language that I want to learn more. I have conducted a usability test using think-aloud experiment and heuristic evaluation.

Is your feature request related to a problem? Please describe. My idea for the feature is related to a specific problem since there is no ability to press delete button/backspace to delete the element in the Project Tree or the Preview section. I believe the interface could be improved in the Flexibility and Efficiency of Use part(https://www.nngroup.com/articles/ten-usability-heuristics/).

Describe the solution you'd like Adding an ability to press the delete button/backspace to delete the element in the Project Tree and Preview section would be nice.

Describe alternatives you've considered N/A

Your Environment (please complete the following information):

Additional context I am planning to add event listeners to detect when the delete key is pressed while an element is selected in the Preview or Project Tree. This will involve modifying the existing event handling system to accommodate keyboard input for element deletion.  When the delete key is pressed, the selected element should be visibly removed from the interface. I will ensure that this action provides immediate visual feedback, such as updating the Preview and Project Tree to reflect the removal. Alongside the UI changes, I will update the underlying data structures that store the elements, ensuring they are consistent with the visual representation after deletion.

alejandroautalan commented 1 month ago

Hello @Tweety24655 thanks for trying pygubu. Sorry for the late response. I'm glad you want to contribute to the project.

Although it's not mentioned anywhere (I think), you can use the Delete key to remove an item from the treeview. Do you want to add backspace for deleting as well? Or is there a problem on Mac with those keys that you want to solve? I don't use a Mac, so there may be problems.

In any case, any contribution is welcome. Let me know if you have any questions.

Regards Alejandro A.

Tweety24655 commented 1 month ago

Hi @alejandroautalan thank you for the reply.

Sorry for the confusion. My Mac book does not have a delete key, so I assumed that the key that I used during the experiment was the backspace key, meaning that people who use Mac Book won't be able to use the delete key to quickly delete the element since they don't have one, so yes, adding a backspace to function like the delete key would be very beneficial to the Mac Book users. I would love to contribute to this project by adding the backspace key to function the same as delete key. Could you give me a little pointer for which file I should start looking at and add this function? or Is there another way for me to contribute to the project? because this week's assignment wants me to create a pull request to show that I have contributed to the project.

Thank you, Tweety

alejandroautalan commented 1 month ago

Sorry for the confusion. My Mac book does not have a delete key

Oh! I didn't know that.

You could add a binding for the backspace key, similar to the one for the delete key.

https://github.com/alejandroautalan/pygubu-designer/blob/efbf906531d6af31897f80155ea1185240503994/src/pygubudesigner/main.py#L392

Test the change and create a pull request.

Tweety24655 commented 1 month ago

HI @alejandroautalan, Thank you for the quick reply. I have added the ability to use backspace as a way to delete the element. I was able to manually test it and it seems to work as intended. I was not able to automatocally test it though because there is something wrong with my computer and it cannot find pygubu in my computer eventhough I can run it just find along with pygubu-designer. I just created a PR. You can check it.