Working on Launcher

This commit is contained in:
Adrien Bourmault 2019-07-08 00:17:30 +02:00
parent a9ea152e74
commit 23989a9ffa
9 changed files with 83 additions and 30 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -1,9 +1,18 @@
@echo off
title Compilation de CNIRLauncher
call pyinstaller -w -D --exclude-module PyQt5 --bootloader-ignore-signals --add-data "C:\users\adrie\Anaconda3\Lib\site-packages\tld\res\effective_tld_names.dat.txt";"tld\res" --add-data "id-card.ico";"id-card.ico" -i "id-card.ico" -n CNILauncher src\launcher\CNIRLauncher.py
title Compilation de CNIRevelator
call pyinstaller -w -D --exclude-module PyQt5 --bootloader-ignore-signals --add-data "C:\users\adrie\Anaconda3\Lib\site-packages\tld\res\effective_tld_names.dat.txt";"tld\res" --add-data "id-card.ico";"id-card.ico" -i "id-card.ico" -n CNIRevelator src\analyzer\CNI_Revelator.py
copy LICENSE dist\CNIRevelator\
copy id-card.ico dist\CNIRevelator\
robocopy dist\CNILauncher dist\CNIRevelator /E /MOVE
rmdir dist\CNILauncher /Q /S
pause

Binary file not shown.

Binary file not shown.

View File

@ -25,28 +25,40 @@
import sys
import os
import subprocess
import threading
import traceback
import logger # logger.py
import updater # updater.py
import ihm # ihm.py
import globs # globs.py
from globs import logfile
## Main function
def main():
# Creating a log file and removing the old
logfile = logger.NewLoggingSystem()
# Starting the main update thread
mainThread.start()
# Hello world
logfile.printdbg('*** CNIRLauncher LOGFILE. Hello World ! ***')
logfile.printdbg('Files in directory : ' + str(os.listdir(globs.CNIRFolder)))
# Hello user
launcherWindow = ihm.LauncherWindow()
launcherWindow.progressBar.configure(mode='indeterminate', value=0, maximum=20)
launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text='Chalut!')
launcherWindow.progressBar.start()
launcherWindow.mainloop()
## Bootstrap
main()
sys.exit(0)
try:
mainThread = threading.Thread(target=updater.umain, daemon=True)
main()
except Exception:
logfile.printerr("A FATAL ERROR OCCURED : " + str(traceback.format_exc()))
sys.exit(1)
sys.exit(0)

View File

@ -23,8 +23,12 @@
********************************************************************************
"""
import os
import logger # logger.py
CNIRTesserHash = '5b58db27f7bc08c58a2cb33d01533b034b067cf8'
#CNIRFolder = os.getenv('APPDATA') + '/CNIRevelator/'
CNIRFolder = "."
CNIRLColor = "#003380"
CNIRFolder = os.getcwd()
CNIRLColor = "#006699"
CNIRName = "CNIRevelator Launcher 3.x"
# Creating a log file and removing the old
logfile = logger.NewLoggingSystem()

BIN
src/launcher/id-card.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -29,6 +29,7 @@ from tkinter import filedialog
from tkinter import ttk
import globs # globs.py
from globs import logfile
class LoginDialog(Toplevel):
@ -59,7 +60,7 @@ class LoginDialog(Toplevel):
y = hs / 2 - h / 2
self.geometry('%dx%d+%d+%d' % (w, h, x, y))
def connecti(self):
def logingin(self):
global key
global login
login = self.entry_login.get().strip()
@ -73,24 +74,25 @@ class LauncherWindow(Tk):
Tk.__init__(self)
self.configure(bg=globs.CNIRLColor)
self.resizable(width=False, height=False)
self.queue = []
# Setting up the geometry
ws = self.winfo_screenwidth()
hs = self.winfo_screenheight()
wheight = ws /4
wwidth = hs /4
wheight = hs /4
wwidth = ws /4
#self.update()
# Creating objects
self.mainCanvas = Canvas(self, width=wwidth, height=wheight, bg=globs.CNIRLColor, highlightthickness=0)
self.mainCanvas = Canvas(self, width=wwidth, height=wheight*9/10, bg=globs.CNIRLColor, highlightthickness=0)
self.pBarZone = Canvas(self, width=wwidth, height=wheight/10, bg=globs.CNIRLColor)
self.progressBar = ttk.Progressbar(self.pBarZone, orient=HORIZONTAL, length=wwidth-10, mode='determinate')
self.update()
#self.update()
self.mainCanvas.create_text((wwidth / 2), (wheight / 3), text=("TEST"), font='Calibri 30 bold', fill='white')
self.msg = self.mainCanvas.create_text((wwidth / 2), (wheight / 1.15), text=' ', font='Calibri 9', fill='white')
self.update()
self.mainCanvas.create_text((wwidth / 2), (wheight / 3), text=(globs.CNIRName), font='Calibri 30 bold', fill='white')
self.msg = self.mainCanvas.create_text((wwidth / 2.05), (wheight / 1.20), text='Starting...', font='Calibri 9', fill='white')
#self.update()
# Centering
x = ws / 2 - wwidth / 2
@ -102,11 +104,11 @@ class LauncherWindow(Tk):
#self.after(2000, updating)
# if getattr(sys, 'frozen', False):
# self.iconbitmap(sys._MEIPASS + '\\id-card.ico\\id-card.ico')
# else:
# self.iconbitmap('id-card.ico')
# logger.info('Success !')
if getattr(sys, 'frozen', False):
self.iconbitmap(sys._MEIPASS + '\\id-card.ico\\id-card.ico')
else:
self.iconbitmap('id-card.ico')
logfile.printdbg('Launcher IHM successful')
self.protocol('WM_DELETE_WINDOW', lambda : self.destroy())

View File

@ -21,4 +21,30 @@
* You should have received a copy of the GNU General Public License *
* along with CNIRevelator. If not, see <https:*www.gnu.org/licenses/>. *
********************************************************************************
"""
"""
from globs import logfile
from win32com.client import Dispatch
import globs # globs.py
def createShortcut(path, target='', wDir='', icon=''):
ext = path[-3:]
if ext == 'url':
shortcut = file(path, 'w')
shortcut.write('[InternetShortcut]\n')
shortcut.write('URL=%s' % target)
shortcut.close()
else:
shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortCut(path)
shortcut.Targetpath = target
shortcut.WorkingDirectory = wDir
if icon == '':
pass
else:
shortcut.IconLocation = icon
shortcut.save()
def umain():
for i in range(0,155555555555555):
print(i)