2
# -*- coding: utf-8 -*-
4
# Copyright (C) 2011 Pâris Quentin
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License along
17
# with this program; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
# Wrapper.py - Enable running PlayOnLinux and PlayOnMac scripts outside of POL/POM environement
24
import os, getopt, sys, urllib, signal, string, time, webbrowser, gettext, locale, sys, shutil, subprocess
27
import lib.Variables as Variables, lib.lng as lng
28
import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading
33
polid=os.environ["POL_ID"]
35
class Program(threading.Thread):
37
threading.Thread.__init__(self)
43
for arg in sys.argv[2:]:
44
self.chaine+=" \""+arg+"\""
45
self.proc = subprocess.Popen("bash \""+sys.argv[1]+"\""+self.chaine, shell=True)
46
while(self.running == True):
51
class PlayOnLinuxApp(wx.App):
56
self.SetClassName(os.environ["APPLICATION_TITLE"])
57
self.SetAppName(os.environ["APPLICATION_TITLE"])
58
self.frame = gui.POL_SetupFrame(os.environ["APPLICATION_TITLE"],str(pid_to_open),top,left,str(pid_to_open))
59
self.frame.Center(wx.BOTH)
71
if(prog.proc.returncode == None):
72
fichier_index = os.environ["REPERTOIRE"]+"/configurations/guis/index_"+polid
73
fichier_index = os.environ["REPERTOIRE"]+"/configurations/guis/index_"+os.environ["POL_ID"]
76
message = open(fichier_index,'r').read()
78
open(fichier_index,'a').write('')
79
message = open(fichier_index,'r').read()
80
message = string.split(message, "\n")
81
if(message[0] == "Open"):
82
pid_to_open = message[1]
85
app = PlayOnLinuxApp(redirect=False)