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

Linux support #2

Open
howff opened this issue Oct 22, 2021 · 6 comments
Open

Linux support #2

howff opened this issue Oct 22, 2021 · 6 comments

Comments

@howff
Copy link

howff commented Oct 22, 2021

What is preventing this from running on Linux?

I've tried this on ubuntu:

sudo apt install tkdnd
pip install imageio tkinterdnd2

I changed import TkinterDnD2 as tkDnD to import tkinterdnd2 as tkDnD (not sure why the case is different)

I had to comment out self.iconbitmap(resource_directory(ICON_FILE)) (not sure why but it gave the error

  File "./imquick.py", line 861, in <module>
    app = ImQuick(root, file_in)
  File "./imquick.py", line 56, in __init__
    self.iconbitmap(resource_directory(ICON_FILE))
  File "/usr/lib/python3.8/tkinter/__init__.py", line 2080, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "resources/ImQuick.ico" not defined

even though that file definitely exists).

After that it seems to work ok.

@DavidStirling
Copy link
Owner

What is preventing this from running on Linux?

I developed and built it on Windows with a specific use-case in mind. As such it's not tested on Linux or macOS but could work. ImQuick's builds are made integrate with Windows, and I'm not familiar enough with Linux to know how to add the equivalent of "Open with" shortcuts. Nonetheless if that'd be feasible it may be worth expanding support.

I changed import TkinterDnD2 as tkDnD to import tkinterdnd2 as tkDnD (not sure why the case is different)

Aha! The tkDnD2 system wasn't available on PyPi when I started development. This should make it much easier to install going forwards, thanks for finding that.

With regards to the icon issues, I believe linux tk doesn't support .ico files (I may be wrong). We'd need to add a PNG version for that resource to work properly.

Please do make a note of any problems you encounter!

@howff
Copy link
Author

howff commented Oct 22, 2021

My suggestion would be:

  • put sudo apt install tkdnd into the Installation part of the document
  • change the import to import tkinterdnd2 as tkDnD (or put that in the except: part of a try import TkinterDnD2 as tkDnD)
  • wrap self.iconbitmap in a try: except so it doesn't crash if no icon found

That's enough to be able to advertise Linux compatibility.

The desktop integration can be partly handled by creating a .desktop file, but that's for another day/issue.

@DavidStirling
Copy link
Owner

Thanks, looks like it can run on macOS too with some minor modifications. Would you be able to post a screenshot of how it looks on Linux?

@howff
Copy link
Author

howff commented Oct 26, 2021

imquick1

@DavidStirling
Copy link
Owner

Thanks for that! Looks like the UI elements are behaving sensibly. I've made the macOS-linux-support branch with some modifications for this, would you be able to test it on your Linux machine?

@howff
Copy link
Author

howff commented Jan 5, 2022

Sorry for the delay. The instruction to pip install -e . doesn't work (no setup.py) but pip install -r requirements.txt worked. The program then worked (although you might still need to add sudo apt install tkdnd to the readme). However the info window complained

    self.iconbitmap(resource_directory(ICON_FILE))
  File "/usr/lib/python3.8/tkinter/__init__.py", line 2080, in wm_iconbitmap
    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "resources/ImQuick.png" not defined

Not sure why, because that file definitely exists.
If I remove the call to self.iconbitmap then it is ok.
The About window doesn't make that call anyway so I think it's not necessary for the Info window either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants