Esempio n. 1
0
def generate_file(request, team_name_t):
    if logged_in_post(request):
        if (download_access_post(request,team_name_t)) or (File.objects.get(file_id=request.POST['file_id']).task.assigned_to==User.objects.get(uname=request.POST['username'])):
            file_object = File.objects.get(file_id=request.POST['file_id'])
            user = User.objects.get(uname=request.POST['username'])
            if file_object.task.team.team_name == team_name_t:
                syst("rm -rf app/static/files/"+user.files_path+"/*")
                syst("cp -f files/"+str(file_object.file_id)+" app/static/files/"+user.files_path)
                syst("mv -f app/static/files/"+user.files_path+"/"+str(file_object.file_id)+" "+" app/static/files/"+user.files_path+"/"+file_object.file_name)
                return HttpResponse("<html><h1>Success</h1></html>")
            else:
                return HttpResponse("<html><h1>Access denied</h1></html>")
    return HttpResponse("<html><h1>Not logged in</h1></html>")
Esempio n. 2
0
 def open(self):
     i = len(self.__fl) - 1
     r = ""
     while i >= 0:
         fn = self.__fl[i]
         if exists(fn) and isfile(fn):
             r = fn
             break
         i = i - 1
     if r != "":
         if system() == "Windows":
             cm = f'explorer.exe /select,"{r}"'
             if self.__logg is not None:
                 self.__logg.write(f"Try open '{r}':\ncm = {cm}",
                                   currentframe(),
                                   "Auto Open File List Open")
             re = syst(cm)
             if self.__logg is not None:
                 self.__logg.write(f"re = {re}", currentframe(),
                                   "Auto Open File List Open Result")
Esempio n. 3
0
def layout():
    syst('cls')
    print("*" * 97)
    print("* " * 20 + " M I N I G R A M " + ' *' * 20)
    print('*' * 97 + '\n')
Esempio n. 4
0
def clear_term():
    syst('cls || clear')
Esempio n. 5
0
    '-s',
    help='Base de donnée locale Sqlite3 de sortie des résultats de calcul, '
    'par defaut -> result.db',
    default='result.db')
parser.add_argument('-c',
                    help='Fichier csv contenant les données de consommation')
parser.add_argument('-p', help='Fichier csv contenant les données des paliers')
parser.add_argument('-o',
                    help='Nom de sortie de la feuille de style excel,'
                    ' par defaut -> output.xls',
                    default='output.xls')
args = parser.parse_args()

if __name__ == '__main__':
    if path.exists(args.d):
        syst(f"del {args.d}")
    if path.exists(args.s):
        syst(f"del {args.s}")
    obj1 = DataQuery(args.d)
    obj2 = Calculations(args.d, args.s, args.i)
    obj1.createTableConso()
    obj1.insertConso(DataQuery(args.d).getData(args.c))
    obj1.createTablePaliers()
    obj1.insertPaliers(DataQuery(args.d).getData(args.p))
    obj1.data.commit()
    obj1.dataCursor.close()
    obj2.createTableOutput()
    obj2.insertReceivedData()
    obj2.calculations()
    obj2.result.commit()
    obj2.showResults()
Esempio n. 6
0
def super_user(): 
	make_user = syst( admin_user )
	return (make_user) 
Esempio n. 7
0
def mkmig(app_to_mig) :
	makemig = syst(str(mkmigration + app_to_mig ))
	return ( makemig ) 
Esempio n. 8
0
def run_server() : #6 
	server_run = syst(runserver)
	return(server_run)
Esempio n. 9
0
def apply_migrates():
	mig_apply = syst(migrate)     
	return(mig_apply)
Esempio n. 10
0
def start_application(app_name): #5
	cmmand1 = "python manage.py startapp  "
	app_start = syst( str( cmmand1 + app_name ))
	print("Creating The Application")
	return(app_start)
Esempio n. 11
0
def start_project(project_name): #4
	cmmand0 = "django-admin startproject  "
	startpro = syst( str (cmmand0 + project_name))
	print("Creating The Project ...// ")
	return(startpro)
Esempio n. 12
0
def django_ver(): #3
	ver = syst(dj_version) 
	return("Your Django version is : " , ver)
Esempio n. 13
0
def install_dj(): #2
	install = syst(install_django_cmd)
	return("Begin The Installation : " , install)
Esempio n. 14
0
def pwwd(): #1
	pwd1 = syst(pwd)
	return("you are in : " , pwd1)
Esempio n. 15
0
dir_path = os.path.dirname(os.path.realpath(__file__))
filename = dir_path + "/sequence.txt"
lircrcPath = dir_path + "/lircrc"
out = ""
keyoutput = {}
blocking = 0
sequence = []

while True:
	print menu
	option = raw_input("Option: ")
	if option == "q":
		break
	elif option == "1":
		print "Starting learn script..."
		syst("sudo kill `cat /var/run/lirc/lircd.pid`")
		syst("if [ -f /etc/lirc/lircd.conf ]; then sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd.conf.bak; fi")
		syst("sudo irrecord -d /dev/lirc0 -f /etc/lirc/lircd.conf")
		syst("sudo lircd")
		print "Finished!"
	elif option == "2":
		fileManage.override(lircrcPath, "")
		while True:
			key = raw_input("Type the full key name and then enter (or 'q' to quit): ")
			if key == 'q':
				break
			out = raw_input("Type the value you want as output: ")
			keyoutput[out] = key
			data = "begin\n" \
					" button="+key+"\n" \
					" prog=pylirc\n" \
Esempio n. 16
0
import sys
try:
	from os import system as syst

except:
	syst('pip install pynput')
	syst('cls')
	try:
		from os import system as syst
	except:
		sys.exit()

try:
	from pynput.keyboard import Key, Listener

except:
	syst('pip install pynput')
	syst('cls')
	try:
		from pynput.keyboard import Key, Listener
	except:
		sys.exit()

import logging

logging.basicConfig(filename='keystroke' , level = logging.DEBUG , format = '%(asctime)s : %(message)s')

def on_press(key) :
	logging.info('\t'+str(key))

def on_release(key) :