[PATCH 26/34] Fix all the "X is defined outside of __init__" warnings.

Chris Lumens clumens at redhat.com
Mon Aug 12 20:33:02 UTC 2013


There were an awful lot of these, and I took a couple tactics when fixing them.
The first is that in a lot of places, we define attributes before they are
ever used, which is what pylint is so concerned about here.  To ignore those,
I added a pylint command line argument.  Another tactic was to move a lot of
the get_object calls into _grabObjects or __init__ or somewhere.  I was also
able to remove some unused variables.
---
 pyanaconda/anaconda_optparse.py              |  1 +
 pyanaconda/bootloader.py                     |  1 +
 pyanaconda/keyboard.py                       |  1 +
 pyanaconda/packaging/__init__.py             |  1 +
 pyanaconda/packaging/livepayload.py          |  3 ++
 pyanaconda/packaging/yumpayload.py           |  2 ++
 pyanaconda/ui/gui/hubs/__init__.py           |  2 +-
 pyanaconda/ui/gui/hubs/progress.py           |  6 ++--
 pyanaconda/ui/gui/spokes/advstorage/fcoe.py  |  5 +--
 pyanaconda/ui/gui/spokes/advstorage/iscsi.py | 10 +++---
 pyanaconda/ui/gui/spokes/custom.py           | 21 +++++++++---
 pyanaconda/ui/gui/spokes/datetime_spoke.py   |  7 +++-
 pyanaconda/ui/gui/spokes/filter.py           | 10 ++++--
 pyanaconda/ui/gui/spokes/keyboard.py         | 11 +++---
 pyanaconda/ui/gui/spokes/lib/cart.py         | 19 ++++++-----
 pyanaconda/ui/gui/spokes/lib/passphrase.py   | 20 ++++++++---
 pyanaconda/ui/gui/spokes/lib/refresh.py      |  3 ++
 pyanaconda/ui/gui/spokes/lib/resize.py       |  3 ++
 pyanaconda/ui/gui/spokes/lib/summary.py      |  6 ++--
 pyanaconda/ui/gui/spokes/software.py         |  5 +--
 pyanaconda/ui/gui/spokes/source.py           | 32 ++++++++++-------
 pyanaconda/ui/gui/spokes/storage.py          | 51 ++++++++++++++++++++--------
 pyanaconda/ui/gui/spokes/user.py             |  1 -
 pyanaconda/ui/tui/simpleline/base.py         |  1 +
 pyanaconda/ui/tui/spokes/storage.py          |  3 ++
 tests/pylint/runpylint.sh                    |  1 +
 26 files changed, 159 insertions(+), 67 deletions(-)

