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

Attempt to remove all gdk threads_enter and leave calls #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TomasKorbar
Copy link
Contributor

Hi,
This pullrequest is an attempt to invent a way how to get rid of gdk threads* calls, which are deprecated.
If you will agree with this way then i will rewrite the rest of system-config-printer to use this instead of gdk threads.
Feel free to propose any change.

@zdohnal
Copy link
Member

zdohnal commented Mar 5, 2019

Hi Tomas!

thank you for pull request, I'll review it.

@zdohnal
Copy link
Member

zdohnal commented May 27, 2019

Hi Tom,
I tried to test it and there are some changes needs to be made:

  1. Add thread_operations.py into Makefile.am, so it would get installed on proper place
  2. require gdk version in thread_operations.py to prevent warning
  3. I found two tracebacks during testing, but I'm not sure which part of code is responsible, because it is incomplete (but previous version did not do it):

TypeError: on_btnRefresh_clicked() missing 1 required positional argument: 'button'
TypeError: show_IPP_Error() missing 1 required positional argument: 'message'

It appeared during changing server connection (server tab, Connect entry), which should trigger your changes.

@zdohnal
Copy link
Member

zdohnal commented May 31, 2019

@TomasKorbar

@TomasKorbar
Copy link
Contributor Author

Hi Zdenek,
Sorry for the delay i forgot about this. I will look into these tracebacks during today or tomorrow.

Changed used module for handling of threads from _thread
to threading. Threading has better API and allows us to
distinguish threads more easily. However there is a minor problem.
When Gdk Window is passed as a argument to method executed in
different thread then it is converted before execution of method
into Gtk box. That is why i removed parent argument from connect
method of GUI class.

Parent argument has been removed from connect method of GUI class.
Reasons described above. Connect was always called with the same
parent anyway so this does not change its function.

Added thread_operations.py file. It contains decorator which
simulates some functionalities provided by deprecated
functions.

Some calls of deprecated functions have been replaced by
Gdk_threads_add_idle function.
@TomasKorbar
Copy link
Contributor Author

@zdohnal So i reviewed the changes i made and found some more errors and repaired them. Now it should be ok. Please keep in mind that these are not all gdk_threads_enter/leave calls. If you agree with the way i replaced them i will replace them all :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants