Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability improvements #3

Merged
merged 13 commits into from
Apr 16, 2023
24 changes: 12 additions & 12 deletions src/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,24 @@
],
"executable": "gzdoom"
},
"PrBoom+": {
"link": "https://github.com/coelckers/prboom-plus/releases/latest",
"description": "\"Modified PrBoom port with uncapped framerate, variable gamespeed, re-record, walkcam, chasecam, full mouselook, fov and other features without loss of compatibility with original DOOM.\"",
"games": ["Doom", "Doom II", "Final Doom", "Chex Quest"],
"executable": "prboom-plus"
},
"Doom Retro": {
"link": "https://github.com/bradharding/doomretro/releases/latest",
"description": "\"Strive[s] to craft a unique ensemble of compelling features, while always respecting that classic, nostalgic DOOM experience[...]\"",
"games": ["Doom", "Doom II", "Final Doom", "Chex Quest", "HacX"],
"executable": "doomretro"
},
"Crispy Doom": {
"link": "http://latest.chocolate-doom.org/",
"description": "\"A friendly fork of Chocolate Doom that provides a higher display resolution, [...] and offers further optional visual, tactical and physical enhancements\"",
"games": ["Doom", "Doom II", "Final Doom", "Chex Quest"],
"executable": "crispy-doom"
},
"Chocolate Doom": {
"link": "http://latest.chocolate-doom.org/",
"description": "\"Doom source port that accurately reproduces the experience of Doom as it was played in the 1990s.\"",
Expand All @@ -445,17 +457,5 @@
"description": "\"Doom source port that accurately reproduces the experience of Doom as it was played in the 1990s.\"",
"games": ["Strife"],
"executable": "chocolate-strife"
},
"Crispy Doom": {
"link": "http://latest.chocolate-doom.org/",
"description": "\"A friendly fork of Chocolate Doom that provides a higher display resolution, [...] and offers further optional visual, tactical and physical enhancements\"",
"games": ["Doom", "Doom II", "Final Doom", "Chex Quest"],
"executable": "crispy-doom"
},
"PrBoom+": {
"link": "https://github.com/coelckers/prboom-plus/releases/latest",
"description": "\"Modified PrBoom port with uncapped framerate, variable gamespeed, re-record, walkcam, chasecam, full mouselook, fov and other features without loss of compatibility with original DOOM.\"",
"games": ["Doom", "Doom II", "Final Doom", "Chex Quest"],
"executable": "prboom-plus"
}
}
50 changes: 50 additions & 0 deletions src/first_run_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Shows window on first run"""
import platform
import sys
import logging
from PySide6 import QtWidgets, QtGui

class FirstRun(QtWidgets.QDialog):
"""Shows window on first run"""
def __init__(self, parent):
super().__init__(parent=parent)
parent = self.parent()
self.setModal(True)
# self.status = self.statusBar()
self.logger = logging.getLogger("Main window")
if "--debug" in sys.argv:
self.logger.setLevel(logging.DEBUG)
self.logger.debug("Debug mode")
self.platform = platform.system()
addGameButton = QtWidgets.QPushButton("Add Games")
addPortButton = QtWidgets.QPushButton("Add Source Port")
importButton = QtWidgets.QPushButton("Import Modpack")
mainLayout = QtWidgets.QVBoxLayout()
mainLayout.addWidget(QtWidgets.QLabel("Right now, this launcher only supports Doom (1 and 2) based games."))
mainLayout.addWidget(QtWidgets.QLabel("You can start by adding a folder with games (Doom 3 BFG and Doom Eternal installs work): "))
mainLayout.addWidget(addGameButton, 0, QtGui.Qt.AlignRight)
mainLayout.addWidget(QtWidgets.QLabel("Choose a source port to run the game with: "))
mainLayout.addWidget(addPortButton, 0, QtGui.Qt.AlignRight)
mainLayout.addWidget(QtWidgets.QLabel("If you have a modpack, you can import it here: "))
mainLayout.addWidget(importButton, 0, QtGui.Qt.AlignRight)

addGameButton.clicked.connect(parent.gameScanner)
addPortButton.clicked.connect(parent.showRunnerList)
importButton.clicked.connect(parent.importModpack)

self.setLayout(mainLayout)

def closeEvent(self, event: QtGui.QCloseEvent) -> None:
"""Close"""
self.deleteLater()
return super().closeEvent(event)

def showWindow(self):
"""Open window and set size/location"""
self.resize(400,300)
mainLocation = self.parent().frameGeometry()
x = mainLocation.x() + mainLocation.width() / 2 - self.width() / 2
y = mainLocation.y() + mainLocation.height() / 2 - self.height() / 2
self.move(x, y)
self.setWindowTitle("Welcome")
self.show()
2 changes: 1 addition & 1 deletion src/games_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, parent):
self.logger.debug("Building game list")
match platform.system():
case "Windows":
self.settings = QtCore.QSettings("fullerSpectrum", "Boomer Shooter Launcher")
self.settings = QtCore.QSettings("Isaiah Fuller", "Boomer Shooter Launcher")
case "Linux":
self.settings = QtCore.QSettings("boomershooterlauncher", "config")

Expand Down
72 changes: 41 additions & 31 deletions src/import_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import webbrowser
import platform
import qtawesome as qta
from PySide6 import QtCore, QtWidgets, QtGui

class ModsImport(QtWidgets.QMainWindow):
Expand All @@ -19,32 +20,57 @@ def __init__(self, parent, data):
match platform.system():
case "Windows":
self.settings = QtCore.QSettings(
"fullerSpectrum", "Boomer Shooter Launcher")
"Isaiah Fuller", "Boomer Shooter Launcher")
case "Linux":
self.settings = QtCore.QSettings(
"boomershooterlauncher", "config")

mainLayout = QtWidgets.QVBoxLayout()
self.modList = QtWidgets.QListWidget()
self.modList = QtWidgets.QTableWidget()
scroll = QtWidgets.QScrollArea()
modInfo = QtWidgets.QGridLayout()

scroll.setWidgetResizable(True)
scroll.setLayout(mainLayout)
self.modList.setColumnCount(3)
self.modList.setHorizontalHeaderLabels(["Name", "Source", "Path"])
self.modList.setAlternatingRowColors(True)
self.modList.setWordWrap(True)
self.modList.verticalHeader().setVisible(False)
self.modList.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
self.modList.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.modList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)

header = self.modList.horizontalHeader()
header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)

mainLayout.addLayout(modInfo)
mainLayout.addWidget(self.modList)
self.name = data["name"]
self.base = data["base"]
mods = data["mods"]
self.modList.setRowCount(len(mods))
self.loadedCount = 0
modInfo.setAlignment(QtCore.Qt.AlignTop)
modInfo.addWidget(QtWidgets.QLabel(f"Name: {self.name}"), 0, 0)
modInfo.addWidget(QtWidgets.QLabel(f"Base: {self.base}"), 0, 1)
modInfo.addWidget(QtWidgets.QLabel(f"Base Game: {self.base}"), 1, 0)
self.mods = {}
count = 0
greenCheck = qta.icon("fa5s.check", color="green")
redXmark = qta.icon("fa5s.times", color="red")
for e in mods:
self.modList.addItem("❌"+e["name"])
self.modList.setItem(count,0,QtWidgets.QTableWidgetItem(e["name"]))
if len(e["source"]) > 0:
source = QtWidgets.QTableWidgetItem(greenCheck,"")
else:
source = QtWidgets.QTableWidgetItem(redXmark,"")
source.setToolTip(e["source"])
self.modList.setItem(count,1,source)
self.mods[e["name"]] = { "source": e["source"], "found": False, "path": None}
count+=1
count = None
self.downloadButton = QtWidgets.QPushButton("Download", self)
self.browseButton = QtWidgets.QPushButton("Browse", self)
self.finishButton = QtWidgets.QPushButton("Finish", self)
Expand All @@ -61,7 +87,7 @@ def __init__(self, parent, data):
self.browseButton.clicked.connect(self.addModFile)
self.downloadButton.clicked.connect(self.downloadMod)
self.finishButton.clicked.connect(self.saveModpack)
self.modList.currentRowChanged.connect(self.selectedModChanged)
self.modList.currentCellChanged.connect(self.selectedModChanged)

self.setCentralWidget(scroll)
self.setAcceptDrops(True)
Expand Down Expand Up @@ -90,38 +116,32 @@ def closeEvent(self, event: QtGui.QCloseEvent) -> None:
def addDroppedModFile(self, file):
"""Add mod file to list"""
fileName = file.split("/")[-1]
for i in range(self.modList.count()):
if "❌" in self.modList.item(i).text():
text = self.modList.item(i).text().split("❌")[-1]
else:
text = self.modList.item(i).text().split("✔")[-1]
for i in range(len(self.mods)):
text = self.modList.item(i,0).text()
if text == fileName:
if not self.mods[text]["found"]:
self.loadedCount+=1
self.mods[text]["found"] = True
self.mods[text]["path"] = file
self.logger.debug(f"Setting {text} Path: {self.mods[text]['path']}")
self.modList.item(i).setText("✔"+text)
self.modList.setItem(i,2,QtWidgets.QTableWidgetItem(file))
self.updateStatus()
break

def addModFile(self):
"""Adds mod to list"""
chooser = QtWidgets.QFileDialog(self)
chooser.setFileMode(QtWidgets.QFileDialog.ExistingFiles)
currentItem = self.modList.currentItem()
if "❌" in currentItem.text():
currentText = currentItem.text().split("❌")[-1]
else:
currentText = currentItem.text().split("✔")[-1]
currentText = self.modList.item(self.modList.currentRow(),0).text()
chooser.setNameFilter(f"{currentText} (*).{currentText.split('.')[-1]}")
if chooser.exec():
modFile = chooser.selectedFiles()[0]
self.mods[currentText]["path"] = modFile
if not self.mods[currentText]["found"]:
self.loadedCount+=1
self.mods[currentText]["found"] = True
currentItem.setText("✔"+currentText)
newPath = QtWidgets.QTableWidgetItem(modFile)
self.modList.setItem(self.modList.currentRow(),2,newPath)
self.updateStatus()

def updateStatus(self):
Expand All @@ -132,11 +152,7 @@ def updateStatus(self):

def selectedModChanged(self, currentRow):
"""Updates vars on change"""
currentItem = self.modList.item(currentRow).text()
if "❌" in currentItem:
currentItem = currentItem.split("❌")[-1]
else:
currentItem = currentItem.split("✔")[-1]
currentItem = self.modList.item(currentRow,0).text()
self.browseButton.setDisabled(False)
if len(self.mods[currentItem]["source"]) > 0:
self.downloadButton.setDisabled(False)
Expand All @@ -145,14 +161,8 @@ def selectedModChanged(self, currentRow):

def downloadMod(self):
"""Opens download page in default web browser"""
currentItem = self.modList.currentItem().text()
if "❌" in currentItem:
currentText = currentItem.split("❌")[-1]
else:
currentText = currentItem.split("✔")[-1]
url = self.mods[currentText]["source"]
self.logger.info(f"Opening broswer to: {url}")
webbrowser.open(url)
currentItem = self.modList.item(self.modList.currentRow(),1).toolTip()
webbrowser.open(currentItem)

def saveModpack(self):
"""Saves modpack to registry and closes window"""
Expand All @@ -173,7 +183,7 @@ def saveModpack(self):

def showWindow(self):
"""Open window and set size/location"""
self.resize(400,400)
self.resize(700,500)
mainLocation = self.parent().frameGeometry()
x = mainLocation.x() + mainLocation.width() / 2 - self.width() / 2
y = mainLocation.y() + mainLocation.height() / 2 - self.height() / 2
Expand Down
5 changes: 3 additions & 2 deletions src/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, parent):
self.logger = logging.getLogger("Launcher")
match platform.system():
case "Windows":
self.settings = QtCore.QSettings("fullerSpectrum", "Boomer Shooter Launcher")
self.settings = QtCore.QSettings("Isaiah Fuller", "Boomer Shooter Launcher")
case "Linux":
self.settings = QtCore.QSettings("boomershooterlauncher", "config")
self.runner = None
Expand All @@ -39,8 +39,9 @@ def runGame(self, game, gamePath, runner, otherFiles):
filteredTitle = "".join(x for x in filteredTitle if x not in "\/:*?<>|\"")
self.settings.endGroup()
spArray = [str(runnerPath), "-iwad", gamePath]
for i in otherFiles:
if len(otherFiles) > 0:
spArray.append("-file")
for i in otherFiles:
spArray.append(i)
match platform.system():
case "Windows": runPath = Path(Path.home(), "AppData", "Roaming",
Expand Down
Loading