コード例 #1
0
 def __init__(self):
     super().__init__()
     self.chunk_directory = Directory(
         "CHUNK", QIcon(Assets.get_asset_path("document_a4_locked.png")),
         None)
     self.mod_directory = Directory(
         "MOD", QIcon(Assets.get_asset_path("document_a4.png")), None)
     self.workspace = Workspace([self.mod_directory, self.chunk_directory],
                                parent=self)
     self.workspace.fileOpened.connect(self.handle_workspace_file_opened)
     self.workspace.fileClosed.connect(self.handle_workspace_file_closed)
     self.workspace.fileActivated.connect(
         self.handle_workspace_file_activated)
     self.workspace.fileLoadError.connect(
         self.handle_workspace_file_load_error)
     self.init_actions()
     self.init_menu_bar()
     self.init_toolbar()
     self.setStatusBar(QStatusBar())
     self.setWindowTitle("MHW-Editor-Suite")
     self.init_file_tree(self.chunk_directory,
                         "Chunk directory",
                         self.open_chunk_directory_action,
                         filtered=True)
     self.init_file_tree(self.mod_directory, "Mod directory",
                         self.open_mod_directory_action)
     self.init_help()
     self.setCentralWidget(self.init_editor_tabs())
     self.load_settings()
コード例 #2
0
from enum import IntEnum

from PyQt5 import uic
from PyQt5.QtCore import (Qt, QModelIndex)
from PyQt5.QtWidgets import (QDataWidgetMapper, QHeaderView)

from mhw_armor_edit.assets import Assets
from mhw_armor_edit.editor.models import (SkillTranslationModel, EditorPlugin)
from mhw_armor_edit.ftypes.am_dat import AmDatEntry, AmDat
from mhw_armor_edit.import_export import (ImportExportManager)
from mhw_armor_edit.tree import TreeModel, TreeNode
from mhw_armor_edit.utils import ItemDelegate, get_t9n

log = logging.getLogger()
ArmorEditorWidget, ArmorEditorWidgetBase = uic.loadUiType(
    Assets.load_asset_file("armor_editor.ui"))

Column = IntEnum("Column", [
    ("name", 0),
] + [(field_name, getattr(AmDatEntry, field_name).index + 1)
     for field_name in AmDatEntry.fields()])