diff --git a/pyanaconda/anaconda_optparse.py b/pyanaconda/anaconda_optparse.py
index 37f4b86..32bdfa8 100644
--- a/pyanaconda/anaconda_optparse.py
+++ b/pyanaconda/anaconda_optparse.py
@@ -35,6 +35,7 @@ class AnacondaOptionParser(OptionParser):
     """
     def __init__(self, *args, **kwargs):
         self._boot_arg = dict()
+        self.deprecated_bootargs = []
         self.bootarg_prefix = kwargs.pop("bootarg_prefix","")
         self.require_prefix = kwargs.pop("require_prefix",True)
         OptionParser.__init__(self, *args, **kwargs)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index b95d47f..52793b2 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -286,6 +286,7 @@ class BootLoader(object):
         self.stage2_is_preferred_stage1 = False
 
         self.errors = []
+        self.problems = []
         self.warnings = []
 
     #
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index 7e59902..1acc22a 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -389,6 +389,7 @@ class XklWrapper(object):
         self._language_keyboard_variants = dict()
         self._country_keyboard_variants = dict()
         self._switching_options = list()
+        self._variants_list = list()
 
         #we want to display layouts as 'language (description)'
         self.name_to_show_str = dict()
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 0588485..2411e6a 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -103,6 +103,7 @@ class Payload(object):
         """ data is a kickstart.AnacondaKSHandler class
         """
         self.data = data
+        self.storage = None
         self._kernelVersionList = []
         self._createdInitrds = False
 
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index 377dc46..f61d3c0 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -63,6 +63,8 @@ class LiveImagePayload(ImagePayload):
         super(LiveImagePayload, self).__init__(*args, **kwargs)
         # Used to adjust size of ROOT_PATH when files are already present
         self._adj_size = 0
+        self.pct = 0
+        self.pct_lock = None
 
     def setup(self, storage):
         super(LiveImagePayload, self).setup(storage)
@@ -205,6 +207,7 @@ class LiveImageKSPayload(LiveImagePayload):
     def __init__(self, *args, **kwargs):
         super(LiveImageKSPayload, self).__init__(*args, **kwargs)
         self._min_size = 0
+        self._proxies = {}
         self.image_path = ROOT_PATH+"/disk.img"
 
     def setup(self, storage):
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 239dc2a..4712d26 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -141,6 +141,8 @@ class YumPayload(PackagePayload):
         self._requiredPackages = []
         self._requiredGroups = []
 
+        self.txID = None
+
         self.reset()
 
     def reset(self, root=None):
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index 9dc61d1..52e34f0 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -365,7 +365,7 @@ class Hub(GUIObject, common.Hub):
         GUIObject.refresh(self)
         self._createBox()
 
-        self._update_spoke_id = GLib.timeout_add(100, self._update_spokes)
+        GLib.timeout_add(100, self._update_spokes)
 
     ### SIGNAL HANDLERS
 
diff --git a/pyanaconda/ui/gui/hubs/progress.py b/pyanaconda/ui/gui/hubs/progress.py
index 53c9021..bc51634 100644
--- a/pyanaconda/ui/gui/hubs/progress.py
+++ b/pyanaconda/ui/gui/hubs/progress.py
@@ -51,6 +51,8 @@ class ProgressHub(Hub):
         self._currentStep = 0
         self._configurationDone = False
 
+        self._rnotes_id = None
+
     def _do_configuration(self, widget = None, reenable_ransom = True):
         from pyanaconda.install import doConfiguration
         from pyanaconda.threads import threadMgr, AnacondaThread
@@ -65,7 +67,7 @@ class ProgressHub(Hub):
         if reenable_ransom:
             self._start_ransom_notes()
 
-        self._progress_id = GLib.timeout_add(250, self._update_progress, self._configuration_done)
+        GLib.timeout_add(250, self._update_progress, self._configuration_done)
         threadMgr.add(AnacondaThread(name=THREAD_CONFIGURATION, target=doConfiguration,
                                      args=(self.storage, self.payload, self.data, self.instclass)))
 
@@ -215,7 +217,7 @@ class ProgressHub(Hub):
         Hub.refresh(self)
 
         self._start_ransom_notes()
-        self._progress_id = GLib.timeout_add(250, self._update_progress, self._install_done)
+        GLib.timeout_add(250, self._update_progress, self._install_done)
         threadMgr.add(AnacondaThread(name=THREAD_INSTALL, target=doInstall,
                                      args=(self.storage, self.payload, self.data, self.instclass)))
 
diff --git a/pyanaconda/ui/gui/spokes/advstorage/fcoe.py b/pyanaconda/ui/gui/spokes/advstorage/fcoe.py
index 455e131..c539cfa 100644
--- a/pyanaconda/ui/gui/spokes/advstorage/fcoe.py
+++ b/pyanaconda/ui/gui/spokes/advstorage/fcoe.py
@@ -40,18 +40,19 @@ class FCoEDialog(GUIObject):
         self.storage = storage
         self.fcoe = self.storage.fcoe()
 
-    def refresh(self):
         self._addButton = self.builder.get_object("addButton")
         self._cancelButton = self.builder.get_object("cancelButton")
         self._addSpinner = self.builder.get_object("addSpinner")
         self._errorBox = self.builder.get_object("errorBox")
 
         self._nicCombo = self.builder.get_object("nicCombo")
-        self._nicCombo.remove_all()
 
         self._dcbCheckbox = self.builder.get_object("dcbCheckbox")
         self._autoCheckbox = self.builder.get_object("autoCheckbox")
 
+    def refresh(self):
+        self._nicCombo.remove_all()
+
         for devname in nm.nm_devices():
             if not nm.nm_device_type_is_ethernet(devname):
                 continue
diff --git a/pyanaconda/ui/gui/spokes/advstorage/iscsi.py b/pyanaconda/ui/gui/spokes/advstorage/iscsi.py
index c303746..7d28d1a 100644
--- a/pyanaconda/ui/gui/spokes/advstorage/iscsi.py
+++ b/pyanaconda/ui/gui/spokes/advstorage/iscsi.py
@@ -120,7 +120,6 @@ class ISCSIDialog(GUIObject):
         self._discoveredNodes = []
         self._update_devicetree = False
 
-    def refresh(self):
         self._authTypeCombo = self.builder.get_object("authTypeCombo")
         self._authNotebook = self.builder.get_object("authNotebook")
         self._iscsiNotebook = self.builder.get_object("iscsiNotebook")
@@ -135,15 +134,19 @@ class ISCSIDialog(GUIObject):
         self._conditionNotebook = self.builder.get_object("conditionNotebook")
 
         self._bindCheckbox = self.builder.get_object("bindCheckbutton")
-        self._bindCheckbox.set_active(bool(self.iscsi.ifaces))
-        self._bindCheckbox.set_sensitive(self.iscsi.mode == "none")
 
         self._startButton = self.builder.get_object("startButton")
         self._okButton = self.builder.get_object("okButton")
         self._cancelButton = self.builder.get_object("cancelButton")
 
+        self._initiatorEntry = self.builder.get_object("initiatorEntry")
+
         self._store = self.builder.get_object("nodeStore")
 
+    def refresh(self):
+        self._bindCheckbox.set_active(bool(self.iscsi.ifaces))
+        self._bindCheckbox.set_sensitive(self.iscsi.mode == "none")
+
         self._authTypeCombo.set_active(0)
         self._startButton.set_sensitive(True)
 
@@ -151,7 +154,6 @@ class ISCSIDialog(GUIObject):
 
         self.builder.get_object("nodeStoreFiltered").set_visible_column(1)
 
-        self._initiatorEntry = self.builder.get_object("initiatorEntry")
         self._initiatorEntry.set_text(self.iscsi.initiator)
         self._initiatorEntry.set_sensitive(not self.iscsi.initiatorSet)
 
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 485a23b..ed87b5d 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -257,6 +257,8 @@ class AddDialog(GUIObject):
         completion.set_text_column(0)
         completion.set_popup_completion(True)
 
+        self._warningLabel = self.builder.get_object("mountPointWarningLabel")
+
     def on_add_confirm_clicked(self, button, *args):
         self.mountpoint = self.builder.get_object("addMountPointEntry").get_active_text()
         self._error = validate_mountpoint(self.mountpoint, self.mountpoints,
@@ -271,7 +273,6 @@ class AddDialog(GUIObject):
 
     def refresh(self):
         GUIObject.refresh(self)
-        self._warningLabel = self.builder.get_object("mountPointWarningLabel")
         self._warningLabel.set_text("")
 
     def run(self):
@@ -286,6 +287,10 @@ class ConfirmDeleteDialog(GUIObject):
     mainWidgetName = "confirmDeleteDialog"
     uiFile = "spokes/custom.glade"
 
+    def __init__(self, *args, **kwargs):
+        GUIObject.__init__(self, *args, **kwargs)
+        self._removeAll = self.builder.get_object("removeAllCheckbox")
+
     @property
     def deleteAll(self):
         return self._removeAll.get_active()
@@ -297,7 +302,6 @@ class ConfirmDeleteDialog(GUIObject):
         GUIObject.refresh(self)
         label = self.builder.get_object("confirmLabel")
 
-        self._removeAll = self.builder.get_object("removeAllCheckbox")
         if rootName and "_" in rootName:
             rootName = rootName.replace("_", "__")
         self._removeAll.set_label(self._removeAll.get_label() % rootName)
@@ -610,9 +614,14 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     def __init__(self, data, storage, payload, instclass):
         NormalSpoke.__init__(self, data, storage, payload, instclass)
 
+        self.__storage = None
+
+        self.passphrase = ""
+
         self._current_selector = None
         self._when_create_text = ""
         self._devices = []
+        self._error = None
         self._media_disks = []
         self._fs_types = []             # list of supported fstypes
         self._free_space = Size(bytes=0)
@@ -620,6 +629,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         self._device_disks = []
         self._device_container_name = None
         self._device_container_raid_level = None
+        self._device_container_encrypted = False
         self._device_container_size = SIZE_POLICY_AUTO
         self._device_name_dict = {DEVICE_TYPE_LVM: None,
                                   DEVICE_TYPE_MD: None,
@@ -677,6 +687,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
 
         self._whenCreateLabel = self.builder.get_object("whenCreateLabel")
 
+        self._availableSpaceLabel = self.builder.get_object("availableSpaceLabel")
+        self._totalSpaceLabel = self.builder.get_object("totalSpaceLabel")
+        self._summaryButton = self.builder.get_object("summary_button")
+
         # Buttons
         self._addButton = self.builder.get_object("addButton")
         self._applyButton = self.builder.get_object("applyButton")
@@ -791,9 +805,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     def _updateSpaceDisplay(self):
         # Set up the free space/available space displays in the bottom left.
         self._setCurrentFreeSpace()
-        self._availableSpaceLabel = self.builder.get_object("availableSpaceLabel")
-        self._totalSpaceLabel = self.builder.get_object("totalSpaceLabel")
-        self._summaryButton = self.builder.get_object("summary_button")
 
         self._availableSpaceLabel.set_text(str(self._free_space))
         self._totalSpaceLabel.set_text(str(self._currentTotalSpace()))
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index fac2ef4..2ec7d26 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -298,6 +298,10 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         # taking values from the kickstart file?
         self._kickstarted = flags.flags.automatedInstall
 
+        self._config_dialog = None
+        self._update_datetime_timer_id = None
+        self._start_updating_timer_id = None
+
     def initialize(self):
         NormalSpoke.initialize(self)
         self._daysStore = self.builder.get_object("days")
@@ -337,6 +341,8 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
 
         self._regions_zones = timezone.get_all_regions_and_timezones()
 
+        self._months_nums = dict()
+
         threadMgr.add(AnacondaThread(name=constants.THREAD_DATE_TIME,
                                      target=self._initialize))
 
@@ -344,7 +350,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         for day in xrange(1, 32):
             self.add_to_store(self._daysStore, day)
 
-        self._months_nums = dict()
         for i in xrange(1, 13):
             #a bit hacky way, but should return the translated string
             #TODO: how to handle language change? Clear and populate again?
diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py
index bf5c409..fe8c354 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -141,11 +141,11 @@ class SearchPage(FilterPage):
         self._lunEntry = self.builder.get_object("searchLUNEntry")
         self._wwidEntry = self.builder.get_object("searchWWIDEntry")
 
+        self._combo = self.builder.get_object("searchTypeCombo")
         self._portCombo = self.builder.get_object("searchPortCombo")
         self._targetEntry = self.builder.get_object("searchTargetEntry")
 
     def setup(self, store, selectedNames, disks):
-        self._combo = self.builder.get_object("searchTypeCombo")
         self._combo.set_active(0)
         self._combo.emit("changed")
 
@@ -212,6 +212,7 @@ class MultipathPage(FilterPage):
         self.model = self.builder.get_object("multipathModel")
         self.model.set_visible_func(self.visible_func)
 
+        self._combo = self.builder.get_object("multipathTypeCombo")
         self._icCombo = self.builder.get_object("multipathInterconnectCombo")
         self._vendorCombo = self.builder.get_object("multipathVendorCombo")
         self._wwidEntry = self.builder.get_object("multipathWWIDEntry")
@@ -238,7 +239,6 @@ class MultipathPage(FilterPage):
             if not disk.bus in interconnects:
                 interconnects.append(disk.bus)
 
-        self._combo = self.builder.get_object("multipathTypeCombo")
         self._combo.set_active(0)
         self._combo.emit("changed")
 
@@ -279,6 +279,7 @@ class OtherPage(FilterPage):
         self.model = self.builder.get_object("otherModel")
         self.model.set_visible_func(self.visible_func)
 
+        self._combo = self.builder.get_object("otherTypeCombo")
         self._icCombo = self.builder.get_object("otherInterconnectCombo")
         self._idEntry = self.builder.get_object("otherIDEntry")
         self._vendorCombo = self.builder.get_object("otherVendorCombo")
@@ -324,7 +325,6 @@ class OtherPage(FilterPage):
             if not disk.bus in interconnects:
                 interconnects.append(disk.bus)
 
-        self._combo = self.builder.get_object("otherTypeCombo")
         self._combo.set_active(0)
         self._combo.emit("changed")
 
@@ -411,6 +411,10 @@ class FilterSpoke(NormalSpoke):
         NormalSpoke.__init__(self, *args)
         self.applyOnSkip = True
 
+        self.ancestors = []
+        self.disks = []
+        self.selected_disks = []
+
     @property
     def indirect(self):
         return True
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index f54da8e..4c27805 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -58,6 +58,7 @@ class AddLayoutDialog(GUIObject):
     def __init__(self, *args):
         GUIObject.__init__(self, *args)
         self._xkl_wrapper = keyboard.XklWrapper.get_instance()
+        self._chosen_layouts = []
 
     def matches_entry(self, model, itr, user_data=None):
         value = model[itr][0]
@@ -266,6 +267,11 @@ class KeyboardSpoke(NormalSpoke):
         self._remove_last_attempt = False
         self._xkl_wrapper = keyboard.XklWrapper.get_instance()
 
+        self._upButton = self.builder.get_object("upButton")
+        self._downButton = self.builder.get_object("downButton")
+        self._removeButton = self.builder.get_object("removeLayoutButton")
+        self._previewButton = self.builder.get_object("previewButton")
+
     def apply(self):
         # Clear and repopulate self.data with actual values
         self.data.keyboard.x_layouts = list()
@@ -337,11 +343,6 @@ class KeyboardSpoke(NormalSpoke):
         self._store.clear()
         self._add_data_layouts()
 
-        self._upButton = self.builder.get_object("upButton")
-        self._downButton = self.builder.get_object("downButton")
-        self._removeButton = self.builder.get_object("removeLayoutButton")
-        self._previewButton = self.builder.get_object("previewButton")
-
         # Start with no buttons enabled, since nothing is selected.
         self._upButton.set_sensitive(False)
         self._downButton.set_sensitive(False)
diff --git a/pyanaconda/ui/gui/spokes/lib/cart.py b/pyanaconda/ui/gui/spokes/lib/cart.py
index 80f308a..16e2d71 100644
--- a/pyanaconda/ui/gui/spokes/lib/cart.py
+++ b/pyanaconda/ui/gui/spokes/lib/cart.py
@@ -41,6 +41,17 @@ class SelectedDisksDialog(GUIObject):
     mainWidgetName = "selected_disks_dialog"
     uiFile = "spokes/lib/cart.glade"
 
+    def __init__(self, data):
+        GUIObject.__init__(self, data)
+
+        self._view = self.builder.get_object("disk_tree_view")
+        self._store = self.builder.get_object("disk_store")
+        self._selection = self.builder.get_object("disk_selection")
+        self._summary_label = self.builder.get_object("summary_label")
+
+        self._set_button = self.builder.get_object("set_as_boot_button")
+        self._remove_button = self.builder.get_object("remove_button")
+
     def initialize(self, disks, free, showRemove=True, setBoot=True):
         self._previousID = None
 
@@ -88,14 +99,6 @@ class SelectedDisksDialog(GUIObject):
     def refresh(self, disks, free, showRemove=True, setBoot=True):
         super(SelectedDisksDialog, self).refresh()
 
-        self._view = self.builder.get_object("disk_tree_view")
-        self._store = self.builder.get_object("disk_store")
-        self._selection = self.builder.get_object("disk_selection")
-        self._summary_label = self.builder.get_object("summary_label")
-
-        self._set_button = self.builder.get_object("set_as_boot_button")
-        self._remove_button = self.builder.get_object("remove_button")
-
         # clear out the store and repopulate it from the devicetree
         self._store.clear()
         self.initialize(disks, free, showRemove=showRemove, setBoot=setBoot)
diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py
index b1a2e82..1a7262d 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.py
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py
@@ -38,20 +38,33 @@ class PassphraseDialog(GUIObject):
     mainWidgetName = "passphrase_dialog"
     uiFile = "spokes/lib/passphrase.glade"
 
+    def __init__(self, data):
+        GUIObject.__init__(self, data)
+
+        self._confirm_entry = self.builder.get_object("confirm_entry")
+        self._passphrase_entry = self.builder.get_object("passphrase_entry")
+
+        self._save_button = self.builder.get_object("passphrase_save_button")
+
+        self._strength_label = self.builder.get_object("strength_label")
+
+        # These will be set up later.
+        self._strength_bar = None
+        self._pwq = None
+        self._pwq_error = None
+        self.passphrase = ""
+
     def refresh(self):
         super(PassphraseDialog, self).refresh()
 
         # disable input methods for the passphrase Entry widgets and make sure
         # the focus change mask is enabled
-        self._passphrase_entry = self.builder.get_object("passphrase_entry")
         self._passphrase_entry.set_property("im-module", "")
         self._passphrase_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, "")
         self._passphrase_entry.add_events(Gdk.EventMask.FOCUS_CHANGE_MASK)
-        self._confirm_entry = self.builder.get_object("confirm_entry")
         self._confirm_entry.set_property("im-module", "")
         self._confirm_entry.add_events(Gdk.EventMask.FOCUS_CHANGE_MASK)
 
-        self._save_button = self.builder.get_object("passphrase_save_button")
         self._save_button.set_can_default(True)
 
         # add the passphrase strength meter
@@ -62,7 +75,6 @@ class PassphraseDialog(GUIObject):
         box = self.builder.get_object("strength_box")
         box.pack_start(self._strength_bar, False, True, 0)
         box.show_all()
-        self._strength_label = self.builder.get_object("strength_label")
 
         # set up passphrase quality checker
         self._pwq = pwquality.PWQSettings()
diff --git a/pyanaconda/ui/gui/spokes/lib/refresh.py b/pyanaconda/ui/gui/spokes/lib/refresh.py
index 31b07ec..49ddc7d 100644
--- a/pyanaconda/ui/gui/spokes/lib/refresh.py
+++ b/pyanaconda/ui/gui/spokes/lib/refresh.py
@@ -44,6 +44,9 @@ class RefreshDialog(GUIObject):
         self._cancel_button = self.builder.get_object("refreshCancelButton")
         self._ok_button = self.builder.get_object("refreshOKButton")
 
+        self._elapsed = 0
+        self._watcher_id = None
+
     def run(self):
         rc = self.window.run()
         self.window.destroy()
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index f17ddee..dfa6a20 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -60,6 +60,9 @@ class ResizeDialog(GUIObject):
         self.storage = storage
         self.payload = payload
 
+        self._initialFreeSpace = Size(0)
+        self._selectedReclaimableSpace = 0
+
         self._actionStore = self.builder.get_object("actionStore")
         self._diskStore = self.builder.get_object("diskStore")
 
diff --git a/pyanaconda/ui/gui/spokes/lib/summary.py b/pyanaconda/ui/gui/spokes/lib/summary.py
index 1ef2b2f..d09fa54 100644
--- a/pyanaconda/ui/gui/spokes/lib/summary.py
+++ b/pyanaconda/ui/gui/spokes/lib/summary.py
@@ -30,6 +30,10 @@ class ActionSummaryDialog(GUIObject):
     mainWidgetName = "summaryDialog"
     uiFile = "spokes/lib/summary.glade"
 
+    def __init__(self, data):
+        GUIObject.__init__(self, data)
+        self._store = self.builder.get_object("actionStore")
+
     def initialize(self, actions):
         for (i, action) in enumerate(actions, start=1):
             mountpoint = ""
@@ -50,8 +54,6 @@ class ActionSummaryDialog(GUIObject):
     def refresh(self, actions):
         GUIObject.refresh(self)
 
-        self._store = self.builder.get_object("actionStore")
-
         self._store.clear()
         self.initialize(actions)
 
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 6272f58..0ed4dbe 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -58,6 +58,9 @@ class SoftwareSelectionSpoke(NormalSpoke):
         self.excludedGroups = []
         self.environment = None
 
+        self._addonStore = self.builder.get_object("addonStore")
+        self._environmentStore = self.builder.get_object("environmentStore")
+
         # Used for detecting whether anything's changed in the spoke.
         self._origAddons = []
         self._origEnvironment = None
@@ -240,7 +243,6 @@ class SoftwareSelectionSpoke(NormalSpoke):
 
         threadMgr.wait(constants.THREAD_PAYLOAD_MD)
 
-        self._environmentStore = self.builder.get_object("environmentStore")
         self._environmentStore.clear()
 
         firstEnvironment = True
@@ -278,7 +280,6 @@ class SoftwareSelectionSpoke(NormalSpoke):
         self._addonStore.append([selected, "<b>%s</b>\n%s" % (name, desc), grp, False])
 
     def refreshAddons(self):
-        self._addonStore = self.builder.get_object("addonStore")
         self._addonStore.clear()
         if self.environment:
             # First, we make up two lists:  One of addons specific to this environment,
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index edfb311..f048cea 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -71,6 +71,18 @@ class ProxyDialog(GUIObject):
     mainWidgetName = "proxyDialog"
     uiFile = "spokes/source.glade"
 
+    def __init__(self, data):
+        GUIObject.__init__(self, data)
+
+        self._proxyCheck = self.builder.get_object("enableProxyCheck")
+        self._proxyInfoBox = self.builder.get_object("proxyInfoBox")
+        self._authCheck = self.builder.get_object("enableAuthCheck")
+        self._proxyAuthBox = self.builder.get_object("proxyAuthBox")
+
+        self._proxyURLEntry = self.builder.get_object("proxyURLEntry")
+        self._proxyUsernameEntry = self.builder.get_object("proxyUsernameEntry")
+        self._proxyPasswordEntry = self.builder.get_object("proxyPasswordEntry")
+
     def on_proxy_cancel_clicked(self, *args):
         self.window.destroy()
 
@@ -110,15 +122,6 @@ class ProxyDialog(GUIObject):
     def refresh(self):
         GUIObject.refresh(self)
 
-        self._proxyCheck = self.builder.get_object("enableProxyCheck")
-        self._proxyInfoBox = self.builder.get_object("proxyInfoBox")
-        self._authCheck = self.builder.get_object("enableAuthCheck")
-        self._proxyAuthBox = self.builder.get_object("proxyAuthBox")
-
-        self._proxyURLEntry = self.builder.get_object("proxyURLEntry")
-        self._proxyUsernameEntry = self.builder.get_object("proxyUsernameEntry")
-        self._proxyPasswordEntry = self.builder.get_object("proxyPasswordEntry")
-
         if not self.data.method.proxy:
             self._proxyCheck.set_active(False)
             self.on_proxy_enable_toggled(self._proxyCheck)
@@ -150,6 +153,10 @@ class MediaCheckDialog(GUIObject):
     mainWidgetName = "mediaCheckDialog"
     uiFile = "spokes/source.glade"
 
+    def __init__(self, data):
+        GUIObject.__init__(self, data)
+        self.progressBar = self.builder.get_object("mediaCheck-progressBar")
+
     def _checkisoEndsCB(self, pid, status):
         doneButton = self.builder.get_object("doneButton")
         verifyLabel = self.builder.get_object("verifyLabel")
@@ -181,8 +188,6 @@ class MediaCheckDialog(GUIObject):
         return True
 
     def run(self, devicePath):
-        self.progressBar = self.builder.get_object("mediaCheck-progressBar")
-
         (retval, pid, stdin, stdout, stderr) = \
             GLib.spawn_async_with_pipes(None, ["checkisomd5", "--gauge", devicePath], [],
                                         GLib.SpawnFlags.DO_NOT_REAP_CHILD|GLib.SpawnFlags.SEARCH_PATH,
@@ -217,9 +222,12 @@ class IsoChooser(GUIObject):
     mainWidgetName = "isoChooserDialog"
     uiFile = "spokes/source.glade"
 
+    def __init__(self, data):
+        GUIObject.__init__(self, data)
+        self._chooser = self.builder.get_object("isoChooser")
+
     def refresh(self, currentFile=""):
         GUIObject.refresh(self)
-        self._chooser = self.builder.get_object("isoChooser")
         self._chooser.connect("current-folder-changed", self.on_folder_changed)
         self._chooser.set_filename(constants.ISO_DIR + "/" + currentFile)
 
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index e387721..2fbd080 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -97,6 +97,15 @@ class InstallOptions1Dialog(GUIObject):
         self.showReclaim = kwargs.pop("showReclaim", None)
         GUIObject.__init__(self, *args, **kwargs)
 
+        self.autoPartType = None
+        self.encrypted = False
+
+        self._grabObjects()
+
+    def _grabObjects(self):
+        self.autoPartTypeCombo = self.builder.get_object("options1_combo")
+        self.encryptCheckbutton = self.builder.get_object("encryption1_checkbutton")
+
     def run(self):
         rc = self.window.run()
         self.window.destroy()
@@ -104,11 +113,9 @@ class InstallOptions1Dialog(GUIObject):
 
     def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
         self.autoPartType = autoPartType
-        self.autoPartTypeCombo = self.builder.get_object("options1_combo")
         self.autoPartTypeCombo.set_active(self.autoPartType)
 
         self.encrypted = encrypted
-        self.encryptCheckbutton = self.builder.get_object("encryption1_checkbutton")
         self.encryptCheckbutton.set_active(self.encrypted)
 
         options_label = self.builder.get_object("options1_label")
@@ -154,13 +161,6 @@ class InstallOptions1Dialog(GUIObject):
         else:
             return self.RESPONSE_CONTINUE_NONE
 
-    def _set_free_space_labels(self, disk_free, fs_free):
-        disk_free_text = size_str(disk_free)
-        self.disk_free_label.set_text(disk_free_text)
-
-        fs_free_text = size_str(fs_free)
-        self.fs_free_label.set_text(fs_free_text)
-
     def _modify_sw_link_clicked(self, label, uri):
         if self._software_is_ready():
             self.window.response(self.RESPONSE_MODIFY_SW)
@@ -216,13 +216,24 @@ class InstallOptions2Dialog(InstallOptions1Dialog):
     builderObjects = ["options2_dialog"]
     mainWidgetName = "options2_dialog"
 
+    def _grabObjects(self):
+        self.autoPartTypeCombo = self.builder.get_object("options2_combo")
+        self.encryptCheckbutton = self.builder.get_object("encryption2_checkbutton")
+        self.disk_free_label = self.builder.get_object("options2_disk_free_label")
+        self.fs_free_label = self.builder.get_object("options2_fs_free_label")
+
+    def _set_free_space_labels(self, disk_free, fs_free):
+        disk_free_text = size_str(disk_free)
+        self.disk_free_label.set_text(disk_free_text)
+
+        fs_free_text = size_str(fs_free)
+        self.fs_free_label.set_text(fs_free_text)
+
     def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
         self.autoPartType = autoPartType
-        self.autoPartTypeCombo = self.builder.get_object("options2_combo")
         self.autoPartTypeCombo.set_active(self.autoPartType)
 
         self.encrypted = encrypted
-        self.encryptCheckbutton = self.builder.get_object("encryption2_checkbutton")
         self.encryptCheckbutton.set_active(self.encrypted)
 
         sw_text = self._get_sw_needs_text(required_space, auto_swap)
@@ -233,8 +244,6 @@ class InstallOptions2Dialog(InstallOptions1Dialog):
         label.set_tooltip_text(_("Please wait... software metadata still loading."))
         label.connect("activate-link", self._modify_sw_link_clicked)
 
-        self.disk_free_label = self.builder.get_object("options2_disk_free_label")
-        self.fs_free_label = self.builder.get_object("options2_fs_free_label")
         self._set_free_space_labels(disk_free, fs_free)
 
         label_text = _("<b>You don't have enough space available to install "
@@ -254,6 +263,17 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
     builderObjects = ["options3_dialog"]
     mainWidgetName = "options3_dialog"
 
+    def _grabObjects(self):
+        self.disk_free_label = self.builder.get_object("options3_disk_free_label")
+        self.fs_free_label = self.builder.get_object("options3_fs_free_label")
+
+    def _set_free_space_labels(self, disk_free, fs_free):
+        disk_free_text = size_str(disk_free)
+        self.disk_free_label.set_text(disk_free_text)
+
+        fs_free_text = size_str(fs_free)
+        self.fs_free_label.set_text(fs_free_text)
+
     def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
         sw_text = self._get_sw_needs_text(required_space, auto_swap)
         label_text = (_("%(sw_text)s You don't have enough space available to install "
@@ -265,8 +285,6 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
         label.set_tooltip_text(_("Please wait... software metadata still loading."))
         label.connect("activate-link", self._modify_sw_link_clicked)
 
-        self.disk_free_label = self.builder.get_object("options3_disk_free_label")
-        self.fs_free_label = self.builder.get_object("options3_fs_free_label")
         self._set_free_space_labels(disk_free, fs_free)
 
         label_text = _("<b>You don't have enough space available to install "
@@ -321,6 +339,9 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         self.applyOnSkip = True
 
         self._ready = False
+        self.autoPartType = None
+        self.encrypted = False
+        self.passphrase = ""
         self.selected_disks = self.data.ignoredisk.onlyuse[:]
 
         # This list contains all possible disks that can be included in the install.
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index a3b3aa3..70ad006 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -433,7 +433,6 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
             return False
 
         # if no errors, clear the info for next time we go into the spoke
-        self._password = pw
         self.clear_info()
         self._error = False
         return True
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index 2ebabc0..2f09506 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -79,6 +79,7 @@ class App(object):
         """
 
         self._header = title
