Skip to content

Commit

Permalink
Merge pull request #1 from darktohka/master
Browse files Browse the repository at this point in the history
Add stylesheet on Linux
  • Loading branch information
naghim authored Mar 25, 2024
2 parents 21fcb1e + e04d86c commit 6c09062
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align='justify'>This is a specialized desktop application designed to simplify the translation process for subtitle files, specifically for the <code>.ass</code> (Advanced SubStation Alpha) format. Tailored for translators, SubAssistant facilitates seamless collaboration by allowing users to comment out the original dialogue text, write their translations alongside it, and enable proofreaders or quality checkers to review both versions within the same file. Users also have the possibilitiy to delete the commented out texts, doing so the application enhances the efficiency and accuracy of subtitle translation workflows.</p>

<p align="center">
<img width="400" src="https://i.imgur.com/vvzOFnF.png"" alt="SubAssistant screenshot"/>
<img width="500" src="https://i.imgur.com/vvzOFnF.png"" alt="SubAssistant screenshot"/>
</p>

## Installation
Expand Down
25 changes: 15 additions & 10 deletions subassistant/gui/tab.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from PySide6.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QFileDialog, QHBoxLayout, QLineEdit, QScrollArea, QMessageBox
from PySide6.QtGui import QColor
from subassistant.logic.logic import RemoveComments, CommentDialogue
from subassistant.gui import util
import os

class BaseSubtitleUI(QWidget):
Expand All @@ -8,18 +10,18 @@ def __init__(self):

self.layout = QVBoxLayout()
self.window_title = QLabel(self.TAB_TITLE)
self.window_title.setObjectName("Label_txt_bold")
self.window_title.setObjectName("Label_txt_bold")
self.layout.addWidget(self.window_title)

self.input_file_label = QLabel("Select Input File:")
self.input_file_label.setObjectName("Label_txt")
self.input_file_label.setObjectName("Label_txt")
self.layout.addWidget(self.input_file_label)

self.input_file_line_edit = QLineEdit()
self.input_file_line_edit.setReadOnly(True)
self.input_file_line_edit.setObjectName("LineEdit")

self.input_btn = QPushButton("Browse", clicked=self.get_file)
self.input_btn = QPushButton("Browse", clicked=self.get_file)
self.input_btn.setObjectName("FileChooserButton")

input_file_layout = QHBoxLayout()
Expand Down Expand Up @@ -47,6 +49,7 @@ def __init__(self):
self.action_button.setObjectName("Action_btn")
self.action_button.clicked.connect(lambda: self.process_file(self.ACTION_CLASS))

util.apply_background_color(self, QColor(249, 249, 249))
self.layout.addWidget(self.action_button)
self.setLayout(self.layout)

Expand Down Expand Up @@ -82,17 +85,17 @@ def get_output_file(self, folder):
def process_file(self, action_class):
input_file = self.input_file_line_edit.text()
output_folder = self.output_file_line_edit.text()

if not input_file:
QMessageBox.warning(self, "Warning", "Please select a file to process.")
return

if not output_folder:
QMessageBox.warning(self, "Warning", "Please select an output folder.")
return

output_file = self.get_output_file(output_folder)

try:
action_class(input_file, output_file).process_file()
QMessageBox.information(self, "Success", f'File processed successfully.\nOutput file: {output_file}')
Expand All @@ -118,14 +121,14 @@ def __init__(self):

def initUI(self):
self.layout = QVBoxLayout()

self.content_widget = QWidget()
self.content_layout = QVBoxLayout()

scroll_area = QScrollArea()
scroll_area.setWidgetResizable(True)
scroll_area.setWidget(self.content_widget)

util.apply_background_color(self.content_widget, QColor(249, 249, 249))
self.layout.addWidget(scroll_area)


Expand All @@ -148,10 +151,12 @@ def initUI(self):
self.text_how_to.setObjectName("About_txt")
self.text_slogan.setObjectName("Label_txt_bold_mini")
self.text_logo.setObjectName("Label_txt_bold")
self.content_widget.setStyleSheet("background-color: #f0f0f0")
self.content_layout.addWidget(self.text_logo)
self.content_layout.addWidget(self.text_how_to)
self.content_layout.addWidget(self.text)
self.content_layout.addWidget(self.text_slogan)
self.content_widget.setLayout(self.content_layout)


util.apply_background_color(self, QColor(249, 249, 249))
self.setLayout(self.layout)
7 changes: 7 additions & 0 deletions subassistant/gui/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from PySide6.QtGui import QPalette

def apply_background_color(widget, color):
palette = QPalette()
palette.setColor(QPalette.Window, color)
widget.setAutoFillBackground(True)
widget.setPalette(palette)
8 changes: 5 additions & 3 deletions subassistant/gui/window.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from PySide6.QtGui import QIcon
from PySide6.QtGui import QIcon, QColor
from PySide6.QtWidgets import QTabWidget, QWidget, QVBoxLayout
from subassistant.globals import RESOURCES_DIR
from subassistant.gui.tab import CommentTab, RemoveCommentTab, AboutTab
from subassistant.gui import util
import os

class SubAssistantWindow(QWidget):
Expand All @@ -10,6 +11,7 @@ def __init__(self):
self.setWindowTitle("SubAssistant")
self.setWindowIcon(QIcon(os.path.join(RESOURCES_DIR, 'curly_braces_icon.png')))
self.setFixedSize(550, 350)
util.apply_background_color(self, QColor(240, 240, 240))
self.initUI()

def initUI(self):
Expand All @@ -22,8 +24,8 @@ def initUI(self):
self.tab_widget.addTab(RemoveCommentTab(), QIcon(os.path.join(RESOURCES_DIR, 'no_curly_braces.png')), "")
self.tab_widget.addTab(AboutTab(), QIcon(os.path.join(RESOURCES_DIR, 'about.png')), "")


self.tab_widget.setStyleSheet("QTabBar::tab { height: 60px; width: 100px;}")
self.tab_widget.setObjectName("TabWidget")
self.tab_widget.setStyleSheet("QTabBar::tab { height: 60px; width: 100px; background-color: #f3f3f3; border: 1px solid #e8e8e8; padding-top: -22px; padding-bottom: 22px; } QTabBar::tab:selected { background-color: #f9f9f9; }")
layout.addWidget(self.tab_widget)

self.setLayout(layout)
Binary file modified subassistant/resources/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified subassistant/resources/curly_braces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified subassistant/resources/curly_braces_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified subassistant/resources/no_curly_braces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions subassistant/resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@
font-size: 16px;
text-align: justify;
}

#TabWidget {
border: none;
background-color: transparent;
}

0 comments on commit 6c09062

Please sign in to comment.