def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.current = None
        self.tab_changed_cb = None
        self.close_cb = None
        self.empty_cb = None

        self.scr = Scroller(self,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.button_bx = Box(self.scr,
                             size_hint_weight=EXPAND_HORIZ,
                             align=ALIGN_LEFT)
        self.button_bx.horizontal = True
        self.button_bx.show()

        self.scr.content = self.button_bx
        self.scr.show()

        self.nav_fr = Naviframe(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
        self.nav_fr.show()

        self.pack_end(self.scr)
        self.pack_end(self.nav_fr)
    def __init__(self):
        StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        staticImage = staticImage = Image(self)
        staticImage.size_hint_weight = EXPAND_BOTH
        staticImage.file_set("images/logo.png")
        staticImage.tooltip_text_set("A picture!")
        staticImage.show()

        ourLabel = ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hey look some text!"
        ourLabel.show()

        self.nf = Naviframe(self)
        self.nf.size_hint_weight = EXPAND_BOTH
        self.nf.size_hint_align = FILL_BOTH
        self.nf.show()

        buttonOne = Button(self)
        buttonOne.size_hint_weight = EXPAND_BOTH
        buttonOne.text = "Show image"
        buttonOne.callback_clicked_add(self.buttonPressed, staticImage)
        buttonOne.show()

        buttonTwo = Button(self)
        buttonTwo.size_hint_weight = EXPAND_BOTH
        buttonTwo.text = "Show label"
        buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel)
        buttonTwo.show()

        buttonBox = Box(self)
        buttonBox.size_hint_weight = EXPAND_HORIZ
        buttonBox.horizontal_set(True)
        buttonBox.pack_end(buttonOne)
        buttonBox.pack_end(buttonTwo)
        buttonBox.show()

        mainBox = Box(self)
        mainBox.size_hint_weight = EXPAND_BOTH
        mainBox.pack_end(self.nf)
        mainBox.pack_end(buttonBox)
        mainBox.show()

        self.nf.item_simple_push(staticImage)

        self.resize_object_add(mainBox)
示例#3
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.currentTab = None
        self.tabChangedCallback = None
        self.closeCallback = None
        self.emptyCallback = None

        self.scr = Scroller(self, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.buttonBox = Box(self.scr, size_hint_weight=EXPAND_HORIZ,
                           align=ALIGN_LEFT)
        self.buttonBox.horizontal = True
        self.buttonBox.show()

        self.scr.content = self.buttonBox
        self.scr.show()
        
        self.nf = Naviframe(self, size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH)
        self.nf.show()

        self.pack_end(self.scr)
        self.pack_end(self.nf)
def naviframe_clicked(obj):
    win = StandardWindow("naviframe", "Naviframe test", autodel=True,
        size=(400, 400))
    win.focus_highlight_enabled = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    nf = Naviframe(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(nf)
    nf.show()

    bt = Button(win, text="Next")
    bt.callback_clicked_add(page2, nf)

    content = Photo(nf, file=os.path.join(img_path, "logo.png"),
        fill_inside=True, style="shadow")

    item = nf.item_push("Page 1", None, bt, content, "basic")
    nf.data["page1"] = item

    win.show()
def naviframe_clicked(obj):
    win = StandardWindow("naviframe",
                         "Naviframe test",
                         autodel=True,
                         size=(400, 400))
    win.focus_highlight_enabled = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    nf = Naviframe(win,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
    win.resize_object_add(nf)
    nf.show()

    bt = Button(win, text="Next")
    bt.callback_clicked_add(page2, nf)

    content = Photo(nf,
                    file=os.path.join(img_path, "logo.png"),
                    fill_inside=True,
                    style="shadow")

    item = nf.item_push("Page 1", None, bt, content, "basic")
    nf.data["page1"] = item

    win.show()
    def __init__(self):
        StandardWindow.__init__(self, "ex7", "Naviframe", size=(300, 200))
        self.callback_delete_request_add(lambda o: elm.exit())

        staticImage = staticImage = Image(self)
        staticImage.size_hint_weight = EXPAND_BOTH
        staticImage.file_set("images/logo.png")
        staticImage.tooltip_text_set("A picture!")
        staticImage.show()
        
        ourLabel = ourLabel = Label(self)
        ourLabel.size_hint_weight = EXPAND_BOTH
        ourLabel.text = "Hey look some text!"
        ourLabel.show()
        
        self.nf = Naviframe(self)
        self.nf.size_hint_weight = EXPAND_BOTH
        self.nf.size_hint_align = FILL_BOTH
        self.nf.show()
        
        buttonOne = Button(self)
        buttonOne.size_hint_weight = EXPAND_BOTH
        buttonOne.text = "Show image"
        buttonOne.callback_clicked_add(self.buttonPressed, staticImage)
        buttonOne.show()
        
        buttonTwo = Button(self)
        buttonTwo.size_hint_weight = EXPAND_BOTH
        buttonTwo.text = "Show label"
        buttonTwo.callback_clicked_add(self.buttonPressed, ourLabel)
        buttonTwo.show()
        
        buttonBox = Box(self)
        buttonBox.size_hint_weight = EXPAND_HORIZ
        buttonBox.horizontal_set(True)
        buttonBox.pack_end(buttonOne)
        buttonBox.pack_end(buttonTwo)
        buttonBox.show()
        
        mainBox = Box(self)
        mainBox.size_hint_weight = EXPAND_BOTH
        mainBox.pack_end(self.nf)
        mainBox.pack_end(buttonBox)
        mainBox.show()
        
        self.nf.item_simple_push(staticImage)
        
        self.resize_object_add(mainBox)
示例#7
0
    def __init__(self, parent_widget, add_tab=False, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self._dict = OrderedDict()

        # Tabs
        scr = self._scr = Scroller(
            self,
            size_hint_weight=EXPAND_HORIZ,
            size_hint_align=FILL_BOTH,
            policy=(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF),
            movement_block=ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)
        scr.content_min_limit(False, True)

        tb = self._tabBox = Box(self._scr,
                                size_hint_weight=EXPAND_HORIZ,
                                align=ALIGN_LEFT,
                                horizontal=True)
        tb.show()

        self._addTab = None
        if add_tab:
            at = self._addTab = Button(self._tabBox, style="anchor")
            at.content = Icon(self._addTab, standard="list-add")
            at.callback_clicked_add(
                lambda x: self.callback_call("tabs,add,clicked"))
            self._tabBox.pack_end(self._addTab)
            at.show()

        scr.content = self._tabBox
        scr.show()

        # Contents
        nf = self._nf = Naviframe(self,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        nf.callback_transition_finished_add(self._nfit_shown)
        nf.show()

        self.pack_end(scr)
        self.pack_end(nf)
    def __init__(self, parent, h):
        if not h.is_valid():
            Information(parent.win, "Invalid torrent handle.")
            return

        if not h.has_metadata():
            Information(parent.win, "Torrent contains no metadata.")
            return

        i = h.get_torrent_info()

        InnerWindow.__init__(self, parent.win)

        box = Box(self)
        box.size_hint_align = -1.0, -1.0
        box.size_hint_weight = 1.0, 1.0

        tname = Label(self)
        tname.size_hint_align = -1.0, 0.5
        tname.line_wrap = ELM_WRAP_CHAR
        tname.ellipsis = True
        tname.text = "{}".format(cgi.escape(i.name()))
        tname.show()
        box.pack_end(tname)

        for func in i.comment, i.creation_date, i.creator:
            try:
                w = func()
            except Exception as e:
                log.debug(e)
            else:
                if w:
                    f = Frame(self)
                    f.size_hint_align = -1.0, 0.0
                    f.text = func.__name__.replace("_", " ").capitalize()
                    l = Label(self)
                    l.ellipsis = True
                    l.text = cgi.escape(str(w))
                    l.show()
                    f.content = l
                    f.show()
                    box.pack_end(f)

        tpriv = Check(self)
        tpriv.size_hint_align = 0.0, 0.0
        tpriv.text = "Private"
        tpriv.tooltip_text_set("Whether this torrent is private.<br> \
            i.e., it should not be distributed on the trackerless network<br> \
            (the kademlia DHT).")
        tpriv.disabled = True
        tpriv.state = i.priv()

        magnet_uri = lt.make_magnet_uri(h)

        f = Frame(self)
        f.size_hint_align = -1.0, 0.0
        f.text = "Magnet URI"
        me_box = Box(self)
        me_box.horizontal = True
        me = Entry(self)
        me.size_hint_align = -1.0, 0.0
        me.size_hint_weight = 1.0, 0.0
        #me.editable = False
        me.entry = magnet_uri
        me_box.pack_end(me)
        me.show()
        me_btn = Button(self)
        me_btn.text = "Copy"
        if hasattr(me, "cnp_selection_set"):
            me_btn.callback_clicked_add(
                lambda x: me.top_widget.cnp_selection_set(
                    ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, me.text))
        else:
            import pyperclip
            me_btn.callback_clicked_add(lambda x: pyperclip.copy(magnet_uri))
        me_btn.show()
        me_box.pack_end(me_btn)
        me_box.show()
        f.content = me_box
        f.show()
        box.pack_end(f)

        fl_btn = Button(self)
        fl_btn.text = "Files ->"
        fl_btn.callback_clicked_add(self.file_list_cb, h)

        xbtn = Button(self)
        xbtn.text_set("Close")
        xbtn.callback_clicked_add(lambda x: self.delete())

        for w in tpriv, fl_btn, xbtn:
            w.show()
            box.pack_end(w)

        box.show()

        nf = self.nf = Naviframe(self)
        nf.item_simple_push(box)

        self.content_set(nf)
        self.activate()
示例#9
0
def conformant2_clicked(obj, item=None):
    win = StandardWindow("conformant2",
                         "Conformant 2",
                         autodel=True,
                         conformant=True,
                         size=(240, 480))

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    en = ScrollableEntry(win,
                         single_line=True,
                         bounce=(True, False),
                         text="This is the top entry here",
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()

    btn = Button(win,
                 focus_allow=False,
                 text="Delete Below",
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    pg = Naviframe(win,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
    bx.pack_end(pg)
    pg.show()

    btn.callback_clicked_add(popobj, pg)

    conform = Conformant(win,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
    pg.item_simple_push(conform)
    conform.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

    en = ScrollableEntry(win,
                         bounce=(False, True),
                         text="This entry and button below get deleted.",
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
    en.show()
    bx.pack_end(en)

    btn = Button(win,
                 focus_allow=False,
                 text="Delete this bottom bit 1",
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    btn.callback_clicked_add(popobj, pg)

    conform.content = bx
    bx.show()

    conform = Conformant(win,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
    pg.item_simple_push(conform)
    conform.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

    en = ScrollableEntry(win,
                         bounce=(False, True),
                         text="This entry and button below get deleted.",
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
    en.show()
    bx.pack_end(en)

    btn = Button(win,
                 focus_allow=False,
                 text="Delete this bottom bit 2",
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    btn.callback_clicked_add(popobj, pg)

    conform.content = bx
    bx.show()

    win.show()
示例#10
0
class TabbedBox(Box):
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.currentTab = None
        self.tabChangedCallback = None
        self.closeCallback = None
        self.emptyCallback = None

        self.scr = Scroller(self, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.buttonBox = Box(self.scr, size_hint_weight=EXPAND_HORIZ,
                           align=ALIGN_LEFT)
        self.buttonBox.horizontal = True
        self.buttonBox.show()

        self.scr.content = self.buttonBox
        self.scr.show()
        
        self.nf = Naviframe(self, size_hint_weight=EXPAND_BOTH,
                               size_hint_align=FILL_BOTH)
        self.nf.show()

        self.pack_end(self.scr)
        self.pack_end(self.nf)
        
    def addTab(self, widget, tabName, canClose=True, disabled=False):
        self.tabs.append(widget)

        btn = Button(self.buttonBox, style="anchor", size_hint_align=ALIGN_LEFT)
        btn.text = tabName
        btn.data["widget"] = widget
        btn.disabled = disabled
        btn.callback_clicked_add(self.showTab, widget)
        btn.show()

        icn = Icon(self.buttonBox)
        icn.standard_set("gtk-close")
        icn.show()

        cls = Button(self.buttonBox, content=icn, style="anchor", size_hint_align=ALIGN_LEFT)
        cls.data["widget"] = widget
        cls.callback_clicked_add(self.closeTab)
        cls.disabled = disabled
        if canClose:
            cls.show()

        sep = Separator(self.buttonBox, size_hint_align=ALIGN_LEFT)
        sep.show()

        self.buttonBox.pack_end(btn)
        self.buttonBox.pack_end(cls)
        self.buttonBox.pack_end(sep)

        #Arguments go: btn, cls, sep
        widget.data["close"] = cls
        widget.data["button"] = btn
        widget.data["sep"] = sep
        
        self.showTab(widget=widget)
    
    def disableTab(self, tabIndex):
        btn, cls = self.tabs[tabIndex].data["button"], self.tabs[tabIndex].data["close"]
        btn.disabled = True
        cls.disabled = True
        
    def enableTab(self, tabIndex):
        btn, cls = self.tabs[tabIndex].data["button"], self.tabs[tabIndex].data["close"]
        btn.disabled = False
        cls.disabled = False
    
    def showTab(self, btn=None, widget=None):
        if type(btn) is int:
            widget = self.tabs[btn]
        if widget != self.currentTab:
            if self.currentTab:
                self.currentTab.data["button"].style="anchor"
            self.nf.item_simple_push(widget)
            self.currentTab = widget
            self.currentTab.data["button"].style="widget"
            
            if self.tabChangedCallback:
                self.tabChangedCallback(self, widget)
    
    def closeTab(self, btn):
        if not self.closeCallback:
            self.deleteTab(btn.data["widget"])
        else:
            self.closeCallback(self, btn.data["widget"])
    
    def deleteTab(self, widget):
        if type(widget) is int:
            widget = self.tabs[tabIndex]
        
        del self.tabs[self.tabs.index(widget)]
        
        self.buttonBox.unpack(widget.data["close"])
        self.buttonBox.unpack(widget.data["button"])
        self.buttonBox.unpack(widget.data["sep"])
        
        widget.data["close"].delete()
        widget.data["button"].delete()
        widget.data["sep"].delete()
        widget.delete()
        
        if self.currentTab == widget and len(self.tabs):
            self.showTab(widget=self.tabs[0])
            
        if not len(self.tabs) and self.emptyCallback:
            self.emptyCallback(self)
class TabbedBox(Box):
    '''A TabbedBox class.'''
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.current = None
        self.tab_changed_cb = None
        self.close_cb = None
        self.empty_cb = None

        self.scr = Scroller(self,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.button_bx = Box(self.scr,
                             size_hint_weight=EXPAND_HORIZ,
                             align=ALIGN_LEFT)
        self.button_bx.horizontal = True
        self.button_bx.show()

        self.scr.content = self.button_bx
        self.scr.show()

        self.nav_fr = Naviframe(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
        self.nav_fr.show()

        self.pack_end(self.scr)
        self.pack_end(self.nav_fr)

    def add(self, widget, name, can_close=True, disabled=False):
        '''Add a tab to the tabbed box'''
        self.tabs.append(widget)

        btn = Button(self.button_bx,
                     style="anchor",
                     size_hint_align=ALIGN_LEFT)
        btn.text = name
        btn.data["widget"] = widget
        btn.disabled = disabled
        btn.callback_clicked_add(self.show_tab, widget)
        btn.show()

        icn = Icon(self.button_bx)
        icn.standard_set("gtk-close")
        icn.show()

        cls = Button(self.button_bx,
                     content=icn,
                     style="anchor",
                     size_hint_align=ALIGN_LEFT)
        cls.data["widget"] = widget
        cls.callback_clicked_add(self.cb_close_btn)
        cls.disabled = disabled
        if can_close:
            cls.show()

        sep = Separator(self.button_bx, size_hint_align=ALIGN_LEFT)
        sep.show()

        self.button_bx.pack_end(btn)
        self.button_bx.pack_end(cls)
        self.button_bx.pack_end(sep)

        # Arguments go: btn, cls, sep
        widget.data["close"] = cls
        widget.data["button"] = btn
        widget.data["sep"] = sep

        self.show_tab(widget=widget)

    def disable(self, index):
        '''Disable a tab'''
        btn, cls = self.tabs[index].data["button"], self.tabs[index].data[
            "close"]
        btn.disabled = True
        cls.disabled = True

    def enable(self, index):
        '''Enable a tab'''
        btn, cls = self.tabs[index].data["button"], self.tabs[index].data[
            "close"]
        btn.disabled = False
        cls.disabled = False

    def show_tab(self, btn=None, widget=None):
        '''Show tab'''
        # pylint: disable=unidiomatic-typecheck
        #   This is as clear as any alternative to me
        if type(btn) is int:
            widget = self.tabs[btn]
        if widget != self.current:
            if self.current:
                self.current.data["button"].style = "anchor"
            self.nav_fr.item_simple_push(widget)
            self.current = widget
            self.current.data["button"].style = "widget"

            if self.tab_changed_cb:
                # pylint: disable=not-callable
                self.tab_changed_cb(self, widget)

    def cb_close_btn(self, btn):
        '''Close tab'''
        # pylint: disable=not-callable
        if not self.close_cb:
            self.delete_tab(btn.data["widget"])
        else:
            self.close_cb(self, btn.data["widget"])

    def delete_tab(self, widget):
        '''Delete tab'''
        # pylint: disable=unidiomatic-typecheck
        #   This is as clear as any alternative to me
        if type(widget) is int:
            widget = self.tabs[widget]

        del self.tabs[self.tabs.index(widget)]

        self.button_bx.unpack(widget.data["close"])
        self.button_bx.unpack(widget.data["button"])
        self.button_bx.unpack(widget.data["sep"])

        widget.data["close"].delete()
        widget.data["button"].delete()
        widget.data["sep"].delete()
        widget.delete()

        if self.current == widget and self.tabs:
            self.show_tab(widget=self.tabs[0])

        if not self.tabs and self.empty_cb:
            # pylint: disable=not-callable
            self.empty_cb(self)
示例#12
0
class TabbedBox(Box):
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.currentTab = None
        self.tabChangedCallback = None
        self.closeCallback = None
        self.emptyCallback = None

        self.scr = Scroller(self,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.buttonBox = Box(self.scr,
                             size_hint_weight=EXPAND_HORIZ,
                             align=ALIGN_LEFT)
        self.buttonBox.horizontal = True
        self.buttonBox.show()

        self.scr.content = self.buttonBox
        self.scr.show()

        self.nf = Naviframe(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.nf.show()

        self.pack_end(self.scr)
        self.pack_end(self.nf)

    def addTab(self, widget, tabName, canClose=True, disabled=False):
        self.tabs.append(widget)

        btn = Button(self.buttonBox,
                     style="anchor",
                     size_hint_align=ALIGN_LEFT)
        btn.text = tabName
        btn.data["widget"] = widget
        btn.disabled = disabled
        btn.callback_clicked_add(self.showTab, widget)
        btn.show()

        icn = Icon(self.buttonBox)
        icn.standard_set("gtk-close")
        icn.show()

        cls = Button(self.buttonBox,
                     content=icn,
                     style="anchor",
                     size_hint_align=ALIGN_LEFT)
        cls.data["widget"] = widget
        cls.callback_clicked_add(self.closeTab)
        cls.disabled = disabled
        if canClose:
            cls.show()

        sep = Separator(self.buttonBox, size_hint_align=ALIGN_LEFT)
        sep.show()

        self.buttonBox.pack_end(btn)
        self.buttonBox.pack_end(cls)
        self.buttonBox.pack_end(sep)

        #Arguments go: btn, cls, sep
        widget.data["close"] = cls
        widget.data["button"] = btn
        widget.data["sep"] = sep

        self.showTab(widget=widget)

    def disableTab(self, tabIndex):
        btn, cls = self.tabs[tabIndex].data["button"], self.tabs[
            tabIndex].data["close"]
        btn.disabled = True
        cls.disabled = True

    def enableTab(self, tabIndex):
        btn, cls = self.tabs[tabIndex].data["button"], self.tabs[
            tabIndex].data["close"]
        btn.disabled = False
        cls.disabled = False

    def showTab(self, btn=None, widget=None):
        if type(btn) is int:
            widget = self.tabs[btn]
        if widget != self.currentTab:
            if self.currentTab:
                self.currentTab.data["button"].style = "anchor"
            self.nf.item_simple_push(widget)
            self.currentTab = widget
            self.currentTab.data["button"].style = "widget"

            if self.tabChangedCallback:
                self.tabChangedCallback(self, widget)

    def closeTab(self, btn):
        if not self.closeCallback:
            self.deleteTab(btn.data["widget"])
        else:
            self.closeCallback(self, btn.data["widget"])

    def deleteTab(self, widget):
        if type(widget) is int:
            widget = self.tabs[widget]

        del self.tabs[self.tabs.index(widget)]

        self.buttonBox.unpack(widget.data["close"])
        self.buttonBox.unpack(widget.data["button"])
        self.buttonBox.unpack(widget.data["sep"])

        widget.data["close"].delete()
        widget.data["button"].delete()
        widget.data["sep"].delete()
        widget.delete()

        if self.currentTab == widget and len(self.tabs):
            self.showTab(widget=self.tabs[0])

        if not len(self.tabs) and self.emptyCallback:
            self.emptyCallback(self)
def conformant2_clicked(obj, item=None):
    win = StandardWindow("conformant2", "Conformant 2", autodel=True,
        conformant=True, size=(240,480))

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    en = ScrollableEntry(win, single_line=True, bounce=(True, False),
        text="This is the top entry here", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()

    btn = Button(win, focus_allow=False, text="Delete Below",
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    pg = Naviframe(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    bx.pack_end(pg)
    pg.show()

    btn.callback_clicked_add(popobj, pg)

    conform = Conformant(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    pg.item_simple_push(conform)
    conform.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

    en = ScrollableEntry(win, bounce=(False, True),
        text="This entry and button below get deleted.",
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    en.show()
    bx.pack_end(en)

    btn = Button(win, focus_allow=False, text="Delete this bottom bit 1",
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    btn.callback_clicked_add(popobj, pg)

    conform.content = bx
    bx.show()

    conform = Conformant(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    pg.item_simple_push(conform)
    conform.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

    en = ScrollableEntry(win, bounce=(False, True),
        text="This entry and button below get deleted.",
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    en.show()
    bx.pack_end(en)

    btn = Button(win, focus_allow=False, text="Delete this bottom bit 2",
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    btn.callback_clicked_add(popobj, pg)

    conform.content = bx
    bx.show()

    win.show()