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

PICARD-1325: Allow disabling new version update checking for packagers #1024

Merged
merged 1 commit into from
Nov 5, 2018

Conversation

virusMac
Copy link
Contributor

@virusMac virusMac commented Nov 2, 2018

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other

When user uses --disable-autoupdate flag when installing or building Picard, it automatically hide "Update checking" feature from user and disable update checking code itself

Problem

Recently the ability to automatically and manually check for program updates was added to MusicBrainz Picard. Picard release packagers should be able to completely hide this functionality and configuration settings from the user for the packages they produce.

Solution

  • added if statements to determine showing all update-checking tabs and update-checking itself
  • added description to flag --disable-autoupdate in picard_install and picard_build (setup.py)
  • changed variable name from _autoupdate to autoupdate_enabled (tagger.py)

picard/tagger.py Outdated
@@ -146,7 +146,7 @@ def __init__(self, picard_args, unparsed_args, localedir, autoupdate):
)

self._cmdline_files = picard_args.FILE
self._autoupdate = autoupdate
self.autoupdate_enabled = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this True setting left over from your testing? Should it be self.autoupdate_enabled = autoupdate instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it was only for testing. Thank you.

picard/tagger.py Outdated
@@ -251,7 +251,8 @@ def __init__(self, picard_args, unparsed_args, localedir, autoupdate):
self.stopping = False

# Load release version information
self.updatecheckmanager = UpdateCheckManager(parent=self.window)
if QtWidgets.QApplication.instance().autoupdate_enabled:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you simply use the self.autoupdate_enabled object here rather than the instance() object?

@@ -189,7 +189,8 @@ def keyPressEvent(self, event):
def show(self):
self.restoreWindowState()
super().show()
self.auto_update_check()
if QtWidgets.QApplication.instance().autoupdate_enabled:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the value is exposed as self.tagger.autoupdate_enabled so the instance() object shouldn't be required. Same throughout the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't notice that.

@@ -17,8 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from PyQt5 import QtCore
from PyQt5.QtWidgets import QInputDialog
from PyQt5 import QtCore,QtWidgets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use self.tagger.autoupdate_enabled this likely isn't required. If it is required, there should be a space after the comma.

self.ui.update_level.addItem(_(description['title']), level)
self.ui.update_level.setCurrentIndex(self.ui.update_level.findData(config.setting["update_level"]))
self.ui.update_check_days.setValue(config.setting["update_check_days"])
if QtWidgets.QApplication.instance().autoupdate_enabled:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that the value is exposed as self.tagger.autoupdate_enabled so the instance() object shouldn't be required. Same throughout the file.

self.verticalLayout_2.addLayout(self.gridLayout_2)
self.vboxlayout.addWidget(self.groupBox_3)

if QtWidgets.QApplication.instance().autoupdate_enabled:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is automatically generated by python setup.py build_ui command and should not be edited manually. I suggest that you simply hide the elements associated with the update checking settings when the ui is displayed in picard/ui/options/general.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to add that hiding feature to load() function?
I used setEnabled() - please tell me if it's better to hide it completely

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would add it to the load() method. I think it would be better to hide it completely, that way users of a packaged version don't see something that they can't change. It's less likely to generate questions that way. ;-)

self.vboxlayout.addWidget(self.groupBox_3)

if QtWidgets.QApplication.instance().autoupdate_enabled:
self.groupBox_3 = QtWidgets.QGroupBox(GeneralOptionsPage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're likely to be referring to this to hide it, the name should probably be changed from groupbox_3 to something more appropriate (e.g. update_check_groupbox).

@@ -18,7 +18,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from PyQt5 import QtCore
from PyQt5.QtWidgets import QInputDialog
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QImportDialog still needs to be imported because it is used in the login(self) method.

Copy link
Contributor Author

@virusMac virusMac Nov 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, misclick :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually surprised that wasn't caught with the automatic checks. Then again, I would have expected codacy to have caught it and it seems the codacy checking didn't run.

@@ -181,7 +181,7 @@ class picard_build(build):
user_options = build.user_options + [
('build-locales=', 'd', "build directory for locale files"),
('localedir=', None, ''),
('disable-autoupdate', None, ''),
('disable-autoupdate', None, 'disable update checking and hide settings for it'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done adding a comment for this!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)

phw
phw previously approved these changes Nov 4, 2018
@@ -19,7 +19,6 @@

from PyQt5 import QtCore
from PyQt5.QtWidgets import QInputDialog

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whiteline should stay, can you just re-add it and squash again ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks :)

@rdswift
Copy link
Collaborator

rdswift commented Nov 5, 2018

@virusMac

Just so you know, the reason @zas was asking you to put the blank line back in is because the Picard developers are trying to standardize on sorting the import lines using the isort utility.

@phw phw merged commit 985c56c into metabrainz:master Nov 5, 2018
@phw phw mentioned this pull request Nov 13, 2018
17 tasks
wegank pushed a commit to NixOS/nixpkgs that referenced this pull request Sep 7, 2023
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.

4 participants