diff --git a/pandasgui/constants.py b/pandasgui/constants.py index b612226..6f2e3bc 100644 --- a/pandasgui/constants.py +++ b/pandasgui/constants.py @@ -12,6 +12,7 @@ PANDASGUI_ICON_PATH = pkg_resources.resource_filename(__name__, "resources/images/icon.png") PANDASGUI_ICON_PATH_ICO = pkg_resources.resource_filename(__name__, "resources/images/icon.ico") -SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', ) -PY_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'python.exe') -PYW_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe') \ No newline at end of file +if sys.platform == "win32": + SHORTCUT_PATH = os.path.join(os.getenv('APPDATA'), 'Microsoft/Windows/Start Menu/Programs/PandasGUI.lnk', ) + PY_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'python.exe') + PYW_INTERPRETTER_PATH = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe') \ No newline at end of file diff --git a/pandasgui/gui.py b/pandasgui/gui.py index 419bc4e..d1c233f 100644 --- a/pandasgui/gui.py +++ b/pandasgui/gui.py @@ -382,23 +382,25 @@ def remove_from_context_menu(self): # https://stackoverflow.com/a/46081847 def add_to_start_menu(self): - import os - import win32com.client - import pythoncom - from pandasgui.constants import PANDASGUI_ICON_PATH_ICO, PYW_INTERPRETTER_PATH, SHORTCUT_PATH - - shell = win32com.client.Dispatch("WScript.Shell") - shortcut = shell.CreateShortCut(SHORTCUT_PATH) - shortcut.Targetpath = PYW_INTERPRETTER_PATH - shortcut.Arguments = '-c "import pandasgui; pandasgui.show()"' - shortcut.IconLocation = PANDASGUI_ICON_PATH_ICO - shortcut.WindowStyle = 7 # 7 - Minimized, 3 - Maximized, 1 - Normal - shortcut.save() + if sys.platform == "win32": + import os + import win32com.client + import pythoncom + from pandasgui.constants import PANDASGUI_ICON_PATH_ICO, PYW_INTERPRETTER_PATH, SHORTCUT_PATH + + shell = win32com.client.Dispatch("WScript.Shell") + shortcut = shell.CreateShortCut(SHORTCUT_PATH) + shortcut.Targetpath = PYW_INTERPRETTER_PATH + shortcut.Arguments = '-c "import pandasgui; pandasgui.show()"' + shortcut.IconLocation = PANDASGUI_ICON_PATH_ICO + shortcut.WindowStyle = 7 # 7 - Minimized, 3 - Maximized, 1 - Normal + shortcut.save() def remove_from_start_menu(self): - from pandasgui.constants import SHORTCUT_PATH - import os - os.remove(SHORTCUT_PATH) + if sys.platform == "win32": + from pandasgui.constants import SHORTCUT_PATH + import os + os.remove(SHORTCUT_PATH) def add_jupyter_to_context_menu(self): import winreg diff --git a/setup.py b/setup.py index 56b7bbb..028ca0c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="pandasgui", - version="0.2.14", + version="0.2.15", description="A GUI for Pandas DataFrames.", author="Adam Rose", author_email="adrotog@gmail.com",