18
16
# You should have received a copy of the GNU General Public License along
19
17
# with this program; if not, write to the Free Software Foundation, Inc.,
20
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
wxversion.select("2.8")
25
import wx, wx.html, webbrowser
26
import gettext, os, getopt, sys, urllib, signal, socket, string, time, threading
21
import os, getopt, sys, urllib, signal, string, time, webbrowser, gettext, locale, sys, shutil
22
#locale.setlocale(locale.CODESET,'fr_FR.utf8')
27
# os.environ["LANG"] = "en_US.utf-8"
28
#locale.setlocale(locale.LC_ALL, '.utf-8')
27
32
import lib.Variables as Variables, lib.lng as lng
33
import lib.playonlinux as playonlinux
34
import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading
36
class POLWeb(threading.Thread):
38
threading.Thread.__init__(self)
39
self.sendToStatusBarStr = ""
40
self.sendAlertStr = None
45
def sendToStatusBar(self, message, gauge):
46
self.sendToStatusBarStr = message
50
def sendAlert(self, message):
51
self.sendAlertStr = message
53
def LastVersion(self):
54
if(os.environ["POL_OS"] == "Mac"):
55
fichier_online="version_mac"
57
fichier_online="version2"
58
return os.popen('wget -q "$SITE/'+fichier_online+'.php?v=$VERSION" -T 10 -O-','r').read()
61
self.WebVersion = self.LastVersion()
63
if(self.WebVersion == ""):
64
self.sendToStatusBar(_('{0} website is unavailable. Please check your connexion').format(os.environ["APPLICATION_TITLE"]), False)
66
self.sendToStatusBar(_("Refreshing {0}").format(os.environ["APPLICATION_TITLE"]), True)
67
os.system("bash \""+Variables.playonlinux_env+"/bash/pol_update_list\"")
69
if(playonlinux.convertVersionToInt(os.environ["VERSION"]) < playonlinux.convertVersionToInt(self.WebVersion)):
70
self.sendToStatusBar(_('An updated version of {0} is available').format(os.environ["APPLICATION_TITLE"])+" ("+self.WebVersion+")",False)
71
#self.sendAlert(_('An updated version of {0} is available').format(os.environ["APPLICATION_TITLE"])+" ("+self.WebVersion+")")
75
self.wantcheck = False
83
if(self.wantcheck == True):
30
89
class MainWindow(wx.Frame):
31
90
def __init__(self,parent,id,title):
32
wx.Frame.__init__(self, parent, -1, title, size = (600, 565))
33
self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY))
34
self.timer = wx.Timer(self, 1)
37
self.images = wx.ImageList(32, 32)
39
if(len(sys.argv) > 1):
40
self.panel_games = wx.Panel(self, -1)
41
self.panel_update = wx.Panel(self.panel_games, -1)
42
#self.panel_update.SetBackgroundColour((255,255,225))
44
self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD,False, "", wx.FONTENCODING_DEFAULT)
45
#argv[1] = 1 nvversion -- argv[2] = version
47
#argv[1] = 3 version de dev
48
#argv[1] = 4 unofficial website used
49
if(int(sys.argv[1]) == 1):
50
self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap("gtk-refresh", wx.ART_MENU), pos=(15,0))
51
self.texte_update = wx.StaticText(self.panel_update, -1, _("An updated version of PlayOnLinux is available.")+" ("+sys.argv[2]+")",pos=(35,0))
52
elif(int(sys.argv[1]) == 2):
53
self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap("gtk-dialog-warning", wx.ART_MENU), pos=(15,0))
54
self.texte_update = wx.StaticText(self.panel_update, -1, _("You do not seem to be connected to the Internet."),pos=(35,0))
55
self.texte_update.SetForegroundColour("red")
56
elif(int(sys.argv[1]) == 3):
57
self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap("gtk-dialog-warning", wx.ART_MENU), pos=(15,0))
58
self.texte_update = wx.StaticText(self.panel_update, -1, _("Your are using a development version, be careful."),pos=(35,0))
59
self.texte_update.SetForegroundColour("orange")
60
elif(int(sys.argv[1]) == 4):
61
self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap("gtk-dialog-warning", wx.ART_MENU), pos=(15,0))
62
self.texte_update = wx.StaticText(self.panel_update, -1, _("You seem to be using the Offline PlayOnLinux plugin."),pos=(35,0))
63
self.texte_update.SetForegroundColour("green")
65
self.image_logo = wx.StaticBitmap(self.panel_update, -1, wx.ArtProvider.GetBitmap("gtk-dialog-error", wx.ART_MENU), pos=(15,0))
66
self.texte_update = wx.StaticText(self.panel_update, -1, _("Internal error when starting GUI. Please file a bug report ASAP!"),pos=(35,0))
68
self.texte_update.SetFont(self.fontText)
69
self.list_game = wx.TreeCtrl(self.panel_games, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT)
71
self.sizer_games = wx.BoxSizer(wx.VERTICAL)
72
self.sizer_games.Add(self.panel_update, 1, wx.EXPAND|wx.ALL, 2)
73
self.sizer_games.Add(self.list_game, 20, wx.EXPAND|wx.ALL, 2)
75
self.panel_games.SetSizer(self.sizer_games)
76
self.panel_games.SetAutoLayout(True)
79
self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT)
81
self.list_game.SetSpacing(0);
82
self.list_game.SetImageList(self.images)
88
self.filemenu = wx.Menu()
89
self.filemenu.Append(wx.ID_OPEN, _("Run"))
90
self.filemenu.Append(wx.ID_ADD, _("Install"))
91
self.filemenu.Append(wx.ID_DELETE, _("Remove"))
92
self.filemenu.Append(wx.ID_REFRESH, _("Refresh the repository"))
93
self.filemenu.AppendSeparator()
94
self.filemenu.Append(wx.ID_EXIT, _("Exit"))
96
self.expertmenu = wx.Menu()
99
self.winever_item = wx.MenuItem(self.expertmenu, 107, _("Manage Wine versions"))
100
self.winever_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/wine.png"))
101
self.expertmenu.AppendItem(self.winever_item)
103
#self.wineserv_item = wx.MenuItem(self.expertmenu, 115, _("Kill wineserver process"))
104
#self.wineserv_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/wineserver.png"))
105
#self.expertmenu.AppendItem(self.wineserv_item)
107
self.run_item = wx.MenuItem(self.expertmenu, 108, _("Run a local script"))
108
self.run_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/run.png"))
109
self.expertmenu.AppendItem(self.run_item)
111
self.polshell_item = wx.MenuItem(self.expertmenu, 109, _("PlayOnLinux debugger"))
112
self.polshell_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/polshell.png"))
113
self.expertmenu.AppendItem(self.polshell_item)
115
self.cdrom_item = wx.MenuItem(self.expertmenu, 120, _("Autorun"))
116
self.cdrom_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/cdrom.png"))
117
self.expertmenu.AppendItem(self.cdrom_item)
119
self.optionmenu = wx.Menu()
121
self.option_item = wx.MenuItem(self.expertmenu, 210, _("General"))
122
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/input-gaming.png"))
123
self.optionmenu.AppendItem(self.option_item)
125
self.option_item = wx.MenuItem(self.expertmenu, 211, _("Internet"))
126
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png"))
127
self.optionmenu.AppendItem(self.option_item)
129
self.option_item = wx.MenuItem(self.expertmenu, 212, _("Environment"))
130
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/user-desktop.png"))
131
self.optionmenu.AppendItem(self.option_item)
133
self.option_item = wx.MenuItem(self.expertmenu, 213, _("System"))
134
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/application-x-executable.png"))
135
self.optionmenu.AppendItem(self.option_item)
137
self.option_item = wx.MenuItem(self.expertmenu, 214, _("Plugins"))
138
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png"))
139
self.optionmenu.AppendItem(self.option_item)
141
self.pluginsmenu = wx.Menu()
143
files=os.listdir(Variables.playonlinux_rep+"/plugins")
145
self.plugin_list = []
148
while(self.i < len(files)):
149
if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/scripts/menu")):
150
if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/enabled")):
151
self.plugin_item = wx.MenuItem(self.expertmenu, 300+self.j, files[self.i])
153
self.icon_look_for = Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/icon"
154
if(os.path.exists(self.icon_look_for)):
155
self.bitmap = wx.Bitmap(self.icon_look_for)
157
self.bitmap = wx.Bitmap(Variables.playonlinux_env+"/etc/playonlinux16.png")
159
self.plugin_item.SetBitmap(self.bitmap)
160
self.pluginsmenu.AppendItem(self.plugin_item)
161
wx.EVT_MENU(self, 300+self.j, self.run_plugin)
162
self.plugin_list.append(files[self.i])
167
self.pluginsmenu.AppendSeparator()
169
self.option_item_p = wx.MenuItem(self.expertmenu, 214, _("Plugin manager"))
170
self.option_item_p.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png"))
171
self.pluginsmenu.AppendItem(self.option_item_p)
173
self.last_string = ""
176
# /!\ id 115 utilisé par wineserver #
177
# /!\ id 117 et 118 utilisés aussi #
178
self.helpmenu = wx.Menu()
179
self.helpmenu.Append(wx.ID_ABOUT, _("About"))
180
self.helpmenu.Append(500, _("Donate"))
181
self.menubar = wx.MenuBar()
182
self.menubar.Append(self.filemenu, _("File"))
183
self.menubar.Append(self.expertmenu, _("Tools"))
184
self.menubar.Append(self.optionmenu, _("Settings"))
185
self.menubar.Append(self.pluginsmenu, _("Plugins"))
186
self.menubar.Append(self.helpmenu, _("Help"))
187
self.SetMenuBar(self.menubar)
189
self.toolbar = self.CreateToolBar(wx.TB_TEXT)
190
self.toolbar.AddLabelTool(wx.ID_OPEN, _("Run"), wx.ArtProvider.GetBitmap("gtk-open", wx.ART_TOOLBAR))
191
self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.ArtProvider.GetBitmap("gtk-add", wx.ART_TOOLBAR))
192
self.toolbar_remove = self.toolbar.AddLabelTool(wx.ID_DELETE, _("Remove"), wx.ArtProvider.GetBitmap("gtk-delete", wx.ART_TOOLBAR))
193
#self.toolbar.AddLabelTool(wx.ID_REFRESH, _("Refresh the repository"), wx.ArtProvider.GetBitmap("gtk-refresh", wx.ART_TOOLBAR))
194
self.toolbar.AddLabelTool(121, _("Configure this application"), wx.ArtProvider.GetBitmap("gtk-edit", wx.ART_TOOLBAR))
195
self.toolbar_remove = self.toolbar.AddLabelTool(122, _("Close all"), wx.ArtProvider.GetBitmap("gtk-close", wx.ART_TOOLBAR))
198
wx.EVT_MENU(self, wx.ID_OPEN, self.Run)
199
wx.EVT_MENU(self, wx.ID_ADD, self.InstallMenu)
200
wx.EVT_MENU(self, wx.ID_ABOUT, self.About)
201
wx.EVT_MENU(self, wx.ID_EXIT, self.ClosePol)
202
wx.EVT_MENU(self, wx.ID_REFRESH, self.UpdatePol)
203
wx.EVT_MENU(self, wx.ID_DELETE, self.UninstallGame)
204
wx.EVT_MENU(self, 122, self.RKillAll)
207
wx.EVT_MENU(self, 101, self.Reload)
208
wx.EVT_MENU(self, 107, self.WineVersion)
209
wx.EVT_MENU(self, 108, self.Executer)
210
wx.EVT_MENU(self, 109, self.PolShell)
211
wx.EVT_MENU(self, 115, self.killwineserver)
212
wx.EVT_MENU(self, 120, self.Autorun)
213
wx.EVT_MENU(self, 121, self.Configure)
216
wx.EVT_MENU(self, 210, self.Options)
217
wx.EVT_MENU(self, 211, self.Options)
218
wx.EVT_MENU(self, 212, self.Options)
219
wx.EVT_MENU(self, 213, self.Options)
220
wx.EVT_MENU(self, 214, self.Options)
221
wx.EVT_MENU(self, 215, self.Options)
223
wx.EVT_CLOSE(self, self.ClosePol)
224
wx.EVT_TREE_ITEM_ACTIVATED(self, 105, self.Run)
225
wx.EVT_TREE_SEL_CHANGED(self, 105, self.Select)
226
#wx.EVT_TREE_ITEM_MENU(self, 105, self.OnRightDown)
228
#Timer, regarde toute les secondes si il faut actualiser la liste
229
self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer)
230
self.timer.Start(200)
232
#Pop-up menu for game list: beginning
233
wx.EVT_TREE_ITEM_MENU(self, 105, self.RMBInGameList)
234
wx.EVT_MENU(self, 230, self.RWineConfigurator)
235
wx.EVT_MENU(self, 231, self.RRegistryEditor)
236
wx.EVT_MENU(self, 232, self.GoToAppDir)
237
wx.EVT_MENU(self, 233, self.ChangeIcon)
238
wx.EVT_MENU(self, 234, self.UninstallGame)
239
wx.EVT_MENU(self, 235, self.RKill)
240
wx.EVT_MENU(self, 500, self.donate)
91
wx.Frame.__init__(self, parent, 1000, title, size = (430, 430))
94
self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY))
95
self.timer = wx.Timer(self, 1)
96
self.images = wx.ImageList(32, 32)
98
self.updater = POLWeb()
100
self.sendAlertStr = None
102
self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT)
103
self.list_game.SetSpacing(0);
104
self.list_game.SetImageList(self.images)
110
self.filemenu = wx.Menu()
111
self.filemenu.Append(wx.ID_OPEN, _("Run"))
112
self.filemenu.Append(wx.ID_ADD, _("Install"))
113
self.filemenu.Append(wx.ID_DELETE, _("Remove"))
114
self.filemenu.AppendSeparator()
115
self.filemenu.Append(216, _("Donate"))
116
self.filemenu.Append(wx.ID_EXIT, _("Exit"))
118
self.expertmenu = wx.Menu()
120
self.winever_item = wx.MenuItem(self.expertmenu, 107, _("Manage Wine versions"))
121
self.winever_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/wine.png"))
122
self.expertmenu.AppendItem(self.winever_item)
124
#self.wineprefix_item = wx.MenuItem(self.expertmenu, 111, _("Manage virtual drives"))
125
#self.wineprefix_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/prefix-manager.png"))
126
#self.expertmenu.AppendItem(self.wineprefix_item)
128
self.expertmenu.AppendSeparator()
130
self.run_item = wx.MenuItem(self.expertmenu, 108, _("Run a local script"))
131
self.run_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/run.png"))
132
self.expertmenu.AppendItem(self.run_item)
134
self.wineserv_item = wx.MenuItem(self.expertmenu, 115, _('Close all {0} software').format(os.environ["APPLICATION_TITLE"]))
135
self.wineserv_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/wineserver.png"))
136
self.expertmenu.AppendItem(self.wineserv_item)
138
self.polshell_item = wx.MenuItem(self.expertmenu, 109, _('{0} console').format(os.environ["APPLICATION_TITLE"]))
139
self.polshell_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/polshell.png"))
140
self.expertmenu.AppendItem(self.polshell_item)
142
self.expertmenu.AppendSeparator()
144
self.pol_online = wx.MenuItem(self.expertmenu, 112, os.environ["APPLICATION_TITLE"]+" online")
145
self.pol_online.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/playonlinux_online.png"))
146
self.expertmenu.AppendItem(self.pol_online)
148
self.chat_item = wx.MenuItem(self.expertmenu, 111, _("{0} messenger").format(os.environ["APPLICATION_TITLE"]))
149
self.chat_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/people.png"))
150
self.expertmenu.AppendItem(self.chat_item)
152
self.bug_item = wx.MenuItem(self.expertmenu, 110, _("Report a bug"))
153
self.bug_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/bug.png"))
154
self.expertmenu.AppendItem(self.bug_item)
157
self.optionmenu = wx.Menu()
159
# self.option_item = wx.MenuItem(self.expertmenu, 210, _("General"))
160
# self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/input-gaming.png"))
161
# self.optionmenu.AppendItem(self.option_item)
163
self.option_item = wx.MenuItem(self.expertmenu, 211, _("Internet"))
164
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png"))
165
self.optionmenu.AppendItem(self.option_item)
167
#self.option_item = wx.MenuItem(self.expertmenu, 212, _("Environment"))
168
#self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/user-desktop.png"))
169
#self.optionmenu.AppendItem(self.option_item)
171
#self.option_item = wx.MenuItem(self.expertmenu, 213, _("System"))
172
#self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/application-x-executable.png"))
173
#self.optionmenu.AppendItem(self.option_item)
176
self.help_menu = wx.Menu()
177
self.help_menu.Append(wx.ID_ABOUT, _('About {0}').format(os.environ["APPLICATION_TITLE"]))
179
self.pluginsmenu = wx.Menu()
181
files=os.listdir(Variables.playonlinux_rep+"/plugins")
183
self.plugin_list = []
186
while(self.i < len(files)):
187
if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/scripts/menu")):
188
if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/enabled")):
189
self.plugin_item = wx.MenuItem(self.expertmenu, 300+self.j, files[self.i])
191
self.icon_look_for = Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/icon"
192
if(os.path.exists(self.icon_look_for)):
193
self.bitmap = wx.Bitmap(self.icon_look_for)
195
self.bitmap = wx.Bitmap(Variables.playonlinux_env+"/etc/playonlinux16.png")
197
self.plugin_item.SetBitmap(self.bitmap)
198
self.pluginsmenu.AppendItem(self.plugin_item)
199
wx.EVT_MENU(self, 300+self.j, self.run_plugin)
200
self.plugin_list.append(files[self.i])
205
self.pluginsmenu.AppendSeparator()
207
self.option_item_p = wx.MenuItem(self.expertmenu, 214, _("Plugin manager"))
208
self.option_item_p.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png"))
209
self.pluginsmenu.AppendItem(self.option_item_p)
211
self.option_item = wx.MenuItem(self.expertmenu, 214, _("Plugin manager"))
212
self.option_item.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png"))
213
self.optionmenu.AppendItem(self.option_item)
216
self.last_string = ""
218
self.sb = wx.StatusBar(self, -1 )
219
self.sb.SetFieldsCount(2)
220
self.sb.SetStatusWidths([400, -1])
221
self.sb.SetStatusText("", 0)
223
if(os.environ["POL_OS"] == "Mac"):
227
self.jauge_update = wx.Gauge(self.sb, -1, 100, (300, hauteur), size=(100,16))
228
self.jauge_update.Pulse()
229
self.jauge_update.Hide()
230
self.SetStatusBar(self.sb)
232
#self.helpmenu = wx.MenuItem()
233
#self.helpmenu.Append(wx.ID_ABOUT, _("About"))
235
self.menubar = wx.MenuBar()
236
self.menubar.Append(self.filemenu, _("File"))
237
self.menubar.Append(self.expertmenu, _("Tools"))
238
self.menubar.Append(self.optionmenu, _("Settings"))
239
self.menubar.Append(self.pluginsmenu, _("Plugins"))
240
self.menubar.Append(self.help_menu, "&Help")
242
#self.menubar.Append(self.help_menu, _("About"))
243
self.SetMenuBar(self.menubar)
246
self.toolbar = self.CreateToolBar(wx.TB_TEXT)
247
self.toolbar.SetToolBitmapSize(iconSize)
248
self.toolbar.AddLabelTool(wx.ID_OPEN, _("Run"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/run.png"))
249
self.toolbar.AddSeparator()
250
self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/install.png"))
251
self.toolbar_remove = self.toolbar.AddLabelTool(wx.ID_DELETE, _("Remove"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/delete.png"))
252
#self.toolbar.AddLabelTool(120, _("CD-ROM"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/cdrom.png"))
254
self.toolbar.AddSeparator()
255
self.toolbar.AddLabelTool(121, _("Configure"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/configure.png"))
256
self.toolbar.AddLabelTool(122, _("Shortcut"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/package.png"))
257
self.toolbar.AddLabelTool(123, _("Messenger"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/messenger.png"))
259
#self.toolbar.DoMenuUpdate(self.toolbar)
260
self.toolbar.Realize()
262
wx.EVT_MENU(self, wx.ID_OPEN, self.Run)
263
wx.EVT_MENU(self, wx.ID_ADD, self.InstallMenu)
264
wx.EVT_MENU(self, wx.ID_ABOUT, self.About)
265
wx.EVT_MENU(self, wx.ID_EXIT, self.ClosePol)
266
wx.EVT_MENU(self, wx.ID_DELETE, self.UninstallGame)
270
wx.EVT_MENU(self, 101, self.Reload)
271
wx.EVT_MENU(self, 107, self.WineVersion)
272
wx.EVT_MENU(self, 108, self.Executer)
273
wx.EVT_MENU(self, 109, self.PolShell)
274
wx.EVT_MENU(self, 110, self.BugReport)
275
wx.EVT_MENU(self, 111, self.OpenIrc)
276
wx.EVT_MENU(self, 112, self.POLOnline)
278
wx.EVT_MENU(self, 115, self.killall)
279
wx.EVT_MENU(self, 121, self.Configure)
280
wx.EVT_MENU(self, 122, self.Package)
281
wx.EVT_MENU(self, 123, self.OpenIrc)
284
wx.EVT_MENU(self, 210, self.Options)
285
wx.EVT_MENU(self, 211, self.Options)
286
wx.EVT_MENU(self, 212, self.Options)
287
wx.EVT_MENU(self, 213, self.Options)
288
wx.EVT_MENU(self, 214, self.Options)
289
wx.EVT_MENU(self, 215, self.Options)
291
wx.EVT_MENU(self, 216, self.donate)
293
wx.EVT_CLOSE(self, self.ClosePol)
294
wx.EVT_TREE_ITEM_ACTIVATED(self, 105, self.Run)
295
wx.EVT_TREE_SEL_CHANGED(self, 105, self.Select)
296
#wx.EVT_TREE_ITEM_MENU(self, 105, self.OnRightDown)
298
#Timer, regarde toute les secondes si il faut actualiser la liste
300
self.Bind(wx.EVT_TIMER, self.AutoReload, self.timer)
301
self.timer.Start(1000)
303
#Pop-up menu for game list: beginning
304
wx.EVT_TREE_ITEM_MENU(self, 105, self.RMBInGameList)
305
wx.EVT_MENU(self, 230, self.RWineConfigurator)
306
wx.EVT_MENU(self, 231, self.RRegistryEditor)
307
wx.EVT_MENU(self, 232, self.GoToAppDir)
308
wx.EVT_MENU(self, 233, self.ChangeIcon)
309
wx.EVT_MENU(self, 234, self.UninstallGame)
310
wx.EVT_MENU(self, 235, self.RKill)
313
def StatusRead(self):
314
self.sb.SetStatusText(self.updater.sendToStatusBarStr, 0)
315
if(self.updater.Gauge == True):
316
self.jauge_update.Pulse()
317
self.jauge_update.Show()
319
self.jauge_update.Hide()
321
if(self.updater.Show == True):
325
if(self.updater.sendAlertStr != self.sendAlertStr):
326
wx.MessageBox(self.updater.sendAlertStr, os.environ["APPLICATION_TITLE"])
327
self.sendAlertStr = self.updater.sendAlertStr
242
329
def RMBInGameList(self, event):
243
330
self.GameListPopUpMenu = wx.Menu()
245
332
self.ConfigureWine = wx.MenuItem(self.GameListPopUpMenu, 230, _("Configure Wine"))
246
self.ConfigureWine.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/run.png"))
333
self.ConfigureWine.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/run.png"))
247
334
self.GameListPopUpMenu.AppendItem(self.ConfigureWine)
249
336
self.RegistryEditor = wx.MenuItem(self.GameListPopUpMenu, 231, _("Registry Editor"))
250
self.RegistryEditor.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/regedit.png"))
337
self.RegistryEditor.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/regedit.png"))
251
338
self.GameListPopUpMenu.AppendItem(self.RegistryEditor)
253
340
self.GotoAppDir = wx.MenuItem(self.GameListPopUpMenu, 232, _("Open the application's directory"))
254
self.GotoAppDir.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/user-desktop.png"))
341
self.GotoAppDir.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/folder-wine.png"))
255
342
self.GameListPopUpMenu.AppendItem(self.GotoAppDir)
257
344
self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 233, _("Set the icon"))
258
self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/playonlinux16.png"))
345
self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/change_icon.png"))
259
346
self.GameListPopUpMenu.AppendItem(self.ChangeIcon)
261
348
self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 234, _("Remove"))
262
self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/options.png"))
349
self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/delete.png"))
263
350
self.GameListPopUpMenu.AppendItem(self.ChangeIcon)
265
352
self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 235, _("Close this application"))
266
self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/menu/wineserver.png"))
353
self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/wineserver.png"))
267
354
self.GameListPopUpMenu.AppendItem(self.ChangeIcon)
269
356
self.PopupMenu(self.GameListPopUpMenu, event.GetPoint())
271
def donate(self, event):
272
webbrowser.open("http://www.playonlinux.com/donate.html");
357
#if(len(sys.argv) >= 1):
359
#wx.MessageBox(str(sys.argv), "PlayOnLinux", wx.OK)
274
362
def RWineConfigurator(self, event):
275
363
self.RConfigure(_("Configure Wine"), "nothing")
277
365
def RKill(self, event):
278
366
self.RConfigure(_("KillApp"), "nothing")
280
def RKillAll(self, event):
281
os.system("bash \""+Variables.playonlinux_env+"/bash/killall\"&")
283
368
def RRegistryEditor(self, event):
284
369
self.RConfigure(_("Registry Editor"), "nothing")
371
def run_plugin(self, event):
372
game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8")
373
plugin=self.plugin_list[event.GetId()-300]
375
os.system("bash \""+Variables.playonlinux_rep+"/plugins/"+plugin+"/scripts/menu\" \""+game_exec+"\"&")
379
def OpenIrc(self, event):
380
self.irc = ircgui.IrcClient(self)
381
self.irc.Center(wx.BOTH)
286
384
def GoToAppDir(self, event):
287
game_exec = self.list_game.GetItemText(self.list_game.GetSelection())
288
self.read = open(Variables.playonlinux_rep+"configurations/installed/"+game_exec,"r").readlines()
290
if not len(self.read):
291
print "err: Empty launcher"
295
while(self.i < len(self.read)):
296
if("cd \"" in self.read[self.i]):
300
if len(self.read) == (self.i):
301
print "err: No path in launcher"
304
AppDir = self.read[self.i][3:]
306
os.system("xdg-open "+AppDir)
385
self.game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8")
386
playonlinux.open_folder(self.game_exec)
308
388
def ChangeIcon(self, event):
309
self.IconDir = Variables.homedir+"/.local/share/icons/"
310
self.SupprotedIconExt = "All|*.xpm;*.XPM;*.png;*.PNG;*.ico;*.ICO;*.jpg;*.JPG;*.jpeg;*.JPEG;*.bmp;*.BMP\
311
\|XPM (*.xpm)|*.xpm;*.XPM\
312
\|PNG (*.png)|*.png;*.PNG\
313
\|ICO (*.ico)|*.ico;*.ICO\
314
\|JPG (*.jpg)|*.jpg;*.JPG\
315
\|BMP (*.bmp)|*.bmp;*.BMP\
316
\|JPEG (*.jpeg)|*.jpeg;*JPEG"
317
self.IconDialog = wx.FileDialog(self, "Choose a icon file", self.IconDir, "", self.SupprotedIconExt, wx.OPEN | wx.FD_PREVIEW)
318
if self.IconDialog.ShowModal() == wx.ID_OK:
319
self.IconFilename=self.IconDialog.GetFilename()
320
self.IconDirname=self.IconDialog.GetDirectory()
321
IconFile=os.path.join(self.IconDirname,self.IconFilename)
322
self.RConfigure("IconChange", IconFile)
323
self.IconDialog.Destroy()
324
#Pop-up menu for game list: ending
389
self.IconDir = Variables.homedir+"/.local/share/icons/"
390
self.SupprotedIconExt = "All|*.xpm;*.XPM;*.png;*.PNG;*.ico;*.ICO;*.jpg;*.JPG;*.jpeg;*.JPEG;*.bmp;*.BMP\
391
\|XPM (*.xpm)|*.xpm;*.XPM\
392
\|PNG (*.png)|*.png;*.PNG\
393
\|ICO (*.ico)|*.ico;*.ICO\
394
\|JPG (*.jpg)|*.jpg;*.JPG\
395
\|BMP (*.bmp)|*.bmp;*.BMP\
396
\|JPEG (*.jpeg)|*.jpeg;*JPEG"
397
self.IconDialog = wx.FileDialog(self, "Choose a icon file", self.IconDir, "", self.SupprotedIconExt, wx.OPEN | wx.FD_PREVIEW)
398
if self.IconDialog.ShowModal() == wx.ID_OK:
399
self.IconFilename=self.IconDialog.GetFilename()
400
self.IconDirname=self.IconDialog.GetDirectory()
401
IconFile=os.path.join(self.IconDirname,self.IconFilename)
402
self.RConfigure("IconChange", IconFile)
403
self.IconDialog.Destroy()
404
#Pop-up menu for game list: ending
326
406
def Select(self, event):
327
game_exec = self.list_game.GetItemText(self.list_game.GetSelection())
328
self.read = open(Variables.playonlinux_rep+"configurations/installed/"+game_exec,"r").readlines()
407
game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8")
408
self.read = open(Variables.playonlinux_rep+"shortcuts/"+game_exec,"r").readlines()
330
410
self.wine_present = False;
331
411
while(self.i < len(self.read)):
332
412
if("wine " in self.read[self.i]):
333
413
self.wine_present = True;
416
def donate(self, event):
417
if(os.environ["POL_OS"] == "Mac"):
418
webbrowser.open("http://www.playonmac.com/en/donate.html")
420
webbrowser.open("http://www.playonlinux.com/en/donate.html")
335
422
def Reload(self, event):
337
self.games = os.listdir(Variables.playonlinux_rep+"configurations/installed/")
423
self.games = os.listdir(Variables.playonlinux_rep+"shortcuts/")
338
424
self.games.sort()
426
self.games.remove(".DS_Store")
339
429
self.list_game.DeleteAllItems()
340
self.images.RemoveAll()
430
self.images.RemoveAll()
341
431
root = self.list_game.AddRoot("")
343
433
for game in self.games: #METTRE EN 32x32
344
434
if(os.path.exists(Variables.playonlinux_rep+"/icones/32/"+game)):
345
435
file_icone = Variables.playonlinux_rep+"/icones/32/"+game
347
file_icone = Variables.playonlinux_rep+"/icones/32/playonlinux.png"
437
file_icone = Variables.playonlinux_env+"/etc/playonlinux32.png"
349
self.images.Add(wx.Bitmap(file_icone))
440
self.images.Add(wx.Bitmap(file_icone))
350
443
item = self.list_game.AppendItem(root, game, self.i)
447
def RConfigure(self, function_to_run, firstargument):
448
"""Starts polconfigurator remotely."""
449
game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8")
451
os.system("bash \""+Variables.playonlinux_env+"/bash/polconfigurator\" \""+game_exec+"\" \""+function_to_run+"\" \""+firstargument+"\"&")
357
455
def Options(self, event):
358
print("Running options")
359
onglet=event.GetId()-210
360
os.system(os.popen("printf $PYTHON",'r').read()+" \""+Variables.playonlinux_env+"/python/options.py\" "+str(onglet)+"&")
362
def run_plugin(self, event):
363
game_exec = self.list_game.GetItemText(self.list_game.GetSelection())
364
plugin=self.plugin_list[event.GetId()-300]
366
os.system("bash \""+Variables.playonlinux_rep+"/plugins/"+plugin+"/scripts/menu\" \""+game_exec+"\"&")
368
print("bash \""+Variables.playonlinux_rep+"/plugins/"+plugin+"/scripts/menu\" "+game_exec+"&")
370
def killwineserver(self, event):
371
os.system("bash \""+Variables.playonlinux_env+"/bash/expert/kill_wineserver\"&")
458
self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 2)
460
self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 1)
461
self.optionFrame.Center(wx.BOTH)
462
self.optionFrame.Show(True)
464
def killall(self, event):
465
os.system("bash \""+Variables.playonlinux_env+"/bash/killall\"&")
373
467
def Executer(self, event):
374
468
os.system("bash \""+Variables.playonlinux_env+"/bash/expert/Executer\"&")
470
def BugReport(self, event):
471
os.system("bash \""+Variables.playonlinux_env+"/bash/bug_report\"&")
473
def POLOnline(self, event):
474
os.system("bash \""+Variables.playonlinux_env+"/bash/playonlinux_online\" &")
376
476
def PolShell(self, event):
477
#Variables.run_x_server()
377
478
os.system("bash \""+Variables.playonlinux_env+"/bash/expert/PolShell\"&")
379
def RConfigure(self, function_to_run, firstargument):
380
"""Starts polconfigurator remotely."""
381
game_exec = self.list_game.GetItemText(self.list_game.GetSelection())
383
print function_to_run
386
print("Running (remotely) configuration of "+game_exec)
387
os.system("bash \""+Variables.playonlinux_env+"/bash/polconfigurator\" \""+game_exec+"\" \""+function_to_run+"\" \""+firstargument+"\"&")
389
480
def Configure(self, event):
481
game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8")
483
configureFrame = configure.MainWindow(None, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),"default",True)
485
configureFrame = configure.MainWindow(None, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),game_exec,False)
486
#self.SetTopWindow(installFrame)
487
configureFrame.Center(wx.BOTH)
488
configureFrame.Show(True)
490
#os.system("bash \""+Variables.playonlinux_env+"/bash/polconfigurator\" \""+game_exec+"\"&")
492
def Package(self, event):
390
493
game_exec = self.list_game.GetItemText(self.list_game.GetSelection())
392
print("Running configuration of "+game_exec)
393
os.system("bash \""+Variables.playonlinux_env+"/bash/polconfigurator\" \""+game_exec+"\"&")
494
os.system("bash \""+Variables.playonlinux_env+"/bash/make_shortcut\" \""+game_exec.encode("utf-8")+"\"&")
396
496
def UninstallGame(self, event):
397
497
game_exec = self.list_game.GetItemText(self.list_game.GetSelection())
399
print("Uninstall "+game_exec)
400
os.system("bash \""+Variables.playonlinux_env+"/bash/uninstall\" \""+game_exec+"\"&")
498
os.system("bash \""+Variables.playonlinux_env+"/bash/uninstall\" \""+game_exec.encode("utf-8")+"\"&")
403
501
def AutoReload(self, event):
404
reload = os.listdir(Variables.playonlinux_rep+"/configurations/installed")
405
if(reload != self.oldreload):
407
self.oldreload = reload
409
reloadimg = os.listdir(Variables.playonlinux_rep+"/icones/32")
410
if(reloadimg != self.oldimg):
412
self.oldimg = reloadimg
503
fichier_index = os.environ["REPERTOIRE"]+"/configurations/guis/index_"+os.environ["POL_ID"]
504
#print(fichier_index)
506
message = open(fichier_index,'r').read()
508
open(fichier_index,'a').write('')
509
message = open(fichier_index,'r').read()
510
message = string.split(message, "\n")
511
if(message[0] == "Open"):
512
self.frame = gui.POL_SetupFrame(os.environ["APPLICATION_TITLE"],message[1].replace("\n",""),message[2].replace("\n",""),message[3].replace("\n",""),message[4].replace("\n",""))
513
self.frame.Center(wx.BOTH)
514
self.frame.Show(True)
515
open(fichier_index,'w').write("Wait")
517
reload = os.listdir(Variables.playonlinux_rep+"/shortcuts")
518
if(reload != self.oldreload):
520
self.oldreload = reload
522
reloadimg = os.listdir(Variables.playonlinux_rep+"/icones/32")
523
if(reloadimg != self.oldimg):
525
self.oldimg = reloadimg
415
528
def InstallMenu(self, event):
416
print("Running install menu")
417
os.system("bash \""+Variables.playonlinux_env+"/bash/install\"&")
419
def UpdatePol(self, event):
420
print("Running update menu")
421
os.system("bash \""+Variables.playonlinux_env+"/bash/check_maj\"&")
423
def Autorun(self, event):
425
os.system("bash \""+Variables.playonlinux_env+"/bash/autorun\"&")
529
installFrame = install.InstallWindow(self, -1, _('{0} install menu').format(os.environ["APPLICATION_TITLE"]))
530
#self.SetTopWindow(installFrame)
531
installFrame.Center(wx.BOTH)
532
installFrame.Show(True)
427
534
def WineVersion(self, event):
428
print("Running wineversion menu")
429
os.system("bash \""+Variables.playonlinux_env+"/bash/wineversion\"&")
535
wversion = wver.MainWindow(None, -1, _('{0} wine versions manager').format(os.environ["APPLICATION_TITLE"]))
536
wversion.Center(wx.BOTH)
538
#os.system("bash \""+Variables.playonlinux_env+"/bash/wineversion\"&")
431
540
def Run(self, event):
432
541
game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8")
433
542
if(game_exec != ""):
434
print("Running "+game_exec)
435
os.system("cd \""+Variables.playonlinux_rep+"/configurations/installed/\" && bash \""+game_exec+"\"&")
543
os.system("bash "+Variables.playonlinux_env+"/bash/run_app \""+game_exec+"\"&")
544
#os.system("cd \""+Variables.playonlinux_rep+"/shortcuts/\" && bash \""+game_exec+"\"&")
438
547
def ClosePol(self, event):
548
if(wx.YES == wx.MessageBox(_('Are you sure you want to close all {0} Windows?').format(os.environ["APPLICATION_TITLE"]).decode("utf-8"), style=wx.YES_NO | wx.ICON_QUESTION)):
549
os.remove(Variables.playonlinux_rep+"/configurations/guis/index_"+os.environ["POL_ID"])
441
553
def About(self, event):
442
554
self.aboutBox = wx.AboutDialogInfo()
443
self.aboutBox.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY))
444
self.aboutBox.SetName("PlayOnLinux")
555
if(os.environ["POL_OS"] == "Linux"):
556
self.aboutBox.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY))
559
self.aboutBox.SetName(os.environ["APPLICATION_TITLE"])
445
560
self.aboutBox.SetVersion(Variables.version)
446
self.aboutBox.SetDescription(_("Run your Windows programs on Linux!"))
447
self.aboutBox.SetCopyright("(C) PlayOnLinux team 2007-2010\n"+_("Under GPL licence version 3."))
448
self.aboutBox.AddDeveloper(_("Developer and Website: ")+"Tinou (Pâris Quentin), MulX (Petit Aymeric)")
561
self.aboutBox.SetDescription(_("Run your Windows programs on "+os.environ["POL_OS"]+" !"))
562
self.aboutBox.SetCopyright(_("(C) PlayOnLinux and PlayOnMac team 2011\nUnder GPL licence version 3"))
563
self.aboutBox.AddDeveloper(_("Developer and Website: ")+"Tinou (Pâris Quentin), MulX (Petit Aymeric)")
449
564
self.aboutBox.AddDeveloper(_("Scriptors: ")+"GNU_Raziel")
450
self.aboutBox.AddDeveloper(_("Packager: ")+"MulX (Petit Aymeric)")
451
#self.aboutBox.AddDeveloper(_("Script Creator: ")+"Zoloom (Cassarin-Grand Arthur)")
452
self.aboutBox.AddDeveloper(_("The following people contributed to this program: ")+"kiplantt, NSLW, Salvatos, Minchul")
565
self.aboutBox.AddDeveloper(_("Packager: ")+"MulX (Petit Aymeric), Tinou (Pâris Quentin)")
566
self.aboutBox.AddDeveloper(_("Icons:")+"Faenza-Icons http://tiheum.deviantart.com/art/Faenza-Icons-173323228")
567
self.aboutBox.AddDeveloper(_("The following people contributed to this program: ")+"kiplantt, Salvatos, Minchul")
453
568
self.aboutBox.AddTranslator(_("Translation made on Launchpad:"))
454
569
self.aboutBox.AddTranslator("https://translations.launchpad.net/playonlinux/")
455
self.aboutBox.AddArtist(_("Icons are provided by the Tango Desktop Project"))
456
self.aboutBox.SetWebSite("http://www.playonlinux.com")
457
self.aboutBox.SetLicence(open("/usr/share/common-licenses/GPL",'r').read())
458
self.about = wx.AboutBox(self.aboutBox)
571
if(os.environ["POL_OS"] == "Mac"):
572
self.aboutBox.SetWebSite("http://www.playonmac.com")
574
self.aboutBox.SetWebSite("http://www.playonlinux.com")
575
wx.AboutBox(self.aboutBox)
460
577
class PlayOnLinuxApp(wx.App):
462
self.frame = MainWindow(None, -1, "PlayOnLinux")
463
self.SetTopWindow(self.frame)
464
self.frame.Center(wx.BOTH)
465
self.frame.Show(True)
582
if(os.popen("id -u").read() == "0"):
583
wx.MessageBox(_("{0} is not supposed to be run as root. Sorry").format(os.environ["APPLICATION_TITLE"]))
587
for f in sys.argv[1:]:
590
if(".exe" in f or ".EXE" in f):
594
if(close == True and exe_present == False):
597
self.SetClassName(os.environ["APPLICATION_TITLE"])
598
self.SetAppName(os.environ["APPLICATION_TITLE"])
599
#self.icon = wx.TaskBarIcon()
600
#self.icon.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonmac.png", wx.BITMAP_TYPE_ANY))
601
self.frame = MainWindow(None, -1, os.environ["APPLICATION_TITLE"])
602
self.SetTopWindow(self.frame)
603
self.frame.Center(wx.BOTH)
604
self.frame.Show(True)
608
def BringWindowToFront(self):
609
try: # it's possible for this event to come when the frame is closed
610
self.GetTopWindow().Raise()
614
def MacOpenFile(self, filename):
615
file_extension = string.split(filename,".")
616
file_extension = file_extension[len(file_extension) - 1]
617
if(file_extension == "desktop"): # Un raccourcis Linux
618
content = open(filename,"r").readlines()
620
while(i < len(content)):
621
# wx.MessageBox(content[i], "PlayOnLinux", wx.OK)
623
if("Path=" in content[i]):
624
cd_app = content[i].replace("Path=","").replace("\n","")
625
if("Exec=" in content[i]):
626
exec_app = content[i].replace("Exec=","").replace("\n","")
628
if(":\\\\\\\\" in exec_app):
629
exec_app = exec_app.replace("\\\\","\\")
631
os.system("cd \""+cd_app+"\" && "+exec_app+" &")
635
if(file_extension == "exe" or file_extension == "EXE"):
636
os.system("bash \"$PLAYONLINUX/bash/run_exe\" \""+filename+"\" &")
638
if(file_extension == "pol" or file_extension == "POL"):
639
if(wx.YES == wx.MessageBox(_('Are you sure you want to want to install {0} package?').format(filename).decode("utf-8"), style=wx.YES_NO | wx.ICON_QUESTION)):
640
os.system("bash \"$PLAYONLINUX/bash/playonlinux-pkg\" -i \""+filename+"\" &")
642
def MacOpenURL(self, url):
643
if(os.environ["POL_OS"] == "Mac" and "playonlinux://" in url):
644
wx.MessageBox("You are trying to open a script design for PlayOnLinux! It might not work as expected")
645
if(os.environ["POL_OS"] == "Linux" and "playonmac://" in url):
646
wx.MessageBox("You are trying to open a script design for PlayOnMac! It might not work as expected")
648
os.system("bash \"$PLAYONLINUX/bash/playonlinux-url_handler\" \""+url+"\" &")
650
def MacReopenApp(self):
652
self.BringWindowToFront()
471
app = PlayOnLinuxApp()
656
#os.system("bash \""+os.environ["PLAYONLINUX"]+"/bash/startup\"")
657
app = PlayOnLinuxApp(redirect=False)