Beispiel #1
0
    def addTable(self, ui):
        ow_ptrs = self.ptrsAddressLineEdit.text()
        data_ptrs = self.dataAddressLineEdit.text()
        frames_ptrs = self.framesPointersAddressLineEdit.text()
        frames_addr = self.framesAddressLineEdit.text()

        if ow_ptrs == "":
            ow_ptrs = 0
        else:
            ow_ptrs = int(ow_ptrs, 16)

        if data_ptrs == "":
            data_ptrs = 0
        else:
            data_ptrs = int(data_ptrs, 16)

        if frames_ptrs == "":
            frames_ptrs = 0
        else:
            frames_ptrs = int(frames_ptrs, 16)

        if frames_addr == "":
            frames_addr = 0
        else:
            frames_addr = int(frames_addr, 16)

        ui.tree_model.insertTable(ow_ptrs, data_ptrs, frames_ptrs, frames_addr,
                                  ui)

        from ui.ui_updater import update_gui
        update_gui(ui)
Beispiel #2
0
    def paletteCleanup(self, ui):

        ui.sprite_manager.palette_cleanup()
        ui.initPaletteIdComboBox()

        if ui.selected_ow is not None and ui.selected_table is not None:
            tableNode = self.index(ui.selected_table, 0, QtCore.QModelIndex())
            owNode = self.index(ui.selected_ow, 0, tableNode)
            self.setData(owNode, None)
            ui.item_selected(self.index(ui.selected_ow, 0, tableNode))

        from ui.ui_updater import update_gui
        update_gui(ui)
Beispiel #3
0
    def open_rom(self, fn=None):
        """
        If no filename is given, it'll prompt the user with a nice dialog
        """
        if fn is None:
            dlg = QtWidgets.QFileDialog()
            fn, _ = dlg.getOpenFileName(dlg, 'Open ROM file',
                                        self.paths['OPEN_ROM_PATH'],
                                        "GBA ROM (*.gba)")
        if not fn:
            return
        self.paths['OPEN_ROM_PATH'] = os.path.dirname(os.path.realpath(fn))

        log.info("Opened a new ROM: " + fn)
        sts.show("Opening ROM: " + fn)
        rom.rom.load_rom(fn)

        self.rom_info = RomInfo()
        rom.rom.rom_path = fn

        if self.rom_info.rom_successfully_loaded == 1:
            self.root.__init__()

            self.sprite_manager = img.ImageManager(self.root)
            self.statusbar.showMessage("Ready")

            self.selected_table = None
            self.selected_ow = None
            self.romNameLabel.setText(rom.rom.rom_path.split('/')[-1])

            update_gui(self)
            self.initColorTextComboBox()
            self.initFootprintComboBox()
            self.initPaletteIdComboBox()
            self.initProfileComboBox()
            self.initPaletteSlotComboBox()
        else:
            self.statusbar.showMessage(
                "Couldn't find a Profile in the INI for \
                your ROM. Open it with 'Open and Analyze\
                ROM'.")
Beispiel #4
0
    def item_selected(self, index):
        node = index.internalPointer()

        if node is None:
            return

        if node.typeInfo() == "ow_node":
            self.selected_table = node.parent().getId()
            self.selected_ow = node.getId()
            self.paint_graphics_view(node.image)

            # Update the SpinBox
            self.framesSpinBox.setRange(0, node.frames - 1)
            self.framesSpinBox.setValue(0)
        else:
            self.selected_table = node.getId()
            self.selected_ow = None

            self.paint_graphics_view(None)

        update_gui(self)
Beispiel #5
0
    def load_from_profile(self, profile):

        if profile != "":
            self.rom_info.load_profile_data(profile)

            # self.rom_info = RomInfo()
            self.statusbar.showMessage("Reloading ROM...")
            self.root.__init__()

            self.statusbar.showMessage("Done")
            self.sprite_manager = img.ImageManager(self.root)

            self.selected_table = None
            self.selected_ow = None

            from ui.ui_updater import update_gui, update_tree_model
            update_tree_model(self)
            update_gui(self)
            self.initColorTextComboBox()
            self.initFootprintComboBox()
            self.initPaletteIdComboBox()
            self.initPaletteSlotComboBox()
Beispiel #6
0
    def removeTable(self, table_id, ui):
        quit_msg = "Are you sure you want to delete the entire table?"
        reply = QtWidgets.QMessageBox.question(ui,
                                               'Message',
                                               quit_msg,
                                               QtWidgets.QMessageBox.Yes,
                                               QtWidgets.QMessageBox.No)

        if reply == QtWidgets.QMessageBox.No:
            return

        ui.statusbar.showMessage("Removing Table...")
        self.removeRows(table_id, 1, QtCore.QModelIndex())
        ui.statusbar.showMessage("Ready")
        n = self.root.tables_num()

        if n == 0:
            ui.selected_table = None
        else:
            ui.selected_table = table_id - 1
        ui.selected_ow = None

        from ui.ui_updater import update_gui
        update_gui(ui)