update-manager: update patches and helper to meet new python test and style.
This commit is contained in:
parent
98b18f0ac7
commit
b2ded520d2
7 changed files with 316 additions and 222 deletions
|
|
@ -1,16 +1,24 @@
|
|||
diff --git a/UpdateManager/Dialogs.py b/UpdateManager/Dialogs.py
|
||||
index a33f9c0..5a9e36c 100644
|
||||
index dd5d0b01..73e69b8e 100644
|
||||
--- a/UpdateManager/Dialogs.py
|
||||
+++ b/UpdateManager/Dialogs.py
|
||||
@@ -38,7 +38,6 @@ import distro_info
|
||||
@@ -35,15 +35,10 @@ warnings.filterwarnings(
|
||||
import logging
|
||||
import datetime
|
||||
import dbus
|
||||
-import distro_info
|
||||
import os
|
||||
|
||||
import HweSupportStatus.consts
|
||||
-from .Core.LivePatchSocket import LivePatchSocket
|
||||
from .Core.utils import get_dist
|
||||
|
||||
-from .Core.utils import get_dist
|
||||
-
|
||||
from gettext import gettext as _
|
||||
@@ -148,62 +147,6 @@ class InternalDialog(BuilderDialog):
|
||||
-from gettext import ngettext
|
||||
|
||||
|
||||
class Dialog(object):
|
||||
@@ -149,69 +149,6 @@ class InternalDialog(BuilderDialog):
|
||||
self.main_container.add(content_widget)
|
||||
self.main_container.set_visible(bool(content_widget))
|
||||
|
||||
|
|
@ -23,12 +31,18 @@ index a33f9c0..5a9e36c 100644
|
|||
- self.set_desc(None)
|
||||
-
|
||||
- if not active:
|
||||
- if self._is_livepatch_supported() and \
|
||||
- self.settings_button and \
|
||||
- self.settings.get_int('launch-count') >= 4:
|
||||
- self.set_desc(_("<b>Tip:</b> You can use Livepatch with "
|
||||
- "Ubuntu Pro to keep your computer more "
|
||||
- "secure between restarts."))
|
||||
- if (
|
||||
- self._is_livepatch_supported()
|
||||
- and self.settings_button
|
||||
- and self.settings.get_int("launch-count") >= 4
|
||||
- ):
|
||||
- self.set_desc(
|
||||
- _(
|
||||
- "<b>Tip:</b> You can use Livepatch with "
|
||||
- "Ubuntu Pro to keep your computer more "
|
||||
- "secure between restarts."
|
||||
- )
|
||||
- )
|
||||
- self.settings_button.set_label(_("Settings & Pro…"))
|
||||
- return
|
||||
-
|
||||
|
|
@ -43,19 +57,21 @@ index a33f9c0..5a9e36c 100644
|
|||
- needs_reschedule = True
|
||||
- elif ps == "applied":
|
||||
- fixes = [fix for fix in fixes if fix.patched]
|
||||
- d = ngettext("%d Livepatch update applied since the last "
|
||||
- "restart.",
|
||||
- "%d Livepatch updates applied since the last "
|
||||
- "restart.",
|
||||
- len(fixes)) % len(fixes)
|
||||
- d = ngettext(
|
||||
- "%d Livepatch update applied since the last restart.",
|
||||
- "%d Livepatch updates applied since the last restart.",
|
||||
- len(fixes),
|
||||
- ) % len(fixes)
|
||||
- self.set_desc(d)
|
||||
- elif ps == "applied-with-bug" or ps == "apply-failed":
|
||||
- fixes = [fix for fix in fixes if fix.patched]
|
||||
- d = ngettext("%d Livepatch update failed to apply since the "
|
||||
- "last restart.",
|
||||
- "%d Livepatch updates failed to apply since the "
|
||||
- "last restart.",
|
||||
- len(fixes)) % len(fixes)
|
||||
- d = ngettext(
|
||||
- "%d Livepatch update failed to apply since the "
|
||||
- "last restart.",
|
||||
- "%d Livepatch updates failed to apply since the "
|
||||
- "last restart.",
|
||||
- len(fixes),
|
||||
- ) % len(fixes)
|
||||
- self.set_desc(d)
|
||||
- elif ps == "nothing-to-apply":
|
||||
- pass
|
||||
|
|
@ -69,14 +85,13 @@ index a33f9c0..5a9e36c 100644
|
|||
- self.lp_socket = LivePatchSocket()
|
||||
- self.lp_socket.get_status(self.on_livepatch_status_ready)
|
||||
-
|
||||
-
|
||||
|
||||
class StoppedUpdatesDialog(InternalDialog):
|
||||
def __init__(self, window_main):
|
||||
InternalDialog.__init__(self, window_main)
|
||||
@@ -227,7 +170,6 @@ class NoUpdatesDialog(InternalDialog):
|
||||
self.settings_button = self.add_settings_button()
|
||||
self.focus_button = self.add_button(Gtk.STOCK_OK,
|
||||
self.window_main.close)
|
||||
def __init__(self, window_main):
|
||||
@@ -255,7 +192,6 @@ class NoUpdatesDialog(InternalDialog):
|
||||
self.focus_button = self.add_button(
|
||||
Gtk.STOCK_OK, self.window_main.close
|
||||
)
|
||||
- self.check_livepatch_status()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue