The forum

Patch ro run PlayOnLinux with wxPython 4.0.4

Author Replies
pixecs Saturday 6 April 2019 at 18:14
pixecsAnonymous

Hi all,

On my linux system I have installed only wxPython 4.0.4 & Python 2.7.16 and i wanted to run PlayOnLinux, so I made a small patch.

I still get a segmentation fault when trying to install a new software... but everything else seems to be working so I'm able to run previous installed software.

Forgot to mention, is for PlayOnLinux version 4.3.4

diff -U 3 -H -d -r -N -- a/python/check_python.py b/python/check_python.py
--- a/python/check_python.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/check_python.py    2019-04-06 16:21:22.233579331 +0300
@@ -1,8 +1,8 @@
-import os, wxversion
-print("wxversion(s): " + ", ".join(wxversion.getInstalled()))
+import os
+#print("wxversion(s): " + ", ".join(wxversion.getInstalled()))
 
-if os.environ["POL_OS"] != "Mac":
-    wxversion.ensureMinimal('2.8')
+#if os.environ["POL_OS"] != "Mac":
+#    wxversion.ensureMinimal('2.8')
 
 import wx
 os._exit(0)
diff -U 3 -H -d -r -N -- a/python/configurewindow/ConfigureWindow.py b/python/configurewindow/ConfigureWindow.py
--- a/python/configurewindow/ConfigureWindow.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/configurewindow/ConfigureWindow.py    2019-04-06 16:21:22.234579331 +0300
@@ -75,7 +75,7 @@
         wx.EVT_BUTTON(self, 1002, self.DeletePrefix)
 
 
-        self.list_game.SetSpacing(0)
+        #self.list_game.SetSpacing(0)
         self.list_game.SetImageList(self.images)
 
 
diff -U 3 -H -d -r -N -- a/python/configurewindow/ConfigureWindowNotebook.py b/python/configurewindow/ConfigureWindowNotebook.py
--- a/python/configurewindow/ConfigureWindowNotebook.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/configurewindow/ConfigureWindowNotebook.py    2019-04-06 16:29:04.695566427 +0300
@@ -269,7 +269,7 @@
 
         self.Menu = wx.TreeCtrl(self.panelPackages, 99, pos=(15, 75), size=(530, 260),
                                 style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders)
-        self.Menu.SetSpacing(0);
+        #self.Menu.SetSpacing(0);
         self.Menu.SetImageList(self.imagePackages)
         self.imagePackages.RemoveAll()
 
diff -U 3 -H -d -r -N -- a/python/debug.py b/python/debug.py
--- a/python/debug.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/debug.py    2019-04-06 16:21:22.234579331 +0300
@@ -60,7 +60,7 @@
         wx.EVT_TREE_SEL_CHANGED(self, 900, self.analyseLog)
 
 
-        self.list_game.SetSpacing(0);
+        #self.list_game.SetSpacing(0);
         self.list_game.SetImageList(self.images)
 
 
diff -U 3 -H -d -r -N -- a/python/install/InstallWindow.py b/python/install/InstallWindow.py
--- a/python/install/InstallWindow.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/install/InstallWindow.py    2019-04-06 18:37:45.038351008 +0300
@@ -23,9 +23,9 @@
 import subprocess
 
 import wx
-import wx.animate
+import wx.adv
 import wx.html
-import wx.lib.hyperlink
+import wx.lib.agw.hyperlink
 from wx.lib.ClickableHtmlWindow import PyClickableHtmlWindow
 
 import lib.Variables as Variables
@@ -46,7 +46,7 @@
         self.cats_icons[name] = wx.BitmapButton(self.installWindowHeader, 2000 + iid, wx.Bitmap(icon), (0, 0),
                                                 style=wx.NO_BORDER)
 
-        self.cats_links[name] = wx.lib.hyperlink.HyperLinkCtrl(self.installWindowHeader, 3000 + iid, name, pos=(0, 52))
+        self.cats_links[name] = wx.lib.agw.hyperlink.HyperLinkCtrl(self.installWindowHeader, 3000 + iid, name, pos=(0, 52))
         mataille = self.cats_links[name].GetSize()[0]
 
         mataille2 = self.cats_icons[name].GetSize()[0]
@@ -55,7 +55,7 @@
         self.cats_links[name].SetPosition((espace * iid + (espace - mataille / 1.3) / 2, 47))
         self.cats_icons[name].SetPosition((image_pos, offset))
 
-        wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 3000 + iid, self.AddApps)
+        wx.lib.agw.hyperlink.EVT_HYPERLINK_LEFT(self, 3000 + iid, self.AddApps)
         wx.EVT_BUTTON(self, 2000 + iid, self.AddApps)
 
         self.cats_links[name].SetColours(wx.Colour(0, 0, 0), wx.Colour(0, 0, 0), wx.Colour(0, 0, 0))
