gnome_connection_manager.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:gnome-connection-manager 作者: mjun 项目源码 文件源码
def split_notebook(self, direction):        
        csp = self.current.get_parent() if self.current!=None else None
        cnb = csp.get_parent() if csp!=None else None

        #Separar solo si hay mas de 2 tabs en el notebook actual
        if csp!=None and cnb.get_n_pages()>1:
            #Crear un hpaned, en el hijo 0 dejar el notebook y en el hijo 1 el nuevo notebook
            #El nuevo hpaned dejarlo como hijo del actual parent
            hp = gtk.HPaned() if direction==HSPLIT else gtk.VPaned()
            nb = gtk.Notebook()
            nb.set_group_id(11)
            nb.connect('button_press_event', self.on_double_click, None)
            nb.connect('page_removed', self.on_page_removed)
            nb.connect("page-added", self.on_page_added)
            nb.set_property("scrollable", True)
            cp  = cnb.get_parent()

            if direction==HSPLIT:
                cnb.set_size_request(cnb.allocation.width/2, cnb.allocation.height)
            else:                
                cnb.set_size_request(cnb.allocation.width, cnb.allocation.height/2)
            #cnb.set_size_request(cnb.allocation.width/2, cnb.allocation.height/2)

            cp.remove(cnb)
            cp.add(hp)
            hp.add1(cnb)                        

            text = cnb.get_tab_label(csp).get_text()

            csp.reparent(nb)
            csp = nb.get_nth_page(0)

            tab = NotebookTabLabel(text, nb, csp, self.popupMenuTab)
            nb.set_tab_label(csp, tab_label=tab)
            nb.set_tab_reorderable(csp, True)
            nb.set_tab_detachable(csp, True)

            hp.add2(nb)
            nb.show()
            hp.show()
            hp.queue_draw()
            self.current = cnb.get_nth_page(cnb.get_current_page()).get_children()[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号