diff --git a/README_THISFORK.md b/README_THISFORK.md new file mode 100644 index 000000000..c47fe400f --- /dev/null +++ b/README_THISFORK.md @@ -0,0 +1,33 @@ +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 diff --git a/etc/onglet/folder-saved-search.png b/etc/onglet/folder-saved-search.png new file mode 100644 index 000000000..ca24a3676 Binary files /dev/null and b/etc/onglet/folder-saved-search.png differ diff --git a/python/configure.py b/python/configure.py index cd622b5a3..6afa95466 100755 --- a/python/configure.py +++ b/python/configure.py @@ -211,6 +211,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 676ee5181..ea03ce9ee 100755 --- a/python/guiv3.py +++ b/python/guiv3.py @@ -100,12 +100,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(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((255,255,255)) + self.MainPanel.SetBackgroundColour(playonlinux.get_background_colour()) # Images @@ -116,19 +116,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(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((0,0,0)) # 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((0,0,0)) # 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((0,0,0)) # 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 = "" @@ -180,13 +180,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 @@ -203,7 +201,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(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 ed7998425..cea1b0dee 100755 --- a/python/install.py +++ b/python/install.py @@ -178,13 +178,13 @@ def addCat(self, name, icon, iid): #self.cats_icons[name].Bind(wx.EVT_LEFT_DOWN, 2000+iid, self.AddApps) - self.cats_links[name].SetColours(wx.Colour(0,0,0), wx.Colour(0,0,0), wx.Colour(0,0,0)) + self.cats_links[name].SetColours(playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour(),playonlinux.get_foreground_hover_colour()) self.cats_links[name].AutoBrowse(False) self.cats_links[name].UpdateLink(True) self.cats_links[name].SetUnderlines(False, False, False) self.cats_links[name].SetFont(self.fontText) - self.cats_links[name].SetBackgroundColour((255,255,255)) + self.cats_links[name].SetBackgroundColour(playonlinux.get_background_colour()) def __init__(self,parent,id,title): wx.Frame.__init__(self, parent, -1, title, size = (800, 550+Variables.windows_add_size), style = wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX) @@ -202,7 +202,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(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) @@ -299,14 +299,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(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.lib.hyperlink.HyperLinkCtrl(self.panelFenp, 111, _("Install a non-listed program"), pos=(10,515)) - self.manualInstall.SetColours(wx.Colour(0,0,0),wx.Colour(0,0,0),wx.Colour(0,0,0)) + self.manualInstall.SetColours(playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour(),playonlinux.get_foreground_hover_colour()) self.manualInstall.AutoBrowse(False) self.manualInstall.UpdateLink(True) diff --git a/python/lib/playonlinux.py b/python/lib/playonlinux.py index 803284648..69cb39941 100755 --- a/python/lib/playonlinux.py +++ b/python/lib/playonlinux.py @@ -6,6 +6,18 @@ import Variables, os, string import subprocess, 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] != "/"): @@ -56,6 +68,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 +98,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 +108,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 +152,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): @@ -393,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 @@ -452,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 bbe172654..0d01362e4 100755 --- a/python/mainwindow.py +++ b/python/mainwindow.py @@ -826,7 +826,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((0,0,0)) # For dark themes + self.menuElem[id].SetForegroundColour(playonlinux.get_foreground_colour()) # For dark themes self.menuElem[id].SetFont(self.fontTitre) @@ -852,7 +852,7 @@ def menuGaucheAddLink(self,id,text,pos,image,evt,url=None): 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].SetColours(wx.Colour(0,0,0),wx.Colour(0,0,0),wx.Colour(0,0,0)) + self.menuElem[id].SetColours(playonlinux.get_foreground_colour(),playonlinux.get_foreground_colour(),playonlinux.get_foreground_hover_colour()) self.menuElem[id].UpdateLink(True) #self.menuElem[id].SetVisited(False) #self.menuElem[id].SetNormalColour(wx.Colour(0,0,0)) diff --git a/resources/images/menu/emblem-favorite.png b/resources/images/menu/emblem-favorite.png new file mode 100644 index 000000000..3acb57dc9 Binary files /dev/null and b/resources/images/menu/emblem-favorite.png differ diff --git a/resources/images/menu/internet-news-reader.png b/resources/images/menu/internet-news-reader.png new file mode 100644 index 000000000..a9850ee2c Binary files /dev/null and b/resources/images/menu/internet-news-reader.png differ diff --git a/resources/images/menu/media-optical.png b/resources/images/menu/media-optical.png new file mode 100644 index 000000000..5853a754e Binary files /dev/null and b/resources/images/menu/media-optical.png differ diff --git a/resources/images/menu/software-update-available.png b/resources/images/menu/software-update-available.png new file mode 100644 index 000000000..ab8d494bb Binary files /dev/null and b/resources/images/menu/software-update-available.png differ diff --git a/resources/images/menu/text-x-script.png b/resources/images/menu/text-x-script.png new file mode 100644 index 000000000..c923098ea Binary files /dev/null and b/resources/images/menu/text-x-script.png differ diff --git a/resources/images/menu/x-office-address-book.png b/resources/images/menu/x-office-address-book.png new file mode 100644 index 000000000..f3b5d9d98 Binary files /dev/null and b/resources/images/menu/x-office-address-book.png differ