forked from MineClone5/MineClone5
add the python script to get the informations from the user with the gui
This commit is contained in:
parent
c184202c7c
commit
bce95a3ddc
|
@ -0,0 +1,83 @@
|
|||
__author__ = "chmodsayshello"
|
||||
__license__ = "GPLv3" #For Devs: Edit this File however you want, just make sure to always provide the source code, but its python, so...
|
||||
|
||||
#Note1: old and new is meant for mc versions, not for values that are outdated
|
||||
|
||||
from PyQt5 import QtWidgets, uic,QtGui
|
||||
from PyQt5.QtWidgets import QFileDialog, QMessageBox
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
class Ui(QtWidgets.QMainWindow):
|
||||
def __init__(self):
|
||||
super(Ui, self).__init__()
|
||||
uic.loadUi('gui.ui', self) #instead of having a lot of lines, i have a file that contains the gui, another pro of it it can be edited easily, using qtdesigner, cons: you need qtdesigner for that
|
||||
import Texture_Converter as tc # I HAVE to import it this late because else it would change the current path the programms runs from before loading some important files
|
||||
def patholdmcversion():
|
||||
global oldpath
|
||||
oldpath = QFileDialog.getExistingDirectory(
|
||||
None,
|
||||
"Select 1.12 Texture Pack folder",
|
||||
"",
|
||||
QFileDialog.ShowDirsOnly
|
||||
)
|
||||
self.old_path.insert(oldpath)
|
||||
|
||||
def pathnewmcversion():
|
||||
global newpath
|
||||
newpath = QFileDialog.getExistingDirectory(
|
||||
None,
|
||||
"Select 1.18 Texture Pack folder",
|
||||
"",
|
||||
QFileDialog.ShowDirsOnly
|
||||
)
|
||||
self.new_path.insert(newpath)
|
||||
|
||||
|
||||
msg = QMessageBox() #Required Code to show nice Messages to the user
|
||||
msg.setIcon(QMessageBox.Information)
|
||||
|
||||
|
||||
def clicked(): #This is what happends when the user clicks start
|
||||
resulution = self.resu.value()#Resulution of the texture pack
|
||||
if self.radbutboth.isChecked():#checking which convertion option the user choose
|
||||
name = self.Name.text()
|
||||
tc.init(2, newpath, resulution, name)#The convertion process
|
||||
tc.convertit()
|
||||
tc.init(1,oldpath, resulution, name)
|
||||
tc.convertit()
|
||||
msg.setWindowTitle("Information")
|
||||
msg.setText("Done! Enjoy your new Texture Pack ;)")
|
||||
msg.exec_()
|
||||
self.close()
|
||||
else:
|
||||
if self.radbutnew.isChecked():
|
||||
name = self.Name.text()
|
||||
tc.init(2, newpath, resulution, name)
|
||||
tc.convertit()
|
||||
msg.setWindowTitle("Information")
|
||||
msg.setText("Done! Enjoy your new Texture Pack ;)")
|
||||
msg.exec_()
|
||||
self.close()
|
||||
else:
|
||||
if self.radbutold.isChecked():
|
||||
name = self.Name.text()
|
||||
tc.init(1,oldpath, resulution, name)
|
||||
msg.setWindowTitle("Information")
|
||||
msg.setText("Done! Enjoy your new Texture Pack ;)")
|
||||
msg.exec_()
|
||||
self.close()
|
||||
|
||||
|
||||
self.start.clicked.connect(clicked)#Event Handler for the button
|
||||
self.brosweold.clicked.connect(patholdmcversion)#For the upper Broswe Files button
|
||||
self.broswe_new.clicked.connect(pathnewmcversion)#For the lower Broswe Files button
|
||||
self.show()
|
||||
|
||||
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
window = Ui()
|
||||
app.exec_()
|
||||
|
Loading…
Reference in New Issue