~ubuntu-branches/ubuntu/wily/playonlinux/wily-proposed

« back to all changes in this revision

Viewing changes to .pc/x-terminal-emulator.diff/python/options.py

  • Committer: Package Import Robot
  • Author(s): Bertrand Marc
  • Date: 2011-12-10 15:48:27 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20111210154827-z9pylhgrahjh7eu1
Tags: 4.0.14-1
* New upstream release.
* Add the new TRANSLATORS file to debian/playonlinux.docs.
* Refresh patches/x-terminal-emulator.diff.
* Install etc/playonlinux.gpg to verify downloaded scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- coding: utf-8 -*-
3
 
 
4
 
# Copyright (C) 2009 Pâris Quentin
5
 
# Copyright (C) 2007-2010 PlayOnLinux Team
6
 
 
7
 
# This program is free software; you can redistribute it and/or modify
8
 
# it under the terms of the GNU General Public License as published by
9
 
# the Free Software Foundation; either version 2 of the License, or
10
 
# (at your option) any later version.
11
 
 
12
 
# This program is distributed in the hope that it will be useful,
13
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 
# GNU General Public License for more details.
16
 
 
17
 
# You should have received a copy of the GNU General Public License along
18
 
# with this program; if not, write to the Free Software Foundation, Inc.,
19
 
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
20
 
 
21
 
from asyncore import dispatcher
22
 
import wxversion, os, getopt, sys, urllib, signal, socket, string
23
 
import wx, time
24
 
import webbrowser, shutil
25
 
import threading, time, codecs
26
 
from select import select
27
 
#from subprocess import Popen,PIPE
28
 
 
29
 
import lib.Variables as Variables
30
 
import lib.lng as lng
31
 
 
32
 
class getPlugins(threading.Thread):
33
 
  def __init__(self):
34
 
        threading.Thread.__init__(self)
35
 
        self.thread_message = "#WAIT#"
36
 
        self.versions = []
37
 
        self.start()
38
 
 
39
 
  def download(self, game):
40
 
        self.getDescription = game
41
 
        
42
 
  def run(self):
43
 
        self.thread_running = True
44
 
        while(self.thread_running):
45
 
                if(self.thread_message == "get"):
46
 
                        try :
47
 
                                url = 'http://mulx.playonlinux.com/wine/linux-i386/LIST'
48
 
                                req = urllib2.Request(url)
49
 
                                handle = urllib2.urlopen(req)
50
 
                                time.sleep(1)
51
 
                                available_versions = handle.read()
52
 
                                available_versions = string.split(available_versions,"\n")
53
 
                                self.i = 0
54
 
                                self.versions_ = []
55
 
                                while(self.i < len(available_versions) - 1):
56
 
                                        informations = string.split(available_versions[self.i], ";")
57
 
                                        version = informations[1]
58
 
                                        package = informations[0]
59
 
                                        sha1sum = informations[2]
60
 
                                        if(not os.path.exists(Variables.playonlinux_rep+"/WineVersions/"+version)):
61
 
                                                self.versions_.append(version)
62
 
                                        self.i += 1     
63
 
                                self.versions_.reverse()
64
 
                                self.versions = self.versions_[:]
65
 
 
66
 
                                self.thread_message = "Ok"
67
 
                        except :
68
 
                                time.sleep(1)
69
 
                                self.thread_message = "Err"
70
 
                                self.versions = ["Wine packages website is unavailable"]
71
 
                else:
72
 
                        time.sleep(0.2)
73
 
 
74
 
 
75
 
class Onglets(wx.Notebook):
76
 
        # Classe dérivée du wx.Notebook
77
 
        def __init__(self, parent):
78
 
                if(os.environ["POL_OS"] == "Mac"):
79
 
                        self.fontTitle = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT)
80
 
                        self.caption_font = wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT)
81
 
                else :
82
 
                        self.fontTitle = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT)
83
 
                        self.caption_font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT)
84
 
                
85
 
                
86
 
                self.notebook = wx.Notebook.__init__(self, parent, -1)
87
 
                self.images_onglets = wx.ImageList(16, 16)
88
 
                self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/input-gaming.png"));
89
 
                self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/internet-group-chat.png"));
90
 
                self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png"));
91
 
                self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/user-desktop.png"));
92
 
                self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/application-x-executable.png"));
