Python-Easy-Chess-GUI icon indicating copy to clipboard operation
Python-Easy-Chess-GUI copied to clipboard

Support for MacOS/Linux?

Open fmhall opened this issue 6 years ago • 6 comments

Since .exes are used, this doesnt seem to work on UNIX based systems. What is involved in making that possible? I can submit a PR.

fmhall avatar Dec 05 '19 21:12 fmhall

The source in python is available. Both python source and exe worked in windows. I have not tried it yet with linux or mac. Please submit a PR if you can.

fsmosca avatar Dec 26 '19 10:12 fsmosca

Task is in progress.

  • [x] Don't crash the program if there is no linux engine in Engines folder
  • [x] Able to run linux engine and get its id name
  • [x] Fix window.Disable(), by PySimpleGUI library, fix in 41a4ae236dc0c8ba0644b8eb7cde7ad55acf8977

fsmosca avatar Feb 09 '20 13:02 fsmosca

This small fix for OSX works to get engines directory filled with right content.

In get_engines add .DS_Store to the ignore list

def get_engines(self):
        """
        Get engine filenames [a.exe, b.exe, ...]

        :return: list of engine filenames
        """
        engine_list = []
        engine_path = Path('Engines')
        files = os.listdir(engine_path)
        
        for file in files:
            if not file.endswith('.gz') and not file.endswith('.dll') \
                    and not file.endswith('.DS_Store') \
                    and not file.endswith('.bin') \
                    and not file.endswith('.dat'):
                engine_list.append(file)

        return engine_list

tillchess avatar Apr 18 '21 11:04 tillchess

Thanks I will update it.

fsmosca avatar Apr 19 '21 00:04 fsmosca

This small fix for OSX works to get engines directory filled with right content.

In get_engines add .DS_Store to the ignore list

This is now implemented in Python Easy Chess GUI v1.13.

fsmosca avatar Apr 20 '21 03:04 fsmosca

Task is in progress.

  • [x] Don't crash the program if there is no linux engine in Engines folder
  • [x] Able to run linux engine and get its id name
  • [ ] Fix window.Disable(), by PySimpleGUI library

This is the current fix to window.Disable(). Tested to work in windows and linux (WSL ubuntu 20.04). Might also work in osx. I don't have access to osx so I cannot test it.

Modify pysimplegui.py with the following change:

    def disable(self):
        """
        Disables window from taking any input from the user
        """
        if not self._is_window_created():
            return
        self.TKroot.grab_release()  # Only 'disables' an already 'enabled' window. Does nothing to a normal window
        # self.TKroot.attributes('-disabled', 1)
        # self.TKroot.grab_set_global()

    def enable(self):
        """
        Re-enables window to take user input after having it be Disabled previously
        """
        if not self._is_window_created():
            return
        self.TKroot.grab_set  # I read grab_set_global messes with all open windows so I wanted to avoid that
        # self.TKroot.attributes('-disabled', 0)
        # self.TKroot.grab_release()

This is not yet officially supported by pysimplegui.

fsmosca avatar Apr 22 '21 02:04 fsmosca

Recently installed this on Ubuntu 20.04 and when I want to select engine it closes down. It happens the same for all the other menu options but for game and help. I have re downloaded it but still the same error. Any other fix available?

Pichetraful avatar Nov 03 '22 11:11 Pichetraful

Could you post the log file?. Let us see what is in there.

fsmosca avatar Nov 03 '22 12:11 fsmosca

These are the lines I see in the pecg_log.txt file. Is there other log or place where this will be registered: 2022-11-03 12:21:29,050 :: get_default_engine_opponent :: line: 2554 :: WARNING :: list index out of range 2022-11-03 12:21:29,050 :: set_default_adviser_engine :: line: 2543 :: WARNING : : list index out of range

Pichetraful avatar Nov 03 '22 12:11 Pichetraful

There is no other log.

Looks like there is no engine. Check the Engines folder, there should be a linux engine there.

fsmosca avatar Nov 03 '22 13:11 fsmosca

Engines ls CDrill_1800_32bit.exe Deuterium_v2019.2.37.73_64bit_pop.exe Deuterium_v2019.1.36.50_32bit.exe Deuterium_v2020.1.38.5_linux_64bit ➜ Engines tree . ├── CDrill_1800_32bit.exe ├── Deuterium_v2019.1.36.50_32bit.exe ├── Deuterium_v2019.2.37.73_64bit_pop.exe └── Deuterium_v2020.1.38.5_linux_64bit

0 directories, 4 files

Pichetraful avatar Nov 03 '22 14:11 Pichetraful

how can I hardcode the engine? If I try to select/install from the menu, it crashes ....

Pichetraful avatar Nov 03 '22 14:11 Pichetraful

Did you use PySimpleGUI==4.49.0?

fsmosca avatar Nov 03 '22 14:11 fsmosca

Checking....

Pichetraful avatar Nov 03 '22 14:11 Pichetraful

➜ Python-Easy-Chess-GUI-master pip list | grep PySimpleGUI PySimpleGUI 4.60.4

Pichetraful avatar Nov 03 '22 15:11 Pichetraful

When I tried it last time, I only use 4.49.0

This is its requirements.txt

chess==1.6.1
pyperclip==1.8.2
PySimpleGUI==4.49.0

fsmosca avatar Nov 03 '22 15:11 fsmosca

I confirm nothing works on Linux. I use Linux Mint 21 Cinnamon. python3

I need to install tkinter, else it spits an error: sudo apt-get install python3-tk

Even with the good dependecies, it has the same behavior: Play asks to install engine. Help shows the windows. Any other button crashes the window...

I tried both as root and user.

Romain-Revel avatar Nov 24 '22 19:11 Romain-Revel

I will check this issue once I have a linux machine.

fsmosca avatar Nov 25 '22 04:11 fsmosca

@Romain-Revel

Can you try this fix?

https://github.com/fsmosca/Python-Easy-Chess-GUI/issues/35#issuecomment-824499803

fsmosca avatar Dec 01 '22 13:12 fsmosca

@Pichetraful

Can you try this fix?

https://github.com/fsmosca/Python-Easy-Chess-GUI/issues/35#issuecomment-824499803

fsmosca avatar Dec 01 '22 13:12 fsmosca

Where exactly should I place the code(fix)? I see many classes with different def's..... Would it be ok to place it in : class EasyChessGui: .....?

Pichetraful avatar Dec 01 '22 15:12 Pichetraful

Ignore it. I updated the code to use HIde()/UnHide() instead of Disable()/Enable() in 41a4ae236dc0c8ba0644b8eb7cde7ad55acf8977

Based from test, it works on windows and linux/ubuntu.

fsmosca avatar Dec 01 '22 16:12 fsmosca

It works.

But you should add in the install section the need to chmod +x the linux UCI engine, else it can't import name nor add it.

Romain-Revel avatar Dec 01 '22 16:12 Romain-Revel

@fsmosca, so... should I download the code again or what exactly do I need to do?

Pichetraful avatar Dec 01 '22 21:12 Pichetraful

@fsmosca, so... should I download the code again or what exactly do I need to do?

Download the code again.

For example you can use the git clone command.

git clone https://github.com/fsmosca/Python-Easy-Chess-GUI.git

fsmosca avatar Dec 01 '22 23:12 fsmosca

It works.

But you should add in the install section the need to chmod +x the linux UCI engine, else it can't import name nor add it.

Thanks.

fsmosca avatar Dec 02 '22 00:12 fsmosca

I just tested on my ubuntu and it works.... Thanks!

Pichetraful avatar Dec 02 '22 13:12 Pichetraful