Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
configuration-avancee-unity-2d [Le 15/02/2012, 13:02]
89.224.171.71 [Avoir les lenses en haut à droite du Dash]
— (Version actuelle)
Ligne 1: Ligne 1:
-{{tag>​Unity-2D personnalisation}} 
----- 
  
-====== Configuration Avancée d'​Unity 2D ====== 
-Bon niveau en informatique nécessaire 
-<note warning>​Les manipulations données ci dessous peuvent rendre Unity-2D instable. Je ne suis pas développeur Unity 2D et je ne connais pas le QML, mes modifications sont faites d'​instinct,​ et bien qu'​elles semblent fonctionner sans problème, il se peut qu'​elles puissent engendrer des bugs par la suite. 
- 
-Les modifications expliquées ci-dessous nécessiteront de modifier des codes d'​Unity 2D. Des fichiers mal modifiés pourront rendre des parties d'​Unity 2D inutilisables. Il est conseillé d'​effectuer ces changements à tête reposée pour ne pas enregistrer trop vite, et d'​effectuer des sauvegardes des fichiers pour revenir en arrière sans perdre toutes les modifications. 
- 
-Les changements réalisés affecteront tous les utilisateurs du système et pas seulement vous. S'il y a plus d'un utilisateur sur votre PC, demandez leur leur avis avant d'​appliquer les changements ;​)</​note>​ 
-<note tip>​Après une erreur de configuration,​ il est possible de revenir à la version par défaut avec **sudo apt-get install --reinstall + nom_du_paquet** (unity-2d-panel;​ unity-2d-launcher;​ unity-2d-places;​ unity-2d-spread selon la partie d'​Unity 2D concernée)</​note>​ 
-<​note>​Après une mise à jour d'​Unity 2D, les changements seront à refaire.</​note>​ 
- 
- 
-===== Supprimer le Home Dash ===== 
-==== Afficher une lens par défaut au lieu de l'​écran d'​accueil du Dash ==== 
-<note important>​Ceci rendra la lense Home inaccessible même si on la retire pas de la liste des lenses : la fonction d'​affichage du Home redirigera vers une autre lense.</​note>​ 
-[[:​tutoriel:​comment_modifier_un_fichier|Ouvrez le fichier]] **/​usr/​share/​unity-2d/​places/​dash.qml**. 
- 
-Cherchez la fonction **function activateHome() {** (ligne 110 sur ma version d'​Unity 2D). 
- 
-Retirez le contenu de cette fonction en faisant attention aux parenthèses (il faut bien supprimer jusqu'​au bout de la fonction de façon à n'​avoir plus que  
-<​code> ​   function activateHome() { 
-} 
-</​code>​ 
-Cette fonction correspond à l'​action à effectuer lorsque l'on clique sur le bouton Ubuntu. 
- 
-Maintenant, ajoutez entre les accolades activateLens(lensId) avec à la place de lensID le nom ou le numéro de la lens que vous voulez avoir à l'​ouverture. 
- 
-Voici les noms des lenses par défaut : **applications.lens** , **commands.lens** , **files.lens** , **music.lens** ​ 
- 
-Après modification,​ votre fonction devrait ressembler à ça (les espaces devant les fonctions ne comptent pas, si vous avez mit le code sur une ligne ou sur cinq, cela n'a pas d'​importance) : 
-<​code> ​   function activateHome() { 
-        activateLens("​applications.lens"​) 
-    } 
-</​code>​ 
-Au prochain démarrage d'​Unity 2D, le bouton Ubuntu devrait maintenant affiche la lense que vous avez choisi. 
-==== Retirer l'​icône du Home Dash de la liste des lenses ==== 
- 
-[[:​tutoriel:​comment_modifier_un_fichier|Ouvrez le fichier]] **/​usr/​share/​unity-2d/​places/​LensBar.qml**. 
- 
-Chercher un code similaire à celui-ci (ligne 96 dans ma version d'​Unity 2D) : 
-<​code> ​       /* Need to manually include the Home lens */ 
-        LensButton { 
-            id: homeLens 
- 
-            Accessible.name:​ u2d.tr("​home"​) 
- 
-            focus: true 
-            icon: "​artwork/​lens-nav-home.svg"​ 
-            onClicked: dash.activateHome() 
-            active: ( dashView.activeLens == ""​ ) 
-            iconWidth: lensBar.iconWidth 
-            iconSpacing:​ lensBar.iconSpacing 
-            width: iconWidth+iconSpacing 
-            height: lensContainer.height 
-        } 
- </​code>​ 
-Et remplacez le par : 
-<​code> ​       /* Need to manually include the Home lens */ 
-        LensButton { 
-            id: homeLens 
- 
-            Accessible.name:​ u2d.tr("​home"​) 
- 
-            focus: false 
-            icon: ""​ 
-            onClicked: dash.activateHome() 
-            active:​false 
-            iconWidth: 0 
-            iconSpacing:​ 0 
-            width: 0 
-            height: 0 
-        } 
- </​code>​ 
-La lense Home ne devrait plus s'​afficher la prochaine fois que vous ouvrirez votre session. 
- 
-===== Avoir les lenses en haut à droite du Dash ===== 
-Attention, ceci a été testé pour Unity 2D 5.2, il peut donc y avoir des différences avec les anciennes versions d'​Unity 2D. 
- 
-[[:​tutoriel:​comment_modifier_un_fichier|Ouvrez le fichier]] **/​usr/​share/​unity-2d/​places/​dash.qml** 
- 
-Cherchez ce code : 
-<​code>​ 
-    Item { 
-        id: content 
- 
-        anchors.fill:​ parent 
-        /* Margins in DesktopMode set so that the content does not overlap with 
-           the border defined by the background image. 
-        */ 
-        anchors.bottomMargin:​ background.bottomBorderThickness 
-        anchors.rightMargin:​ background.rightBorderThickness 
- 
-        /* Unhandled keys will always be forwarded to the search bar. That way 
-           the user can type and search from anywhere in the interface without 
-           ​necessarily focusing the search bar first. */ 
-        /* FIXME: deactivated because it makes the user lose the focus very often */ 
-        //​Keys.forwardTo:​ [search_entry] 
- 
-        SearchEntry { 
-            id: search_entry 
- 
-            focus: true 
-            /* FIXME: check on visible necessary; fixed in Qt Quick 1.1 
-                      ref: http://​bugreports.qt.nokia.com/​browse/​QTBUG-15862 
-            */ 
-            KeyNavigation.right:​ filterPane.visible ? filterPane : search_entry 
-            KeyNavigation.down:​ pageLoader 
- 
-            anchors.top:​ parent.top 
-            anchors.topMargin:​ 11 
-            anchors.left:​ parent.left 
-            anchors.leftMargin:​ 10 
-            anchors.right:​ filterPane.left 
-            anchors.rightMargin:​ 15 
- 
-            height: 42 
- 
-            active: dash.active 
-            placeHolderText:​ { 
-                if(dash.currentPage != undefined && dash.currentPage.model.searchHint) 
-                    return dash.currentPage.model.searchHint 
-                else 
-                    return u2d.tr("​Search"​) 
-            } 
- 
-            onSearchQueryChanged:​ if (dash.currentPage != undefined) dash.currentPage.model.searchQuery = searchQuery 
-            onActivateFirstResult:​ if (dash.currentPage != undefined) dash.currentPage.activateFirstResult() 
-        } 
- 
-        FilterPane { 
-            id: filterPane 
- 
-            KeyNavigation.left:​ search_entry 
- 
-            /* FilterPane is only to be displayed for lenses, not in the home page or Alt+F2 Run page */ 
-            visible: declarativeView.activeLens != "​home.lens"​ && declarativeView.activeLens != ""​ && declarativeView.activeLens != "​commands.lens"​ 
-            lens: visible && currentPage != undefined ? currentPage.model : undefined 
- 
-            anchors.top:​ search_entry.anchors.top 
-            anchors.topMargin:​ search_entry.anchors.topMargin 
-            anchors.bottom:​ lensBar.top 
-            headerHeight:​ search_entry.height 
-            width: 300 
-            anchors.right:​ parent.right 
-            anchors.rightMargin:​ 15 
-        } 
- 
-        Loader { 
-            id: pageLoader 
-            objectName: "​pageLoader"​ 
- 
-            Accessible.name:​ "​loader"​ 
-            /* FIXME: check on visible necessary; fixed in Qt Quick 1.1 
-                      ref: http://​bugreports.qt.nokia.com/​browse/​QTBUG-15862 
-            */ 
-            KeyNavigation.right:​ filterPane.visible && !filterPane.folded ? filterPane : pageLoader 
-            KeyNavigation.up:​ search_entry 
-            KeyNavigation.down:​ lensBar 
- 
-            anchors.top:​ search_entry.bottom 
-            anchors.topMargin:​ 9 
-            anchors.bottom:​ lensBar.top 
-            anchors.left:​ parent.left 
-            anchors.right:​ !filterPane.visible || filterPane.folded ? parent.right : filterPane.left 
-            anchors.rightMargin:​ !filterPane.visible || filterPane.folded ? 0 : 15 
-            onLoaded: item.focus = true 
- 
-            /* Workaround loss of focus issue happening when the loaded item has 
-               ​active focus and is then destroyed. The active focus was completely 
-               lost instead of being relinquished to the Loader. 
- 
-               Ref.: https://​bugreports.qt.nokia.com/​browse/​QTBUG-22939 
-            */ 
-            function setSource(newSource) { 
-                var hadActiveFocus = activeFocus 
-                source = newSource 
-                if (hadActiveFocus) forceActiveFocus() 
-            } 
-        } 
- 
-        LensBar { 
-            id: lensBar 
- 
-            KeyNavigation.up:​ pageLoader 
- 
-            anchors.bottom:​ parent.bottom 
-            anchors.left:​ parent.left 
-            anchors.right:​ parent.right 
-            height: 44 
-            visible: declarativeView.expanded 
-        } 
-    } 
-</​code>​ 
-Et remplacez le par : 
-<​code>​ 
-    Item { 
-        id: content 
- 
-        anchors.fill:​ parent 
-        /* Margins in DesktopMode set so that the content does not overlap with 
-           the border defined by the background image. 
-        */ 
-        anchors.bottomMargin:​ dashView.dashMode == DashDeclarativeView.DesktopMode ? 39 : 0 
-        anchors.rightMargin:​ dashView.dashMode == DashDeclarativeView.DesktopMode ? 37 : 0 
- 
-        visible: dashView.active 
- 
-        /* Unhandled keys will always be forwarded to the search bar. That way 
-           the user can type and search from anywhere in the interface without 
-           ​necessarily focusing the search bar first. */ 
-        /* FIXME: deactivated because it makes the user lose the focus very often */ 
-        //​Keys.forwardTo:​ [search_entry] 
- 
- 
-        SearchEntry { 
-            id: search_entry 
- 
-            focus: true 
-            /* FIXME: check on visible necessary; fixed in Qt Quick 1.1 
-                      ref: http://​bugreports.qt.nokia.com/​browse/​QTBUG-15862 
-            */ 
-            KeyNavigation.right:​ filterPane.visible ? filterPane : search_entry 
-            KeyNavigation.down:​ pageLoader 
- 
-            anchors.top:​ parent.top 
-            anchors.topMargin:​ 11 
-            anchors.left:​ parent.left 
-            anchors.leftMargin:​ 10 
-            anchors.right:​ filterPane.left 
-            anchors.rightMargin:​ 15 
- 
-            height: 42 
-        } 
- 
-        LensBar { 
-            id: lensBar 
- 
-            KeyNavigation.up:​ pageLoader 
-            ​ 
-            anchors.top:​ parent.top 
-            anchors.topMargin:​ 11 
-            anchors.left:​ search_entry.anchors.right 
-            anchors.right:​ parent.right 
-            anchors.rightMargin:​ 15 
-            ​ 
-            height: 42 
-        } 
- 
-        Loader { 
-            id: pageLoader 
- 
-            Accessible.name:​ "​loader"​ 
-            /* FIXME: check on visible necessary; fixed in Qt Quick 1.1 
-                      ref: http://​bugreports.qt.nokia.com/​browse/​QTBUG-15862 
-            */ 
-            KeyNavigation.right:​ filterPane.visible && !filterPane.folded ? filterPane : pageLoader 
-            KeyNavigation.up:​ search_entry 
-            KeyNavigation.down:​ lensBar 
- 
-            anchors.top:​ search_entry.bottom 
-            anchors.topMargin:​ 9 
-            anchors.bottom:​ parent.bottom 
-            anchors.left:​ parent.left 
-            anchors.right:​ !filterPane.visible || filterPane.folded ? parent.right : filterPane.left 
-            anchors.rightMargin:​ !filterPane.visible || filterPane.folded ? 0 : 15 
-            onLoaded: item.focus = true 
-        } 
-        ​ 
-        FilterPane { 
-            id: filterPane 
- 
-            KeyNavigation.left:​ search_entry 
- 
-            /* FilterPane is only to be displayed for lenses, not in the home page or Alt+F2 Run page */ 
-            visible: dashView.activeLens != ""​ && dashView.activeLens != "​commands.lens"​ 
-            lens: visible && currentPage != undefined ? currentPage.model : undefined 
- 
-            anchors.top:​ search_entry.bottom 
-            anchors.topMargin:​ 12 
-            anchors.bottom:​ parent.bottom 
-            headerHeight:​ 10 
-            width: 300 
-            anchors.right:​ parent.right 
-            anchors.rightMargin:​ 20 
-        } 
-    } 
-</​code>​ 
  • configuration-avancee-unity-2d.1329307337.txt.gz
  • Dernière modification: Le 15/02/2012, 13:02
  • par 89.224.171.71