ObaraEmmanuel / Formation

Tools for building gorgeous graphical user interfaces in tkinter
MIT License
271 stars 23 forks source link

Add macOS support #7

Open ObaraEmmanuel opened 3 years ago

ObaraEmmanuel commented 3 years ago

Currently, only windows and linux are supported. Formation on macOS is untested and you will most definitely run into problems. It would be nice if someone helped bring Formation to macOS.

SatyenderSinghRana commented 3 years ago

Hi Obara, i'm here to help :)

ObaraEmmanuel commented 3 years ago

Cool, you could comment on any issues you run into here and we can work to fix them ... include tracebacks for any error so it is easy for us to debug.

SatyenderSinghRana commented 3 years ago

I'm getting this when i run formation-studio in terminal

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/bin/formation-studio", line 8, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 624, in main StudioApplication().mainloop() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 48, in init self._restore_position() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 215, in _restore_position self.wm_attributes('-zoomed', True) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/init.py", line 1967, in wm_attributes return self.tk.call(args) _tkinter.TclError: bad attribute "-zoomed": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, or -transparent

ObaraEmmanuel commented 3 years ago

@SatyenderSinghRana-in I think I have ironed out this issue. Try installing this particular branch like so

pip install --upgrade git+https://github.com/ObaraEmmanuel/Formation@macos-support

and see if it works

SatyenderSinghRana commented 3 years ago

I upgraded to the new branch and tried running formation-studio, looks like i'm still getting the same error

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/bin/formation-studio", line 8, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 624, in main StudioApplication().mainloop() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 48, in init self._restore_position() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 215, in _restore_position self.wm_attributes('-zoomed', True) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/init.py", line 1967, in wm_attributes return self.tk.call(args) _tkinter.TclError: bad attribute "-zoomed": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, or -transparent

ObaraEmmanuel commented 3 years ago

I don't think that's the right version you are using coz line 215 is a very different thing in the mac os branch. Ensure you run the command exactly as I gave you before and ascertain that the installation is successful.... the --upgrade is very important

SatyenderSinghRana commented 3 years ago

I have shared the steps I followed and the message after each command 1) pip install formation-studio Message: Installing collected packages: argparse, mss, entrypoint2, EasyProcess, pyscreenshot, Pillow, lxml, appdirs, formation-studio Successfully installed EasyProcess-0.3 Pillow-8.1.2 appdirs-1.4.4 argparse-1.4.0 entrypoint2-0.2.3 formation-studio-0.2.1 lxml-4.6.2 mss-6.1.0 pyscreenshot-2.3

2) pip install --upgrade git+https://github.com/ObaraEmmanuel/Formation@macos-support Message: Collecting git+https://github.com/ObaraEmmanuel/Formation@macos-support Cloning https://github.com/ObaraEmmanuel/Formation (to revision macos-support) to /private/var/folders/rv/t2gt2d9d6lg6g6cvrm_rvf0w0000gn/T/pip-req-build-86od_0hx Running command git clone -q https://github.com/ObaraEmmanuel/Formation /private/var/folders/rv/t2gt2d9d6lg6g6cvrm_rvf0w0000gn/T/pip-req-build-86od_0hx Running command git checkout -b macos-support --track origin/macos-support Switched to a new branch 'macos-support' Branch 'macos-support' set up to track remote branch 'macos-support' from 'origin'. Requirement already satisfied: lxml in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from formation-studio==0.2.1) (4.6.2) Requirement already satisfied: Pillow in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from formation-studio==0.2.1) (8.1.2) Requirement already satisfied: appdirs in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from formation-studio==0.2.1) (1.4.4) Requirement already satisfied: pyscreenshot in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from formation-studio==0.2.1) (2.3) Requirement already satisfied: entrypoint2 in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from pyscreenshot->formation-studio==0.2.1) (0.2.3) Requirement already satisfied: mss in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from pyscreenshot->formation-studio==0.2.1) (6.1.0) Requirement already satisfied: EasyProcess in ./.pyenv/versions/3.9.1/lib/python3.9/site-packages (from pyscreenshot->formation-studio==0.2.1) (0.3) Collecting argparse Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB) Installing collected packages: argparse Successfully installed argparse-1.4.0

3) formation-studio Message: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/bin/formation-studio", line 8, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 624, in main StudioApplication().mainloop() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 48, in init self._restore_position() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/studio/main.py", line 215, in _restore_position self.wm_attributes('-zoomed', True) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/init.py", line 1967, in wm_attributes return self.tk.call(args) _tkinter.TclError: bad attribute "-zoomed": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, or -transparent

