1
0
Fork 0
mirror of synced 2024-06-23 08:40:45 +12:00
Rare/Rare/utils/Dialogs/InstallDialog.py

39 lines
1.2 KiB
Python
Raw Normal View History

2021-02-10 23:48:25 +13:00
import os
from PyQt5.QtWidgets import QDialog, QFormLayout, QVBoxLayout, QSpinBox, QFileDialog, QLabel, QPushButton, QHBoxLayout
from Rare.utils.QtExtensions import PathEdit
class InstallDialog(QDialog):
def __init__(self):
super(InstallDialog, self).__init__()
self.layout = QVBoxLayout()
self.form = QFormLayout()
default_path = os.path.expanduser("~/legendary")
#TODO read from config
self.install_path_field = PathEdit(text=default_path, type_of_file=QFileDialog.DirectoryOnly)
self.form.addRow(QLabel("Install directory"), self.install_path_field)
self.max_workes = QSpinBox()
self.form.addRow(QLabel("Max workers"), self.max_workes)
self.layout.addLayout(self.form)
self.ok = QPushButton("Install")
self.cancel = QPushButton("Cancel")
self.button_layout = QHBoxLayout()
self.button_layout.addStretch(1)
self.button_layout.addWidget(self.ok)
self.button_layout.addWidget(self.cancel)
self.layout.addLayout(self.button_layout)
self.setLayout(self.layout)
def get_information(self):
self.exec_()
return self.install_path_field.text(), self.max_workes.value()