def _display_results(self): # Display results to user. key = '' high_version = PICARD_VERSION for test_key in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[test_key]['name'] test_version = self._available_versions.get(update_level, {}).get('version', (0, 0, 0, '')) if self._update_level >= test_key and compare_version_tuples(high_version, test_version) > 0: key = PROGRAM_UPDATE_LEVELS[test_key]['name'] high_version = test_version if key: if QMessageBox.information( self._parent, _("Picard Update"), _("A new version of Picard is available.\n\n" "This version: {picard_old_version}\n" "New version: {picard_new_version}\n\n" "Would you like to download the new version?").format( picard_old_version=PICARD_FANCY_VERSION_STR, picard_new_version=self._available_versions[key]['tag'] ), QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Cancel ) == QMessageBox.Ok: webbrowser2.open(self._available_versions[key]['urls']['download']) else: if self._show_always: if self._update_level in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[self._update_level]['title'] else: update_level = N_('unknown') QMessageBox.information( self._parent, _("Picard Update"), _("There is no update currently available for your subscribed update level: {update_level}\n\n" "Your version: {picard_old_version}\n").format( update_level=_(update_level), picard_old_version=PICARD_FANCY_VERSION_STR, ), QMessageBox.Ok, QMessageBox.Ok )
def _display_results(self): # Display results to user. key = '' high_version = PICARD_VERSION for test_key in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[test_key]['name'] test_version = self._available_versions.get(update_level, {}).get( 'version', (0, 0, 0, '')) if self._update_level >= test_key and compare_version_tuples( high_version, test_version) > 0: key = PROGRAM_UPDATE_LEVELS[test_key]['name'] high_version = test_version if key: if QMessageBox.information( self._parent, _("Picard Update"), _("A new version of Picard is available.\n\n" "This version: {picard_old_version}\n" "New version: {picard_new_version}\n\n" "Would you like to download the new version?").format( picard_old_version=PICARD_FANCY_VERSION_STR, picard_new_version=self._available_versions[key] ['tag']), QMessageBox.Ok | QMessageBox.Cancel, QMessageBox.Cancel) == QMessageBox.Ok: webbrowser2.open( self._available_versions[key]['urls']['download']) else: if self._show_always: if self._update_level in PROGRAM_UPDATE_LEVELS: update_level = PROGRAM_UPDATE_LEVELS[ self._update_level]['title'] else: update_level = N_('unknown') QMessageBox.information( self._parent, _("Picard Update"), _("There is no update currently available for your subscribed update level: {update_level}\n\n" "Your version: {picard_old_version}\n").format( update_level=_(update_level), picard_old_version=PICARD_FANCY_VERSION_STR, ), QMessageBox.Ok, QMessageBox.Ok)
def test_compare_version_23(self): a, b, r = (1, 1, 0, 'final', 0), (1, 1, 0, 'final', 0), 0 self.assertEqual(compare_version_tuples(a, b), r)
def test_compare_version_01(self): a, b, r = (0, 0, 1, 'dev', 1), (0, 0, 1, 'dev', 1), 0 self.assertEqual(compare_version_tuples(a, b), r)
def test_compare_version_18(self): a, b, r = (0, 0, 1, 'final', 1), (0, 0, 1, 'final', 0), 0 self.assertEqual(compare_version_tuples(a, b), r)
def test_compare_version_15(self): a, b, r = (0, 1, 1, 'dev', 2), (1, 0, 0, 'dev', 1), 1 self.assertEqual(compare_version_tuples(a, b), r)
def test_compare_version_52(self): a, b, r = (1, 0, 0, 'final', 0), (1, 0, 0, 'dev', 1), -1 self.assertEqual(compare_version_tuples(a, b), r)
def test_compare_version_49(self): a, b, r = (0, 2, 0, 'final', 0), (0, 2, 1, 'dev', 1), 1 self.assertEqual(compare_version_tuples(a, b), r)
def test_compare_version_25(self): a, b, r = (0, 0, 2, 'final', 0), (0, 0, 1, 'final', 0), -1 self.assertEqual(compare_version_tuples(a, b), r)