93
 
                self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png"));
94
 
                self.SetImageList(self.images_onglets)
95
 
 
96
 
        def General(self, nom):
97
 
                self.panelGeneral = wx.Panel(self, -1)
98
 
                self.fontTitle = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT)
99
 
                self.txtPrograms = wx.StaticText(self.panelGeneral, -1, _("Default programs"), (0,0), wx.DefaultSize)
100
 
                self.txtPrograms.SetFont(self.fontTitle)
101
 
                
102
 
                self.FontNavigator = wx.StaticText(self.panelGeneral, -1, _("Default browser"), (10,30), wx.DefaultSize)
103
 
                if(os.path.exists(Variables.playonlinux_rep+"/configurations/options/navigator")):
104
 
                        default_navigator = open(Variables.playonlinux_rep+"/configurations/options/navigator","r").read()
105
 
                else:
106
 
                        default_navigator = "Default"
107
 
 
108
 
                self.Navigator = wx.ComboBox(self.panelGeneral, -1, value=default_navigator, choices=["Default","firefox","konqueror","opera"], pos=(20,50))
109
 
                self.buttonTestN = wx.Button(self.panelGeneral, 110, _("Test"), pos=(230,50), size=(80,27))
110
 
                
111
 
                self.FontTerm = wx.StaticText(self.panelGeneral, -1, _("Default terminal"), (10,100), wx.DefaultSize)
112
 
 
113
 
                if(os.path.exists(Variables.playonlinux_rep+"/configurations/options/terminal")):
114
 
                        default_terminal = open(Variables.playonlinux_rep+"/configurations/options/terminal","r").read()
115
 
                else:
116
 
                        default_terminal = "xterm"
117
 
                self.Term = wx.ComboBox(self.panelGeneral, -1, value=default_terminal, choices=os.listdir(Variables.playonlinux_env+"/bash/terminals"), pos=(20,120),style=wx.CB_READONLY)
118
 
                self.buttonTestT = wx.Button(self.panelGeneral, 111, _("Test"), pos=(230,120), size=(80,27))
119
 
 
120
 
 
121
 
                self.txtOther = wx.StaticText(self.panelGeneral, -1, _("Other"), (0,180), wx.DefaultSize)
122
 
                self.txtOther.SetFont(self.fontTitle)
123
 
 
124
 
                self.FontNavigator = wx.StaticText(self.panelGeneral, -1, _("Temp directory"), (10,210), wx.DefaultSize)
125
 
                self.TmpAutoRemove = wx.CheckBox(self.panelGeneral, -1, _("Automatically empty temp directory"),pos=(20,230))
126
 
                
127
 
                if(os.path.exists(Variables.playonlinux_rep+"/configurations/options/rmtemp")):
128
 
                        if(open(Variables.playonlinux_rep+"/configurations/options/rmtemp",'r').read() == '1'):
129
 
                                self.TmpAutoRemove.SetValue(1)
130
 
                else:
131
 
                        self.TmpAutoRemove.SetValue(1)
132
 
                self.AddPage(self.panelGeneral, nom, imageId=0)
133
 
                wx.EVT_BUTTON(self, 110, self.browser_test)
134
 
                wx.EVT_BUTTON(self, 111, self.term_test)
135
 
 
136
 
        #def get_lng_name(self, lng):
137
 
        #       return os.popen("cat "+Variables.playonlinux_env+"/lang/"+lng+" | grep LNGFILENAME").read().replace("\n","").replace("\"","").replace("export LNGFILENAME=","")
138
 
        
139
 
        def browser_test(self, event):
140
 
                if(self.Navigator.GetValue() == "Default"):
141
 
                        webbrowser.open("http://www.playonlinux.com")   
142
 
                else:
143
 
                        os.system(self.Navigator.GetValue()+" http://www.playonlinux.com &")
144
 
 
145
 
        def term_test(self, event):
146
 
                os.system("bash "+Variables.playonlinux_env+"/bash/terminals/"+self.Term.GetValue()+" sleep 2 &")
147
 
 
148
 
        def Internet(self, nom):
149
 
                self.panelInternet = wx.Panel(self, -1)
150
 
 
151
 
                if(os.path.exists(Variables.playonlinux_rep+"/configurations/options/offline")):
152
 
                        if(open(Variables.playonlinux_rep+"/configurations/options/offline",'r').read() == '1'):
