""" Created By: Jap-Slappa Date: 15th/Aug/2026 * Joplin Template 4 Docker Apps v1.0 Purpose: - Convert windows folder + File paths into URL paths for use in Joplin """ # Tell Python to look in your C-Drive helper folder (Or the folder on your Laptop) # Better to have my Helper Modules on the PC using them. (But using them from my NAS might work?) # Use raw strings (r"...") to handle Windows backslashes properly import sys sys.path.append(r"C:\My_Python_Helper_Modules") import Get_Date_and_Time__v1 as Get_Date_and_Time import Error_Handling import time import pyperclip import PySimpleGUI as sg import Mod_01_Joplin_Template_Funcs_v1 as Joplin_Funcs_Mod from Mod_02_Joplin_Template_Class_v1 import Share_Text from Mod_03_Custom_Layout_v1 import custom_Win_Layout import Mod_02_Joplin_Template_Class_v1 as Funcs_Share_Text from yt_dlp import YoutubeDL from urllib.parse import quote from pathlib import Path, PureWindowsPath def custom_input_Win(): # ============================================================= # todo =============== PySimpleGUI: Event Loop =============== # ============================================================= window_size = (500, 670) # (W x H) # STEP 2 - create the window window = sg.Window('Joplin Template 4 Docker Apps v1.0', custom_Win_Layout(), window_size) # STEP3 - the event loop while True: # Read the event that happened and the values dictionary event, values = window.read() # If user closed window with X or if user clicked "Exit" button then exit if event == sg.WIN_CLOSED or event == 'Finish + Exit': break # TODO: ===== Paste In The OG WinPath + Convert It ===== elif event == '-BTN_cls_docker_app_name-': # Gets the OG_WinPath text from the clipboard BTN_cls_docker_app_name = pyperclip.paste() window['-INPUT_cls_docker_app_name-'].update(BTN_cls_docker_app_name) Share_Text.cls_docker_app_name = BTN_cls_docker_app_name print('---') print('The Docker App Name.. Was Pasted To The Clipboard!!') print(BTN_cls_docker_app_name) print('Share_Text.cls_docker_app_name >>>', Share_Text.cls_docker_app_name ) print('---') print() #? === Reset === elif event == '-BTN_RESET_01-': print('Button Reset 01... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_docker_app_name', 'cls_docker_app_name') elif event == '-BTN_cls_GitHub_URL-': # Gets the OG_WinPath text from the clipboard BTN_cls_GitHub_URL = pyperclip.paste() window['-INPUT_GitHub_URL-'].update(BTN_cls_GitHub_URL) Share_Text.cls_GitHub_URL = BTN_cls_GitHub_URL print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_GitHub_URL) print('Share_Text.cls_GitHub_URL >>>', Share_Text.cls_GitHub_URL ) print('---') print() #? === Reset === elif event == '-BTN_RESET_02-': print('Button Reset 01... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_GitHub_URL', 'cls_GitHub_URL') elif event == '-BTN_cls_Home_Page_URL-': # Gets the OG_WinPath text from the clipboard BTN_cls_Home_Page_URL = pyperclip.paste() window['-INPUT_Home_Page_URL-'].update(BTN_cls_Home_Page_URL) Share_Text.cls_Home_Page_URL = BTN_cls_Home_Page_URL print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_Home_Page_URL) print('Share_Text.cls_Home_Page_URL >>>', Share_Text.cls_Home_Page_URL ) print('---') print() #? === Reset === elif event == '-BTN_RESET_03-': print('Button Reset 01... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_Home_Page_URL', 'cls_Home_Page_URL') elif event == '-BTN_cls_Docs_URL-': # Gets the OG_WinPath text from the clipboard BTN_cls_Docs_URL = pyperclip.paste() window['-INPUT_cls_Docs_URL-'].update(BTN_cls_Docs_URL) Share_Text.cls_Docs_URL = BTN_cls_Docs_URL print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_Docs_URL) print('Share_Text.cls_Docs_URL >>>', Share_Text.cls_Docs_URL ) print('---') print() #? === Reset === elif event == '-BTN_RESET_04-': print('Button Reset 04... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_Docs_URL', 'cls_Docs_URL') # todo =============== Win Folder Buttons =============== elif event == '-BTN_cls_folder_path-': # Gets the OG_WinPath text from the clipboard BTN_cls_folder_path = pyperclip.paste() window['-INPUT_cls_folder_path-'].update(BTN_cls_folder_path) Share_Text.cls_folder_path = Joplin_Funcs_Mod.windows_path_to_markdown( BTN_cls_folder_path) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_folder_path) print('Share_Text.cls_folder_path >>>', Share_Text.cls_folder_path ) print('---') print() #? === Reset === elif event == '-BTN_RESET_05-': print('Button Reset 05... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_folder_path', 'cls_folder_path') elif event == '-BTN_cls_MD_File_path-': # Gets the OG_WinPath text from the clipboard BTN_cls_MD_File_path = pyperclip.paste() window['-INPUT_cls_MD_File_path-'].update(BTN_cls_MD_File_path) Share_Text.cls_MD_File_path = Joplin_Funcs_Mod.windows_path_to_markdown( BTN_cls_MD_File_path) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_MD_File_path) print('Share_Text.cls_MD_File_path >>>', Share_Text.cls_MD_File_path ) print('---') print() #? === Reset === elif event == '-BTN_RESET_06-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_MD_File_path', 'cls_MD_File_path') elif event == '-BTN_cls_Compose_File_path-': # Gets the OG_WinPath text from the clipboard BTN_cls_Compose_File_path = pyperclip.paste() window['-INPUT_cls_Compose_File_path-'].update(BTN_cls_Compose_File_path) Share_Text.cls_folder_path = Joplin_Funcs_Mod.windows_path_to_markdown( BTN_cls_Compose_File_path) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_Compose_File_path) print('Share_Text.cls_Compose_File_path >>>', Share_Text.cls_Compose_File_path ) print('---') print() #? === Reset === elif event == '-BTN_RESET_07-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_Compose_File_path', 'cls_Compose_File_path') # todo =============== YouTube URLs Buttons =============== elif event == '-BTN_cls_YT_Tut_Vid_01-': # Gets the OG_WinPath text from the clipboard BTN_cls_YT_Tut_Vid_01 = pyperclip.paste() window['-INPUT_cls_YT_Tut_Vid_01-'].update(BTN_cls_YT_Tut_Vid_01) Share_Text.cls_YT_Tut_Vid_01 = Joplin_Funcs_Mod.YouTube_URL_Formatter( BTN_cls_YT_Tut_Vid_01) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_YT_Tut_Vid_01) print('Share_Text.cls_YT_Tut_Vid_01 >>>', Share_Text.cls_YT_Tut_Vid_01 ) print('---') print() #? === Reset === elif event == '-BTN_RESET_08-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_YT_Tut_Vid_01', 'cls_YT_Tut_Vid_01') elif event == '-BTN_cls_YT_Tut_Vid_02-': # Gets the OG_WinPath text from the clipboard BTN_cls_YT_Tut_Vid_02 = pyperclip.paste() window['-INPUT_cls_YT_Tut_Vid_02-'].update(BTN_cls_YT_Tut_Vid_02) Share_Text.cls_YT_Tut_Vid_02 = Joplin_Funcs_Mod.YouTube_URL_Formatter( BTN_cls_YT_Tut_Vid_02) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_YT_Tut_Vid_02) print('Share_Text.cls_YT_Tut_Vid_02 >>>', Share_Text.cls_YT_Tut_Vid_02 ) print('---') print() #? === Reset === elif event == '-BTN_RESET_09-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_YT_Tut_Vid_02', 'cls_YT_Tut_Vid_02') elif event == '-BTN_cls_YT_Tut_Vid_Search-': # Gets the OG_WinPath text from the clipboard BTN_cls_YT_Tut_Vid_Search = pyperclip.paste() window['-INPUT_cls_YT_Tut_Vid_Search-'].update(BTN_cls_YT_Tut_Vid_Search) Share_Text.cls_YT_Tut_Vid_Search = Joplin_Funcs_Mod.YT_Search_URL_Formatter( BTN_cls_YT_Tut_Vid_Search) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_YT_Tut_Vid_Search) print('Share_Text.cls_YT_Tut_Vid_Search >>>', Share_Text.cls_YT_Tut_Vid_Search ) print('---') print() #? === Reset === elif event == '-BTN_RESET_10-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_YT_Tut_Vid_Search', 'cls_YT_Tut_Vid_Search') # todo =============== Web Search URLs =============== # todo =============== Web Search URLs =============== elif event == '-BTN_cls_SearXNG_Search-': # Gets the OG_WinPath text from the clipboard BTN_cls_SearXNG_Search = pyperclip.paste() window['-INPUT_cls_SearXNG_Search-'].update(BTN_cls_SearXNG_Search) Share_Text.cls_SearXNG_Search = Joplin_Funcs_Mod.Web_Search_URL_Formatter( BTN_cls_SearXNG_Search, 'cls_SearXNG_Search' ) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_SearXNG_Search) print('Share_Text.cls_SearXNG_Search >>>', Share_Text.cls_SearXNG_Search ) print('---') print() #? === Reset === elif event == '-BTN_RESET_11-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_SearXNG_Search', 'cls_SearXNG_Search') # ===================== HorizontalSeparator ===================== elif event == '-BTN_cls_Google_Search-': # Gets the OG_WinPath text from the clipboard BTN_cls_Google_Search = pyperclip.paste() window['-INPUT_cls_Google_Search-'].update(BTN_cls_Google_Search) Share_Text.cls_Google_Search = Joplin_Funcs_Mod.Web_Search_URL_Formatter( BTN_cls_Google_Search, 'cls_Google_Search' ) print('---') print('The WinPath Was Pasted To The Clipboard!!') print(BTN_cls_YT_Tut_Vid_Search) print('Share_Text.cls_Google_Search >>>', Share_Text.cls_Google_Search ) print('---') print() #? === Reset === elif event == '-BTN_RESET_12-': print('Button Reset 06... Was Pressed') Joplin_Funcs_Mod.reset_psg_window(window, 'INPUT_cls_Google_Search', 'cls_Google_Search') window.close() # ? ==== End Of Custom Window Function ==== def ask_2_write_file() ->str: """ Popup to ask the user if they are finished & want to write the .md file _extended_summary_ Returns: str: Yes or No answer from the PSG popup """ popup_title = 'Write The File?' popup_msg = (f'\nDo You Want To Write The Joplin File Now? \n' # f' >> {Error_Text} << \n\n' f'YES or NO?... \n\n' f'Yes = Write The File And Print \n' f' or... \n' f'No = Just Print to the Console \n' # f' or... \n' # f'2. A Valid Web URL \n\n' # f'Please Press Reset & Try Again \n' ) pop_answer = sg.popup_yes_no(popup_msg, popup_title, font=('Arial', 12, 'bold'), ) print(f'User Selected: ', pop_answer) return pop_answer #? ==== End Of Function ==== def write_file() -> str: print('=== write_file === START ') print('Now writing the Joplin file... ') Funcs_Share_Text.write_Template_2_File() print('writing Joplin file... Now Completed!! ') print('=== write_file === END ') #? ==== End Of Function ==== def Print_to_the_Console() -> str: print('Now Printing the Joplin_Template_Txt... ') print('=== Joplin_Template_Txt ===') print(Funcs_Share_Text.func_Joplin_Template_Txt()) print('Done!') print() #? ==== End Of Function ==== def Main(): custom_input_Win() print('='*20) print('='*5, 'All Inputs Now Completed!!', '='*5) print('='*20) # time.sleep(2.0) answer = ask_2_write_file() if answer == 'Yes': write_file() Print_to_the_Console() elif answer == 'N0': Print_to_the_Console() else: print(f'The User exited without Selecting anything! ' ) print() #? ==== End Of Function ==== if __name__ == '__main__': # docker_app_name = 'Gotify' Main()