From 749566ad3f77cd9782dcb68b26b5f1d3246e1484 Mon Sep 17 00:00:00 2001 From: Tamas Kornman Date: Fri, 11 Jul 2014 23:53:51 +0200 Subject: [PATCH 01/18] Made a more sophisticated game list. It has a root node titled Your games and all games prefixed with Name - will be grouped under a tree node with the prefix name. When the root node is clicked the menu is reset. --- python/mainwindow.py | 350 +++++++++++++++++++++++-------------------- 1 file changed, 186 insertions(+), 164 deletions(-) diff --git a/python/mainwindow.py b/python/mainwindow.py index 58147dfe2..5fe80faa9 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -35,7 +35,13 @@ import lib.lng as lng import lib.playonlinux as playonlinux, lib.Variables as Variables import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading, debug, gui_server +import irc as ircgui +import re + +const_foreground_colour = wx.Colour(255,255,255) +const_foreground_hover_colour = wx.Colour(128,128,128) + # This thread manage updates class POLWeb(threading.Thread): def __init__(self): @@ -219,9 +225,14 @@ def __init__(self,parent,id,title): ## List game - self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT) - self.list_game.SetSpacing(0); - self.list_game.SetIndent(5); + header_font = wx.Font(32, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) + + self.rootnode = None; + + self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.TR_FULL_ROW_HIGHLIGHT) + self.list_game.SetFont(header_font) + self.list_game.SetSpacing(15); + self.list_game.SetIndent(15); self.list_game.SetImageList(self.images) self.menu_gauche = wx.Panel(self,-1) @@ -294,10 +305,6 @@ def __init__(self,parent,id,title): self.supportmenu.Append(402, _("Documentation")) self.supportmenu.Append(403, _("Forums")) self.supportmenu.Append(404, _("Bugs")) - self.supportmenu.AppendSeparator() - self.supportmenu.Append(405, _("Twitter")) - self.supportmenu.Append(406, _("Google+")) - self.supportmenu.Append(407, _("Facebook")) self.help_menu = wx.Menu() @@ -330,15 +337,11 @@ def __init__(self,parent,id,title): if(self.j > 0): self.pluginsmenu.AppendSeparator() - - - self.option_item_p = wx.MenuItem(self.pluginsmenu, 214, _("Plugin manager")) self.option_item_p.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png")) self.pluginsmenu.AppendItem(self.option_item_p) - self.last_string = "" self.sb = wx.StatusBar(self, -1 ) @@ -477,6 +480,19 @@ def __init__(self,parent,id,title): self.Bind(wx.EVT_SIZE, self.ResizeWindow) self._mgr.restorePosition() + + def tree_item(self, tree, match, root): + item, cookie = tree.GetFirstChild(root) + + while item.IsOk(): + if tree.GetItemText(item) == match: + return item + if tree.ItemHasChildren(item): + if self.tree_item(tree, match, item): + return item + item, cookie = tree.GetNextChild(root, cookie) + return None + def ResizeWindow(self, e): self.UpdateGaugePos() self.UpdateSearchHackSize() @@ -513,8 +529,7 @@ def SetupWindowAction(self, event): if(self.SetupWindowTimer_action != None): return gui_server.readAction(self) - - + def TimerAction(self, event): self.StatusRead() @@ -607,7 +622,6 @@ def RMBInGameList(self, event): self.PopupMenu(self.GameListPopUpMenu, event.GetPoint()) - def RWineConfigurator(self, event): self.RConfigure(_("Configure Wine"), "nothing") @@ -646,25 +660,6 @@ def runSupport(self, event): if(urlId == 4): url = urlPrefix+"/bugs.html" - if(urlId == 5): - if(os.environ["POL_OS"] == "Mac"): - url = "https://twitter.com/PlayOnMac" - else: - url = "https://twitter.com/PlayOnLinux" - - if(urlId == 6): - if(os.environ["POL_OS"] == "Mac"): - url = "http://plus.google.com/u/0/105992880311102680198" - else: - url = "https://plus.google.com/+playonlinux" - - if(urlId == 7): - if(os.environ["POL_OS"] == "Mac"): - url = "https://www.facebook.com/playonmac" - else: - url = "https://www.facebook.com/playonlinux" - - playonlinux.POL_Open(url) def iconDisplay(self, event): @@ -697,7 +692,6 @@ def UpdateInstructions(self, event): def UpdateGIT(self, event): subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/update_git"]) - def GoToAppDir(self, event): self.game_exec = self.GetSelectedProgram() playonlinux.open_folder(self.game_exec) @@ -722,18 +716,24 @@ def ChangeIcon(self, event): def Select(self, event): game_exec = self.GetSelectedProgram() - self.read = open(Variables.playonlinux_rep+"shortcuts/"+game_exec,"r").readlines() - self.i = 0; - self.wine_present = False; - while(self.i < len(self.read)): - if("wine " in self.read[self.i]): - self.wine_present = True; - self.i += 1 - - self.generate_menu(game_exec) - self.playTool.Enable(True) - self.stopTool.Enable(True) - self.removeTool.Enable(True) + if (game_exec != ""): + self.read = open(Variables.playonlinux_rep+"shortcuts/"+game_exec,"r").readlines() + self.i = 0; + self.wine_present = False; + while(self.i < len(self.read)): + if("wine " in self.read[self.i]): + self.wine_present = True; + self.i += 1 + + self.generate_menu(game_exec) + self.playTool.Enable(True) + self.stopTool.Enable(True) + self.removeTool.Enable(True) + else: + self.generate_menu("") + self.playTool.Enable(False) + self.stopTool.Enable(False) + self.removeTool.Enable(False) def generate_menu(self, shortcut=None): for c in self.menuElem: @@ -748,84 +748,78 @@ def generate_menu(self, shortcut=None): self.menuElem = {} self.menuImage = {} - - i = 0; - self.menuGaucheAddTitle("pol_title", os.environ["APPLICATION_TITLE"], i) - i+=1 - self.menuGaucheAddLink("pol_prgm_install", _("Install a program"), i,Variables.playonlinux_env+"/resources/images/menu/add.png",self.InstallMenu) - i+=1 - self.menuGaucheAddLink("pol_prgm_settings", _("Settings"), i,Variables.playonlinux_env+"/resources/images/menu/settings.png",self.Options) - - - if(os.path.exists(os.environ["PLAYONLINUX"]+"/.git/")): - i+=1 - self.menuGaucheAddLink("pol_git", _("Update GIT"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateGIT) - elif "POL_UPTODATE" in os.environ and os.environ["POL_UPTODATE"] == "FALSE": - i+=1 - self.menuGaucheAddLink("pol_update", _("Update instructions"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateInstructions) - - if(shortcut != None): - i+=2 - self.menuGaucheAddTitle("prgm_title", shortcut, i) - i+=1 - self.menuGaucheAddLink("pol_prgm_run", _("Run"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-start.png",self.Run) - i+=1 - self.menuGaucheAddLink("pol_prgm_kill", _("Close"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-stop.png",self.RKill) - i+=1 - self.menuGaucheAddLink("pol_prgm_rundebug", _("Debug"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.RunDebug) - - game_exec = self.GetSelectedProgram() - game_log = playonlinux.getLog(game_exec) - if(game_log): - i+=1 - self.menuGaucheAddLink("pol_prgm_reportproblem", _("Send a feedback"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.sendfeedback) - - i+=1 - self.menuGaucheAddLink("pol_prgm_configure", _("Configure"), i,Variables.playonlinux_env+"/resources/images/menu/run.png",self.Configure) - i+=1 - self.menuGaucheAddLink("pol_prgm_shortcut", _("Create a shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.Package) - i+=1 - self.menuGaucheAddLink("pol_prgm_adddir", _("Open the directory"), i,Variables.playonlinux_env+"/resources/images/menu/folder-wine.png",self.GoToAppDir) - - if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+shortcut)): - i+=1 - self.menuGaucheAddLink("pol_prgm_readme", _("Read the manual"), i,Variables.playonlinux_env+"/resources/images/menu/manual.png",self.ReadMe) - - i+=1 - self.menuGaucheAddLink("pol_prgm_uninstall", _("Uninstall"), i,Variables.playonlinux_env+"/resources/images/menu/window-close.png",self.UninstallGame) - - - self.linksfile = os.environ["POL_USER_ROOT"]+"/configurations/links/"+shortcut - if(os.path.exists(self.linksfile)): - self.linksc = open(self.linksfile,"r").read().split("\n") - for line in self.linksc: - if("|" in line): - line = line.split("|") - i+=1 - if("PROFILEBUTTON/" in line[0]): - line[0] = line[0].replace("PROFILEBUTTON/","") - - self.menuGaucheAddLink("url_"+str(i), line[0], i,Variables.playonlinux_env+"/resources/images/menu/star.png",None,line[1]) - - icon = os.environ["POL_USER_ROOT"]+"/icones/full_size/"+shortcut - - - if(os.path.exists(icon)): - try: - self.bitmap = wx.Image(icon) - if(self.bitmap.GetWidth() >= 48): - self.bitmap.Rescale(48,48,wx.IMAGE_QUALITY_HIGH) - self.bitmap = self.bitmap.ConvertToBitmap() - self.menuBitmap = wx.StaticBitmap(self.menu_gauche, id=-1, bitmap=self.bitmap, pos=(left_pos,20+(i+2)*20)) - except: - pass + + i = 0; + self.menuGaucheAddTitle("pol_title", os.environ["APPLICATION_TITLE"], i) + i+=1 + self.menuGaucheAddLink("pol_prgm_install", _("Install a program"), i,Variables.playonlinux_env+"/resources/images/menu/add.png",self.InstallMenu) + i+=1 + self.menuGaucheAddLink("pol_prgm_settings", _("Settings"), i,Variables.playonlinux_env+"/resources/images/menu/settings.png",self.Options) + + if (shortcut != None and shortcut != ""): + if(os.path.exists(os.environ["PLAYONLINUX"]+"/.git/")): + i+=1 + self.menuGaucheAddLink("pol_git", _("Update GIT"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateGIT) + elif "POL_UPTODATE" in os.environ and os.environ["POL_UPTODATE"] == "FALSE": + i+=1 + self.menuGaucheAddLink("pol_update", _("Update instructions"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateInstructions) + + if(shortcut != None): + i+=2 + self.menuGaucheAddTitle("prgm_title", shortcut, i) + i+=1 + self.menuGaucheAddLink("pol_prgm_run", _("Run"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-start.png",self.Run) + i+=1 + self.menuGaucheAddLink("pol_prgm_kill", _("Close"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-stop.png",self.RKill) + i+=1 + self.menuGaucheAddLink("pol_prgm_rundebug", _("Debug"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.RunDebug) + i+=1 + self.menuGaucheAddLink("pol_prgm_reportproblem", _("Report a problem"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.ReportProblem) + i+=1 + self.menuGaucheAddLink("pol_prgm_configure", _("Configure"), i,Variables.playonlinux_env+"/resources/images/menu/run.png",self.Configure) + i+=1 + self.menuGaucheAddLink("pol_prgm_shortcut", _("Create a shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.Package) + i+=1 + self.menuGaucheAddLink("pol_prgm_adddir", _("Open the directory"), i,Variables.playonlinux_env+"/resources/images/menu/folder-wine.png",self.GoToAppDir) + + if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+shortcut)): + i+=1 + self.menuGaucheAddLink("pol_prgm_readme", _("Read the manual"), i,Variables.playonlinux_env+"/resources/images/menu/manual.png",self.ReadMe) + + i+=1 + self.menuGaucheAddLink("pol_prgm_uninstall", _("Uninstall"), i,Variables.playonlinux_env+"/resources/images/menu/window-close.png",self.UninstallGame) + + + self.linksfile = os.environ["POL_USER_ROOT"]+"/configurations/links/"+shortcut + if(os.path.exists(self.linksfile)): + self.linksc = open(self.linksfile,"r").read().split("\n") + for line in self.linksc: + if("|" in line): + line = line.split("|") + i+=1 + if("PROFILEBUTTON/" in line[0]): + line[0] = line[0].replace("PROFILEBUTTON/","") + + self.menuGaucheAddLink("url_"+str(i), line[0], i,Variables.playonlinux_env+"/resources/images/menu/star.png",None,line[1]) + + icon = os.environ["POL_USER_ROOT"]+"/icones/full_size/"+shortcut + + + if(os.path.exists(icon)): + try: + self.bitmap = wx.Image(icon) + if(self.bitmap.GetWidth() >= 48): + self.bitmap.Rescale(48,48,wx.IMAGE_QUALITY_HIGH) + self.bitmap = self.bitmap.ConvertToBitmap() + self.menuBitmap = wx.StaticBitmap(self.menu_gauche, id=-1, bitmap=self.bitmap, pos=(left_pos,20+(i+2)*20)) + except: + pass def menuGaucheAddTitle(self,id,text,pos): self.menuElem[id] = wx.StaticText(self.menu_gauche, -1, text,pos=(5,5+pos*20)) - self.menuElem[id].SetForegroundColour((0,0,0)) # For dark themes + self.menuElem[id].SetForegroundColour(const_foreground_colour) # For dark themes self.menuElem[id].SetFont(self.fontTitre) - def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): if(os.path.exists(image)): menu_icone = image @@ -846,9 +840,9 @@ def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): else: self.menuElem[id] = wx.HyperlinkCtrl(self.menu_gauche, 10000+pos, text, url, pos=(35,15+pos*20)) - self.menuElem[id].SetNormalColour(wx.Colour(0,0,0)) - self.menuElem[id].SetVisitedColour(wx.Colour(0,0,0)) - self.menuElem[id].SetHoverColour(wx.Colour(100,100,100)) + self.menuElem[id].SetNormalColour(const_foreground_colour) + self.menuElem[id].SetVisitedColour(const_foreground_colour) + self.menuElem[id].SetHoverColour(const_foreground_hover_colour) if(evt != None): wx.EVT_HYPERLINK(self, 10000+pos, evt) @@ -870,7 +864,8 @@ def Reload(self, event): self.list_game.DeleteAllItems() self.images.RemoveAll() - root = self.list_game.AddRoot("") + self.rootnode = self.list_game.AddRoot("Your games") + self.i = 0 if(self.iconSize <= 32): self.iconFolder = "32"; @@ -892,8 +887,25 @@ def Reload(self, event): except: pass - item = self.list_game.AppendItem(root, game, self.i) + prefix = re.search('^[a-z A-Z 0-9]*[ ]{1}[-]{1}[ ]{1}', game) + + matchingitem = None + + if ((prefix is not None) and (prefix.group() is not None)): + prefix = prefix.group()[:-3] + matchingitem = self.tree_item(self.list_game, prefix, self.rootnode) + + if (matchingitem != None): + itemid = self.list_game.AppendItem(matchingitem, game, self.i) + else: + itemid = self.list_game.AppendItem(self.rootnode, game, self.i) + + self.list_game.SetItemFont(itemid, wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT)) + self.i += 1 + + self.list_game.Expand(self.rootnode); + self.generate_menu(None) if(os.environ["POL_OS"] == "Mac"): @@ -939,7 +951,6 @@ def BugReport(self, event): self.debugFrame.Center(wx.BOTH) self.debugFrame.Show() - def POLOnline(self, event): subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/playonlinux_online"]) @@ -952,27 +963,31 @@ def PolShell(self, event): def Configure(self, event): game_exec = self.GetSelectedProgram() - try: - self.configureFrame.Show(True) - self.configureFrame.SetFocus() - if(game_exec != ""): - self.configureFrame.change_program(game_exec,False) + + if (game_exec != ""): + try: + self.configureFrame.Show(True) + self.configureFrame.SetFocus() + if(game_exec != ""): + self.configureFrame.change_program(game_exec,False) - except: - if(game_exec == ""): - self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),"default",True) - else: - self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),game_exec.decode("utf-8","replace"),False) + except: + if(game_exec == ""): + self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),"default",True) + else: + self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),game_exec.decode("utf-8","replace"),False) - self.configureFrame.Center(wx.BOTH) - self.configureFrame.Show(True) + self.configureFrame.Center(wx.BOTH) + self.configureFrame.Show(True) #subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/polconfigurator", game_exec]) def Package(self, event): game_exec = self.GetSelectedProgram() - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/make_shortcut", game_exec]) + + if (game_exec != ""): + subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/make_shortcut", game_exec]) def UninstallGame(self, event): game_exec = self.GetSelectedProgram() @@ -1007,33 +1022,38 @@ def WineVersion(self, event): self.wversion.Show(True) def GetSelectedProgram(self): - return self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8","replace") + if (self.list_game.GetSelection() != self.rootnode): + return self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8","replace") + else: + return "" def Run(self, event, s_debug=False): game_exec = self.GetSelectedProgram() - game_prefix = playonlinux.getPrefix(game_exec) - - if(s_debug == False): - playonlinux.SetDebugState(game_exec, game_prefix, False) - - 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() - - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/run_app", game_exec]) - else: - wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) - else: - wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"]) + + if (game_exec != ""): + game_prefix = playonlinux.getPrefix(game_exec) + + if(s_debug == False): + playonlinux.SetDebugState(game_exec, game_prefix, False) + + 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() + + subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/run_app", game_exec]) + else: + wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) + else: + wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"]) def RunDebug(self, event): game_exec = self.GetSelectedProgram() @@ -1041,11 +1061,13 @@ def RunDebug(self, event): playonlinux.SetDebugState(game_exec, game_prefix, True) self.Run(self, True) - def sendfeedback(self, event): + def ReportProblem(self, event): game_exec = self.GetSelectedProgram() - game_log = str(playonlinux.getLog(game_exec)) + game_log = playonlinux.getLog(game_exec) if game_log: - playonlinux.POL_Open("http://www."+os.environ["POL_DNS"]+"/repository/feedback.php?script="+urllib.quote_plus(game_log)) + new_env = os.environ + new_env["LOGTITLE"] = game_log + subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/bug_report"], env = new_env) def POLDie(self): for pid in self.registeredPid: From a75e65356a1d838f76f8c1516e5e7e27896a036e Mon Sep 17 00:00:00 2001 From: TFK Date: Sat, 12 Jul 2014 23:12:56 +0200 Subject: [PATCH 02/18] Small change. System colours are now used instead of RGB values for the links in the side menu. This ensures that systems using different theme colours display the correct colours. --- python/mainwindow.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python/mainwindow.py b/python/mainwindow.py index 5fe80faa9..21ab127ce 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -39,9 +39,6 @@ import re -const_foreground_colour = wx.Colour(255,255,255) -const_foreground_hover_colour = wx.Colour(128,128,128) - # This thread manage updates class POLWeb(threading.Thread): def __init__(self): @@ -162,6 +159,8 @@ def Destroy(self): class MainWindow(wx.Frame): def __init__(self,parent,id,title): + self.foreground_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) + self.foreground_hover_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DHILIGHT ) wx.Frame.__init__(self, parent, 1000, title, size = (515,450)) self.SetMinSize((400,400)) @@ -817,7 +816,7 @@ def generate_menu(self, shortcut=None): def menuGaucheAddTitle(self,id,text,pos): self.menuElem[id] = wx.StaticText(self.menu_gauche, -1, text,pos=(5,5+pos*20)) - self.menuElem[id].SetForegroundColour(const_foreground_colour) # For dark themes + self.menuElem[id].SetForegroundColour(self.foreground_colour) # For dark themes self.menuElem[id].SetFont(self.fontTitre) def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): @@ -840,9 +839,9 @@ def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): else: self.menuElem[id] = wx.HyperlinkCtrl(self.menu_gauche, 10000+pos, text, url, pos=(35,15+pos*20)) - self.menuElem[id].SetNormalColour(const_foreground_colour) - self.menuElem[id].SetVisitedColour(const_foreground_colour) - self.menuElem[id].SetHoverColour(const_foreground_hover_colour) + self.menuElem[id].SetNormalColour(self.foreground_colour) + self.menuElem[id].SetVisitedColour(self.foreground_colour) + self.menuElem[id].SetHoverColour(self.foreground_hover_colour) if(evt != None): wx.EVT_HYPERLINK(self, 10000+pos, evt) From 34cb20d34cdca1042331d46f949cc9fd953cc53d Mon Sep 17 00:00:00 2001 From: TFK Date: Sun, 13 Jul 2014 00:16:54 +0200 Subject: [PATCH 03/18] Another small change. Changed the install widget. It now uses system colours and the test-applications are now decorated with a blue based background colour. This is more readable and has no links with error states. --- python/install.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/python/install.py b/python/install.py index 496314109..3f031242a 100755 --- a/python/install.py +++ b/python/install.py @@ -175,14 +175,19 @@ def addCat(self, name, icon, iid): wx.EVT_BUTTON(self, 2000+iid, self.AddApps) #self.cats_icons[name].Bind(wx.EVT_LEFT_DOWN, 2000+iid, self.AddApps) - self.cats_links[name].SetNormalColour(wx.Colour(0,0,0)) - self.cats_links[name].SetVisitedColour(wx.Colour(0,0,0)) - self.cats_links[name].SetHoverColour(wx.Colour(0,0,0)) - self.cats_links[name].SetBackgroundColour((255,255,255)) + self.cats_links[name].SetNormalColour(self.foreground_colour) + self.cats_links[name].SetVisitedColour(self.foreground_colour) + self.cats_links[name].SetHoverColour(self.foreground_colour) + self.cats_links[name].SetBackgroundColour(self.background_colour) self.cats_links[name].SetFont(self.fontText) def __init__(self,parent,id,title): + self.foreground_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) + self.foreground_hover_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT ) + self.background_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BACKGROUND ) + self.background_test_colour = wx.Colour(90,90,222) + wx.Frame.__init__(self, parent, -1, title, size = (800, 550+Variables.windows_add_size), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.cats_icons = {} self.cats_links = {} @@ -198,7 +203,7 @@ def __init__(self,parent,id,title): # Categories self.panelButton = wx.Panel(self.panelFenp, -1, size=(802,69), pos=(-1,-1),style=Variables.widget_borders) - self.panelButton.SetBackgroundColour((255,255,255)) + self.panelButton.SetBackgroundColour(self.background_colour) if(os.environ["POL_OS"] == "Mac"): self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT) @@ -295,14 +300,14 @@ def __init__(self,parent,id,title): self.install_button.Enable(False) self.new_panel = wx.Panel(self.panelItems, -1, pos=(740-160,113-71), style=Variables.widget_borders, size=self.new_size) - self.new_panel.SetBackgroundColour((255,255,255)) + self.new_panel.SetBackgroundColour(self.background_colour) self.animation = wx.animate.GIFAnimationCtrl(self.new_panel, -1, Variables.playonlinux_env+"/resources/images/install/wait_mini.gif", (90,100)) self.animation.Hide() self.new_panel.Hide() self.ManualInstall = wx.HyperlinkCtrl(self.panelFenp, 111, _("Install a non-listed program"), "", pos=(10,515)) - self.ManualInstall.SetNormalColour(wx.Colour(0,0,0)) + self.ManualInstall.SetNormalColour(self.foreground_colour) # Panel wait self.animation_wait = wx.animate.GIFAnimationCtrl(self.panelWait, -1, Variables.playonlinux_env+"/resources/images/install/wait.gif", ((800-128)/2,(550-128)/2-71)) @@ -550,7 +555,8 @@ def WriteApps(self, array): if testing == 1: # (255,255,214) is web site color for beta, but it's not very visible next to plain white, # and red is the color of danger - self.list_apps.SetItemBackgroundColour(itemId, (255,214,214)) + ##self.list_apps.SetItemBackgroundColour(itemId, (255,214,214)) + self.list_apps.SetItemBackgroundColour(itemId, self.background_test_colour) self.i = self.i+1 def DelApps(self): From 1d1e3551792152b39c1df5b0145aa2787b361755 Mon Sep 17 00:00:00 2001 From: TFK Date: Sun, 13 Jul 2014 00:35:14 +0200 Subject: [PATCH 04/18] Another small change. Changed the Install a non-listed application widget. Also this widget uses system colours. Making it readable on dark themes. --- python/guiv3.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/python/guiv3.py b/python/guiv3.py index a726071a3..f2326d55d 100755 --- a/python/guiv3.py +++ b/python/guiv3.py @@ -54,6 +54,9 @@ def run(self): class POL_SetupFrame(wx.Frame): #fenêtre principale def __init__(self, titre, POL_SetupWindowID, Arg1, Arg2, Arg3): + self.foreground_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) + self.background_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BACKGROUND ) + wx.Frame.__init__(self, None, -1, title = titre, style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX, size = (520, 398+Variables.windows_add_size)) self.bash_pid = POL_SetupWindowID self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) @@ -99,12 +102,12 @@ def make_gui(self): # GUI elements self.panel = wx.Panel(self, -1, pos=(0,0), size=((520, 398+Variables.windows_add_size))) self.header = wx.Panel(self.panel, -1, style=Variables.widget_borders, size=(522,65)) - self.header.SetBackgroundColour((255,255,255)) + self.header.SetBackgroundColour(self.background_colour) self.footer = wx.Panel(self.panel, -1, size=(522,45), pos=(-1,358), style=Variables.widget_borders) # Panels self.MainPanel = wx.Panel(self.panel, -1, pos=(150,0), size=(370,356)) - self.MainPanel.SetBackgroundColour((255,255,255)) + self.MainPanel.SetBackgroundColour(self.background_colour) # Images @@ -115,19 +118,19 @@ def make_gui(self): # Text self.titre_header = wx.StaticText(self.header, -1, _('{0} Wizard').format(os.environ["APPLICATION_TITLE"]),pos=(5,5), size=(340,356),style=wx.ST_NO_AUTORESIZE) self.titre_header.SetFont(self.fontTitre) - self.titre_header.SetForegroundColour((0,0,0)) # For dark themes + self.titre_header.SetForegroundColour(self.foreground_colour) # For dark themes self.texte = wx.StaticText(self.panel, -1, "",pos=(20,80),size=(480,275),style=wx.ST_NO_AUTORESIZE) self.texte_bis = wx.StaticText(self.panel, -1, "",size=(480,30),style=wx.ST_NO_AUTORESIZE) self.titre = wx.StaticText(self.header, -1, "",pos=(20,30), size=(340,356),style=wx.ST_NO_AUTORESIZE) - self.titre.SetForegroundColour((0,0,0)) # For dark themes + self.titre.SetForegroundColour(self.foreground_colour) # For dark themes self.texteP = wx.StaticText(self.MainPanel, -1, "",pos=(5,50)) - self.texteP.SetForegroundColour((0,0,0)) # For dark themes + self.texteP.SetForegroundColour(self.foreground_colour) # For dark themes self.titreP = wx.StaticText(self.MainPanel, -1,"",pos=(5,5), size=(340,356)) self.titreP.SetFont(self.fontTitre) - self.titreP.SetForegroundColour((0,0,0)) # For dark themes + self.titreP.SetForegroundColour(self.foreground_colour) # For dark themes self.txtEstimation = wx.StaticText(self.panel, -1, "",size=(480,30),style=wx.ST_NO_AUTORESIZE) self.register_link = "" @@ -195,7 +198,7 @@ def make_gui(self): self.loginbox = wx.TextCtrl(self.panel, -1, "",size=(250,22),pos=(200,115)) self.passbox = wx.TextCtrl(self.panel, -1, "",size=(250,22),pos=(200,145), style=wx.TE_PASSWORD) self.register = wx.HyperlinkCtrl(self.panel, 303, _("Register"), "", pos=(20,180)) - self.register.SetNormalColour(wx.Colour(0,0,0)) + self.register.SetNormalColour(self.foreground_colour) # Fixed Events wx.EVT_BUTTON(self, wx.ID_YES, self.release_yes) From 2804af565260dadba9995983d6abe7e477ddd723 Mon Sep 17 00:00:00 2001 From: TFK Date: Sun, 13 Jul 2014 22:01:28 +0200 Subject: [PATCH 05/18] Create README.md Some information on the changes in this fork. --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..bb25ba7f1 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +POL-POM-4 +========= + +PlayOnLinux 4 repository + +I've fixed a few glitches I wanted to correct for myself. +I've decided to create a fork of the main project to share my changes in good open source tradition. + +I am keeping track of the changes in the main repository so any release updates are going to be merged into this one. + +The changes so far: + +1. The colours used in the interface are now read from the system. This means that dark themes display the various elements in the widgets in the colour of those themes. This makes sure that all elements are readable under all conditions. + +2. The game list became somewhat long. I noticed that this list is a TreeView control with just one level and a hidden root. I made this TreeView control two-level and added a root with the text "Your games" in a nice big font size. + + +How to enable two levels in the TreeView control +The two level system is an open one. It's not based on wine-prefixes but on naming. This way you decide how you want to have your list defined. To define your list do the following: + +1. Make sure that there is one game in your list which will be the root item. For instance "Steam". +2. Name all games you want to place under this root item as - . For instance "Steam - Crysis" + +The list will automatically rearange. + + +TODO: +1. Some more refining where I run into them. +2. Make the two-level system into a multi-level system. + +TFK From f8972a3677fcf98ba9930e339bd66ff28cd73399 Mon Sep 17 00:00:00 2001 From: TFK Date: Thu, 17 Jul 2014 22:03:32 +0200 Subject: [PATCH 06/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb25ba7f1..30d026de4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ How to enable two levels in the TreeView control The two level system is an open one. It's not based on wine-prefixes but on naming. This way you decide how you want to have your list defined. To define your list do the following: 1. Make sure that there is one game in your list which will be the root item. For instance "Steam". -2. Name all games you want to place under this root item as - . For instance "Steam - Crysis" +2. Name all games you want to place under this root item as [Root-Item-Name] - [Name-Of-Your-Game]. For instance "Steam - Crysis" The list will automatically rearange. From 8be7d1eed4b616dcb8a5529fb53b4ff148e4ebc8 Mon Sep 17 00:00:00 2001 From: TFK Date: Mon, 21 Jul 2014 22:18:55 +0200 Subject: [PATCH 07/18] Forgot the background colour of the new app install wizard - install extra components page. TFKs --- python/guiv3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/guiv3.py b/python/guiv3.py index f2326d55d..f1c59fdb1 100755 --- a/python/guiv3.py +++ b/python/guiv3.py @@ -175,7 +175,7 @@ def make_gui(self): self.PCheckBox = wx.CheckBox(self.panel, 304, _("Show virtual drives"), pos=(20,325)) self.Menu = wx.ListBox(self.panel, 104, pos=(25,105),size=(460,220), style=Variables.widget_borders) self.scrolled_panel = wx.ScrolledWindow(self.panel, -1, pos=(20,100), size=(460,220), style=Variables.widget_borders|wx.HSCROLL|wx.VSCROLL) - self.scrolled_panel.SetBackgroundColour((255,255,255)) + self.scrolled_panel.SetBackgroundColour(self.background_colour) self.texte_panel = wx.StaticText(self.scrolled_panel, -1, "",pos=(5,5)) self.gauge = wx.Gauge(self.panel, -1, 50, size=(375, 20)) From 0ad183a1a0d51d508010e198c9d0d1f5420ce42e Mon Sep 17 00:00:00 2001 From: TFK Date: Mon, 21 Jul 2014 22:35:10 +0200 Subject: [PATCH 08/18] Ditched the irc include. Don't need it. TFKs --- python/mainwindow.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/mainwindow.py b/python/mainwindow.py index 21ab127ce..ec4de8d80 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -35,7 +35,6 @@ import lib.lng as lng import lib.playonlinux as playonlinux, lib.Variables as Variables import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading, debug, gui_server -import irc as ircgui import re From ef0c0c5e7b81938d18d387ac18810ace8842e5bf Mon Sep 17 00:00:00 2001 From: TFK Date: Wed, 23 Jul 2014 00:00:59 +0200 Subject: [PATCH 09/18] Started with the settings dialog page that stores the shelve names. Shelves allow users to create top level Shelves under which games can be grouped together. Interface done. Need an extra button for renaming Shelves. Opening and saving of the config file done. Todo: the coupling with the main game list. TFKs --- python/guiv3.py | 1 + python/install.py | 7 +-- python/lib/playonlinux.py | 69 +++++++++++++----------- python/mainwindow.py | 1 + python/options.py | 107 +++++++++++++++++++++++++++++++++++++- 5 files changed, 149 insertions(+), 36 deletions(-) diff --git a/python/guiv3.py b/python/guiv3.py index f1c59fdb1..19a4b0adc 100755 --- a/python/guiv3.py +++ b/python/guiv3.py @@ -175,6 +175,7 @@ def make_gui(self): self.PCheckBox = wx.CheckBox(self.panel, 304, _("Show virtual drives"), pos=(20,325)) self.Menu = wx.ListBox(self.panel, 104, pos=(25,105),size=(460,220), style=Variables.widget_borders) self.scrolled_panel = wx.ScrolledWindow(self.panel, -1, pos=(20,100), size=(460,220), style=Variables.widget_borders|wx.HSCROLL|wx.VSCROLL) + #self.scrolled_panel.SetBackgroundColour((255,255,255)) self.scrolled_panel.SetBackgroundColour(self.background_colour) self.texte_panel = wx.StaticText(self.scrolled_panel, -1, "",pos=(5,5)) diff --git a/python/install.py b/python/install.py index 386f85ae7..3f031242a 100755 --- a/python/install.py +++ b/python/install.py @@ -439,12 +439,9 @@ def installapp(self, event): self.EasterEgg.Show() self.EasterEgg.Center(wx.BOTH) else: - if(playonlinux.GetSettings("FIRST_INSTALL_DONE_WITH_WINE") == ""): + if(playonlinux.GetSettings("FIRST_INSTALL_DONE") == ""): wx.MessageBox(_("When {0} installs a Windows program: \n\n - Leave the default location\n - Do not tick the checkbox 'Run the program' if asked.").format(os.environ["APPLICATION_TITLE"]),_("Please read this")) - if(os.environ["POL_OS"] == "Linux"): - # Distro packagers: please keep this message on your package. It's a real pain for wine devs - wx.MessageBox(_("{0} is not related to WineHQ.\n\nTo ensure that the results will be comparable from one computer to another and to avoid regressions, we specify a working wine version for each program. This wine version will quickly become out to date, but we won't change the installer until new tests are made and it takes time.\n\nFor those reason, please do NOT send any bug report or ask any support on WineHQ forums if you are using PlayOnLinux.\n\nIf you want to help the project to make some tests in order to avoid using out of date wine versions, do not hesitate to go on our website.\n\nThank you.").format(os.environ["APPLICATION_TITLE"]),_("Please read this")) - playonlinux.SetSettings("FIRST_INSTALL_DONE_WITH_WINE","TRUE") + playonlinux.SetSettings("FIRST_INSTALL_DONE","TRUE") if(os.path.exists(Variables.playonlinux_rep+"/configurations/listes/search")): content = codecs.open(Variables.playonlinux_rep+"/configurations/listes/search", "r", "utf-8").read().split("\n") diff --git a/python/lib/playonlinux.py b/python/lib/playonlinux.py index 3ca1c5c6f..e4783b571 100755 --- a/python/lib/playonlinux.py +++ b/python/lib/playonlinux.py @@ -56,6 +56,8 @@ def GetSettings(setting, prefix='_POL_'): cfile = Variables.playonlinux_rep+"/playonlinux.cfg" elif(prefix == "_EXT_"): cfile = Variables.playonlinux_rep+"/extensions.cfg" + elif(prefix == "_SHV_"): + cfile = Variables.playonlinux_rep+"/shelves.cfg" else: cfile = Variables.playonlinux_rep+"/wineprefix/"+prefix+"/playonlinux.cfg" @@ -84,6 +86,8 @@ def SetSettings(setting, value, prefix='_POL_'): cfile = Variables.playonlinux_rep+"/playonlinux.cfg" elif(prefix == "_EXT_"): cfile = Variables.playonlinux_rep+"/extensions.cfg" + elif(prefix == "_SHV_"): + cfile = Variables.playonlinux_rep+"/shelves.cfg" else: cfile = Variables.playonlinux_rep+"/wineprefix/"+prefix+"/playonlinux.cfg" @@ -92,35 +96,42 @@ def SetSettings(setting, value, prefix='_POL_'): except: pass else: - i = 0 - line = [] - found = False - while(i < len(fichier)): - fichier[i] = fichier[i].replace("\n","") - if(setting+"=" in fichier[i]): - line.append(setting+"="+value) - found = True - else: - line.append(fichier[i]) - i += 1 - if(found == False): - line.append(setting+"="+value) - - try: - fichier_write = open(cfile,"w") - except IOError: - pass - else: - i = 0 - while(i < len(line)): # On ecrit - fichier_write.write(line[i]+"\n") - i+=1 + if(prefix == "_SHV_"): + fichier = open(cfile,"w") + fichier.write(value) + fichier.close() + else: + i = 0 + line = [] + found = False + while(i < len(fichier)): + fichier[i] = fichier[i].replace("\n","") + if(setting+"=" in fichier[i]): + line.append(setting+"="+value) + found = True + else: + line.append(fichier[i]) + i += 1 + if(found == False): + line.append(setting+"="+value) + + try: + fichier_write = open(cfile,"w") + except IOError: + pass + else: + i = 0 + while(i < len(line)): # On ecrit + fichier_write.write(line[i]+"\n") + i+=1 def DeleteSettings(setting, prefix='_POL_'): if(prefix == "_POL_"): cfile = Variables.playonlinux_rep+"/playonlinux.cfg" elif(prefix == "_EXT_"): cfile = Variables.playonlinux_rep+"/extensions.cfg" + elif(prefix == "_SHV_"): + cfile = Variables.playonlinux_rep+"/shelves.cfg" else: cfile = Variables.playonlinux_rep+"/wineprefix/"+prefix+"/playonlinux.cfg" @@ -129,17 +140,17 @@ def DeleteSettings(setting, prefix='_POL_'): line = [] found = False while(i < len(fichier)): - fichier[i] = fichier[i].replace("\n","") - if(setting+"=" not in fichier[i]): - line.append(fichier[i]) - i += 1 + fichier[i] = fichier[i].replace("\n","") + if(setting+"=" not in fichier[i]): + line.append(fichier[i]) + i += 1 fichier_write = open(cfile,"w") i = 0 while(i < len(line)): # On ecrit - fichier_write.write(line[i]+"\n") - i+=1 + fichier_write.write(line[i]+"\n") + i+=1 def getLog(game): diff --git a/python/mainwindow.py b/python/mainwindow.py index ec4de8d80..2f32f482f 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -35,6 +35,7 @@ import lib.lng as lng import lib.playonlinux as playonlinux, lib.Variables as Variables import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading, debug, gui_server +#import irc as ircgui import re diff --git a/python/options.py b/python/options.py index 9fc688b1a..cda3d60bb 100755 --- a/python/options.py +++ b/python/options.py @@ -93,6 +93,7 @@ def __init__(self, parent): self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/application-x-executable.png")); self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png")); self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/extensions.png")); + self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/folder-saved-search.png")); self.SetImageList(self.images_onglets) @@ -291,6 +292,94 @@ def Extensions(self, nom): wx.EVT_BUTTON(self, 502, self.delExt) wx.EVT_BUTTON(self, 503, self.newExt) + def generateShvs(self): + self.list_shv.DeleteAllItems() + + i = 0 + self.shelves = open(os.environ["POL_USER_ROOT"]+"/shelves.cfg").readlines() + self.shelves.sort() + for line in self.shelves: + line = line.replace("\n","") + self.list_shv.InsertStringItem(i, line) + i += 1 + + def doAddShelve(self): + ## add item to the listbox. The apply action handles the saving. + shv_value = self.txt_shv.GetLineText(0) + + if (shv_value != ""): + self.list_shv.InsertStringItem(self.list_shv.GetItemCount (), shv_value) + + self.txt_shv.Clear() + + def addShelve(self, event): + self.doAddShelve() + + def deleteShelve(self, event): + i = 0 + + def doNewShelveEntered(self): + if (self.txt_shv.GetLineText(0) != ""): + self.add_shv.Enable() + else: + self.add_shv.Disable() + + def newShelveEntered(self, event): + self.doNewShelveEntered() + + def enterKeyPressed(self, event): + self.doAddShelve() + + def shelveSelected(self, event): + self.delete_shv.Enable() + + def Shelves(self, nom): + self.panelShelves = wx.Panel(self, -1) + + self.sizerShelves = wx.BoxSizer(wx.VERTICAL) + + self.panelShelvesButtons = wx.Panel(self.panelShelves, -1); + + ##self.app_addshelve_text = wx.StaticText(self.panelShelves, pos=(1,388), label=_("Add new shelve")) + + self.list_shv = wx.ListCtrl(self.panelShelves, 1504, size=(504,350), pos=(1,1), style=wx.LC_REPORT) + self.list_shv.InsertColumn(0, 'Shelve', width=320) + + self.txt_shv = wx.TextCtrl(self.panelShelves, 1505, "", pos=(1,2), size=(400,25), style=wx.TE_PROCESS_ENTER) + + self.sizerShelves.Add(self.list_shv, 0, wx.TOP|wx.ALL, 2) + self.sizerShelves.Add(self.txt_shv, 0, wx.TOP|wx.ALL, 2) + + self.sizerShelves.Add(self.panelShelvesButtons, 1, wx.BOTTOM|wx.ALL, 2) + + self.panelShelves.SetSizer(self.sizerShelves) + self.panelShelves.SetAutoLayout(True) + + self.sizerShelvesButtons = wx.BoxSizer(wx.VERTICAL) + + self.panelShelvesButtons.SetSizer(self.sizerShelvesButtons) + self.panelShelvesButtons.SetAutoLayout(True) + + self.add_shv = wx.Button(self.panelShelvesButtons, 1502, pos=(372,385+2*Variables.windows_add_playonmac), size=(100,25), label=_("Add shelve")) + self.delete_shv = wx.Button(self.panelShelvesButtons, 1503, pos=(372,385+2*Variables.windows_add_playonmac), size=(125,25), label=_("Remove shelve")) + + self.add_shv.Disable() + self.delete_shv.Disable() + + self.sizerShelvesButtons.Add(self.add_shv, 0, wx.TOP|wx.ALL, 2) + self.sizerShelvesButtons.Add(self.delete_shv, 0, wx.TOP|wx.ALL, 2) + + + self.generateShvs(); + + self.AddPage(self.panelShelves, nom, imageId=7) + + wx.EVT_BUTTON(self, 1502, self.addShelve) + wx.EVT_BUTTON(self, 1503, self.deleteShelve) + wx.EVT_LIST_ITEM_SELECTED(self, 1504, self.shelveSelected) + wx.EVT_TEXT(self, 1505, self.newShelveEntered) + wx.EVT_TEXT_ENTER(self, 1505, self.enterKeyPressed) + def setup_plug(self, event): self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection()) self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin @@ -386,6 +475,7 @@ def __init__(self,parent,id,title,onglet): #self.onglets.System(_("System")) self.onglets.Plugins(_("Plugins")) self.onglets.Extensions(_("File associations")) + self.onglets.Shelves(_("Shelves")) try: self.onglets.SetSelection(onglet) @@ -408,6 +498,19 @@ def apply_settings(self, event): playonlinux.SetSettings("PROXY_LOGIN",self.onglets.ProxyLogin.GetValue()) playonlinux.SetSettings("PROXY_PASSWORD",self.onglets.ProxyPass.GetValue()) - - wx.MessageBox(_("You must restart {0} for the changes to take effect.").format(os.environ["APPLICATION_TITLE"]), os.environ["APPLICATION_TITLE"], wx.OK) + wx.MessageBox(_("You must restart {0} for the changes to take effect.").format(os.environ["APPLICATION_TITLE"]), os.environ["APPLICATION_TITLE"], wx.OK) + + ## Let's use the apply button for all settings... + allvalues = "" + count = self.onglets.list_shv.GetItemCount() + for row in range(count): + item = self.onglets.list_shv.GetItem(itemId=row, col=0) + if (allvalues == ""): + allvalues = item.GetText() + else: + allvalues = allvalues + "\n" + item.GetText() + + playonlinux.SetSettings("", allvalues,"_SHV_") + + self.Destroy() From b1276db1cd7050a234911054877f2aa75c2b2aec Mon Sep 17 00:00:00 2001 From: TFK Date: Thu, 24 Jul 2014 00:36:08 +0200 Subject: [PATCH 10/18] Made the toolbar a bit more intelligent. Buttons are disabled when the first item is selected. En vice versa. The colour settings have been moved to the lib/playonlinux.py file and referenced from all widgets. The menu items for the setting pages are now in the same order as the pages themselves and the internet menu item now works. The configuration widget has an extra combobox with the shelves. Todo: save the selected shelve in the games config. Make the list read this setting and arrange itself. TFKs --- python/configure.py | 9 ++++++ python/guiv3.py | 19 +++++------ python/install.py | 21 +++++-------- python/lib/playonlinux.py | 14 +++++++++ python/mainwindow.py | 66 +++++++++++++++++++++++++-------------- python/options.py | 2 +- 6 files changed, 83 insertions(+), 48 deletions(-) diff --git a/python/configure.py b/python/configure.py index 1ae45e15a..27fd7e2e7 100755 --- a/python/configure.py +++ b/python/configure.py @@ -209,6 +209,15 @@ def General(self, nom): self.configurator_title.SetFont(self.fontTitle) self.configurator_button = wx.Button(self.panelGeneral, 106, _("Run configuration wizard"), pos=(15,324)) + self.lnGeneral = wx.StaticLine(self.panelGeneral, wx.ID_ANY, (200, 10), size=wx.DefaultSize, style=wx.LI_HORIZONTAL) + self.lnGeneral.SetSize((self.panelGeneral.GetSize().GetWidth()-20, 1)) + self.lnGeneral.SetForegroundColour(playonlinux.get_foreground_colour()) + + shelves = [] + shelves.append("") + shelves.extend(playonlinux.Get_Shelves()) + + self.AddGeneralElement(_("Shelve"), "shelve", shelves, shelves, 7) wx.EVT_TEXT(self, 202, self.setname) wx.EVT_TEXT(self, 206, self.setargs) diff --git a/python/guiv3.py b/python/guiv3.py index 19a4b0adc..76fd850c8 100755 --- a/python/guiv3.py +++ b/python/guiv3.py @@ -54,9 +54,6 @@ def run(self): class POL_SetupFrame(wx.Frame): #fenêtre principale def __init__(self, titre, POL_SetupWindowID, Arg1, Arg2, Arg3): - self.foreground_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) - self.background_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BACKGROUND ) - wx.Frame.__init__(self, None, -1, title = titre, style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX, size = (520, 398+Variables.windows_add_size)) self.bash_pid = POL_SetupWindowID self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) @@ -102,12 +99,12 @@ def make_gui(self): # GUI elements self.panel = wx.Panel(self, -1, pos=(0,0), size=((520, 398+Variables.windows_add_size))) self.header = wx.Panel(self.panel, -1, style=Variables.widget_borders, size=(522,65)) - self.header.SetBackgroundColour(self.background_colour) + self.header.SetBackgroundColour(playonlinux.get_background_colour()) self.footer = wx.Panel(self.panel, -1, size=(522,45), pos=(-1,358), style=Variables.widget_borders) # Panels self.MainPanel = wx.Panel(self.panel, -1, pos=(150,0), size=(370,356)) - self.MainPanel.SetBackgroundColour(self.background_colour) + self.MainPanel.SetBackgroundColour(playonlinux.get_background_colour()) # Images @@ -118,19 +115,19 @@ def make_gui(self): # Text self.titre_header = wx.StaticText(self.header, -1, _('{0} Wizard').format(os.environ["APPLICATION_TITLE"]),pos=(5,5), size=(340,356),style=wx.ST_NO_AUTORESIZE) self.titre_header.SetFont(self.fontTitre) - self.titre_header.SetForegroundColour(self.foreground_colour) # For dark themes + self.titre_header.SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.texte = wx.StaticText(self.panel, -1, "",pos=(20,80),size=(480,275),style=wx.ST_NO_AUTORESIZE) self.texte_bis = wx.StaticText(self.panel, -1, "",size=(480,30),style=wx.ST_NO_AUTORESIZE) self.titre = wx.StaticText(self.header, -1, "",pos=(20,30), size=(340,356),style=wx.ST_NO_AUTORESIZE) - self.titre.SetForegroundColour(self.foreground_colour) # For dark themes + self.titre.SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.texteP = wx.StaticText(self.MainPanel, -1, "",pos=(5,50)) - self.texteP.SetForegroundColour(self.foreground_colour) # For dark themes + self.texteP.SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.titreP = wx.StaticText(self.MainPanel, -1,"",pos=(5,5), size=(340,356)) self.titreP.SetFont(self.fontTitre) - self.titreP.SetForegroundColour(self.foreground_colour) # For dark themes + self.titreP.SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.txtEstimation = wx.StaticText(self.panel, -1, "",size=(480,30),style=wx.ST_NO_AUTORESIZE) self.register_link = "" @@ -176,7 +173,7 @@ def make_gui(self): self.Menu = wx.ListBox(self.panel, 104, pos=(25,105),size=(460,220), style=Variables.widget_borders) self.scrolled_panel = wx.ScrolledWindow(self.panel, -1, pos=(20,100), size=(460,220), style=Variables.widget_borders|wx.HSCROLL|wx.VSCROLL) #self.scrolled_panel.SetBackgroundColour((255,255,255)) - self.scrolled_panel.SetBackgroundColour(self.background_colour) + self.scrolled_panel.SetBackgroundColour(playonlinux.get_background_colour()) self.texte_panel = wx.StaticText(self.scrolled_panel, -1, "",pos=(5,5)) self.gauge = wx.Gauge(self.panel, -1, 50, size=(375, 20)) @@ -199,7 +196,7 @@ def make_gui(self): self.loginbox = wx.TextCtrl(self.panel, -1, "",size=(250,22),pos=(200,115)) self.passbox = wx.TextCtrl(self.panel, -1, "",size=(250,22),pos=(200,145), style=wx.TE_PASSWORD) self.register = wx.HyperlinkCtrl(self.panel, 303, _("Register"), "", pos=(20,180)) - self.register.SetNormalColour(self.foreground_colour) + self.register.SetNormalColour(playonlinux.get_foreground_colour()) # Fixed Events wx.EVT_BUTTON(self, wx.ID_YES, self.release_yes) diff --git a/python/install.py b/python/install.py index 3f031242a..edb48f57d 100755 --- a/python/install.py +++ b/python/install.py @@ -175,19 +175,14 @@ def addCat(self, name, icon, iid): wx.EVT_BUTTON(self, 2000+iid, self.AddApps) #self.cats_icons[name].Bind(wx.EVT_LEFT_DOWN, 2000+iid, self.AddApps) - self.cats_links[name].SetNormalColour(self.foreground_colour) - self.cats_links[name].SetVisitedColour(self.foreground_colour) - self.cats_links[name].SetHoverColour(self.foreground_colour) - self.cats_links[name].SetBackgroundColour(self.background_colour) + self.cats_links[name].SetNormalColour(playonlinux.get_foreground_colour()) + self.cats_links[name].SetVisitedColour(playonlinux.get_foreground_colour()) + self.cats_links[name].SetHoverColour(playonlinux.get_foreground_colour()) + self.cats_links[name].SetBackgroundColour(playonlinux.get_background_colour()) self.cats_links[name].SetFont(self.fontText) def __init__(self,parent,id,title): - self.foreground_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) - self.foreground_hover_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT ) - self.background_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BACKGROUND ) - self.background_test_colour = wx.Colour(90,90,222) - wx.Frame.__init__(self, parent, -1, title, size = (800, 550+Variables.windows_add_size), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) self.cats_icons = {} self.cats_links = {} @@ -203,7 +198,7 @@ def __init__(self,parent,id,title): # Categories self.panelButton = wx.Panel(self.panelFenp, -1, size=(802,69), pos=(-1,-1),style=Variables.widget_borders) - self.panelButton.SetBackgroundColour(self.background_colour) + self.panelButton.SetBackgroundColour(playonlinux.get_background_colour()) if(os.environ["POL_OS"] == "Mac"): self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT) @@ -300,14 +295,14 @@ def __init__(self,parent,id,title): self.install_button.Enable(False) self.new_panel = wx.Panel(self.panelItems, -1, pos=(740-160,113-71), style=Variables.widget_borders, size=self.new_size) - self.new_panel.SetBackgroundColour(self.background_colour) + self.new_panel.SetBackgroundColour(playonlinux.get_background_colour()) self.animation = wx.animate.GIFAnimationCtrl(self.new_panel, -1, Variables.playonlinux_env+"/resources/images/install/wait_mini.gif", (90,100)) self.animation.Hide() self.new_panel.Hide() self.ManualInstall = wx.HyperlinkCtrl(self.panelFenp, 111, _("Install a non-listed program"), "", pos=(10,515)) - self.ManualInstall.SetNormalColour(self.foreground_colour) + self.ManualInstall.SetNormalColour(playonlinux.get_foreground_colour()) # Panel wait self.animation_wait = wx.animate.GIFAnimationCtrl(self.panelWait, -1, Variables.playonlinux_env+"/resources/images/install/wait.gif", ((800-128)/2,(550-128)/2-71)) @@ -556,7 +551,7 @@ def WriteApps(self, array): # (255,255,214) is web site color for beta, but it's not very visible next to plain white, # and red is the color of danger ##self.list_apps.SetItemBackgroundColour(itemId, (255,214,214)) - self.list_apps.SetItemBackgroundColour(itemId, self.background_test_colour) + self.list_apps.SetItemBackgroundColour(itemId, playonlinux.get_background_test_colour()) self.i = self.i+1 def DelApps(self): diff --git a/python/lib/playonlinux.py b/python/lib/playonlinux.py index e4783b571..51709c665 100755 --- a/python/lib/playonlinux.py +++ b/python/lib/playonlinux.py @@ -6,6 +6,18 @@ import Variables, os, string import shlex, pipes, wx +def get_foreground_colour(): + return wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) + +def get_foreground_hover_colour(): + return wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DHILIGHT ) + +def get_background_colour(): + return wx.SystemSettings.GetColour( wx.SYS_COLOUR_BACKGROUND ) + +def get_background_test_colour(): + return wx.Colour(90,90,222) + def winpath(script, path): #path=os.path.realpath(path) if(path[0] != "/"): @@ -404,6 +416,8 @@ def Get_Drives(): pref.sort() return pref +def Get_Shelves(): + return open(os.environ["POL_USER_ROOT"]+"/shelves.cfg").readlines() def SetWinePrefix(game, prefix): cfile = Variables.playonlinux_rep+"shortcuts/"+game diff --git a/python/mainwindow.py b/python/mainwindow.py index 2f32f482f..faf61768b 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -113,7 +113,6 @@ def run(self): time.sleep(1) class PanelManager(wx.aui.AuiManager): - def __init__(self, frame): wx.aui.AuiManager.__init__(self, frame) self.startPerspective = self.SavePerspective() @@ -159,9 +158,6 @@ def Destroy(self): class MainWindow(wx.Frame): def __init__(self,parent,id,title): - self.foreground_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNTEXT ) - self.foreground_hover_colour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DHILIGHT ) - wx.Frame.__init__(self, parent, 1000, title, size = (515,450)) self.SetMinSize((400,400)) self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) @@ -293,9 +289,10 @@ def __init__(self,parent,id,title): self.optionmenu = wx.Menu() - self.optionmenu.Append(221, _("Internet")) - self.optionmenu.Append(212, _("File associations")) + self.optionmenu.Append(211, _("Internet")) self.optionmenu.Append(214, _("Plugin manager")) + self.optionmenu.Append(212, _("File associations")) + self.optionmenu.Append(215, _("Shelves")) self.supportmenu = wx.Menu() @@ -377,16 +374,22 @@ def __init__(self,parent,id,title): self.toolbar = self.CreateToolBar(wx.TB_TEXT) self.toolbar.SetToolBitmapSize(iconSize) self.searchbox = wx.SearchCtrl( self.toolbar, 124, style=wx.RAISED_BORDER ) + self.playTool = self.toolbar.AddLabelTool(wx.ID_OPEN, _("Run"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/play.png")) + self.stopTool = self.toolbar.AddLabelTool(123, _("Close"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/stop.png")) self.toolbar.AddSeparator() - self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/install.png")) + + self.installTool = self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/install.png")) + self.removeTool = self.toolbar_remove = self.toolbar.AddLabelTool(wx.ID_DELETE, _("Remove"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/delete.png")) + self.toolbar.AddSeparator() - self.toolbar.AddLabelTool(121, _("Configure"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/configure.png")) - try: + self.configTool = self.toolbar.AddLabelTool(121, _("Configure"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/configure.png")) + + try: self.toolbar.AddStretchableSpace() self.SpaceHack = False except: @@ -439,6 +442,7 @@ def __init__(self,parent,id,title): wx.EVT_MENU(self, 213, self.Options) wx.EVT_MENU(self, 214, self.Options) wx.EVT_MENU(self, 215, self.Options) + wx.EVT_MENU(self, 221, self.Options) wx.EVT_MENU(self, 216, self.donate) @@ -477,7 +481,12 @@ def __init__(self,parent,id,title): wx.EVT_MENU(self, 235, self.RKill) wx.EVT_MENU(self, 236, self.ReadMe) self.Bind(wx.EVT_SIZE, self.ResizeWindow) - self._mgr.restorePosition() + self._mgr.restorePosition() + + self.toolbar.EnableTool(self.playTool.GetId(), False) + self.toolbar.EnableTool(self.stopTool.GetId(), False) + self.toolbar.EnableTool(self.removeTool.GetId(), False) + self.toolbar.EnableTool(self.configTool.GetId(), False) def tree_item(self, tree, match, root): @@ -725,14 +734,25 @@ def Select(self, event): self.i += 1 self.generate_menu(game_exec) - self.playTool.Enable(True) - self.stopTool.Enable(True) - self.removeTool.Enable(True) + #self.playTool.Enable(True) + #self.stopTool.Enable(True) + #self.removeTool.Enable(True) + + self.toolbar.EnableTool(self.playTool.GetId(), True) + self.toolbar.EnableTool(self.stopTool.GetId(), True) + self.toolbar.EnableTool(self.removeTool.GetId(), True) + self.toolbar.EnableTool(self.configTool.GetId(), True) else: self.generate_menu("") - self.playTool.Enable(False) - self.stopTool.Enable(False) - self.removeTool.Enable(False) + + #self.playTool.Enable(False) + #self.stopTool.Enable(False) + #self.removeTool.Enable(False) + + self.toolbar.EnableTool(self.playTool.GetId(), False) + self.toolbar.EnableTool(self.stopTool.GetId(), False) + self.toolbar.EnableTool(self.removeTool.GetId(), False) + self.toolbar.EnableTool(self.configTool.GetId(), False) def generate_menu(self, shortcut=None): for c in self.menuElem: @@ -816,7 +836,7 @@ def generate_menu(self, shortcut=None): def menuGaucheAddTitle(self,id,text,pos): self.menuElem[id] = wx.StaticText(self.menu_gauche, -1, text,pos=(5,5+pos*20)) - self.menuElem[id].SetForegroundColour(self.foreground_colour) # For dark themes + self.menuElem[id].SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.menuElem[id].SetFont(self.fontTitre) def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): @@ -839,9 +859,9 @@ def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): else: self.menuElem[id] = wx.HyperlinkCtrl(self.menu_gauche, 10000+pos, text, url, pos=(35,15+pos*20)) - self.menuElem[id].SetNormalColour(self.foreground_colour) - self.menuElem[id].SetVisitedColour(self.foreground_colour) - self.menuElem[id].SetHoverColour(self.foreground_hover_colour) + self.menuElem[id].SetNormalColour(playonlinux.get_foreground_colour()) + self.menuElem[id].SetVisitedColour(playonlinux.get_foreground_colour()) + self.menuElem[id].SetHoverColour(playonlinux.get_foreground_hover_colour()) if(evt != None): wx.EVT_HYPERLINK(self, 10000+pos, evt) @@ -932,6 +952,8 @@ def Options(self, event): self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 0) if(onglet == 214): self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 1) + if(onglet == 215): + self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 3) self.optionFrame.Center(wx.BOTH) self.optionFrame.Show(True) @@ -956,8 +978,7 @@ def POLOnline(self, event): def PCCd(self, event): subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/read_pc_cd"]) - def PolShell(self, event): - #Variables.run_x_server() + def PolShell(self, event): #Variables.run_x_server() subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/expert/PolShell"]) def Configure(self, event): @@ -1027,7 +1048,6 @@ def GetSelectedProgram(self): return "" def Run(self, event, s_debug=False): - game_exec = self.GetSelectedProgram() if (game_exec != ""): diff --git a/python/options.py b/python/options.py index cda3d60bb..ff5e5662b 100755 --- a/python/options.py +++ b/python/options.py @@ -296,7 +296,7 @@ def generateShvs(self): self.list_shv.DeleteAllItems() i = 0 - self.shelves = open(os.environ["POL_USER_ROOT"]+"/shelves.cfg").readlines() + self.shelves = playonlinux.Get_Shelves() self.shelves.sort() for line in self.shelves: line = line.replace("\n","") From 07e5ebc4463eb30614ce797b71776623529d105d Mon Sep 17 00:00:00 2001 From: TFK Date: Fri, 25 Jul 2014 00:37:15 +0200 Subject: [PATCH 11/18] Created a centralized method in lib/playonlinux.py to create menu items with images in one call. Added images to all menu items that needed them. TFKs --- python/lib/playonlinux.py | 12 ++++++++++ python/mainwindow.py | 46 +++++++++++++++++++++++---------------- python/options.py | 4 ++++ 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/python/lib/playonlinux.py b/python/lib/playonlinux.py index 51709c665..32c3ea891 100755 --- a/python/lib/playonlinux.py +++ b/python/lib/playonlinux.py @@ -477,3 +477,15 @@ def POL_Open(arg): def POL_Error(message): wx.MessageBox(message,_("{0} error").format(os.environ["APPLICATION_TITLE"])) + +def SetMenuBitmap(menuitem, path): + if(os.path.exists(path)): + bitmap = wx.Bitmap(path) + menuitem.SetBitmap(bitmap) + +def AddMenuItem(parent, menuId, label, pathtobitmap): + newMenuItem = wx.MenuItem(parent, menuId, label) + if(os.path.exists(pathtobitmap)): + SetMenuBitmap(newMenuItem, pathtobitmap) + parent.AppendItem(newMenuItem) + return newMenuItem diff --git a/python/mainwindow.py b/python/mainwindow.py index faf61768b..2194afc0d 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -268,40 +268,48 @@ def __init__(self,parent,id,title): self.expertmenu = wx.Menu() - self.expertmenu.Append(107, _("Manage Wine versions")) + self.expertMenuManageWineVersions = wx.MenuItem(self.expertmenu, 107, _("Manage Wine versions")) + + playonlinux.SetMenuBitmap(self.expertMenuManageWineVersions, Variables.playonlinux_env+"/etc/onglet/wine.png") + + self.expertmenu.AppendItem(self.expertMenuManageWineVersions) if(os.environ["POL_OS"] == "Mac"): self.expertmenu.AppendSeparator() - self.expertmenu.Append(113, _("Read a PC CD-Rom")) + + self.expertMenuReadAPCCDROM = wx.MenuItem(self.expertmenu, 113, _("Read a PC CD-Rom")) + playonlinux.SetMenuBitmap(self.expertMenuReadAPCCDROM, Variables.playonlinux_env+"/resources/images/menu/media-optical.png") + + self.expertmenu.AppendItem(self.expertMenuReadAPCCDROM) self.expertmenu.AppendSeparator() - self.expertmenu.Append(108, _("Run a local script")) - self.expertmenu.Append(109, _("{0} console").format(os.environ["APPLICATION_TITLE"])) - - self.expertmenu.Append(115, _('Close all {0} software').format(os.environ["APPLICATION_TITLE"])) - self.expertmenu.AppendSeparator() + - self.expertmenu.Append(110, _("{0} debugger").format(os.environ["APPLICATION_TITLE"])) + self.expertMenuRunALocalScript = playonlinux.AddMenuItem(self.expertmenu, 108, _("Run a local script"), Variables.playonlinux_env+"/resources/images/menu/text-x-script.png") + self.expertMenuConsole = playonlinux.AddMenuItem(self.expertmenu, 109, _("{0} console").format(os.environ["APPLICATION_TITLE"]), Variables.playonlinux_env+"/resources/images/menu/polshell.png") + self.expertMenuCloseAllSoftware = playonlinux.AddMenuItem(self.expertmenu, 115, _('Close all {0} software').format(os.environ["APPLICATION_TITLE"]), Variables.playonlinux_env+"/resources/images/menu/wineserver.png") + self.expertmenu.AppendSeparator() - self.optionmenu = wx.Menu() - + self.expertMenuDebugger = playonlinux.AddMenuItem(self.expertmenu, 110, _("{0} debugger").format(os.environ["APPLICATION_TITLE"]), Variables.playonlinux_env+"/resources/images/menu/software-update-available.png") - self.optionmenu.Append(211, _("Internet")) - self.optionmenu.Append(214, _("Plugin manager")) - self.optionmenu.Append(212, _("File associations")) - self.optionmenu.Append(215, _("Shelves")) + self.optionmenu = wx.Menu() + self.optionMenuInternet = playonlinux.AddMenuItem(self.optionmenu, 211, _("Internet"), Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png") + self.optionMenuPluginManager = playonlinux.AddMenuItem(self.optionmenu, 214, _("Plugin manager"), Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png") + self.optionMenuFileAssociations = playonlinux.AddMenuItem(self.optionmenu, 212, _("File associations"), Variables.playonlinux_env+"/resources/images/menu/extensions.png") + self.optionMenuShelves = playonlinux.AddMenuItem(self.optionmenu, 215, _("Shelves"), Variables.playonlinux_env+"/etc/onglet/folder-saved-search.png") self.supportmenu = wx.Menu() - self.supportmenu.Append(400, _("Supported software")) - self.supportmenu.Append(401, _("News")) - self.supportmenu.Append(402, _("Documentation")) - self.supportmenu.Append(403, _("Forums")) - self.supportmenu.Append(404, _("Bugs")) + self.supportMenuSupportedSoftware = playonlinux.AddMenuItem(self.supportmenu, 400, _("Supported software"), Variables.playonlinux_env+"/resources/images/menu/emblem-favorite.png") + self.supportMenuNews = playonlinux.AddMenuItem(self.supportmenu, 401, _("News"), Variables.playonlinux_env+"/resources/images/menu/internet-news-reader.png") + self.supportMenuDocumentation = playonlinux.AddMenuItem(self.supportmenu, 402, _("Documentation"), Variables.playonlinux_env+"/resources/images/menu/x-office-address-book.png") + self.supportMenuForums = playonlinux.AddMenuItem(self.supportmenu, 403, _("Forums"), Variables.playonlinux_env+"/etc/onglet/internet-group-chat.png") + self.supportMenuBugs = playonlinux.AddMenuItem(self.supportmenu, 404, _("Bugs"), Variables.playonlinux_env+"/resources/images/menu/software-update-available.png") + self.help_menu = wx.Menu() self.help_menu.Append(wx.ID_ABOUT, _('About {0}').format(os.environ["APPLICATION_TITLE"])) diff --git a/python/options.py b/python/options.py index ff5e5662b..f4f1ee4de 100755 --- a/python/options.py +++ b/python/options.py @@ -333,6 +333,9 @@ def enterKeyPressed(self, event): def shelveSelected(self, event): self.delete_shv.Enable() + def shelveDeselected(self, event): + self.delete_shv.Disable() + def Shelves(self, nom): self.panelShelves = wx.Panel(self, -1) @@ -377,6 +380,7 @@ def Shelves(self, nom): wx.EVT_BUTTON(self, 1502, self.addShelve) wx.EVT_BUTTON(self, 1503, self.deleteShelve) wx.EVT_LIST_ITEM_SELECTED(self, 1504, self.shelveSelected) + wx.EVT_LIST_ITEM_DESELECTED(self, 1504, self.shelveDeselected) wx.EVT_TEXT(self, 1505, self.newShelveEntered) wx.EVT_TEXT_ENTER(self, 1505, self.enterKeyPressed) From 4d11eed0b4aecd86ac0c560d3554c88cbdcf7d73 Mon Sep 17 00:00:00 2001 From: TFK Date: Fri, 25 Jul 2014 21:46:24 +0200 Subject: [PATCH 12/18] Adding some files. tfks --- etc/onglet/.directory | 4 ++++ etc/onglet/folder-saved-search.png | Bin 0 -> 711 bytes python/guiv3.py | 3 --- resources/images/configure/.directory | 4 ++++ resources/images/emotes/.directory | 3 +++ resources/images/icones/.directory | 4 ++++ resources/images/menu/.directory | 4 ++++ resources/images/menu/emblem-favorite.png | Bin 0 -> 788 bytes resources/images/menu/internet-news-reader.png | Bin 0 -> 474 bytes resources/images/menu/media-optical.png | Bin 0 -> 2288 bytes .../images/menu/software-update-available.png | Bin 0 -> 740 bytes resources/images/menu/text-x-script.png | Bin 0 -> 516 bytes resources/images/menu/x-office-address-book.png | Bin 0 -> 753 bytes resources/images/toolbar/.directory | 4 ++++ resources/images/toolbar/48/.directory | 4 ++++ 15 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 etc/onglet/.directory create mode 100644 etc/onglet/folder-saved-search.png create mode 100644 resources/images/configure/.directory create mode 100644 resources/images/emotes/.directory create mode 100644 resources/images/icones/.directory create mode 100644 resources/images/menu/.directory create mode 100644 resources/images/menu/emblem-favorite.png create mode 100644 resources/images/menu/internet-news-reader.png create mode 100644 resources/images/menu/media-optical.png create mode 100644 resources/images/menu/software-update-available.png create mode 100644 resources/images/menu/text-x-script.png create mode 100644 resources/images/menu/x-office-address-book.png create mode 100644 resources/images/toolbar/.directory create mode 100644 resources/images/toolbar/48/.directory diff --git a/etc/onglet/.directory b/etc/onglet/.directory new file mode 100644 index 000000000..69c469290 --- /dev/null +++ b/etc/onglet/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,7,22,20,17,43 +Version=3 diff --git a/etc/onglet/folder-saved-search.png b/etc/onglet/folder-saved-search.png new file mode 100644 index 0000000000000000000000000000000000000000..ca24a3676b9f18d5f6272de2f4203ff2cb4c681c GIT binary patch literal 711 zcmV;&0yzDNP)|6*x4SbI4-gE}ILTy-ng5%a zon51<{EwO8;o%3WdU=;vO;xXqj*d?42^bn0O8Wcz+e8ErVY8zoNhlVJQzCM6Gub(Z zwKkMWrB~zQ;{hOc&Z+mFrKKf82wMN3;BGWD2lMwvaql~xm-TJ35>n>;(efJVh~&ZxyzJ0FZqBfCt+av`q+Stqc5>@ zPSZ3csxNbT0N2;+)$M zE9CZJ4xL3mKY`kJs4b%N&oQmXKm(*n<|qaaVuJ# zLsl0vNR-1gs$epJdLICTOBRsQ2c-28QRg`{Sje?OYcEnuFee6apPnMgEH<|YipJi1 zNz)Vs*5}`$D-{}(_leq%5_g?KD&O!k<3t@jG!@Qc4`0Bo)o_(k)`2lbLM7c204Bt$O1}IW6UXSv`+xnJttaJ^ET>wofHhNb td$eBc`#5$3U~Y1HPr!Dwku9srt=}^@UuC|qY3Bd{002ovPDHLkV1i_aGVTBX literal 0 HcmV?d00001 diff --git a/python/guiv3.py b/python/guiv3.py index 76fd850c8..53032d9d6 100755 --- a/python/guiv3.py +++ b/python/guiv3.py @@ -172,14 +172,11 @@ def make_gui(self): self.PCheckBox = wx.CheckBox(self.panel, 304, _("Show virtual drives"), pos=(20,325)) self.Menu = wx.ListBox(self.panel, 104, pos=(25,105),size=(460,220), style=Variables.widget_borders) self.scrolled_panel = wx.ScrolledWindow(self.panel, -1, pos=(20,100), size=(460,220), style=Variables.widget_borders|wx.HSCROLL|wx.VSCROLL) - #self.scrolled_panel.SetBackgroundColour((255,255,255)) self.scrolled_panel.SetBackgroundColour(playonlinux.get_background_colour()) self.texte_panel = wx.StaticText(self.scrolled_panel, -1, "",pos=(5,5)) self.gauge = wx.Gauge(self.panel, -1, 50, size=(375, 20)) self.WaitButton = wx.Button(self.panel, 310, "", size=(250,25)) - - self.animation = wx.StaticBitmap(self.panel, -1, self.GetLoaderFromAngle(1), (228,170)) self.current_angle = 1 diff --git a/resources/images/configure/.directory b/resources/images/configure/.directory new file mode 100644 index 000000000..3e3a8c77b --- /dev/null +++ b/resources/images/configure/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,7,24,23,0,2 +Version=3 diff --git a/resources/images/emotes/.directory b/resources/images/emotes/.directory new file mode 100644 index 000000000..672951e2a --- /dev/null +++ b/resources/images/emotes/.directory @@ -0,0 +1,3 @@ +[Dolphin] +Timestamp=2014,7,24,22,59,34 +Version=3 diff --git a/resources/images/icones/.directory b/resources/images/icones/.directory new file mode 100644 index 000000000..bbf092472 --- /dev/null +++ b/resources/images/icones/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,7,24,23,0,49 +Version=3 diff --git a/resources/images/menu/.directory b/resources/images/menu/.directory new file mode 100644 index 000000000..f2d041549 --- /dev/null +++ b/resources/images/menu/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,7,24,23,1,17 +Version=3 diff --git a/resources/images/menu/emblem-favorite.png b/resources/images/menu/emblem-favorite.png new file mode 100644 index 0000000000000000000000000000000000000000..3acb57dc97fef46f12495b5405c9ad5ed3bbab48 GIT binary patch literal 788 zcmV+v1MB>WP)AJcf;|HO-w?mVV+ z2b~6XI*xs%ZQs^}Z3}Sd0}P0SgR#*J?1YW^6%MqU1%!ljO5tmXTbFwLLf$_jTO^%Y zxuK@6s=5?9Hw_MaaNt9`U*NV>xKohxQ_ne21#~W*C0D%wlFqM!@7Q96(C zvkNvqx5Zk6VkKa(uq;V$Gvm{%D-s0l&2#_&tPFxN7rGG5T3u{G1=16fkc1CH8NU4d z$vaP$SHc7#j29wG7vR0m&IywhL%ePsh6aX;k-<@+HJ{66z1J@uz1L(fgg@#cOnYEu zX2Y=~W1s;*b z3=G^tAk28_ZrvZCAbW|YuPggiW^Qg~6A7WOaq$lGMz+)FO4`_Yn*X zjIy3Cjv*GOmrma6ci2Fr)!uoYVse?4dzY37;HcOU(q{XAXF$#5gbOns*B;*@cLiACah?`$rO zl8=|enc}X$K7ae-(T+tLeSbJ-U46y;z?b2S*yZvEpRSy@*jYcThS^`dQcLUYbTwd* OGkCiCxvXA=OO2B9$#z%bGBtUpG648hRc|qktpR|b;aFoyhi6u~AXlDv^dWF(<=G^z*>*B*X z({x5OVtjM$eAzqMYp?%ree1IS3;y4We3Hs}o?j&*cQ+c1Z^sy?ovYTDWtApLQW#?{ zDW#6KTCJym19_fb{GS2jdA_4otNkK`FtdI8cC}^87BxOTN|x0~lLY4~ilU_1YVqE? z?}fQ{-U(W(L+y6w-aOBb{nr4GJ@#1I?RK9~N_~Cz?%if$VuG?PDT)r>JBT1Cv@uv? zu{L3BYz(Co$L8nx%j~R=F+P)J*?srle}D0b03Lq$;p?>4FHTNQPVL&YOS;`IOG`_L za%iO?Dy%VRZO}@iwZ@u+Mx%jJiZn}!BE0zG-{R3@$L2eo&Ruz)f4Ejhf1LOuk34dX z)_U%aJMOq~$BrFx^5jXH%_gE8GQ46?gdivZq5y(57Oe+O1|JY$YHCWdEZcDA%$a-k z?%n&;?Cfm!-vZ=$o+L@~%I@8}Z`!OOTASzsR#DT7Y`J{*&qH=^c}klbkzu4gg~VF+lK< z;KBQV4-o=52hK;l2d&IdlwrL{@PVoQA&}dpk&Z+@R1NA!AHt|Nm=%2xB7J3U1Asr4n!jnfjFoi15{!AXF|%h+Ix-J|F`e1OUY+O00_P7fafRaG%Dv6X(m_~N6FK03ZO z17F&?bEgg=pp-&ugV7eH3|bjtfL^aeMB!Y4G7)QQjISSKeDoUXwNbnmLKND)f~Dma zmo6<+lqKE=obx#6i6JmGwN3T={ks9oiu&m2=)F@@Q_4AqF@{J9VhCRFO6c~M(c0ic zMV490vgZ%Kai~)i#b}yl&FP8TMkXger7vDQPpj1=Ni`cbtOqTK4+C%sRIXy{)|=Jh z;^Mu)uP+0{7^la_#|LZE1Y)#A?+985{fZC-P$Wr>7z@9!uy7Iht}*6NQS@hy%)Rn6 z(Pl%vzCm|OM-@Dc(vgZDtacT!Q79|N=;$aRgy~foD9dtPyAr zfU7EcrK9wbDg>O1xDasOW2~X7s&o~AF{W_NVQd)gFD ztp-XwJ{p#r6-5y#T;P`J&o&OfKKrW&AAIn8#+XCSxfv1p`L12JjRe{xX_tN(v3eY# z#Cc1l1qp(WfljA`wRUM0fKuvMtJS*xy6djSJC8Pkb`fKQBuS~&>NG}Ew9XiJMVR^ZUh#Xr5u)Mtd z%cDo<_TF&A=an&r;5}MLl=o!yI-52%SX%DleWWP5Y~D1bw``sm6V*YaKjM6s_l~~_ zMAB4~riwt5$k@O)h){T;9_pN0JP}&0))T7$fCER4yyf@p+oy~&1S5dPSVdU|3L;r8 zqt`1CJm)_;N2_@eg~P`-Sr#z1!dQbz5+V?MNu(V7zM~?zj0l`Oc_IJ@R!zb@&o8EF z`rQ2d0>&7uwItS{wHoY?>ztf3k%yOrxK+UQGrN6TZM8FkwB7KgoJhL$EgYfA%U1+ ztU{?8A+)Ky!$-xya0O7F5K@!`7Uo_rtE#wfMRS!QdEtc@n)~HXoWKbuu zBb+{Yf{#8t`%bUh{lS%bYb}|Xot;fZ$pPRSwOTFPxbX%MA%;i?_KaAcmT0jB+ z`e0(NfJuP_NT#Q!ub!Ei**CRq+gFS+n}ZJ{&Q*yqrWB>xuBuKRKYsl8FTM2AU+3rN zKLV;@PrJh?hP}UB{?o(h%D4^P#pUOfHsbKv1L2BP`zzjkZ21TEI90V#aS^-#0000< KMNUMnLSTX_UsMzT literal 0 HcmV?d00001 diff --git a/resources/images/menu/software-update-available.png b/resources/images/menu/software-update-available.png new file mode 100644 index 0000000000000000000000000000000000000000..ab8d494bb3367bae188d0c31dc7a05e86d83a87a GIT binary patch literal 740 zcmVEh306QPEcFidJh)h*{a}$Ny`_LyWBA zwsW56H_SZqh?y~}nsxaS7^^jGc2tjy0yOKgLA+~$i>=6a)*ANwKLO3Ud;^q$Yrrk> z?#HoDCTD{3I$4^(dRYsd0`>s=fl{qu=Kz8s*atqYoN-Y}^KKg#me_pYi%`60`Tm{5 z)_vLYm8!#3@?PicnrIks&4p1mK7FE;_WNj-;?gB35_TS$j>LPyN|^_9zjX6n=lAyk zZe-ndn7&*h=sg58{Gsmv2!Hz?Oi`Jjzxb>ITwN2n*ZY4cPR{$Nq`K0^k^#E>2#Kml zR7IB`VS^R&&N4w<%A9vUHS4k&KyDuAgovCS+qym6wENT835Ud(KD1>pw? z@qH5pP8uridAC!U4$FdZyoV{)vU_~anizw&FuffGy-yr)i|FY)$#@I|S_<`|JP!0g*{W zK~y-)m6N}Y+CUJ-e}h({49)`}3JNz!$6G{-s8a9X3|k zq-mPN3xWzrF{aq#tLNQNG56d=B)csTfT{!2H@TQ%1m}PVq6NET3{>6+kRk)k41xs` z2mBEO#OCh)i{;~dmHVPtDHT&t(d>`pw~EyyiFy3_$ZofL2S6Q%0^>~oCNaHUk01!> zbUIwG*S7#tY($@O$P z;rl*O6ah4I0MGOAJdaAHV)aXfYPHH>Fkm{JVvON(xd5?u$zR0000Mh53JODVWnpw>WFU8GbZ8({Xk{Qr zNlj3Y*^6%g00KQpL_t(I%axN&Pg6k@hM$?w0X#5SDVBDAx z;=+Z0!K4caEKK|#ggud;VB*4r4GIP@RT1# zz*KQz4w&KJV}9|~^eljwDlW{8NImo7`9nNk zsqExS3z&KQ=s_5UMs|Y^*;I^;@;;5q0Yl|IRI5#>B6y=2TA392kvMfAm7S!vxAfWq za2!V(;NZ|B8grrEBweadyE00Uh++9{Ql$!A6@igBF(>GIu>f3G0fv^}JCI*0)W@g|hZ5PJ#MD5NXz;b-6&lG{J2 zU(WaVBnB;7%3n>6hHch>)Nq*l& zHCl9SMfK*yxf9h>U_dF0bUK0G(d38YB%=;oAM5K%4QTue;5AyjS$>Np4Wa2Rtqnp7 zY!yKWfdIPQkgw%xm~S4*&+F>|Pc48Ct6SW^5$})fc_F2wDbj502XcG-7I%-uSOAA! zgNfV_g~FvXiQ-fN*EV;~t-<{J&FYM9HN%~1AYE6XJ9@zIAB66POy0?urIo5U-8VT^ jT$ugO@66(>X#wyXbGzHwYQAj$00000NkvXXu0mjf74}1O literal 0 HcmV?d00001 diff --git a/resources/images/toolbar/.directory b/resources/images/toolbar/.directory new file mode 100644 index 000000000..d12ca9144 --- /dev/null +++ b/resources/images/toolbar/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,7,24,22,59,42 +Version=3 diff --git a/resources/images/toolbar/48/.directory b/resources/images/toolbar/48/.directory new file mode 100644 index 000000000..69e5dd0e6 --- /dev/null +++ b/resources/images/toolbar/48/.directory @@ -0,0 +1,4 @@ +[Dolphin] +PreviewsShown=true +Timestamp=2014,7,24,22,59,48 +Version=3 From 5a0953a29422be1d8ceab126910ab626180aab20 Mon Sep 17 00:00:00 2001 From: TFK Date: Fri, 25 Jul 2014 21:58:10 +0200 Subject: [PATCH 13/18] Removing those darn .direcory names. Really have to add this one to gitignore. tfks --- etc/onglet/.directory | 4 ---- resources/images/configure/.directory | 4 ---- resources/images/emotes/.directory | 3 --- resources/images/icones/.directory | 4 ---- resources/images/menu/.directory | 4 ---- resources/images/toolbar/.directory | 4 ---- 6 files changed, 23 deletions(-) delete mode 100644 etc/onglet/.directory delete mode 100644 resources/images/configure/.directory delete mode 100644 resources/images/emotes/.directory delete mode 100644 resources/images/icones/.directory delete mode 100644 resources/images/menu/.directory delete mode 100644 resources/images/toolbar/.directory diff --git a/etc/onglet/.directory b/etc/onglet/.directory deleted file mode 100644 index 69c469290..000000000 --- a/etc/onglet/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2014,7,22,20,17,43 -Version=3 diff --git a/resources/images/configure/.directory b/resources/images/configure/.directory deleted file mode 100644 index 3e3a8c77b..000000000 --- a/resources/images/configure/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2014,7,24,23,0,2 -Version=3 diff --git a/resources/images/emotes/.directory b/resources/images/emotes/.directory deleted file mode 100644 index 672951e2a..000000000 --- a/resources/images/emotes/.directory +++ /dev/null @@ -1,3 +0,0 @@ -[Dolphin] -Timestamp=2014,7,24,22,59,34 -Version=3 diff --git a/resources/images/icones/.directory b/resources/images/icones/.directory deleted file mode 100644 index bbf092472..000000000 --- a/resources/images/icones/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2014,7,24,23,0,49 -Version=3 diff --git a/resources/images/menu/.directory b/resources/images/menu/.directory deleted file mode 100644 index f2d041549..000000000 --- a/resources/images/menu/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2014,7,24,23,1,17 -Version=3 diff --git a/resources/images/toolbar/.directory b/resources/images/toolbar/.directory deleted file mode 100644 index d12ca9144..000000000 --- a/resources/images/toolbar/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2014,7,24,22,59,42 -Version=3 From ec2e2d95071a3a14a37f18e9d9458aa8fb45f48e Mon Sep 17 00:00:00 2001 From: TFK Date: Fri, 25 Jul 2014 22:00:40 +0200 Subject: [PATCH 14/18] Removing those darn .direcory names. Really have to add this one to gitignore. tfks --- resources/images/toolbar/48/.directory | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 resources/images/toolbar/48/.directory diff --git a/resources/images/toolbar/48/.directory b/resources/images/toolbar/48/.directory deleted file mode 100644 index 69e5dd0e6..000000000 --- a/resources/images/toolbar/48/.directory +++ /dev/null @@ -1,4 +0,0 @@ -[Dolphin] -PreviewsShown=true -Timestamp=2014,7,24,22,59,48 -Version=3 From 5b5fd2a4414c267e567a5937b187c7d06060bf59 Mon Sep 17 00:00:00 2001 From: TFK Date: Thu, 11 Sep 2014 20:56:23 +0200 Subject: [PATCH 15/18] Separate readme for the changes in this fork. T. --- README_THISFORK.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 README_THISFORK.md diff --git a/README_THISFORK.md b/README_THISFORK.md new file mode 100644 index 000000000..a4fcc1072 --- /dev/null +++ b/README_THISFORK.md @@ -0,0 +1,32 @@ +POL-POM-4 +========= + +PlayOnLinux 4 repository + +I've fixed a few glitches I wanted to correct for myself. +I've decided to create a fork of the main project to share my changes in good open source tradition. + +I am keeping track of the changes in the main repository so any release updates are going to be merged into this one. + +The changes so far: + +1. The colours used in the interface are now read from the system. This means that dark themes display the various elements in the widgets in the colour of those themes. This makes sure that all elements are readable under all conditions. + +2. The game list became somewhat long. I noticed that this list is a TreeView control with just one level and a hidden root. I made this TreeView control two-level and added a root with the text "Your games" in a nice big font size. + + +How to enable two levels in the TreeView control +The two level system is an open one. It's not based on wine-prefixes but on naming. This way you decide how you want to have your list defined. To define your list do the following: + +1. Make sure that there is one game in your list which will be the root item. For instance "Steam". +2. Name all games you want to place under this root item as [Root-Item-Name] - [Name-Of-Your-Game]. For instance "Steam - Crysis" + +The list will automatically rearange. + + +TODO: +1. Some more refining where I run into them. + +2. A shelving system is in the making. This is a further development of the TreeView system mentioned above. It allowes the user to define labels (or shelves) in the Options widget and select one of them in a game's Configuration widget. This way the user is free to have entries with hyphens in the gamelist. This is for 80% done. + +TFK \ No newline at end of file From 1bb04b27d45dd5f91fb064ceac85ab2a824a2979 Mon Sep 17 00:00:00 2001 From: TFK Date: Thu, 11 Sep 2014 21:01:14 +0200 Subject: [PATCH 16/18] Separate readme for the changes in this fork. T. --- README_THISFORK.md | 1 + python/install.py | 2 +- python/mainwindow.py | 368 ++++++++++++++++++++++++------------------- 3 files changed, 206 insertions(+), 165 deletions(-) diff --git a/README_THISFORK.md b/README_THISFORK.md index a4fcc1072..c47fe400f 100644 --- a/README_THISFORK.md +++ b/README_THISFORK.md @@ -25,6 +25,7 @@ The list will automatically rearange. TODO: + 1. Some more refining where I run into them. 2. A shelving system is in the making. This is a further development of the TreeView system mentioned above. It allowes the user to define labels (or shelves) in the Options widget and select one of them in a game's Configuration widget. This way the user is free to have entries with hyphens in the gamelist. This is for 80% done. diff --git a/python/install.py b/python/install.py index 470f107cf..84f9a47dd 100755 --- a/python/install.py +++ b/python/install.py @@ -308,7 +308,7 @@ def __init__(self,parent,id,title): self.ManualInstall = wx.lib.hyperlink.HyperLinkCtrl(self.panelFenp, 111, _("Install a non-listed program"), pos=(10,515)) - self.ManualInstall.SetColours(playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour()),playonlinux.get_foreground_colour()) + self.ManualInstall.SetColours(playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour()) self.ManualInstall.AutoBrowse(False) self.ManualInstall.UpdateLink(True) diff --git a/python/mainwindow.py b/python/mainwindow.py index 89a4ddd98..66fbbefea 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -36,8 +36,6 @@ import lib.lng as lng import lib.playonlinux as playonlinux, lib.Variables as Variables import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading, debug, gui_server -#import irc as ircgui - import re # This thread manage updates @@ -223,9 +221,14 @@ def __init__(self,parent,id,title): ## List game - self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT) - self.list_game.SetSpacing(0); - self.list_game.SetIndent(5); + header_font = wx.Font(32, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) + + self.rootnode = None; + + self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.TR_FULL_ROW_HIGHLIGHT) + self.list_game.SetFont(header_font) + self.list_game.SetSpacing(15); + self.list_game.SetIndent(15); self.list_game.SetImageList(self.images) self.menu_gauche = wx.Panel(self,-1) @@ -255,6 +258,7 @@ def __init__(self,parent,id,title): self.icon24 = self.displaymenu.AppendRadioItem(502, _("Medium icons")) self.icon32 = self.displaymenu.AppendRadioItem(503, _("Large icons")) self.icon48 = self.displaymenu.AppendRadioItem(504, _("Very large icons")) + if(self.iconSize == 16): self.icon16.Check(True) if(self.iconSize == 24): @@ -266,12 +270,20 @@ def __init__(self,parent,id,title): self.expertmenu = wx.Menu() - self.expertmenu.Append(107, _("Manage Wine versions")) + self.expertMenuManageWineVersions = wx.MenuItem(self.expertmenu, 107, _("Manage Wine versions")) + + playonlinux.SetMenuBitmap(self.expertMenuManageWineVersions, Variables.playonlinux_env+"/etc/onglet/wine.png") + + self.expertmenu.AppendItem(self.expertMenuManageWineVersions) if(os.environ["POL_OS"] == "Mac"): - self.expertmenu.AppendSeparator() - self.expertmenu.Append(113, _("Read a PC CD-Rom")) + self.expertmenu.AppendSeparator() + + self.expertMenuReadAPCCDROM = wx.MenuItem(self.expertmenu, 113, _("Read a PC CD-Rom")) + playonlinux.SetMenuBitmap(self.expertMenuReadAPCCDROM, Variables.playonlinux_env+"/resources/images/menu/media-optical.png") + + self.expertmenu.AppendItem(self.expertMenuReadAPCCDROM) self.expertmenu.AppendSeparator() @@ -281,33 +293,33 @@ def __init__(self,parent,id,title): self.expertmenu.Append(115, _('Close all {0} software').format(os.environ["APPLICATION_TITLE"])) self.expertmenu.AppendSeparator() - self.expertmenu.Append(110, _("{0} debugger").format(os.environ["APPLICATION_TITLE"])) - + self.expertMenuRunALocalScript = playonlinux.AddMenuItem(self.expertmenu, 108, _("Run a local script"), Variables.playonlinux_env+"/resources/images/menu/text-x-script.png") + self.expertMenuConsole = playonlinux.AddMenuItem(self.expertmenu, 109, _("{0} console").format(os.environ["APPLICATION_TITLE"]), Variables.playonlinux_env+"/resources/images/menu/polshell.png") + self.expertMenuCloseAllSoftware = playonlinux.AddMenuItem(self.expertmenu, 115, _('Close all {0} software').format(os.environ["APPLICATION_TITLE"]), Variables.playonlinux_env+"/resources/images/menu/wineserver.png") - self.optionmenu = wx.Menu() + self.expertmenu.AppendSeparator() + self.expertMenuDebugger = playonlinux.AddMenuItem(self.expertmenu, 110, _("{0} debugger").format(os.environ["APPLICATION_TITLE"]), Variables.playonlinux_env+"/resources/images/menu/software-update-available.png") - self.optionmenu.Append(221, _("Internet")) - self.optionmenu.Append(212, _("File associations")) - self.optionmenu.Append(214, _("Plugin manager")) + self.optionmenu = wx.Menu() + self.optionMenuInternet = playonlinux.AddMenuItem(self.optionmenu, 211, _("Internet"), Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png") + self.optionMenuPluginManager = playonlinux.AddMenuItem(self.optionmenu, 214, _("Plugin manager"), Variables.playonlinux_env+"/etc/onglet/internet-web-browser.png") + self.optionMenuFileAssociations = playonlinux.AddMenuItem(self.optionmenu, 212, _("File associations"), Variables.playonlinux_env+"/resources/images/menu/extensions.png") + self.optionMenuShelves = playonlinux.AddMenuItem(self.optionmenu, 215, _("Shelves"), Variables.playonlinux_env+"/etc/onglet/folder-saved-search.png") self.supportmenu = wx.Menu() - self.supportmenu.Append(400, _("Supported software")) - self.supportmenu.Append(401, _("News")) - self.supportmenu.Append(402, _("Documentation")) - self.supportmenu.Append(403, _("Forums")) - self.supportmenu.Append(404, _("Bugs")) - self.supportmenu.AppendSeparator() - self.supportmenu.Append(405, _("Twitter")) - self.supportmenu.Append(406, _("Google+")) - self.supportmenu.Append(407, _("Facebook")) - self.supportMenuSupportedSoftware = playonlinux.AddMenuItem(self.supportmenu, 400, _("Supported software"), Variables.playonlinux_env+"/resources/images/menu/emblem-favorite.png") self.supportMenuNews = playonlinux.AddMenuItem(self.supportmenu, 401, _("News"), Variables.playonlinux_env+"/resources/images/menu/internet-news-reader.png") self.supportMenuDocumentation = playonlinux.AddMenuItem(self.supportmenu, 402, _("Documentation"), Variables.playonlinux_env+"/resources/images/menu/x-office-address-book.png") self.supportMenuForums = playonlinux.AddMenuItem(self.supportmenu, 403, _("Forums"), Variables.playonlinux_env+"/etc/onglet/internet-group-chat.png") self.supportMenuBugs = playonlinux.AddMenuItem(self.supportmenu, 404, _("Bugs"), Variables.playonlinux_env+"/resources/images/menu/software-update-available.png") + + self.supportmenu.AppendSeparator() + self.supportmenu.Append(405, _("Twitter")) + self.supportmenu.Append(406, _("Google+")) + self.supportmenu.Append(407, _("Facebook")) + self.help_menu = wx.Menu() @@ -316,15 +328,19 @@ def __init__(self,parent,id,title): files=os.listdir(Variables.playonlinux_rep+"/plugins") files.sort() + self.plugin_list = [] + self.i = 0 self.j = 0 + while(self.i < len(files)): if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/scripts/menu")): if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/enabled")): self.plugin_item = wx.MenuItem(self.expertmenu, 300+self.j, files[self.i]) self.icon_look_for = Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/icon" + if(os.path.exists(self.icon_look_for)): self.bitmap = wx.Bitmap(self.icon_look_for) else: @@ -332,23 +348,22 @@ def __init__(self,parent,id,title): self.plugin_item.SetBitmap(self.bitmap) self.pluginsmenu.AppendItem(self.plugin_item) + wx.EVT_MENU(self, 300+self.j, self.run_plugin) + self.plugin_list.append(files[self.i]) self.j += 1 + self.i += 1 if(self.j > 0): self.pluginsmenu.AppendSeparator() - - - self.option_item_p = wx.MenuItem(self.pluginsmenu, 214, _("Plugin manager")) self.option_item_p.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png")) self.pluginsmenu.AppendItem(self.option_item_p) - self.last_string = "" self.sb = wx.StatusBar(self, -1 ) @@ -360,9 +375,11 @@ def __init__(self,parent,id,title): hauteur = 2; else: hauteur = 6; + self.jauge_update = wx.Gauge(self.sb, -1, 100, (self.GetSize()[0]-100, hauteur), size=(100,16)) self.jauge_update.Pulse() self.jauge_update.Hide() + self.SetStatusBar(self.sb) #self.helpmenu = wx.MenuItem() @@ -391,13 +408,16 @@ def __init__(self,parent,id,title): self.stopTool = self.toolbar.AddLabelTool(123, _("Close"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/stop.png")) self.toolbar.AddSeparator() - self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/install.png")) + + self.installTool = self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/install.png")) + self.removeTool = self.toolbar_remove = self.toolbar.AddLabelTool(wx.ID_DELETE, _("Remove"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/delete.png")) self.toolbar.AddSeparator() - self.toolbar.AddLabelTool(121, _("Configure"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/configure.png")) - try: + self.configTool = self.toolbar.AddLabelTool(121, _("Configure"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/configure.png")) + + try: self.toolbar.AddStretchableSpace() self.SpaceHack = False except: @@ -416,6 +436,7 @@ def __init__(self,parent,id,title): self.toolbar.Realize() self.Reload(self) + wx.EVT_MENU(self, wx.ID_OPEN, self.Run) wx.EVT_MENU(self, 123, self.RKill) @@ -489,7 +510,25 @@ def __init__(self,parent,id,title): wx.EVT_MENU(self, 235, self.RKill) wx.EVT_MENU(self, 236, self.ReadMe) self.Bind(wx.EVT_SIZE, self.ResizeWindow) - self._mgr.restorePosition() + self._mgr.restorePosition() + + self.toolbar.EnableTool(self.playTool.GetId(), False) + self.toolbar.EnableTool(self.stopTool.GetId(), False) + self.toolbar.EnableTool(self.removeTool.GetId(), False) + self.toolbar.EnableTool(self.configTool.GetId(), False) + + + def tree_item(self, tree, match, root): + item, cookie = tree.GetFirstChild(root) + + while item.IsOk(): + if tree.GetItemText(item) == match: + return item + if tree.ItemHasChildren(item): + if self.tree_item(tree, match, item): + return item + item, cookie = tree.GetNextChild(root, cookie) + return None def ResizeWindow(self, e): self.UpdateGaugePos() @@ -527,8 +566,7 @@ def SetupWindowAction(self, event): if(self.SetupWindowTimer_action != None): return gui_server.readAction(self) - - + def TimerAction(self, event): self.StatusRead() @@ -659,25 +697,21 @@ def runSupport(self, event): url = urlPrefix+"/forums.html" if(urlId == 4): url = urlPrefix+"/bugs.html" - if(urlId == 5): if(os.environ["POL_OS"] == "Mac"): url = "https://twitter.com/PlayOnMac" else: url = "https://twitter.com/PlayOnLinux" - if(urlId == 6): if(os.environ["POL_OS"] == "Mac"): url = "http://plus.google.com/u/0/105992880311102680198" else: url = "https://plus.google.com/+playonlinux" - if(urlId == 7): if(os.environ["POL_OS"] == "Mac"): url = "https://www.facebook.com/playonmac" else: url = "https://www.facebook.com/playonlinux" - playonlinux.POL_Open(url) @@ -694,12 +728,12 @@ def iconDisplay(self, event): self.iconSize = 48 playonlinux.SetSettings("ICON_SIZE",str(self.iconSize)) + self.list_game.SetImageList(self.imagesEmpty) self.images.Destroy() self.images = wx.ImageList(self.iconSize, self.iconSize) self.list_game.SetImageList(self.images) - self.Reload(self) def UpdateInstructions(self, event): @@ -736,18 +770,28 @@ def ChangeIcon(self, event): def Select(self, event): game_exec = self.GetSelectedProgram() - self.read = open(Variables.playonlinux_rep+"shortcuts/"+game_exec,"r").readlines() - self.i = 0; - self.wine_present = False; - while(self.i < len(self.read)): - if("wine " in self.read[self.i]): - self.wine_present = True; - self.i += 1 - - self.generate_menu(game_exec) - self.playTool.Enable(True) - self.stopTool.Enable(True) - self.removeTool.Enable(True) + if (game_exec != ""): + self.read = open(Variables.playonlinux_rep+"shortcuts/"+game_exec,"r").readlines() + self.i = 0; + self.wine_present = False; + while(self.i < len(self.read)): + if("wine " in self.read[self.i]): + self.wine_present = True; + self.i += 1 + + self.generate_menu(game_exec) + + self.toolbar.EnableTool(self.playTool.GetId(), True) + self.toolbar.EnableTool(self.stopTool.GetId(), True) + self.toolbar.EnableTool(self.removeTool.GetId(), True) + self.toolbar.EnableTool(self.configTool.GetId(), True) + else: + self.generate_menu("") + + self.toolbar.EnableTool(self.playTool.GetId(), False) + self.toolbar.EnableTool(self.stopTool.GetId(), False) + self.toolbar.EnableTool(self.removeTool.GetId(), False) + self.toolbar.EnableTool(self.configTool.GetId(), False) def generate_menu(self, shortcut=None): for c in self.menuElem: @@ -770,12 +814,13 @@ def generate_menu(self, shortcut=None): i+=1 self.menuGaucheAddLink("pol_prgm_settings", _("Settings"), i,Variables.playonlinux_env+"/resources/images/menu/settings.png",self.Options) - i = 0; - self.menuGaucheAddTitle("pol_title", os.environ["APPLICATION_TITLE"], i) - i+=1 - self.menuGaucheAddLink("pol_prgm_install", _("Install a program"), i,Variables.playonlinux_env+"/resources/images/menu/add.png",self.InstallMenu) - i+=1 - self.menuGaucheAddLink("pol_prgm_settings", _("Settings"), i,Variables.playonlinux_env+"/resources/images/menu/settings.png",self.Options) + if (shortcut != None and shortcut != ""): + if(os.path.exists(os.environ["PLAYONLINUX"]+"/.git/")): + i+=1 + self.menuGaucheAddLink("pol_git", _("Update GIT"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateGIT) + elif "POL_UPTODATE" in os.environ and os.environ["POL_UPTODATE"] == "FALSE": + i+=1 + self.menuGaucheAddLink("pol_update", _("Update instructions"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateInstructions) if(shortcut != None): i+=2 @@ -787,7 +832,13 @@ def generate_menu(self, shortcut=None): i+=1 self.menuGaucheAddLink("pol_prgm_rundebug", _("Debug"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.RunDebug) i+=1 - self.menuGaucheAddLink("pol_prgm_reportproblem", _("Report a problem"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.ReportProblem) + + game_exec = self.GetSelectedProgram() + game_log = playonlinux.getLog(game_exec) + if(game_log): + i+=1 + self.menuGaucheAddLink("pol_prgm_reportproblem", _("Send a feedback"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.sendfeedback) + i+=1 self.menuGaucheAddLink("pol_prgm_configure", _("Configure"), i,Variables.playonlinux_env+"/resources/images/menu/run.png",self.Configure) i+=1 @@ -795,73 +846,44 @@ def generate_menu(self, shortcut=None): i+=1 self.menuGaucheAddLink("pol_prgm_adddir", _("Open the directory"), i,Variables.playonlinux_env+"/resources/images/menu/folder-wine.png",self.GoToAppDir) - if(os.path.exists(os.environ["PLAYONLINUX"]+"/.git/")): - i+=1 - self.menuGaucheAddLink("pol_git", _("Update GIT"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateGIT) - elif "POL_UPTODATE" in os.environ and os.environ["POL_UPTODATE"] == "FALSE": - i+=1 - self.menuGaucheAddLink("pol_update", _("Update instructions"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateInstructions) - - if(shortcut != None): - i+=2 - self.menuGaucheAddTitle("prgm_title", shortcut, i) - i+=1 - self.menuGaucheAddLink("pol_prgm_run", _("Run"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-start.png",self.Run) - i+=1 - self.menuGaucheAddLink("pol_prgm_kill", _("Close"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-stop.png",self.RKill) - i+=1 - self.menuGaucheAddLink("pol_prgm_rundebug", _("Debug"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.RunDebug) - - game_exec = self.GetSelectedProgram() - game_log = playonlinux.getLog(game_exec) - if(game_log): - i+=1 - self.menuGaucheAddLink("pol_prgm_reportproblem", _("Send a feedback"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.sendfeedback) - - i+=1 - self.menuGaucheAddLink("pol_prgm_configure", _("Configure"), i,Variables.playonlinux_env+"/resources/images/menu/run.png",self.Configure) - i+=1 - self.menuGaucheAddLink("pol_prgm_shortcut", _("Create a shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.Package) - i+=1 - self.menuGaucheAddLink("pol_prgm_adddir", _("Open the directory"), i,Variables.playonlinux_env+"/resources/images/menu/folder-wine.png",self.GoToAppDir) - - if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+shortcut)): - i+=1 - self.menuGaucheAddLink("pol_prgm_readme", _("Read the manual"), i,Variables.playonlinux_env+"/resources/images/menu/manual.png",self.ReadMe) + if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+shortcut)): + i+=1 + self.menuGaucheAddLink("pol_prgm_readme", _("Read the manual"), i,Variables.playonlinux_env+"/resources/images/menu/manual.png",self.ReadMe) - i+=1 - self.menuGaucheAddLink("pol_prgm_uninstall", _("Uninstall"), i,Variables.playonlinux_env+"/resources/images/menu/window-close.png",self.UninstallGame) + i+=1 + self.menuGaucheAddLink("pol_prgm_uninstall", _("Uninstall"), i,Variables.playonlinux_env+"/resources/images/menu/window-close.png",self.UninstallGame) + + if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+shortcut)): + i+=1 + self.menuGaucheAddLink("pol_prgm_readme", _("Read the manual"), i,Variables.playonlinux_env+"/resources/images/menu/manual.png",self.ReadMe) + + self.linksfile = os.environ["POL_USER_ROOT"]+"/configurations/links/"+shortcut + if(os.path.exists(self.linksfile)): + self.linksc = open(self.linksfile,"r").read().split("\n") + for line in self.linksc: + if("|" in line): + line = line.split("|") + i+=1 + if("PROFILEBUTTON/" in line[0]): + line[0] = line[0].replace("PROFILEBUTTON/","") self.menuGaucheAddLink("url_"+str(i), line[0], i,Variables.playonlinux_env+"/resources/images/menu/star.png",None,line[1]) - self.linksfile = os.environ["POL_USER_ROOT"]+"/configurations/links/"+shortcut - if(os.path.exists(self.linksfile)): - self.linksc = open(self.linksfile,"r").read().split("\n") - for line in self.linksc: - if("|" in line): - line = line.split("|") - i+=1 - if("PROFILEBUTTON/" in line[0]): - line[0] = line[0].replace("PROFILEBUTTON/","") - - self.menuGaucheAddLink("url_"+str(i), line[0], i,Variables.playonlinux_env+"/resources/images/menu/star.png",None,line[1]) + icon = os.environ["POL_USER_ROOT"]+"/icones/full_size/"+shortcut - icon = os.environ["POL_USER_ROOT"]+"/icones/full_size/"+shortcut - - - if(os.path.exists(icon)): - try: - self.bitmap = wx.Image(icon) - if(self.bitmap.GetWidth() >= 48): - self.bitmap.Rescale(48,48,wx.IMAGE_QUALITY_HIGH) - self.bitmap = self.bitmap.ConvertToBitmap() - self.menuBitmap = wx.StaticBitmap(self.menu_gauche, id=-1, bitmap=self.bitmap, pos=(left_pos,20+(i+2)*20)) - except: - pass + if(os.path.exists(icon)): + try: + self.bitmap = wx.Image(icon) + if(self.bitmap.GetWidth() >= 48): + self.bitmap.Rescale(48,48,wx.IMAGE_QUALITY_HIGH) + self.bitmap = self.bitmap.ConvertToBitmap() + self.menuBitmap = wx.StaticBitmap(self.menu_gauche, id=-1, bitmap=self.bitmap, pos=(left_pos,20+(i+2)*20)) + except: + pass def menuGaucheAddTitle(self,id,text,pos): self.menuElem[id] = wx.StaticText(self.menu_gauche, -1, text,pos=(5,5+pos*20)) - self.menuElem[id].SetForegroundColour((0,0,0)) # For dark themes + self.menuElem[id].SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.menuElem[id].SetFont(self.fontTitre) @@ -885,16 +907,11 @@ def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): self.menuElem[id].AutoBrowse(False) else: self.menuElem[id] = wx.lib.hyperlink.HyperLinkCtrl(self.menu_gauche, 10000+pos, text, pos=(35,15+pos*20)) - self.menuElem[id].setURL(url) + self.menuElem[id].setURL(url) - self.menuElem[id].SetColours(wx.Colour(0,0,0),wx.Colour(0,0,0),wx.Colour(0,0,0)) self.menuElem[id].UpdateLink(True) - #self.menuElem[id].SetVisited(False) - #self.menuElem[id].SetNormalColour(wx.Colour(0,0,0)) - #self.menuElem[id].SetVisitedColour(wx.Colour(0,0,0)) - #self.menuElem[id].SetHoverColour(wx.Colour(100,100,100)) + self.menuElem[id].SetColours(playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour(),playonlinux.get_foreground_hover_colour()) - if(evt != None): wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 10000+pos, evt) @@ -915,7 +932,8 @@ def Reload(self, event): self.list_game.DeleteAllItems() self.images.RemoveAll() - root = self.list_game.AddRoot("") + self.rootnode = self.list_game.AddRoot("Your games") + self.i = 0 if(self.iconSize <= 32): self.iconFolder = "32"; @@ -937,7 +955,21 @@ def Reload(self, event): except: pass - item = self.list_game.AppendItem(root, game, self.i) + prefix = re.search('^[a-z A-Z 0-9]*[ ]{1}[-]{1}[ ]{1}', game) + + matchingitem = None + + if ((prefix is not None) and (prefix.group() is not None)): + prefix = prefix.group()[:-3] + matchingitem = self.tree_item(self.list_game, prefix, self.rootnode) + + if (matchingitem != None): + itemid = self.list_game.AppendItem(matchingitem, game, self.i) + else: + itemid = self.list_game.AppendItem(self.rootnode, game, self.i) + + self.list_game.SetItemFont(itemid, wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT)) + self.i += 1 self.list_game.Expand(self.rootnode); @@ -996,33 +1028,36 @@ def POLOnline(self, event): def PCCd(self, event): subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/read_pc_cd"]) - def PolShell(self, event): - #Variables.run_x_server() + def PolShell(self, event): #Variables.run_x_server() subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/expert/PolShell"]) def Configure(self, event): game_exec = self.GetSelectedProgram() - try: - self.configureFrame.Show(True) - self.configureFrame.SetFocus() - if(game_exec != ""): - self.configureFrame.change_program(game_exec,False) + + if (game_exec != ""): + try: + self.configureFrame.Show(True) + self.configureFrame.SetFocus() + if(game_exec != ""): + self.configureFrame.change_program(game_exec,False) - except: - if(game_exec == ""): - self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),"default",True) - else: - self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),game_exec.decode("utf-8","replace"),False) + except: + if(game_exec == ""): + self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),"default",True) + else: + self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),game_exec.decode("utf-8","replace"),False) - self.configureFrame.Center(wx.BOTH) - self.configureFrame.Show(True) + self.configureFrame.Center(wx.BOTH) + self.configureFrame.Show(True) #subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/polconfigurator", game_exec]) def Package(self, event): game_exec = self.GetSelectedProgram() - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/make_shortcut", game_exec]) + + if (game_exec != ""): + subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/make_shortcut", game_exec]) def UninstallGame(self, event): game_exec = self.GetSelectedProgram() @@ -1057,33 +1092,38 @@ def WineVersion(self, event): self.wversion.Show(True) def GetSelectedProgram(self): - return self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8","replace") + if (self.list_game.GetSelection() != self.rootnode): + return self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8","replace") + else: + return "" def Run(self, event, s_debug=False): game_exec = self.GetSelectedProgram() - game_prefix = playonlinux.getPrefix(game_exec) - - if(s_debug == False): - playonlinux.SetDebugState(game_exec, game_prefix, False) - - 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() - - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/run_app", game_exec]) - else: - wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) - else: - wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"]) + + if (game_exec != ""): + game_prefix = playonlinux.getPrefix(game_exec) + + if(s_debug == False): + playonlinux.SetDebugState(game_exec, game_prefix, False) + + 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() + + subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/run_app", game_exec]) + else: + wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) + else: + wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"]) def RunDebug(self, event): game_exec = self.GetSelectedProgram() From 2ddb1310b98232340e1b0442489d1a7336a31be1 Mon Sep 17 00:00:00 2001 From: TFK Date: Thu, 11 Sep 2014 21:03:08 +0200 Subject: [PATCH 17/18] Backup file deleted. T. --- python/mainwindow.py.orig | 1324 ------------------------------------- 1 file changed, 1324 deletions(-) delete mode 100755 python/mainwindow.py.orig diff --git a/python/mainwindow.py.orig b/python/mainwindow.py.orig deleted file mode 100755 index 58147dfe2..000000000 --- a/python/mainwindow.py.orig +++ /dev/null @@ -1,1324 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Copyright (C) 2008 Pâris Quentin -# Copyright (C) 2007-2057 PlayOnLinux team - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -encoding = 'utf-8' - -import os, getopt, sys, urllib, signal, string, time, webbrowser, gettext, locale, sys, shutil, subprocess - -try : - os.environ["POL_OS"] -except : - print "ERROR ! Please define POL_OS environment var first." - os._exit(1) - -if(os.environ["POL_OS"] != "Mac"): - import wxversion - wxversion.ensureMinimal('2.8') - -import wx, wx.aui -import lib.lng as lng -import lib.playonlinux as playonlinux, lib.Variables as Variables -import guiv3 as gui, install, options, wine_versions as wver, sp, configure, threading, debug, gui_server - -# This thread manage updates -class POLWeb(threading.Thread): - def __init__(self): - threading.Thread.__init__(self) - self.sendToStatusBarStr = "" - self.sendAlertStr = None - self.Gauge = False - self.WebVersion = "" - self.Show = False - self.perc = -1 - self.updating = True - def sendToStatusBar(self, message, gauge): - self.sendToStatusBarStr = message - self.Gauge = gauge - self.Show = True - - def sendPercentage(self, n): - self.perc = n - - def sendAlert(self, message): - self.sendAlertStr = message - - def LastVersion(self): - if(os.environ["POL_OS"] == "Mac"): - fichier_online="version_mac" - elif(os.environ["POL_OS"] == "FreeBSD"): - fichier_online="version_freebsd" - else: - fichier_online="version2" - return os.popen(os.environ["POL_WGET"]+' "'+os.environ["SITE"]+'/'+fichier_online+'.php?v='+os.environ["VERSION"]+'" -T 30 -O-','r').read() - - def real_check(self): - self.WebVersion = self.LastVersion() - - if(self.WebVersion == ""): - self.sendToStatusBar(_('{0} website is unavailable. Please check your connection').format(os.environ["APPLICATION_TITLE"]), False) - else: - self.sendToStatusBar(_("Refreshing {0}").format(os.environ["APPLICATION_TITLE"]), True) - self.sendPercentage(0) - self.updating = True - exe = ['bash',Variables.playonlinux_env+"/bash/pol_update_list"] - - p = subprocess.Popen(exe, stdout=subprocess.PIPE, bufsize=1, preexec_fn=lambda: os.setpgid(os.getpid(), os.getpid())) - - for line in iter(p.stdout.readline, ''): - try: - self.sendPercentage(int(line)) - except ValueError: - pass - - self.updating = False - if(playonlinux.VersionLower(os.environ["VERSION"],self.WebVersion)): - self.sendToStatusBar(_('An updated version of {0} is available').format(os.environ["APPLICATION_TITLE"])+" ("+self.WebVersion+")",False) - if(os.environ["DEBIAN_PACKAGE"] == "FALSE"): - self.sendAlert(_('An updated version of {0} is available').format(os.environ["APPLICATION_TITLE"])+" ("+self.WebVersion+")") - os.environ["POL_UPTODATE"] = "FALSE" - else: - self.Show = False - self.perc = -1 - os.environ["POL_UPTODATE"] = "TRUE" - - self.wantcheck = False - - def check(self): - self.wantcheck = True - - def run(self): - self.check() - while(1): - if(self.wantcheck == True): - self.real_check() - time.sleep(1) - -class PanelManager(wx.aui.AuiManager): - - def __init__(self, frame): - wx.aui.AuiManager.__init__(self, frame) - self.startPerspective = self.SavePerspective() - - - def _getPerspectiveName(self): - name = self.SavePerspective().split("=") - name = name[1].split(";") - name = name[0] - return name - - def getPerspective(self): - return self.SavePerspective().replace(self._getPerspectiveName(),"PERSPECTIVE_NAME") - - def savePosition(self): - playonlinux.SetSettings("PANEL_PERSPECTIVE", self.getPerspective()) - - def restorePosition(self): - self.startPerspective = self.SavePerspective() - - self.Update() - - try: - setting = playonlinux.GetSettings("PANEL_PERSPECTIVE") - if(setting.count("Actions") < 2 or setting.count("dock_size") < 2 or not "PERSPECTIVE_NAME" in setting): - self.LoadPerspective(self.startPerspective) - else: - setting = setting.replace("PERSPECTIVE_NAME",self._getPerspectiveName()) - if(setting != ""): - self.LoadPerspective(setting) - - except wx._core.PyAssertionError: - self.LoadPerspective(self.startPerspective) - - - self.Update() - - def AddPane(self, data, settings): - wx.aui.AuiManager.AddPane(self, data, settings) - - def Destroy(self): - self.savePosition() - -class MainWindow(wx.Frame): - def __init__(self,parent,id,title): - - wx.Frame.__init__(self, parent, 1000, title, size = (515,450)) - self.SetMinSize((400,400)) - self.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) - - self.windowList = {} - self.registeredPid = [] - self.windowOpened = 0 - - # Manage updater - self.updater = POLWeb() - self.updater.start() - - # These lists contain the dock links and images - self.menuElem = {} - self.menuImage = {} - - # Catch CTRL+C - signal.signal(signal.SIGINT, self.ForceClose) - - # Window size - try: - self.windowWidth = int(playonlinux.GetSettings("MAINWINDOW_WIDTH")) - self.windowHeight = int(playonlinux.GetSettings("MAINWINDOW_HEIGHT")) - self.SetSize((self.windowWidth,self.windowHeight)) - except: - self.windowWidth = 500 - self.windowHeight = 450 - - # Window position - try: - self.windowx = int(playonlinux.GetSettings("MAINWINDOW_X")) - self.windowy = int(playonlinux.GetSettings("MAINWINDOW_Y")) - self.screen_width = wx.Display().GetGeometry()[2] - self.screen_height = wx.Display().GetGeometry()[3] - - if(self.screen_width >= self.windowx and self.screen_height >= self.windowy): - self.SetPosition((self.windowx, self.windowy)) - else: - self.Center(wx.BOTH) - except: - self.Center(wx.BOTH) - - - try: self.iconSize = int(playonlinux.GetSettings("ICON_SIZE")) - except: self.iconSize = 32 - - self.images = wx.ImageList(self.iconSize, self.iconSize) - self.imagesEmpty = wx.ImageList(1,1) - - - self.sendAlertStr = None - - ## Fonts - if(os.environ["POL_OS"] == "Mac"): - self.fontTitre = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) - self.fontText = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT) - else : - self.fontTitre = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) - self.fontText = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL,False, "", wx.FONTENCODING_DEFAULT) - - - ## List game - self.list_game = wx.TreeCtrl(self, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT) - self.list_game.SetSpacing(0); - self.list_game.SetIndent(5); - self.list_game.SetImageList(self.images) - self.menu_gauche = wx.Panel(self,-1) - - self._mgr = PanelManager(self) - self._mgr.AddPane(self.list_game, wx.CENTER) - self._mgr.AddPane(self.menu_gauche, wx.aui.AuiPaneInfo().Name('Actions').Caption('Actions').Left().BestSize((200,400)).Floatable(True).CloseButton(False).TopDockable(False).BottomDockable(False)) - - - - self.filemenu = wx.Menu() - ### On MacOS X, preference is always on the main menu - if(os.environ["POL_OS"] == "Mac"): - prefItem = self.filemenu.Append(wx.ID_PREFERENCES, text = "&Preferences") - self.Bind(wx.EVT_MENU, self.Options, prefItem) - - ### File menu - self.filemenu.Append(wx.ID_OPEN, _("Run")) - self.filemenu.Append(wx.ID_ADD, _("Install")) - self.filemenu.Append(wx.ID_DELETE, _("Remove")) - self.filemenu.AppendSeparator() - self.filemenu.Append(216, _("Donate")) - self.filemenu.Append(wx.ID_EXIT, _("Exit")) - - ### Display menu - self.displaymenu = wx.Menu() - self.icon16 = self.displaymenu.AppendRadioItem(501, _("Small icons")) - self.icon24 = self.displaymenu.AppendRadioItem(502, _("Medium icons")) - self.icon32 = self.displaymenu.AppendRadioItem(503, _("Large icons")) - self.icon48 = self.displaymenu.AppendRadioItem(504, _("Very large icons")) - if(self.iconSize == 16): - self.icon16.Check(True) - if(self.iconSize == 24): - self.icon24.Check(True) - if(self.iconSize == 32): - self.icon32.Check(True) - if(self.iconSize == 48): - self.icon48.Check(True) - - self.expertmenu = wx.Menu() - - self.expertmenu.Append(107, _("Manage Wine versions")) - - - if(os.environ["POL_OS"] == "Mac"): - self.expertmenu.AppendSeparator() - self.expertmenu.Append(113, _("Read a PC CD-Rom")) - - self.expertmenu.AppendSeparator() - - self.expertmenu.Append(108, _("Run a local script")) - self.expertmenu.Append(109, _("{0} console").format(os.environ["APPLICATION_TITLE"])) - - self.expertmenu.Append(115, _('Close all {0} software').format(os.environ["APPLICATION_TITLE"])) - self.expertmenu.AppendSeparator() - - self.expertmenu.Append(110, _("{0} debugger").format(os.environ["APPLICATION_TITLE"])) - - - self.optionmenu = wx.Menu() - - - self.optionmenu.Append(221, _("Internet")) - self.optionmenu.Append(212, _("File associations")) - self.optionmenu.Append(214, _("Plugin manager")) - - - self.supportmenu = wx.Menu() - self.supportmenu.Append(400, _("Supported software")) - self.supportmenu.Append(401, _("News")) - self.supportmenu.Append(402, _("Documentation")) - self.supportmenu.Append(403, _("Forums")) - self.supportmenu.Append(404, _("Bugs")) - self.supportmenu.AppendSeparator() - self.supportmenu.Append(405, _("Twitter")) - self.supportmenu.Append(406, _("Google+")) - self.supportmenu.Append(407, _("Facebook")) - - - self.help_menu = wx.Menu() - self.help_menu.Append(wx.ID_ABOUT, _('About {0}').format(os.environ["APPLICATION_TITLE"])) - self.pluginsmenu = wx.Menu() - - files=os.listdir(Variables.playonlinux_rep+"/plugins") - files.sort() - self.plugin_list = [] - self.i = 0 - self.j = 0 - while(self.i < len(files)): - if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/scripts/menu")): - if(os.path.exists(Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/enabled")): - self.plugin_item = wx.MenuItem(self.expertmenu, 300+self.j, files[self.i]) - - self.icon_look_for = Variables.playonlinux_rep+"/plugins/"+files[self.i]+"/icon" - if(os.path.exists(self.icon_look_for)): - self.bitmap = wx.Bitmap(self.icon_look_for) - else: - self.bitmap = wx.Bitmap(Variables.playonlinux_env+"/etc/playonlinux16.png") - - self.plugin_item.SetBitmap(self.bitmap) - self.pluginsmenu.AppendItem(self.plugin_item) - wx.EVT_MENU(self, 300+self.j, self.run_plugin) - self.plugin_list.append(files[self.i]) - self.j += 1 - self.i += 1 - - if(self.j > 0): - self.pluginsmenu.AppendSeparator() - - - - - self.option_item_p = wx.MenuItem(self.pluginsmenu, 214, _("Plugin manager")) - self.option_item_p.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png")) - - self.pluginsmenu.AppendItem(self.option_item_p) - - - self.last_string = "" - - self.sb = wx.StatusBar(self, -1 ) - self.sb.SetFieldsCount(2) - self.sb.SetStatusWidths([self.GetSize()[0], -1]) - self.sb.SetStatusText("", 0) - - if(os.environ["POL_OS"] == "Mac"): - hauteur = 2; - else: - hauteur = 6; - self.jauge_update = wx.Gauge(self.sb, -1, 100, (self.GetSize()[0]-100, hauteur), size=(100,16)) - self.jauge_update.Pulse() - self.jauge_update.Hide() - self.SetStatusBar(self.sb) - - #self.helpmenu = wx.MenuItem() - #self.helpmenu.Append(wx.ID_ABOUT, _("About")) - - self.menubar = wx.MenuBar() - self.menubar.Append(self.filemenu, _("File")) - self.menubar.Append(self.displaymenu, _("Display")) - self.menubar.Append(self.expertmenu, _("Tools")) - self.menubar.Append(self.optionmenu, _("Settings")) - self.menubar.Append(self.pluginsmenu, _("Plugins")) - self.menubar.Append(self.supportmenu, _("Support")) - self.menubar.Append(self.help_menu, "&Help") - - #self.menubar.Append(self.help_menu, _("About")) - - self.SetMenuBar(self.menubar) - iconSize = (32,32) - - self.toolbar = self.CreateToolBar(wx.TB_TEXT) - self.toolbar.SetToolBitmapSize(iconSize) - self.searchbox = wx.SearchCtrl( self.toolbar, 124, style=wx.RAISED_BORDER ) - self.playTool = self.toolbar.AddLabelTool(wx.ID_OPEN, _("Run"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/play.png")) - self.stopTool = self.toolbar.AddLabelTool(123, _("Close"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/stop.png")) - - self.toolbar.AddSeparator() - self.toolbar.AddLabelTool(wx.ID_ADD, _("Install"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/install.png")) - self.removeTool = self.toolbar_remove = self.toolbar.AddLabelTool(wx.ID_DELETE, _("Remove"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/delete.png")) - self.toolbar.AddSeparator() - self.toolbar.AddLabelTool(121, _("Configure"), wx.Bitmap(Variables.playonlinux_env+"/resources/images/toolbar/configure.png")) - - try: - self.toolbar.AddStretchableSpace() - self.SpaceHack = False - except: - # wxpython 2.8 does not support AddStretchableSpace(). This is a dirty workaround for this. - self.dirtyHack = wx.StaticText(self.toolbar) - self.SpaceHack = True - self.toolbar.AddControl( self.dirtyHack ) - self.UpdateSearchHackSize() - - try: - self.toolbar.AddControl( self.searchbox , _("Search")) - except: - self.toolbar.AddControl( self.searchbox ) - self.searchbox.SetDescriptiveText(_("Search")) - - - self.toolbar.Realize() - self.Reload(self) - wx.EVT_MENU(self, wx.ID_OPEN, self.Run) - wx.EVT_MENU(self, 123, self.RKill) - - wx.EVT_MENU(self, wx.ID_ADD, self.InstallMenu) - wx.EVT_MENU(self, wx.ID_ABOUT, self.About) - wx.EVT_MENU(self, wx.ID_EXIT, self.ClosePol) - wx.EVT_MENU(self, wx.ID_DELETE, self.UninstallGame) - - # Display - wx.EVT_MENU(self, 501, self.iconDisplay) - wx.EVT_MENU(self, 502, self.iconDisplay) - wx.EVT_MENU(self, 503, self.iconDisplay) - wx.EVT_MENU(self, 504, self.iconDisplay) - - # Expert - wx.EVT_MENU(self, 101, self.Reload) - wx.EVT_MENU(self, 107, self.WineVersion) - wx.EVT_MENU(self, 108, self.Executer) - wx.EVT_MENU(self, 109, self.PolShell) - wx.EVT_MENU(self, 110, self.BugReport) - wx.EVT_MENU(self, 112, self.POLOnline) - wx.EVT_MENU(self, 113, self.PCCd) - wx.EVT_MENU(self, 115, self.killall) - wx.EVT_MENU(self, 121, self.Configure) - wx.EVT_MENU(self, 122, self.Package) - wx.EVT_TEXT(self, 124, self.Reload) - - #Options - wx.EVT_MENU(self, 210, self.Options) - wx.EVT_MENU(self, 211, self.Options) - wx.EVT_MENU(self, 212, self.Options) - wx.EVT_MENU(self, 213, self.Options) - wx.EVT_MENU(self, 214, self.Options) - wx.EVT_MENU(self, 215, self.Options) - - wx.EVT_MENU(self, 216, self.donate) - - wx.EVT_CLOSE(self, self.ClosePol) - wx.EVT_TREE_ITEM_ACTIVATED(self, 105, self.Run) - wx.EVT_TREE_SEL_CHANGED(self, 105, self.Select) - - # Support - wx.EVT_MENU(self, 400, self.runSupport) - wx.EVT_MENU(self, 401, self.runSupport) - wx.EVT_MENU(self, 402, self.runSupport) - wx.EVT_MENU(self, 403, self.runSupport) - wx.EVT_MENU(self, 404, self.runSupport) - - # PlayOnLinux main timer - self.timer = wx.Timer(self, 1) - self.Bind(wx.EVT_TIMER, self.TimerAction, self.timer) - self.timer.Start(1000) - self.Timer_LastShortcutList = None - self.Timer_LastIconList = None - - # SetupWindow timer. The server is in another thread and GUI must be run from the main thread - self.SetupWindowTimer = wx.Timer(self, 2) - self.Bind(wx.EVT_TIMER, self.SetupWindowAction, self.SetupWindowTimer) - self.SetupWindowTimer_action = None - self.SetupWindowTimer.Start(100) - self.SetupWindowTimer_delay = 100 - - #Pop-up menu for game list: beginning - wx.EVT_TREE_ITEM_MENU(self, 105, self.RMBInGameList) - wx.EVT_MENU(self, 230, self.RWineConfigurator) - wx.EVT_MENU(self, 231, self.RRegistryEditor) - wx.EVT_MENU(self, 232, self.GoToAppDir) - wx.EVT_MENU(self, 233, self.ChangeIcon) - wx.EVT_MENU(self, 234, self.UninstallGame) - wx.EVT_MENU(self, 235, self.RKill) - wx.EVT_MENU(self, 236, self.ReadMe) - self.Bind(wx.EVT_SIZE, self.ResizeWindow) - self._mgr.restorePosition() - - def ResizeWindow(self, e): - self.UpdateGaugePos() - self.UpdateSearchHackSize() - - def UpdateSearchHackSize(self): - if(self.SpaceHack == True): - self.dirtyHack.SetLabel("") - self.dirtyHack.SetSize((50,1)) - - def UpdateGaugePos(self): - if(os.environ["POL_OS"] == "Mac"): - hauteur = 2; - else: - hauteur = 6; - self.jauge_update.SetPosition((self.GetSize()[0]-100, hauteur)) - - def SetupWindowTimer_SendToGui(self, recvData): - recvData = recvData.split("\t") - while(self.SetupWindowTimer_action != None): - time.sleep(0.1) - self.SetupWindowTimer_action = recvData - - def SetupWindow_TimerRestart(self, time): - if(time != self.SetupWindowTimer_delay): - self.SetupWindowTimer.Stop() - self.SetupWindowTimer.Start(time) - self.SetupWindowTimer_delay = time - - def SetupWindowAction(self, event): - if(self.windowOpened == 0): - self.SetupWindow_TimerRestart(100) - else: - self.SetupWindow_TimerRestart(10) - - if(self.SetupWindowTimer_action != None): - return gui_server.readAction(self) - - - def TimerAction(self, event): - self.StatusRead() - - # We read shortcut folder to see if it has to be rescanned - currentShortcuts = os.path.getmtime(Variables.playonlinux_rep+"/shortcuts") - currentIcons = os.path.getmtime(Variables.playonlinux_rep+"/icones/32") - if(currentShortcuts != self.Timer_LastShortcutList or currentIcons != self.Timer_LastIconList): - self.Reload(self) - self.Timer_LastShortcutList = currentShortcuts - self.Timer_LastIconList = currentIcons - - def StatusRead(self): - self.sb.SetStatusText(self.updater.sendToStatusBarStr, 0) - if(self.updater.Gauge == True): - perc = self.updater.perc - if(perc == -1): - self.jauge_update.Pulse() - else: - try: - self.installFrame.percentageText.SetLabel(str(perc)+" %") - except: - pass - self.jauge_update.SetValue(perc) - self.jauge_update.Show() - else: - self.jauge_update.Hide() - - if(self.updater.updating == True): - self.sb.Show() - try: - self.installFrame.panelItems.Hide() - self.installFrame.panelManual.Hide() - self.installFrame.panelWait.Show() - try: - if(self.playing == False): - self.installFrame.animation_wait.Play() - self.playing = True - except: - self.playing = False - except: - pass - else: - self.sb.Hide() - try: - if(self.installFrame.currentPanel == 1): - self.installFrame.panelManual.Show() - else: - self.installFrame.panelItems.Show() - self.installFrame.panelWait.Hide() - self.installFrame.animation_wait.Stop() - self.playing = False - self.installFrame.Refresh() - except: - pass - - if(self.updater.sendAlertStr != self.sendAlertStr): - wx.MessageBox(self.updater.sendAlertStr, os.environ["APPLICATION_TITLE"]) - self.sendAlertStr = self.updater.sendAlertStr - - def RMBInGameList(self, event): - self.GameListPopUpMenu = wx.Menu() - - self.ConfigureWine = wx.MenuItem(self.GameListPopUpMenu, 230, _("Configure Wine")) - self.ConfigureWine.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/run.png")) - self.GameListPopUpMenu.AppendItem(self.ConfigureWine) - - self.RegistryEditor = wx.MenuItem(self.GameListPopUpMenu, 231, _("Registry Editor")) - self.RegistryEditor.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/regedit.png")) - self.GameListPopUpMenu.AppendItem(self.RegistryEditor) - - self.GotoAppDir = wx.MenuItem(self.GameListPopUpMenu, 232, _("Open the application's directory")) - self.GotoAppDir.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/folder-wine.png")) - self.GameListPopUpMenu.AppendItem(self.GotoAppDir) - - self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 236, _("Read the manual")) - self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/manual.png")) - self.GameListPopUpMenu.AppendItem(self.ChangeIcon) - - self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 233, _("Set the icon")) - self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/change_icon.png")) - self.GameListPopUpMenu.AppendItem(self.ChangeIcon) - - self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 234, _("Remove")) - self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/delete.png")) - self.GameListPopUpMenu.AppendItem(self.ChangeIcon) - - self.ChangeIcon = wx.MenuItem(self.GameListPopUpMenu, 235, _("Close this application")) - self.ChangeIcon.SetBitmap(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/media-playback-stop.png")) - self.GameListPopUpMenu.AppendItem(self.ChangeIcon) - - self.PopupMenu(self.GameListPopUpMenu, event.GetPoint()) - - - def RWineConfigurator(self, event): - self.RConfigure(_("Configure Wine"), "nothing") - - def RKill(self, event): - self.RConfigure(_("KillApp"), "nothing") - - def ReadMe(self, event): - game_exec = self.GetSelectedProgram() - if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+game_exec)): - playonlinux.POL_Open(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+game_exec) - else: - wx.MessageBox(_("No manual found for {0}").format(game_exec), os.environ["APPLICATION_TITLE"]) - - def RRegistryEditor(self, event): - self.RConfigure(_("Registry Editor"), "nothing") - - def run_plugin(self, event): - game_exec = self.GetSelectedProgram() - plugin=self.plugin_list[event.GetId()-300] - try : - subprocess.Popen(["bash", Variables.playonlinux_rep+"/plugins/"+plugin+"/scripts/menu", game_exec]) - except : - pass - - def runSupport(self, event): - urlId = event.GetId()-400 - urlPrefix = "http://www."+os.environ["POL_DNS"]+"/en" - if(urlId == 0): - url = urlPrefix+"/supported_apps.html" - if(urlId == 1): - url = urlPrefix+"/news.html" - if(urlId == 2): - url = urlPrefix+"/documentation.html" - if(urlId == 3): - url = urlPrefix+"/forums.html" - if(urlId == 4): - url = urlPrefix+"/bugs.html" - - if(urlId == 5): - if(os.environ["POL_OS"] == "Mac"): - url = "https://twitter.com/PlayOnMac" - else: - url = "https://twitter.com/PlayOnLinux" - - if(urlId == 6): - if(os.environ["POL_OS"] == "Mac"): - url = "http://plus.google.com/u/0/105992880311102680198" - else: - url = "https://plus.google.com/+playonlinux" - - if(urlId == 7): - if(os.environ["POL_OS"] == "Mac"): - url = "https://www.facebook.com/playonmac" - else: - url = "https://www.facebook.com/playonlinux" - - - playonlinux.POL_Open(url) - - def iconDisplay(self, event): - iconEvent=event.GetId() - - if(iconEvent == 501): - self.iconSize = 16 - if(iconEvent == 502): - self.iconSize = 24 - if(iconEvent == 503): - self.iconSize = 32 - if(iconEvent == 504): - self.iconSize = 48 - - playonlinux.SetSettings("ICON_SIZE",str(self.iconSize)) - self.list_game.SetImageList(self.imagesEmpty) - self.images.Destroy() - self.images = wx.ImageList(self.iconSize, self.iconSize) - self.list_game.SetImageList(self.images) - - - self.Reload(self) - - def UpdateInstructions(self, event): - if(os.environ["POL_OS"] == "Mac"): - webbrowser.open("http://www.playonmac.com/en/download.html") - else: - webbrowser.open("http://www.playonlinux.com/en/download.html") - - def UpdateGIT(self, event): - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/update_git"]) - - - def GoToAppDir(self, event): - self.game_exec = self.GetSelectedProgram() - playonlinux.open_folder(self.game_exec) - - def ChangeIcon(self, event): - self.IconDir = Variables.homedir+"/.local/share/icons/" - self.SupprotedIconExt = "All|*.xpm;*.XPM;*.png;*.PNG;*.ico;*.ICO;*.jpg;*.JPG;*.jpeg;*.JPEG;*.bmp;*.BMP\ - \|XPM (*.xpm)|*.xpm;*.XPM\ - \|PNG (*.png)|*.png;*.PNG\ - \|ICO (*.ico)|*.ico;*.ICO\ - \|JPG (*.jpg)|*.jpg;*.JPG\ - \|BMP (*.bmp)|*.bmp;*.BMP\ - \|JPEG (*.jpeg)|*.jpeg;*JPEG" - self.IconDialog = wx.FileDialog(self, "Choose a icon file", self.IconDir, "", self.SupprotedIconExt, wx.OPEN | wx.FD_PREVIEW) - if self.IconDialog.ShowModal() == wx.ID_OK: - self.IconFilename=self.IconDialog.GetFilename() - self.IconDirname=self.IconDialog.GetDirectory() - IconFile=os.path.join(self.IconDirname,self.IconFilename) - self.RConfigure("IconChange", IconFile) - self.IconDialog.Destroy() - #Pop-up menu for game list: ending - - def Select(self, event): - game_exec = self.GetSelectedProgram() - self.read = open(Variables.playonlinux_rep+"shortcuts/"+game_exec,"r").readlines() - self.i = 0; - self.wine_present = False; - while(self.i < len(self.read)): - if("wine " in self.read[self.i]): - self.wine_present = True; - self.i += 1 - - self.generate_menu(game_exec) - self.playTool.Enable(True) - self.stopTool.Enable(True) - self.removeTool.Enable(True) - - def generate_menu(self, shortcut=None): - for c in self.menuElem: - self.menuElem[c].Destroy() - - for c in self.menuImage: - self.menuImage[c].Destroy() - try: - self.menuBitmap.Destroy() - except: - pass - - self.menuElem = {} - self.menuImage = {} - - i = 0; - self.menuGaucheAddTitle("pol_title", os.environ["APPLICATION_TITLE"], i) - i+=1 - self.menuGaucheAddLink("pol_prgm_install", _("Install a program"), i,Variables.playonlinux_env+"/resources/images/menu/add.png",self.InstallMenu) - i+=1 - self.menuGaucheAddLink("pol_prgm_settings", _("Settings"), i,Variables.playonlinux_env+"/resources/images/menu/settings.png",self.Options) - - - if(os.path.exists(os.environ["PLAYONLINUX"]+"/.git/")): - i+=1 - self.menuGaucheAddLink("pol_git", _("Update GIT"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateGIT) - elif "POL_UPTODATE" in os.environ and os.environ["POL_UPTODATE"] == "FALSE": - i+=1 - self.menuGaucheAddLink("pol_update", _("Update instructions"), i,Variables.playonlinux_env+"/resources/images/menu/update_git.png",self.UpdateInstructions) - - if(shortcut != None): - i+=2 - self.menuGaucheAddTitle("prgm_title", shortcut, i) - i+=1 - self.menuGaucheAddLink("pol_prgm_run", _("Run"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-start.png",self.Run) - i+=1 - self.menuGaucheAddLink("pol_prgm_kill", _("Close"), i,Variables.playonlinux_env+"/resources/images/menu/media-playback-stop.png",self.RKill) - i+=1 - self.menuGaucheAddLink("pol_prgm_rundebug", _("Debug"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.RunDebug) - - game_exec = self.GetSelectedProgram() - game_log = playonlinux.getLog(game_exec) - if(game_log): - i+=1 - self.menuGaucheAddLink("pol_prgm_reportproblem", _("Send a feedback"), i,Variables.playonlinux_env+"/resources/images/menu/bug.png",self.sendfeedback) - - i+=1 - self.menuGaucheAddLink("pol_prgm_configure", _("Configure"), i,Variables.playonlinux_env+"/resources/images/menu/run.png",self.Configure) - i+=1 - self.menuGaucheAddLink("pol_prgm_shortcut", _("Create a shortcut"), i,Variables.playonlinux_env+"/resources/images/menu/shortcut.png",self.Package) - i+=1 - self.menuGaucheAddLink("pol_prgm_adddir", _("Open the directory"), i,Variables.playonlinux_env+"/resources/images/menu/folder-wine.png",self.GoToAppDir) - - if(os.path.exists(os.environ["POL_USER_ROOT"]+"/configurations/manuals/"+shortcut)): - i+=1 - self.menuGaucheAddLink("pol_prgm_readme", _("Read the manual"), i,Variables.playonlinux_env+"/resources/images/menu/manual.png",self.ReadMe) - - i+=1 - self.menuGaucheAddLink("pol_prgm_uninstall", _("Uninstall"), i,Variables.playonlinux_env+"/resources/images/menu/window-close.png",self.UninstallGame) - - - self.linksfile = os.environ["POL_USER_ROOT"]+"/configurations/links/"+shortcut - if(os.path.exists(self.linksfile)): - self.linksc = open(self.linksfile,"r").read().split("\n") - for line in self.linksc: - if("|" in line): - line = line.split("|") - i+=1 - if("PROFILEBUTTON/" in line[0]): - line[0] = line[0].replace("PROFILEBUTTON/","") - - self.menuGaucheAddLink("url_"+str(i), line[0], i,Variables.playonlinux_env+"/resources/images/menu/star.png",None,line[1]) - - icon = os.environ["POL_USER_ROOT"]+"/icones/full_size/"+shortcut - - - if(os.path.exists(icon)): - try: - self.bitmap = wx.Image(icon) - if(self.bitmap.GetWidth() >= 48): - self.bitmap.Rescale(48,48,wx.IMAGE_QUALITY_HIGH) - self.bitmap = self.bitmap.ConvertToBitmap() - self.menuBitmap = wx.StaticBitmap(self.menu_gauche, id=-1, bitmap=self.bitmap, pos=(left_pos,20+(i+2)*20)) - except: - pass - - def menuGaucheAddTitle(self,id,text,pos): - self.menuElem[id] = wx.StaticText(self.menu_gauche, -1, text,pos=(5,5+pos*20)) - self.menuElem[id].SetForegroundColour((0,0,0)) # For dark themes - self.menuElem[id].SetFont(self.fontTitre) - - - def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): - if(os.path.exists(image)): - menu_icone = image - else: - menu_icone = Variables.playonlinux_env+"/etc/playonlinux.png" - - try: - self.bitmap = wx.Image(menu_icone) - self.bitmap.Rescale(16,16,wx.IMAGE_QUALITY_HIGH) - self.bitmap = self.bitmap.ConvertToBitmap() - self.menuImage[id] = wx.StaticBitmap(self.menu_gauche, id=-1, bitmap=self.bitmap, pos=(10,15+pos*20)) - - except: - pass - - if(url == None): - self.menuElem[id] = wx.HyperlinkCtrl(self.menu_gauche, 10000+pos, text, "", pos=(35,15+pos*20)) - else: - self.menuElem[id] = wx.HyperlinkCtrl(self.menu_gauche, 10000+pos, text, url, pos=(35,15+pos*20)) - - self.menuElem[id].SetNormalColour(wx.Colour(0,0,0)) - self.menuElem[id].SetVisitedColour(wx.Colour(0,0,0)) - self.menuElem[id].SetHoverColour(wx.Colour(100,100,100)) - - if(evt != None): - wx.EVT_HYPERLINK(self, 10000+pos, evt) - - def donate(self, event): - if(os.environ["POL_OS"] == "Mac"): - webbrowser.open("http://www.playonmac.com/en/donate.html") - else: - webbrowser.open("http://www.playonlinux.com/en/donate.html") - - def Reload(self, event): - self.games = os.listdir(Variables.playonlinux_rep+"shortcuts/") - self.games.sort(key=str.upper) - - try: - self.games.remove(".DS_Store") - except: - pass - - self.list_game.DeleteAllItems() - self.images.RemoveAll() - root = self.list_game.AddRoot("") - self.i = 0 - if(self.iconSize <= 32): - self.iconFolder = "32"; - else: - self.iconFolder = "full_size"; - for game in self.games: #METTRE EN 32x32 - if(self.searchbox.GetValue().encode("utf-8","replace").lower() in game.lower()): - if(not os.path.isdir(Variables.playonlinux_rep+"/shortcuts/"+game)): - if(os.path.exists(Variables.playonlinux_rep+"/icones/"+self.iconFolder+"/"+game)): - file_icone = Variables.playonlinux_rep+"/icones/"+self.iconFolder+"/"+game - else: - file_icone = Variables.playonlinux_env+"/etc/playonlinux.png" - - try: - self.bitmap = wx.Image(file_icone) - self.bitmap.Rescale(self.iconSize,self.iconSize,wx.IMAGE_QUALITY_HIGH) - self.bitmap = self.bitmap.ConvertToBitmap() - self.images.Add(self.bitmap) - except: - pass - - item = self.list_game.AppendItem(root, game, self.i) - self.i += 1 - self.generate_menu(None) - - if(os.environ["POL_OS"] == "Mac"): - self.playTool.Enable(False) - self.stopTool.Enable(False) - self.removeTool.Enable(False) - - - def RConfigure(self, function_to_run, firstargument): - """Starts polconfigurator remotely.""" - game_exec = self.GetSelectedProgram() - if game_exec != "": - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/polconfigurator", game_exec, function_to_run, firstargument]) - else: - wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) - - - def Options(self, event): - onglet=event.GetId() - try: - self.optionFrame.SetFocus() - except: - self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 2) - if(onglet == 211): - self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 0) - if(onglet == 214): - self.optionFrame = options.MainWindow(self, -1, _("{0} settings").format(os.environ["APPLICATION_TITLE"]), 1) - self.optionFrame.Center(wx.BOTH) - self.optionFrame.Show(True) - - def killall(self, event): - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/killall"]) - - def Executer(self, event): - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/expert/Executer"]) - - def BugReport(self, event): - try: - self.debugFrame.Show() - self.debugFrame.SetFocus() - except: - self.debugFrame = debug.MainWindow(None, -1, _("{0} debugger").format(os.environ["APPLICATION_TITLE"])) - self.debugFrame.Center(wx.BOTH) - self.debugFrame.Show() - - - def POLOnline(self, event): - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/playonlinux_online"]) - - def PCCd(self, event): - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/read_pc_cd"]) - - def PolShell(self, event): - #Variables.run_x_server() - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/expert/PolShell"]) - - def Configure(self, event): - game_exec = self.GetSelectedProgram() - try: - self.configureFrame.Show(True) - self.configureFrame.SetFocus() - if(game_exec != ""): - self.configureFrame.change_program(game_exec,False) - - except: - if(game_exec == ""): - self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),"default",True) - else: - self.configureFrame = configure.MainWindow(self, -1, _("{0} configuration").format(os.environ["APPLICATION_TITLE"]),game_exec.decode("utf-8","replace"),False) - - - self.configureFrame.Center(wx.BOTH) - self.configureFrame.Show(True) - - #subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/polconfigurator", game_exec]) - - def Package(self, event): - game_exec = self.GetSelectedProgram() - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/make_shortcut", game_exec]) - - def UninstallGame(self, event): - game_exec = self.GetSelectedProgram() - if game_exec != "": - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/uninstall", game_exec]) - else: - wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) - - def PolVaultSaveGame(self, event): - game_exec = self.GetSelectedProgram() - if game_exec != "": - subprocess.Popen(["bash", Variables.playonlinux_rep+"plugins/PlayOnLinux Vault/scripts/menu", "--app", game_exec]) - else: - wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) - - def InstallMenu(self, event): - try: - self.installFrame.Show(True) - self.installFrame.SetFocus() - except: - self.installFrame = install.InstallWindow(self, -1, _('{0} install menu').format(os.environ["APPLICATION_TITLE"])) - self.installFrame.Center(wx.BOTH) - self.installFrame.Show(True) - - def WineVersion(self, event): - try: - self.wversion.Show() - self.wversion.SetFocus() - except: - self.wversion = wver.MainWindow(None, -1, _('{0} wine versions manager').format(os.environ["APPLICATION_TITLE"])) - self.wversion.Center(wx.BOTH) - self.wversion.Show(True) - - def GetSelectedProgram(self): - return self.list_game.GetItemText(self.list_game.GetSelection()).encode("utf-8","replace") - - def Run(self, event, s_debug=False): - - game_exec = self.GetSelectedProgram() - game_prefix = playonlinux.getPrefix(game_exec) - - if(s_debug == False): - playonlinux.SetDebugState(game_exec, game_prefix, False) - - 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() - - subprocess.Popen(["bash", Variables.playonlinux_env+"/bash/run_app", game_exec]) - else: - wx.MessageBox(_("Please select a program."), os.environ["APPLICATION_TITLE"]) - else: - wx.MessageBox(_("The virtual drive associated with {0} ({1}) does no longer exists.").format(game_exec, game_prefix), os.environ["APPLICATION_TITLE"]) - - def RunDebug(self, event): - game_exec = self.GetSelectedProgram() - game_prefix = playonlinux.getPrefix(game_exec) - playonlinux.SetDebugState(game_exec, game_prefix, True) - self.Run(self, True) - - def sendfeedback(self, event): - game_exec = self.GetSelectedProgram() - game_log = str(playonlinux.getLog(game_exec)) - if game_log: - playonlinux.POL_Open("http://www."+os.environ["POL_DNS"]+"/repository/feedback.php?script="+urllib.quote_plus(game_log)) - - def POLDie(self): - for pid in self.registeredPid: - os.system("kill -9 -%d 2> /dev/null" % pid) - os.system("kill -9 %d 2> /dev/null" % pid) - app.POLServer.closeServer() - os._exit(0) - - def POLRestart(self): - for pid in self.registeredPid: - os.system("kill -9 -%d 2> /dev/null" % pid) - os.system("kill -9 %d 2> /dev/null" % pid) - app.POLServer.closeServer() - os._exit(63) # Restart code - - def ForceClose(self, signal, frame): # Catch SIGINT - print "\nCtrl+C pressed. Killing all processes..." - self.POLDie() - - def ClosePol(self, event): - pids = [] - for pid in self.registeredPid: - try: - os.kill(pid, 0) - pid_exists = True - pids.append(pid) - except OSError: - pid_exists = False - print "Registered PID: %d (%s)" % (pid, 'Present' if pid_exists else 'Missing') - self.registeredPid = pids - - if(playonlinux.GetSettings("DONT_ASK_BEFORE_CLOSING") == "TRUE" or self.registeredPid == [] or wx.YES == wx.MessageBox(_('Are you sure you want to close all {0} Windows?').format(os.environ["APPLICATION_TITLE"]).decode("utf-8","replace"),os.environ["APPLICATION_TITLE"], style=wx.YES_NO | wx.ICON_QUESTION)): - self.SizeToSave = self.GetSize(); - self.PositionToSave = self.GetPosition(); - # Save size and position - playonlinux.SetSettings("MAINWINDOW_WIDTH",str(self.SizeToSave[0])) - playonlinux.SetSettings("MAINWINDOW_HEIGHT",str(self.SizeToSave[1]-Variables.windows_add_playonmac*56)) - playonlinux.SetSettings("MAINWINDOW_X",str(self.PositionToSave[0])) - playonlinux.SetSettings("MAINWINDOW_Y",str(self.PositionToSave[1])) - - self._mgr.Destroy() - - self.POLDie() - return None - - def About(self, event): - self.aboutBox = wx.AboutDialogInfo() - if(os.environ["POL_OS"] != "Mac"): - self.aboutBox.SetIcon(wx.Icon(Variables.playonlinux_env+"/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) - - - self.aboutBox.SetName(os.environ["APPLICATION_TITLE"]) - self.aboutBox.SetVersion(Variables.version) - self.aboutBox.SetDescription(_("Run your Windows programs on "+os.environ["POL_OS"]+" !")) - self.aboutBox.SetCopyright("© 2007-2013 "+_("PlayOnLinux and PlayOnMac team\nUnder GPL licence version 3")) - self.aboutBox.AddDeveloper(_("Developer and Website: ")+"Tinou (Pâris Quentin), MulX (Petit Aymeric)") - self.aboutBox.AddDeveloper(_("Scriptors: ")+"GNU_Raziel") - self.aboutBox.AddDeveloper(_("Packager: ")+"MulX (Petit Aymeric), Tinou (Pâris Quentin)") - self.aboutBox.AddDeveloper(_("Icons:")+"Faenza-Icons http://tiheum.deviantart.com/art/Faenza-Icons-173323228") - self.aboutBox.AddDeveloper(_("The following people contributed to this program: ")+"kiplantt, Salvatos, Minchul") - self.aboutBox.AddTranslator(_("Translations:")) - self.aboutBox.AddTranslator(_("Read TRANSLATORS file")) - - if(os.environ["POL_OS"] == "Mac"): - self.aboutBox.SetWebSite("http://www.playonmac.com") - else: - self.aboutBox.SetWebSite("http://www.playonlinux.com") - wx.AboutBox(self.aboutBox) - -class PlayOnLinuxApp(wx.App): - def OnInit(self): - lng.iLang() - close = False - exe_present = False - - os.system("bash "+Variables.playonlinux_env+"/bash/startup") - self.systemCheck() - - for f in sys.argv[1:]: - self.MacOpenFile(f) - if(".exe" in f or ".EXE" in f): - exe_present = True - close = True - - if(close == True and exe_present == False): - os._exit(0) - - self.SetClassName(os.environ["APPLICATION_TITLE"]) - self.SetAppName(os.environ["APPLICATION_TITLE"]) - - - self.frame = MainWindow(None, -1, os.environ["APPLICATION_TITLE"]) - # Gui Server - self.POLServer = gui_server.gui_server(self.frame) - self.POLServer.start() - - i = 0 - while(os.environ["POL_PORT"] == "0"): - time.sleep(0.01) - if(i >= 300): - wx.MessageBox(_("{0} is not able to start PlayOnLinux Setup Window server.").format(os.environ["APPLICATION_TITLE"]),_("Error")) - os._exit(0) - break - i+=1 - os.system("bash \"$PLAYONLINUX/bash/startup_after_server\" &") - - self.SetTopWindow(self.frame) - self.frame.Show(True) - - return True - - def _executableFound(self, executable): - devnull = open('/dev/null', 'wb') - try: - returncode = subprocess.call(["which",executable],stdout=devnull) - return (returncode == 0) - except: - return False - - def _singleCheck(self, executable, package, fatal): - if not self._executableFound(executable): - message = _("{0} cannot find {1}") - if package is not None: - message += _(" (from {2})") - - if fatal: - verdict = _("You need to install it to continue") - else: - verdict = _("You should install it to use {0}") - - wx.MessageBox(("%s\n\n%s" % (message, verdict)).format(os.environ["APPLICATION_TITLE"], executable, package), _("Error")) - - if fatal: - os._exit(0) - - def singleCheck(self, executable, package=None): - self._singleCheck(executable, package, False) - - def singleCheckFatal(self, executable, package=None): - self._singleCheck(executable, package, True) - - def systemCheck(self): - #### Root uid check - if(os.popen("id -u").read() == "0\n" or os.popen("id -u").read() == "0"): - wx.MessageBox(_("{0} is not supposed to be run as root. Sorry").format(os.environ["APPLICATION_TITLE"]),_("Error")) - os._exit(0) - - #### 32 bits OpenGL check - try: - returncode=subprocess.call([os.environ["PLAYONLINUX"]+"/bash/check_gl","x86"]) - except: - returncode=255 - if(os.environ["POL_OS"] == "Linux" and returncode != 0): - wx.MessageBox(_("{0} is unable to find 32bits OpenGL libraries.\n\nYou might encounter problem with your games").format(os.environ["APPLICATION_TITLE"]),_("Error")) - os.environ["OpenGL32"] = "0" - else: - os.environ["OpenGL32"] = "1" - - #### 64 bits OpenGL check - if(os.environ["AMD64_COMPATIBLE"] == "True"): - try: - returncode=subprocess.call([os.environ["PLAYONLINUX"]+"/bash/check_gl","amd64"]) - except: - returncode=255 - if(os.environ["AMD64_COMPATIBLE"] == "True" and os.environ["POL_OS"] == "Linux" and returncode != 0): - wx.MessageBox(_("{0} is unable to find 64bits OpenGL libraries.\n\nYou might encounter problem with your games").format(os.environ["APPLICATION_TITLE"]),_("Error")) - os.environ["OpenGL64"] = "0" - else: - os.environ["OpenGL64"] = "1" - - #### Filesystem check - if(os.environ["POL_OS"] == "Linux"): - try: - returncode=subprocess.call([os.environ["PLAYONLINUX"]+"/bash/check_fs"]) - except: - returncode=255 - if(os.environ["POL_OS"] == "Linux" and returncode != 0): - wx.MessageBox(_("Your filesystem might prevent {0} from running correctly.\n\nPlease open {0} in a terminal to get more details").format(os.environ["APPLICATION_TITLE"]),_("Error")) - - if(os.environ["DEBIAN_PACKAGE"] == "FALSE"): - if(playonlinux.GetSettings("SEND_REPORT") == ""): - if(wx.YES == wx.MessageBox(_('Do you want to help {0} to make a compatibility database?\n\nIf you click yes, the following things will be sent to us anonymously the first time you run a Windows program:\n\n- You graphic card model\n- Your OS version\n- If graphic drivers are installed or not.\n\n\nThese information will be very precious for us to help people.').format(os.environ["APPLICATION_TITLE"]).decode("utf-8","replace"), os.environ["APPLICATION_TITLE"],style=wx.YES_NO | wx.ICON_QUESTION)): - playonlinux.SetSettings("SEND_REPORT","TRUE") - else: - playonlinux.SetSettings("SEND_REPORT","FALSE") - - #### Other import checks - self.singleCheckFatal("nc", package="Netcat") - self.singleCheckFatal("tar") - self.singleCheckFatal("cabextract") - self.singleCheckFatal("convert", package="ImageMagick") - self.singleCheckFatal("wget", package="Wget") - self.singleCheckFatal("curl", package="cURL") - - self.singleCheckFatal("gpg", package="GnuPG") - - if(os.environ["DEBIAN_PACKAGE"] == "FALSE" and os.environ["POL_OS"] != "Mac"): - self.singleCheck("xterm") - self.singleCheck("gettext.sh", package="gettext") # gettext-base on Debian - self.singleCheck("icotool", package="icoutils") - self.singleCheck("wrestool", package="icoutils") - self.singleCheck("wine", package="Wine") - self.singleCheck("unzip", package="InfoZIP") - self.singleCheck("7z", package="P7ZIP full") # p7zip-full on Debian - if(os.environ["POL_OS"] == "FreeBSD"): - self.singleCheck("gsed", package="GNU Sed") - - def BringWindowToFront(self): - try: # it's possible for this event to come when the frame is closed - self.GetTopWindow().Raise() - except: - pass - - def MacOpenFile(self, filename): - file_extension = string.split(filename,".") - file_extension = file_extension[len(file_extension) - 1] - if(file_extension == "desktop"): # Un raccourcis Linux - content = open(filename,"r").readlines() - i = 0 - while(i < len(content)): - #wx.MessageBox(content[i], "PlayOnLinux", wx.OK) - - if("Path=" in content[i]): - cd_app = content[i].replace("Path=","").replace("\n","") - if("Exec=" in content[i]): - exec_app = content[i].replace("Exec=","").replace("\n","") - i += 1 - if(":\\\\\\\\" in exec_app): - exec_app = exec_app.replace("\\\\","\\") - try: - os.system("cd \""+cd_app+"\" && "+exec_app+" &") - except: - pass - - elif(file_extension == "exe" or file_extension == "EXE"): - os.system("bash \"$PLAYONLINUX/bash/run_exe\" \""+filename+"\" &") - - elif(file_extension == "pol" or file_extension == "POL"): - if(wx.YES == wx.MessageBox(_('Are you sure you want to want to install {0} package?').format(filename).decode("utf-8","replace"), os.environ["APPLICATION_TITLE"],style=wx.YES_NO | wx.ICON_QUESTION)): - os.system("bash \"$PLAYONLINUX/bash/playonlinux-pkg\" -i \""+filename+"\" &") - else: - playonlinux.open_document(filename,file_extension.lower()) - - def MacOpenURL(self, url): - if(os.environ["POL_OS"] == "Mac" and not "playonmac://" in url): - wx.MessageBox(_("You are trying to open a script design for {0}! It might not work as expected").format("PlayOnLinux or PlayOnBSD"), os.environ["APPLICATION_TITLE"]) - if(os.environ["POL_OS"] == "Linux" and not "playonlinux://" in url): - wx.MessageBox(_("You are trying to open a script design for {0}! It might not work as expected").format("PlayOnMac or PlayOnBSD"), os.environ["APPLICATION_TITLE"]) - if(os.environ["POL_OS"] == "FreeBSD" and not "playonbsd://" in url): - wx.MessageBox(_("You are trying to open a script design for {0}! It might not work as expected").format("PlayOnMac or PlayOnLinux"), os.environ["APPLICATION_TITLE"]) - - os.system("bash \"$PLAYONLINUX/bash/playonlinux-url_handler\" \""+url+"\" &") - - def MacReopenApp(self): - #sys.exit() - self.BringWindowToFront() - -# Idea taken from flacon -def setSigchldHandler(): - signal.signal(signal.SIGCHLD, handleSigchld) - if hasattr(signal, 'siginterrupt'): - signal.siginterrupt(signal.SIGCHLD, False) - -def handleSigchld(number, frame): - # Apparently some UNIX systems automatically resent the SIGCHLD - # handler to SIG_DFL. Reset it just in case. - setSigchldHandler() - -setSigchldHandler() -lng.Lang() - -wx.Log_EnableLogging(False) - -app = PlayOnLinuxApp(redirect=False) -app.MainLoop() -#sys.exit(0) From d67616f4af98280ff87eca571946034230c1af2c Mon Sep 17 00:00:00 2001 From: tfks Date: Sat, 16 May 2015 12:23:31 +0200 Subject: [PATCH 18/18] Basic version with only system colour feature. T. --- python/options.py | 111 +--------------------------------------------- 1 file changed, 2 insertions(+), 109 deletions(-) diff --git a/python/options.py b/python/options.py index 1b0fe68d3..19db04072 100755 --- a/python/options.py +++ b/python/options.py @@ -92,7 +92,6 @@ def __init__(self, parent): self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/application-x-executable.png")); self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/package-x-generic.png")); self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/extensions.png")); - self.images_onglets.Add(wx.Bitmap(Variables.playonlinux_env+"/etc/onglet/folder-saved-search.png")); self.SetImageList(self.images_onglets) @@ -291,98 +290,6 @@ def Extensions(self, nom): wx.EVT_BUTTON(self, 502, self.delExt) wx.EVT_BUTTON(self, 503, self.newExt) - def generateShvs(self): - self.list_shv.DeleteAllItems() - - i = 0 - self.shelves = playonlinux.Get_Shelves() - self.shelves.sort() - for line in self.shelves: - line = line.replace("\n","") - self.list_shv.InsertStringItem(i, line) - i += 1 - - def doAddShelve(self): - ## add item to the listbox. The apply action handles the saving. - shv_value = self.txt_shv.GetLineText(0) - - if (shv_value != ""): - self.list_shv.InsertStringItem(self.list_shv.GetItemCount (), shv_value) - - self.txt_shv.Clear() - - def addShelve(self, event): - self.doAddShelve() - - def deleteShelve(self, event): - i = 0 - - def doNewShelveEntered(self): - if (self.txt_shv.GetLineText(0) != ""): - self.add_shv.Enable() - else: - self.add_shv.Disable() - - def newShelveEntered(self, event): - self.doNewShelveEntered() - - def enterKeyPressed(self, event): - self.doAddShelve() - - def shelveSelected(self, event): - self.delete_shv.Enable() - - def shelveDeselected(self, event): - self.delete_shv.Disable() - - def Shelves(self, nom): - self.panelShelves = wx.Panel(self, -1) - - self.sizerShelves = wx.BoxSizer(wx.VERTICAL) - - self.panelShelvesButtons = wx.Panel(self.panelShelves, -1); - - ##self.app_addshelve_text = wx.StaticText(self.panelShelves, pos=(1,388), label=_("Add new shelve")) - - self.list_shv = wx.ListCtrl(self.panelShelves, 1504, size=(504,350), pos=(1,1), style=wx.LC_REPORT) - self.list_shv.InsertColumn(0, 'Shelve', width=320) - - self.txt_shv = wx.TextCtrl(self.panelShelves, 1505, "", pos=(1,2), size=(400,25), style=wx.TE_PROCESS_ENTER) - - self.sizerShelves.Add(self.list_shv, 0, wx.TOP|wx.ALL, 2) - self.sizerShelves.Add(self.txt_shv, 0, wx.TOP|wx.ALL, 2) - - self.sizerShelves.Add(self.panelShelvesButtons, 1, wx.BOTTOM|wx.ALL, 2) - - self.panelShelves.SetSizer(self.sizerShelves) - self.panelShelves.SetAutoLayout(True) - - self.sizerShelvesButtons = wx.BoxSizer(wx.VERTICAL) - - self.panelShelvesButtons.SetSizer(self.sizerShelvesButtons) - self.panelShelvesButtons.SetAutoLayout(True) - - self.add_shv = wx.Button(self.panelShelvesButtons, 1502, pos=(372,385+2*Variables.windows_add_playonmac), size=(100,25), label=_("Add shelve")) - self.delete_shv = wx.Button(self.panelShelvesButtons, 1503, pos=(372,385+2*Variables.windows_add_playonmac), size=(125,25), label=_("Remove shelve")) - - self.add_shv.Disable() - self.delete_shv.Disable() - - self.sizerShelvesButtons.Add(self.add_shv, 0, wx.TOP|wx.ALL, 2) - self.sizerShelvesButtons.Add(self.delete_shv, 0, wx.TOP|wx.ALL, 2) - - - self.generateShvs(); - - self.AddPage(self.panelShelves, nom, imageId=7) - - wx.EVT_BUTTON(self, 1502, self.addShelve) - wx.EVT_BUTTON(self, 1503, self.deleteShelve) - wx.EVT_LIST_ITEM_SELECTED(self, 1504, self.shelveSelected) - wx.EVT_LIST_ITEM_DESELECTED(self, 1504, self.shelveDeselected) - wx.EVT_TEXT(self, 1505, self.newShelveEntered) - wx.EVT_TEXT_ENTER(self, 1505, self.enterKeyPressed) - def setup_plug(self, event): self.current_plugin = self.pluginlist.GetItemText(self.pluginlist.GetSelection()) self.plugin_path = Variables.playonlinux_rep+"/plugins/"+self.current_plugin @@ -478,7 +385,6 @@ def __init__(self,parent,id,title,onglet): #self.onglets.System(_("System")) self.onglets.Plugins(_("Plugins")) self.onglets.Extensions(_("File associations")) - self.onglets.Shelves(_("Shelves")) try: self.onglets.SetSelection(onglet) @@ -501,19 +407,6 @@ def apply_settings(self, event): playonlinux.SetSettings("PROXY_LOGIN",self.onglets.ProxyLogin.GetValue()) playonlinux.SetSettings("PROXY_PASSWORD",self.onglets.ProxyPass.GetValue()) - wx.MessageBox(_("You must restart {0} for the changes to take effect.").format(os.environ["APPLICATION_TITLE"]), os.environ["APPLICATION_TITLE"], wx.OK) - - ## Let's use the apply button for all settings... - allvalues = "" - count = self.onglets.list_shv.GetItemCount() - for row in range(count): - item = self.onglets.list_shv.GetItem(itemId=row, col=0) - if (allvalues == ""): - allvalues = item.GetText() - else: - allvalues = allvalues + "\n" + item.GetText() - - playonlinux.SetSettings("", allvalues,"_SHV_") - - + + wx.MessageBox(_("You must restart {0} for the changes to take effect.").format(os.environ["APPLICATION_TITLE"]), os.environ["APPLICATION_TITLE"], wx.OK) self.Destroy()