153
 
                                self.OffLineCheck.SetValue(1)
154
 
                
155
 
                self.ProxySettings = wx.StaticText(self.panelInternet, -1, _("Proxy configuration"), (0,0), wx.DefaultSize)
156
 
                self.ProxySettings.SetFont(self.fontTitle)
157
 
                
158
 
                proxy_settings = {}
159
 
                
160
 
                proxy_settings['PROXY_ENABLED'] = "0"
161
 
                proxy_settings['PROXY_ADRESS'] = ""
162
 
                proxy_settings["PROXY_PORT"] = "8080"
163
 
                proxy_settings["PROXY_LOGIN"] = ""
164
 
                proxy_settings["PROXY_PASS"] = ""
165
 
                
166
 
                if(os.path.exists(Variables.playonlinux_rep+"/configurations/options/proxy")):
167
 
                        proxy = open(Variables.playonlinux_rep+"/configurations/options/proxy","r").readlines()
168
 
                        self.i = 0
169
 
                        
170
 
                        while(self.i < len(proxy)):
171
 
                                line_parsed = string.split(proxy[self.i].replace("\n","").replace("\r",""),"=")
172
 
                                #print line_parsed[0] + " " + line_parsed[1]
173
 
                                proxy_settings[line_parsed[0]] = line_parsed[1]
174
 
                                self.i += 1
175
 
                
176
 
                self.ProxyCheck = wx.CheckBox(self.panelInternet, 120, _("Set a proxy"),pos=(10,30))
177
 
                self.ProxyCheck.SetValue(int(proxy_settings['PROXY_ENABLED']))
178
 
 
179
 
                self.ProxyTxtAdresse = wx.StaticText(self.panelInternet, -1, _("Proxy address"), (10,60), wx.DefaultSize)
180
 
                self.ProxyAdresse = wx.TextCtrl(self.panelInternet, -1, proxy_settings["PROXY_ADRESS"], pos=(20,80),size=(300,27))
181
 
                
182
 
                self.ProxyTxtPort = wx.StaticText(self.panelInternet, -1, _("Proxy port"), (10,120), wx.DefaultSize)
183
 
                self.ProxyPort = wx.TextCtrl(self.panelInternet, -1, proxy_settings["PROXY_PORT"], pos=(20,140),size=(80,27))
184
 
 
185
 
                self.ProxyTxtLogin = wx.StaticText(self.panelInternet, -1, _("Proxy login"), (10,180), wx.DefaultSize)
186
 
                self.ProxyLogin = wx.TextCtrl(self.panelInternet, -1, proxy_settings["PROXY_LOGIN"], pos=(20,200),size=(300,27))
187
 
 
188
 
                self.ProxyTxtPass = wx.StaticText(self.panelInternet, -1, _("Proxy password"), (10,240), wx.DefaultSize)
189
 
                self.ProxyPass = wx.TextCtrl(self.panelInternet, -1, proxy_settings["PROXY_PASS"], pos=(20,260),size=(300,27), style=wx.TE_PASSWORD)
190
 
                self.AddPage(self.panelInternet, nom, imageId=2)
191
 
                wx.EVT_CHECKBOX(self, 120, self.proxy_enable)
192
 
                self.proxy_enable(self)
193
 
 
194
 
        def proxy_enable(self, event):
195
 
                if(self.ProxyCheck.IsChecked() == 1):
196
 
                        self.ProxyAdresse.Enable(True)
197
 
                        self.ProxyLogin.Enable(True)
198
 
                        self.ProxyPass.Enable(True)
199
 
                        self.ProxyPort.Enable(True)
200
 
                else:
201
 
                        self.ProxyAdresse.Enable(False)
202
 
                        self.ProxyLogin.Enable(False)
203
 
                        self.ProxyPass.Enable(False)
204
 
                        self.ProxyPort.Enable(False)
205
 
 
206
 
        def Wine(self, nom):
207
 
                env_settings = {}
208
 
                
209
 
                env_settings['DESKTOP'] = os.popen("printf $HOME").read()+"/Desktop/"
210
 
                env_settings['WINEVERSION'] = "System"
211
 
 
212
 
                if(os.path.exists(Variables.playonlinux_rep+"/configurations/options/env")):
213
 
                        envfile = open(Variables.playonlinux_rep+"/configurations/options/env","r").readlines()
