URI: 
       tqt channels list: make selection more in line with other tabs - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 95979ba58d93ae83ec519f7f8f8468105e3f3e9e
   DIR parent 7488cc91cdbece4f93b0047e36cfba65ae8b01a2
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu, 26 Mar 2020 02:54:21 +0100
       
       qt channels list: make selection more in line with other tabs
       
       (allow selecting none, and allow multi-select)
       
       Diffstat:
         M electrum/gui/qt/channels_list.py    |      16 +++++++++++++---
       
       1 file changed, 13 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py
       t@@ -4,7 +4,8 @@ from enum import IntEnum
        
        from PyQt5 import QtCore, QtGui
        from PyQt5.QtCore import Qt
       -from PyQt5.QtWidgets import QMenu, QHBoxLayout, QLabel, QVBoxLayout, QGridLayout, QLineEdit, QPushButton
       +from PyQt5.QtWidgets import (QMenu, QHBoxLayout, QLabel, QVBoxLayout, QGridLayout, QLineEdit,
       +                             QPushButton, QAbstractItemView)
        from PyQt5.QtGui import QFont
        
        from electrum.util import bh2u, NotEnoughFunds, NoDynamicFeeEstimates
       t@@ -46,6 +47,7 @@ class ChannelsList(MyTreeView):
                super().__init__(parent, self.create_menu, stretch_column=self.Columns.NODE_ID,
                                 editable_columns=[])
                self.setModel(QtGui.QStandardItemModel(self))
       +        self.setSelectionMode(QAbstractItemView.ExtendedSelection)
                self.main_window = parent
                self.update_rows.connect(self.do_update_rows)
                self.update_single_row.connect(self.do_update_single_row)
       t@@ -121,7 +123,15 @@ class ChannelsList(MyTreeView):
            def create_menu(self, position):
                menu = QMenu()
                menu.setSeparatorsCollapsible(True)  # consecutive separators are merged together
       -        idx = self.selectionModel().currentIndex()
       +        selected = self.selected_in_column(self.Columns.NODE_ID)
       +        if not selected:
       +            return
       +        multi_select = len(selected) > 1
       +        if multi_select:
       +            return
       +        idx = self.indexAt(position)
       +        if not idx.isValid():
       +            return
                item = self.model().itemFromIndex(idx)
                if not item:
                    return
       t@@ -153,7 +163,7 @@ class ChannelsList(MyTreeView):
                menu.exec_(self.viewport().mapToGlobal(position))
        
            @QtCore.pyqtSlot(Channel)
       -    def do_update_single_row(self, chan):
       +    def do_update_single_row(self, chan: Channel):
                lnworker = self.parent.wallet.lnworker
                if not lnworker:
                    return