Skip to content

Commit 57935b5

Browse files
authored
Update DynamoLauncher_app.py
1 parent 86f1e6e commit 57935b5

File tree

1 file changed

+52
-7
lines changed

1 file changed

+52
-7
lines changed

DynamoLauncher_app.py

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
from PyQt5.QtCore import QThread, pyqtSignal, QSize, Qt, QSettings
1+
from PyQt5.QtCore import QThread, pyqtSignal, QSize, Qt, QSettings, QTimer
22
from PyQt5.QtWidgets import (
33
QWidget, QHBoxLayout, QVBoxLayout, QLabel, QLineEdit,
44
QComboBox, QSpacerItem, QSizePolicy, QProgressBar,
55
QPushButton, QApplication, QMainWindow, QMessageBox
66
)
7-
from PyQt5.QtGui import QPixmap, QIcon
8-
import os
7+
from PyQt5.QtGui import QPixmap, QIcon, QPalette, QColor
98

109
from minecraft_launcher_lib.utils import get_minecraft_directory, get_version_list
1110
from minecraft_launcher_lib.install import install_minecraft_version
@@ -18,6 +17,7 @@
1817
from sys import argv, exit
1918

2019
from os.path import join, isdir
20+
import os
2121

2222
minecraft_directory = get_minecraft_directory().replace('minecraft', 'DynamoLauncher')
2323

@@ -101,21 +101,43 @@ def __init__(self):
101101

102102
self.setWindowIcon(QIcon('assets/215446.ico'))
103103
self.setWindowTitle("DynamoLauncher V1.1")
104-
105-
self.showMaximized()
104+
106105

107106
self.titlespacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
108107

108+
# Estilo para QLineEdit
109+
line_edit_style = (
110+
"QLineEdit {"
111+
" background-color: #ecf0f1;"
112+
" border: 1px solid #bdc3c7;"
113+
" border-radius: 4px;"
114+
" padding: 5px;"
115+
"}"
116+
)
117+
118+
# Estilo para QComboBox
119+
combo_box_style = (
120+
"QComboBox {"
121+
" background-color: #ecf0f1;"
122+
" border: 1px solid #bdc3c7;"
123+
" border-radius: 4px;"
124+
" padding: 5px;"
125+
"}"
126+
)
127+
109128
self.username = QLineEdit(self.centralwidget)
110129
self.username.setPlaceholderText('Username')
130+
self.username.setStyleSheet(line_edit_style)
111131

112132
self.version_select = QComboBox(self.centralwidget)
113133
self.version_select.addItem("Available Minecraft Versions")
114134
self.load_available_versions()
135+
self.version_select.setStyleSheet(combo_box_style)
115136

116137
self.downloaded_version_select = QComboBox(self.centralwidget)
117138
self.downloaded_version_select.addItem("Downloaded Minecraft Versions")
118139
self.load_downloaded_versions()
140+
self.downloaded_version_select.setStyleSheet(combo_box_style)
119141

120142
self.progress_spacer = QSpacerItem(20, 20, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum)
121143

@@ -127,13 +149,17 @@ def __init__(self):
127149
self.start_progress.setProperty('value', 24)
128150
self.start_progress.setVisible(False)
129151

152+
# Botón de inicio
130153
self.start_button = QPushButton(self.centralwidget)
131154
self.start_button.setText('Play')
132155
self.start_button.clicked.connect(self.launch_game)
156+
self.apply_button_style(self.start_button)
133157

158+
# Botón de historial
134159
self.history_button = QPushButton(self.centralwidget)
135160
self.history_button.setText('User History')
136161
self.history_button.clicked.connect(self.show_user_history)
162+
self.apply_button_style(self.history_button)
137163

138164
self.vertical_layout = QVBoxLayout(self.centralwidget)
139165
self.vertical_layout.setContentsMargins(15, 15, 15, 15)
@@ -236,20 +262,39 @@ def launch_game(self):
236262
self.launch_thread.launch_setup_signal.emit(selected_version, self.username.text())
237263
self.launch_thread.start()
238264

265+
def apply_button_style(self, button):
266+
button_style = (
267+
"QPushButton {"
268+
" background-color: #4CAF50;" # Color de fondo
269+
" border: none;"
270+
" color: white;"
271+
" padding: 10px 20px;"
272+
" text-align: center;"
273+
" text-decoration: none;"
274+
" font-size: 16px;"
275+
" margin: 4px 2px;"
276+
" border-radius: 8px;" # Bordes redondeados
277+
"}"
278+
"QPushButton:hover {"
279+
" background-color: #45a049;" # Cambio de color al pasar el ratón
280+
"}"
281+
)
282+
button.setStyleSheet(button_style)
283+
239284
def main():
240285
QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling, True)
241286

242287
app = QApplication(argv)
243288
window = MainWindow()
289+
window.showMaximized()
244290
window.show()
245291

292+
246293
exit(app.exec_())
247294

248295
if __name__ == '__main__':
249296
main()
250297

251-
252-
253298
# MIT License
254299

255300
# Copyright (c) 2023 Sstudiosdev

0 commit comments

Comments
 (0)