Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash issue on linux #237

Merged
merged 1 commit into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pandasgui/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
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')
32 changes: 17 additions & 15 deletions pandasgui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
Expand Down