refactor: Conditionally import tkinter and update local environment detection
This commit is contained in:
parent
c224424e04
commit
cc3a7d1175
@ -5,13 +5,19 @@ import warnings
|
|||||||
import shutil
|
import shutil
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import tempfile
|
import tempfile
|
||||||
import tkinter as tk
|
|
||||||
from tkinter import filedialog
|
|
||||||
import zipfile
|
import zipfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import glob
|
import glob
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
# Conditionally import tkinter
|
||||||
|
try:
|
||||||
|
import tkinter as tk
|
||||||
|
from tkinter import filedialog
|
||||||
|
TKINTER_AVAILABLE = True
|
||||||
|
except ImportError:
|
||||||
|
TKINTER_AVAILABLE = False
|
||||||
from main import (
|
from main import (
|
||||||
load_workbook_with_possible_passwords,
|
load_workbook_with_possible_passwords,
|
||||||
copy_excel_file,
|
copy_excel_file,
|
||||||
@ -21,11 +27,7 @@ from main import (
|
|||||||
|
|
||||||
def is_running_locally():
|
def is_running_locally():
|
||||||
"""Check if the app is running locally or in cloud environment"""
|
"""Check if the app is running locally or in cloud environment"""
|
||||||
try:
|
return TKINTER_AVAILABLE
|
||||||
import tkinter
|
|
||||||
return True
|
|
||||||
except ImportError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Configure page
|
# Configure page
|
||||||
st.set_page_config(
|
st.set_page_config(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user