class ArmorEditor(ArmorEditorWidgetBase, ArmorEditorWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setupUi(self)
        self.model = None
        self.parts_tree_model = ArmorSetTreeModel()
        self.skill_model = SkillTranslationModel()
        self.armor_item_mapper = QDataWidgetMapper(self)
コード例 #3
0
from PyQt5.QtCore import QModelIndex, Qt
from PyQt5.QtWidgets import (QDataWidgetMapper, QHeaderView)

from mhw_armor_edit.assets import Assets
from mhw_armor_edit.editor.models import (EditorPlugin, ATTRS, WeaponType,
                                          SkillTranslationModel)
from mhw_armor_edit.editor.shell_table_editor import ShellTableTreeModel
from mhw_armor_edit.ftypes.bbtbl import BbtblEntry
from mhw_armor_edit.ftypes.wp_dat_g import WpDatGEntry, WpDatG
from mhw_armor_edit.import_export import ImportExportManager
from mhw_armor_edit.struct_table import StructTableModel
from mhw_armor_edit.utils import get_t9n, ItemDelegate

log = logging.getLogger()
WeaponGunEditorWidget, WeaponGunEditorWidgetBase = uic.loadUiType(
    Assets.load_asset_file("weapon_gun_editor.ui"))


class WpDatGTableModel(StructTableModel):
    def __init__(self, parent=None):
        super().__init__(WpDatGEntry.fields(), parent)
        self.model = None

    def get_field_value(self, entry, field):
        value = getattr(entry, field)
        if field in ("gmd_name_index", "gmd_description_index"):
            return get_t9n(self.model, "t9n", value)
        return value

    def data(self, qindex, role=None):
        if role == Qt.DisplayRole or role == Qt.EditRole:
コード例 #4
0
# coding: utf-8
import logging
from enum import IntEnum, auto

from PyQt5 import uic
from PyQt5.QtCore import (QAbstractTableModel, QModelIndex, Qt)
from PyQt5.QtWidgets import (QHeaderView, QDataWidgetMapper)

from mhw_armor_edit.assets import Assets
from mhw_armor_edit.editor.models import EditorPlugin
from mhw_armor_edit.ftypes.itm import Itm
from mhw_armor_edit.utils import get_t9n_item, get_t9n

log = logging.getLogger()
ItmEditorWidget, ItmEditorWidgetBase = uic.loadUiType(
    Assets.load_asset_file("item_editor.ui"))


class FlagAttr:
    def __init__(self, flag):
        self.flag = flag

    def __get__(self, that, owner):
        if that is None:
            return self
        return that.entry.flags & self.flag != 0

    def __set__(self, that, toggle):
        if toggle:
            that.entry.flags = that.entry.flags | self.flag
        else:
コード例 #5
0
        dialog.setWindowTitle("About MHW Editor Suite")
        layout = QVBoxLayout()
        dialog.setLayout(layout)
        about_text = QLabel(ABOUT_TEXT)
        about_text.setTextFormat(Qt.RichText)
        about_text.setTextInteractionFlags(Qt.TextBrowserInteraction)
        about_text.setOpenExternalLinks(True)
        layout.addWidget(about_text)
        dialog.exec()


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG,
                        format="%(levelname)s %(message)s")
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon(Assets.get_asset_path("icon32.svg")))
    app.setStyleSheet("""
    QMainWindow::separator:vertical,
    QSplitter::handle:horizontal {
        width: 0px;
        margin: 0 6px;
        max-height: 100px;
        border-left: 1px dotted palette(dark);
        border-right: 1px dotted palette(base);
    }
    QMainWindow::separator:horizontal,
    QSplitter::handle:vertical {
        height: 0px;
        margin: 6px 0;
        border-top: 1px dotted palette(dark);
        border-bottom: 1px dotted palette(base);
コード例 #6
0
from enum import IntEnum, auto

from PyQt5 import uic
from PyQt5.QtCore import (QAbstractTableModel, QModelIndex, Qt)
from PyQt5.QtWidgets import (QHeaderView,
                             QDataWidgetMapper)

from mhw_armor_edit.assets import Assets
from mhw_armor_edit.editor.models import EditorPlugin
from mhw_armor_edit.ftypes.itm import Itm
from mhw_armor_edit.import_export import ImportExportManager
from mhw_armor_edit.utils import get_t9n_item, get_t9n


log = logging.getLogger()
ItmEditorWidget, ItmEditorWidgetBase = uic.loadUiType(Assets.load_asset_file("item_editor.ui"))


class FlagAttr:
    def __init__(self, flag):
        self.flag = flag

    def __get__(self, that, owner):
        if that is None:
            return self
        return that.entry.flags & self.flag != 0

    def __set__(self, that, toggle):
        if toggle:
            that.entry.flags = that.entry.flags | self.flag
        else:
コード例 #7
0
import logging
import sys

from PyQt5 import uic
from PyQt5.QtCore import Qt, pyqtSignal, QModelIndex, QObject
from PyQt5.QtWidgets import (QFileDialog, QApplication, QMainWindow,
                             QPushButton, QWidget, QVBoxLayout,
                             QListWidgetItem, QDialog, QMenu)

from mhw_armor_edit.assets import Assets
from mhw_armor_edit.ftypes.am_dat import AmDatEntry
from mhw_armor_edit.utils import create_action

log = logging.getLogger()
DialogWidget, DialogWidgetBase = \
    uic.loadUiType(Assets.load_asset_file("import_export.ui"))


class DialogHelper:
    def get_attrs(self):
        return self.attrs

    def dialog_helper_init(self):
        self.check_all_button.clicked.connect(self.handle_check_all_clicked)
        self.check_none_button.clicked.connect(self.handle_check_none_clicked)
        for attr in self.get_attrs():
            it = QListWidgetItem()
            it.setText(attr)
            it.setData(Qt.UserRole, attr)
            it.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
            it.setCheckState(Qt.Checked if attr in
コード例 #8
0
 def handle_reload_ui(self):
     widget = uic.loadUi(Assets.load_asset_file("weapon_editor.ui"))
     widget.kire_widget.set_model(self.kire_gauge_model)
     self.setCentralWidget(widget)