mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 01:18:39 +00:00
The column menu list now toggles visibility of the columns.
This commit is contained in:
parent
e208724bc3
commit
8d23e8ee80
1 changed files with 12 additions and 3 deletions
|
@ -110,8 +110,7 @@ class ListView:
|
||||||
|
|
||||||
# Dictionary of 'header' or 'name' to ListViewColumn object
|
# Dictionary of 'header' or 'name' to ListViewColumn object
|
||||||
self.columns = {}
|
self.columns = {}
|
||||||
# Column_index will keep track of the order that the visible columns
|
# Column_index keeps track of the order of the visible columns.
|
||||||
# are in.
|
|
||||||
self.column_index = []
|
self.column_index = []
|
||||||
# The column types for the list store.. this may have more entries than
|
# The column types for the list store.. this may have more entries than
|
||||||
# visible columns due to some columns utilizing more than 1 liststore
|
# visible columns due to some columns utilizing more than 1 liststore
|
||||||
|
@ -131,6 +130,14 @@ class ListView:
|
||||||
else:
|
else:
|
||||||
return self.columns[name].column_indices[0]
|
return self.columns[name].column_indices[0]
|
||||||
|
|
||||||
|
def on_menuitem_toggled(self, widget):
|
||||||
|
# Get the column name from the widget
|
||||||
|
name = widget.get_child().get_text()
|
||||||
|
|
||||||
|
# Set the column's visibility based on the widgets active state
|
||||||
|
self.columns[name].column.set_visible(widget.get_active())
|
||||||
|
return
|
||||||
|
|
||||||
def create_checklist_menu(self):
|
def create_checklist_menu(self):
|
||||||
self.menu = gtk.Menu()
|
self.menu = gtk.Menu()
|
||||||
# Iterate through the column_index list to preserve order
|
# Iterate through the column_index list to preserve order
|
||||||
|
@ -145,6 +152,8 @@ class ListView:
|
||||||
# (or checked) in the menu.
|
# (or checked) in the menu.
|
||||||
if column.column.get_visible() is True:
|
if column.column.get_visible() is True:
|
||||||
menuitem.set_active(True)
|
menuitem.set_active(True)
|
||||||
|
# Connect to the 'toggled' event
|
||||||
|
menuitem.connect("toggled", self.on_menuitem_toggled)
|
||||||
# Add the new checkmenuitem to the menu
|
# Add the new checkmenuitem to the menu
|
||||||
self.menu.append(menuitem)
|
self.menu.append(menuitem)
|
||||||
return self.menu
|
return self.menu
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue