Pylint cleanup for ddrescue-tui part 2

This commit is contained in:
2Shirt 2019-05-13 20:08:31 -06:00
parent d1f8307153
commit 1f8b795e9a
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -361,28 +361,29 @@ class RecoveryState():
return min_percent return min_percent
def fix_tmux_panes(self, forced=False): def fix_tmux_panes(self, forced=False):
# pylint: disable=too-many-branches,too-many-locals
"""Fix pane sizes if the winodw has been resized.""" """Fix pane sizes if the winodw has been resized."""
needs_fixed = False needs_fixed = False
# Check layout # Check layout
for k, v in TMUX_LAYOUT.items(): for pane, pane_data in TMUX_LAYOUT.items():
if not v.get('Check'): if not pane_data.get('Check'):
# Not concerned with the size of this pane # Not concerned with the size of this pane
continue continue
# Get target # Get target
target = None target = None
if k != 'Current': if pane != 'Current':
if k not in self.panes: if pane not in self.panes:
# Skip missing panes # Skip missing panes
continue continue
else: else:
target = self.panes[k] target = self.panes[pane]
# Check pane size # Check pane size
x, y = tmux_get_pane_size(pane_id=target) size_x, size_y = tmux_get_pane_size(pane_id=target)
if v.get('x', False) and v['x'] != x: if pane_data.get('x', False) and pane_data['x'] != size_x:
needs_fixed = True needs_fixed = True
if v.get('y', False) and v['y'] != y: if pane_data.get('y', False) and pane_data['y'] != size_y:
needs_fixed = True needs_fixed = True
# Bail? # Bail?
@ -393,18 +394,18 @@ class RecoveryState():
tmux_kill_pane(self.panes['Destination']) tmux_kill_pane(self.panes['Destination'])
# Update layout # Update layout
for k, v in TMUX_LAYOUT.items(): for pane, pane_data in TMUX_LAYOUT.items():
# Get target # Get target
target = None target = None
if k != 'Current': if pane != 'Current':
if k not in self.panes: if pane not in self.panes:
# Skip missing panes # Skip missing panes
continue continue
else: else:
target = self.panes[k] target = self.panes[pane]
# Resize pane # Resize pane
tmux_resize_pane(pane_id=target, **v) tmux_resize_pane(pane_id=target, **pane_data)
# Calc Source/Destination pane sizes # Calc Source/Destination pane sizes
width, height = tmux_get_pane_size() width, height = tmux_get_pane_size()