#!/usr/bin/python3 """ ===================================================================================== makecalendar.py (frigcal utility script) Run me to generate a new named calendar file in the calendars folder. The new calendar's name is input in this script's console window. Reuses file creation code in icsfiletools written for the default file. Not required if you use just existing files or the automatic default file. ===================================================================================== """ import os, sys RunningOnMacOS = sys.platform.startswith('darwin') RunningOnWindows = sys.platform.startswith('win') if RunningOnWindows: # # [3.0] auto deblur tkinter GUIs, whether run by python.exe or standalone exe; # this may matter for tool scripts if standalone exes (e.g., clicked to run); # from ctypes import windll, c_int64 windll.user32.SetProcessDpiAwarenessContext(c_int64(-4)) # per monitor aware v2 # [2.0] for frozen app/exes, fix module+resource visibility (sys.path) import fixfrozenpaths # [3.0] special case (yuck): pyinstaller, but not an app (see fix file) if RunningOnMacOS and hasattr(sys, 'frozen'): exepath = sys.argv[0] exedir = os.path.dirname(os.path.abspath(exepath)) os.chdir(exedir) # for any "." file refs sys.path.append(exedir) # for configs .py import else: # [2.0] make relative calendar paths map to frigcal's install folder os.chdir(fixfrozenpaths.fetchMyInstallDir(__file__)) # absolute import icsfiletools icsfiletools.ask_init_default_ics_file() print('Calendar created; (re)start Frigcal to use it.') input('Press Enter to close.')