Switch to ordered list of hosts. I don't want crussh to tweak the host

order.
This commit is contained in:
jkx 2017-09-25 11:06:38 +02:00
parent 972bef1dbf
commit c98742a9cc

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python2
# A cssh replacement written in Python / GTK. # A cssh replacement written in Python / GTK.
# (c)2012-2017 - Tessa Nordgren <tessa@sudo.ca>. # (c)2012-2017 - Tessa Nordgren <tessa@sudo.ca>.
@ -15,6 +15,7 @@ pygtk.require('2.0')
import gtk import gtk
import vte import vte
from EntryDialog import EntryDialog from EntryDialog import EntryDialog
from collections import OrderedDict
### Config Dialog ### ### Config Dialog ###
@ -138,7 +139,8 @@ class HostsMask:
HostsConfFrame.add(HostsConfTable) HostsConfFrame.add(HostsConfTable)
i = 0 i = 0
hosts = sorted(self.Terminals.keys(), reverse=False)
hosts = self.Terminals.keys()
for host in hosts: for host in hosts:
HostTable = gtk.Table(1, 2) HostTable = gtk.Table(1, 2)
HostTable.props.column_spacing = 2 HostTable.props.column_spacing = 2
@ -180,7 +182,7 @@ class CruSSH:
} }
### State Vars ### ### State Vars ###
Terminals = {} Terminals = OrderedDict()
TermMinWidth = 1 TermMinWidth = 1
TermMinHeight = 1 TermMinHeight = 1
@ -194,7 +196,8 @@ class CruSSH:
### Methods ### ### Methods ###
def reflowTable(self, cols=1, rows=1): def reflowTable(self, cols=1, rows=1):
# empty table and re-size # empty table and re-size
hosts = sorted(self.Terminals.keys(), reverse=True) hosts = list(self.Terminals.keys())
hosts.reverse()
for host in hosts: for host in hosts:
if self.Terminals[host].parent == self.LayoutTable: if self.Terminals[host].parent == self.LayoutTable:
self.LayoutTable.remove(self.Terminals[host]) self.LayoutTable.remove(self.Terminals[host])