Commit Graph

12388 Commits

Author SHA1 Message Date
pyup-bot
78c93e1225 Update pytest-rerunfailures from 2.1.0 to 2.2 2017-06-26 15:47:14 +02:00
pyup-bot
e8dac08a35 Update cheroot from 5.5.2 to 5.7.0 2017-06-26 15:47:13 +02:00
pyup-bot
6d1775fcd6 Update pylint from 1.7.1 to 1.7.2 2017-06-26 15:47:11 +02:00
Ryan Roden-Corrent
46161c3af0 Refactor delete_cur_item.
Taking the completion widget as an argument was overly complex.
The process now looks like:

1. CompletionView gets deletion request
2. CompletionView passes selected index to CompletionModel
3. CompletionModel passes the row data to the owning category
4. The category runs its custom completion function.

This also fixes a bug. With the switch to the hybrid (list/sql)
completion model, the view was no longer updating when items were
deleted. This fixes that by ensuring the correct signals are emitted.

The SQL model must be refreshed by running the query. We could try using
a SqlTableModel so we can call removeRows instead.

The test for deleting a url fails because qmodeltester claims the length
of the query model is still 3.
2017-06-26 08:57:36 -04:00
Ryan Roden-Corrent
866f4653c7 Fix spelling existant -> existent. 2017-06-25 22:14:38 -04:00
Justin Partain
cb67a911fa Remove recommendation to use '-c' command line argument, which doesn't exist 2017-06-21 10:56:25 -04:00
Ryan Roden-Corrent
6080830a8b Fix outdated docstring and pylint error. 2017-06-20 22:25:09 -04:00
Ryan Roden-Corrent
b722cc1dec Pass invalid index to [can]FetchMore.
For QSqlQueryModel, the argument should always be an invalid index:
http://doc.qt.io/qt-5/qsqlquerymodel.html#canFetchMore

For a QStandardItemModel, it doesn't matter. Either way, passing the
top-level parent index was wrong.
2017-06-20 22:11:53 -04:00
Ryan Roden-Corrent
63cb88a0f4 Use _cat_from_index in completionmodel.data.
Keep all the category lookup inside _cat_from_idx for easier refactoring
if the organization ever changes.
2017-06-20 22:08:23 -04:00
Ryan Roden-Corrent
0f585eda4f Bring history.py back to 100% coverage.
The code of debug_dump_history was tweaked to handle a possible
OSException that can be thrown by open, which I noticed while trying to
test it.
2017-06-20 21:41:43 -04:00
Florian Bruhin
cb5cd1a910 Remove old test_commands.py 2017-06-20 15:20:32 +02:00
Florian Bruhin
994e8c692f Merge different FakeTabbedBrowser objects 2017-06-20 15:19:53 +02:00
Florian Bruhin
096b0a7a37 Remove unused import 2017-06-20 15:03:42 +02:00
Florian Bruhin
750ef834dc Make PyOpenGL a required dependency
Looks like the "black screen" issue isn't the only thing going wrong, some
people even report segfaults since the vendor check was added.
2017-06-20 13:05:53 +02:00
Florian Bruhin
73940a64bb Update docs 2017-06-20 12:46:55 +02:00
Florian Bruhin
cf3c7266aa Make show_error keyword-only 2017-06-20 12:45:36 +02:00
Florian Bruhin
06d4a24bd1 Merge branch 'master' of https://github.com/iordanisg/qutebrowser 2017-06-20 12:45:21 +02:00
Florian Bruhin
3a7a3909d7 Merge remote-tracking branch 'origin/pyup-scheduled-update-06-19-2017' 2017-06-20 12:44:05 +02:00
Florian Bruhin
038dcff4ba Ignore common URL issues while importing history
See #2646.

This ignores the "corrupted" Apple-lookalike URLs, comments and data: URLs.
2017-06-20 12:19:14 +02:00
Florian Bruhin
f838eb1bdc Use named formatting for queries in sql.py 2017-06-20 12:11:41 +02:00
Florian Bruhin
da875755d1 Add spaces after commas in SQL queries 2017-06-20 12:06:17 +02:00
Florian Bruhin
c1776bbf9d Add error message when query failed to prepare 2017-06-20 12:05:40 +02:00
Florian Bruhin
29ce1b3811 Add column order in SqlTable._insert_query
_insert_query gets called with a query and dict of values such as:

  {'val': 1, 'lucky': False, 'name': 'one'}

Via bindValues(), we only assign a placeholder in the query string to a value,
so we get a query with bindings like:

  INSERT INTO Foo values(:lucky,:val,:name)
  {':name': 'one', ':val': 1, ':lucky': False}

So what we're executing is something like:

  INSERT INTO Foo values(false,1,"one")

However, if the column order in the database doesn't happen to be the order
we're passing the values in, we get the wrong values in the wrong columns.

Instead, we now do:

  INSERT INTO Foo (lucky, val, name) values(false,1,"one")

Which inserts the values in the order we intended.

With Python 3.6, this just happened to work before because we always passed the
keyword arguments in the table column order, and in 3.6 dicts
(and thus **kwargs) happen to be ordered:
https://mail.python.org/pipermail/python-dev/2016-September/146327.html
2017-06-20 12:03:43 +02:00
Florian Bruhin
27c6aa00bd travis: Add group: edge 2017-06-19 18:15:35 +02:00
Iordanis Grigoriou
f0ff02fcb2 Avoid throwing exception when no last focused tab exists 2017-06-19 15:48:17 +02:00
pyup-bot
aa460a7abd Update hypothesis from 3.11.3 to 3.11.6 2017-06-19 15:46:21 +02:00
pyup-bot
0306c3e898 Update cheroot from 5.5.0 to 5.5.2 2017-06-19 15:46:19 +02:00
pyup-bot
61737f95a9 Update requests from 2.17.3 to 2.18.1 2017-06-19 15:46:18 +02:00
pyup-bot
5913f92b19 Update requests from 2.17.3 to 2.18.1 2017-06-19 15:46:16 +02:00
pyup-bot
86fffb5462 Update requests from 2.17.3 to 2.18.1 2017-06-19 15:46:15 +02:00
Florian Bruhin
3053ed01e4 backers: Add Bostan 2017-06-19 15:30:09 +02:00
Florian Bruhin
2adb57f263 travis: Remove the archlinux-ng docker env
Archlinux merged qt5-webkit-ng into qt5-webkit
2017-06-19 14:17:56 +02:00
Florian Bruhin
7062f9e060 Update qt5-webkit-ng docs for Archlinux 2017-06-19 13:44:41 +02:00
Florian Bruhin
4296a61b9a tests: Clean up check_history 2017-06-19 07:44:11 -04:00
Florian Bruhin
9f94f28181 Use :memory: for an in-memory database
Using an empty string for the same purpose only started working in some
recent-ish Qt/sqlite/? version, so using --version failed on Ubuntu Trusty.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
051d2665f3 Fix signal type error in CompletionView.
On Travis CI we are sometimes seeing:

```
CompletionView.selection_changed[str].emit():
argument 1 has unexpected type 'int'
```

Cast the data to a string before emitting it just to be safe.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
891a6bcf14 Fix flake8 errors 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
c7a18a8b8d Fix tests for recent sql changes 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
4e87773d89 Use a dict instead of named params for insert.
This allows replace to be a named parameter and allows consolidating
some duplicate code between various insert methods.

This also fixes some tests that broke because batch insert was broken.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
e436f48164 Small sql fixes.
- Remove unused SqlTable.Entry
- Fix wording of two log messages
- Remove unused import
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
f4f52ee204 Remove history.Entry.
No longer needed with sql backend. Query results build their own
namedtuple from the returned columns, and inserting new entries is just
done with named parameters.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
1fe1813431 Fix pylint errors. 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
cf23f42b99 Use splitlines in test_history_bdd again.
Just using read() returns a single string, and iterating over that
iterates over each character.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
679e001a48 Separate sqlcategory title from table name.
Also fix a number of sql/completion tests that were failing.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
61a1709141 Fix completion selection bug.
Fix the issue where pressing `o<esc>o` would show a url completion
dialog where attempting to <Tab> select items would do nothing but show
a Qt warning.

The fix is to ensure we set _last_completion_func to None whenever we
clear completion (there was a case I missed).

It also ensures we always delete the old model and adds a safety to
prevent deleting an in-use model is set_model is called with the current
model.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
fa39b82b3c Backup old history file after import.
Instead of removing it, move it to history.bak.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
a6a9ad72f9 Fix test_history_interface.
This was still using a history dict instead of SQL history.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
22b7b21d5a Use named placeholders for sql queries. 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
862f8d3188 Always return col 0 for index parent.
This was changed during code review but was causing Qt errors while
TAB-completing in the selection view:

08:42:34 WARNING  qt         Unknown module:none:0 Can't select indexes from different model or with different parents
2017-06-19 07:44:11 -04:00
Florian Bruhin
18cd8ba0b6 Add indices for HistoryAtimeIndex and CompletionHistoryAtimeIndex
before
------

sqlite> SELECT * FROM History where not redirect and not url like "qute://%" and atime > ? and atime <= ? ORDER BY atime desc;
Run Time: real 0.072 user 0.063334 sys 0.010000

sqlite> explain query plan SELECT * FROM History where not redirect and not url like "qute://%" and atime > ? and atime <= ? ORDER BY atime desc;
0|0|0|SCAN TABLE History
0|0|0|USE TEMP B-TREE FOR ORDER BY

sqlite> explain query plan select url, title, strftime('%Y-%m-%d', last_atime, 'unixepoch') from CompletionHistory where (url like "%qute%" or title like "%qute%") order by last_atime desc;
0|0|0|SCAN TABLE CompletionHistory
0|0|0|USE TEMP B-TREE FOR ORDER BY

after
-----

sqlite> SELECT * FROM History where not redirect and not url like "qute://%" and atime > ? and atime <= ? ORDER BY atime desc;
Run Time: real 0.000 user 0.000000 sys 0.000000

sqlite> explain query plan SELECT * FROM History where not redirect and not url like "qute://%" and atime > ? and atime <= ? ORDER BY atime desc;
0|0|0|SEARCH TABLE History USING INDEX AtimeIndex (atime>? AND atime<?)

sqlite> explain query plan select url, title, strftime('%Y-%m-%d', last_atime, 'unixepoch') from CompletionHistory where (url like "%qute%" or title like "%qute%") order by last_atime desc;
0|0|0|SCAN TABLE CompletionHistory USING INDEX CompletionAtimeIndex
2017-06-19 07:44:11 -04:00