--- pyanaconda/ui/gui/spokes/datetime_spoke.py | 33 ++++++---------------------- pyanaconda/ui/gui/spokes/keyboard.py | 18 +++++---------- pyanaconda/ui/gui/spokes/lib/cart.py | 8 ++---- 3 files changed, 16 insertions(+), 43 deletions(-) diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index 5d7c674..be96d2f 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -60,30 +60,22 @@ class NTPconfigDialog(UIObject): @property def working_server(self): - itr = self._serversStore.get_iter_first() - while itr: - row = self._serversStore[itr] + for row in self._serversStore: if row[1] == SERVER_OK and row[2]: #server is checked and working return row[0] - itr = self._serversStore.iter_next(itr) - return None @property def servers(self): ret = list() - itr = self._serversStore.get_iter_first() - while itr: - row = self._serversStore[itr] + for row in self._serversStore: if row[2]: #server checked ret.append(row[0]) - itr = self._serversStore.iter_next() - return ret def _render_working(self, column, renderer, model, itr, user_data=None): @@ -134,16 +126,11 @@ class NTPconfigDialog(UIObject): if rc == 1: new_servers = list() - itr = self._serversStore.get_iter_first() - while itr: - row = self._serversStore[itr] - + for row in self._serversStore: #if server checked if row[2]: new_servers.append(row[0]) - itr = self._serversStore.iter_next(itr) - ntp.save_servers_to_config(new_servers) iutil.restart_service("chronyd") @@ -210,14 +197,11 @@ class NTPconfigDialog(UIObject): self._threads_counter += 1 def _add_server(self, server): - itr = self._serversStore.get_iter_first() - while itr: - if self._serversStore[itr][0] == server: + for row in self._serversStore: + if row[0] == server: #do not add duplicate items return - itr = self._serversStore.iter_next(itr) - itr = self._serversStore.append([server, SERVER_QUERY, True]) if "pool" in server: @@ -542,14 +526,11 @@ class DatetimeSpoke(NormalSpoke): if not model: return False - itr = model.get_iter_first() - while itr: - if model[itr][0] == item: + for row in model: + if row[0] == item: combo.set_active_iter(itr) return True - itr = model.iter_next(itr) - return False def _get_combo_selection(self, combo): diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py index a657fb2..154a88c 100644 --- a/pyanaconda/ui/gui/spokes/keyboard.py +++ b/pyanaconda/ui/gui/spokes/keyboard.py @@ -133,10 +133,8 @@ class KeyboardSpoke(NormalSpoke): def apply(self): # Clear and repopulate self.data with actual values self.data.keyboard.layouts_list = list() - itr = self._store.get_iter_first() - while itr: - self.data.keyboard.layouts_list.append(self._store[itr][0]) - itr = self._store.iter_next(itr) + for row in self._store: + self.data.keyboard.layouts_list.append(row[0]) # FIXME: Set the keyboard layout here, too. @property @@ -206,12 +204,10 @@ class KeyboardSpoke(NormalSpoke): if response == 1: duplicates = set() - itr = self._store.get_iter_first() - while itr: - item = self._store[itr][0] + for row in self._store: + item = row[0] if item in dialog.chosen_layouts: duplicates.add(item) - itr = self._store.iter_next(itr) for layout in dialog.chosen_layouts: if layout not in duplicates: @@ -335,10 +331,8 @@ class KeyboardSpoke(NormalSpoke): def _flush_layouts_to_X(self): layouts_list = list() - itr = self._store.get_iter_first() - while itr: - layouts_list.append(self._store[itr][0]) - itr = self._store.iter_next(itr) + for row in self._store: + layouts_list.append(row[0]) self._xkl_wrapper.replace_layouts(layouts_list) diff --git a/pyanaconda/ui/gui/spokes/lib/cart.py b/pyanaconda/ui/gui/spokes/lib/cart.py index 1aee53d..c65aa3e 100644 --- a/pyanaconda/ui/gui/spokes/lib/cart.py +++ b/pyanaconda/ui/gui/spokes/lib/cart.py @@ -86,12 +86,10 @@ class SelectedDisksDialog(UIObject): count = 0 size = 0 free = 0 - itr = self._store.get_iter_first() - while itr: + for row in self._store: count += 1 - size += Size(spec=self._store.get_value(itr, 1)) - free += Size(spec=self._store.get_value(itr, 2)) - itr = self._store.iter_next(itr) + size += Size(spec=row[1]) + free += Size(spec=row[2]) size = str(Size(bytes=long(size))).upper() free = str(Size(bytes=long(free))).upper() -- 1.7.4.4 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list