Skip to content

Commit

Permalink
replaced multiprocessing by threading
Browse files Browse the repository at this point in the history
to prevent program from calling itself
  • Loading branch information
Yoween committed Mar 6, 2023
1 parent 97c3da0 commit b5a9392
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Binary file added main.exe
Binary file not shown.
17 changes: 8 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#imports
from tkinter import ttk, filedialog
import tkinter as tk
import multiprocessing, os, time, subprocess
import threading, os, time, subprocess

class Execution():
def changeFolder(self):
Expand Down Expand Up @@ -272,8 +272,6 @@ def __init__(self):
buttonQuit = tk.Button(self.tab4, text = "Quit!", command = self.root.destroy)
buttonQuit.pack(side = "bottom", anchor = "se", pady = 8, padx = 8)


self.root.mainloop()


def focus_next_widget(self, event):
Expand Down Expand Up @@ -329,7 +327,7 @@ def newCreateFolders(self, entryGet = "", sleepValue = 0):
if str(incrementStart).isdigit():
incrementStart = int(incrementStart)

p = multiprocessing.Process(target = self.execution.createFolders(entryGet, sleepValue, incrementValue, incrementStart))
p = threading.Thread(target = self.execution.createFolders(entryGet, sleepValue, incrementValue, incrementStart))
p.start()
self.logs.configure(state = "normal")
self.logs.insert("1.0", f"---------------------------------\n{self.execution.functionsOutput}")
Expand All @@ -351,32 +349,33 @@ def newRemoveFolders(self, entryGet = "", modeSelected = 0, startsEndsWith = "")
if str(incrementStart).isdigit():
incrementStart = int(incrementStart)

p = multiprocessing.Process(target = self.execution.removeFolders(entryGet, modeSelected, startsEndsWith, incrementValue, incrementStart))
p = threading.Thread(target = self.execution.removeFolders(entryGet, modeSelected, startsEndsWith, incrementValue, incrementStart))
p.start()
self.logs.configure(state = "normal")
self.logs.insert("1.0", f"---------------------------------\n{self.execution.functionsOutput}")
self.logs.configure(state = "disabled")

def newModifyFolders(self, entryGet = "", modeSelected = 0, replaceWith = "", sleepValue = 0):
p = multiprocessing.Process(target = self.execution.modifyFolders(entryGet, modeSelected, replaceWith, sleepValue))
p = threading.Thread(target = self.execution.modifyFolders(entryGet, modeSelected, replaceWith, sleepValue))
p.start()
self.logs.configure(state = "normal")
self.logs.insert("1.0", f"---------------------------------\n{self.execution.functionsOutput}")
self.logs.configure(state = "disabled")

def newFoldersList(self):
p = multiprocessing.Process(target = self.execution.getFolderList())
p = threading.Thread(target = self.execution.getFolderList())
p.start()
self.logs.configure(state = "normal")
self.logs.insert("1.0", f"---------------------------------\nCurrently working on:\n{os.getcwd()}.\nFolders list:\n{self.execution.foldersList}")
self.logs.configure(state = "disabled")

def newChangeFolder(self):
p = multiprocessing.Process(target = self.execution.changeFolder())
p = threading.Thread(target = self.execution.changeFolder())
p.start()

def newOpenCurrentFolder(self):
subprocess.Popen(f'explorer "{os.getcwd()}"')

if __name__ == '__main__':
startUI = WindowUI()
startUI = WindowUI()
startUI.root.mainloop()

0 comments on commit b5a9392

Please sign in to comment.