Exemplo n.º 1
0
    def __init__(self, parser):

        # for some reason, this is not being obeyed
        self.item_width = 55
        self.item_height = 50

        self._signal_name = 'category_item_selected'
        self._parser = parser

        # Initialise self._items
        self._items = {}

        # Save the order of the categories so we can use it outside
        self.categories = self._parser.list_available_categories()
        SelectMenu.__init__(self, self.categories, self._signal_name)

        # Add the scrollbar for the category menu
        sw = ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        # Set the scrollbar to the left
        sw.set_placement(Gtk.CornerType.TOP_RIGHT)
        sw.apply_styling_to_widget()
        sw.set_size_request(-1, 364)
        self.add(sw)

        self._vertbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        sw.add(self._vertbox)

        # The menu is one item by 7 items
        self.set_size_request(self.item_width, 7 * self.item_height)
        self._pack_buttons()
Exemplo n.º 2
0
    def __init__(self, parser):

        # for some reason, this is not being obeyed
        self.item_width = 55
        self.item_height = 50

        self._signal_name = 'category_item_selected'
        self._parser = parser

        # Initialise self._items
        self._items = {}

        # Save the order of the categories so we can use it outside
        self.categories = self._parser.list_available_categories()
        SelectMenu.__init__(self, self.categories, self._signal_name)

        # Add the scrollbar for the category menu
        sw = ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        # Set the scrollbar to the left
        sw.set_placement(Gtk.CornerType.TOP_RIGHT)
        sw.apply_styling_to_widget()
        sw.set_size_request(-1, 364)
        self.add(sw)

        self._vertbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        sw.add(self._vertbox)

        # The menu is one item by 7 items
        self.set_size_request(self.item_width, 7 * self.item_height)
        self._pack_buttons()
Exemplo n.º 3
0
    def __init__(self, category, avatar_parser):
        logger.debug(
            "Initialising pop up menu with category {}".format(category))

        self.top_bar_height = 50

        # Size of the selected icon
        self.button_width = 42
        self.button_height = 42

        self._category = category
        self._parser = avatar_parser
        if self._category == self._parser.char_label:
            self._signal_name = 'character_selected'
        else:
            self._signal_name = 'pop_up_item_selected'
        self._border_path = self._parser.get_selected_border(self._category)
        self._hover_path = self._parser.get_hover_border(self._category)

        obj_names = self._parser.list_avail_objs(self._category)
        SelectMenu.__init__(self, obj_names, self._signal_name)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        # Grid which the buttons are packed into
        self._grid = Gtk.Grid()

        # pack the grid into a sw of a specified height
        sw = ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        sw.apply_styling_to_widget()
        sw.add(self._grid)
        sw.set_size_request(152, 294)

        # Labels the category
        top_bar = self._create_top_bar()
        vbox.pack_start(top_bar, False, False, 0)
        vbox.pack_start(sw, False, False, 10)

        self._pack_items()
        self.show_all()
Exemplo n.º 4
0
    def __init__(self, category, avatar_parser):
        logger.debug(
            "Initialising pop up menu with category {}".format(category))

        self.top_bar_height = 50

        # Size of the selected icon
        self.button_width = 42
        self.button_height = 42

        self._category = category
        self._parser = avatar_parser
        if self._category == self._parser.char_label:
            self._signal_name = 'character_selected'
        else:
            self._signal_name = 'pop_up_item_selected'
        self._border_path = self._parser.get_selected_border(self._category)
        self._hover_path = self._parser.get_hover_border(self._category)

        obj_names = self._parser.list_avail_objs(self._category)
        SelectMenu.__init__(self, obj_names, self._signal_name)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        # Grid which the buttons are packed into
        self._grid = Gtk.Grid()

        # pack the grid into a sw of a specified height
        sw = ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        sw.apply_styling_to_widget()
        sw.add(self._grid)
        sw.set_size_request(152, 294)

        # Labels the category
        top_bar = self._create_top_bar()
        vbox.pack_start(top_bar, False, False, 0)
        vbox.pack_start(sw, False, False, 10)

        self._pack_items()
        self.show_all()