(self)
return(menu)
Fill out a group menu
Fill out a group menu
Fill out a group menu
def populate_group_menu(self):
        """Fill out a group menu"""
        menu = Gtk.Menu()
        self.group_menu = menu
        groupitems = []

        item = Gtk.MenuItem.new_with_mnemonic(_('N_ew group...'))
        item.connect('activate', self.create_group)
        menu.append(item)

        if len(self.terminator.groups) > 0:
            cnxs = []
            item = Gtk.RadioMenuItem.new_with_mnemonic(groupitems, _('_None'))
            groupitems = item.get_group()
            item.set_active(self.group == None)
            cnxs.append([item, 'toggled', self.set_group, None])
            menu.append(item)

            for group in self.terminator.groups:
                item = Gtk.RadioMenuItem.new_with_label(groupitems, group)
                groupitems = item.get_group()
                item.set_active(self.group == group)
                cnxs.append([item, 'toggled', self.set_group, group])
                menu.append(item)

            for cnx in cnxs:
                cnx[0].connect(cnx[1], cnx[2], cnx[3])

        if self.group != None or len(self.terminator.groups) > 0:
            menu.append(Gtk.SeparatorMenuItem())

        if self.group != None:
            item = Gtk.MenuItem(_('Remove group %s') % self.group)
            item.connect('activate', self.ungroup, self.group)
            menu.append(item)

        if util.has_ancestor(self, Gtk.Window):
            item = Gtk.MenuItem.new_with_mnemonic(_('G_roup all in window'))
            item.connect('activate', lambda x: self.emit('group_win'))
            menu.append(item)

            if len(self.terminator.groups) > 0:
                item = Gtk.MenuItem.new_with_mnemonic(_('Ungro_up all in window'))
                item.connect('activate', lambda x: self.emit('ungroup_win'))
                menu.append(item)

        if util.has_ancestor(self, Gtk.Notebook):
            item = Gtk.MenuItem.new_with_mnemonic(_('G_roup all in tab'))
            item.connect('activate', lambda x: self.emit('group_tab'))
            menu.append(item)

            if len(self.terminator.groups) > 0:
                item = Gtk.MenuItem.new_with_mnemonic(_('Ungro_up all in tab'))
                item.connect('activate', lambda x: self.emit('ungroup_tab'))
                menu.append(item)

        if len(self.terminator.groups) > 0:
            item = Gtk.MenuItem(_('Remove all groups'))
            item.connect('activate', lambda x: self.emit('ungroup-all'))
            menu.append(item)

        if self.group != None:
            menu.append(Gtk.SeparatorMenuItem())

            item = Gtk.MenuItem(_('Close group %s') % self.group)
            item.connect('activate', lambda x:
                         self.terminator.closegroupedterms(self.group))
            menu.append(item)

        menu.append(Gtk.SeparatorMenuItem())

        groupitems = []
        cnxs = []

        for key, value in list({_('Broadcast _all'):'all',
                          _('Broadcast _group'):'group',
                          _('Broadcast _off'):'off'}.items()):
            item = Gtk.RadioMenuItem.new_with_mnemonic(groupitems, key)
            groupitems = item.get_group()
            dbg('Terminal::populate_group_menu: %s active: %s' %
                    (key, self.terminator.groupsend ==
                        self.terminator.groupsend_type[value]))
            item.set_active(self.terminator.groupsend ==
                    self.terminator.groupsend_type[value])
            cnxs.append([item, 'activate', self.set_groupsend, self.terminator.groupsend_type[value]])
            menu.append(item)

        for cnx in cnxs:
            cnx[0].connect(cnx[1], cnx[2], cnx[3])

        menu.append(Gtk.SeparatorMenuItem())

        item = Gtk.CheckMenuItem.new_with_mnemonic(_('_Split to this group'))
        item.set_active(self.config['split_to_group'])
        item.connect('toggled', lambda x: self.do_splittogroup_toggle())
        menu.append(item)

        item = Gtk.CheckMenuItem.new_with_mnemonic(_('Auto_clean groups'))
        item.set_active(self.config['autoclean_groups'])
        item.connect('toggled', lambda x: self.do_autocleangroups_toggle())
        menu.append(item)

        menu.append(Gtk.SeparatorMenuItem())

        item = Gtk.MenuItem.new_with_mnemonic(_('_Insert terminal number'))
        item.connect('activate', lambda x: self.emit('enumerate', False))
        menu.append(item)

        item = Gtk.MenuItem.new_with_mnemonic(_('Insert _padded terminal number'))
        item.connect('activate', lambda x: self.emit('enumerate', True))
        menu.append(item)

        return(menu)
