예제 #1
0
    def __create_widgets(self):
        """
        """
        self.__content = HIGVBox()
        self.__head = HIGHBox(spacing=2)

        self.__notebook = NodeNotebook(self.__node)

        # create head elements

        # icon with node's score color
        self.__color_box = gtk.EventBox()
        self.__color_image = gtk.Image()
        self.__color_image.set_from_file(self.__icon.get_icon('border'))
        self.__color_box.add(self.__color_image)
        self.__color_box.set_size_request(15, 15)
        r, g, b = drawing.cairo_to_gdk_color(
            self.__node.get_draw_info('color'))
        self.__color_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(r, g, b))

        # title with the node ip and hostname
        self.__title = ""

        if self.__node.get_info('hostname') is not None:
            self.__title = self.__node.get_info('hostname') + ' - '

        self.__title += self.__node.get_info('ip')

        self.__title_label = HIGSectionLabel(self.__title)
        self.__title_label.modify_font(self.__title_font)

        # icon to collapse window
        self.__collapse_box = gtk.EventBox()
        self.__collapse_img = gtk.Image()
        self.__collapse_img.set_from_file(self.__icon.get_icon('collapse'))
        self.__collapse_box.add(self.__collapse_img)
        self.__collapse_box.connect('button_press_event', self.collapse_window)
        self.__collapse_box.add_events(gtk.gdk.BUTTON_PRESS_MASK)

        # icon to close window
        self.__close_box = gtk.EventBox()
        self.__close_img = gtk.Image()
        self.__close_img.set_from_file(self.__icon.get_icon('close'))
        self.__close_box.add(self.__close_img)
        self.__close_box.connect('button_press_event', self.close_window)
        self.__close_box.add_events(gtk.gdk.BUTTON_PRESS_MASK)

        # packing head elements
        self.__head._pack_noexpand_nofill(self.__color_box)
        self.__head._pack_expand_fill(self.__title_label)
        self.__head._pack_noexpand_nofill(self.__collapse_box)
        self.__head._pack_noexpand_nofill(self.__close_box)

        # packing all to content
        self.__content._pack_noexpand_nofill(self.__head)
        self.__content._pack_expand_fill(self.__notebook)

        # add context to window
        self.add(self.__content)
예제 #2
0
    def change_notebook(self, node):
        """
        """
        if self.__view is not None:
            self.__view.destroy()

        self.__view = NodeNotebook(node)
        self.__view.show_all()

        self.__panel.add2(self.__view)