def __init__(self): super().__init__() self.chapter_data = None module_service = locator.get_scoped("ModuleService") config_module = module_service.get_common_module_template("Map Config") self.module = module_service.get_module("Chapters") self.text_data_widget = FE14ChapterTextDataWidget() self.header_scroll, self.header_property_form = PropertyForm.create_with_scroll( self.module.element_template) self.config_scroll, self.config_property_form = PropertyForm.create_with_scroll( config_module.element_template) self.header_property_form.editors["CID"].setEnabled(False) self.header_property_form.editors["Key (CID)"].setEnabled(False) self.vertical_layout = QVBoxLayout(parent=self) self.splitter = QSplitter(parent=self) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter2 = QSplitter(parent=self) self.splitter2.setOrientation(QtCore.Qt.Horizontal) self.splitter.addWidget(self.text_data_widget) self.splitter.addWidget(self.splitter2) self.splitter2.addWidget(self.header_scroll) self.splitter2.addWidget(self.config_scroll) self.vertical_layout.addWidget(self.splitter) self.scroll_content = QWidget() self.scroll_content.setLayout(self.vertical_layout) self.setWidget(self.scroll_content) self.setWidgetResizable(True)
def __init__(self): super().__init__() self.chapter_data = None self.dispos_model = None self.dispos = None self.terrain = None self.tiles_model = None self.terrain_mode = False self.initialized_selection_signal = False self.selected_faction = None left_panel_container = QWidget() left_panel_layout = QVBoxLayout() self.toggle_editor_type_checkbox = QCheckBox() self.toggle_editor_type_checkbox.setText("Spawns/Terrain") self.toggle_editor_type_checkbox.setChecked(True) self.toggle_editor_type_checkbox.stateChanged.connect( self._on_mode_change_requested) self.toggle_coordinate_type_checkbox = QCheckBox() self.toggle_coordinate_type_checkbox.setText( "Coordinate (1)/Coordinate (2)") self.toggle_coordinate_type_checkbox.setChecked(True) self.toggle_coordinate_type_checkbox.stateChanged.connect( self._on_coordinate_change_requested) self.tree_view = QTreeView() left_panel_layout.addWidget(self.toggle_editor_type_checkbox) left_panel_layout.addWidget(self.toggle_coordinate_type_checkbox) left_panel_layout.addWidget(self.tree_view) left_panel_container.setLayout(left_panel_layout) self.grid = FE14MapGrid() self.dispos_scroll, self.dispos_form = PropertyForm.create_with_scroll( dispo.SPAWN_TEMPLATE) self.terrain_form, self.terrain_persistent_editors, self.tile_form = _create_terrain_form( ) self.organizer = QSplitter() self.organizer.addWidget(left_panel_container) self.organizer.addWidget(self.grid) self.organizer.addWidget(self.dispos_scroll) main_layout = QVBoxLayout(self) main_layout.addWidget(self.organizer) self.setLayout(main_layout) self.add_faction_shortcut = QShortcut(QKeySequence("Ctrl+F"), self) self.add_item_shortcut = QShortcut(QKeySequence("Ctrl+N"), self) self.grid.focused_spawn_changed.connect(self._on_focused_spawn_changed) self.add_faction_shortcut.activated.connect( self._on_add_faction_requested) self.add_item_shortcut.activated.connect(self._on_add_item_requested) self.dispos_form.editors["PID"].editingFinished.connect( self._on_pid_field_changed) self.dispos_form.editors["Team"].currentIndexChanged.connect( self._on_team_field_changed) self.dispos_form.editors["Coordinate (1)"].textChanged.connect( self._on_coordinate_1_field_changed) self.dispos_form.editors["Coordinate (2)"].textChanged.connect( self._on_coordinate_2_field_changed)
def _create_terrain_form(): terrain = Terrain() persistent_form = QFormLayout() persistent_editors = [] _create_editor_for_property(terrain.map_model, persistent_form, persistent_editors) _create_editor_for_property(terrain.map_size_x, persistent_form, persistent_editors) _create_editor_for_property(terrain.map_size_y, persistent_form, persistent_editors) _create_editor_for_property(terrain.border_size_x, persistent_form, persistent_editors) _create_editor_for_property(terrain.border_size_y, persistent_form, persistent_editors) _create_editor_for_property(terrain.trimmed_size_x, persistent_form, persistent_editors) _create_editor_for_property(terrain.trimmed_size_y, persistent_form, persistent_editors) tile_scroll, tile_form = PropertyForm.create_with_scroll( fe14.terrain.TILE_TEMPLATE) tile_form.editors["ID"].setEnabled(False) persistent_form_container = QWidget() persistent_form_container.setLayout(persistent_form) container = QWidget() layout = QVBoxLayout() layout.addWidget(persistent_form_container) layout.addWidget(tile_scroll) container.setLayout(layout) return container, persistent_editors, tile_form
def __init__(self, parent=None): super().__init__(parent) terrain = Terrain() persistent_properties_template = terrain.adapter() self.persistent_scroll, self.persistent_form = PropertyForm.create_with_scroll(persistent_properties_template) self.tile_scroll, self.tile_form = PropertyForm.create_with_scroll(get_tile_template()) self.toggle_persistent_button = QPushButton(text="Toggle Map/Grid Properties") self.persistent_scroll.setFixedHeight(300) self.layout = QVBoxLayout() self.container = QWidget() self.layout.addWidget(self.toggle_persistent_button) self.layout.addWidget(self.persistent_scroll) self.layout.addWidget(self.tile_scroll) self.container.setLayout(self.layout) self.setWidgetResizable(True) self.setWidget(self.container) self.toggle_persistent_button.clicked.connect(self._on_toggle_persistent_button_pressed)