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
|
from tkinter import ttk
|
||||||
import sys, os, json, traceback
|
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()
|
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
|
# easy way to get data out of window events
|
||||||
class Window_Interaction_Handler:
|
class Window_Interaction_Handler:
|
||||||
# constructor
|
# constructor
|
||||||
|
@ -57,10 +72,14 @@ class Window_Interaction_Handler:
|
||||||
if len(self.__window_interactions)>0:
|
if len(self.__window_interactions)>0:
|
||||||
warn("__window_interactions not empty upon destruction of Window_Interaction_Handler:\n"+str(self.__window_interactions))
|
warn("__window_interactions not empty upon destruction of Window_Interaction_Handler:\n"+str(self.__window_interactions))
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# PROGRAM START
|
||||||
|
################################################################################
|
||||||
|
|
||||||
# read configuration
|
# read configuration
|
||||||
home_directory = os.path.expanduser("~")
|
home_directory = os.path.expanduser("~")
|
||||||
config_file_path = os.path.join(home_directory, "some_ide_config.json")
|
config_file_path = os.path.join(home_directory, "some_ide_config.json")
|
||||||
|
# default configuration
|
||||||
configuration = {}
|
configuration = {}
|
||||||
if os.path.isfile(config_file_path):
|
if os.path.isfile(config_file_path):
|
||||||
try:
|
try:
|
||||||
|
@ -88,7 +107,7 @@ else:
|
||||||
warn("Not implemented!")
|
warn("Not implemented!")
|
||||||
else:
|
else:
|
||||||
print("No config present and user chose not to create one. Exiting.")
|
print("No config present and user chose not to create one. Exiting.")
|
||||||
sys.exit()
|
sys.exit(EXIT_SUCCESS)
|
||||||
|
|
||||||
#window = tk.Tk()
|
#window = tk.Tk()
|
||||||
#frame = ttk.Frame(window, padding=10)
|
#frame = ttk.Frame(window, padding=10)
|
||||||
|
|
Reference in New Issue