@@ -116,8 +116,8 @@
         self.installWindowBodySizer.Add(self.panelWait, 1, wx.EXPAND)
         self.panelWait.Hide()
         ## FIXME: Remove those magic numbers
-        self.animation_wait = wx.animate.GIFAnimationCtrl(self.panelWait, -1,
-                                                          Variables.playonlinux_env + "/resources/images/install/wait.gif",
+        self.animation_wait = wx.adv.AnimationCtrl(self.panelWait, -1,
+                                                          wx.adv.Animation(Variables.playonlinux_env + "/resources/images/install/wait.gif"),
                                                           ((800 - 128) / 2, (550 - 128) / 2 - 71))
         self.percentageText = wx.StaticText(self.panelWait, -1, "", ((800 - 30) / 2, (550 - 128) / 2 + 128 + 10 - 71),
                                             wx.DefaultSize)
@@ -184,7 +184,7 @@
         self.appsList = wx.TreeCtrl(self.appNavigationPanel, 106,
                                     style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders)
         self.appsList.SetImageList(self.imagesapps)
-        self.appsList.SetSpacing(0)
+        #self.appsList.SetSpacing(0)
 
         self.appNavigationSizer.AddSpacer(10)
         self.appNavigationSizer.Add(self.appsList, 4, wx.EXPAND, 5)
@@ -202,7 +202,7 @@
 
         self.descriptionLoaderPanel = wx.Panel(appDescriptionPanel, -1, style=Variables.widget_borders)
         self.descriptionLoaderPanel.SetBackgroundColour((255, 255, 255))
-        self.animation = wx.animate.GIFAnimationCtrl(self.descriptionLoaderPanel, -1, Variables.playonlinux_env + "/resources/images/install/wait_mini.gif", (90, 100))
+        self.animation = wx.adv.AnimationCtrl(self.descriptionLoaderPanel, -1, wx.adv.Animation(Variables.playonlinux_env + "/resources/images/install/wait_mini.gif"), (90, 100))
         self.animation.Hide()
         self.descriptionLoaderPanel.Hide()
 
@@ -227,7 +227,7 @@
         self.cancelButton = wx.Button(buttonsPanel, wx.ID_CLOSE, _("Cancel"))
         self.installButton = wx.Button(buttonsPanel, wx.ID_APPLY, _("Install"))
         self.updateButton = wx.Button(buttonsPanel, wx.ID_REFRESH, _("Refresh"))
-        self.manualInstall = wx.lib.hyperlink.HyperLinkCtrl(buttonsPanel, 111, _("Install a non-listed program"))
+        self.manualInstall = wx.lib.agw.hyperlink.HyperLinkCtrl(buttonsPanel, 111, _("Install a non-listed program"))
         self.manualInstall.SetColours(wx.Colour(0, 0, 0), wx.Colour(0, 0, 0), wx.Colour(0, 0, 0))
         self.manualInstall.AutoBrowse(False)
         self.manualInstall.UpdateLink(True)
@@ -284,7 +284,7 @@
         wx.EVT_CLOSE(self, self.closeapp)
         wx.EVT_TREE_ITEM_ACTIVATED(self, 106, self.installapp)
         wx.EVT_TEXT(self, 110, self.search)
-        wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 111, self.manual)
+        wx.lib.agw.hyperlink.EVT_HYPERLINK_LEFT(self, 111, self.manual)
 
         wx.EVT_CHECKBOX(self, 401, self.CheckBoxReload)
         wx.EVT_CHECKBOX(self, 402, self.CheckBoxReload)
diff -U 3 -H -d -r -N -- a/python/lib/lng.py b/python/lib/lng.py
--- a/python/lib/lng.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/lib/lng.py    2019-04-06 16:21:22.235579331 +0300
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 import wx
-import wxversion
+#import wxversion
 import gettext, Variables as Variables, os
 import locale, string
 
diff -U 3 -H -d -r -N -- a/python/mainwindow.py b/python/mainwindow.py
--- a/python/mainwindow.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/mainwindow.py    2019-04-06 18:17:33.169384822 +0300
@@ -35,13 +35,13 @@
     print "ERROR ! Please define POL_OS environment var first."
     os._exit(1)
 
-if (os.environ["POL_OS"] != "Mac"):
-    import wxversion
+#if (os.environ["POL_OS"] != "Mac"):
+#    import wxversion
 
-    wxversion.ensureMinimal('2.8')
+#    wxversion.ensureMinimal('2.8')
 
