コード例 #1
0
ファイル: chunk_editor.py プロジェクト: tech-ticks/skytemple
 def on_icon_view_static_tiles_selection_changed(self, icon_view: IconView):
     model, treeiter = icon_view.get_model(), icon_view.get_selected_items()
     if model is not None and treeiter is not None and treeiter != []:
         selected_bpc_tile = model[treeiter][0]
         if not self.switching_tile:
             self.edited_mappings[
                 self.current_tile_id].idx = selected_bpc_tile
             self.builder.get_object(f'combo_box_palettes').set_active(
                 self.current_tile_picker_palette)
             # == self.edited_mappings[self.current_tile_id].pal_idx = self.current_tile_picker_palette
         self.builder.get_object(f'tile_number_label').set_text(
             str(selected_bpc_tile))
コード例 #2
0
ファイル: chunk_editor.py プロジェクト: tech-ticks/skytemple
    def on_icon_view_chunk_selection_changed(self, icon_view: IconView):
        """Fill the icon view containing the 3x3 tiles for the current chunk"""
        model, treeiter = icon_view.get_model(), icon_view.get_selected_items()
        if model is not None and treeiter is not None and treeiter != []:
            first_tile_id = model[treeiter][0]
            icon_view_tiles_in_chunk: IconView = self.builder.get_object(
                f'icon_view_tiles_in_chunk')
            store: Gtk.ListStore = icon_view_tiles_in_chunk.get_model()
            store.clear()
            for idx in range(first_tile_id, first_tile_id + 9):
                store.append([idx])

            icon_view_tiles_in_chunk.select_path(
                store.get_path(store.get_iter_first()))
コード例 #3
0
ファイル: chunk_editor.py プロジェクト: SkyTemple/skytemple
    def on_icon_view_tiles_in_chunk_selection_changed(self,
                                                      icon_view: IconView):
        """Change the current edited tile view"""
        model, treeiter = icon_view.get_model(), icon_view.get_selected_items()
        if model is not None and treeiter is not None and treeiter != []:
            self.current_tile_id = model[treeiter][0]

            mapping = self.edited_mappings[self.current_tile_id]
            self.current_tile_drawer.set_tile_mappings([mapping
                                                        ])  # type: ignore

            self.builder.get_object('flip_x').set_active(mapping.flip_x)
            self.builder.get_object('flip_y').set_active(mapping.flip_y)
            cb: Gtk.ComboBox = self.builder.get_object('combo_box_palettes')
            cb.set_active(mapping.pal_idx)

            # Also update the selected tile
            self.switching_tile = True
            icon_view_static_tiles: IconView = self.builder.get_object(
                f'icon_view_static_tiles')
            if mapping.idx < self.tile_graphics.count():
                store: Gtk.ListStore = icon_view_static_tiles.get_model()
                for e in store:
                    if e[0] == mapping.idx:
                        icon_view_static_tiles.select_path(e.path)
                        icon_view_static_tiles.scroll_to_path(
                            e.path, True, 0.5, 0.5)
                        for bpa_view in bpa_views:
                            obj = self.builder.get_object(bpa_view)
                            if obj:
                                obj.unselect_all()
                        break
            else:
                # BPA case
                icon_view_static_tiles.unselect_all()
                for i, bpa_view in enumerate(bpa_views):
                    obj = self.builder.get_object(bpa_view)
                    if self.animated_tile_graphics[i]:  # type: ignore
                        if obj and mapping.idx >= self.bpa_starts[
                                i]:  # type: ignore
                            store = obj.get_model()
                            for e in store:
                                if e[0] == mapping.idx:
                                    obj.select_path(e.path)
                                    obj.scroll_to_path(e.path, True, 0.5, 0.5)
                            break
            self.switching_tile = False
コード例 #4
0
 def on_current_icon_view_selection_changed(self, icon_view: Gtk.IconView):
     model, treeiter = icon_view.get_model(), icon_view.get_selected_items()
     if model is not None and treeiter is not None and treeiter != []:
         chunk_id = model[treeiter][0]
         if self.drawer:
             self.drawer.set_selected_chunk(chunk_id)
コード例 #5
0
ファイル: image_utils.py プロジェクト: wummel/gourmet
 def on_selection(self, iconview: Gtk.IconView):
     item = iconview.get_selected_items()
     if item:
         itr = self.liststore.get_iter(item[0])
         self.image = pixbuf_to_image(self.liststore.get_value(itr, 0))