Exemplo n.º 1
0
    def _init_bpas(self):
        if self.animated_tile_graphics is None:
            bpas_box = self.builder.get_object('bpas')
            parent = bpas_box.get_parent()
            parent.remove(bpas_box)
            return
        for i, ani_tile_g in enumerate(self.animated_tile_graphics):
            view: IconView = self.builder.get_object(bpa_views[i])
            if ani_tile_g is None:
                sw: ScrolledWindow = view.get_parent()
                sw.remove(view)
                label = Gtk.Label.new(
                    _('BPA slot is empty.\n\nGo to Tiles > Animated Tiles to\nmanage animated tiles.'
                      ))
                label.set_vexpand(True)
                label.show()
                sw.add(label)
            else:
                view.set_selection_mode(Gtk.SelectionMode.BROWSE)
                renderer = DrawerTiledCellRenderer(
                    view, self.animated_tile_durations, self.pal_ani_durations,
                    False, self.dummy_tile_map, self.tile_surfaces, 3)

                store = Gtk.ListStore(int, str)
                view.set_model(store)
                view.pack_start(renderer, True)
                view.add_attribute(renderer, 'tileidx', 0)
                view.set_text_column(1)
                view.connect('selection-changed',
                             self.on_icon_view_static_tiles_selection_changed)
                for idx in range(self.bpa_starts[i], self.bpa_starts[i] +
                                 ani_tile_g.count()):  # type: ignore
                    store.append([idx, str(idx)])

                renderer.start()
Exemplo n.º 2
0
    def _init_icon_view_tiles_in_chunk(self):
        """Init the icon view containing the 3x3 tiles for the current chunk"""
        icon_view: IconView = self.builder.get_object(
            f'icon_view_tiles_in_chunk')
        icon_view.set_selection_mode(Gtk.SelectionMode.BROWSE)
        renderer = DrawerTiledCellRenderer(icon_view,
                                           self.animated_tile_durations,
                                           self.pal_ani_durations, False,
                                           self.edited_mappings,
                                           self.tile_surfaces, 3)

        store = Gtk.ListStore(int)
        icon_view.set_model(store)
        icon_view.pack_start(renderer, True)
        icon_view.add_attribute(renderer, 'tileidx', 0)
        icon_view.connect('selection-changed',
                          self.on_icon_view_tiles_in_chunk_selection_changed)

        renderer.start()
Exemplo n.º 3
0
    def _init_icon_view_chunk(self):
        """Fill the icon view containing all the chunks"""
        icon_view: IconView = self.builder.get_object(f'icon_view_chunk')
        icon_view.set_selection_mode(Gtk.SelectionMode.BROWSE)
        renderer = DrawerTiledCellRenderer(icon_view,
                                           self.animated_tile_durations,
                                           self.pal_ani_durations, True,
                                           self.edited_mappings,
                                           self.tile_surfaces, 1)

        store = Gtk.ListStore(int)
        icon_view.set_model(store)
        icon_view.pack_start(renderer, True)
        icon_view.add_attribute(renderer, 'tileidx', 0)
        icon_view.connect('selection-changed',
                          self.on_icon_view_chunk_selection_changed)

        for idx in range(0, len(self.edited_mappings), 9):
            store.append([idx])

        icon_view.select_path(store.get_path(store.get_iter_first()))
        renderer.start()
Exemplo n.º 4
0
    def _init_icon_view_static_tiles(self):
        """Fill the icon view containing all static tiles"""
        icon_view: IconView = self.builder.get_object(
            f'icon_view_static_tiles')
        icon_view.set_selection_mode(Gtk.SelectionMode.BROWSE)

        renderer = DrawerTiledCellRenderer(icon_view,
                                           self.animated_tile_durations,
                                           self.pal_ani_durations, False,
                                           self.dummy_tile_map,
                                           self.tile_surfaces, 3)

        store = Gtk.ListStore(int, str)
        icon_view.set_model(store)
        icon_view.pack_start(renderer, True)
        icon_view.add_attribute(renderer, 'tileidx', 0)
        icon_view.set_text_column(1)
        icon_view.connect('selection-changed',
                          self.on_icon_view_static_tiles_selection_changed)

        for idx in range(0, self.tile_graphics.count()):
            store.append([idx, str(idx)])

        renderer.start()