-import wx, wx.aui
-import wx.lib.hyperlink
+import wx, wx.aui, wx.adv
+import wx.lib.agw.hyperlink
 import lib.lng as lng
 import lib.playonlinux as playonlinux, lib.Variables as Variables
 import options, threading, debug
@@ -246,7 +246,7 @@
 
         ## List game
         self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT)
-        self.list_game.SetSpacing(0)
+        #self.list_game.SetSpacing(0)
         self.list_game.SetIndent(5)
         self.list_game.SetImageList(self.images)
         self.menu_gauche = wx.Panel(self, -1)
@@ -571,7 +571,7 @@
                 self.sb.Hide()
                 self.installFrame.setWaitState(False)
                 self.installFrame.Refresh()
-        except wx._core.PyDeadObjectError:
+        except RuntimeError:
             pass
         except AttributeError:  # FIXME: Install Frame is not opened
             pass
@@ -867,11 +867,11 @@
             pass
 
         if (url == None):
-            self.menuElem[id] = wx.lib.hyperlink.HyperLinkCtrl(self.menu_gauche, 10000 + pos, text,
+            self.menuElem[id] = wx.lib.agw.hyperlink.HyperLinkCtrl(self.menu_gauche, 10000 + pos, text,
                                                                pos=(35, 15 + pos * 20))
             self.menuElem[id].AutoBrowse(False)
         else:
-            self.menuElem[id] = wx.lib.hyperlink.HyperLinkCtrl(self.menu_gauche, 10000 + pos, text,
+            self.menuElem[id] = wx.lib.agw.hyperlink.HyperLinkCtrl(self.menu_gauche, 10000 + pos, text,
                                                                pos=(35, 15 + pos * 20))
             self.menuElem[id].setURL(url)
 
@@ -883,7 +883,7 @@
         # self.menuElem[id].SetHoverColour(wx.Colour(100,100,100))
 
         if (evt != None):
-            wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 10000 + pos, evt)
+            wx.lib.agw.hyperlink.EVT_HYPERLINK_LEFT(self, 10000 + pos, evt)
 
     def donate(self, event):
         if (os.environ["POL_OS"] == "Mac"):
@@ -1149,7 +1149,7 @@
         return None
 
     def About(self, event):
-        self.aboutBox = wx.AboutDialogInfo()
+        self.aboutBox = wx.adv.AboutDialogInfo()
         if (os.environ["POL_OS"] != "Mac"):
             self.aboutBox.SetIcon(wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY))
 
@@ -1170,7 +1170,7 @@
             self.aboutBox.SetWebSite("http://www.playonmac.com")
         else:
             self.aboutBox.SetWebSite("http://www.playonmac.com")
-        wx.AboutBox(self.aboutBox)
+        wx.adv.AboutBox(self.aboutBox)
 
 
 class PlayOnLinuxApp(wx.App):
@@ -1399,7 +1399,7 @@
 setSigchldHandler()
 lng.Lang()
 
-wx.Log_EnableLogging(False)
+wx.Log.EnableLogging(True)
 
 app = PlayOnLinuxApp(redirect=False)
 app.MainLoop()
diff -U 3 -H -d -r -N -- a/python/options.py b/python/options.py
--- a/python/options.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/options.py    2019-04-06 16:28:35.425567243 +0300
@@ -19,7 +19,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 from asyncore import dispatcher
-import wxversion, os, subprocess, getopt, sys, urllib, signal, socket, string
+import os, subprocess, getopt, sys, urllib, signal, socket, string
 import wx, time, re
 import webbrowser, shutil
 import threading, time, codecs
@@ -187,7 +187,7 @@
         self.txtPlugin = wx.StaticText(self.panelPlugins, -1, _("Installed plugins"), size=wx.DefaultSize)
         self.txtPlugin.SetFont(self.fontTitle)
         self.pluginlist = wx.TreeCtrl(self.panelPlugins, 220, style=Variables.widget_borders|wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT)
-        self.pluginlist.SetSpacing(0)
+        #self.pluginlist.SetSpacing(0)
 
         self.pluginImgList = wx.ImageList(16,16)
 
diff -U 3 -H -d -r -N -- a/python/setupwindow/POL_SetupFrame.py b/python/setupwindow/POL_SetupFrame.py
--- a/python/setupwindow/POL_SetupFrame.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/setupwindow/POL_SetupFrame.py    2019-04-06 17:15:05.081489404 +0300
@@ -27,7 +27,7 @@
 import urllib
 import urlparse
 import wx
-import wx.animate
+import wx.adv
 
 import lib.Variables as Variables
 import lib.lng
