Skip to content

Commit

Permalink
Changed name to deltamc
Browse files Browse the repository at this point in the history
  • Loading branch information
williambl committed Aug 26, 2017
1 parent c175296 commit 2c95c46
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 138 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# CMAN
# DeltaMC

![Badge](https://img.shields.io/github/downloads/comprehensive-minecraft-archive-network/CMAN-Python/total.svg)

Comprehensive Minecraft Archive Network

Licenced under the GPL v3

Have a mod on the CMAN? Add one of these to your forum page so that everyone knows!
Have a mod on DeltaMC? Add one of these to your forum page so that everyone knows!

![Badge](https://img.shields.io/badge/CMAN-Indexed-green.svg)
![Badge](https://img.shields.io/badge/DeltaMC-Indexed-green.svg)

![Badge](https://img.shields.io/badge/CMAN-Indexed-green.svg?style=flat-square)
![Badge](https://img.shields.io/badge/DeltaMC-Indexed-green.svg?style=flat-square)

![Badge](https://img.shields.io/badge/CMAN-Indexed-green.svg?style=plastic)
![Badge](https://img.shields.io/badge/DeltaMC-Indexed-green.svg?style=plastic)

Proudly supporting [#StopModReposts](http://www.stopmodreposts.org)!

Expand Down
74 changes: 37 additions & 37 deletions CMAN_gui.py → delta_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import zipfile
import argparse
import tkinter as tk
import CMAN_remove
import CMAN_upgrade
import CMAN_install
import CMAN_importexport
import delta_remove
import delta_upgrade
import delta_install
import delta_importexport
import tkinter.messagebox as msgbox
import tkinter.simpledialog as dialogs
import tkinter.filedialog as filedialogs
from CMAN_util import *
from delta_util import *

modfolder = "@ERROR@"
jarfolder = "@ERROR@"
Expand All @@ -37,10 +37,10 @@ def gui_setup_config(_instance):
modfolder, jarfolder, mc_version = read_config(_instance) #gets config stuff
os.chdir(execdir)
init_config_util((modfolder, jarfolder, mc_version, execdir, instance, gui)) #transferring config data (and Tkinter instance) to all files
CMAN_install.init_config_install((modfolder, jarfolder, mc_version, execdir, instance, gui))
CMAN_remove.init_config_remove((modfolder, jarfolder, mc_version, execdir, instance, gui))
CMAN_upgrade.init_config_upgrade((modfolder, jarfolder, mc_version, execdir, instance, gui))
CMAN_importexport.init_config_importexport((modfolder, jarfolder, mc_version, execdir, instance, gui))
delta_install.init_config_install((modfolder, jarfolder, mc_version, execdir, instance, gui))
delta_remove.init_config_remove((modfolder, jarfolder, mc_version, execdir, instance, gui))
delta_upgrade.init_config_upgrade((modfolder, jarfolder, mc_version, execdir, instance, gui))
delta_importexport.init_config_importexport((modfolder, jarfolder, mc_version, execdir, instance, gui))
init_config_gui((modfolder, jarfolder, mc_version, execdir, instance, gui))


Expand All @@ -51,22 +51,22 @@ def instmods():

_mods = map(int, tkinst.mlist.curselection())
for _mod in _mods:
CMAN_install.install_mod(tkinst.mods[int(_mod)]["Name"])
delta_install.install_mod(tkinst.mods[int(_mod)]["Name"])
updateinst()


def removmods():

_mods = map(int, tkinst.mlisti.curselection())
for _mod in _mods:
CMAN_remove.remove_mod(tkinst.modsi[int(_mod)]["Name"])
delta_remove.remove_mod(tkinst.modsi[int(_mod)]["Name"])
updateinst()

def upgrmods():

_mods = map(int, tkinst.mlisti.curselection())
for _mod in _mods:
CMAN_upgrade.upgrade_mod(tkinst.modsi[int(_mod)]["Name"])
delta_upgrade.upgrade_mod(tkinst.modsi[int(_mod)]["Name"])
updateinst()

def runcmd():
Expand Down Expand Up @@ -129,7 +129,7 @@ def updateinst():
tkinst.ilabel.configure(text = "Current Instance: "+instance)
tkinst.mlisti.delete(0, tk.END)
tkinst.modsi = listmods(False, False)
upgrades = CMAN_upgrade.get_upgrade_names(instance)
upgrades = delta_upgrade.get_upgrade_names(instance)
for mod in tkinst.modsi:
if mod != None:
if mod in upgrades:
Expand All @@ -140,11 +140,11 @@ def updateinst():

def importmlist():
fname = filedialogs.askopenfilename(parent=tkinst)
CMAN_importexport.import_mods(fname)
delta_importexport.import_mods(fname)

def exportmlist():
fname = filedialogs.asksaveasfilename(parent=tkinst)
CMAN_importexport.export_mods(fname)
delta_importexport.export_mods(fname)

def exit():
sys.exit()
Expand All @@ -162,7 +162,7 @@ def update_modlist(self):
if mod != None:
self.mlist.insert(tk.END, mod["Name"])
def initialise_window(self):
self.master.title("CMAN v2.1.0")
self.master.title("DeltaMC v2.1.0")
#self.master.geometry("800x400")

self.winv = tk.PanedWindow(self, orient=tk.VERTICAL, sashrelief=tk.RAISED, height=400, width=800)
Expand Down Expand Up @@ -237,7 +237,7 @@ def initialise_window(self):
self.definst = tk.Button(self.lpane, text = "Set as Default Instance", command=sdinst)
self.definst.pack()

self.update = tk.Button(self.lpane, text = "Update CMAN Archive", command=update_archive)
self.update = tk.Button(self.lpane, text = "Update DeltaMC Archive", command=update_archive)
self.update.pack(side = tk.BOTTOM)

self.blankf = tk.Frame(self.lpane, height = 20)
Expand All @@ -249,7 +249,7 @@ def initialise_window(self):
self.implist = tk.Button(self.lpane, text = "Import Mod List...", command=importmlist)
self.implist.pack(side = tk.BOTTOM)

self.exit = tk.Button(self.lpane, text = "Exit CMAN", command=exit)
self.exit = tk.Button(self.lpane, text = "Exit DeltaMC", command=exit)
self.exit.pack(side = tk.BOTTOM)

self.mpane = tk.Frame(self.win)
Expand Down Expand Up @@ -312,7 +312,7 @@ def parsecmd(command):
cprint("Instance "+inst+" does not exist.")
return
update_archive()
CMAN_upgrade.check_upgrades(True, inst)
delta_upgrade.check_upgrades(True, inst)
elif(len(command.split(" ")) == 1):
cprint("upgrades: not enough arguments")
else:
Expand All @@ -321,13 +321,13 @@ def parsecmd(command):
if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""):
mod = command.split(" ")[1]
update_archive()
upgrades = CMAN_upgrade.get_upgrades()
CMAN_upgrade.upgrade_mod(mod)
upgrades = delta_upgrade.get_upgrades()
delta_upgrade.upgrade_mod(mod)
elif(len(command.split(" ")) == 1):
mod = None
update_archive()
upgrades = CMAN_upgrade.get_upgrades()
CMAN_upgrade.upgrade_mod(mod)
upgrades = delta_upgrade.get_upgrades()
delta_upgrade.upgrade_mod(mod)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "upgradeall"):
Expand All @@ -343,30 +343,30 @@ def parsecmd(command):
else:
cprint("Invalid command syntax.")
update_archive()
updates = CMAN_upgrade.get_upgrades(inst)
updates = delta_upgrade.get_upgrades(inst)
if(len(updates) == 0):
cprint("No upgrades available.")
else:
for update in updates:
CMAN_upgrade.upgrade_mod(update[0]["Name"])
delta_upgrade.upgrade_mod(update[0]["Name"])
elif(command.split(" ")[0] == "install"):
if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""):
mod = command.split(" ")[1]
update_archive()
CMAN_install.install_mod(mod)
delta_install.install_mod(mod)
elif(len(command.split(" ")) == 1):
mod = None
update_archive()
CMAN_install.install_mod(mod)
delta_install.install_mod(mod)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "remove"):
if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""):
mod = command.split(" ")[1]
CMAN_remove.remove_mod(mod)
delta_remove.remove_mod(mod)
elif(len(command.split(" ")) == 1):
mod = None
CMAN_remove.remove_mod(mod)
delta_remove.remove_mod(mod)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "info"):
Expand All @@ -385,7 +385,7 @@ def parsecmd(command):
string = string + item+", "
cprint(string[:-2]+"...") #[:-2] to cut off the extra ", " after the last element
for item in modslist:
CMAN_install.install_mod(item)
delta_install.install_mod(item)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "removem" or command.split(" ")[0] == "removemany"):
Expand All @@ -397,7 +397,7 @@ def parsecmd(command):
string = string + item+", "
cprint(string[:-2]+"...") #[:-2] to cut off the extra ", " after the last element
for item in modslist:
CMAN_remove.remove_mod(item)
delta_remove.remove_mod(item)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "upgradem" or command.split(" ")[0] == "upgrademany"):
Expand All @@ -409,29 +409,29 @@ def parsecmd(command):
string = string + item+", "
cprint(string[:-2]+"...") #[:-2] to cut off the extra ", " after the last element
for item in modslist:
CMAN_upgrade.upgrade_mod(item)
delta_upgrade.upgrade_mod(item)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "export"):
if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""):
name = command.split(" ")[1]
update_archive()
CMAN_importexport.export_mods(name)
delta_importexport.export_mods(name)
elif(len(command.split(" ")) == 1):
name = None
update_archive()
CMAN_importexport.export_mods(name)
delta_importexport.export_mods(name)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "import"):
if(len(command.split(" ")) == 2 and command.split(" ")[1] != ""):
path = command.split(" ")[1]
update_archive()
CMAN_importexport.import_mods(path)
delta_importexport.import_mods(path)
elif(len(command.split(" ")) == 1):
path = None
update_archive()
CMAN_importexport.import_mods(path)
delta_importexport.import_mods(path)
else:
cprint("Invalid command syntax.")
elif(command.split(" ")[0] == "instance" or command.split(" ")[0] == "inst"):
Expand Down Expand Up @@ -500,7 +500,7 @@ def parsecmd(command):
elif(command.split(" ")[0] == "list"):
listmods()
elif(command.split(" ")[0] == "version"):
cprint("CMAN v"+version)
cprint("DeltaMC v"+version)
elif(command.split(" ")[0] == "help" or command.split(" ")[0] == "?"):
print_help()
elif(command.split(" ")[0] == "exit"):
Expand Down
4 changes: 2 additions & 2 deletions CMAN_importexport.py → delta_importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import tarfile
import zipfile
from CMAN_util import *
from delta_util import *

