Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoRanger committed Jan 4, 2018
2 parents 5b4d7c7 + 5b8a1c8 commit 3e5b7ee
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 164 deletions.
23 changes: 15 additions & 8 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning <http://semver.org/>`_.

[2.0.2] - 2017-12-19
===========
added:
______
* Notificacion al restaurar archivos faltantes.
* Mejora en la funcion de verificacion de archivos y restauracion.

Fixed:
______
* Se corrigieron bugs menores.

[2.0] - 2017-03-14
===========
added:
Expand All @@ -12,7 +23,7 @@ ______
* modulo Traslate (soporte para multi-idiomas)
* modulo para el manejo de la base de datos (Sqlite3)
* nueva forma para el manejo de los menus.
* se agrego la opcion dinamica tareas a la barra de opciones
* se agrego la opcion dinamica (tareas) a la barra de opciones
* se extendio la funcionalidad de multi-install ahora se llama tasks y permite
instalar, desinstalar y agregar comandos para ser ejecutados en lotes)
* se agregaron varias aplicaciones.
Expand All @@ -27,20 +38,16 @@ en la base de datos
Fixed:
______
* Se corrigio el color de la terminal al terminar el script con Crt+C
* se corrigieron bugs menores,
* se corrigieron bugs menores.


[1.1.1] - 2016-10-13
===========
Changed:
Fixed:
______
* Fixing some sintactic words
* Fixing Telegram installation commands

Fixed:
______


[1.1] - 2016-10-13
===========
Changed:
Expand Down Expand Up @@ -153,7 +160,7 @@ ______
* issue #11 (option menu back work in all menus)
* issue #8 (the mirrorlist file contents will not be displayed)
* issue #6 (change the lenguage to english)
* issue #5 (install telegram fram the official website)
* issue #5 (install telegram from the official website)
* issue #4 (clean the screen to make action)
* issue #3 (WPS not installed)

Expand Down
Binary file modified db/mpis.db
Binary file not shown.
234 changes: 130 additions & 104 deletions mpis
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# This file is part of MPIS (https://github.com/KernelPanicBlog/MPIS).
Expand All @@ -20,12 +20,15 @@
# You should have received a copy of the GNU General Public License
# along with MPIS; If not, see <http://www.gnu.org/licenses/>.
# _____________________________________________________________________________

import sys
import traceback
import webbrowser
import mpislib
from mpislib.core import check_file
from mpislib.core import restor_file
from mpislib.core import db
from mpislib.core import resource
from mpislib.core import GlobalResource
from mpislib.core import paramlist
from mpislib.core import user_input
from mpislib.core import pause
from mpislib.core import clear
Expand All @@ -43,107 +46,130 @@ from mpislib.traslate import tr
from mpislib.colorize import colorize