214
 
                        self.i = 0
215
 
                        
216
 
                        while(self.i < len(envfile)):
217
 
                                line_parsed = string.split(envfile[self.i].replace("\n","").replace("\r",""),"=")
218
 
                                env_settings[line_parsed[0]] = line_parsed[1]
219
 
                                self.i += 1
220
 
 
221
 
 
222
 
                self.panelWine = wx.Panel(self, -1)
223
 
                self.txtWine = wx.StaticText(self.panelWine, -1, _("Wine"), (0,0), wx.DefaultSize)
224
 
                self.txtWine.SetFont(self.fontTitle)
225
 
                self.txtWVer = wx.StaticText(self.panelWine, -1, _("Default Wine version for PlayOnLinux programs: "), (10,30), wx.DefaultSize)
226
 
                wine_ver = os.listdir(Variables.playonlinux_rep+"/WineVersions/")
227
 
                self.i = 0
228
 
                wine_ver_bis = []
229
 
                while(self.i < len(wine_ver)):
230
 
                        if(os.path.isdir(Variables.playonlinux_rep+"/WineVersions/"+wine_ver[self.i])):
231
 
                                wine_ver_bis.append(wine_ver[self.i])
232
 
                        self.i += 1
233
 
                wine_ver = wine_ver_bis[:]
234
 
                wine_ver.sort()
235
 
                wine_ver.insert(0, "System")
236
 
                self.WineVersion = wx.ComboBox(self.panelWine, -1, value=env_settings['WINEVERSION'], choices=wine_ver, pos=(20,50))
237
 
 
238
 
                self.txtDesktop = wx.StaticText(self.panelWine, -1, _("Desktop"), (0,100), wx.DefaultSize)
239
 
                self.txtPanel = wx.StaticText(self.panelWine, -1, _("PlayOnLinux menu"), (10,130), wx.DefaultSize)
240
 
                self.Panel = wx.CheckBox(self.panelWine, -1, _("Add the PlayOnLinux menu to your panel"),pos=(20,150))
241
 
                if(os.path.exists(os.popen("printf $HOME").read()+"/.config/menus/applications-merged/playonlinux-Programmes.menu")):
242
 
                        self.Panel.SetValue(1)
243
 
                self.txtPanel = wx.StaticText(self.panelWine, -1, _("Desktop directory"), (10,190), wx.DefaultSize)
244
 
                self.Desktop = wx.TextCtrl(self.panelWine, -1, env_settings['DESKTOP'] ,pos=(20,210),size=(300,27))
245
 
 
246
 
 
247
 
                self.txtDesktop.SetFont(self.fontTitle)
248
 
                self.AddPage(self.panelWine, nom, imageId=3)
249
 
 
250
 
        
251
 
 
252
 
        def System(self, nom):
253
 
                self.panelSystem = wx.Panel(self, -1)
254
 
                self.panels_buttons_system = wx.Panel(self.panelSystem, -1)
255
 
 
256
 
                self.sizerSystem = wx.BoxSizer(wx.VERTICAL) 
257
 
 
258
 
                self.txtGLX = wx.TextCtrl(self.panelSystem, -1, style=wx.TE_MULTILINE)          
259
 
 
260
 
                self.sizerSystem.Add(self.txtGLX, 9, wx.EXPAND|wx.ALL, 2)
261
 
                self.sizerSystem.Add(self.panels_buttons_system, 1, wx.EXPAND|wx.ALL, 2)
262
 
                
263
 
                self.GlxInfo = wx.Button(self.panels_buttons_system, 100, "GLXInfos", pos=(0,0))
264
 
                self.xOrg = wx.Button(self.panels_buttons_system, 101, "xorg.conf", pos=(100,0))
265
 
                self.glxGears = wx.Button(self.panels_buttons_system, 102, "3D Test", pos=(200,0))
266
 
                self.glxGears = wx.Button(self.panels_buttons_system, 103, "System", pos=(300,0))
267
 
 
268
 
                self.panelSystem.SetSizer(self.sizerSystem)
269
 
                self.panelSystem.SetAutoLayout(True)
270
 
 
271
 
                self.AddPage(self.panelSystem, nom, imageId=4)
272
 
                        
273
 
                wx.EVT_BUTTON(self, 100, self.glxinfo)
