mirror of
https://github.com/openai/whisper.git
synced 2025-11-23 22:15:58 +00:00
feat: Add professional styling and theming
- Create styles.py module with comprehensive stylesheet - Implement color palette and typography configuration - Apply consistent styling across all UI elements - Improve button, text input, and progress bar appearance - Use monospace font for transcription results display - Add hover and active states for interactive elements - Phase 5 complete: Professional UI styling applied
This commit is contained in:
parent
dd57adab18
commit
72ab2e3fa9
@ -24,6 +24,7 @@ from PyQt6.QtGui import QFont
|
||||
|
||||
from farsi_transcriber.models.whisper_transcriber import FarsiTranscriber
|
||||
from farsi_transcriber.utils.export import TranscriptionExporter
|
||||
from farsi_transcriber.ui.styles import get_stylesheet, get_color
|
||||
|
||||
|
||||
class TranscriptionWorker(QThread):
|
||||
@ -85,6 +86,8 @@ class MainWindow(QMainWindow):
|
||||
self.selected_file = None
|
||||
self.transcription_worker = None
|
||||
self.last_result = None
|
||||
# Apply stylesheet
|
||||
self.setStyleSheet(get_stylesheet())
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
@ -121,10 +124,6 @@ class MainWindow(QMainWindow):
|
||||
|
||||
# Transcribe button
|
||||
self.transcribe_button = QPushButton("Transcribe")
|
||||
self.transcribe_button.setStyleSheet(
|
||||
"background-color: #4CAF50; color: white; font-weight: bold; "
|
||||
"padding: 8px; border-radius: 4px; font-size: 12pt;"
|
||||
)
|
||||
self.transcribe_button.clicked.connect(self.on_transcribe)
|
||||
self.transcribe_button.setEnabled(False)
|
||||
main_layout.addWidget(self.transcribe_button)
|
||||
@ -152,9 +151,9 @@ class MainWindow(QMainWindow):
|
||||
self.results_text.setPlaceholderText(
|
||||
"Transcription results will appear here..."
|
||||
)
|
||||
self.results_text.setStyleSheet(
|
||||
"border: 1px solid #ccc; border-radius: 4px; font-family: 'Courier New';"
|
||||
)
|
||||
# Set monospace font for results
|
||||
mono_font = QFont("Courier New", 10)
|
||||
self.results_text.setFont(mono_font)
|
||||
main_layout.addWidget(self.results_text)
|
||||
|
||||
# Buttons layout (Export, Clear)
|
||||
|
||||
107
farsi_transcriber/ui/styles.py
Normal file
107
farsi_transcriber/ui/styles.py
Normal file
@ -0,0 +1,107 @@
|
||||
"""
|
||||
Application styling and theming
|
||||
|
||||
Provides stylesheet and styling utilities for the Farsi Transcriber app.
|
||||
"""
|
||||
|
||||
# Modern, professional dark-themed stylesheet
|
||||
MAIN_STYLESHEET = """
|
||||
QMainWindow {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
QLabel {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
QLineEdit, QTextEdit {
|
||||
background-color: #ffffff;
|
||||
color: #333333;
|
||||
border: 1px solid #d0d0d0;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
QLineEdit:focus, QTextEdit:focus {
|
||||
border: 2px solid #4CAF50;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 8px 16px;
|
||||
font-weight: bold;
|
||||
font-size: 11pt;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: #3d8b40;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #cccccc;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
QProgressBar {
|
||||
border: 1px solid #d0d0d0;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
background-color: #ffffff;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
QProgressBar::chunk {
|
||||
background-color: #4CAF50;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
QMessageBox QLabel {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
QMessageBox QPushButton {
|
||||
min-width: 60px;
|
||||
}
|
||||
"""
|
||||
|
||||
# Color palette
|
||||
COLORS = {
|
||||
"primary": "#4CAF50",
|
||||
"primary_hover": "#45a049",
|
||||
"primary_active": "#3d8b40",
|
||||
"background": "#f5f5f5",
|
||||
"text": "#333333",
|
||||
"text_secondary": "#666666",
|
||||
"border": "#d0d0d0",
|
||||
"success": "#4CAF50",
|
||||
"error": "#f44336",
|
||||
"warning": "#ff9800",
|
||||
"info": "#2196F3",
|
||||
}
|
||||
|
||||
# Font settings
|
||||
FONTS = {
|
||||
"default_size": 11,
|
||||
"title_size": 16,
|
||||
"mono_family": "Courier New",
|
||||
}
|
||||
|
||||
|
||||
def get_stylesheet() -> str:
|
||||
"""Get the main stylesheet for the application"""
|
||||
return MAIN_STYLESHEET
|
||||
|
||||
|
||||
def get_color(color_name: str) -> str:
|
||||
"""Get a color from the palette"""
|
||||
return COLORS.get(color_name, "#000000")
|
||||
Loading…
x
Reference in New Issue
Block a user