Fix DeprecationWarning: Removed Gdk.threads_enter/leave calls#419
Fix DeprecationWarning: Removed Gdk.threads_enter/leave calls#419dk8877 wants to merge 1 commit intoOpenPrinting:masterfrom
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.
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.
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.
Hi,
there is one badly indented block - would you mind fixing it?
Thank you in advance!
c70217c to
3516a34
Compare
| self.opreq_user_search = False | ||
| self.opreq_handlers = None | ||
| self.opreq = None | ||
| self._searchdialog.hide () | ||
| self._searchdialog.destroy () | ||
| self._searchdialog = None |
| try: | ||
| 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.
But this is the same as in the previous review - incorrect, bad indentation, the code is not in the correct function scope.
if len (printers) < 1: and corresponding else: have to on the same level as self.opreq_user_search = False, which you have in correct scope.
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