def setname(self, event): new_name = self.general_elements["name"].GetValue() if(self.changing_selection == False): self.typing = True else: self.changing_selection = False if(not os.path.exists(Variables.playonlinux_rep+"shortcuts/"+new_name)): try: os.rename(Variables.playonlinux_rep+"icones/32/"+self.s_title,Variables.playonlinux_rep+"icones/32/"+new_name) except: pass try: os.rename(Variables.playonlinux_rep+"icones/full_size/"+self.s_title,Variables.playonlinux_rep+"icones/full_size/"+new_name) except: pass try: os.rename(Variables.playonlinux_rep+"configurations/configurators/"+self.s_title,Variables.playonlinux_rep+"configurations/configurators/"+new_name) except: pass try: os.rename(Variables.playonlinux_rep+"shortcuts/"+self.s_title,Variables.playonlinux_rep+"shortcuts/"+new_name) self.s_title = new_name self.s_prefix = playonlinux.getPrefix(self.s_title) except: pass
def DeletePrefix(self, event): if (self.onglets.s_isPrefix == True): if (self.onglets.s_prefix == "default"): wx.MessageBox(_("This virtual drive is protected"), os.environ["APPLICATION_TITLE"]) else: if (wx.YES == wx.MessageBox( _("Are you sure you want to delete {0} virtual drive ?" ).format(self.onglets.s_prefix.encode( "utf-8")).decode("utf-8"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): mylist = os.listdir(Variables.playonlinux_rep + "/shortcuts") for element in mylist: if (playonlinux.getPrefix(element).lower() == self.onglets.s_prefix.lower()): os.remove(Variables.playonlinux_rep + "/shortcuts/" + element) shutil.rmtree(Variables.playonlinux_rep + "/wineprefix/" + self.onglets.s_prefix) else: if (wx.YES == wx.MessageBox( _("Are you sure you want to delete {0} ?").format( self.onglets.s_title.encode("utf-8")).decode("utf-8"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): os.remove(Variables.playonlinux_rep + "/shortcuts/" + self.onglets.s_title) self.onglets.s_isPrefix = True self.change_program("default", True) self.list_game.SelectItem(self.prefixes_item["default"])
def Run(self, event): game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8") game_prefix = playonlinux.getPrefix(game_exec) if(os.path.exists(os.environ["POL_USER_ROOT"]+"/wineprefix/"+game_prefix)): if(game_exec != ""): os.system("bash "+Variables.playonlinux_env+"/bash/run_app \""+game_exec+"\"&") else: wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"])
def DeletePrefix(self, event): if (self.onglets.s_isPrefix == True): if (self.onglets.s_prefix == "default"): wx.MessageBox(_("This virtual drive is protected"), os.environ["APPLICATION_TITLE"]) else: if (wx.YES == wx.MessageBox( _("Are you sure you want to delete {0} virtual drive ?" ).format( self.onglets.s_prefix.encode("utf-8", "replace")).decode( "utf-8", "replace"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): mylist = os.listdir(Variables.playonlinux_rep + "/shortcuts") for element in mylist: if (playonlinux.getPrefix(element).lower() == self.onglets.s_prefix.lower()): subprocess.Popen([ "bash", Variables.playonlinux_env + "/bash/uninstall", "--non-interactive", element ]) self._delete_directory(Variables.playonlinux_rep + "/wineprefix/" + self.onglets.s_prefix) else: if (wx.YES == wx.MessageBox( _("Are you sure you want to delete {0} ?").format( self.onglets.s_title.encode("utf-8", "replace")).decode( "utf-8", "replace"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): subprocess.Popen([ "bash", Variables.playonlinux_env + "/bash/uninstall", "--non-interactive", self.onglets.s_title.encode('utf-8', 'replace') ]) self.onglets.s_isPrefix = True self.change_program("default", True) self.list_game.SelectItem(self.prefixes_item["default"])
def DeletePrefix(self, event): if(self.onglets.s_isPrefix == True): if(self.onglets.s_prefix == "default"): wx.MessageBox(_("This virtual drive is protected"), os.environ["APPLICATION_TITLE"]) else: if(wx.YES == wx.MessageBox(_("Are you sure you want to delete {0} virtual drive ?").format(self.onglets.s_prefix.encode("utf-8","replace")).decode("utf-8","replace"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): mylist = os.listdir(Variables.playonlinux_rep+"/shortcuts") for element in mylist: if(playonlinux.getPrefix(element).lower() == self.onglets.s_prefix.lower()): subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/uninstall", "--non-interactive", element]) self._delete_directory(Variables.playonlinux_rep+"/wineprefix/"+self.onglets.s_prefix) else: if(wx.YES == wx.MessageBox(_("Are you sure you want to delete {0} ?").format(self.onglets.s_title.encode("utf-8","replace")).decode("utf-8","replace"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/uninstall", "--non-interactive", self.onglets.s_title.encode('utf-8', 'replace')]) self.onglets.s_isPrefix = True self.change_program("default",True) self.list_game.SelectItem(self.prefixes_item["default"])
def DeletePrefix(self, event): if(self.onglets.s_isPrefix == True): if(self.onglets.s_prefix == "default"): wx.MessageBox(_("This virtual drive is protected"), os.environ["APPLICATION_TITLE"]) else: if(wx.YES == wx.MessageBox(_("Are you sure you want to delete {0} virtual drive ?").format(self.onglets.s_prefix.encode("utf-8")).decode("utf-8"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): mylist = os.listdir(Variables.playonlinux_rep+"/shortcuts") for element in mylist: if(playonlinux.getPrefix(element).lower() == self.onglets.s_prefix.lower()): os.remove(Variables.playonlinux_rep+"/shortcuts/"+element) shutil.rmtree(Variables.playonlinux_rep+"/wineprefix/"+self.onglets.s_prefix) else: if(wx.YES == wx.MessageBox(_("Are you sure you want to delete {0} ?").format(self.onglets.s_title.encode("utf-8")).decode("utf-8"), os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): os.remove(Variables.playonlinux_rep+"/shortcuts/"+self.onglets.s_title) self.onglets.s_isPrefix = True self.change_program("default",True) self.list_game.SelectItem(self.prefixes_item["default"])
def Run(self, event): game_exec = self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8","replace") game_prefix = playonlinux.getPrefix(game_exec) if(os.path.exists(os.environ["POL_USER_ROOT"]+"/wineprefix/"+game_prefix)): if(game_exec != ""): if(playonlinux.GetDebugState(game_exec)): try: self.debugFrame.analyseReal(0, game_prefix) self.debugFrame.Show() self.debugFrame.SetFocus() except: self.debugFrame = debug.MainWindow(None, -1, _("{0} debugger").format(os.environ["APPLICATION_TITLE"]),game_prefix,0) self.debugFrame.Center(wx.BOTH) self.debugFrame.Show() os.system("bash "+Variables.playonlinux_env+"/bash/run_app \""+game_exec+"\"&") else: wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"])
def ChangeTitle(self, new_title): self.s_title = new_title self.s_prefix = playonlinux.getPrefix(self.s_title) self.changing_selection = True self.general_elements["name"].SetValue(new_title) self.changing = True
def list_software(self): self.games = os.listdir(Variables.playonlinux_rep+"shortcuts/") self.games.sort() self.prefixes = os.listdir(Variables.playonlinux_rep+"wineprefix/") self.prefixes.sort() self.games_item = {} self.prefixes_item = {} try: self.games.remove(".DS_Store") except: pass try: self.prefixes.remove(".DS_Store") except: pass self.list_game.DeleteAllItems() self.images.RemoveAll() root = self.list_game.AddRoot("#ROOT#") self.i = 0 for prefix in self.prefixes: if(os.path.isdir(Variables.playonlinux_rep+"wineprefix/"+prefix)): self.prefixes_item[prefix] = self.list_game.AppendItem(root, prefix, self.i) if(os.path.exists(Variables.playonlinux_rep+"/wineprefix/"+prefix+"/icon")): self.file_icone = Variables.playonlinux_rep+"/wineprefix/"+prefix+"/icon" else: try: archdd = playonlinux.GetSettings('ARCH',prefix) if(archdd == "amd64"): archdd = "64" else: archdd = "32" except: archdd = "32" self.file_icone = Variables.playonlinux_env+"/resources/images/menu/virtual_drive_"+archdd+".png" try: self.bitmap = wx.Image(self.file_icone) self.bitmap.Rescale(16,16,wx.IMAGE_QUALITY_HIGH) self.bitmap = self.bitmap.ConvertToBitmap() self.images.Add(self.bitmap) except: pass self.list_game.SetItemBold(self.prefixes_item[prefix], True) for game in self.games: #METTRE EN 32x32 if(playonlinux.getPrefix(game).lower() == prefix.lower()): if(os.path.exists(Variables.playonlinux_rep+"/icones/32/"+game)): self.file_icone = Variables.playonlinux_rep+"/icones/32/"+game else: self.file_icone = Variables.playonlinux_env+"/etc/playonlinux32.png" try: self.bitmap = wx.Image(self.file_icone) self.bitmap.Rescale(16,16,wx.IMAGE_QUALITY_HIGH) self.bitmap = self.bitmap.ConvertToBitmap() self.images.Add(self.bitmap) except: pass self.i += 1 self.games_item[game] = self.list_game.AppendItem(self.prefixes_item[prefix], game, self.i) self.i += 1 self.list_game.ExpandAll() try: if(self.onglets.s_isPrefix == True): self.list_game.SelectItem(self.prefixes_item[self.onglets.s_prefix.encode("utf-8","replace")]) else: self.list_game.SelectItem(self.games_item[self.onglets.s_title.encode("utf-8","replace")]) except: self.onglets.s_isPrefix = True self.change_program("default",True) self.list_game.SelectItem(self.prefixes_item["default"])
def UpdateValues(self, selection): #print "Test" if(self.s_isPrefix == False): self.ChangeTitle(selection) #self.general_elements["wineversion"].SetValue(wine_versions.GetWineVersion(selection)) #self.general_elements["wineversion"].Show() self.general_elements["wineprefix"].Show() self.general_elements["arguments"].Show() self.general_elements["arguments_text"].Show() #self.general_elements["name"].Show() #self.general_elements["wineversion_text"].Show() self.general_elements["wineprefix_text"].Show() self.general_elements["name"].SetEditable(True) #self.general_elements["name_text"].Show() self.general_elements["wineprefix"].SetValue(playonlinux.getPrefix(self.s_title)) self.general_elements["arguments"].SetValue(playonlinux.getArgs(self.s_title)) self.display_elements["folder_button"].SetLabel(_("Open program's directory")) if(os.path.exists(Variables.playonlinux_rep+"configurations/configurators/"+self.s_title)): self.configurator_title.Show() self.configurator_button.Show() else: self.configurator_title.Hide() self.configurator_button.Hide() self.configurator_title.SetLabel("{0} specific configuration".format(self.s_title.encode('utf-8','replace'))) self.display_elements["pre_run_panel"].Show() self.display_elements["pre_run_text"].Show() else: self.s_prefix = selection self.s_title = selection #self.general_elements["wineversion"].Hide() self.general_elements["wineprefix"].Hide() #self.general_elements["name"].Hide() self.general_elements["name"].SetEditable(False) self.general_elements["name"].SetValue(self.s_prefix) self.general_elements["arguments"].Hide() self.general_elements["arguments_text"].Hide() #self.general_elements["wineversion_text"].Hide() self.general_elements["wineprefix_text"].Hide() #self.general_elements["name_text"].Hide() self.display_elements["folder_button"].SetLabel(_("Open virtual drive's directory")) self.configurator_title.Hide() self.configurator_button.Hide() self.display_elements["pre_run_panel"].Hide() self.display_elements["pre_run_text"].Hide() self.Refresh() self.elements = ["UseGLSL","DirectDrawRenderer","VideoMemorySize","OffscreenRenderingMode","RenderTargetModeLock","Multisampling","StrictDrawOrdering","MouseWarpOverride"] self.settings = wine.LoadRegValues(self.s_prefix,self.elements) #print self.settings self.get_current_settings("UseGLSL") self.get_current_settings("DirectDrawRenderer") self.get_current_settings("VideoMemorySize") self.get_current_settings("OffscreenRenderingMode") self.get_current_settings("RenderTargetModeLock") self.get_current_settings("Multisampling") self.get_current_settings("StrictDrawOrdering") self.get_current_settings("MouseWarpOverride") self.arch = playonlinux.GetSettings('ARCH',self.s_prefix) if(self.arch == ""): self.arch = "x86" self.UpdateVersions(self.arch) self.general_elements["winedebug"].SetValue(playonlinux.GetSettings("WINEDEBUG", self.s_prefix)) try: self.display_elements["pre_run"].SetValue(open(os.environ["POL_USER_ROOT"]+"/configurations/pre_shortcut/"+self.s_title,'r').read()) except: self.display_elements["pre_run"].SetValue("")
def UpdateValues(self, selection): # print "Test" if (self.s_isPrefix == False): self.ChangeTitle(selection) # self.general_elements["wineversion"].SetValue(wine_versions.GetWineVersion(selection)) # self.general_elements["wineversion"].Show() self.general_elements["wineprefix"].Show() self.general_elements["arguments"].Show() self.general_elements["arguments_text"].Show() # self.general_elements["name"].Show() # self.general_elements["wineversion_text"].Show() self.general_elements["wineprefix_text"].Show() self.general_elements["name"].SetEditable(True) # self.general_elements["name_text"].Show() self.general_elements["wineprefix"].SetValue( playonlinux.getPrefix(self.s_title)) self.general_elements["arguments"].SetValue( playonlinux.getArgs(self.s_title)) self.display_elements["folder_button"].SetLabel( _("Open program's directory")) if not playonlinux.GetSettings("OPEN_IN", self.s_prefix): self.display_elements["open_in"].SetValue("xdg-open") else: self.display_elements["open_in"].SetValue( playonlinux.GetSettings("OPEN_IN", self.s_prefix)) if (os.path.exists(Variables.playonlinux_rep + "configurations/configurators/" + self.s_title)): self.configurator_title.Show() self.configurator_button.Show() else: self.configurator_title.Hide() self.configurator_button.Hide() self.configurator_title.SetLabel( "{0} specific configuration".format(self.s_title)) self.display_elements["pre_run_panel"].Show() self.display_elements["pre_run_text"].Show() else: self.s_prefix = selection self.s_title = selection # self.general_elements["wineversion"].Hide() self.general_elements["wineprefix"].Hide() # self.general_elements["name"].Hide() self.general_elements["name"].SetEditable(False) self.general_elements["name"].SetValue(self.s_prefix) self.general_elements["arguments"].Hide() self.general_elements["arguments_text"].Hide() # self.general_elements["wineversion_text"].Hide() self.general_elements["wineprefix_text"].Hide() # self.general_elements["name_text"].Hide() self.display_elements["folder_button"].SetLabel( _("Open virtual drive's directory")) self.configurator_title.Hide() self.configurator_button.Hide() self.display_elements["pre_run_panel"].Hide() self.display_elements["pre_run_text"].Hide() self.Refresh() self.elements = [ "UseGLSL", "DirectDrawRenderer", "VideoMemorySize", "OffscreenRenderingMode", "RenderTargetModeLock", "Multisampling", "StrictDrawOrdering", "MouseWarpOverride" ] self.settings = wine.LoadRegValues(self.s_prefix, self.elements) # print self.settings self.get_current_settings("UseGLSL") self.get_current_settings("DirectDrawRenderer") self.get_current_settings("VideoMemorySize") self.get_current_settings("OffscreenRenderingMode") self.get_current_settings("RenderTargetModeLock") self.get_current_settings("Multisampling") self.get_current_settings("StrictDrawOrdering") self.get_current_settings("MouseWarpOverride") self.arch = playonlinux.GetSettings('ARCH', self.s_prefix) if (self.arch == ""): self.arch = "x86" self.UpdateVersions(self.arch) self.general_elements["winedebug"].SetValue( playonlinux.GetSettings("WINEDEBUG", self.s_prefix)) try: self.display_elements["pre_run"].SetValue( open( os.environ["POL_USER_ROOT"] + "/configurations/pre_shortcut/" + self.s_title, 'r').read()) except: self.display_elements["pre_run"].SetValue("")
def UpdateValues(self, selection): #print "Test" if(self.s_isPrefix == False): self.ChangeTitle(selection) #self.general_elements["wineversion"].SetValue(wine_versions.GetWineVersion(selection)) #self.general_elements["wineversion"].Show() self.general_elements["wineprefix"].Show() self.general_elements["arguments"].Show() self.general_elements["arguments_text"].Show() #self.general_elements["name"].Show() #self.general_elements["wineversion_text"].Show() self.general_elements["wineprefix_text"].Show() self.general_elements["debug_text"].Show() self.general_elements["debug_check"].Show() self.general_elements["name"].SetEditable(True) #self.general_elements["name_text"].Show() self.general_elements["wineprefix"].SetValue(playonlinux.getPrefix(self.s_title)) self.general_elements["arguments"].SetValue(playonlinux.getArgs(self.s_title)) self.display_elements["folder_button"].SetLabel(_("Open program's directory")) self.general_elements["debug_check"].SetValue(playonlinux.GetDebugState(self.s_title)) if(os.path.exists(Variables.playonlinux_rep+"configurations/configurators/"+self.s_title)): self.configurator_title.Show() self.configurator_button.Show() else: self.configurator_title.Hide() self.configurator_button.Hide() self.configurator_title.SetLabel(self.s_title+" specific configuration") else: self.s_prefix = selection self.s_title = selection #self.general_elements["wineversion"].Hide() self.general_elements["wineprefix"].Hide() #self.general_elements["name"].Hide() self.general_elements["name"].SetEditable(False) self.general_elements["name"].SetValue(self.s_prefix) self.general_elements["arguments"].Hide() self.general_elements["arguments_text"].Hide() #self.general_elements["wineversion_text"].Hide() self.general_elements["wineprefix_text"].Hide() self.general_elements["debug_text"].Hide() self.general_elements["debug_check"].Hide() #self.general_elements["name_text"].Hide() self.display_elements["folder_button"].SetLabel(_("Open virtual drive's directory")) self.configurator_title.Hide() self.configurator_button.Hide() self.Refresh() self.elements = ["UseGLSL","DirectDrawRenderer","VideoMemorySize","OffscreenRenderingMode","RenderTargetModeLock","Multisampling","StrictDrawOrdering","MouseWarpOverride"] self.settings = wine.LoadRegValues(self.s_prefix,self.elements) #print self.settings self.get_current_settings("UseGLSL") self.get_current_settings("DirectDrawRenderer") self.get_current_settings("VideoMemorySize") self.get_current_settings("OffscreenRenderingMode") self.get_current_settings("RenderTargetModeLock") self.get_current_settings("Multisampling") self.get_current_settings("StrictDrawOrdering") self.get_current_settings("MouseWarpOverride") self.arch = playonlinux.GetSettings('ARCH',self.s_prefix) if(self.arch == ""): self.arch = "x86" self.UpdateVersions(self.arch)
def UpdateValues(self, selection): #print "Test" if (self.s_isPrefix == False): self.ChangeTitle(selection) #self.general_elements["wineversion"].SetValue(wine_versions.GetWineVersion(selection)) #self.general_elements["wineversion"].Show() self.general_elements["wineprefix"].Show() self.general_elements["arguments"].Show() self.general_elements["arguments_text"].Show() #self.general_elements["name"].Show() #self.general_elements["wineversion_text"].Show() self.general_elements["wineprefix_text"].Show() self.general_elements["debug_text"].Show() self.general_elements["debug_check"].Show() self.general_elements["name"].SetEditable(True) #self.general_elements["name_text"].Show() self.general_elements["wineprefix"].SetValue( playonlinux.getPrefix(self.s_title)) self.general_elements["arguments"].SetValue( playonlinux.getArgs(self.s_title)) self.display_elements["folder_button"].SetLabel( _("Open program's directory")) self.general_elements["debug_check"].SetValue( playonlinux.GetDebugState(self.s_title)) if (os.path.exists(Variables.playonlinux_rep + "configurations/configurators/" + self.s_title)): self.configurator_title.Show() self.configurator_button.Show() else: self.configurator_title.Hide() self.configurator_button.Hide() self.configurator_title.SetLabel(self.s_title + " specific configuration") else: self.s_prefix = selection self.s_title = selection #self.general_elements["wineversion"].Hide() self.general_elements["wineprefix"].Hide() #self.general_elements["name"].Hide() self.general_elements["name"].SetEditable(False) self.general_elements["name"].SetValue(self.s_prefix) self.general_elements["arguments"].Hide() self.general_elements["arguments_text"].Hide() #self.general_elements["wineversion_text"].Hide() self.general_elements["wineprefix_text"].Hide() self.general_elements["debug_text"].Hide() self.general_elements["debug_check"].Hide() #self.general_elements["name_text"].Hide() self.display_elements["folder_button"].SetLabel( _("Open virtual drive's directory")) self.configurator_title.Hide() self.configurator_button.Hide() self.Refresh() self.elements = [ "UseGLSL", "DirectDrawRenderer", "VideoMemorySize", "OffscreenRenderingMode", "RenderTargetModeLock", "Multisampling", "StrictDrawOrdering", "MouseWarpOverride" ] self.settings = wine.LoadRegValues(self.s_prefix, self.elements) #print self.settings self.get_current_settings("UseGLSL") self.get_current_settings("DirectDrawRenderer") self.get_current_settings("VideoMemorySize") self.get_current_settings("OffscreenRenderingMode") self.get_current_settings("RenderTargetModeLock") self.get_current_settings("Multisampling") self.get_current_settings("StrictDrawOrdering") self.get_current_settings("MouseWarpOverride") self.arch = playonlinux.GetSettings('ARCH', self.s_prefix) if (self.arch == ""): self.arch = "x86" self.UpdateVersions(self.arch)