274
 
                wx.EVT_BUTTON(self, 101, self.xorg)
275
 
                wx.EVT_BUTTON(self, 102, self.glxgears)
276
 
                wx.EVT_BUTTON(self, 103, self.system_info)
277
 
 
278
 
        def LoadPlugins(self):
279
 
                self.pluginlist.DeleteAllItems()
280
 
                self.pluginImgList.RemoveAll()
281
 
                plugins=os.listdir(Variables.playonlinux_rep+"/plugins/")
282
 
                self.i = 0
283
 
                
284
 
                PluginsRoot = self.pluginlist.AddRoot("")
285
 
                plugins.sort()
286
 
                while(self.i < len(plugins)):
287
 
                        self.pluginlist.AppendItem(PluginsRoot, plugins[self.i], self.i)
288
 
                        if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+plugins[self.i]+"/enabled") == False):
289
 
                                self.pluginlist.SetItemTextColour(self.pluginlist.GetLastChild(PluginsRoot), wx.Colour(150,150,150))
290
 
                        self.icon_look_for = Variables.playonlinux_rep+"/plugins/"+plugins[self.i]+"/icon"
291
 
                        if(os.path.exists(self.icon_look_for)):
292
 
                                self.pluginImgList.Add(wx.Bitmap(self.icon_look_for))
293
 
                        else:   
294
 
                                self.pluginImgList.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/playonlinux16.png"))
295
 
                        self.i += 1
296
 
                self.EnablePlugin.Enable(False)
297
 
                self.ConfigurePlugin.Enable(False)
298
 
                self.DelPlugin.Enable(False)
299
 
 
300
 
        def Plugins(self, nom):
301
 
                self.panelPlugins= wx.Panel(self, -1)
302
 
                self.panels_buttons_plugins = wx.Panel(self.panelPlugins, -1)
303
 
 
304
 
                self.sizerPlugins = wx.BoxSizer(wx.VERTICAL) 
305
 
                self.txtPlugin = wx.StaticText(self.panelPlugins, -1, _("Installed plugins"), size=wx.DefaultSize)
306
 
                self.txtPlugin.SetFont(self.fontTitle)
307
 
                self.pluginlist = wx.TreeCtrl(self.panelPlugins, 220, style=wx.RAISED_BORDER|wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT)          
308
 
                self.pluginlist.SetSpacing(0)
309
 
 
310
 
                self.pluginImgList = wx.ImageList(16,16)
311
 
 
312
 
                self.pluginlist.SetImageList(self.pluginImgList)
313
 
 
314
 
                
315
 
 
316
 
                self.sizerPlugins.Add(self.txtPlugin, 1, wx.EXPAND|wx.ALL, 2)
317
 
                self.sizerPlugins.Add(self.pluginlist, 7, wx.EXPAND|wx.ALL, 2)
318
 
 
319
 
                self.sizerPlugins.Add(self.panels_buttons_plugins, 6, wx.EXPAND|wx.ALL, 2)
320
 
                
321
 
                self.panelPlugins.SetSizer(self.sizerPlugins)
322
 
                self.panelPlugins.SetAutoLayout(True)
323
 
                self.AddPlugin = wx.Button(self.panels_buttons_plugins, wx.ID_ADD,  pos=(0,0))
324
 
                self.DelPlugin = wx.Button(self.panels_buttons_plugins, wx.ID_REMOVE, pos=(100,0))
325
 
                self.ConfigurePlugin = wx.Button(self.panels_buttons_plugins, 212, _("Configure"), pos=(0,38))  
326
 
                self.EnablePlugin = wx.Button(self.panels_buttons_plugins, 213, _("Enable"), pos=(100,38))
327
 
                self.txtPlugin = wx.StaticText(self.panels_buttons_plugins, -1, _("Choose a plugin"), size=(300,150), pos=(200,5))
328
 
 
329
 
                self.LoadPlugins()
330
 
 
331
 
                self.AddPage(self.panelPlugins, nom, imageId=5)
332
 
 
333
 
                wx.EVT_TREE_SEL_CHANGED(self, 220, self.choose_plugin)
334
 
        
335
 
                wx.EVT_BUTTON(self, 214, self.disable)
336
 
                wx.EVT_BUTTON(self, 213, self.enable)
337
 
                wx.EVT_BUTTON(self, 212, self.setup_plug)