list_cmd_to_install = []
try:
show_banner()
sleep(2)
clear()
print(colorize.aplicar(1, 31)
+ tr("The '--noconfirm' parameter is enabled by default."))
print(tr("You can change this option in the Settings menu.")
+ colorize.reset())
sleep(2)
clear()
option = 0
menu_back = []
GlobalMenu.load_appearance()
menu = GlobalMenu.nodos[option]
GlobalMenu.show_menu(menu, True if list_cmd_to_install else False)
while True:
try:
option = user_input()
if option in mkopts("back"):
if len(menu_back):
menu = menu_back.pop()
elif option in mkopts("help"):
show_help()
elif option in mkopts("search"):
cmd_ = search()
if db.get_config('multi_install') == 'True':
list_cmd_to_install.append(cmd_)
pause(tr("The tasks was added to the installation list."))
else:
execute_command(cmd_)
elif option in mkopts("tasks"):
print(tr("We will proceed to install"
"the selected applications."))
for _cmd_ in list_cmd_to_install:
execute_command(_cmd_)
list_cmd_to_install.clear()
elif option in mkopts("exit"):
sys.exit(0)
elif int(option) <= len(menu.childern):
option = int(option)
if len(menu[option].childern):
menu_back.append(menu)
menu = menu.childern[option]
else:
arg_eval = menu.childern[option].name
if menu.name == "Look & Feel":
pause(tr("(not functional, yet)"))
elif arg_eval == "Appearance":
wizard_config()
GlobalMenu.load_appearance()
elif arg_eval == "Set language":
set_language()
elif arg_eval == "Toggle --noconfirm":
toggle_config("noconfirm")
elif arg_eval == "Toggle multi-install":
toggle_config("multi_install")
elif arg_eval == "About MPIS":
show_banner()
pause()
elif arg_eval == "Report bug!":
web_bug = "https://github.com/"
web_bug += "KernelPanicBlog/MPIS/issues"
webbrowser.open(web_bug)
clear()
pause(tr("Link is opening in your web browser."))
elif arg_eval == "See README File":
with open(resource.path_file("README.rst"),
"r") as _file:
pause(_file.read())
elif arg_eval == "See CHANGELOG File":
with open(resource.path_file("CHANGELOG.rst"),
"r") as _file:
pause(_file.read())
elif arg_eval == "See the content of mirrorlist file":
with open("/etc/pacman.d/mirrorlist",
"r") as _file:
pause(_file.read())
def main():
list_cmd_to_install = []
try:
show_banner()
sleep(2)
clear()
print(colorize.aplicar(1, 31)
+ tr("The '--noconfirm' parameter is enabled by default."))
print(tr("You can change this option in the Settings menu.")
+ colorize.reset())
sleep(2)
clear()
option = 0
menu_back = []
GlobalMenu.load_appearance()
menu = GlobalMenu.nodos[option]
GlobalMenu.show_menu(menu, True if list_cmd_to_install else False)
while True:
try:
option = user_input()
if option in mkopts("back"):
if menu_back:
menu = menu_back.pop()
elif option in mkopts("help"):
show_help()
elif option in mkopts("search"):
cmd_ = search()
if db.get_config('multi_install') == 'True':
list_cmd_to_install.append(cmd_)
pause(tr("The tasks was added to the installation list."))
else:
parm = menu.parent.split()[0]
arg = True if parm == "Install" else False
cmd_ = db.get_command(menu.childern[option].name, arg)
if db.get_config('multi_install') == 'True':
list_cmd_to_install.append(cmd_)
pause(tr("The tasks was added to the installation"
"list."))
execute_command(cmd_)
elif option in mkopts("tasks"):
print(tr("We will proceed to install"
"the selected applications."))
for _cmd_ in list_cmd_to_install:
execute_command(_cmd_)
list_cmd_to_install.clear()
elif option in mkopts("exit"):
sys.exit(0)
elif int(option) <= len(menu.childern):
option = int(option)
if menu[option].childern:
menu_back.append(menu)
menu = menu.childern[option]
else:
arg_eval = menu.childern[option].name
if menu.name == "Look & Feel":
pause(tr("(not functional, yet)"))
elif arg_eval == "Appearance":
wizard_config()
GlobalMenu.load_appearance()
elif arg_eval == "Set language":
set_language()
elif arg_eval == "Toggle --noconfirm":
toggle_config("noconfirm")
elif arg_eval == "Toggle multi-install":
toggle_config("multi_install")
elif arg_eval == "About MPIS":
show_banner()
pause()
elif arg_eval == "Report bug!":
web_bug = "https://github.com/"
web_bug += "KernelPanicBlog/MPIS/issues"
webbrowser.open(web_bug)
clear()
pause(tr("Link is opening in your web browser."))
elif arg_eval == "See README File":
with open(GlobalResource.path_file("README.rst"),
"r") as _file:
pause(_file.read())
elif arg_eval == "See CHANGELOG File":
with open(GlobalResource.path_file("CHANGELOG.rst"),
"r") as _file:
pause(_file.read())
elif arg_eval == "See the content of mirrorlist file":
with open("/etc/pacman.d/mirrorlist",
"r") as _file:
pause(_file.read())
else:
execute_command(cmd_)
else:
pause(tr("Sorry not valid Option."))
except (ValueError, IndexError):
pause(tr("Error in option, this value is outside the range"
"of the list"))
parm = menu.parent.split()[0]
arg = True if parm == "Install" else False
cmd_ = db.get_command(menu.childern[option].name, arg)
if db.get_config('multi_install') == 'True':
list_cmd_to_install.append(cmd_)
pause(tr("The tasks was added to the installation"
" list."))
else:
execute_command(cmd_)
else:
pause(tr("Sorry not valid Option."))
except (ValueError, IndexError):
pause(tr("Error in option, this value is outside the range"
"of the list"))
clear()
GlobalMenu.show_menu(menu, len(list_cmd_to_install))
except KeyboardInterrupt:
print(colorize.aplicar(1, 31)
+ tr("You had press the Ctrl+C keys combination."
"Accepted exit request. Bye!") + colorize.reset())
sleep(2)
clear()
GlobalMenu.show_menu(menu, len(list_cmd_to_install))
except KeyboardInterrupt:
print(colorize.aplicar(1, 31)
+ tr("You had press the Ctrl+C keys combination."
"Accepted exit request. Bye!") + colorize.reset())
sleep(2)
clear()
except Exception:
traceback.print_exc(file=sys.stdout)
sys.exit(0)
except Exception:
traceback.print_exc(file=sys.stdout)
sys.exit(0)


