Changeset 38142c77f3dc358917b2a802d6e5c0620bfa67f7

Show
Ignore:
Timestamp:
06/11/08 16:15:52 (4 years ago)
Author:
Lincoln de Sousa <lincoln@…>
Children:
5d1bd3021693e54e7d206613f99797ed5d29b05d
Parents:
99518efdf730844e6adc35309b321332710a2460
git-committer:
Lincoln de Sousa <lincoln@…> (06/11/08 16:15:52)
Message:

Finishing initial tab issues, like close, now the child process is
being killed with SIGKILL. Terminal focus on tab click was fixed
too. last_pos attribute and its setter were removed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/guake.py

    r99518ef r38142c7  
    3232 
    3333import os 
     34import signal 
    3435import sys 
    3536import warnings 
     
    6263) 
    6364 
    64  
    6565class AboutDialog(SimpleGladeApp): 
    6666    def __init__(self): 
     
    7373 
    7474        # images 
    75         ipath = common.pixmapfile('guake.png') 
     75        ipath = common.pixmapfile('guake-notification.png') 
    7676        img = gtk.gdk.pixbuf_new_from_file(ipath) 
    7777        ad.set_property('logo', img) 
     
    9595 
    9696        # images 
    97         ipath = common.pixmapfile('guake.png') 
     97        ipath = common.pixmapfile('guake-notification.png') 
    9898        self.get_widget('image_logo').set_from_file(ipath) 
    9999        ipath = common.pixmapfile('tabdown.svg') 
     
    425425 
    426426        self.accel_group = gtk.AccelGroup() 
    427         self.last_pos = -1 
    428427        self.term_list = [] 
     428        self.pid_list = [] 
    429429 
    430430        self.animation_speed = 30 
     
    694694        self.term_list[current_pos].paste_clipboard() 
    695695 
     696    def on_context_close_tab_activate(self, *args): 
     697        current_pos = self.notebook.get_current_page() 
     698        pid = self.pid_list.pop(current_pos) 
     699        os.kill(pid, signal.SIGKILL) 
     700 
    696701    def on_context_close_activate(self, widget): 
    697702        gtk.main_quit() 
    698  
    699     def on_close_button_close_clicked(self, widget, index): 
    700         self.term_list[index].fork_command("bash", "exit") 
    701         self.set_terminal_focus() 
    702703 
    703704    # -- tab related functions -- 
     
    710711        # TODO: make new terminal opens in the same dir of the already in use. 
    711712        shell_name = self.client.get_string(GCONF_PATH+'general/default_shell') 
    712         self.term_list[last_added].fork_command(shell_name or "bash", 
    713                 directory=os.path.expanduser('~')) 
     713        directory = os.path.expanduser('~') 
     714        pid = self.term_list[last_added].\ 
     715            fork_command(shell_name or "bash", directory=directory) 
     716 
     717        self.pid_list.append(pid) 
    714718        self.term_list[last_added].connect('button-press-event', 
    715719                self.show_context_menu) 
     
    720724        bnt = gtk.RadioButton(group=parent, 
    721725                              label=_('Terminal %s') % (last_added+1)) 
    722         bnt.connect('clicked', self.set_terminal_focus) 
     726        bnt.connect('clicked', lambda *x: 
     727                        self.notebook.set_current_page (len(tabs))) 
    723728        bnt.set_property('draw-indicator', False) 
    724729        bnt.show() 
     
    758763 
    759764        self.notebook.append_page(mhbox, None) 
    760         self.notebook.connect('switch-page', self.set_last_pos) 
    761         self.notebook.connect('focus-tab', self.set_terminal_focus) 
    762765 
    763766        self.load_config() 
    764767        self.term_list[last_added].show() 
    765768        self.notebook.set_current_page(last_added) 
    766         self.last_pos = last_added 
    767769 
    768770    def delete_tab(self, pagepos): 
     
    773775            self.hide() 
    774776 
    775     def set_terminal_focus(self, *args): 
    776         self.notebook.set_current_page(self.last_pos) 
    777         self.term_list[self.last_pos].grab_focus() 
     777    def set_terminal_focus(self): 
     778        page = self.notebook.get_current_page() 
     779        self.term_list[page].grab_focus() 
    778780 
    779781    def select_current_tab(self, notebook, user_data, page): 
    780782        self.tabs.get_children()[page].set_active(True) 
    781  
    782     def set_last_pos(self, notebook, page, page_num): 
    783         self.last_pos = page_num 
    784783 
    785784    def clear_old_terms(self):