@@ -213,14 +213,14 @@
                                      style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders,
                                      pos=(25, 25), size=(460, 220))
         self.MenuGames.SetImageList(self.images)
-        self.MenuGames.SetSpacing(0)
+        #self.MenuGames.SetSpacing(0)
 
         # Login
         self.login = wx.StaticText(self.contentPanel, -1, _("Login: "), pos=(20, 40), size=(460, 20))
         self.password = wx.StaticText(self.contentPanel, -1, _("Password: "), pos=(20, 70), size=(460, 20))
         self.loginbox = wx.TextCtrl(self.contentPanel, -1, "", size=(250, 22), pos=(200, 35))
         self.passbox = wx.TextCtrl(self.contentPanel, -1, "", size=(250, 22), pos=(200, 65), style=wx.TE_PASSWORD)
-        self.register = wx.HyperlinkCtrl(self.contentPanel, 303, _("Register"), "", pos=(20, 100))
+        self.register =  wx.adv.HyperlinkCtrl(self.contentPanel, 303, _("Register"), "", pos=(20, 100))
         self.register.SetNormalColour(wx.Colour(0, 0, 0))
 
         # Fixed Events
@@ -230,7 +230,7 @@
         wx.EVT_BUTTON(self, 103, self.Parcourir)
         wx.EVT_CHECKBOX(self, 302, self.agree)
         wx.EVT_CHECKBOX(self, 304, self.switch_menu)
-        wx.EVT_HYPERLINK(self, 303, self.POL_register)
+        wx.adv.EVT_HYPERLINK(self, 303, self.POL_register)
 
         # Debug Window
         self.debugImage = wx.StaticBitmap(self.contentPanel, -1, wx.Bitmap(
diff -U 3 -H -d -r -N -- a/python/wine_versions/WineVersionsNotebook.py b/python/wine_versions/WineVersionsNotebook.py
--- a/python/wine_versions/WineVersionsNotebook.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/wine_versions/WineVersionsNotebook.py    2019-04-06 16:29:40.121565438 +0300
@@ -39,7 +39,7 @@
         self.installedWineVersionsTreeSelector[arch] = wx.TreeCtrl(installedWineVersionsPanel, 107 + self.calculateEventDelta(arch),
                                                                    style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders)
         self.installedWineVersionsTreeSelector[arch].SetImageList(self.imagesapps_i[arch])
-        self.installedWineVersionsTreeSelector[arch].SetSpacing(0)
+        #self.installedWineVersionsTreeSelector[arch].SetSpacing(0)
         installedWineVersionsSizer.Add(self.installedWineVersionsTreeSelector[arch], 1, wx.EXPAND)
         installedWineVersionsSizer.AddSpacer(10)
 
@@ -55,7 +55,7 @@
                                                                    style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders,
                                                                    size=(320, 300), pos=(10, 35))
         self.availableWineVersionsTreeSelector[arch].SetImageList(self.imagesapps[arch])
-        self.availableWineVersionsTreeSelector[arch].SetSpacing(0)
+        #self.availableWineVersionsTreeSelector[arch].SetSpacing(0)
         availableWineVersionsSizer.Add(self.availableWineVersionsTreeSelector[arch], 1, wx.EXPAND)
         availableWineVersionsSizer.AddSpacer(10)
 
diff -U 3 -H -d -r -N -- a/python/wine_versions/WineVersionsWindow.py b/python/wine_versions/WineVersionsWindow.py
--- a/python/wine_versions/WineVersionsWindow.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/wine_versions/WineVersionsWindow.py    2019-04-06 16:21:22.236579331 +0300
@@ -23,7 +23,7 @@
 import subprocess
 
 import wx
-import wx.animate
+import wx.adv
 
 import lib.Variables as Variables
 import lib.lng
diff -U 3 -H -d -r -N -- a/python/wrapper.py b/python/wrapper.py
--- a/python/wrapper.py    2018-12-24 22:22:56.000000000 +0200
+++ b/python/wrapper.py    2019-04-06 16:21:22.237579331 +0300
@@ -28,9 +28,9 @@
     print "ERROR ! Please define POL_OS environment var first."
     os._exit(1)
 
-if(os.environ["POL_OS"] == "Linux"):
-    import wxversion
-    wxversion.ensureMinimal('2.8')
+#if(os.environ["POL_OS"] == "Linux"):
+#    import wxversion
+#    wxversion.ensureMinimal('2.8')
 
 import wx
 import lib.lng as lng




 

 

 

 

Edited by pixecs

Quentin PÂRIS Sunday 7 April 2019 at 14:46
Quentin PÂRISAnonymous

Cool! Thanks!

Can we make a merge request on github?

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com