modfolder = "@ERROR@"
jarfolder = "@ERROR@"
Expand Down Expand Up @@ -62,4 +62,4 @@ def import_mods(path):
mods = json_data["Mods"]
for mod in mods:
cprint(mod)
CMAN_install.install_mod(mod)
delta_install.install_mod(mod)
14 changes: 7 additions & 7 deletions CMAN_install.py → delta_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys
import tarfile
import zipfile
from CMAN_util import *
from delta_util import *
import tkinter as tk
import tkinter.messagebox as msgbox
import tkinter.simpledialog as dialogs
Expand All @@ -28,7 +28,7 @@ def recieve_tkinst_install(data):


def install_mod(modname, version = None):
os.chdir(execdir + "/Data/CMAN-Archive")
os.chdir(execdir + "/Data/DeltaMC-Archive")
if(modname == None):
modname = cinput("Enter mod name: ")

Expand Down Expand Up @@ -72,7 +72,7 @@ def install_mod(modname, version = None):
cprint(modname + " is already installed!")
return

originalfile = execdir + "/Data/CMAN-Archive/" + modname + ".json" # Saving Modname.json for future reference
originalfile = execdir + "/Data/DeltaMC-Archive/" + modname + ".json" # Saving Modname.json for future reference
if(not os.path.exists(execdir + "/LocalData/ModsDownloaded/"+instance)):
os.mkdir(execdir + "/LocalData/ModsDownloaded/"+instance)
os.chdir(execdir + "/LocalData/ModsDownloaded/"+instance)
Expand Down Expand Up @@ -120,7 +120,7 @@ def install_mod(modname, version = None):
cprint(modname + " is at version " + version)
if (modtype == "Basemod"):
os.chdir(execdir + "/Data/temp")
file_name = modname + "-" + version + "-CMANtemp.zip"
file_name = modname + "-" + version + "-DeltaMCtemp.zip"
cprint("Downloading " + url)
with open(file_name, 'wb') as out_file:
response = requests.get(url)
Expand Down Expand Up @@ -149,9 +149,9 @@ def install_mod(modname, version = None):
folderpath = os.path.join(jarfolder, foldernamefinal)
shutil.copytree(vpath, folderpath)
fix_names(folderpath, vname, foldernamefinal)
zipfile.ZipFile(os.path.join(jarfolder, foldernamefinal, newjarname)).extractall(path="./"+file_name+"CMANtemp")
mergedirs(modname, file_name+"CMANtemp")
os.chdir(file_name+"CMANtemp")
zipfile.ZipFile(os.path.join(jarfolder, foldernamefinal, newjarname)).extractall(path="./"+file_name+"DeltaMCtemp")
mergedirs(modname, file_name+"DeltaMCtemp")
os.chdir(file_name+"DeltaMCtemp")
shutil.rmtree("META-INF") #delete META-INF
cprint("Making jar (this might take a while).")
shutil.make_archive("../"+foldername, "zip")
Expand Down
8 changes: 4 additions & 4 deletions CMAN_remove.py → delta_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import tarfile
import zipfile
from CMAN_util import *
from delta_util import *
import tkinter as tk
import tkinter.messagebox as msgbox
import tkinter.simpledialog as dialogs
Expand All @@ -23,7 +23,7 @@ def recieve_tkinst_remove(data):
global tkinst
tkinst = data

