GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit f1c4f578 authored by modos189's avatar modos189
Browse files

исправление ошибки если при мервом запуске программы майнкрафт уже установлен

parent 2472f645
......@@ -174,49 +174,49 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def updateListMods(self):
self.listWidget_2.clear()
self.tab_2.setEnabled(True)
try:
mods_list_package = ConfigParser.ConfigParser()
mods_list_package.read(pth+'.mpm_cache'+s+mods_list_file)
self.listWidget_2.clear()
i=0
for line in mods_list_package.sections():
QtGui.QListWidgetItem(self.listWidget_2)
self.listWidget_2.item(i).setText(
QtGui.QApplication.translate("MainWindow", line,
None, QtGui.QApplication.UnicodeUTF8))
if (mods_list_package.has_option(line, 'in_mods') or mods_list_package.has_option(line, 'in_jar')):
print line
if (mods_list_package.has_option(line, 'in_mods')):
if (mods_list_package.get(line, 'in_mods')=='<THIS>'):
in_mods = mods_list_package.get(line, 'filename')
else:
in_mods = re.sub('.*?\/', '', mods_list_package.get(line, 'in_mods'))
print in_mods
if ((mods_list_package.has_option(line, 'in_mods') and
in_mods!='' and os.path.exists(pth+dtm+s+'mods'+s+in_mods)) or
(mods_list_package.has_option(line, 'mc_loader') and
os.path.exists(pth+dtm+s+'bin'+s+'minecraft.jar'+s+mods_list_package.get(line, 'mc_loader')))):
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(ich+"icons"+s+"tick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.listWidget_2.item(i).setIcon(icon1)
elif ((mods_list_package.has_option(line, 'in_mods') and
os.path.exists(pth+dtm+s+'mods'+s+in_mods+'.off')) or
(mods_list_package.has_option(line, 'mc_loader') and
os.path.exists(pth+dtm+s+'bin'+s+'minecraft.jar'+s+mods_list_package.get(line, 'mc_loader')+'.off'))):
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(ich+"icons"+s+"cross.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.listWidget_2.item(i).setIcon(icon1)
i+=1
except NameError:
pass
QtCore.QCoreApplication.processEvents()
if minecraft_version!='':
self.tab_2.setEnabled(True)
try:
mods_list_package = ConfigParser.ConfigParser()
mods_list_package.read(pth+'.mpm_cache'+s+mods_list_file)
self.listWidget_2.clear()
i=0
for line in mods_list_package.sections():
QtGui.QListWidgetItem(self.listWidget_2)
self.listWidget_2.item(i).setText(
QtGui.QApplication.translate("MainWindow", line,
None, QtGui.QApplication.UnicodeUTF8))
if (mods_list_package.has_option(line, 'in_mods') or mods_list_package.has_option(line, 'in_jar')):
print line
if (mods_list_package.has_option(line, 'in_mods')):
if (mods_list_package.get(line, 'in_mods')=='<THIS>'):
in_mods = mods_list_package.get(line, 'filename')
else:
in_mods = re.sub('.*?\/', '', mods_list_package.get(line, 'in_mods'))
print in_mods
if ((mods_list_package.has_option(line, 'in_mods') and
in_mods!='' and os.path.exists(pth+dtm+s+'mods'+s+in_mods)) or
(mods_list_package.has_option(line, 'mc_loader') and
os.path.exists(pth+dtm+s+'bin'+s+'minecraft.jar'+s+mods_list_package.get(line, 'mc_loader')))):
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(ich+"icons"+s+"tick.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.listWidget_2.item(i).setIcon(icon1)
elif ((mods_list_package.has_option(line, 'in_mods') and
os.path.exists(pth+dtm+s+'mods'+s+in_mods+'.off')) or
(mods_list_package.has_option(line, 'mc_loader') and
os.path.exists(pth+dtm+s+'bin'+s+'minecraft.jar'+s+mods_list_package.get(line, 'mc_loader')+'.off'))):
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(ich+"icons"+s+"cross.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.listWidget_2.item(i).setIcon(icon1)
i+=1
except:
pass
def updateListClients(self):
self.listWidget.clear()
......@@ -446,6 +446,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
error = QtGui.QApplication.translate("Initializing",
"You must install Minecraft of MPM", None,
QtGui.QApplication.UnicodeUTF8)
self.loliminecraft()
self.updateListClients()
self.tab_2.setEnabled(False)
if os.path.exists(pth+'.mpm_cache'+s+'config.ini'):
config = ConfigParser.ConfigParser()
......@@ -472,7 +475,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QApplication.UnicodeUTF8)+' '+minecraft_version)
self.lolimods()
self.updateListMods()
else:
if os.path.exists(pth+dtm+s+u'bin'+s+'minecraft.jar'):
......@@ -490,9 +492,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
second_window = User_hello(parent=self)
second_window.show()
self.loliminecraft()
self.updateListClients()
# load lists
def loliminecraft(self):
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment