From d028e77a23b5f1cd102f223934c9807bbd5d1262 Mon Sep 17 00:00:00 2001 From: Dhaboav Date: Sun, 3 Mar 2024 15:50:46 +0700 Subject: [PATCH] Delete change name feature --- praproses/Main.py | 13 ++----------- praproses/backend/ChangeName.py | 19 ------------------- praproses/frontend/Interface.py | 2 +- 3 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 praproses/backend/ChangeName.py diff --git a/praproses/Main.py b/praproses/Main.py index 30e82b7..e952ec3 100644 --- a/praproses/Main.py +++ b/praproses/Main.py @@ -2,8 +2,7 @@ from frontend.Interface import ChoiceDialog from backend.TakeImg import TakeImg from backend.ColorSelector import Color -from backend.ChangeName import ChangeName -from variable import CAMERA_INDEX, CAMERA_WIDTH, CAMERA_HEIGHT, NAME_FORMATING +from variable import CAMERA_INDEX, CAMERA_WIDTH, CAMERA_HEIGHT if __name__ == "__main__": @@ -21,12 +20,4 @@ elif choice == 'Pilih warna': excute = Color(camera=CAMERA_INDEX, width=CAMERA_WIDTH, height=CAMERA_HEIGHT) - excute.run() - - elif choice == 'Ubah nama': - if folder_path: - # example of name format -> test-{}.jpg - excute = ChangeName(folder_path=folder_path, name_format=NAME_FORMATING) - excute.run() - else: - msg.showerror('Error', 'No Folder Path!') \ No newline at end of file + excute.run() \ No newline at end of file diff --git a/praproses/backend/ChangeName.py b/praproses/backend/ChangeName.py deleted file mode 100644 index 830e0cd..0000000 --- a/praproses/backend/ChangeName.py +++ /dev/null @@ -1,19 +0,0 @@ -import os - - -class ChangeName: - def __init__(self, folder_path, name_format): - self.folder_path = folder_path - self.name_format = name_format - self.counter = 1 - - def run(self): - for file in os.listdir(self.folder_path): - old_file_path = os.path.join(self.folder_path, file) - new_file_name = self.name_format.format(self.counter) - new_file_path = os.path.join(self.folder_path, new_file_name) - - os.rename(old_file_path, new_file_path) - self.counter += 1 - - print(f'Done change name of {self.counter-1} files') \ No newline at end of file diff --git a/praproses/frontend/Interface.py b/praproses/frontend/Interface.py index c0f9f1e..e3ee431 100644 --- a/praproses/frontend/Interface.py +++ b/praproses/frontend/Interface.py @@ -25,7 +25,7 @@ def create_popup(self): def popup_component(self, GUI): info = Label(GUI, text="Pilih Operasi Yang ingin dilakukan:") info.pack(pady=5) - choices = ['Ambil gambar', 'Pilih warna', 'Ubah nama'] + choices = ['Ambil gambar', 'Pilih warna'] # button setting button_frame = Frame(GUI)