ObaraEmmanuel commented 3 years ago

It seems you have multiple python versions installed on your computer ... while the pip installation is going to python 3.9 you are running formation-studio installed on python 3.8... uninstall the one on 3.8 or pip ugrade install to the one in 3.8.

SatyenderSinghRana commented 3 years ago

I uninstalled python 3.8 and 3.9 (also manually removed leftovers from library) ran "pip freeze" followed by removing all the modules previously installed to start fresh then installed python 3.9.2 and ran these in terminal: 1) pip3 install formation-studio 2) pip3 install --upgrade git+https://github.com/ObaraEmmanuel/Formation@macos-support 3) formation-studio

now i'm getting this

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/bin/formation-studio", line 8, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/studio/main.py", line 623, in main ResourceLoader.load() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/studio/resource_loader.py", line 73, in load style = StyleDelegator(pref.get("resource::theme")) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 129, in init styles = parse(files) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 117, in parse bundles = re.findall(patterns["bundle"], merged_files(files)) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 95, in merged_files return "".join([read_file(file) for file in files]) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 95, in return "".join([read_file(file) for file in files]) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 86, in read_file with open(file_name, "r") as test_file: FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hoverset/ui/themes/default.css'

not sure how to run the package installed via pip3 for python 3.9

ObaraEmmanuel commented 3 years ago

The app is having problems reading the config and cache files from the previous versions ... let me remedy that .... stand by for a fix ... I'll inform you when it's done

meanwhile delete everything inside this folder

~/Library/Preferences/formation/

and try again. It will work

SatyenderSinghRana commented 3 years ago

Alright

ObaraEmmanuel commented 3 years ago

did it work?

SatyenderSinghRana commented 3 years ago

I uninstalled formation-studio, here are the steps with messages after uninstalling:

pip --version pip 21.0.1 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)

pip uninstall formation-studio Found existing installation: formation-studio 0.2.1 Uninstalling formation-studio-0.2.1: Would remove: /Library/Frameworks/Python.framework/Versions/3.9/bin/formation-studio /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/formation/ /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/formation_studio-0.2.1.dist-info/ /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/studio/ Proceed (y/n)? y Successfully uninstalled formation-studio-0.2.1

pip show formation-studio WARNING: Package(s) not found: formation-studio

pip install formation-studio Collecting argparse Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB) Installing collected packages: argparse, formation-studio Successfully installed argparse-1.4.0 formation-studio-0.2.1

pip install --upgrade git+https://github.com/ObaraEmmanuel/Formation@macos-support Collecting argparse Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB) Installing collected packages: argparse Successfully installed argparse-1.4.0

formation-studio
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/bin/formation-studio", line 8, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/studio/main.py", line 623, in main ResourceLoader.load() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/studio/resource_loader.py", line 73, in load style = StyleDelegator(pref.get("resource::theme")) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 129, in init styles = parse(files) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 117, in parse bundles = re.findall(patterns["bundle"], merged_files(files)) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 95, in merged_files return "".join([read_file(file) for file in files]) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 95, in return "".join([read_file(file) for file in files]) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/hoverset/ui/styles.py", line 86, in read_file with open(file_name, "r") as test_file: FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/hoverset/ui/themes/default.css'

I hope i'm not doing anything wrong at my end? Do I need to change any path variables?

ObaraEmmanuel commented 3 years ago

did you delete the files i told you about?

~/Library/Preferences/formation
SatyenderSinghRana commented 3 years ago

I double checked it, I don't have any formation related file/folder in ~/Library/Preferences/formation

All the modules are installed here instead /Library/Frameworks/Python.framework/Versions/3.9/bin/ and /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/

ObaraEmmanuel commented 3 years ago

Try the following commands in that order

pip install --upgrade git+https://github.com/ObaraEmmanuel/Formation@macos-support
formation-cli --remove config
formation-studio

formation-cli is a cool tool i added to help you clean config and cache files as well as modify config files without necessarily opening formation studio.

SatyenderSinghRana commented 3 years ago

I tried the commands in given order, i'm getting this now

formation-cli --remove config zsh: command not found: formation-cli

also tried this

pip3 formation-cli --remove config (using pip also gave the same error) ERROR: unknown command "formation-cli"

ObaraEmmanuel commented 3 years ago