+        self._redraw = True
         self._spacer = "\n".join(2*[width*"="])
         self._width = width
         self.quit_question = yes_or_no_question
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 7eaa95c..6d5b332 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -63,6 +63,9 @@ class StorageSpoke(NormalTUISpoke):
         self._ready = False
         self.selected_disks = self.data.ignoredisk.onlyuse[:]
 
+        self.autopart = None
+        self.clearPartType = None
+
         # This list gets set up once in initialize and should not be modified
         # except perhaps to add advanced devices. It will remain the full list
         # of disks that can be included in the install.
diff --git a/tests/pylint/runpylint.sh b/tests/pylint/runpylint.sh
index 83af123..3a5dc01 100755
--- a/tests/pylint/runpylint.sh
+++ b/tests/pylint/runpylint.sh
@@ -63,6 +63,7 @@ for i in $(find pyanaconda -type f -name '*py'); do
       sys.path.insert(4, "pyanaconda/.libs")' \
     -i y -r n --disable=C,R --rcfile=/dev/null \
     --ignored-classes=Popen,QueueFactory,TransactionSet \
+    --defining-attr-methods=__init__,_grabObjects,initialize,reset,start \
     $DISABLED_WARN_OPTIONS \
     $DISABLED_ERR_OPTIONS \
     $NON_STRICT_OPTIONS $i | \
-- 
1.8.1.2



More information about the anaconda-patches mailing list