Closed Bug 1231332 Opened 5 years ago Closed 5 years ago

Implement auto-completion for the repository field in the wizard

Categories

(Testing :: mozregression, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: parkouss, Assigned: parkouss, Mentored)

Details

(Whiteboard: [good first bug][lang=python])

Attachments

(1 file)

On the first page of the wizard, there is a Repository text fields. It is meant to specify a branch name, e.g: mozilla-central, inbound, aurora...

It would be great to offer an autocompletion for this field. It is possible since we now have the branches modules, particularly:

https://github.com/mozilla/mozregression/blob/master/mozregression/branches.py#L85

So from the GUI side, we can call these functions, and get the branch name list to get our auto-completion list.

In details, here is what is needed:

1. Add a *include_aliases* parameter in the get_branches methods (https://github.com/mozilla/mozregression/blob/master/mozregression/branches.py#L24). This should default to False, but when called with True the list returned should include branch aliases too. That is, we will have 'm-c', 'central' in the returned list.
2. Add a QCompleter object (http://doc.qt.io/qt-4.8/qcompleter.html) to the Repository line edit. this line edit is created in the __init__ method of the IntroPage (https://github.com/mozilla/mozregression/blob/master/gui/mozregui/wizard.py#L48). so this should look like 'self.ui.repository.setCompleter(completer)' inside this __init__ method. To fill the Completer, attach to it a QStringListModel (http://doc.qt.io/qt-4.8/qstringlistmodel.html) - and that list model should include the result of our branches.get_branches(include_aliases=True) return call.

So, this should be it! Completion should be available after that. :)

:gopianis, if you are interested to work on this bug, please say so! I will assign you the bug.
Yeah, I'll have a go at it :)
Cool! Ask if you are stuck. For the GUI dev setup, please look at https://github.com/mozilla/mozregression/blob/master/gui/README.rst.
Assignee: nobody → gopianis
Status: NEW → ASSIGNED
I've just an issue in running pip install -r requirements-gui-dev. 
I get the following error:


collect2: error: ld returned 1 exit status

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cx-Freeze/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-NY7om1-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cx-Freeze
Storing debug log for failure in /home/sumeet/.pip/pip.log


the full error message can be found here: http://pastebin.com/cDnbrC89
I have also had a google around and tried multiple solutions but they do not fix it.
I'm running Linux Mint 17 Cinamon (2.2.16) 64-bit
(In reply to Sumeet (:gopianis) from comment #4)
> I have also had a google around and tried multiple solutions but they do not
> fix it.
> I'm running Linux Mint 17 Cinamon (2.2.16) 64-bit

Hm, seems to me like you need to install python-dev package or similar (needed to build python c extensions) on your system. Then run the command again, it should work.
I've already got both python-dev and python2.7-dev installed but that does not help.
I removed them and re-installed them again but this doesn't help.
I installed cx-freeze and it works now.
I've done the first part of the bug, I've also added the missed case in get_branches
I've created 2 new test cases in test_branches.py
While I was testing, there were a few other things other scripts that were breaking the checks which I have not touched. I went and fixed them.

https://github.com/GopianiS/mozregression/commit/b2adcb2dfd55485de0c93fbd31e378023eb08207
Oh cool - maybe a new version of flake8 is available and some style issues needed to be fixed. Thanks. :)

Great to see that first step done!

So, now that we got this new function, you should be able to use it from the wizard module to fill a QCompleter and attach it to the QLineEdit to activate auto completion. You should use all branches and aliases to be possible completion, so using get_branches(include_aliases=True) seems like the needed call.
Great, looks like you've done everything!

So, the next final steps are:

1. create a github Pull request for your changes
2. create an attachment on this bugzilla bug pointing at your pull request to ask for a review (just choose me as the reviewer).

This is explained in http://ateam-bootcamp.readthedocs.org/en/latest/guide/development_process.html#git-and-github.
Gopianis,

any news here ?
Flags: needinfo?(gopianis)
Sorry, I was working on it yesterday and cannot get that last test to pass.
Flags: needinfo?(gopianis)
(In reply to Sumeet (:gopianis) from comment #13)
> Sorry, I was working on it yesterday and cannot get that last test to pass.

Ok, glad you're still working on it! Tell me if you want me to help. :)
So :gopianis do not have the time currently to work on this - I will finish the work, highly based on his initial work.

Thanks :gopianis for the initial work!
Assignee: gopianis → j.parkouss
After giving some tests, including the aliases do not seems good to me. E.g, I prefer to only display mozilla-central, but not m-c or central.

The possible completions are shown when the focus is set on the empty field, and updated with what the user type at the keyboard.

:wlach, I tested it, it seems to work fine. The code is pretty straightforward.
Attachment #8714259 - Flags: review?(wlachance)
Comment on attachment 8714259 [details] [review]
auto complete for the repository field

Ok, I'm going to r+ myself here since wlach is not around - this is a simple patch anyway.
Attachment #8714259 - Flags: review?(wlachance) → review+
Landed in https://github.com/mozilla/mozregression/commit/7932de37ffa528baee7f0553e3fb2f4dab941b49
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.