1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed a4e2360

logcolumns: merge duplicate codes to build list of checked/unchecked columns

  • Participants
  • Parent commits 23573a2
  • Branches default

Comments (0)

Files changed (1)

File tortoisehg/hgqt/repoview.py

View file
  • Ignore whitespace
         self.setLayout(layout)
 
         list = QListWidget()
-        # enabled cols are listed in sorted order
-        for c in self.curcolumns:
+        # enabled cols are listed in sorted order, disabled are listed last
+        for c in self.curcolumns + self.disabled:
             item = QListWidgetItem(colnames[c])
             item.columnid = c
             item.setFlags(Qt.ItemIsSelectable |
                           Qt.ItemIsEnabled |
                           Qt.ItemIsDragEnabled |
                           Qt.ItemIsUserCheckable)
-            item.setCheckState(Qt.Checked)
-            list.addItem(item)
-        # disabled cols are listed last
-        for c in self.disabled:
-            item = QListWidgetItem(colnames[c])
-            item.columnid = c
-            item.setFlags(Qt.ItemIsSelectable |
-                          Qt.ItemIsEnabled |
-                          Qt.ItemIsDragEnabled |
-                          Qt.ItemIsUserCheckable)
-            item.setCheckState(Qt.Unchecked)
+            if c in self.curcolumns:
+                item.setCheckState(Qt.Checked)
+            else:
+                item.setCheckState(Qt.Unchecked)
             list.addItem(item)
         list.setDragDropMode(QListView.InternalMove)
         layout.addWidget(list)