338
 
                wx.EVT_BUTTON(self, wx.ID_REMOVE, self.delete_plug)
339
 
                wx.EVT_BUTTON(self, wx.ID_ADD, self.add_plug)
340
 
 
341
 
        def setup_plug(self, event):
342
 
                self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection())
343
 
                self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin
344
 
                os.system("bash \""+self.plugin_path+"/scripts/options\" &")
345
 
 
346
 
        def add_plug(self, event):
347
 
                self.FileDialog = wx.FileDialog(self)
348
 
                self.FileDialog.SetDirectory("~")
349
 
                self.FileDialog.SetWildcard("POL Packages (*.pol)|*.pol")
350
 
                self.FileDialog.ShowModal()
351
 
                if(self.FileDialog.GetPath() != ""):
352
 
                        if(wx.YES == wx.MessageBox(_("Are you sure you want to install: ").decode("utf-8")+self.FileDialog.GetPath()+"?", style=wx.YES_NO | wx.ICON_QUESTION)):
353
 
                                os.system("bash \""+Variables.playonlinux_env+"/playonlinux-pkg\" -i \""+self.FileDialog.GetPath().encode('utf-8')+"\"")
354
 
                                self.LoadPlugins()
355
 
                self.FileDialog.Destroy()
356
 
 
357
 
        def delete_plug(self, event):
358
 
                self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection())
359
 
                self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin
360
 
                if(wx.YES == wx.MessageBox(_("Are you sure you want to delete: ").decode("utf-8")+self.current_plugin+"?", style=wx.YES_NO | wx.ICON_QUESTION)):
361
 
                        shutil.rmtree(self.plugin_path)
362
 
                        self.LoadPlugins()
363
 
        def disable(self, event):
364
 
                self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection())
365
 
                self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin
366
 
                os.remove(self.plugin_path+"/enabled")
367
 
                self.LoadPlugins()
368
 
 
369
 
        def enable(self, event):
370
 
                self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection())
371
 
                self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin
372
 
                enab=open(self.plugin_path+"/enabled",'w')
373
 
                enab.close()
374
 
                self.LoadPlugins()
375
 
 
376
 
        def choose_plugin(self, event):
377
 
                self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection())
378
 
                self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin
379
 
                if(os.path.exists(self.plugin_path+"/enabled")):
380
 
                        self.EnablePlugin.Destroy()
381
 
                        self.EnablePlugin = wx.Button(self.panels_buttons_plugins, 214, _("Disable"), pos=(100,38))
382
 
                else:
383
 
                        self.EnablePlugin.Destroy()
384
 
                        self.EnablePlugin = wx.Button(self.panels_buttons_plugins, 213, _("Enable"), pos=(100,38))
385
 
 
386
 
                if(os.path.exists(self.plugin_path+"/scripts/options")):
387
 
                        self.ConfigurePlugin.Enable(True)
388
 
                else:
389
 
                        self.ConfigurePlugin.Enable(False)
390
 
        
391
 
                if(os.path.exists(self.plugin_path+"/description")):    
392
 
                        self.txtPlugin.Destroy()
393
 
                        self.txtPlugin = wx.StaticText(self.panels_buttons_plugins, -1, open(self.plugin_path+"/description","r").read(), size=(285,150), pos=(200,5))
394
 
 
395
 
                self.DelPlugin.Enable(True)
396
 
 
397
 
        def glxinfo(self, event):
398
 
                glx = os.popen("glxinfo", "r").read()
399
 
                self.txtGLX.SetValue(glx)
400
 
 
401
 
        def xorg(self, event):
402
 
                glx = open("/etc/X11/xorg.conf", "r").read()
403
 
                self.txtGLX.SetValue(glx)
404
 
 
405
 
        def glxgears(self, event):
406
 
                self.result = os.popen("glxgears", "r").read()
407
 
                self.txtGLX.SetValue(self.result)
408
 
        
409
 
        def system_info(self, event):
410
 
                self.txtGLX.SetValue(os.popen("bash \""+Variables.playonlinux_env+"/bash/system_info\" &", "r").read())
411
 
 
412
 
        def SupprimePage(self, index):
413
 
                self.DeletePage(index)
414
 
                        
415
 
 
416
 
class MainWindow(wx.Frame):
417
 
  def __init__(self,parent,id,title,onglet):
