From 692ddf00b6872423e49c69fbd47518e9f37e7807 Mon Sep 17 00:00:00 2001 From: dazedanon Date: Sat, 25 Oct 2025 17:02:06 -0500 Subject: [PATCH] moar --- gui/config_tab.py | 202 +++++++++++++++++++++++++--------------- gui/main.py | 34 +++---- gui/rpgmaker_tab.py | 146 ++++++++++++++++++----------- gui/wolf_tab.py | 30 +++--- modules/rpgmakermvmz.py | 2 +- 5 files changed, 246 insertions(+), 168 deletions(-) diff --git a/gui/config_tab.py b/gui/config_tab.py index 003b697..b6659c7 100644 --- a/gui/config_tab.py +++ b/gui/config_tab.py @@ -55,9 +55,11 @@ class ConfigTab(QWidget): """Initialize the user interface with tabs for different config categories.""" main_layout = QVBoxLayout() main_layout.setContentsMargins(0, 0, 0, 0) + main_layout.setSpacing(0) # Create tab widget for different configuration categories self.config_tabs = QTabWidget() + self.config_tabs.setDocumentMode(True) # Remove frame for more space # Tab 1: General Settings (Everything in one place!) general_tab = self.create_general_settings_tab() @@ -76,74 +78,61 @@ class ConfigTab(QWidget): self.config_tabs.addTab(self.wolf_tab, "Wolf RPG") main_layout.addWidget(self.config_tabs) - - # Bottom buttons row - button_layout = QHBoxLayout() - button_layout.setSpacing(10) - - self.save_button = QPushButton("💾 Save Configuration") - self.save_button.clicked.connect(self.save_to_env) - self.save_button.setMinimumHeight(35) - - self.load_button = QPushButton("📂 Load from File") - self.load_button.clicked.connect(self.load_from_file_dialog) - self.load_button.setMinimumHeight(35) - - self.reset_button = QPushButton("🔄 Reset to Defaults") - self.reset_button.clicked.connect(self.reset_to_defaults) - self.reset_button.setMinimumHeight(35) - - button_layout.addWidget(self.save_button) - button_layout.addWidget(self.load_button) - button_layout.addWidget(self.reset_button) - button_layout.addStretch() - - main_layout.addLayout(button_layout) self.setLayout(main_layout) def create_general_settings_tab(self): """Create combined general settings tab with API, Translation, Performance, and UI settings.""" widget = QWidget() - scroll = QScrollArea() - scroll.setWidgetResizable(True) - scroll.setFrameShape(QFrame.NoFrame) content = QWidget() layout = QVBoxLayout() - layout.setSpacing(5) - layout.setContentsMargins(10, 10, 10, 10) + layout.setSpacing(8) + layout.setContentsMargins(15, 15, 15, 15) # Create a two-column layout for better space utilization columns_layout = QHBoxLayout() - columns_layout.setSpacing(20) + columns_layout.setSpacing(30) # LEFT COLUMN left_column = QVBoxLayout() - left_column.setSpacing(5) + left_column.setSpacing(8) # API Configuration Section left_column.addWidget(create_section_header("🔑 API Configuration")) api_form = QFormLayout() - api_form.setSpacing(5) - api_form.setContentsMargins(0, 0, 0, 10) - api_form.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) + api_form.setSpacing(6) + api_form.setContentsMargins(0, 0, 0, 12) + api_form.setFieldGrowthPolicy(QFormLayout.FieldsStayAtSizeHint) + api_form.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter) + api_url_label = QLabel("API URL:") + api_url_label.setFixedWidth(150) + api_url_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.api_url_edit = QLineEdit() self.api_url_edit.setPlaceholderText("Leave blank for OpenAI API") self.api_url_edit.setFixedWidth(350) # Large - api_form.addRow("API URL:", self.api_url_edit) + api_form.addRow(api_url_label, self.api_url_edit) + api_key_label = QLabel("API Key:") + api_key_label.setFixedWidth(150) + api_key_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.api_key_edit = QLineEdit() self.api_key_edit.setEchoMode(QLineEdit.Password) self.api_key_edit.setPlaceholderText("Enter your API key") self.api_key_edit.setFixedWidth(350) # Large - api_form.addRow("API Key:", self.api_key_edit) + api_form.addRow(api_key_label, self.api_key_edit) + org_label = QLabel("Organization:") + org_label.setFixedWidth(150) + org_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.organization_edit = QLineEdit() self.organization_edit.setPlaceholderText("Optional organization key") self.organization_edit.setFixedWidth(350) # Large - api_form.addRow("Organization:", self.organization_edit) + api_form.addRow(org_label, self.organization_edit) + model_label = QLabel("Model:") + model_label.setFixedWidth(150) + model_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.model_combo = QComboBox() self.model_combo.setEditable(True) self.model_combo.addItems([ @@ -152,7 +141,7 @@ class ConfigTab(QWidget): "gemini-2.0-flash", "gemini-2.5-flash", "gemini-2.5-pro" ]) self.model_combo.setFixedWidth(200) # Medium - api_form.addRow("Model:", self.model_combo) + api_form.addRow(model_label, self.model_combo) left_column.addLayout(api_form) left_column.addWidget(create_horizontal_line()) @@ -160,25 +149,32 @@ class ConfigTab(QWidget): # Translation Settings Section left_column.addWidget(create_section_header("🌐 Translation Settings")) trans_form = QFormLayout() - trans_form.setSpacing(5) - trans_form.setContentsMargins(0, 0, 0, 10) - trans_form.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) + trans_form.setSpacing(6) + trans_form.setContentsMargins(0, 0, 0, 12) + trans_form.setFieldGrowthPolicy(QFormLayout.FieldsStayAtSizeHint) + trans_form.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter) + lang_label = QLabel("Target Language:") + lang_label.setFixedWidth(150) + lang_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.language_combo = QComboBox() self.language_combo.addItems([ "English", "Spanish", "French", "German", "Italian", "Portuguese", "Russian", "Chinese", "Korean", "Japanese" ]) self.language_combo.setFixedWidth(200) # Medium - trans_form.addRow("Target Language:", self.language_combo) + trans_form.addRow(lang_label, self.language_combo) + timeout_label = QLabel("Timeout:") + timeout_label.setFixedWidth(150) + timeout_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.timeout_spin = QSpinBox() self.timeout_spin.setButtonSymbols(QSpinBox.NoButtons) self.timeout_spin.setRange(30, 300) self.timeout_spin.setValue(90) self.timeout_spin.setSuffix(" sec") - self.timeout_spin.setFixedWidth(90) # Small - trans_form.addRow("Timeout:", self.timeout_spin) + self.timeout_spin.setFixedWidth(120) # Small + trans_form.addRow(timeout_label, self.timeout_spin) left_column.addLayout(trans_form) left_column.addWidget(create_horizontal_line()) @@ -186,76 +182,99 @@ class ConfigTab(QWidget): # Performance Settings Section left_column.addWidget(create_section_header("⚡ Performance Settings")) perf_form = QFormLayout() - perf_form.setSpacing(5) - perf_form.setContentsMargins(0, 0, 0, 10) - perf_form.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) + perf_form.setSpacing(6) + perf_form.setContentsMargins(0, 0, 0, 12) + perf_form.setFieldGrowthPolicy(QFormLayout.FieldsStayAtSizeHint) + perf_form.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter) + file_threads_label = QLabel("File Threads:") + file_threads_label.setFixedWidth(150) + file_threads_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.file_threads_spin = QSpinBox() self.file_threads_spin.setButtonSymbols(QSpinBox.NoButtons) self.file_threads_spin.setRange(1, 10) self.file_threads_spin.setValue(1) - self.file_threads_spin.setFixedWidth(90) # Small - perf_form.addRow("File Threads:", self.file_threads_spin) + self.file_threads_spin.setFixedWidth(120) # Small + perf_form.addRow(file_threads_label, self.file_threads_spin) + threads_label = QLabel("Threads per File:") + threads_label.setFixedWidth(150) + threads_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.threads_spin = QSpinBox() self.threads_spin.setButtonSymbols(QSpinBox.NoButtons) self.threads_spin.setRange(1, 20) self.threads_spin.setValue(1) - self.threads_spin.setFixedWidth(90) # Small - perf_form.addRow("Threads per File:", self.threads_spin) + self.threads_spin.setFixedWidth(120) # Small + perf_form.addRow(threads_label, self.threads_spin) + batch_label = QLabel("Batch Size:") + batch_label.setFixedWidth(150) + batch_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.batch_size_spin = QSpinBox() self.batch_size_spin.setButtonSymbols(QSpinBox.NoButtons) self.batch_size_spin.setRange(1, 100) self.batch_size_spin.setValue(30) - self.batch_size_spin.setFixedWidth(90) # Small - perf_form.addRow("Batch Size:", self.batch_size_spin) + self.batch_size_spin.setFixedWidth(120) # Small + perf_form.addRow(batch_label, self.batch_size_spin) + freq_label = QLabel("Frequency Penalty:") + freq_label.setFixedWidth(150) + freq_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.frequency_penalty_spin = QDoubleSpinBox() self.frequency_penalty_spin.setButtonSymbols(QDoubleSpinBox.NoButtons) self.frequency_penalty_spin.setRange(0.0, 2.0) self.frequency_penalty_spin.setSingleStep(0.05) self.frequency_penalty_spin.setValue(0.05) - self.frequency_penalty_spin.setFixedWidth(90) # Small - perf_form.addRow("Frequency Penalty:", self.frequency_penalty_spin) + self.frequency_penalty_spin.setFixedWidth(120) # Small + perf_form.addRow(freq_label, self.frequency_penalty_spin) left_column.addLayout(perf_form) left_column.addStretch() # RIGHT COLUMN right_column = QVBoxLayout() - right_column.setSpacing(5) + right_column.setSpacing(8) # Text Formatting Section right_column.addWidget(create_section_header("📝 Text Formatting")) format_form = QFormLayout() - format_form.setSpacing(5) - format_form.setContentsMargins(0, 0, 0, 10) - format_form.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) + format_form.setSpacing(6) + format_form.setContentsMargins(0, 0, 0, 12) + format_form.setFieldGrowthPolicy(QFormLayout.FieldsStayAtSizeHint) + format_form.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter) + dialogue_label = QLabel("Dialogue Width:") + dialogue_label.setFixedWidth(150) + dialogue_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.width_spin = QSpinBox() self.width_spin.setButtonSymbols(QSpinBox.NoButtons) self.width_spin.setRange(20, 200) self.width_spin.setValue(60) self.width_spin.setSuffix(" chars") - self.width_spin.setFixedWidth(90) # Small - format_form.addRow("Dialogue Width:", self.width_spin) + self.width_spin.setFixedWidth(120) # Small + format_form.addRow(dialogue_label, self.width_spin) + list_label = QLabel("List Width:") + list_label.setFixedWidth(150) + list_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.list_width_spin = QSpinBox() self.list_width_spin.setButtonSymbols(QSpinBox.NoButtons) self.list_width_spin.setRange(20, 200) self.list_width_spin.setValue(100) self.list_width_spin.setSuffix(" chars") - self.list_width_spin.setFixedWidth(90) # Small - format_form.addRow("List Width:", self.list_width_spin) + self.list_width_spin.setFixedWidth(120) # Small + format_form.addRow(list_label, self.list_width_spin) + note_label = QLabel("Note Width:") + note_label.setFixedWidth(150) + note_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.note_width_spin = QSpinBox() self.note_width_spin.setButtonSymbols(QSpinBox.NoButtons) self.note_width_spin.setRange(20, 200) self.note_width_spin.setValue(75) self.note_width_spin.setSuffix(" chars") - self.note_width_spin.setFixedWidth(90) # Small - format_form.addRow("Note Width:", self.note_width_spin) + self.note_width_spin.setFixedWidth(120) # Small + format_form.addRow(note_label, self.note_width_spin) right_column.addLayout(format_form) right_column.addWidget(create_horizontal_line()) @@ -263,16 +282,20 @@ class ConfigTab(QWidget): # Custom API Pricing Section right_column.addWidget(create_section_header("💰 Custom API Pricing")) - pricing_note = QLabel("Only used if your model isn't in the built-in pricing list") - pricing_note.setStyleSheet("color: #888888; font-style: italic; font-size: 10px;") + pricing_note = QLabel("Only used if model isn't in built-in pricing list") + pricing_note.setStyleSheet("color: #888888; font-style: italic; font-size: 9px;") pricing_note.setWordWrap(True) right_column.addWidget(pricing_note) price_form = QFormLayout() - price_form.setSpacing(5) - price_form.setContentsMargins(0, 5, 0, 10) - price_form.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) + price_form.setSpacing(6) + price_form.setContentsMargins(0, 3, 0, 12) + price_form.setFieldGrowthPolicy(QFormLayout.FieldsStayAtSizeHint) + price_form.setLabelAlignment(Qt.AlignRight | Qt.AlignVCenter) + input_label = QLabel("Input Cost:") + input_label.setFixedWidth(150) + input_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.input_cost_spin = QDoubleSpinBox() self.input_cost_spin.setButtonSymbols(QDoubleSpinBox.NoButtons) self.input_cost_spin.setRange(0.0, 100.0) @@ -281,8 +304,11 @@ class ConfigTab(QWidget): self.input_cost_spin.setValue(2.0) self.input_cost_spin.setSuffix(" per 1M tokens") self.input_cost_spin.setFixedWidth(200) # Medium - price_form.addRow("Input Cost:", self.input_cost_spin) + price_form.addRow(input_label, self.input_cost_spin) + output_label = QLabel("Output Cost:") + output_label.setFixedWidth(150) + output_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.output_cost_spin = QDoubleSpinBox() self.output_cost_spin.setButtonSymbols(QDoubleSpinBox.NoButtons) self.output_cost_spin.setRange(0.0, 100.0) @@ -291,7 +317,7 @@ class ConfigTab(QWidget): self.output_cost_spin.setValue(8.0) self.output_cost_spin.setSuffix(" per 1M tokens") self.output_cost_spin.setFixedWidth(200) # Medium - price_form.addRow("Output Cost:", self.output_cost_spin) + price_form.addRow(output_label, self.output_cost_spin) right_column.addLayout(price_form) right_column.addStretch() @@ -302,13 +328,35 @@ class ConfigTab(QWidget): layout.addLayout(columns_layout) - content.setLayout(layout) - scroll.setWidget(content) + # Add buttons at the bottom of General Settings tab + layout.addSpacing(15) + button_layout = QHBoxLayout() + button_layout.setSpacing(10) - wrapper = QVBoxLayout() - wrapper.setContentsMargins(0, 0, 0, 0) - wrapper.addWidget(scroll) - widget.setLayout(wrapper) + save_button = QPushButton("💾 Save Configuration") + save_button.clicked.connect(self.save_to_env) + save_button.setMinimumHeight(32) + save_button.setStyleSheet("font-weight: bold;") + + load_button = QPushButton("📂 Load from File") + load_button.clicked.connect(self.load_from_file_dialog) + load_button.setMinimumHeight(32) + + reset_button = QPushButton("🔄 Reset to Defaults") + reset_button.clicked.connect(self.reset_to_defaults) + reset_button.setMinimumHeight(32) + + button_layout.addWidget(save_button) + button_layout.addWidget(load_button) + button_layout.addWidget(reset_button) + button_layout.addStretch() + + layout.addLayout(button_layout) + + content.setLayout(layout) + widget.setLayout(QVBoxLayout()) + widget.layout().setContentsMargins(0, 0, 0, 0) + widget.layout().addWidget(content) return widget def load_from_env(self): diff --git a/gui/main.py b/gui/main.py index 3a18b50..1d47596 100644 --- a/gui/main.py +++ b/gui/main.py @@ -138,6 +138,8 @@ class DazedMTLGUI(QMainWindow): # Set main layout layout = QVBoxLayout() + layout.setContentsMargins(0, 0, 0, 0) + layout.setSpacing(0) layout.addWidget(self.tab_widget) central_widget.setLayout(layout) @@ -177,8 +179,6 @@ class DazedMTLGUI(QMainWindow): # Save to .env file self.config_tab.save_to_env() - self.status_label.setText(f"Font scale set to {scale_factor:.1f}x") - except Exception as e: QMessageBox.warning(self, "Warning", f"Failed to set font scale: {str(e)}") @@ -240,17 +240,9 @@ class DazedMTLGUI(QMainWindow): about_action.triggered.connect(self.show_about) def setup_status_bar(self): - """Set up the status bar.""" - self.status_bar = QStatusBar() - self.setStatusBar(self.status_bar) - - # Add status labels - self.status_label = QLabel("Ready") - self.progress_bar = QProgressBar() - self.progress_bar.setVisible(False) - - self.status_bar.addWidget(self.status_label) - self.status_bar.addPermanentWidget(self.progress_bar) + """Set up the status bar (removed to save space).""" + # Status bar removed to maximize space for content + pass def load_project(self): """Load a project configuration.""" @@ -265,7 +257,6 @@ class DazedMTLGUI(QMainWindow): try: # Load configuration from file self.config_tab.load_from_file(file_path) - self.status_label.setText(f"Loaded project: {Path(file_path).name}") except Exception as e: QMessageBox.critical(self, "Error", f"Failed to load project:\n{str(e)}") @@ -287,7 +278,6 @@ class DazedMTLGUI(QMainWindow): with open(file_path, 'w', encoding='utf-8') as f: json.dump(config_data, f, indent=2, ensure_ascii=False) - self.status_label.setText(f"Saved project: {Path(file_path).name}") except Exception as e: QMessageBox.critical(self, "Error", f"Failed to save project:\n{str(e)}") @@ -303,7 +293,6 @@ class DazedMTLGUI(QMainWindow): if reply == QMessageBox.Yes: self.config_tab.reset_to_defaults() - self.status_label.setText("Reset to defaults") def validate_configuration(self): """Validate the current configuration.""" @@ -313,7 +302,6 @@ class DazedMTLGUI(QMainWindow): if config_valid: QMessageBox.information(self, "Validation", "Configuration is valid!") - self.status_label.setText("Configuration validated") else: QMessageBox.warning(self, "Validation", "Configuration has issues. Check the warnings.") @@ -340,16 +328,16 @@ class DazedMTLGUI(QMainWindow): ) def update_status(self, message): - """Update the status bar message.""" - self.status_label.setText(message) + """Update the status bar message (removed to save space).""" + pass def show_progress(self, show=True): - """Show or hide the progress bar.""" - self.progress_bar.setVisible(show) + """Show or hide the progress bar (removed to save space).""" + pass def set_progress(self, value): - """Set the progress bar value (0-100).""" - self.progress_bar.setValue(value) + """Set the progress bar value (removed to save space).""" + pass def main(): diff --git a/gui/rpgmaker_tab.py b/gui/rpgmaker_tab.py index e580054..5ec12dc 100644 --- a/gui/rpgmaker_tab.py +++ b/gui/rpgmaker_tab.py @@ -171,29 +171,29 @@ class RPGMakerTab(QWidget): def init_ui(self): """Initialize the user interface with compact two-column layout.""" main_layout = QVBoxLayout() - main_layout.setContentsMargins(10, 10, 10, 10) + main_layout.setContentsMargins(15, 15, 15, 15) main_layout.setSpacing(10) # Title and description title = "RPG Maker MV/MZ" if self.engine != "ACE" else "RPG Maker Ace" title_label = QLabel(f"{title} Translation Settings") - title_label.setStyleSheet("font-size: 14px; font-weight: bold; color: #007acc;") + title_label.setStyleSheet("font-size: 15px; font-weight: bold; color: #007acc;") main_layout.addWidget(title_label) description_label = QLabel( "Enable event codes to translate. Only enable what you need to reduce translation time and costs." ) description_label.setWordWrap(True) - description_label.setStyleSheet("color: #888888; font-size: 11px; margin-bottom: 5px;") + description_label.setStyleSheet("color: #888888; font-size: 10px; margin-bottom: 5px;") main_layout.addWidget(description_label) # Two-column layout for checkboxes columns_layout = QHBoxLayout() - columns_layout.setSpacing(30) + columns_layout.setSpacing(40) # LEFT COLUMN left_column = QVBoxLayout() - left_column.setSpacing(3) + left_column.setSpacing(5) # General Configuration left_column.addWidget(create_section_label("⚙️ General Options")) @@ -221,7 +221,7 @@ class RPGMakerTab(QWidget): self.ignoretltext_cb.setToolTip("Ignore already translated text") left_column.addWidget(self.ignoretltext_cb) - left_column.addSpacing(8) + left_column.addSpacing(15) # Main Dialogue Codes left_column.addWidget(create_section_label("💬 Main Dialogue (Recommended)")) @@ -234,7 +234,7 @@ class RPGMakerTab(QWidget): self.code102_cb = QCheckBox("CODE102 - Show Choices") left_column.addWidget(self.code102_cb) - left_column.addSpacing(8) + left_column.addSpacing(15) # Optional Dialogue Codes left_column.addWidget(create_section_label("📝 Optional Dialogue")) @@ -243,6 +243,7 @@ class RPGMakerTab(QWidget): self.code408_cb = QCheckBox("CODE408 - Show Text (continuation)") self.code408_cb.setToolTip("Can significantly increase costs") + self.code408_cb.setStyleSheet("QCheckBox { color: #ff9999; }") left_column.addWidget(self.code408_cb) self.code122_cb = QCheckBox("CODE122 - Control Variables") @@ -252,40 +253,38 @@ class RPGMakerTab(QWidget): # RIGHT COLUMN right_column = QVBoxLayout() - right_column.setSpacing(3) + right_column.setSpacing(5) - # Event Codes (compact grid layout) - right_column.addWidget(create_section_label("🎮 Event Codes")) + # Plugins / Scripts / Other Codes + right_column.addWidget(create_section_label("🔧 Plugins / Scripts / Other")) - # Create a grid for better space usage - event_grid = QGridLayout() - event_grid.setSpacing(2) - event_grid.setHorizontalSpacing(15) + self.code355655_cb = QCheckBox("CODE355/655 - Script/Plugin Commands (MZ)") + right_column.addWidget(self.code355655_cb) - # Event codes in a more compact format - event_codes = [ - ("CODE103", "Input Number"), ("CODE104", "Select Item"), - ("CODE111", "Conditional Branch"), ("CODE117", "Common Event"), - ("CODE119", "Set Movement"), ("CODE121", "Control Switches"), - ("CODE125", "Change Gold"), ("CODE126", "Change Items"), - ("CODE127", "Change Weapons"), ("CODE128", "Change Armors"), - ("CODE129", "Change Party"), ("CODE201", "Transfer Player"), - ("CODE202", "Set Vehicle Loc"), ("CODE203", "Set Event Loc"), - ("CODE211", "Change Transparency"), ("CODE212", "Show Animation"), - ("CODE213", "Show Balloon"), ("CODE214", "Erase Event"), - ("CODE221", "Fadeout Screen"), ("CODE222", "Fadein Screen"), - ("CODE231", "Show Picture"), ("CODE232", "Move Picture"), - ("CODE241", "Play BGM"), ("CODE242", "Fadeout BGM"), - ] + self.code357_cb = QCheckBox("CODE357 - Plugin Commands") + right_column.addWidget(self.code357_cb) - self.event_checkboxes = {} - for idx, (code, label) in enumerate(event_codes): - cb = QCheckBox(f"{code} - {label}") - cb.setStyleSheet("QCheckBox { font-size: 10px; }") - event_grid.addWidget(cb, idx // 2, idx % 2) - self.event_checkboxes[code] = cb + self.code657_cb = QCheckBox("CODE657 - Plugin Commands (Extended)") + right_column.addWidget(self.code657_cb) + + self.code356_cb = QCheckBox("CODE356 - System Settings") + right_column.addWidget(self.code356_cb) + + self.code320_cb = QCheckBox("CODE320 - Change Name") + right_column.addWidget(self.code320_cb) + + self.code324_cb = QCheckBox("CODE324 - Change Nickname") + right_column.addWidget(self.code324_cb) + + self.code325_cb = QCheckBox("CODE325 - Change Profile") + right_column.addWidget(self.code325_cb) + + self.code111_cb = QCheckBox("CODE111 - Conditional Branch") + right_column.addWidget(self.code111_cb) + + self.code108_cb = QCheckBox("CODE108 - Comments") + right_column.addWidget(self.code108_cb) - right_column.addLayout(event_grid) right_column.addStretch() # Add both columns @@ -294,16 +293,20 @@ class RPGMakerTab(QWidget): main_layout.addLayout(columns_layout) # Bottom buttons + main_layout.addSpacing(12) button_layout = QHBoxLayout() button_layout.setSpacing(10) self.reset_button = QPushButton("🔄 Reset to Defaults") self.reset_button.clicked.connect(self.reset_to_defaults_with_message) - self.reset_button.setMaximumWidth(200) + self.reset_button.setMaximumWidth(180) + self.reset_button.setMinimumHeight(32) self.apply_button = QPushButton("✓ Apply Settings") self.apply_button.clicked.connect(self.apply_to_module) - self.apply_button.setMaximumWidth(200) + self.apply_button.setMaximumWidth(180) + self.apply_button.setMinimumHeight(32) + self.apply_button.setStyleSheet("font-weight: bold;") button_layout.addWidget(self.reset_button) button_layout.addWidget(self.apply_button) @@ -337,9 +340,16 @@ class RPGMakerTab(QWidget): # Variable codes self.code122_cb.setChecked(self.DEFAULT_CONFIG["CODE122"]) - # Event codes - for code, cb in self.event_checkboxes.items(): - cb.setChecked(self.DEFAULT_CONFIG.get(code, False)) + # Plugins / Scripts / Other codes + self.code355655_cb.setChecked(self.DEFAULT_CONFIG.get("CODE355655", False)) + self.code357_cb.setChecked(self.DEFAULT_CONFIG.get("CODE357", False)) + self.code657_cb.setChecked(self.DEFAULT_CONFIG.get("CODE657", False)) + self.code356_cb.setChecked(self.DEFAULT_CONFIG.get("CODE356", False)) + self.code320_cb.setChecked(self.DEFAULT_CONFIG.get("CODE320", False)) + self.code324_cb.setChecked(self.DEFAULT_CONFIG.get("CODE324", False)) + self.code325_cb.setChecked(self.DEFAULT_CONFIG.get("CODE325", False)) + self.code111_cb.setChecked(self.DEFAULT_CONFIG.get("CODE111", False)) + self.code108_cb.setChecked(self.DEFAULT_CONFIG.get("CODE108", False)) # Reconnect signals and apply changes once self.connect_auto_apply() @@ -377,9 +387,16 @@ class RPGMakerTab(QWidget): # Variable codes self.code122_cb.stateChanged.disconnect() - # Event codes - for cb in self.event_checkboxes.values(): - cb.stateChanged.disconnect() + # Plugins / Scripts / Other codes + self.code355655_cb.stateChanged.disconnect() + self.code357_cb.stateChanged.disconnect() + self.code657_cb.stateChanged.disconnect() + self.code356_cb.stateChanged.disconnect() + self.code320_cb.stateChanged.disconnect() + self.code324_cb.stateChanged.disconnect() + self.code325_cb.stateChanged.disconnect() + self.code111_cb.stateChanged.disconnect() + self.code108_cb.stateChanged.disconnect() except TypeError: # Ignore if signals are not connected pass @@ -406,9 +423,16 @@ class RPGMakerTab(QWidget): # Variable codes self.code122_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) - # Event codes - for cb in self.event_checkboxes.values(): - cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + # Plugins / Scripts / Other codes + self.code355655_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code357_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code657_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code356_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code320_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code324_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code325_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code111_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) + self.code108_cb.stateChanged.connect(lambda: self.apply_to_module(show_messages=False)) def get_config(self): """Get current configuration as dictionary.""" @@ -432,11 +456,18 @@ class RPGMakerTab(QWidget): # Variable codes "CODE122": self.code122_cb.isChecked(), + + # Plugins / Scripts / Other codes + "CODE355655": self.code355655_cb.isChecked(), + "CODE357": self.code357_cb.isChecked(), + "CODE657": self.code657_cb.isChecked(), + "CODE356": self.code356_cb.isChecked(), + "CODE320": self.code320_cb.isChecked(), + "CODE324": self.code324_cb.isChecked(), + "CODE325": self.code325_cb.isChecked(), + "CODE111": self.code111_cb.isChecked(), + "CODE108": self.code108_cb.isChecked(), } - - # Event codes - for code, cb in self.event_checkboxes.items(): - config[code] = cb.isChecked() return config @@ -462,9 +493,16 @@ class RPGMakerTab(QWidget): # Variable codes self.code122_cb.setChecked(config.get("CODE122", False)) - # Event codes - for code, cb in self.event_checkboxes.items(): - cb.setChecked(config.get(code, False)) + # Plugins / Scripts / Other codes + self.code355655_cb.setChecked(config.get("CODE355655", False)) + self.code357_cb.setChecked(config.get("CODE357", False)) + self.code657_cb.setChecked(config.get("CODE657", False)) + self.code356_cb.setChecked(config.get("CODE356", False)) + self.code320_cb.setChecked(config.get("CODE320", False)) + self.code324_cb.setChecked(config.get("CODE324", False)) + self.code325_cb.setChecked(config.get("CODE325", False)) + self.code111_cb.setChecked(config.get("CODE111", False)) + self.code108_cb.setChecked(config.get("CODE108", False)) def load_from_file(self, file_path): """Load configuration from file.""" diff --git a/gui/wolf_tab.py b/gui/wolf_tab.py index 7950102..9e3ad60 100644 --- a/gui/wolf_tab.py +++ b/gui/wolf_tab.py @@ -53,28 +53,28 @@ class WolfTab(QWidget): def init_ui(self): """Initialize the user interface with compact two-column layout.""" main_layout = QVBoxLayout() - main_layout.setContentsMargins(10, 10, 10, 10) + main_layout.setContentsMargins(15, 15, 15, 15) main_layout.setSpacing(10) # Title and description title = QLabel("Wolf RPG Editor Translation Settings") - title.setStyleSheet("font-size: 14px; font-weight: bold; color: #007acc;") + title.setStyleSheet("font-size: 15px; font-weight: bold; color: #007acc;") main_layout.addWidget(title) description = QLabel( "Enable translation options for Wolf RPG Editor projects. Only enable what you need." ) description.setWordWrap(True) - description.setStyleSheet("color: #888888; font-size: 11px; margin-bottom: 5px;") + description.setStyleSheet("color: #888888; font-size: 10px; margin-bottom: 5px;") main_layout.addWidget(description) # Two-column layout for checkboxes columns_layout = QHBoxLayout() - columns_layout.setSpacing(30) + columns_layout.setSpacing(40) # LEFT COLUMN left_column = QVBoxLayout() - left_column.setSpacing(3) + left_column.setSpacing(5) # Dialogue & Choices left_column.addWidget(create_section_label("💬 Dialogue & Choices")) @@ -86,7 +86,7 @@ class WolfTab(QWidget): self.code102_cb.setToolTip("Enable translation of choice options") left_column.addWidget(self.code102_cb) - left_column.addSpacing(8) + left_column.addSpacing(15) # Pictures & Variables left_column.addWidget(create_section_label("🖼️ Pictures & Variables")) @@ -98,7 +98,7 @@ class WolfTab(QWidget): self.code122_cb.setToolTip("Enable translation of string variables") left_column.addWidget(self.code122_cb) - left_column.addSpacing(8) + left_column.addSpacing(15) # Other Event Codes left_column.addWidget(create_section_label("🎮 Other Event Codes")) @@ -115,15 +115,16 @@ class WolfTab(QWidget): # RIGHT COLUMN right_column = QVBoxLayout() - right_column.setSpacing(3) + right_column.setSpacing(5) # Database Sections right_column.addWidget(create_section_label("📚 Database Sections")) # Database flags in compact 2-column grid db_grid = QGridLayout() - db_grid.setSpacing(2) - db_grid.setHorizontalSpacing(10) + db_grid.setSpacing(5) + db_grid.setHorizontalSpacing(25) + db_grid.setVerticalSpacing(6) database_flags = [ ("SCENARIOFLAG", "Scenario Text"), @@ -142,7 +143,6 @@ class WolfTab(QWidget): self.db_checkboxes = {} for idx, (key, label) in enumerate(database_flags): cb = QCheckBox(label) - cb.setStyleSheet("QCheckBox { font-size: 10px; }") db_grid.addWidget(cb, idx // 2, idx % 2) self.db_checkboxes[key] = cb @@ -155,16 +155,20 @@ class WolfTab(QWidget): main_layout.addLayout(columns_layout) # Bottom buttons + main_layout.addSpacing(12) button_layout = QHBoxLayout() button_layout.setSpacing(10) self.reset_btn = QPushButton("🔄 Reset to Defaults") self.reset_btn.clicked.connect(self.reset_to_defaults_with_message) - self.reset_btn.setMaximumWidth(200) + self.reset_btn.setMaximumWidth(180) + self.reset_btn.setMinimumHeight(32) self.apply_btn = QPushButton("✓ Apply Settings") self.apply_btn.clicked.connect(lambda: self.apply_to_module(True)) - self.apply_btn.setMaximumWidth(200) + self.apply_btn.setMaximumWidth(180) + self.apply_btn.setMinimumHeight(32) + self.apply_btn.setStyleSheet("font-weight: bold;") button_layout.addWidget(self.reset_btn) button_layout.addWidget(self.apply_btn) diff --git a/modules/rpgmakermvmz.py b/modules/rpgmakermvmz.py index 32c8c5d..6777b0d 100644 --- a/modules/rpgmakermvmz.py +++ b/modules/rpgmakermvmz.py @@ -104,7 +104,7 @@ CODE408 = False # Variables CODE122 = False -# Other +# Plugins / Scripts CODE355655 = False CODE357 = False CODE657 = False