def remove_mod(modname): #behavior not guaranteed on mods installed outside of CMAN
def remove_mod(modname): #behavior not guaranteed on mods installed outside of DeltaMC
if(modname == None):
modname = cinput("Enter mod name: ")
cprint("Removing file for mod in ModsDownloaded")
Expand All @@ -49,5 +49,5 @@ def remove_mod(modname): #behavior not guaranteed on mods installed outside of C
cprint("Skipped \""+file+"\".")
else:
if(gui):
msgbox.showerror("Removal Failed", "CMAN cannot remove installer mods or base mods.\nRemoving mod from CMAN listing only.")
cprint("CMAN cannot remove installer mods or base mods! (If "+modname+" is not an installer mod or base mod, then something went wrong.)")
msgbox.showerror("Removal Failed", "DeltaMC cannot remove installer mods or base mods.\nRemoving mod from DeltaMC listing only.")
cprint("DeltaMC cannot remove installer mods or base mods! (If "+modname+" is not an installer mod or base mod, then something went wrong.)")
12 changes: 6 additions & 6 deletions CMAN_upgrade.py → delta_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import sys
import tarfile
import zipfile
from CMAN_util import *
import CMAN_install
import CMAN_remove
from delta_util import *
import delta_install
import delta_remove

modfolder = "@ERROR@"
jarfolder = "@ERROR@"
Expand All @@ -25,7 +25,7 @@ def recieve_tkinst_upgrade(data):
tkinst = data

def upgrade_mod(modname):
os.chdir(execdir + "/Data/CMAN-Archive")
os.chdir(execdir + "/Data/DeltaMC-Archive")
if(modname == None):
modname = cinput("Enter mod name: ")
update = [get_installed_json(modname),get_mod(modname)]
Expand All @@ -37,8 +37,8 @@ def upgrade_mod(modname):
return
os.chdir(execdir + "/LocalData") #restoring current working dir
if(update[1]["Versions"][0]["Version"] != get_latest_compatible_version(update[0]) and mod_installed(modname)):
CMAN_remove.remove_mod(modname)
CMAN_install.install_mod(modname)
delta_remove.remove_mod(modname)
delta_install.install_mod(modname)
elif(not mod_installed(modname)):
cprint(modname+" is not installed.")
else:
Expand Down
Loading

0 comments on commit 2c95c46

Please sign in to comment.