def _createAppDescription(self): appDescriptionPanel = wx.Panel(self.appNavigationPanel, -1) self.appNavigationSizer.Add(appDescriptionPanel, 1, wx.EXPAND) self.appNavigationSizer.AddSpacer(10) appDescriptionSizer = wx.BoxSizer(wx.VERTICAL) self.descriptionContentHtmlBox = PyClickableHtmlWindow( appDescriptionPanel, 107, style=Variables.widget_borders) appDescriptionSizer.Add(self.descriptionContentHtmlBox, 1, wx.EXPAND) self.descriptionLoaderPanel = wx.Panel(appDescriptionPanel, -1, style=Variables.widget_borders) self.descriptionLoaderPanel.SetBackgroundColour((255, 255, 255)) self.animation = wx.animate.GIFAnimationCtrl( self.descriptionLoaderPanel, -1, Variables.playonlinux_env + "/resources/images/install/wait_mini.gif", (90, 100)) self.animation.Hide() self.descriptionLoaderPanel.Hide() self.image = wx.StaticBitmap( appDescriptionPanel, 108, wx.Bitmap(Variables.playonlinux_env + "/resources/images/pol_min.png")) self.image.Bind(wx.EVT_LEFT_DOWN, self.sizeUpScreen) appDescriptionSizer.Add(self.descriptionLoaderPanel, 1, wx.EXPAND) appDescriptionSizer.AddSpacer(10) appDescriptionSizer.Add(self.image, 0) appDescriptionPanel.SetSizer(appDescriptionSizer)
def __init__(self, parent, htmlFilename): wx.Dialog.__init__(self, parent, -1, _("Word Up! Help"), size=(-1, 550)) panel = wx.Panel(self) htmlWindow = PyClickableHtmlWindow(panel, -1) htmlWindow.LoadFile(htmlFilename) okButton = wx.Button(panel, wx.ID_OK) okButton.SetDefault() self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(htmlWindow, 1, wx.EXPAND) vbox.Add(okButton, 0, wx.ALIGN_RIGHT | wx.ALL, 20) vbox.SetMinSize((300, 300)) panel.SetSizer(vbox) vbox2 = wx.BoxSizer(wx.VERTICAL) vbox2.Add(panel, 1, wx.EXPAND) self.SetSizer(vbox2) self.CentreOnParent(wx.BOTH)
def _create_view(self): panel = wx.Panel(self.application.frame.notebook) html_win = PyClickableHtmlWindow(panel, -1) html_win.SetStandardFonts() html_win.SetPage(WELCOME_TEXT + RELEASE_NOTES) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html_win, 1, wx.EXPAND | wx.ALL, border=8) panel.SetSizer(sizer) return panel
def _create_view(self): panel = wx.Panel(self.application.frame.notebook) html_win = PyClickableHtmlWindow(panel, -1) html_win.SetStandardFonts() fgcolor = self.general_settings.get('foreground text', Colour(7, 0, 70)) """ panel.SetBackgroundColour(Colour(200, 222, 40)) """ panel.SetForegroundColour(fgcolor) html_win.SetOwnForegroundColour(fgcolor) self.set_content(html_win, WELCOME_TEXT + RELEASE_NOTES) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html_win, 1, wx.EXPAND | wx.ALL, border=8) panel.SetSizer(sizer) return panel
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) self.cats_icons = {} self.cats_links = {} self.description = getDescription() self.panelFenp = wx.Panel(self, -1) self.panelItems = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelWait = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelWait.Hide() self.panelManual = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelManual.Hide() self.currentPanel = 0 # [ 1 = manual, 0 = items ] # Categories self.panelButton = wx.Panel(self.panelFenp, -1, size=(802, 69), pos=(-1, -1), style=Variables.widget_borders) self.panelButton.SetBackgroundColour((255, 255, 255)) if (os.environ["POL_OS"] == "Mac"): self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "", wx.FONTENCODING_DEFAULT) self.fontTitre = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) else: self.fontText = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "", wx.FONTENCODING_DEFAULT) self.fontTitre = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) self.addCat( _("Accessories"), Variables.playonlinux_env + "/resources/images/install/32/applications-accessories.png", 0) self.addCat( _("Development"), Variables.playonlinux_env + "/resources/images/install/32/applications-development.png", 1) self.addCat( _("Education"), Variables.playonlinux_env + "/resources/images/install/32/applications-science.png", 2) self.addCat( _("Games"), Variables.playonlinux_env + "/resources/images/install/32/applications-games.png", 3) self.addCat( _("Graphics"), Variables.playonlinux_env + "/resources/images/install/32/applications-graphics.png", 4) self.addCat( _("Internet"), Variables.playonlinux_env + "/resources/images/install/32/applications-internet.png", 5) self.addCat( _("Multimedia"), Variables.playonlinux_env + "/resources/images/install/32/applications-multimedia.png", 6) self.addCat( _("Office"), Variables.playonlinux_env + "/resources/images/install/32/applications-office.png", 7) self.addCat( _("Other"), Variables.playonlinux_env + "/resources/images/install/32/applications-other.png", 8) self.addCat( _("Patches"), Variables.playonlinux_env + "/resources/images/install/32/view-refresh.png", 9) self.live = 0 self.openMin = False self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.images_cat = wx.ImageList(22, 22) self.imagesapps = wx.ImageList(22, 22) #self.list_cat = wx.TreeCtrl(self.panelItems, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|Variables.widget_borders, size=(200, 363), pos=(10,10)) #self.list_cat.Hide() if (os.environ["POL_OS"] == "Mac"): self.image_position = (738 - 160, 346 - 71) self.new_size = (196, 218 - 4) self.search_offset = 3 if (os.environ["POL_OS"] == "Linux"): self.image_position = (740 - 160, 348 - 71) self.new_size = (200, 222 - 4) self.search_offset = 5 self.image = wx.StaticBitmap( self.panelItems, 108, wx.Bitmap(Variables.playonlinux_env + "/resources/images/pol_min.png"), self.image_position, wx.DefaultSize) self.image.Bind(wx.EVT_LEFT_DOWN, self.sizeUpScreen) #self.list_cat.SetSpacing(0); #self.list_cat.SetImageList(self.images_cat) position = 10 + self.search_offset #self.searchcaption = wx.StaticText(self.panelItems, -1, _("Search"), (position,82-71+self.search_offset), wx.DefaultSize) #position += self.searchcaption.GetSize()[0]+5 self.searchbox = wx.SearchCtrl(self.panelItems, 110, size=(250, 22), pos=(position, 9)) self.searchbox.SetDescriptiveText(_("Search")) position += self.searchbox.GetSize()[0] + 20 self.filterscaption = wx.StaticText( self.panelItems, -1, _("Include:"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.filterscaption.GetSize()[0] + 10 self.testingChk = wx.CheckBox(self.panelItems, 401, pos=(position, 82 - 71), size=wx.DefaultSize) self.testingChk.SetValue(True) position += 15 + self.search_offset self.testingCapt = wx.StaticText( self.panelItems, -1, _("Testing"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.testingCapt.GetSize()[0] + 10 self.nocdChk = wx.CheckBox(self.panelItems, 402, pos=(position, 82 - 71), size=wx.DefaultSize) position += 15 + self.search_offset self.noDvDCapt = wx.StaticText( self.panelItems, -1, _("No-cd needed"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.noDvDCapt.GetSize()[0] + 10 self.freeChk = wx.CheckBox(self.panelItems, 403, pos=(position, 82 - 71), size=wx.DefaultSize) self.freeChk.SetValue(True) position += 15 + self.search_offset self.FreeCapt = wx.StaticText(self.panelItems, -1, _("Commercial"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.FreeCapt.GetSize()[0] + 10 self.star_x = position self.lasthtml_content = "" self.list_apps = wx.TreeCtrl(self.panelItems, 106, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders, size=(550, 385), pos=(15, 113 - 71)) self.list_apps.SetImageList(self.imagesapps) self.list_apps.SetSpacing(0) self.stars = 0 #self.content = wx.TextCtrl(self.panelItems, 107, pos=(220,301), size=(562,212), style = wx.TE_MULTILINE | wx.TE_RICH2 | wx.CB_READONLY | Variables.widget_borders) self.content = PyClickableHtmlWindow(self.panelItems, 107, style=Variables.widget_borders, pos=(580, 113 - 71), size=(200, 218)) self.button = wx.Button(self.panelItems, wx.ID_CLOSE, _("Cancel"), pos=(736 - 160, 510 - 71), size=(100, 35)) self.install_button = wx.Button(self.panelItems, wx.ID_APPLY, _("Install"), pos=(843 - 160, 510 - 71), size=(100, 35)) self.update_button = wx.Button(self.panelItems, wx.ID_REFRESH, _("Refresh"), pos=(630 - 160, 510 - 71), size=(100, 35)) 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.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.panelItems, 111, _("Install a non-listed program"), "", pos=(10, 515 - 71)) self.ManualInstall.SetNormalColour(wx.Colour(0, 0, 0)) # 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)) self.percentageText = wx.StaticText(self.panelWait, -1, "", ((800 - 30) / 2, (550 - 128) / 2 + 128 + 10 - 71), wx.DefaultSize) self.percentageText.SetFont(self.fontTitre) self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.TimerAction, self.timer) self.timer.Start(200) # panel manual # self.AddApps() #wx.EVT_TREE_SEL_CHANGED(self, 105, self.AddApps) wx.EVT_TREE_SEL_CHANGED(self, 106, self.AppsDetails) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_BUTTON(self, wx.ID_APPLY, self.installapp) wx.EVT_BUTTON(self, wx.ID_REFRESH, self.UpdatePol) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_TREE_ITEM_ACTIVATED(self, 106, self.installapp) wx.EVT_TEXT(self, 110, self.search) wx.EVT_HYPERLINK(self, 111, self.manual) wx.EVT_CHECKBOX(self, 401, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 402, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 403, self.CheckBoxReload)
class InstallWindow(wx.Frame): def addCat(self, name, icon, iid): espace = 80 if (os.environ["POL_OS"] == "Mac"): offset = 10 w_offset = 5 else: offset = 2 w_offset = 10 self.cats_icons[name] = wx.BitmapButton(self.panelButton, 2000 + iid, wx.Bitmap(icon), (0, 0), style=wx.NO_BORDER) self.cats_links[name] = wx.HyperlinkCtrl(self.panelButton, 3000 + iid, name, "", pos=(0, 52)) mataille = self.cats_links[name].GetSize()[0] mataille2 = self.cats_icons[name].GetSize()[0] image_pos = (espace - mataille2) / 2 + espace * iid self.cats_links[name].SetPosition( (espace * iid + espace / 2 - mataille / 2, 47)) self.cats_icons[name].SetPosition((image_pos, offset)) #self.cats_icons[name].SetSize((espace,100)) wx.EVT_HYPERLINK(self, 3000 + iid, self.AddApps) 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].SetFont(self.fontText) 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) self.cats_icons = {} self.cats_links = {} self.description = getDescription() self.panelFenp = wx.Panel(self, -1) self.panelItems = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelWait = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelWait.Hide() self.panelManual = wx.Panel(self.panelFenp, -1, size=(800, 550 + Variables.windows_add_size), pos=(0, 71)) self.panelManual.Hide() self.currentPanel = 0 # [ 1 = manual, 0 = items ] # Categories self.panelButton = wx.Panel(self.panelFenp, -1, size=(802, 69), pos=(-1, -1), style=Variables.widget_borders) self.panelButton.SetBackgroundColour((255, 255, 255)) if (os.environ["POL_OS"] == "Mac"): self.fontText = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "", wx.FONTENCODING_DEFAULT) self.fontTitre = wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) else: self.fontText = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "", wx.FONTENCODING_DEFAULT) self.fontTitre = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) self.addCat( _("Accessories"), Variables.playonlinux_env + "/resources/images/install/32/applications-accessories.png", 0) self.addCat( _("Development"), Variables.playonlinux_env + "/resources/images/install/32/applications-development.png", 1) self.addCat( _("Education"), Variables.playonlinux_env + "/resources/images/install/32/applications-science.png", 2) self.addCat( _("Games"), Variables.playonlinux_env + "/resources/images/install/32/applications-games.png", 3) self.addCat( _("Graphics"), Variables.playonlinux_env + "/resources/images/install/32/applications-graphics.png", 4) self.addCat( _("Internet"), Variables.playonlinux_env + "/resources/images/install/32/applications-internet.png", 5) self.addCat( _("Multimedia"), Variables.playonlinux_env + "/resources/images/install/32/applications-multimedia.png", 6) self.addCat( _("Office"), Variables.playonlinux_env + "/resources/images/install/32/applications-office.png", 7) self.addCat( _("Other"), Variables.playonlinux_env + "/resources/images/install/32/applications-other.png", 8) self.addCat( _("Patches"), Variables.playonlinux_env + "/resources/images/install/32/view-refresh.png", 9) self.live = 0 self.openMin = False self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.images_cat = wx.ImageList(22, 22) self.imagesapps = wx.ImageList(22, 22) #self.list_cat = wx.TreeCtrl(self.panelItems, 105, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|Variables.widget_borders, size=(200, 363), pos=(10,10)) #self.list_cat.Hide() if (os.environ["POL_OS"] == "Mac"): self.image_position = (738 - 160, 346 - 71) self.new_size = (196, 218 - 4) self.search_offset = 3 if (os.environ["POL_OS"] == "Linux"): self.image_position = (740 - 160, 348 - 71) self.new_size = (200, 222 - 4) self.search_offset = 5 self.image = wx.StaticBitmap( self.panelItems, 108, wx.Bitmap(Variables.playonlinux_env + "/resources/images/pol_min.png"), self.image_position, wx.DefaultSize) self.image.Bind(wx.EVT_LEFT_DOWN, self.sizeUpScreen) #self.list_cat.SetSpacing(0); #self.list_cat.SetImageList(self.images_cat) position = 10 + self.search_offset #self.searchcaption = wx.StaticText(self.panelItems, -1, _("Search"), (position,82-71+self.search_offset), wx.DefaultSize) #position += self.searchcaption.GetSize()[0]+5 self.searchbox = wx.SearchCtrl(self.panelItems, 110, size=(250, 22), pos=(position, 9)) self.searchbox.SetDescriptiveText(_("Search")) position += self.searchbox.GetSize()[0] + 20 self.filterscaption = wx.StaticText( self.panelItems, -1, _("Include:"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.filterscaption.GetSize()[0] + 10 self.testingChk = wx.CheckBox(self.panelItems, 401, pos=(position, 82 - 71), size=wx.DefaultSize) self.testingChk.SetValue(True) position += 15 + self.search_offset self.testingCapt = wx.StaticText( self.panelItems, -1, _("Testing"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.testingCapt.GetSize()[0] + 10 self.nocdChk = wx.CheckBox(self.panelItems, 402, pos=(position, 82 - 71), size=wx.DefaultSize) position += 15 + self.search_offset self.noDvDCapt = wx.StaticText( self.panelItems, -1, _("No-cd needed"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.noDvDCapt.GetSize()[0] + 10 self.freeChk = wx.CheckBox(self.panelItems, 403, pos=(position, 82 - 71), size=wx.DefaultSize) self.freeChk.SetValue(True) position += 15 + self.search_offset self.FreeCapt = wx.StaticText(self.panelItems, -1, _("Commercial"), (position, 82 - 71 + self.search_offset), wx.DefaultSize) position += self.FreeCapt.GetSize()[0] + 10 self.star_x = position self.lasthtml_content = "" self.list_apps = wx.TreeCtrl(self.panelItems, 106, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders, size=(550, 385), pos=(15, 113 - 71)) self.list_apps.SetImageList(self.imagesapps) self.list_apps.SetSpacing(0) self.stars = 0 #self.content = wx.TextCtrl(self.panelItems, 107, pos=(220,301), size=(562,212), style = wx.TE_MULTILINE | wx.TE_RICH2 | wx.CB_READONLY | Variables.widget_borders) self.content = PyClickableHtmlWindow(self.panelItems, 107, style=Variables.widget_borders, pos=(580, 113 - 71), size=(200, 218)) self.button = wx.Button(self.panelItems, wx.ID_CLOSE, _("Cancel"), pos=(736 - 160, 510 - 71), size=(100, 35)) self.install_button = wx.Button(self.panelItems, wx.ID_APPLY, _("Install"), pos=(843 - 160, 510 - 71), size=(100, 35)) self.update_button = wx.Button(self.panelItems, wx.ID_REFRESH, _("Refresh"), pos=(630 - 160, 510 - 71), size=(100, 35)) 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.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.panelItems, 111, _("Install a non-listed program"), "", pos=(10, 515 - 71)) self.ManualInstall.SetNormalColour(wx.Colour(0, 0, 0)) # 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)) self.percentageText = wx.StaticText(self.panelWait, -1, "", ((800 - 30) / 2, (550 - 128) / 2 + 128 + 10 - 71), wx.DefaultSize) self.percentageText.SetFont(self.fontTitre) self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.TimerAction, self.timer) self.timer.Start(200) # panel manual # self.AddApps() #wx.EVT_TREE_SEL_CHANGED(self, 105, self.AddApps) wx.EVT_TREE_SEL_CHANGED(self, 106, self.AppsDetails) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_BUTTON(self, wx.ID_APPLY, self.installapp) wx.EVT_BUTTON(self, wx.ID_REFRESH, self.UpdatePol) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_TREE_ITEM_ACTIVATED(self, 106, self.installapp) wx.EVT_TEXT(self, 110, self.search) wx.EVT_HYPERLINK(self, 111, self.manual) wx.EVT_CHECKBOX(self, 401, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 402, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 403, self.CheckBoxReload) #wx.EVT_CHECKBOX(self, 111, self.manual) #Timer, regarde toute les secondes si il faut actualiser la liste def TimerAction(self, event): if (self.lasthtml_content != self.description.htmlContent): self.SetImg(self.description.miniature) self.description.miniature = self.description.miniature_defaut self.lasthtml_content = self.description.htmlContent if (self.description.htmlContent == "###WAIT###"): self.animation.Show() self.animation.Play() self.new_panel.Show() self.content.Hide() self.Refresh() else: self.animation.Stop() self.content.Show() self.animation.Hide() self.new_panel.Hide() self.Refresh() self.content.SetPage(self.description.htmlContent) if (self.stars != self.description.stars): self.show_stars(self.description.stars) self.stars = self.description.stars #if(self.list_cat.GetItemImage(self.list_cat.GetSelection()) != self.description.cat): # self.description.cat = self.list_cat.GetItemImage(self.list_cat.GetSelection()) if (self.openMin == True): if (self.description.med_miniature != None): self.wmin = Wminiature( None, -1, self.list_apps.GetItemText(self.list_apps.GetSelection()), self.description.med_miniature) self.wmin.Show() self.wmin.Center(wx.BOTH) self.openMin = False def closeapp(self, event): self.description.thread_running = False self.Destroy() def manual(self, event): self.live = 1 self.installapp(self) def show_stars(self, stars): self.stars = int(stars) try: self.star1.Destroy() except: pass try: self.star2.Destroy() except: pass try: self.star3.Destroy() except: pass try: self.star4.Destroy() except: pass try: self.star5.Destroy() except: pass self.stars = int(self.stars) star_y = 83 - 71 star_x = 832 - 160 if (self.stars >= 1): self.star1 = wx.StaticBitmap( self.panelItems, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/star.png"), (5 * 18 + star_x, star_y), wx.DefaultSize) if (self.stars >= 2): self.star2 = wx.StaticBitmap( self.panelItems, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/star.png"), (4 * 18 + star_x, star_y), wx.DefaultSize) if (self.stars >= 3): self.star3 = wx.StaticBitmap( self.panelItems, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/star.png"), (3 * 18 + star_x, star_y), wx.DefaultSize) if (self.stars >= 4): self.star4 = wx.StaticBitmap( self.panelItems, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/star.png"), (2 * 18 + star_x, star_y), wx.DefaultSize) if (self.stars == 5): self.star5 = wx.StaticBitmap( self.panelItems, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/star.png"), (18 + star_x, star_y), wx.DefaultSize) def UpdatePol(self, event): self.DelApps() self.Parent.updater.check() playonlinux.SetSettings("LAST_TIMESTAMP", "0") def installapp(self, event): if (self.live == 1): InstallApplication = "ExecLiveInstall" else: InstallApplication = self.list_apps.GetItemText( self.list_apps.GetSelection()) if (InstallApplication == "about:creator"): self.EasterEgg = sp.egg(None, -1, "PlayOnLinux Conceptor") self.EasterEgg.Show() self.EasterEgg.Center(wx.BOTH) else: 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")) 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") found = False for line in content: split = line.split("~") if (split[0] == InstallApplication): found = True break if (found == True): if (len(split) <= 1): self.UpdatePol(self) else: if (split[1] == "1"): wx.MessageBox( _("This program is currently in testing.\n\nIt might not work as expected. Your feedback, positive or negative, is specially important to improve this installer." ), _("Please read this")) if (split[2] == "1"): wx.MessageBox( _("This program contains a protection against copy (DRM) incompatible with emulation.\nThe only workaround is to use a \"no-cd\" patch, but since those can also be used for piracy purposes we won't give any support on this matter." ), _("Please read this")) os.system("bash \"" + Variables.playonlinux_env + "/bash/install\" \"" + InstallApplication.encode("utf-8", "replace") + "\"&") self.Destroy() return def search(self, event): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/search", 'r', "utf-8") self.apps = self.apps.readlines() self.j = 0 while (self.j < len(self.apps)): self.apps[self.j] = self.apps[self.j].replace("\n", "") self.j += 1 self.j = 0 self.k = 0 self.user_search = self.searchbox.GetValue() self.search_result = [] while (self.j < len(self.apps)): if (string.lower(self.user_search) in string.lower(self.apps[self.j])): self.search_result.append(self.apps[self.j]) self.k = self.k + 1 self.j = self.j + 1 if (self.user_search == "about:creator"): self.search_result.append("about:creator") if (len(self.user_search) < 2 or "~" in self.user_search): self.search_result = [] self.user_search_cut = string.split(self.user_search, ":") if (len(self.user_search_cut) > 1): if (self.user_search_cut[0] == "get" and self.user_search_cut[1].isdigit()): self.search_result.append(self.user_search) if (self.user_search != ""): self.WriteApps(self.search_result) else: self.DelApps() def EraseDetails(self): self.content.SetValue("") def AppsDetails(self, event): self.install_button.Enable(True) self.application = self.list_apps.GetItemText( self.list_apps.GetSelection()) self.description.download(self.application) def sizeUpScreen(self, event): self.openMin = True def WriteApps(self, array): self.imagesapps.RemoveAll() self.DelApps() self.root_apps = self.list_apps.AddRoot("") self.i = 0 array.sort() for app in array: app_array = app.split("~") appname = app_array[0] try: free = int(app_array[3]) testing = int(app_array[1]) nocd = int(app_array[2]) show = True if (int(nocd) == 1 and self.nocdChk.IsChecked() == 0): show = False if (int(free) == 0 and self.freeChk.IsChecked() == 0): show = False if (int(testing) == 1 and self.testingChk.IsChecked() == 0): show = False except: show = True if (show == True): self.icon_look_for = Variables.playonlinux_rep + "/configurations/icones/" + appname if (os.path.exists(self.icon_look_for)): try: self.imagesapps.Add(wx.Bitmap(self.icon_look_for)) except: pass else: self.imagesapps.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux22.png")) itemId = self.list_apps.AppendItem(self.root_apps, appname, self.i) if int(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.i = self.i + 1 def DelApps(self): self.list_apps.DeleteAllItems() def SetImg(self, image): self.image.Destroy() self.image = wx.StaticBitmap(self.panelItems, 108, wx.Bitmap(image), self.image_position, wx.DefaultSize) self.image.Bind(wx.EVT_LEFT_DOWN, self.sizeUpScreen) self.image.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) self.Refresh() def ResetImg(self): self.SetImg(Variables.playonlinux_env + "/resources/images/pol_min.png") def CheckBoxReload(self, event): chk_id = event.GetId() if (chk_id == 401): if (self.testingChk.IsChecked() == 1): wx.MessageBox( _("By enabling this, you will have access to testing installers.\n\n{0} cannot ensure that your app will work without any problems" ).format(os.environ["APPLICATION_TITLE"]), _("Please read this")) if (chk_id == 402): if (self.nocdChk.IsChecked() == 1): wx.MessageBox( _("By enabling this, you will have access to installers for programs that contain protections against copy (DRM) incompatible with emulation.\nThe only workaround is to use \"no-cd\" patches, but since those can also be used for piracy purposes we won't give any support on this matter." ), _("Please read this")) if (self.searchbox.GetValue() == ""): self.AddApps(self, noevent=True) else: self.search(self) def AddApps(self, event, noevent=False): self.searchbox.SetValue("") #self.cat_selected=self.list_cat.GetItemText(self.list_cat.GetSelection()).encode("utf-8","replace") if (noevent == False): if (event.GetId() >= 3000): self.cat_selected = event.GetId() - 3000 else: self.cat_selected = event.GetId() - 2000 self.current_cat = self.cat_selected else: try: self.cat_selected = self.current_cat except: return 0 if (self.cat_selected == 8): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/0", 'r', "utf-8") if (self.cat_selected == 3): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/1", 'r', "utf-8") if (self.cat_selected == 0): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/2", 'r', "utf-8") if (self.cat_selected == 7): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/3", 'r', "utf-8") if (self.cat_selected == 5): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/4", 'r', "utf-8") if (self.cat_selected == 6): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/5", 'r', "utf-8") if (self.cat_selected == 4): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/6", 'r', "utf-8") if (self.cat_selected == 1): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/7", 'r', "utf-8") if (self.cat_selected == 2): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/8", 'r', "utf-8") if (self.cat_selected == 9): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/9", 'r', "utf-8") #if(self.cat_selected == 12): # self.apps = codecs.open(Variables.playonlinux_rep+"/configurations/listes/10",'r',"utf-8") if (self.cat_selected != -1): self.apps = self.apps.readlines() self.j = 0 while (self.j < len(self.apps)): self.apps[self.j] = self.apps[self.j].replace("\n", "") self.j += 1 self.WriteApps(self.apps)
class InstallWindow(PlayOnLinuxWindow): def addCat(self, name, icon, iid): espace = 80 if (os.environ["POL_OS"] == "Mac"): offset = 10 else: offset = 2 self.cats_icons[name] = wx.BitmapButton(self.installWindowHeader, 2000 + iid, wx.Bitmap(icon), (0, 0), style=wx.NO_BORDER) self.cats_links[name] = wx.lib.hyperlink.HyperLinkCtrl( self.installWindowHeader, 3000 + iid, name, pos=(0, 52)) mataille = self.cats_links[name].GetSize()[0] mataille2 = self.cats_icons[name].GetSize()[0] image_pos = (espace - mataille2) / 2 + espace * iid self.cats_links[name].SetPosition( (espace * iid + (espace - mataille / 1.3) / 2, 47)) self.cats_icons[name].SetPosition((image_pos, offset)) wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 3000 + iid, self.AddApps) wx.EVT_BUTTON(self, 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].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)) def setWaitState(self, isWaiting): if isWaiting: self.installWindowCategoryContentPanel.Hide() self.panelWait.Show() self.manualInstall.Raise() self.animation_wait.Play() self.installButton.Hide() self.updateButton.Hide() else: self.installWindowCategoryContentPanel.Show() self.manualInstall.Raise() self.panelWait.Hide() self.animation_wait.Stop() self.installButton.Show() self.updateButton.Show() self.Layout() def _createHeader(self): self.installWindowHeader = wx.Panel(self, -1, size=(802, 69)) self.installWindowHeader.SetBackgroundColour((255, 255, 255)) self.windowSizer.Add(self.installWindowHeader, 0, wx.EXPAND) self.addCat( _("Accessories"), Variables.playonlinux_env + "/resources/images/install/32/applications-accessories.png", 0) self.addCat( _("Development"), Variables.playonlinux_env + "/resources/images/install/32/applications-development.png", 1) self.addCat( _("Education"), Variables.playonlinux_env + "/resources/images/install/32/applications-science.png", 2) self.addCat( _("Games"), Variables.playonlinux_env + "/resources/images/install/32/applications-games.png", 3) self.addCat( _("Graphics"), Variables.playonlinux_env + "/resources/images/install/32/applications-graphics.png", 4) self.addCat( _("Internet"), Variables.playonlinux_env + "/resources/images/install/32/applications-internet.png", 5) self.addCat( _("Multimedia"), Variables.playonlinux_env + "/resources/images/install/32/applications-multimedia.png", 6) self.addCat( _("Office"), Variables.playonlinux_env + "/resources/images/install/32/applications-office.png", 7) self.addCat( _("Other"), Variables.playonlinux_env + "/resources/images/install/32/applications-other.png", 8) self.addCat( _("Patches"), Variables.playonlinux_env + "/resources/images/install/32/view-refresh.png", 9) def _createBody(self): self.installWindowBodyPanel = wx.Panel(self, -1) self.windowSizer.Add(self.installWindowBodyPanel, 1, wx.EXPAND) self.installWindowBodySizer = wx.BoxSizer(wx.VERTICAL) self.installWindowBodyPanel.SetSizer(self.installWindowBodySizer) def _createWaitPanel(self): self.panelWait = wx.Panel(self.installWindowBodyPanel, -1) self.installWindowBodySizer.Add(self.panelWait, 1, wx.EXPAND) self.panelWait.Hide() ## FIXME: Remove those magic numbers self.animation_wait = wx.animate.GIFAnimationCtrl( self.panelWait, -1, Variables.playonlinux_env + "/resources/images/install/wait.gif", ((800 - 128) / 2, (550 - 128) / 2 - 71)) self.percentageText = wx.StaticText(self.panelWait, -1, "", ((800 - 30) / 2, (550 - 128) / 2 + 128 + 10 - 71), wx.DefaultSize) self.percentageText.SetFont(self.fontTitle) self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.TimerAction, self.timer) self.timer.Start(200) def _createInstallWindowCategoryContentPanel(self): self.installWindowCategoryContentPanel = wx.Panel( self.installWindowBodyPanel, -1) self.installWindowBodySizer.Add(self.installWindowCategoryContentPanel, 1, wx.EXPAND) self.installWindowCategoryContentSizer = wx.BoxSizer(wx.VERTICAL) self.installWindowCategoryContentPanel.SetSizer( self.installWindowCategoryContentSizer) def _createFilterPanel(self): self.filterPanel = wx.Panel(self.installWindowCategoryContentPanel, -1) self.installWindowCategoryContentSizer.AddSpacer(10) self.installWindowCategoryContentSizer.Add(self.filterPanel, 0, wx.EXPAND) self.installWindowCategoryContentSizer.AddSpacer(10) filterSizer = wx.BoxSizer(wx.HORIZONTAL) self.filterPanel.SetSizer(filterSizer) self.searchbox = wx.SearchCtrl( self.filterPanel, 110, ) filtersCaption = wx.StaticText(self.filterPanel, -1, _("Include:")) self.testingChk = wx.CheckBox(self.filterPanel, 401) self.testingChk.SetValue(True) testingCaption = wx.StaticText(self.filterPanel, -1, _("Testing")) self.nocdChk = wx.CheckBox(self.filterPanel, 402) nocdCaption = wx.StaticText(self.filterPanel, -1, _("No-cd needed")) self.commercialChk = wx.CheckBox(self.filterPanel, 403) self.commercialChk.SetValue(True) commercialCaption = wx.StaticText(self.filterPanel, -1, _("Commercial")) self.panelStars = wx.Panel(self.filterPanel, -1) filterSizer.AddSpacer(10) filterSizer.Add(self.searchbox, 4, wx.EXPAND) filterSizer.AddSpacer(10) filterSizer.Add(filtersCaption, 0, wx.EXPAND) filterSizer.AddSpacer(10) filterSizer.Add(self.testingChk, 0, wx.EXPAND) filterSizer.Add(testingCaption, 0, wx.EXPAND) filterSizer.AddSpacer(10) filterSizer.Add(self.nocdChk, 0, wx.EXPAND) filterSizer.Add(nocdCaption, 0, wx.EXPAND) filterSizer.AddSpacer(10) filterSizer.Add(self.commercialChk, 0, wx.EXPAND) filterSizer.Add(commercialCaption, 0, wx.EXPAND) filterSizer.AddSpacer(20) filterSizer.Add(self.panelStars, 2, wx.EXPAND) filterSizer.AddSpacer(10) def _createAppNavigation(self): self.appNavigationPanel = wx.Panel( self.installWindowCategoryContentPanel, -1) self.installWindowCategoryContentSizer.Add(self.appNavigationPanel, 10, wx.EXPAND) self.appNavigationSizer = wx.BoxSizer(wx.HORIZONTAL) # self.appNavigationPanel.SetSizer(self.appNavigationSizer) self.imagesapps = wx.ImageList(22, 22) self.appsList = wx.TreeCtrl(self.appNavigationPanel, 106, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | Variables.widget_borders) self.appsList.SetImageList(self.imagesapps) self.appsList.SetSpacing(0) self.appNavigationSizer.AddSpacer(10) self.appNavigationSizer.Add(self.appsList, 4, wx.EXPAND, 5) self.appNavigationSizer.AddSpacer(10) def _createAppDescription(self): appDescriptionPanel = wx.Panel(self.appNavigationPanel, -1) self.appNavigationSizer.Add(appDescriptionPanel, 1, wx.EXPAND) self.appNavigationSizer.AddSpacer(10) appDescriptionSizer = wx.BoxSizer(wx.VERTICAL) self.descriptionContentHtmlBox = PyClickableHtmlWindow( appDescriptionPanel, 107, style=Variables.widget_borders) appDescriptionSizer.Add(self.descriptionContentHtmlBox, 1, wx.EXPAND) self.descriptionLoaderPanel = wx.Panel(appDescriptionPanel, -1, style=Variables.widget_borders) self.descriptionLoaderPanel.SetBackgroundColour((255, 255, 255)) self.animation = wx.animate.GIFAnimationCtrl( self.descriptionLoaderPanel, -1, Variables.playonlinux_env + "/resources/images/install/wait_mini.gif", (90, 100)) self.animation.Hide() self.descriptionLoaderPanel.Hide() self.image = wx.StaticBitmap( appDescriptionPanel, 108, wx.Bitmap(Variables.playonlinux_env + "/resources/images/pol_min.png")) self.image.Bind(wx.EVT_LEFT_DOWN, self.sizeUpScreen) appDescriptionSizer.Add(self.descriptionLoaderPanel, 1, wx.EXPAND) appDescriptionSizer.AddSpacer(10) appDescriptionSizer.Add(self.image, 0) appDescriptionPanel.SetSizer(appDescriptionSizer) def _createButtons(self): buttonsPanel = wx.Panel(self.installWindowBodyPanel, -1) buttonsSizer = wx.BoxSizer(wx.HORIZONTAL) buttonsPanel.SetSizer(buttonsSizer) self.installWindowBodySizer.AddSpacer(10) self.installWindowBodySizer.Add(buttonsPanel, 0, wx.EXPAND) self.installWindowBodySizer.AddSpacer(10) self.cancelButton = wx.Button(buttonsPanel, wx.ID_CLOSE, _("Cancel")) self.installButton = wx.Button(buttonsPanel, wx.ID_APPLY, _("Install")) self.updateButton = wx.Button(buttonsPanel, wx.ID_REFRESH, _("Refresh")) self.manualInstall = wx.lib.hyperlink.HyperLinkCtrl( buttonsPanel, 111, _("Install a non-listed program")) self.manualInstall.SetColours(wx.Colour(0, 0, 0), wx.Colour(0, 0, 0), wx.Colour(0, 0, 0)) self.manualInstall.AutoBrowse(False) self.manualInstall.UpdateLink(True) buttonsSizer.AddSpacer(10) buttonsSizer.Add(self.manualInstall, 0) buttonsSizer.AddStretchSpacer() buttonsSizer.Add(self.updateButton, 0) buttonsSizer.AddSpacer(1) buttonsSizer.Add(self.cancelButton, 0) buttonsSizer.AddSpacer(1) buttonsSizer.Add(self.installButton, 0) buttonsSizer.AddSpacer(10) def __init__(self, parent, id, title): PlayOnLinuxWindow.__init__(self, parent, -1, title, size=(850, 550)) self.cats_icons = {} self.cats_links = {} self.descriptionFetcher = DescriptionFetcher() ## Window self.windowSizer = wx.BoxSizer(wx.VERTICAL) self._createHeader() self._createBody() self.SetSizer(self.windowSizer) self._createInstallWindowCategoryContentPanel() self._createWaitPanel() # Filter panel self._createFilterPanel() # Apps Navigation self._createAppNavigation() self._createAppDescription() ## Buttons self._createButtons() self.live = 0 self.openMin = False self.images_cat = wx.ImageList(22, 22) self.installButton.Enable(False) # wx.EVT_TREE_SEL_CHANGED(self, 105, self.AddApps) wx.EVT_TREE_SEL_CHANGED(self, 106, self.AppsDetails) wx.EVT_BUTTON(self, wx.ID_CLOSE, self.closeapp) wx.EVT_BUTTON(self, wx.ID_APPLY, self.installapp) wx.EVT_BUTTON(self, wx.ID_REFRESH, self.UpdatePol) wx.EVT_CLOSE(self, self.closeapp) wx.EVT_TREE_ITEM_ACTIVATED(self, 106, self.installapp) wx.EVT_TEXT(self, 110, self.search) wx.lib.hyperlink.EVT_HYPERLINK_LEFT(self, 111, self.manual) wx.EVT_CHECKBOX(self, 401, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 402, self.CheckBoxReload) wx.EVT_CHECKBOX(self, 403, self.CheckBoxReload) def TimerAction(self, event): try: self.lasthtml_content except AttributeError: self.lasthtml_content = "" if self.lasthtml_content != self.descriptionFetcher.htmlContent: self.SetImg(self.descriptionFetcher.miniature) self.descriptionFetcher.miniature = self.descriptionFetcher.miniature_defaut self.lasthtml_content = self.descriptionFetcher.htmlContent if self.descriptionFetcher.htmlContent == "###WAIT###": self.animation.Show() self.animation.Play() self.descriptionLoaderPanel.Show() self.descriptionContentHtmlBox.Hide() self.Refresh() else: self.animation.Stop() self.descriptionContentHtmlBox.Show() self.animation.Hide() self.descriptionLoaderPanel.Hide() self.Refresh() self.descriptionContentHtmlBox.SetPage( self.descriptionFetcher.htmlContent) self.Layout() self.showStars(self.descriptionFetcher.stars) if self.openMin == True: if self.descriptionFetcher.med_miniature != None: self.miniatureWindow = MiniatureWindow( None, -1, self.appsList.GetItemText(self.appsList.GetSelection()), self.descriptionFetcher.med_miniature) self.miniatureWindow.Show() self.miniatureWindow.Center(wx.BOTH) self.openMin = False def closeapp(self, event): self.descriptionFetcher.thread_running = False self.Destroy() def manual(self, event): self.live = 1 self.installapp(self) def showStars(self, stars): starWidth = 20 self.panelStars.DestroyChildren() for i in xrange(int(stars)): wx.StaticBitmap( self.panelStars, -1, wx.Bitmap(Variables.playonlinux_env + "/etc/star.png"), (i * starWidth, 0), wx.DefaultSize) def UpdatePol(self, event): self.DelApps() self.Parent.updater.check() playonlinux.SetSettings("LAST_TIMESTAMP", "0") def installapp(self, event): if (self.live == 1): InstallApplication = "ExecLiveInstall" else: InstallApplication = self.appsList.GetItemText( self.appsList.GetSelection()) 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") found = False for line in content: split = line.split("~") if (split[0] == InstallApplication): found = True break if (found == True): if (len(split) <= 1): self.UpdatePol(self) else: if (split[1] == "1"): wx.MessageBox( _("This program is currently in testing.\n\nIt might not work as expected. Your feedback, positive or negative, is specially important to improve this installer." ), _("Please read this")) if (split[2] == "1"): wx.MessageBox( _("This program contains a protection against copy (DRM) incompatible with emulation.\nThe only workaround is to use a \"no-cd\" patch, but since those can also be used for piracy purposes we won't give any support on this matter." ), _("Please read this")) subprocess.Popen([ "bash", Variables.playonlinux_env + "/bash/install", InstallApplication.encode("utf-8", "replace") ]) self.Destroy() return def search(self, event): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/search", 'r', "utf-8") self.apps = self.apps.readlines() self.j = 0 while (self.j < len(self.apps)): self.apps[self.j] = self.apps[self.j].replace("\n", "") self.j += 1 self.j = 0 self.k = 0 self.user_search = self.searchbox.GetValue() self.search_result = [] while (self.j < len(self.apps)): if (string.lower(self.user_search) in string.lower(self.apps[self.j])): self.search_result.append(self.apps[self.j]) self.k = self.k + 1 self.j = self.j + 1 if (len(self.user_search) < 2 or "~" in self.user_search): self.search_result = [] self.user_search_cut = string.split(self.user_search, ":") if (len(self.user_search_cut) > 1): if (self.user_search_cut[0] == "get" and self.user_search_cut[1].isdigit()): self.search_result.append(self.user_search) if (self.user_search != ""): self.WriteApps(self.search_result) else: self.DelApps() def EraseDetails(self): self.descriptionContentHtmlBox.SetValue("") def AppsDetails(self, event): self.installButton.Enable(True) self.application = self.appsList.GetItemText( self.appsList.GetSelection()) self.descriptionFetcher.download(self.application) def sizeUpScreen(self, event): self.openMin = True def WriteApps(self, array): self.imagesapps.RemoveAll() self.DelApps() self.root_apps = self.appsList.AddRoot("") self.i = 0 array.sort(key=unicode.upper) for app in array: app_array = app.split("~") appname = app_array[0] try: free = int(app_array[3]) testing = int(app_array[1]) nocd = int(app_array[2]) except IndexError: free = 0 testing = 0 nocd = 0 show = True if nocd == 1 and self.nocdChk.IsChecked() == 0: show = False if free == 0 and self.commercialChk.IsChecked() == 0: show = False if testing == 1 and self.testingChk.IsChecked() == 0: show = False if (show == True): self.icon_look_for = Variables.playonlinux_rep + "/configurations/icones/" + appname if (os.path.exists(self.icon_look_for.encode( 'utf-8', 'ignore'))): try: bitmap = wx.Image(self.icon_look_for) bitmap.Rescale(22, 22, wx.IMAGE_QUALITY_HIGH) bitmap = bitmap.ConvertToBitmap() self.imagesapps.Add(bitmap) except: pass else: self.imagesapps.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux22.png")) itemId = self.appsList.AppendItem( self.root_apps, appname.encode('utf-8', 'ignore'), self.i) 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.appsList.SetItemBackgroundColour( itemId, (255, 214, 214)) self.i = self.i + 1 def DelApps(self): self.appsList.DeleteAllItems() def SetImg(self, image): self.image.SetBitmap(wx.Bitmap(image)) self.Refresh() def ResetImg(self): self.SetImg(Variables.playonlinux_env + "/resources/images/pol_min.png") def CheckBoxReload(self, event): chk_id = event.GetId() if (chk_id == 401): if (self.testingChk.IsChecked() == 1): wx.MessageBox( _("By enabling this option, you can install programs that employ digital rights management (DRM) copy protection that are not supported by {0} and might need to be bypassed.\n\nThis feature should not be construed as implicit or implied condoning of piracy and as such, we will not offer any support for issues resulting from using this option." ).format(os.environ["APPLICATION_TITLE"]), _("Attention!")) if (chk_id == 402): if (self.nocdChk.IsChecked() == 1): wx.MessageBox( _("By enabling this, you will have access to installers for programs that contain protections against copy (DRM) incompatible with emulation.\nThe only workaround is to use \"no-cd\" patches, but since those can also be used for piracy purposes we won't give any support on this matter." ), _("Please read this")) if (self.searchbox.GetValue() == ""): self.AddApps(self, noevent=True) else: self.search(self) def AddApps(self, event, noevent=False): self.searchbox.SetValue("") if (noevent == False): if (event.GetId() >= 3000): self.cat_selected = event.GetId() - 3000 else: self.cat_selected = event.GetId() - 2000 self.current_cat = self.cat_selected else: try: self.cat_selected = self.current_cat except: return 0 if (self.cat_selected == 8): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/0", 'r', "utf-8") if (self.cat_selected == 3): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/1", 'r', "utf-8") if (self.cat_selected == 0): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/2", 'r', "utf-8") if (self.cat_selected == 7): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/3", 'r', "utf-8") if (self.cat_selected == 5): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/4", 'r', "utf-8") if (self.cat_selected == 6): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/5", 'r', "utf-8") if (self.cat_selected == 4): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/6", 'r', "utf-8") if (self.cat_selected == 1): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/7", 'r', "utf-8") if (self.cat_selected == 2): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/8", 'r', "utf-8") if (self.cat_selected == 9): self.apps = codecs.open( Variables.playonlinux_rep + "/configurations/listes/9", 'r', "utf-8") if (self.cat_selected != -1): self.apps = self.apps.readlines() self.j = 0 while (self.j < len(self.apps)): self.apps[self.j] = self.apps[self.j].replace("\n", "") self.j += 1 self.WriteApps(self.apps)
def AjouteIRC(self, nom): self.panel = wx.Panel(self, -1) self.panels_button = wx.Panel(self.panel, -1) self.panels_main = wx.Panel(self.panel, -1) self.panels_connexion = wx.Panel(self.panel, -1) #self.content = wx.TextCtrl(self.panel, 107, pos=(0,20), size=(500,300), style = wx.TE_MULTILINE | wx.TE_RICH2 | wx.CB_READONLY | wx.RAISED_BORDER) self.content = PyClickableHtmlWindow(self.panels_main, -1, style=wx.RAISED_BORDER) self.buddy = wx.TreeCtrl(self.panels_main, 126, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.RAISED_BORDER) self.buddy.SetSpacing(0) self.window = wx.TreeCtrl(self.panels_main, 127, style=wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.RAISED_BORDER) #self.root_window = self.window.AddRoot("") self.window.SetSpacing(0) self.buddy_images = wx.ImageList(16, 16) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/star.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/h-star.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux16.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/spacer16.png")) self.buddy_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/install/star.png")) self.buddy.SetImageList(self.buddy_images) self.window_images = wx.ImageList(16, 16) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/internet-group-chat.png")) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/system-users.png")) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/onglet/applications-system.png")) self.window_images.Add( wx.Bitmap(Variables.playonlinux_env + "/etc/playonlinux16.png")) self.window.SetImageList(self.window_images) self.buddy.SetSpacing(0) self.field = wx.TextCtrl(self.panels_button, 121, style=wx.TE_MULTILINE) self.button = wx.Button(self.panels_button, 122, _("Send")) self.connect = wx.Button(self.panels_connexion, 123, _("Connect"), pos=(0, 0), size=(150, 28)) self.disconnect = wx.Button(self.panels_connexion, 124, _("Disconnect"), pos=(0, 0), size=(150, 28)) self.close = wx.Button(self.panels_connexion, 128, _("Leave"), pos=(155, 0), size=(150, 28)) #self.close = wx.BitmapButton(self.panels_connexion, 128, wx.Bitmap(Variables.playonlinux_env+"/resources/images/menu/wineserver.png"), pos=(630,0)) self.settings = self.getSettings() self.nickname = wx.TextCtrl(self.panels_connexion, 125, self.settings["NICKNAME"], size=(300, 25), pos=(330, 2)) #self.channel_choices = ["#playonlinux-fr","#playonlinux-en","#playonlinux-it","#playonlinux-ru","#playonlinux-pl","#playonlinux-hu","#playonlinux-es"] #self.channel_choices.sort() #self.channel = wx.ComboBox(self.panels_connexion, 130, _("Join a channel"), size=(190,28), pos=(510,0), choices=self.channel_choices) self.close.Enable(False) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizerInputs = wx.BoxSizer(wx.HORIZONTAL) self.sizerMain = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(self.panels_connexion, 3, wx.EXPAND | wx.ALL, 2) self.sizer.Add(self.panels_main, 36, wx.EXPAND | wx.ALL, 2) self.sizer.Add(self.panels_button, 4, wx.EXPAND | wx.ALL, 2) self.sizerInputs.Add(self.field, 14, wx.EXPAND | wx.ALL, 2) self.sizerInputs.Add(self.button, 4, wx.EXPAND | wx.ALL, 2) self.sizerMain.Add(self.window, 4, wx.EXPAND | wx.ALL, 2) self.sizerMain.Add(self.content, 10, wx.EXPAND | wx.ALL, 2) self.sizerMain.Add(self.buddy, 4, wx.EXPAND | wx.ALL, 2) self.panel.SetSizer(self.sizer) self.panels_button.SetSizer(self.sizerInputs) self.panels_main.SetSizer(self.sizerMain) self.panel.SetAutoLayout(True) self.AddPage(self.panel, nom) self.field.Bind(wx.EVT_KEY_UP, self.EventKey) self.nickname.Bind(wx.EVT_KEY_UP, self.NicknameKey) #self.channel.Bind(wx.EVT_KEY_UP, self.EventChannel) wx.EVT_COMBOBOX(self, 130, self.JoinChan) wx.EVT_BUTTON(self, 122, self.EventButton) wx.EVT_BUTTON(self, 123, self.EventStart) wx.EVT_BUTTON(self, 124, self.EventStop) wx.EVT_BUTTON(self, 128, self.EventClose) wx.EVT_TREE_ITEM_ACTIVATED(self, 126, self.AddNick)