rahims/SoCo

Can't set volume to 0

DPH opened this issue · 5 comments

DPH commented

Great project - really enjoying it.

Because the volume can get or set volume it sets the value to False when getting volume.
Setting the volume to 0 is also interpreted as False so you can never set volume to 0.

Fix suggested by Kenneth Nielsen is to use the None Type as follows:

def volume(self, volume=None):
   ''' '''
    if volume is None:
        rest of code.......

etc......

have tested and it works fine
Cheers David

Ah, that's nice. I was actually speaking more generally and wasn't aware that there was any actual problems with it, nice catch. When we get it fixed I'll be sure to add a unit test for it. If you would like, it would be cool if you would create a fix for it as a commit or as a named branch containing the fix. That way, it'll be real easy for @rahims to include.

DPH commented

Hi, thanks - been wondering how to fix it for some time and then I read
your suggestion.
Am new to GitHub, but have posted my first pull request an hour ago
(an extension to mute)
Am doing it from Windows which currently lacks tutorials....
Love the sharing and collaboration that seems to occur.

Will do another commit for the volume issue, and make the same change for
bass and treble in the morning.
Am I right if I do a commit to my repository - I still need to make the
pull request?
Also assume I should make the changes to the base version of SoCo not the
one I have already commited.
Bed time in the UK right now

Cheers David

On 3 March 2013 22:40, Kenneth Nielsen notifications@github.com wrote:

Ah, that's nice. I was actually speaking more generally and wasn't aware
that there was any actual problems with, nice catch. When we get it fixed
I'll be sure to add a unit test for it. If you would like, it would be cool
if you would create a fix for it as a commit or as a named branch
containing the fix. That way, it'll be real easy for @rahimshttps://github.com/rahimsto include.


Reply to this email directly or view it on GitHubhttps://github.com//issues/29#issuecomment-14357232
.

Ok, so about the commits and the pull requests. You actually make a pull request for the branch, not for the commit*. So what you have requested in the "extend mute" pull request is to have you master branch pulled into rahims master branch. If you make any commits to your master branch after, those commits will also become part of the existing pull request for that branch. For an example you can have a look at the pull request I have made for unit tests; #17 I made the pull essentially just to let people know that I'm working on it, and therefore rahims left it open and I continued to work on it. This feature is also especially useful if you want to make changes based on feedback you get on your pull request. You can just make the changes in another commit, based on the feecback, and it will automatically be included in the pull request.

But ok, so how do we work with several things at once (like your extension to mute and the volume fix). I'm pretty sure the "git way" to do it is to use named branches. I have discussed that a little with @scottgwaters in another thread: #27 (comment) which you could have a look at.
I'd be happy to answer any questions about it you may have, well, to the extent that I understand it anyway ;)

I myself am developing from Linux so I'm a little unsure how to do it with windows. As far as I know there should be a command line implementation of git for windows, which should definitely be able to work with branches. Another options is to look for an editor of IDE that both supports python and can work with git directly. I googled "windows ide python git" and there did seems to be some useful information. But I guess it depends on how you want to work and so on, which solution you choose.

Regards Kenneth

  • While in general it is better to use branches, I'm pretty sure it is possible e.g. for rahims to "cherry pick" certain commits from your repository based on their hash values, but it is more work since he will have to do it for each commit individually.
DPH commented

Hi Kenneth,
thank you for your help and replies. Understand the benefit of using branches and have it sort of working on my Windows PC. Have tried using Git from eclipse (but that became hard), have tried the Git for Windows which is quite good, and also installed git command line for windows.

One question: there is only one set of code in the directories on my file system. When I switch branches this code changes. Is that what should happen? If so I assume I can't have 2 branches open simultaneously in an editor (e.g. eclipse)?

Cheers David

When you switch between branches (with git checkout) the files in the working directory update accordingly. If you need to have two branches available at the same time, you could create two separate clones of the repository, and work with those. If you just need to compare branches, you can always use git diff and git log with different branch names, commit hashes, etc.