Exemple #1
0
    def __on_create_page(self, widget):
        nb = Core().get_main_scan_notebook()

        widget = TerminalPage()
        widget.show_all()

        label = HIGAnimatedTabLabel("Terminal")
        label.connect("close-clicked", self.__on_close_page, widget)

        gtk.Notebook.append_page(nb, widget, label)
    def __on_create_page(self, widget):
        nb = Core().get_main_scan_notebook()

        widget = TerminalPage()
        widget.show_all()

        label = HIGAnimatedTabLabel("Terminal")
        label.connect('close-clicked', self.__on_close_page, widget)

        gtk.Notebook.append_page(nb, widget, label)
Exemple #3
0
        def buildtv(*args):
            """
            Build treeview and append results.
            """
            lsmodel = gtk.ListStore(str, str, str, str)
            tview = gtk.TreeView(lsmodel)
            columns = 4
            columns_text = (
                _("Inventory"), _("Host"),
                _("First Matched Category"), _("Entry Date")
                )
            tview.columns = [None]*columns

            for n in range(columns):
                tview.columns[n] = gtk.TreeViewColumn(columns_text[n])
                tview.columns[n].cell = gtk.CellRendererText()
                tview.columns[n].pack_start(tview.columns[n].cell, True)
                tview.columns[n].set_attributes(tview.columns[n].cell, text=n)

                tview.append_column(tview.columns[n])

            tview.connect('row-activated', row_activated)

            # layout
            matches = len(args[1])
            word = append_s(_("result"), matches)
            upper_title = gtk.Label()
            upper_title.set_markup(
                    ("<b>%d " % matches) + word + _(" found.") +
                    "</b>")
            hutbox = HIGHBox()
            hutbox._pack_noexpand_nofill(upper_title)
            sw = HIGScrolledWindow()
            sw.add(tview)
            vbox = gtk.VBox()
            vbox.pack_start(hutbox, False, False, 3)
            vbox.pack_start(sw, True, True, 0)

            vbox.show_all()

            # append results to treeview
            results = args[1]

            for res, date in results.items():
                invname = self.invdb.get_inventory_name_for_id(res[0])
                lsmodel.append((invname, res[1], res[2], str(date)))

            title = _("Search: %s") % args[0]
            tab_label = HIGAnimatedTabLabel(title)
            tab_label.connect("close-clicked", close_page, vbox)
            self.viewernb.append_page(vbox, tab_label)
        def buildtv(*args):
            """
            Build treeview and append results.
            """
            lsmodel = gtk.ListStore(str, str, str, str)
            tview = gtk.TreeView(lsmodel)
            columns = 4
            columns_text = (_("Inventory"), _("Host"),
                            _("First Matched Category"), _("Entry Date"))
            tview.columns = [None] * columns

            for n in range(columns):
                tview.columns[n] = gtk.TreeViewColumn(columns_text[n])
                tview.columns[n].cell = gtk.CellRendererText()
                tview.columns[n].pack_start(tview.columns[n].cell, True)
                tview.columns[n].set_attributes(tview.columns[n].cell, text=n)

                tview.append_column(tview.columns[n])

            tview.connect('row-activated', row_activated)

            # layout
            matches = len(args[1])
            word = append_s(_("result"), matches)
            upper_title = gtk.Label()
            upper_title.set_markup(("<b>%d " % matches) + word + _(" found.") +
                                   "</b>")
            hutbox = HIGHBox()
            hutbox._pack_noexpand_nofill(upper_title)
            sw = HIGScrolledWindow()
            sw.add(tview)
            vbox = gtk.VBox()
            vbox.pack_start(hutbox, False, False, 3)
            vbox.pack_start(sw, True, True, 0)

            vbox.show_all()

            # append results to treeview
            results = args[1]

            for res, date in results.items():
                invname = self.invdb.get_inventory_name_for_id(res[0])
                lsmodel.append((invname, res[1], res[2], str(date)))

            title = _("Search: %s") % args[0]
            tab_label = HIGAnimatedTabLabel(title)
            tab_label.connect("close-clicked", close_page, vbox)
            self.viewernb.append_page(vbox, tab_label)
    def timeline_for_host(self, event):
        """
        Show timeline for a especific host (Only available in Historic, for
        now at least).
        """
        def close_page(widget, data):
            """
            Close search page.
            """
            page_num = self.daddy.viewernb.page_num(data)
            self.daddy.viewernb.remove_page(page_num)

        from umit.inventory.Timeline import TLHolder

        fk_inventory = self.invdb.get_inventory_id_for_name(self.inventory)
        fk_address = (
            self.invdb.get_address_id_for_address_from_db(self.hostaddr))

        tl = TLHolder(fk_inventory, fk_address)
        tl.show_all()

        title = "%s/%s" % (self.inventory, self.hostaddr)
        tab_label = HIGAnimatedTabLabel(title)
        tab_label.show()
        tab_label.connect("close-clicked", close_page, tl)
        self.daddy.viewernb.append_page(tl, tab_label)