featurecat / lizzie

Lizzie - Leela Zero Interface
GNU General Public License v3.0
970 stars 228 forks source link

Dialogs appear on different monitors in dual display setup #885

Open w3333 opened 3 years ago

w3333 commented 3 years ago

Would it be possible to fix that? I have 2 monitors (running Linux), Lizzie main window is on the secondary screen. All dialogs (analyze-all, open, delete-node-warning ...) will still appear on the primary monitor. Would be so nice if they appear on the same monitor where the main window is located. Otherwise such a great tool, still my favorite for analysis.

kaorahi commented 3 years ago

Can you try this for "a" key (run automatic analysis of game), for example?

--- a/src/main/java/featurecat/lizzie/rules/Board.java
+++ b/src/main/java/featurecat/lizzie/rules/Board.java
@@ -1388,7 +1388,7 @@ public class Board implements LeelazListener {
       if (!getNextMove().isPresent()) return;
       String answer =
           JOptionPane.showInputDialog(
-              "# playouts for analysis (e.g. 100 (fast) or 50000 (slow)): ");
+              Lizzie.frame, "# playouts for analysis (e.g. 100 (fast) or 50000 (slow)): ");
       try {
         playoutsAnalysis = Integer.parseInt(answer);
       } catch (NumberFormatException err) {
w3333 commented 3 years ago

Hi kaorahi,

you mean fumble around in the code? I mean, I was a programmer, but I have no clue about Lizzie or what to do to make these changes... but I could try. But I see what you do there, that looks like it would be the fix.

kaorahi commented 3 years ago

Would you test this if you can compile it?

https://github.com/kaorahi/lizzie/tree/fix885_dual

I dare to make the patch on #884 (patched 0.7.4) because we also need to fix several patches in #884 for #885.

w3333 commented 3 years ago

Is it the official build process described in https://github.com/kaorahi/lizzie/blob/fix885_dual/README.md ? Then I could try.

kaorahi commented 3 years ago

Yes. Just two steps if the environment is ready.

$ mvn package
$ java -jar target/lizzie-0.7.4-shaded.jar
w3333 commented 3 years ago

I think I'm too stupid... I did git clone https://github.com/kaorahi/lizzie.git cd lizzie In src/main/java there is no "featurecat"-dir, only "wagner", then "stephanie". And there in rules/Board.java I cannot find the line you mention. Even the class header doesn't have an implements-clause...

kaorahi commented 3 years ago

Ah, my words were too few. Please forget my first post. You don't need to edit the source code by yourself. I checked all such flaws and made a fixed version.

You may need to install some packages for Java beforehand. This step depends on your Linux distribution. In my case:

$ sudo apt-get install default-jdk maven

To test my fixed version, just open https://github.com/kaorahi/lizzie/tree/fix885_dual, click the green "Code" button, and click "Download ZIP". Then...

$ unzip lizzie-fix885_dual.zip
$ cd lizzie-fix885_dual
$ cp ~/SOMEWHERE/LEELAZ_BINARY/leelaz ./leelaz
$ cp ~/SOMEWHERE/LEELAZ_NETWORK_WEIGHTS/XXXXXX.gz ./lznetwork.gz
$ mvn package
$ java -jar target/lizzie-0.7.4-shaded.jar
w3333 commented 3 years ago

Yep, looks good! Thanks!