made things more structured
parent
02a6f555e0
commit
73c37988f4
25
main.py
25
main.py
|
@ -3,10 +3,25 @@ import tkinter as tk
|
|||
from tkinter import ttk
|
||||
import sys, os, json, traceback
|
||||
|
||||
def warn(text):
|
||||
print("WARNING: "+str(text), file=sys.stderr)
|
||||
################################################################################
|
||||
# DEFINITIONS
|
||||
################################################################################
|
||||
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_ERROR=1
|
||||
|
||||
def warn(message):
|
||||
print("WARNING: "+str(message), file=sys.stderr)
|
||||
traceback.print_stack()
|
||||
|
||||
def error(message, handle_gracefully=True):
|
||||
print("ERROR: "+str(message), file=sys.stderr)
|
||||
traceback.print_stack()
|
||||
if handle_gracefully:
|
||||
pass
|
||||
else:
|
||||
sys.exit(EXIT_ERROR)
|
||||
|
||||
# easy way to get data out of window events
|
||||
class Window_Interaction_Handler:
|
||||
# constructor
|
||||
|
@ -57,10 +72,14 @@ class Window_Interaction_Handler:
|
|||
if len(self.__window_interactions)>0:
|
||||
warn("__window_interactions not empty upon destruction of Window_Interaction_Handler:\n"+str(self.__window_interactions))
|
||||
|
||||
################################################################################
|
||||
# PROGRAM START
|
||||
################################################################################
|
||||
|
||||
# read configuration
|
||||
home_directory = os.path.expanduser("~")
|
||||
config_file_path = os.path.join(home_directory, "some_ide_config.json")
|
||||
# default configuration
|
||||
configuration = {}
|
||||
if os.path.isfile(config_file_path):
|
||||
try:
|
||||
|
@ -88,7 +107,7 @@ else:
|
|||
warn("Not implemented!")
|
||||
else:
|
||||
print("No config present and user chose not to create one. Exiting.")
|
||||
sys.exit()
|
||||
sys.exit(EXIT_SUCCESS)
|
||||
|
||||
#window = tk.Tk()
|
||||
#frame = ttk.Frame(window, padding=10)
|
||||
|
|
Reference in New Issue