Skip to content

Commit

Permalink
closes #46, closes #45, closes #43, closes #42, enhancement gui
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorian25 committed May 13, 2023
1 parent 5140bc8 commit 29eb630
Show file tree
Hide file tree
Showing 36 changed files with 1,403 additions and 214 deletions.
32 changes: 21 additions & 11 deletions App.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import sys
import random
import time
import threading
from dotenv import load_dotenv
import pygame
Expand All @@ -24,6 +25,11 @@
from utils.utils import *
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Threading')
from System.Windows.Forms import Control
from System.Threading import Thread, ApartmentState, ThreadStart

class App(tk.Tk):

Expand All @@ -42,7 +48,7 @@ def __init__(self, *args, **kwargs):

self.resizable(False, False)
self.iconbitmap(DIR_IMG_ICON + 'icon.ico')
self.title('Otaku Apuri (v1.2.2)')
self.title('Otaku Apuri (v1.2.5)')

self.series_available_sushiscan = []
self.series_available_manganato = []
Expand All @@ -51,10 +57,8 @@ def __init__(self, *args, **kwargs):
self.mongoclient = MongoClient("mongodb+srv://"+os.getenv('USER_PYMONGO')+":"+os.getenv('PASS_PYMONGO')+"@getmangacluster.zmh5nne.mongodb.net/?retryWrites=true&w=majority",
server_api=ServerApi('1'))

#self.show_loading_frame()
self.show_splashscreen_frame()
#self.show_optube_frame()
#self.show_searching_frame()
#self.show_serie_frame(MongoDBManager.get_serie_infos_pymongo(self.mongoclient, "Blue Lock", "sushiscan"))

def set_series_available(self, source="sushiscan"):
Expand All @@ -77,7 +81,7 @@ def show_searching_frame(self):
self.current_frame = SearchingFrame(parent=self)
self.current_frame.pack(expand=True, fill="both")

self.title("Otaku Apuri (v1.2.2)")
self.title("Otaku Apuri (v1.2.5)")

def show_splashscreen_frame(self):
"""Show the SplashScreenFrame
Expand All @@ -91,8 +95,6 @@ def show_splashscreen_frame(self):
self.current_frame = SplashScreenFrame(parent=self)
self.current_frame.pack(expand=True, fill="both")

self.current_frame.after(0, self.current_frame.update, 0)

def show_optube_frame(self):
"""Show the OptubeFrame
"""
Expand Down Expand Up @@ -137,7 +139,8 @@ def show_serie_frame(self, serie):
serie (_type_): _description_
"""
if self.current_frame :
self.current_frame.mediaplayer.stop()
if type(self.current_frame) == SearchingFrame:
self.current_frame.mediaplayer.stop()
# Supprimer tous les widgets enfants de la video_frame
for child in self.current_frame.winfo_children():
child.destroy()
Expand All @@ -158,7 +161,7 @@ def show_malranking_frame(self):
child.destroy()
self.current_frame.destroy()

self.current_frame = MALRankingFrame(parent=self)
self.current_frame = MALRankingFrame(parent=self, app=self)
self.current_frame.pack(expand=True, fill="both")

self.title("Top Manga - MyAnimeList.net")
Expand Down Expand Up @@ -194,8 +197,7 @@ def show_error_frame(self, error_msg):
# TODO : Gérer toutes les exceptions
# TODO : Paginer les chapitres volumes


if __name__ == "__main__":
def main():
extDataDir = os.getcwd()
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
# sys._MEIPASS = C:\Users\xxxx\AppData\Local\Temp\_MEIxxxxxx
Expand All @@ -212,7 +214,15 @@ def show_error_frame(self, error_msg):

if isinstance(app.current_frame, SerieFrame):
app.current_frame.frame_anime.stop(quit=True)
if isinstance(app.current_frame, OptubeFrame):
app.current_frame.quit()

app.mongoclient.close()
FileManager.delete_tmp_files()
pygame.quit()
pygame.quit()

if __name__ == "__main__":
t = Thread(ThreadStart(main))
t.ApartmentState = ApartmentState.STA
t.Start()
t.Join()
Loading

0 comments on commit 29eb630

Please sign in to comment.