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): def create_group(self):
"""Create a new group""" """Create a new group"""
defaultgroups=set(['Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta', if self.terminal.group:
'Theta','Iota','Kappa','Lambda','Mu','Nu','Xi', self.groupentry.set_text(self.terminal.group)
'Omnicron','Pi','Rho','Sigma','Tau','Upsilon','Phi', else:
'Chi','Psi','Omega']) defaultgroups=set(['Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta',
currentgroups=set(self.terminator.groups) 'Theta','Iota','Kappa','Lambda','Mu','Nu','Xi',
freegroups = list(defaultgroups-currentgroups) 'Omnicron','Pi','Rho','Sigma','Tau','Upsilon','Phi',
random.shuffle(freegroups) 'Chi','Psi','Omega'])
if self.groupentry.get_text()=='' and freegroups: currentgroups=set(self.terminator.groups)
self.groupentry.set_text(freegroups.pop()) 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.show()
self.groupentry.grab_focus() self.groupentry.grab_focus()
self.update_visibility() self.update_visibility()