Lookin good
This commit is contained in:
parent
0efe60e8c1
commit
d870a395fd
2 changed files with 183 additions and 31 deletions
|
|
@ -8,9 +8,10 @@ from PyQt5.QtWidgets import (
|
||||||
QWidget, QVBoxLayout, QHBoxLayout, QFormLayout, QLineEdit,
|
QWidget, QVBoxLayout, QHBoxLayout, QFormLayout, QLineEdit,
|
||||||
QSpinBox, QDoubleSpinBox, QComboBox, QPushButton, QGroupBox,
|
QSpinBox, QDoubleSpinBox, QComboBox, QPushButton, QGroupBox,
|
||||||
QLabel, QFileDialog, QMessageBox, QScrollArea, QTextEdit,
|
QLabel, QFileDialog, QMessageBox, QScrollArea, QTextEdit,
|
||||||
QCheckBox, QApplication, QTabWidget, QFrame
|
QCheckBox, QApplication, QTabWidget, QFrame, QStackedWidget, QToolButton
|
||||||
)
|
)
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal
|
from PyQt5.QtCore import Qt, pyqtSignal
|
||||||
|
from PyQt5.QtGui import QIcon
|
||||||
from dotenv import load_dotenv, set_key
|
from dotenv import load_dotenv, set_key
|
||||||
|
|
||||||
from gui.rpgmaker_tab import RPGMakerTab
|
from gui.rpgmaker_tab import RPGMakerTab
|
||||||
|
|
@ -52,33 +53,114 @@ class ConfigTab(QWidget):
|
||||||
self.load_from_env()
|
self.load_from_env()
|
||||||
|
|
||||||
def init_ui(self):
|
def init_ui(self):
|
||||||
"""Initialize the user interface with tabs for different config categories."""
|
"""Initialize the user interface with horizontal icon navigation at top."""
|
||||||
main_layout = QVBoxLayout()
|
main_layout = QVBoxLayout()
|
||||||
main_layout.setContentsMargins(0, 0, 0, 0)
|
main_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
main_layout.setSpacing(0)
|
main_layout.setSpacing(0)
|
||||||
|
|
||||||
# Create tab widget for different configuration categories
|
# Create top navigation bar
|
||||||
self.config_tabs = QTabWidget()
|
nav_bar = QWidget()
|
||||||
self.config_tabs.setDocumentMode(True) # Remove frame for more space
|
nav_bar.setFixedHeight(50)
|
||||||
|
nav_bar.setStyleSheet("""
|
||||||
|
QWidget {
|
||||||
|
background-color: #2d2d30;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
nav_layout = QHBoxLayout()
|
||||||
|
nav_layout.setContentsMargins(10, 0, 10, 0)
|
||||||
|
nav_layout.setSpacing(5)
|
||||||
|
|
||||||
# Tab 1: General Settings (Everything in one place!)
|
# Create navigation buttons
|
||||||
|
self.nav_buttons = []
|
||||||
|
|
||||||
|
# General Settings button
|
||||||
|
btn_general = self.create_nav_button("🔧", "General Settings")
|
||||||
|
btn_general.clicked.connect(lambda: self.switch_page(0))
|
||||||
|
nav_layout.addWidget(btn_general)
|
||||||
|
self.nav_buttons.append(btn_general)
|
||||||
|
|
||||||
|
# RPG Maker MV/MZ button
|
||||||
|
btn_mvmz = self.create_nav_button("🎮", "RPG Maker MV/MZ")
|
||||||
|
btn_mvmz.clicked.connect(lambda: self.switch_page(1))
|
||||||
|
nav_layout.addWidget(btn_mvmz)
|
||||||
|
self.nav_buttons.append(btn_mvmz)
|
||||||
|
|
||||||
|
# RPG Maker Ace button
|
||||||
|
btn_ace = self.create_nav_button("🎲", "RPG Maker Ace")
|
||||||
|
btn_ace.clicked.connect(lambda: self.switch_page(2))
|
||||||
|
nav_layout.addWidget(btn_ace)
|
||||||
|
self.nav_buttons.append(btn_ace)
|
||||||
|
|
||||||
|
# Wolf RPG button
|
||||||
|
btn_wolf = self.create_nav_button("🐺", "Wolf RPG")
|
||||||
|
btn_wolf.clicked.connect(lambda: self.switch_page(3))
|
||||||
|
nav_layout.addWidget(btn_wolf)
|
||||||
|
self.nav_buttons.append(btn_wolf)
|
||||||
|
|
||||||
|
nav_layout.addStretch()
|
||||||
|
nav_bar.setLayout(nav_layout)
|
||||||
|
|
||||||
|
# Create stacked widget for content pages
|
||||||
|
self.content_stack = QStackedWidget()
|
||||||
|
|
||||||
|
# Page 1: General Settings
|
||||||
general_tab = self.create_general_settings_tab()
|
general_tab = self.create_general_settings_tab()
|
||||||
self.config_tabs.addTab(general_tab, "General Settings")
|
self.content_stack.addWidget(general_tab)
|
||||||
|
|
||||||
# Tab 2: RPG Maker MV/MZ Engine
|
# Page 2: RPG Maker MV/MZ Engine
|
||||||
self.mvmz_tab = RPGMakerTab("MVMZ")
|
self.mvmz_tab = RPGMakerTab("MVMZ")
|
||||||
self.config_tabs.addTab(self.mvmz_tab, "RPG Maker MV/MZ")
|
self.content_stack.addWidget(self.mvmz_tab)
|
||||||
|
|
||||||
# Tab 3: RPG Maker Ace Engine
|
# Page 3: RPG Maker Ace Engine
|
||||||
self.ace_tab = RPGMakerTab("ACE")
|
self.ace_tab = RPGMakerTab("ACE")
|
||||||
self.config_tabs.addTab(self.ace_tab, "RPG Maker Ace")
|
self.content_stack.addWidget(self.ace_tab)
|
||||||
|
|
||||||
# Tab 4: Wolf RPG Engine
|
# Page 4: Wolf RPG Engine
|
||||||
self.wolf_tab = WolfTab()
|
self.wolf_tab = WolfTab()
|
||||||
self.config_tabs.addTab(self.wolf_tab, "Wolf RPG")
|
self.content_stack.addWidget(self.wolf_tab)
|
||||||
|
|
||||||
main_layout.addWidget(self.config_tabs)
|
# Add navigation bar and content to main layout
|
||||||
|
main_layout.addWidget(nav_bar)
|
||||||
|
main_layout.addWidget(self.content_stack)
|
||||||
self.setLayout(main_layout)
|
self.setLayout(main_layout)
|
||||||
|
|
||||||
|
# Select first page by default
|
||||||
|
self.switch_page(0)
|
||||||
|
|
||||||
|
def create_nav_button(self, icon_text, tooltip):
|
||||||
|
"""Create a navigation button for the top bar."""
|
||||||
|
btn = QToolButton()
|
||||||
|
btn.setText(icon_text)
|
||||||
|
btn.setToolTip(tooltip)
|
||||||
|
btn.setFixedSize(50, 50)
|
||||||
|
btn.setCheckable(True)
|
||||||
|
btn.setStyleSheet("""
|
||||||
|
QToolButton {
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 3px solid transparent;
|
||||||
|
color: #cccccc;
|
||||||
|
font-size: 24px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
QToolButton:hover {
|
||||||
|
background-color: #3e3e42;
|
||||||
|
}
|
||||||
|
QToolButton:checked {
|
||||||
|
background-color: #37373d;
|
||||||
|
border-bottom: 3px solid #007acc;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
return btn
|
||||||
|
|
||||||
|
def switch_page(self, index):
|
||||||
|
"""Switch to the specified page and update button states."""
|
||||||
|
self.content_stack.setCurrentIndex(index)
|
||||||
|
|
||||||
|
# Update button checked states
|
||||||
|
for i, btn in enumerate(self.nav_buttons):
|
||||||
|
btn.setChecked(i == index)
|
||||||
|
|
||||||
def create_general_settings_tab(self):
|
def create_general_settings_tab(self):
|
||||||
"""Create combined general settings tab with API, Translation, Performance, and UI settings."""
|
"""Create combined general settings tab with API, Translation, Performance, and UI settings."""
|
||||||
|
|
|
||||||
104
gui/main.py
104
gui/main.py
|
|
@ -11,7 +11,7 @@ from pathlib import Path
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication, QMainWindow, QTabWidget, QVBoxLayout, QHBoxLayout,
|
QApplication, QMainWindow, QTabWidget, QVBoxLayout, QHBoxLayout,
|
||||||
QWidget, QPushButton, QLabel, QFileDialog, QMessageBox, QProgressBar,
|
QWidget, QPushButton, QLabel, QFileDialog, QMessageBox, QProgressBar,
|
||||||
QTextEdit, QSplitter, QGroupBox, QStatusBar
|
QTextEdit, QSplitter, QGroupBox, QStatusBar, QStackedWidget, QToolButton
|
||||||
)
|
)
|
||||||
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer, QSettings
|
from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer, QSettings
|
||||||
from PyQt5.QtGui import QIcon, QFont, QPixmap, QScreen
|
from PyQt5.QtGui import QIcon, QFont, QPixmap, QScreen
|
||||||
|
|
@ -129,33 +129,103 @@ class DazedMTLGUI(QMainWindow):
|
||||||
central_widget = QWidget()
|
central_widget = QWidget()
|
||||||
self.setCentralWidget(central_widget)
|
self.setCentralWidget(central_widget)
|
||||||
|
|
||||||
# Create tab widget
|
# Create main layout with VSCode-style sidebar
|
||||||
self.tab_widget = QTabWidget()
|
main_layout = QHBoxLayout()
|
||||||
self.tab_widget.setTabPosition(QTabWidget.North)
|
main_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
main_layout.setSpacing(0)
|
||||||
|
|
||||||
# Add tabs
|
# Create sidebar for navigation
|
||||||
|
sidebar = QWidget()
|
||||||
|
sidebar.setFixedWidth(60)
|
||||||
|
sidebar.setStyleSheet("""
|
||||||
|
QWidget {
|
||||||
|
background-color: #2d2d30;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
sidebar_layout = QVBoxLayout()
|
||||||
|
sidebar_layout.setContentsMargins(0, 10, 0, 10)
|
||||||
|
sidebar_layout.setSpacing(2)
|
||||||
|
|
||||||
|
# Create navigation buttons
|
||||||
|
self.nav_buttons = []
|
||||||
|
|
||||||
|
# Translation button (first)
|
||||||
|
btn_translation = self.create_nav_button("🌐", "Translation")
|
||||||
|
btn_translation.clicked.connect(lambda: self.switch_page(0))
|
||||||
|
sidebar_layout.addWidget(btn_translation)
|
||||||
|
self.nav_buttons.append(btn_translation)
|
||||||
|
|
||||||
|
# Configuration button (second)
|
||||||
|
btn_config = self.create_nav_button("⚙️", "Configuration")
|
||||||
|
btn_config.clicked.connect(lambda: self.switch_page(1))
|
||||||
|
sidebar_layout.addWidget(btn_config)
|
||||||
|
self.nav_buttons.append(btn_config)
|
||||||
|
|
||||||
|
sidebar_layout.addStretch()
|
||||||
|
sidebar.setLayout(sidebar_layout)
|
||||||
|
|
||||||
|
# Create stacked widget for content pages
|
||||||
|
self.content_stack = QStackedWidget()
|
||||||
|
|
||||||
|
# Add tabs to stacked widget
|
||||||
self.setup_tabs()
|
self.setup_tabs()
|
||||||
|
|
||||||
# Set main layout
|
# Add sidebar and content to main layout
|
||||||
layout = QVBoxLayout()
|
main_layout.addWidget(sidebar)
|
||||||
layout.setContentsMargins(0, 0, 0, 0)
|
main_layout.addWidget(self.content_stack)
|
||||||
layout.setSpacing(0)
|
central_widget.setLayout(main_layout)
|
||||||
layout.addWidget(self.tab_widget)
|
|
||||||
central_widget.setLayout(layout)
|
|
||||||
|
|
||||||
# Create menu bar
|
# Create menu bar
|
||||||
self.create_menu_bar()
|
self.create_menu_bar()
|
||||||
|
|
||||||
|
# Select first page by default
|
||||||
|
self.switch_page(0)
|
||||||
|
|
||||||
|
def create_nav_button(self, icon_text, tooltip):
|
||||||
|
"""Create a navigation button for the sidebar."""
|
||||||
|
btn = QToolButton()
|
||||||
|
btn.setText(icon_text)
|
||||||
|
btn.setToolTip(tooltip)
|
||||||
|
btn.setFixedSize(60, 50)
|
||||||
|
btn.setCheckable(True)
|
||||||
|
btn.setStyleSheet("""
|
||||||
|
QToolButton {
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
border-left: 3px solid transparent;
|
||||||
|
color: #cccccc;
|
||||||
|
font-size: 24px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
QToolButton:hover {
|
||||||
|
background-color: #3e3e42;
|
||||||
|
}
|
||||||
|
QToolButton:checked {
|
||||||
|
background-color: #37373d;
|
||||||
|
border-left: 3px solid #007acc;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
return btn
|
||||||
|
|
||||||
|
def switch_page(self, index):
|
||||||
|
"""Switch to the specified page and update button states."""
|
||||||
|
self.content_stack.setCurrentIndex(index)
|
||||||
|
|
||||||
|
# Update button checked states
|
||||||
|
for i, btn in enumerate(self.nav_buttons):
|
||||||
|
btn.setChecked(i == index)
|
||||||
|
|
||||||
def setup_tabs(self):
|
def setup_tabs(self):
|
||||||
"""Set up all the tabs in the interface."""
|
"""Set up all the tabs in the interface."""
|
||||||
# Configuration Tab
|
# Translation Execution Tab (first)
|
||||||
|
self.translation_tab = TranslationTab(self)
|
||||||
|
self.content_stack.addWidget(self.translation_tab)
|
||||||
|
|
||||||
|
# Configuration Tab (second)
|
||||||
self.config_tab = ConfigTab()
|
self.config_tab = ConfigTab()
|
||||||
self.config_tab.config_changed.connect(self.on_config_changed)
|
self.config_tab.config_changed.connect(self.on_config_changed)
|
||||||
self.tab_widget.addTab(self.config_tab, "Configuration")
|
self.content_stack.addWidget(self.config_tab)
|
||||||
|
|
||||||
# Translation Execution Tab (includes file management)
|
|
||||||
self.translation_tab = TranslationTab(self)
|
|
||||||
self.tab_widget.addTab(self.translation_tab, "Translation")
|
|
||||||
|
|
||||||
def on_config_changed(self):
|
def on_config_changed(self):
|
||||||
"""Handle configuration changes."""
|
"""Handle configuration changes."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue