diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..c396f19 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7b057cc..6298b18 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -20,7 +20,20 @@ - + + + + + + + + + + + + + + @@ -397,7 +375,7 @@ - + @@ -442,21 +420,6 @@ - - - - - - - - - - - - - - - @@ -543,7 +506,32 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -551,7 +539,7 @@ - + @@ -559,25 +547,7 @@ - - - - - - - - - - - - - - - - - - - + @@ -585,63 +555,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -649,68 +563,70 @@ - + - + - + - + - + - + - + - - - + + + + + - + - + - - - - - - - - - - + + + + + + + + + + - - + + diff --git a/JDE/Interfaces/desktop.py b/JDE/Interfaces/desktop.py index e7a614b..ed1dad9 100644 --- a/JDE/Interfaces/desktop.py +++ b/JDE/Interfaces/desktop.py @@ -13,6 +13,7 @@ from Programs import imageViewer from Programs import minesweeper from Programs import terminal from Programs.webEdit import htmlEdit as webEdit +import threading desktopLog = logging.getLogger(__name__) @@ -45,43 +46,53 @@ class desktop: desktopLog.error(str(e)) def reposition(self, event): - desktopLog.debug("Running "+desktop.reposition.__name__) - try: - self.cHeight = self.window.winfo_height() - self.cWidth = self.window.winfo_width() + if self.tempWidth != self.window.winfo_width() or self.tempHeight != self.window.winfo_height(): + desktopLog.debug("Running "+desktop.reposition.__name__) + try: + self.cHeight = self.window.winfo_height() + self.cWidth = self.window.winfo_width() - self.centerWidth = self.window.winfo_x() + int(int(self.cWidth) / 2) - self.centerHeight = self.window.winfo_y() + int(int(self.cHeight) / 2) + self.centerWidth = self.window.winfo_x() + int(int(self.cWidth) / 2) + self.centerHeight = self.window.winfo_y() + int(int(self.cHeight) / 2) - self.screenCenter = str(self.centerWidth) + "+" + str(self.centerHeight) + self.screenCenter = str(self.centerWidth) + "+" + str(self.centerHeight) - # self.startPic.place_configure(x=int(0), y=int(self.cHeight) - 55) + # self.startPic.place_configure(x=int(0), y=int(self.cHeight) - 55) + def searchPlaceRepos(): + self.search.place_configure(x=0, y=int(self.cHeight) - 55, height=55, width=300) - self.search.place_configure(x=0, y=int(self.cHeight) - 55, height=55, width=300) + # versionText.place(x=int(cWidth) - 300, y=int(cHeight) - 120) - # versionText.place(x=int(cWidth) - 300, y=int(cHeight) - 120) + def toolbarPlaceRepos(): + self.toolbar.place_configure(x=258, y=int(self.cHeight) - 55, height=55, width=int(self.cWidth)) - self.toolbar.place_configure(x=258, y=int(self.cHeight) - 55, height=55, width=int(self.cWidth)) + def notifyBarPlaceRepos(): + self.notifcationBar.place_configure(x=int(self.cWidth) - 500, y=int(self.cHeight) - 55, height=55, + width=500) - self.notifcationBar.place_configure(x=int(self.cWidth) - 500, y=int(self.cHeight) - 55, height=55, - width=500) - if config["resizeBackground"]: - try: - self.canvas.delete("background") - backgroundResized = self.image.resize((self.cWidth, self.cHeight), PIL.Image.ANTIALIAS) - backgroundResizedImage = PIL.ImageTk.PhotoImage(backgroundResized) - self.canvas.backgroundImage = backgroundResizedImage - self.canvas.create_image(0, 0, image=backgroundResizedImage, anchor=NW, tag="background") - except Exception as e: - desktopLog.error(str(e)) + def resizeBackground(): + if self.background_image.width() != self.cWidth or self.background_image.height() != self.cHeight: + if config["resizeBackground"]: + try: + self.canvas.delete("background") + backgroundResized = self.image.resize((self.cWidth, self.cHeight), PIL.Image.ANTIALIAS) + self.background_image = PIL.ImageTk.PhotoImage(backgroundResized) + self.canvas.backgroundImage = self.background_image + self.canvas.create_image(0, 0, image=self.background_image, anchor=NW, tag="background") + except Exception as e: + desktopLog.error(str(e)) + threading.Thread(target=searchPlaceRepos, daemon=True).start() + threading.Thread(target=toolbarPlaceRepos, daemon=True).start() + threading.Thread(target=notifyBarPlaceRepos, daemon=True).start() + threading.Thread(target=resizeBackground, daemon=True).start() - self.windowX = self.window.winfo_x() - self.windowY = (self.window.winfo_y() + self.window.winfo_height()) + self.windowX = self.window.winfo_x() + self.windowY = (self.window.winfo_y() + self.window.winfo_height()) - # displayTime.pack_configure(side=RIGHT) - except Exception as e: - desktopLog.error(str(e)) + # displayTime.pack_configure(side=RIGHT) + except Exception as e: + desktopLog.error(str(e)) def fullScreen(self, event): desktopLog.debug("Running "+desktop.fullScreen.__name__) @@ -116,7 +127,7 @@ class desktop: try: self.searchText = Label(self.window, text="Search for: ") self.searchvar = StringVar() - self.search = Entry(self.window, textvariable=self.searchvar, font=(14), bg=self.menuColour) + self.search = Entry(self.window, textvariable=self.searchvar, font=(14), bg=self.menuColour, relief=FLAT) self.search.bind("", self.box) self.search.bind("", self.search_internet) self.search.place(x=0, y=350, height=50, width=100) @@ -281,6 +292,8 @@ class desktop: self.window.minsize(640, 360) self.windowX = self.window.winfo_x() self.windowY = self.window.winfo_y() + self.tempWidth = self.window.winfo_width() + self.tempHeight = self.window.winfo_height() self.canvas = Canvas(self.window, width=self.width, height=self.height) self.canvas.pack(expand=YES, fill=BOTH) diff --git a/JDE/Interfaces/login.py b/JDE/Interfaces/login.py index c98140b..4ef95e2 100644 --- a/JDE/Interfaces/login.py +++ b/JDE/Interfaces/login.py @@ -2,6 +2,7 @@ import logging import PIL.Image import PIL.ImageTk from tkinter import * +import threading loginLog = logging.getLogger(__name__) @@ -16,20 +17,30 @@ except Exception as e: class login: def reposition(self, event): - loginLog.debug("Running reposition") - self.frame.place_configure(x=int(self.window.winfo_width() / 3), y=self.window.winfo_height() / 3, - width=int(int(self.window.winfo_width()) / 3), - height=int(int(self.window.winfo_height()) / 3)) - if config["resizeBackground"]: - try: - self.canvas.delete("Background") - background_image_resized = self.bg_image.resize((self.window.winfo_width(), self.window.winfo_height()), - PIL.Image.ANTIALIAS) - background_image = PIL.ImageTk.PhotoImage(background_image_resized) - self.canvas.backgroundImage = background_image - self.canvas.create_image(0, 0, image=background_image, anchor=NW, tag="Background") - except Exception as e: - loginLog.error(str(e)) + if self.tempWidth != self.window.winfo_width() or self.tempHeight != self.window.winfo_height(): + loginLog.debug("Running reposition") + def reposFrame(): + self.frame.place_configure(x=int(self.window.winfo_width() / 3), y=self.window.winfo_height() / 3, + width=int(int(self.window.winfo_width()) / 3), + height=int(int(self.window.winfo_height()) / 3)) + + if self.background_image.width() != self.window.winfo_width() or self.background_image.height() != self.window.winfo_height(): + def reposBackground(): + if config["resizeBackground"]: + try: + self.canvas.delete("Background") + background_image_resized = self.bg_image.resize((self.window.winfo_width(), self.window.winfo_height()), + PIL.Image.ANTIALIAS) + self.background_image = PIL.ImageTk.PhotoImage(background_image_resized) + self.canvas.backgroundImage = self.background_image + self.canvas.create_image(0, 0, image=self.background_image, anchor=NW, tag="Background") + except Exception as e: + loginLog.error(str(e)) + + threading.Thread(target=reposFrame, daemon=True).start() + threading.Thread(target=reposBackground, daemon=True).start() + self.tempWidth = self.window.winfo_width() + self.tempHeight = self.window.winfo_height() def callback(self, event): loginLog.debug("Running callback") @@ -79,7 +90,13 @@ class login: self.go.bind("", self.callback) self.go.bind("", self.callback) self.passw.bind("", self.callback) - self.window.bind("", self.reposition) + + self.reposition(self) + + def configureWindow(): + self.window.bind("", self.reposition) + + threading.Thread(target=configureWindow, daemon=True).start() self.window.mainloop() @@ -127,6 +144,9 @@ class login: self.frame = Frame(self.canvas) self.frame.configure(bg=self.bgColour) + self.tempWidth = self.window.winfo_width() + self.tempHeight = self.window.winfo_height() + self.canvas.pack() self.window.attributes('-fullscreen', True) diff --git a/JDE/Settings/settings.conf b/JDE/Settings/settings.conf index abdf20b..a0b0adf 100644 --- a/JDE/Settings/settings.conf +++ b/JDE/Settings/settings.conf @@ -1,29 +1,9 @@ -# --== JDE SETTINGS ==-- - -width = "1280" # Sets the width of JDE -- Outdated ( not used ) -height = "800" # Sets the height of JDE -- Outdated ( not used ) -userDirs = "Users/" # Sets the user directory -background = "JDE/Images/background.png" # Path to background image -colour = "#a0fd44" # Background colour of the taskbar -startPic = "JDE/Images/start.png" # sets the start menu picture ( not used ) -contextMenuColour = "#a0fd44" # Sets the colour of the context menu - -resizeBackground = False # Resizes the background but can be VERY slow! - -version = "1.4.0 ALPHA" # Please don't Change, it's here for a reason! - -#░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄ -#░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄ -#░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█ -#░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░█ -#░▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░█ -#█▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒█ -#█▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█ -#░█▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█ -#░░█░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█ -#░░░█░░██░░▀█▄▄▄█▄▄█▄████░█ -#░░░░█░░░▀▀▄░█░░░█░███████░█ -#░░░░░▀▄░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█ -#░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░█ -#░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░█ -#░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░█ \ No newline at end of file +width = "1280" +height = "800" +userDirs = "Users/" +background = "JDE/Images/background.png" +colour = "#a0fd44" +startPic = "JDE/Images/start.png" +contextMenuColour = "#a0fd44" +resizeBackground = False # This can be VERY slow! +version = "1.4.0 ALPHA" \ No newline at end of file