Don't overwrite existing groups

This commit is contained in:
Stephen Boddy 2012-10-22 14:25:37 +02:00
parent 55c3b7d59c
commit 038e495610
1 changed files with 12 additions and 9 deletions

View File

@ -234,15 +234,18 @@ class Titlebar(gtk.EventBox):
def create_group(self):
"""Create a new group"""
defaultgroups=set(['Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta',
'Theta','Iota','Kappa','Lambda','Mu','Nu','Xi',
'Omnicron','Pi','Rho','Sigma','Tau','Upsilon','Phi',
'Chi','Psi','Omega'])
currentgroups=set(self.terminator.groups)
freegroups = list(defaultgroups-currentgroups)
random.shuffle(freegroups)
if self.groupentry.get_text()=='' and freegroups:
self.groupentry.set_text(freegroups.pop())
if self.terminal.group:
self.groupentry.set_text(self.terminal.group)
else:
defaultgroups=set(['Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta',
'Theta','Iota','Kappa','Lambda','Mu','Nu','Xi',
'Omnicron','Pi','Rho','Sigma','Tau','Upsilon','Phi',
'Chi','Psi','Omega'])
currentgroups=set(self.terminator.groups)
freegroups = list(defaultgroups-currentgroups)
random.shuffle(freegroups)
if self.groupentry.get_text()=='' and freegroups:
self.groupentry.set_text(freegroups.pop())
self.groupentry.show()
self.groupentry.grab_focus()
self.update_visibility()