[Player-dev] RE: [Midplayer-private-dev] CR-Resend: [#8076] Fixing sort menu and sort toggle button not in sync
Lynch, Rusty rusty.lynch at intel.comThat's the one (or maybe 'one of') the evil things about python... white space is more then just making code readable.
Taking out the 'w' in your diff should do the trick, but then you need to be carefull so that your not loading your changes with lots of unnessicary whitespace changes (which is a good thing anyway.)
--rusty
________________________________________
From: midplayer-private-dev-bounces at lists.helixcommunity.org [midplayer-private-dev-bounces at lists.helixcommunity.org] On Behalf Of Kinson Liu [kliu at real.com]
Sent: Thursday, September 04, 2008 7:52 PM
To: Rusty Lynch
Cc: midplayer-private-dev at helixcommunity.org; Player-dev
Subject: Re: [Midplayer-private-dev] CR-Resend: [#8076] Fixing sort menu and sort toggle button not in sync
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><mailto: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<mailto:kliu at real.com> | 206.892.6177