Merge lp:~joshuascotton/entertainer/bug-281245 into lp:entertainer

Proposed by Joshua Scotton
Status: Merged
Merge reported by: Paul Hummer
Merged at revision: 290
Proposed branch: lp:~joshuascotton/entertainer/bug-281245
Merge into: lp:entertainer
To merge this branch: bzr merge lp:~joshuascotton/entertainer/bug-281245
Reviewer Review Type Date Requested Status
Paul Hummer Approve
Entertainer Release Team Pending
Review via email: mp+1297@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Joshua Scotton (joshuascotton) wrote :

=== modified file 'entertainerlib/frontend/gui/screens/main_screen.py'
--- entertainerlib/frontend/gui/screens/main_screen.py 2008-10-11 13:31:42 +0000
+++ entertainerlib/frontend/gui/screens/main_screen.py 2008-10-12 20:27:03 +0000
@@ -254,9 +254,17 @@
         Update screen widgets. This is called always when screen is poped from
         the screen history. Updates main menu widget.
         """
+ selected_name = self.menu.get_selected().get_name()
+
         self.group.remove(self.menu)
         self.create_main_menu()

+ index = self.menu.index(selected_name)
+ if not index == -1:
+ self.menu.select(index)
+
+ self.update_preview_area(self.menu.get_selected())
+
     def update_preview_area(self, item):
         """
         Update preview area. This area displayes information of currently
@@ -355,6 +363,6 @@
                     menu_item = self.preview_menu.get_current_menuitem()
                     data = menu_item.get_userdata()
                     self.ui.changeScreen(self.ui.createScreen("entry", data),
- Transition.FORWARD)
+ Transition.FORWARD)

=== modified file 'entertainerlib/frontend/gui/widgets/scroll_menu.py'
--- entertainerlib/frontend/gui/widgets/scroll_menu.py 2008-08-02 21:33:38 +0000
+++ entertainerlib/frontend/gui/widgets/scroll_menu.py 2008-10-12 20:26:46 +0000
@@ -35,7 +35,7 @@
     def add(self, actor):
         """
         Add new menuitem to the menu.
- @param item: clutter.Actor
+ @param item: Label
         """
         clutter.Group.add(self, actor)

@@ -63,9 +63,36 @@
         """
         Remove all actors from the menu.
         """
+ del self.__items
+ self.__items = []
+
+ def index(self, text):
+ """
+ Returns index of label with the text as passed, returns -1 if not found
+ @author Joshua Scotton
+ """
+ for item in self.__items:
+ if item.get_name() == text:
+ return self.__items.index(item)
+ return -1
+
+ def select(self, index):
+ """
+ Selects the item at the passed index, does not support animations
+ @author Joshua Scotton
+ """
+ #split list so that item at the index will now be at position 2
+ #which is the selected index in a scroll menu
+ list = self.__items[index-2:] + self.__items[0:index-2]
+
+ #Basically remove all then add in the correct order
         self.remove_all()
- del self.__items
- self.__items = []
+ for item in list:
+ #Remove all doesn't remove the parent object. So in order to avoid
+ #adding two parent clutter items to the item we need to remove the
+ #old one first
+ clutter.Group.remove(self, item)
+ self.add(item)

 # def set_selector(self, selector):
 # """

Revision history for this message
Paul Hummer (rockstar) wrote :

Thanks for the patch!

review: Approve
Revision history for this message
Paul Hummer (rockstar) wrote :

Oops! This branch seems to conflict with the current trunk.

289. By Joshua Scotton

merged in branch and fixed 1 conflict

Revision history for this message
Joshua Scotton (joshuascotton) wrote :

merged and fixed

Subscribers

People subscribed via source and target branches