[Player-dev] CN-Client: [#8076] Fixing sort menu and sort toggle button not in sync

[Player-dev] CN-Client: [#8076] Fixing sort menu and sort toggle button not in sync

Kinson Liu kliu at real.com
Fri Sep 5 11:54:57 PDT 2008


Thanks.  It is now committed into 310atlas and HEAD.

Kinson

Rusty Lynch wrote:
> This looks good
>
> On Thu, Sep 4, 2008 at 4:56 PM, Kinson Liu <kliu at real.com> wrote:
>   
>> Looks like cvs diff -u can fix the indentation problem.  Resending the newer
>> diff.
>>
>> Thanks,
>>
>> Kinson
>>
>> Kinson Liu wrote:
>>
>> Hi Rusty,
>>
>> Thanks for answering.  Actually my fix is safe from what you said.  What
>> happened was, for some reason, cvs diff -uw stripped off some necessary
>> whitespace, making the two "else" indented out by one tab.  I tried cutting
>> and pasting the code, making sure the there are tabs instead of whitespace,
>> but the problem still existed.  Do you have any idea what I can do about?
>>
>> Thanks,
>>
>> Kinson
>>
>> Rusty Lynch wrote:
>>
>> Crud... I sent on accident.
>>
>> Forget the last reply and now the complete reply (hopefully)...
>>
>> On Wed, Sep 3, 2008 at 4:18 AM, Rusty Lynch <rustylynch1234 at gmail.com>
>> wrote:
>> <snip>
>>
>>
>> ===================================================================
>> RCS file: /cvsroot/player/mid/src/toolbar_view.py,v
>> retrieving revision 1.13.4.2
>> diff -u -w -r1.13.4.2 toolbar_view.py
>> --- src/toolbar_view.py 2 Jul 2008 20:32:43 -0000       1.13.4.2
>> +++ src/toolbar_view.py 26 Aug 2008 21:07:13 -0000
>> @@ -300,13 +300,13 @@
>>             if visible:
>>                 if sorttype == 0:
>>                     # Sorted by date, so show Sort by Name btn
>> -                    self.ph_sort_name_btn.show()
>> -                    self.ph_sort_date_btn.hide()
>> -                else:
>> -                    # Sort by name, so show Sort by Date btn
>>                     self.ph_sort_name_btn.hide()
>>                     self.ph_sort_date_btn.show()
>>             else:
>> +                    # Sort by name, so show Sort by Date btn
>> +                    self.ph_sort_name_btn.show()
>> +                    self.ph_sort_date_btn.hide()
>> +            else:
>>                 self.ph_sort_name_btn.hide()
>>                 self.ph_sort_date_btn.hide()
>>         elif mode == 'video':
>>
>>
>> The above patch results in ==>
>>
>>            if visible:
>>                if sorttype == 0:
>>                    # Sorted by date, so show Sort by Name btn
>>                    self.ph_sort_name_btn.hide()
>>                    self.ph_sort_date_btn.show()
>>            else:
>>                    # Sort by name, so show Sort by Date btn
>>                    self.ph_sort_name_btn.show()
>>                    self.ph_sort_date_btn.hide()
>>            else:
>>                self.ph_sort_name_btn.hide()
>>                self.ph_sort_date_btn.hide()
>>
>>
>>
>>  ...where my cut-n-paste may make it not very obvious, but since python
>>  works off indention level, you basically have:
>>
>>  if (foo) {
>>     if (bar) {
>>        ...
>>     }
>>  } else {
>>    ...
>>  } else {
>>    ...
>> }
>>
>> I don't think this will do what you expect.  The last 'else' block is
>> not even reachable.
>>
>>
>>
>> @@ -314,13 +314,13 @@
>>
>>
>>             if visible:
>>                 if sorttype == 0:
>>                     # Sorted by date, so show Sort by Name btn
>> -                    self.vd_sort_name_btn.show()
>> -                    self.vd_sort_date_btn.hide()
>> -                else:
>> -                    # Sort by name, so show Sort by Date btn
>>                     self.vd_sort_name_btn.hide()
>>                     self.vd_sort_date_btn.show()
>>             else:
>> +                    # Sort by name, so show Sort by Date btn
>> +                    self.vd_sort_name_btn.show()
>> +                    self.vd_sort_date_btn.hide()
>> +            else:
>>                 self.vd_sort_name_btn.hide()
>>                 self.vd_sort_date_btn.hide()
>>
>>
>> It looks like another similar problem here.
>>
>>     --rusty
>>
>>
>>
>> --
>> ________________________________
>> Kinson Liu | Software Development Engineer | RealNetworks, Inc. |
>> kliu at real.com | 206.892.6177
>>
>> ________________________________
>> _______________________________________________
>> Player-dev mailing list
>> Player-dev at helixcommunity.org
>> http://lists.helixcommunity.org/mailman/listinfo/player-dev
>>
>>
>> --
>> ________________________________
>> Kinson Liu | Software Development Engineer | RealNetworks, Inc. |
>> kliu at real.com | 206.892.6177
>> Index: constant.py
>> ===================================================================
>> RCS file: /cvsroot/player/mid/src/constant.py,v
>> retrieving revision 1.12.4.1
>> diff -u -r1.12.4.1 constant.py
>> --- constant.py 5 Jun 2008 15:51:25 -0000       1.12.4.1
>> +++ constant.py 29 Aug 2008 19:00:58 -0000
>> @@ -230,6 +230,7 @@
>>  MENU_ROTATE_CLOCKWISE = _("Rotate clockwise")
>>  MENU_ROTATE_COUNTERCLOCKWISE = _("Rotate counter-clockwise")
>>  MENU_NAME = _("Name")
>> +MENU_DATE = _("Date")
>>  MENU_SIZE = _("Size")
>>
>>  THUMB_SORT_FILENAME = 0
>> Index: toolbar_view.py
>> ===================================================================
>> RCS file: /cvsroot/player/mid/src/toolbar_view.py,v
>> retrieving revision 1.13.4.2
>> diff -u -r1.13.4.2 toolbar_view.py
>> --- toolbar_view.py     2 Jul 2008 20:32:43 -0000       1.13.4.2
>> +++ toolbar_view.py     4 Sep 2008 23:39:28 -0000
>> @@ -299,13 +299,13 @@
>>             sorttype =
>> self.app.view[mode].get_photo_thumbnail().get_sort_type()
>>             if visible:
>>                 if sorttype == 0:
>> +                    # Sorted by name, so show Sort by Date btn
>> +                    self.ph_sort_name_btn.hide()
>> +                    self.ph_sort_date_btn.show()
>> +                else:
>>                     # Sorted by date, so show Sort by Name btn
>>                     self.ph_sort_name_btn.show()
>>                     self.ph_sort_date_btn.hide()
>> -                else:
>> -                    # Sort by name, so show Sort by Date btn
>> -                    self.ph_sort_name_btn.hide()
>> -                    self.ph_sort_date_btn.show()
>>             else:
>>                 self.ph_sort_name_btn.hide()
>>                 self.ph_sort_date_btn.hide()
>> @@ -313,13 +313,13 @@
>>             sorttype =
>> self.app.view[mode].get_video_thumbnail().get_sort_type()
>>             if visible:
>>                 if sorttype == 0:
>> -                    # Sorted by date, so show Sort by Name btn
>> -                    self.vd_sort_name_btn.show()
>> -                    self.vd_sort_date_btn.hide()
>> -                else:
>> -                    # Sort by name, so show Sort by Date btn
>> +                    # Sorted by name, so show Sort by Dame btn
>>                     self.vd_sort_name_btn.hide()
>>                     self.vd_sort_date_btn.show()
>> +                else:
>> +                    # Sorted by date, so show Sort by Name btn
>> +                    self.vd_sort_name_btn.show()
>> +                    self.vd_sort_date_btn.hide()
>>             else:
>>                 self.vd_sort_name_btn.hide()
>>                 self.vd_sort_date_btn.hide()
>> @@ -887,6 +887,9 @@
>>             elif mode == 'video':
>>                 self.vd_sort_date_btn.hide()
>>                 self.vd_sort_name_btn.show()
>> +
>> +            # set "sort by date" in top menu being selected
>> +            self.app.TopMenu.item_date.set_active(True)
>>         elif value == 'name':
>>             if mode == 'photo':
>>                 self.ph_sort_name_btn.hide()
>> @@ -895,6 +898,9 @@
>>                 self.vd_sort_name_btn.hide()
>>                 self.vd_sort_date_btn.show()
>>
>> +            # set "sort by name" in top menu being selected
>> +            self.app.TopMenu.item_name.set_active(True)
>> +
>>     def set_photo_autoplay_image_change(self):
>>         self.pm_autoplay_button.hide()
>>         self.pm_pause_button.show()
>> Index: top_menu.py
>> ===================================================================
>> RCS file: /cvsroot/player/mid/src/top_menu.py,v
>> retrieving revision 1.8
>> diff -u -r1.8 top_menu.py
>> --- top_menu.py 28 May 2008 05:43:48 -0000      1.8
>> +++ top_menu.py 29 Aug 2008 19:00:52 -0000
>> @@ -119,13 +119,16 @@
>>
>>     def create_sort_sub_menu(self):
>>         menu_sort = gtk.Menu()
>> -        self.item_name = gtk.MenuItem(_(constant.MENU_NAME))
>> -        self.item_name.connect('activate',self.on_sort_name)
>> -        menu_sort.append(self.item_name)
>>
>> -        self.item_size = gtk.MenuItem(_(constant.MENU_SIZE))
>> -        self.item_size.connect('activate',self.on_sort_size)
>> -        menu_sort.append(self.item_size)
>> +        self.item_name = gtk.RadioMenuItem(None, constant.MENU_NAME, True)
>> +        self.item_name.set_active(True)
>> +        self.item_name.connect('activate', self.on_sort_name)
>> +        menu_sort.append(self.item_name)
>> +
>> +        self.item_date = gtk.RadioMenuItem(self.item_name,
>> constant.MENU_DATE, True)
>> +        self.item_date.connect('activate', self.on_sort_date)
>> +        menu_sort.append(self.item_date)
>> +
>>         return menu_sort
>>
>>     def update_menu(self, item_is_selected):
>> @@ -300,25 +303,22 @@
>>     def on_active_item_view(self,wiget,event):
>>         self.update_show_hide_labels_menu()
>>
>> -    def on_sort_name(self,widget):
>> -        hint_window.HintWindow().show_hint(constant.MSG_PHOTO_SORT_BY_NAME)
>> +    def __on_sort(self,widget,hint,type):
>> +        hint_window.HintWindow().show_hint(hint)
>>
>>         thumbnail = self.app.get_current_thumb()
>>         if (thumbnail == None):
>>             return
>> -        thumbnail.set_sort_type(constant.THUMB_SORT_FILENAME)
>> +        thumbnail.set_sort_type(type)
>>         cur_mode = self.app.get_thumb_current_mode()
>>         mode = cur_mode + '-thumb'
>>         self.app.view['toolbar'].change_mode(mode,cur_mode)
>>
>> -    def on_sort_size(self,widget):
>> -        hint_window.HintWindow().show_hint(constant.MSG_PHOTO_SORT_BY_SIZE)
>> -
>> -        thumbnail = self.app.get_current_thumb()
>> -        if (thumbnail == None):
>> -            return
>> -        thumbnail.set_sort_type(constant.THUMB_SORT_SIZE)
>> +    def on_sort_name(self,widget):
>> +
>>  self.__on_sort(widget,constant.MSG_PHOTO_SORT_BY_NAME,constant.THUMB_SORT_FILENAME)
>>
>> +    def on_sort_date(self,widget):
>> +
>>  self.__on_sort(widget,constant.MSG_PHOTO_SORT_BY_DATE,constant.THUMB_SORT_DATE)
>>
>>     ##for Mode menu handler
>>     def on_mode_normal(self,widget):
>> @@ -391,4 +391,4 @@
>>
>>        def on_button_for_updating_handler(self,widget):
>>                webbrowser.open("https://rp4mid.helixcommunity.org/files")
>> -
>> \ No newline at end of file
>> +
>>
>>
>>     
>
>
>
>   

-- 
------------------------------------------------------------------------
*Kinson Liu* | Software Development Engineer | RealNetworks, Inc. | 
kliu at real.com | 206.892.6177
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.helixcommunity.org/pipermail/player-dev/attachments/20080905/a851106e/attachment-0001.html


More information about the Player-dev mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.