Your installation probably wasn't successful... you are sure the pip install worked? ... try uninstalling then installing once more.

SatyenderSinghRana commented 3 years ago

I have tried uninstalling then installing and I still get the same message 🤔 pip install shows "Successfully installed argparse-1.4.0 formation-studio-0.2.1"

ObaraEmmanuel commented 3 years ago

don't run the command like this ... this doesn't make sense

pip3 formation-cli --remove config

formation cli is a standalone application so run it like this

formation-cli --remove config

the new version definitely has formation-cli ... I tested it in a virtual environment and it worked. The problem has to be on your end.

edit: the latest version should be able to handle the config issue without you necessarily running formation-cli so u can upgrade and run the studio directly

SatyenderSinghRana commented 3 years ago

I tried reinstalling it again and it's not working on my system. I also think that the problem might be with my system. I have asked one of my friends to install formation-studio, once he does that I'll inform you

ObaraEmmanuel commented 3 years ago

@SatyenderSinghRana-in how did it go?

SatyenderSinghRana commented 3 years ago

He is out of station for some work. I've reminded him to check it, I'll message you once he replies.

SatyenderSinghRana commented 3 years ago

Sorry for the delay, here's the screenshot he sent me IMG_20210313_182930.jpg

ObaraEmmanuel commented 3 years ago

He is using python 2.7 which is not supported

SatyenderSinghRana commented 3 years ago

It's working on his system now

He is using python 3.7 and he installed it like this: pip3.7 install formation-studio

pip3.7 install --upgrade git+https://github.com/ObaraEmmanuel/Formation@macos-support

formation-studio

I have installed python 3.7 on my system but same is not working on my system so there's probably something wrong in my system.

ObaraEmmanuel commented 3 years ago

What exactly is the issue with yours? I told you I pushed a version that will work even if you don't run formation-cli. Try again and send the issue here if any

SatyenderSinghRana commented 3 years ago

It's working now 👍🏻

ObaraEmmanuel commented 3 years ago

It's working now 👍🏻

Could you kindly send a screenshot? Make it look good.

Are there other issues you may have noticed?

SatyenderSinghRana commented 3 years ago
ss

Demo login interface to share, I'll explore it more later, nice work so far ✌️

ObaraEmmanuel commented 3 years ago

looks good ... a couple of visual hitches but nothing that can't be fixed ... I will try and set up macOS on an emulator and polish it up.

ObaraEmmanuel commented 3 years ago

@SatyenderSinghRana Hello, I managed to set up mac on an emulator and fix a few things, If you have the time you could take a look at the master branch and point out any issues that may come up. The emulator is a bit limited and I may not be able to get the full experience as on real mac hardware.

pip install --upgrade git+https://github.com/ObaraEmmanuel/Formation@master
SatyenderSinghRana commented 3 years ago

Hi Obara, I sold my MacBook :( sometime ago and now I'm using a Windows laptop. Due to this, I won't be able to review the changes related to Formation Studio.

SatyenderSinghRana commented 3 years ago

I have a tight schedule these days, but I'll try to contribute to the windows version of Formation Studio :)

Kastakin commented 5 months ago

Hello, I have a M3 Pro Macbook. I am a PhD student with kind of a tight schedule but I love the potential of the project and I would really like to help in any way I could.

ObaraEmmanuel commented 5 months ago

Hello @Kastakin. I appreciate your interest in the project. I don't use MacOS so I don't have very clear insights into what MacOS issues the studio has. I know the entire shortcut-keys system does not work on Mac because I haven't gotten round to figuring out the keycodes. The last time I tried I did not get consistent keycodes on Mac so I gave up. It can be worth looking at in your free time. The code for that is in hoverset/data/keymap.py. Other than that, feel free to identify and report/fix any other issues you notice.

shayneoneill commented 2 months ago

Current macos state seems to be a no go. At least on 3.11 in a virtualenv After trying to install first via the regular pip install formation-studio , but then also after the pip install --upgrade git+https://github.com/ObaraEmmanuel/Formation@master I get;-

Screenshot 2024-08-29 at 12 03 40 PM
ObaraEmmanuel commented 1 month ago

It seems you are using an M series chip and the libraries provided by tkdnd for mac are for x86_64. I'll try to catch this exception and disable dnd entirely for these cases.

ObaraEmmanuel commented 1 month ago

@shayneoneill you can pull the latest changes I've made and try again.