-
Notifications
You must be signed in to change notification settings - Fork 94
Fix DeprecationWarning: Removed Gdk.threads_enter/leave calls #419
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
base: master
Are you sure you want to change the base?
Conversation
|
Hi @dk8877 , thank you for the PR! I see you commented out the threads methods - can you remove them if they are not needed? |
|
ohk i will do it soon |
5ecccf5 to
3bbeaaa
Compare
|
Done! I have removed the ines @zdohnal |
zdohnal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some issues with indentation and some lines are not needed anymore, would you mind looking into it?
3bbeaaa to
6ecd735
Compare
|
@zdohnal Thanks for the review! I have addressed all the points: |
zdohnal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some unnecessary changes in indentation and one try: block was removed incorrectly (we catch exception there, try: will stay) - please look into it.
Thank you in advance!
6ecd735 to
c70217c
Compare
|
@zdohnal Thanks for the review! I have fixed the issues. You can review it now. |
zdohnal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
there is one badly indented block - would you mind fixing it?
Thank you in advance!
| Gdk.threads_enter () | ||
|
|
||
| try: | ||
| self.opreq_user_search = False | ||
| self.opreq_handlers = None | ||
| self.opreq = None | ||
| self._searchdialog.hide () | ||
| self._searchdialog.destroy () | ||
| self._searchdialog = None | ||
| self.opreq_user_search = False | ||
| self.opreq_handlers = None | ||
| self.opreq = None | ||
| self._searchdialog.hide () | ||
| self._searchdialog.destroy () | ||
| self._searchdialog = None | ||
|
|
||
| # Check whether we have found something | ||
| if len (printers) < 1: | ||
| # No. | ||
| ready (self.NewPrinterWindow) | ||
|
|
||
| # Check whether we have found something | ||
| if len (printers) < 1: | ||
| # No. | ||
| ready (self.NewPrinterWindow) | ||
| self.founddownloadabledrivers = False | ||
| if self.dialog_mode == "download_driver": | ||
| self.on_NPCancel(None) | ||
| else: | ||
| self.nextNPTab () | ||
| else: | ||
| self.downloadable_printers = printers | ||
| self.downloadable_drivers = drivers | ||
| self.founddownloadabledrivers = True | ||
|
|
||
| try: | ||
| self.NewPrinterWindow.show() | ||
| self.setNPButtons() | ||
| if not self.fillDownloadableDrivers(): | ||
| ready(self.NewPrinterWindow) | ||
| self.founddownloadabledrivers = False | ||
| if self.dialog_mode == "download_driver": | ||
| self.on_NPCancel(None) | ||
| else: | ||
| self.nextNPTab () | ||
| self.nextNPTab() | ||
| else: | ||
| self.downloadable_printers = printers | ||
| self.downloadable_drivers = drivers | ||
| self.founddownloadabledrivers = True | ||
|
|
||
| try: | ||
| self.NewPrinterWindow.show() | ||
| self.setNPButtons() | ||
| if not self.fillDownloadableDrivers(): | ||
| ready (self.NewPrinterWindow) | ||
|
|
||
| self.founddownloadabledrivers = False | ||
| if self.dialog_mode == "download_driver": | ||
| self.on_NPCancel(None) | ||
| else: | ||
| self.nextNPTab () | ||
| else: | ||
| if self.dialog_mode == "download_driver": | ||
| self.nextNPTab (step = 0) | ||
| else: | ||
| self.nextNPTab () | ||
| except: | ||
| nonfatalException () | ||
| self.nextNPTab () | ||
|
|
||
| finally: | ||
| Gdk.threads_leave () | ||
| if self.dialog_mode == "download_driver": | ||
| self.nextNPTab(step=0) | ||
| else: | ||
| self.nextNPTab() | ||
| except: | ||
| nonfatalException () | ||
| self.nextNPTab () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole change is incorrectly indented in the method - Gdk.threads_enter/leave lines have to be removed, and try: and finally: lines (lines 1793 and 1749) removed as well. Finally the contents of try: block (which started at line 1749) move one segment (4 spaces) to the left, so it will be on the same level as for handler in self.opreq_handlers:
Removes the deprecated Gdk.threads_enter() and Gdk.threads_leave() calls.
Modern Gdk handles thread locking automatically, so these manual locks are no longer needed and cause DeprecationWarnings.
Tested locally on Fedora; the application launches correctly and the specific DeprecationWarning is gone.
Closes #126