if __name__ == "__main__" and len(sys.argv) == 1:
for file_ in ["/.config/mpis/db", "/EN_us.tr", "/ES_es.tr"]:
_db = True if file_.endswith("db") else False
_val, _dir = check_file(file_, _db)
if not _val:
print("file:{0} not found.".format(file_))
print("Restoring . . .")
restor_file(_dir, file_, _db)
print("Done.")
main()
else:
if sys.argv[1] in paramlist:
param = sys.argv[1]
argv = sys.argv[2]
if param in ["-i", "--install"]:
cmd = db.get_command(argv)
execute_command(cmd)
elif param in ["-u", "--uninstall"]:
cmd = db.get_command(argv, False)
execute_command(cmd)
49 changes: 1 addition & 48 deletions mpislib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,56 +21,9 @@
# ------------------------------------------------------------------------------
# META DATA
# ------------------------------------------------------------------------------
__version__ = '2.0'
__version__ = '2.0.2'
__autores__ = """KernelPanicBlog team:
SniferL4bs | https://www.sniferl4bs.com
NeoRanger | https://www.neositelinux.com
Harrinsoft | [email protected]"""
# ------------------------------------------------------------------------------

from mpislib.resource import GlobalResource
import os.path as path

#
if not path.isfile(GlobalResource.path_db()):
try:
import subprocess
dir = GlobalResource.path_home() + "/.config/mpis/db"
cmd = "mkdir -p {0}".format(dir)
subprocess.call(cmd.split())
file = GlobalResource.path_db_restore()
cmd = "cp {0} {1}".format(file, dir)
subprocess.call(cmd.split())
except Exception:
import sys
import traceback
traceback.print_exc(file=sys.stdout)

if not path.isfile(GlobalResource.path_tr_file() + "/EN_us.tr"):
try:
import subprocess
dir = GlobalResource.path_tr_file()
cmd = "mkdir -p {0}".format(dir)
subprocess.call(cmd.split())
file = GlobalResource.path_tr_restore("/EN_us.tr")
cmd = "cp {0} {1}".format(file, dir)
subprocess.call(cmd.split())
except Exception:
import sys
import traceback
traceback.print_exc(file=sys.stdout)

if not path.isfile(GlobalResource.path_tr_file() + "/ES_es.tr"):
try:
import subprocess
dir = GlobalResource.path_tr_file()
cmd = "mkdir -p {0}".format(dir)
subprocess.call(cmd.split())
file = GlobalResource.path_tr_restore("/ES_es.tr")
cmd = "cp {0} {1}".format(file, dir)
subprocess.call(cmd.split())
except Exception:
import sys
import traceback
traceback.print_exc(file=sys.stdout)

Loading

0 comments on commit 3e5b7ee

Please sign in to comment.