def populate_group_menu ( self ) : menu = Gtk . Menu ( ) self . group_menu = menu groupitems = [ ] item = Gtk . MenuItem . new_with_mnemonic ( _ ( 'N_ew group...' ) ) item . connect ( 'activate' , self . create_group ) menu . append ( item ) if len ( self . terminator . groups ) > 0 : cnxs = [ ] item = Gtk . RadioMenuItem . new_with_mnemonic ( groupitems , _ ( '_None' ) ) groupitems = item . get_group ( ) item . set_active ( self . group == None ) cnxs . append ( [ item , 'toggled' , self . set_group , None ] ) menu . append ( item ) for group in self . terminator . groups : item = Gtk . RadioMenuItem . new_with_label ( groupitems , group ) groupitems = item . get_group ( ) item . set_active ( self . group == group ) cnxs . append ( [ item , 'toggled' , self . set_group , group ] ) menu . append ( item ) for cnx in cnxs : cnx [ 0 ] . connect ( cnx [ 1 ] , cnx [ 2 ] , cnx [ 3 ] ) if self . group != None or len ( self . terminator . groups ) > 0 : menu . append ( Gtk . SeparatorMenuItem ( ) ) if self . group != None : item = Gtk . MenuItem ( _ ( 'Remove group %s' ) % self . group ) item . connect ( 'activate' , self . ungroup , self . group ) menu . append ( item ) if util . has_ancestor ( self , Gtk . Window ) : item = Gtk . MenuItem . new_with_mnemonic ( _ ( 'G_roup all in window' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'group_win' ) ) menu . append ( item ) if len ( self . terminator . groups ) > 0 : item = Gtk . MenuItem . new_with_mnemonic ( _ ( 'Ungro_up all in window' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'ungroup_win' ) ) menu . append ( item ) if util . has_ancestor ( self , Gtk . Notebook ) : item = Gtk . MenuItem . new_with_mnemonic ( _ ( 'G_roup all in tab' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'group_tab' ) ) menu . append ( item ) if len ( self . terminator . groups ) > 0 : item = Gtk . MenuItem . new_with_mnemonic ( _ ( 'Ungro_up all in tab' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'ungroup_tab' ) ) menu . append ( item ) if len ( self . terminator . groups ) > 0 : item = Gtk . MenuItem ( _ ( 'Remove all groups' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'ungroup-all' ) ) menu . append ( item ) if self . group != None : menu . append ( Gtk . SeparatorMenuItem ( ) ) item = Gtk . MenuItem ( _ ( 'Close group %s' ) % self . group ) item . connect ( 'activate' , lambda x : self . terminator . closegroupedterms ( self . group ) ) menu . append ( item ) menu . append ( Gtk . SeparatorMenuItem ( ) ) groupitems = [ ] cnxs = [ ] for key , value in list ( { _ ( 'Broadcast _all' ) : 'all' , _ ( 'Broadcast _group' ) : 'group' , _ ( 'Broadcast _off' ) : 'off' } . items ( ) ) : item = Gtk . RadioMenuItem . new_with_mnemonic ( groupitems , key ) groupitems = item . get_group ( ) dbg ( 'Terminal::populate_group_menu: %s active: %s' % ( key , self . terminator . groupsend == self . terminator . groupsend_type [ value ] ) ) item . set_active ( self . terminator . groupsend == self . terminator . groupsend_type [ value ] ) cnxs . append ( [ item , 'activate' , self . set_groupsend , self . terminator . groupsend_type [ value ] ] ) menu . append ( item ) for cnx in cnxs : cnx [ 0 ] . connect ( cnx [ 1 ] , cnx [ 2 ] , cnx [ 3 ] ) menu . append ( Gtk . SeparatorMenuItem ( ) ) item = Gtk . CheckMenuItem . new_with_mnemonic ( _ ( '_Split to this group' ) ) item . set_active ( self . config [ 'split_to_group' ] ) item . connect ( 'toggled' , lambda x : self . do_splittogroup_toggle ( ) ) menu . append ( item ) item = Gtk . CheckMenuItem . new_with_mnemonic ( _ ( 'Auto_clean groups' ) ) item . set_active ( self . config [ 'autoclean_groups' ] ) item . connect ( 'toggled' , lambda x : self . do_autocleangroups_toggle ( ) ) menu . append ( item ) menu . append ( Gtk . SeparatorMenuItem ( ) ) item = Gtk . MenuItem . new_with_mnemonic ( _ ( '_Insert terminal number' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'enumerate' , False ) ) menu . append ( item ) item = Gtk . MenuItem . new_with_mnemonic ( _ ( 'Insert _padded terminal number' ) ) item . connect ( 'activate' , lambda x : self . emit ( 'enumerate' , True ) ) menu . append ( item ) return ( menu )