418
 
    wx.Frame.__init__(self, parent, -1, title, size = (505, 550), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX)
419
 
    self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY))
420
 
    self.panelFenp = wx.Panel(self, -1)
421
 
    self.panels_buttons = wx.Panel(self.panelFenp, -1)
422
 
    self.Apply = wx.Button(self.panels_buttons, wx.ID_APPLY, pos=(400,0))
423
 
    self.Close = wx.Button(self.panels_buttons, wx.ID_CLOSE, pos=(305,0))
424
 
    self.sizer = wx.BoxSizer(wx.VERTICAL)   
425
 
    self.onglets = Onglets(self.panelFenp)
426
 
 
427
 
    self.sizer.Add(self.onglets, 10, wx.EXPAND|wx.ALL, 2)
428
 
    self.sizer.Add(self.panels_buttons, 1, wx.EXPAND|wx.ALL, 2)
429
 
 
430
 
    #self.onglets.General(_("General"))
431
 
    self.onglets.Internet(_("Internet"))
432
 
    #self.onglets.Wine(_("Environment"))
433
 
    #self.onglets.System(_("System"))
434
 
    self.onglets.Plugins(_("Plugins"))
435
 
    try:
436
 
                self.onglets.SetSelection(onglet)
437
 
    except:
438
 
                pass
439
 
 
440
 
    self.panelFenp.SetSizer(self.sizer)
441
 
    self.panelFenp.SetAutoLayout(True)
442
 
    wx.EVT_BUTTON(self, wx.ID_APPLY, self.apply_settings)
443
 
    wx.EVT_BUTTON(self, wx.ID_CLOSE, self.app_Close)
444
 
 
445
 
  def app_Close(self, event):
446
 
    self.Destroy()
447
 
 
448
 
  def apply_settings(self, event):
449
 
    #Navigateur
450
 
    open(Variables.playonlinux_rep+"/configurations/options/navigator","w").write(self.onglets.Navigator.GetValue())
451
 
    #Terminal
452
 
    open(Variables.playonlinux_rep+"/configurations/options/terminal","w").write(self.onglets.Term.GetValue())
453
 
 
454
 
    open(Variables.playonlinux_rep+"/configurations/options/rmtemp","w").write(str(int(self.onglets.TmpAutoRemove.GetValue())))
455
 
    if(self.onglets.ProxyAdresse.GetValue().replace("http://","") and self.onglets.ProxyPort.GetValue()):
456
 
            self.chaine = "PROXY_ENABLED="+str(int(self.onglets.ProxyCheck.IsChecked()))+"\nPROXY_ADRESS="+self.onglets.ProxyAdresse.GetValue().replace("http://","")+"\n"+"PROXY_PORT="+self.onglets.ProxyPort.GetValue()+"\n"
457
 
            if(self.onglets.ProxyLogin.GetValue() and self.onglets.ProxyPass.GetValue()):
458
 
                self.chaine += "PROXY_LOGIN="+self.onglets.ProxyLogin.GetValue()+"\n"+"PROXY_PASS="+self.onglets.ProxyPass.GetValue()+"\n"
459
 
    else:
460
 
            self.chaine=""
461
 
 
462
 
           
463
 
    open(Variables.playonlinux_rep+"/configurations/options/proxy","w").write(self.chaine)
464
 
 
465
 
 
466
 
    if(self.onglets.Desktop.GetValue()):
467
 
        self.desk = self.onglets.Desktop.GetValue().encode('utf-8')
468
 
    else:
469
 
        self.desk = os.popen("printf $HOME").read()+"/Desktop/"
470
 
 
471
 
    if(self.onglets.Panel.IsChecked() == 1):
472
 
        os.system("bash \""+Variables.playonlinux_env+"/bash/panel\" --build")  
473
 
    else:
474
 
        os.system("bash \""+Variables.playonlinux_env+"/bash/panel\" --rm")
475
 
        
476
 
    self.env_chaine = "DESKTOP="+self.desk+"\nWINEVERSION="+self.onglets.WineVersion.GetValue()
477
 
    open(Variables.playonlinux_rep+"/configurations/options/env",'w').write(self.env_chaine)
478
 
    wx.MessageBox(_("You must restart PlayOnLinux for the changes to take effect."), "PlayOnLinux", wx.OK)
479
 
    self.Destroy()
480