Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #In the name of Allah
- import sys, codecs, platform, os, subprocess
- from subprocess import check_call
- from PyQt4 import QtCore, QtGui, uic
- from PyQt4.QtGui import *
- def isl32b():
- dir = os.getcwd() + "\\AppData\\py2exe-0.9.2.0.win32.exe"
- print(subprocess.Popen(dir, shell = True, stdout = subprocess.PIPE).stdout.read())
- def isl64b():
- dir = os.getcwd() + "\\AppData\\py2exe-0.9.2.0.win-amd64.exe"
- print(subprocess.Popen(dir, shell = True, stdout = subprocess.PIPE).stdout.read())
- fc1 = uic.loadUiType("Appdata\\pg1.ui")[0]
- fc2 = uic.loadUiType("Appdata\\pg2.ui")[0]
- class Pg1(QtGui.QMainWindow, fc1):
- def __init__(slf, prt = None):
- QtGui.QMainWindow.__init__(slf, prt)
- slf.setupUi(slf)
- slf.Pb1.clicked.connect(slf.islp2x)
- def islp2x(slf):
- if "64" in platform.architecture()[0]:
- isl64b()
- else:
- isl32b()
- ise = rbn = qti = False
- class Pg2(QtGui.QMainWindow, fc2):
- def __init__(slf, prt = None):
- QtGui.QMainWindow.__init__(slf, prt)
- slf.setupUi(slf)
- slf.Pb1.clicked.connect(slf.Min)
- slf.Pb4.clicked.connect(slf.Min)
- slf.Cbx.currentIndexChanged.connect(slf.Ovs)
- slf.Rb1.released.connect(slf.smd1)
- slf.Rb2.released.connect(slf.smd2)
- slf.CHb.released.connect(slf.pyq)
- slf.Pbr.setValue(0)
- slf.Pb3.clicked.connect(slf.oer)
- oer = lambda slf:check_call("explorer dist", shell = True)
- def pyq(slf):
- global qti
- qti = not qti
- def smd1(slf):
- global rbn
- rbn = True
- def smd2(slf):
- global rbn
- rbn = False
- def Min(slf):
- VRS = slf.Cbx.currentText()
- if VRS == "\u0646\u0633\u062e\u0647 \u0647\u0627\u06cc \u062f\u06cc\u06af\u0631":
- VRS = slf.Let.text()
- Fwr = open("setup.py", "w")
- FNM = QFileDialog.getOpenFileName()
- Fwr.write("from distutils.core import setup\nimport py2exe\nsetup(console = [" + ascii("\\".join(FNM.split("/"))) + "])")
- Fwr.close()
- global ise, qti
- if ise or not rbn:
- slf.Pbr.setValue(10)
- check_call("py setup.py install", shell = True)
- slf.Pbr.setValue(44)
- ils = " --includes sip"
- check_call("py setup.py py2exe" + ils * qti, shell = True)
- slf.Pbr.setValue(100)
- else:
- slf.Pbr.setValue(10)
- check_call("py -" + str(VRS) + " setup.py install", shell = True)
- slf.Pbr.setValue(45)
- ils = " --includes sip"
- check_call("py -" + str(VRS) + " setup.py py2exe" + ils * qti, shell = True)
- slf.Pbr.setValue(100)
- def Ovs(slf):
- global ise
- if slf.Cbx.currentText() == "\u0646\u0633\u062e\u0647 \u0647\u0627\u06cc \u062f\u06cc\u06af\u0631":
- slf.Lb2.setEnabled(True)
- slf.Let.setEnabled(True)
- ise = True
- elif ise:
- slf.Lb2.setEnabled(False)
- slf.Let.setEnabled(False)
- ise = False
- app = QtGui.QApplication(sys.argv)
- def Exc(win):
- mwn = win(None)
- mwn.show()
- app.exec_()
- Exc(Pg1)
- Exc(Pg2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement