-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainwindowui.py
More file actions
562 lines (465 loc) · 25.7 KB
/
mainwindowui.py
File metadata and controls
562 lines (465 loc) · 25.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
import os
import sys
import time
import threading
import richpresence
from aboutwindow import AboutWindow
from addmodoptions import AddModFromOptionsWindow
from compilemodoptions import CompileModOptionsWindow
from mainwindowfunc import * # Contains our functionality so we can read this file properly
from constants import * # Contains our paths
from PyQt6 import QtCore, QtGui, QtWidgets, uic
from PyQt6.QtCore import QRunnable, pyqtSlot, QThreadPool, Qt
from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QComboBox, QVBoxLayout, QWidget, QLineEdit, \
QFileDialog, QHeaderView, QTableWidgetItem, QAbstractItemView
from PyQt6.QtGui import QIcon
from modfileutils import get_path_to_game_folder
from addmodui import AddModWindow
from warningui import WarningWindow
# This class will handle our multithreading
# We've come far enough in python work that we need to multithread it, be proud
class Worker(QRunnable):
"""Worker thread.
Inherits from QRunnable to handler worker thread setup, signals and wrap-up.
:param callback: The function callback to run on this worker thread.
Supplied args and kwargs will be passed through to the runner.
:type callback: function
:param args: Arguments to pass to the callback function
:param kwargs: Keywords to pass to the callback function
"""
def __init__(self, fn, *args, **kwargs):
super().__init__()
self.fn = fn
self.args = args
self.kwargs = kwargs
@pyqtSlot()
def run(self):
"""Initialise the runner function with passed args, kwargs."""
self.fn(*self.args, **self.kwargs)
# load our main window and hook all behaviors/connections to other windows here
# Functions attached to buttons should be in another file for readability
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
# Load mainwindow file
uic.loadUi(os.path.join(UI_FOLDER_PATH, 'mainwindow.ui'), self)
ico_path = QIcon(os.path.join(os.getcwd(), "appAssets", "OLLIELG.ICO"))
self.setWindowIcon(ico_path)
self.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
# Fixes the cells in the table
# self.setStyleSheet("QTableWidget::item{selection-color: #ffffff; selection-background-color: #0010cf;}")
# This does technically start a thread, but you can never update the thread... which sucks
client_id = "1432755181598150908"
# Init thread in window to access later?
try:
RPC_Thread = threading.Thread(name="discord-RPC", target=richpresence.RPC_loop(client_id), daemon=True)
RPC_Thread.start()
except Exception as e:
print("Discord not found. Skipping rich presence...")
# ATTACH ALL BUTTON BEHAVIOR IN HERE
# THREAD POOL
self.threadpool = QThreadPool()
self.aboutButton.clicked.connect(self.about_window)
# TAB WIDGET - handles style changes
self.tabWidget.currentChanged.connect(self.change_tabstyle)
# SETTINGS BUTTONS - make sure to change these on load depending on the settings toggles
self.launchDolphinPlayRadiobutton.setChecked(check_play_behavior(self.launchDolphinPlayRadiobutton.text()))
self.launchDolphinPlayRadiobutton.toggled.connect(self.toggle_play_behavior)
self.playGameRadiobutton.setChecked(check_play_behavior(self.playGameRadiobutton.text()))
self.playGameRadiobutton.toggled.connect(self.toggle_play_behavior)
self.checkBox_4.setChecked(settings_checkbox_init("check4"))
self.checkBox_4.checkStateChanged.connect(self.toggle_checkbox_settings)
self.checkBox_5.setChecked(settings_checkbox_init("check5"))
self.checkBox_5.checkStateChanged.connect(self.toggle_checkbox_settings)
# DIR PLAIN TEXT SETUP
self.modsDirPathField.setPlainText(get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"modsdir"))
self.dolphinDirPathField.setPlainText(get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"dolphindir"))
self.pluginsDirPathField.setPlainText(get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"pluginsdir"))
# DIR BUTTON SETUP
self.dolphinDirToolbutton.clicked.connect(self.set_directory)
self.modsDirToolbutton.clicked.connect(self.set_directory)
self.pluginsDirToolbutton.clicked.connect(self.set_directory)
self.openModsPushbutton.clicked.connect(self.open_directory)
self.openDolphinPushbutton.clicked.connect(self.open_directory)
# BOTTOM ROW OF BUTTONS
self.addModButton.clicked.connect(self.install_mod)
self.refreshListButton.clicked.connect(self.refresh_modsUI)
self.compileModsButton.clicked.connect(self.compile_mods)
# SAVE BUTTONS
self.saveModsPushbutton.clicked.connect(self.save_mods)
self.saveAndPlayPushbutton.clicked.connect(self.save_and_start_game)
# GAME COMBOBOX
# Create a dictionary of added games from the add_new_game function
# TODO: add "last selected game" as a settings property to open up to the last selected game.
self.currentGameCombobox.addItems(update_gamelist_combobox())
self.currentGameCombobox.activated.connect(self.game_combo_box_option_select)
# MOD QTABLEWIDGET
mod_entries, mod_info = populate_modlist(self.currentGameCombobox.currentText())
column_titles = ["Title", "Version", "Author", "Features"]
self.modsTableWidget.itemChanged.connect(self.get_checked_mod) # Attach to each item's checkbox for enable/disable behaviors
self.modsTableWidget.setRowCount(len(mod_entries))
self.modsTableWidget.setColumnCount(4)
self.modsTableWidget.setHorizontalHeaderLabels(column_titles)
self.modsTableWidget.verticalHeader().setVisible(False)
self.modsTableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.modsTableWidget.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
self.modsTableWidget.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.modsTableWidget.setDragDropOverwriteMode(False)
self.modsTableWidget.itemChanged.connect(self.update_modinfo_from_cell)
self.modsTableWidget.doubleClicked.connect(self.open_mod_folder)
# MAKE SURE EVERYTHING IS HOOKED BEFORE CANCELLING FILLING THESE OUT
if self.currentGameCombobox.count() <= 1:
# There's no games here, switch the tab to settings and ignore the rest of init
# dialog = WarningWindow(self, "No mods or games! Add a game with the combobox.")
# dialog.exec()
print("No mods or games! Add a game with the combobox.")
self.tabWidget.setTabEnabled(0, False)
self.tabWidget.setCurrentIndex(1)
self.setStyleSheet("")
return
elif self.tabWidget.isEnabled:
self.setStyleSheet("QTableWidget::item{selection-color: #ffffff; selection-background-color: #0010cf;}")
pass
if not mod_info:
# There's no mods here, don't fill out mod list
# dialog = WarningWindow(self, "No mods! Add some mods with the \"Add mod\" button on the mods screen.")
# dialog.exec()
print("No mods! Add some mods with the \"Add mod\" button on the mods screen.")
return
row = 0
for info in mod_info:
# Make item
title_item = QtWidgets.QTableWidgetItem(info["title"])
title_item.setFlags(title_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled & ~Qt.ItemFlag.ItemIsEditable)
ver_item = QtWidgets.QTableWidgetItem(info["version"])
ver_item.setFlags(ver_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled)
auth_item = QtWidgets.QTableWidgetItem(info["author"])
auth_item.setFlags(auth_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled)
desc_item = QtWidgets.QTableWidgetItem(info["description"])
desc_item.setFlags(desc_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled)
title_item.setCheckState(is_mod_enabled(self.currentGameCombobox.currentText(), title_item.text()))
self.modsTableWidget.blockSignals(True)
self.modsTableWidget.setItem(row, 0, title_item)
self.modsTableWidget.setItem(row, 1, ver_item)
self.modsTableWidget.setItem(row, 2, auth_item)
self.modsTableWidget.setItem(row, 3, desc_item)
self.modsTableWidget.blockSignals(False)
row += 1
self.set_modbox_title("Loaded " + str(len(mod_entries)) + " mods.\n")
print("Loaded " + str(len(mod_entries)) + " mods.\n")
# FUNCTIONS
# This runs literally every time they click the window. I wish there was a better way to do this.
# def focusInEvent(self, event):
# # super().focusInEvent(event) # Call the base class implementation
# self.refresh_modsUI()
# pass
def change_tabstyle(self, tab_idx):
if tab_idx == 0:
# Mods tab needs this so entering data doesn't look doubled
self.setStyleSheet("QTableWidget::item{selection-color: #ffffff; selection-background-color: #0010cf;}")
else:
# Remove stylesheet/set to default if not this tab
self.setStyleSheet("")
pass
def open_mod_folder(self, item):
# Open the mod when the name in the GUI is clicked on
if item.column() != 0:
return
mod_title = item.data()
game_mod_dir = get_path_to_game_folder(self.currentGameCombobox.currentText())
gameID = os.path.basename(game_mod_dir)
path_to_mods_folder = os.path.join(game_mod_dir, Path(MOD_PACK_DIR.format(gameID)))
mod_to_open = os.path.join(path_to_mods_folder, mod_title)
if sys.platform == "win32":
os.startfile(mod_to_open)
else:
opener = "open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, mod_to_open])
pass
def update_modinfo_from_cell(self, item):
# Retrieve the related file by matching mod and game, then update whatever is needed
# item is the newly changed cell.
# Get the mod title from the left cell
curr_row = item.row()
curr_col = item.column()
mod_title = self.modsTableWidget.item(curr_row, 0).text()
column_titles = ["Title", "Version", "Author", "Description"]
value_changed = column_titles[curr_col]
game_mod_dir = get_path_to_game_folder(self.currentGameCombobox.currentText())
gameID = os.path.basename(game_mod_dir)
path_to_mods_folder = os.path.join(game_mod_dir, Path(MOD_PACK_DIR.format(gameID)))
mod_to_update = os.path.join(path_to_mods_folder, mod_title)
# Get the mod details of this mod and update it
set_config_option(MODINFO_INI, mod_to_update, "Desc", value_changed, new_value=item.text())
pass
def compile_mods(self):
compile_options_window = CompileModOptionsWindow()
if compile_options_window.exec():
# Handle options
if compile_options_window.zipModsRadioButton.isChecked():
# Get all active mod folders and zip them
path_to_directory = QFileDialog.getSaveFileName(self, caption="Save Mod archive")
# Ensure we have a path here, otherwise do nothing.
if path_to_directory[0]:
self.save_mods(export_mods=path_to_directory[0])
if compile_options_window.createISORadioButton.isChecked():
# path_to_directory = QFileDialog.getOpenFileName(self, caption="Select Mod Zip archive")
# # Ensure we have a path here, otherwise do nothing.
# if path_to_directory[0]:
# install_mod_by_folder(self.currentGameCombobox.currentText(), path_to_directory[0])
# Save the mods first, then run dolphintool to compile the output.
path_to_directory = QFileDialog.getSaveFileName(self, caption="Save Modded ISO")
if path_to_directory[0]:
self.save_mods()
create_iso_game_from_dolphin(path_to_directory[0], self.currentGameCombobox.currentText())
# compile_ISO_with_dolphin()
pass
if compile_options_window.createRVLPatchRadioButton.isChecked():
# path_to_directory = QFileDialog.getExistingDirectory(self, caption="Select Mod Folder")
# install_mod_by_folder(self.currentGameCombobox.currentText(), path_to_directory)
pass
self.refresh_modsUI()
return
pass
# About window
def about_window(self):
about_window = AboutWindow()
about_window.exec()
pass
def toggle_checkbox_settings(self, checked):
save_checkbox_settings(self.sender().text(), checked)
pass
def toggle_play_behavior(self, checked):
set_play_behavior(self.sender().text(), checked)
pass
# Installs mods
def install_mod(self):
install_options_window = AddModFromOptionsWindow()
if install_options_window.exec():
# Handle options
if install_options_window.createModRadioButton.isChecked():
create_mod_processing(self.currentGameCombobox.currentText())
if install_options_window.installFolderRadioButton.isChecked():
path_to_directory = QFileDialog.getOpenFileName(self, caption="Select Mod Zip archive")
# Ensure we have a path here, otherwise do nothing.
if path_to_directory[0]:
install_mod_by_folder(self.currentGameCombobox.currentText(), path_to_directory[0])
pass
if install_options_window.installArchiveRadioButton.isChecked():
# path_to_directory = QFileDialog.getExistingDirectory(self, caption="Select Mod Folder")
# install_mod_by_folder(self.currentGameCombobox.currentText(), path_to_directory)
pass
self.refresh_modsUI()
return
pass
# Handles text display for info
def set_modbox_title(self, text):
self.modsBox.setTitle(text)
pass
# Wrap save mods and start the dolphin game selected
def save_and_start_game(self):
self.save_mods()
start_dolphin_game(self.currentGameCombobox.currentText())
pass
def save_mods(self, export_mods=None):
# Save ALL activated mod databases here
# If there are NO MODS, do NOT let them save.
# Thanks dreamsyntax for testing that I cannot believe I didn't think of that.
if self.modsTableWidget.rowCount() == 0:
dialog = WarningWindow(self, title="No mods in mod list.", warning_text="No mods to save!\nInstall or create some mods first with the \"Add Mod\" button.")
if dialog.exec():
return
else:
return
# So instead of getting enabled mods, get the mods that are checked, from top to bottom
# Reconstruct our DB (yes, fully with new GUIDs)
game_mod_dir = get_path_to_game_folder(self.currentGameCombobox.currentText())
path_to_mods_db = os.path.join(game_mod_dir, MODSDB_INI)
generate_modsDB_ini(path_to_mods_db, force_overwrite=True)
gameID = os.path.basename(game_mod_dir)
set_modsDB(modsDB_data=path_to_mods_db, path_to_gamemod_folder=game_mod_dir, gameID=gameID)
# Now add our checked mods as active mods
checked_mods = []
for index in range(self.modsTableWidget.rowCount()):
# Get current mod and see if checked
current_item = self.modsTableWidget.item(index, 0)
# If checked, add to our modsDB and append to our table
if current_item.checkState() == QtCore.Qt.CheckState.Checked:
has_been_enabled, mod_GUID = enable_mod(self.currentGameCombobox.currentText(), current_item.text(), return_GUID=True)
if has_been_enabled:
# Changed this to append GUIDs instead, so we can just filter those in order
# checked_mods.append(current_item.text())
checked_mods.append(mod_GUID)
pass
pass
# For now, this ensures that everything at the top of the list is prioritized. We will make this a toggle later.
checked_mods.reverse()
save_mods_to_modded_game(checked_mods, self.currentGameCombobox.currentText())
if export_mods:
zip_mods_processing(checked_mods, self.currentGameCombobox.currentText(), Path(export_mods))
self.refresh_modsUI()
return
def get_checked_mod(self, item):
if item.column() != 0:
# For QTableView, do NOT make anything checkable here.
return
if item.checkState() == QtCore.Qt.CheckState.Checked:
# REMOVED: handled at save_mods()
# print(item.text() + " checked. Loading...")
# Make this ASYNC
# self.set_modbox_title(item.text() + " checked. Loading...")
# Enable mod:
# 1. Get mod path
# 2. Generate DB
# 3. Add to active mod list
# enable_mod(self.currentGameCombobox.currentText(), item.text())
self.set_modbox_title(item.text() + " enabled.\n")
else:
# REMOVED: handled at save_mods()
# print(item.text() + " unchecked. Loading...")
# Make this ASYNC
# self.set_modbox_title(item.text() + " unchecked. Loading...")
# disable_mod(self.currentGameCombobox.currentText(), item.text())
self.set_modbox_title(item.text() + " disabled.\n")
pass
return
def refresh_modsUI(self):
# Check game title, then check mod entries for game
# TODO: rework this into a function
self.tabWidget.setTabEnabled(0, True)
mod_entries, mod_info = populate_modlist(self.currentGameCombobox.currentText())
# If game isn't found, repopulate game list and remove from our settings.ini
if "INVALID_ENTRIES" in mod_entries:
self.currentGameCombobox.clear()
self.currentGameCombobox.addItems(update_gamelist_combobox())
self.refresh_modsUI() # Refresh one more time with the game at the top of the list before ending
return
self.set_modbox_title("Loading " + str(len(mod_entries)) + " mods...")
column_titles = ["Title", "Version", "Author", "Features"]
self.modsTableWidget.setRowCount(len(mod_entries))
self.modsTableWidget.setColumnCount(4)
self.modsTableWidget.setHorizontalHeaderLabels(column_titles)
self.modsTableWidget.verticalHeader().setVisible(False)
self.modsTableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.modsTableWidget.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
self.modsTableWidget.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.modsTableWidget.setDragDropOverwriteMode(False)
# self.modsTableWidget.itemChanged.connect(self.update_modinfo_from_cell)
row = 0
for info in mod_info:
# Make item
title_item = QtWidgets.QTableWidgetItem(info["title"])
title_item.setFlags(title_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled & ~Qt.ItemFlag.ItemIsEditable)
ver_item = QtWidgets.QTableWidgetItem(info["version"])
ver_item.setFlags(ver_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled)
auth_item = QtWidgets.QTableWidgetItem(info["author"])
auth_item.setFlags(auth_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled)
desc_item = QtWidgets.QTableWidgetItem(info["description"])
desc_item.setFlags(desc_item.flags() & ~Qt.ItemFlag.ItemIsDropEnabled)
title_item.setCheckState(is_mod_enabled(self.currentGameCombobox.currentText(), title_item.text()))
self.modsTableWidget.blockSignals(True)
self.modsTableWidget.setItem(row, 0, title_item)
self.modsTableWidget.setItem(row, 1, ver_item)
self.modsTableWidget.setItem(row, 2, auth_item)
self.modsTableWidget.setItem(row, 3, desc_item)
self.modsTableWidget.blockSignals(False)
row += 1
# Note: move this modbox title set somewhere else, so I can show how many are saved
print("Loaded " + str(len(mod_entries)) + " mods.\n")
self.set_modbox_title("Loaded " + str(len(mod_entries)) + " mods.\n")
pass
# Opens the directory for these
def open_directory(self):
sent_button = self.sender()
if sent_button == self.openModsPushbutton:
if sys.platform == "win32":
os.startfile(get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"modsdir"))
else:
opener = "open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"modsdir")])
if sent_button == self.openDolphinPushbutton:
if sys.platform == "win32":
os.startfile(get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"dolphindir"))
else:
opener = "open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, get_config_option(SETTINGS_INI,
"config",
"LauncherLoader",
"dolphindir")])
pass
# Sets a directory into the correct config file for later use, update text box
def set_directory(self):
sent_button = self.sender()
if sent_button == self.modsDirToolbutton:
path_to_directory = QFileDialog.getExistingDirectory(self, caption="Select Mod Directory", options=QFileDialog.Option.ShowDirsOnly)
if not path_to_directory:
return
plaintext = set_up_directory(path_to_directory, 'modsdir')
self.modsDirPathField.setPlainText(plaintext)
elif sent_button == self.dolphinDirToolbutton:
path_to_directory = QFileDialog.getExistingDirectory(self, caption="Select Dolphin Directory", options=QFileDialog.Option.ShowDirsOnly)
if not path_to_directory:
return
self.dolphinDirPathField.setPlainText(set_up_directory(path_to_directory, 'dolphindir'))
elif sent_button == self.pluginsDirToolbutton:
path_to_directory = QFileDialog.getExistingDirectory(self, caption="Select Plugins Directory", options=QFileDialog.Option.ShowDirsOnly)
if not path_to_directory:
return
self.pluginsDirPathField.setPlainText(set_up_directory(path_to_directory, 'pluginsdir'))
pass
# Adds a new game or refreshes the mods list view for the new game chosen
def game_combo_box_option_select(self):
selected_item = self.currentGameCombobox.currentText()
if selected_item == "Add new game here":
path_to_new_game = QFileDialog.getOpenFileName(self, caption="Select Game", filter="Games (*.iso)")
try:
gameID, gameTitle = add_new_game_from_dolphin(path_to_new_game[0])
except Exception as e:
print("No file selected. Please select a game.\n")
gameID = None
gameTitle = None
if gameID is None and gameTitle is None:
return
# Checks if game is already in list to prevent duplicates
AllItems = [self.currentGameCombobox.itemText(i) for i in range(self.currentGameCombobox.count())]
gameTitle = gameTitle.replace(" ", "")
if gameTitle.lower() not in AllItems:
# Add this game title to settings.ini, set box to new title
# gameTitle MUST BE ONE CONTINUOUS STRING TO WORK IN INI
# gameTitle = gameTitle.replace(" ", "")
self.currentGameCombobox.insertItem(0, gameTitle.lower())
set_config_option(SETTINGS_INI,
path_to_config=os.path.join(os.getcwd(), "config"),
section_to_write="GameList",
option_to_write=gameTitle,
new_value=gameID)
self.currentGameCombobox.setCurrentText(gameTitle.lower())
self.refresh_modsUI()
else:
# Profile changed, update mod list here
self.refresh_modsUI()
pass
# Runs our main window here, executed from main.py
def run_main_window_loop():
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()