Commit graph

371 commits

Author SHA1 Message Date
Romain Bignon
20835e5180 ls: clear objects list 2012-04-10 13:25:55 +02:00
Laurent Bachelier
2d463e060e Hide ConversionWarning by default
refs #839
2012-04-10 08:01:27 +02:00
Romain Bignon
101eabf17a fix format of dicts 2012-04-07 23:15:06 +02:00
Romain Bignon
fc849995f4 rewrite of the formatters system 2012-04-03 22:40:38 +02:00
Roger Philibert
4b05f77329 [app/console] use EDITOR env variable to edit input 2012-04-01 19:28:11 +02:00
Laurent Bachelier
3b2bafdf12 Centralize "empty" comparisons
And always use "is" instead of "==".
2012-03-27 12:14:37 +02:00
Romain Bignon
c6a141595c change way to describe fields of CapBaseObject, and lot of documentation 2012-03-26 14:35:54 +02:00
Clément Schreiner
76795b27a2 Ask for correct login information (for example "Account ID" in boobank) instead of always asking for "Password". 2012-03-25 12:51:38 +02:00
Romain Bignon
1833952af1 fix completion of 'cd' after using 'ls' with a parameter 2012-03-25 09:45:31 +02:00
theo
67ae0893cd Add completion to ls in CapCollection
The completion is the same code as ls used to call.
2012-03-20 07:52:40 +01:00
theo
8c977825b9 ls dir is equivalent to cd dir + ls + cd ..
Until now, ls discarded arguments.

ls = ls dir:

videoob> ls
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)
videoob> ls sport
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)

With this patch, we are now able to ls a dir without chdir into it.

For instance:
videoob> ls
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)
videoob> ls sport
~ (les-incontournables) Les incontournables (canalplus)
~ (les-plus-recentes) Les plus recentes (canalplus)
~ (les-plus-vues) Les plus vues (canalplus)
~ (tout-le-football) Tout le football (canalplus)
~ (tout-le-rugby) Tout le rugby (canalplus)
~ (tout-le-basket) Tout le basket (canalplus)
~ (tout-le-tennis-golf) Tout le tennis / golf (canalplus)
~ (autres-sports-home-sport) Autres sports - home sport (canalplus)
~ (les-emissions-sport) Les emissions sport (canalplus)
videoob> ls
~ (emissions) Emissions (canalplus)
~ (sport) Sport (canalplus)
~ (cinema) Cinema (canalplus)
~ (cesar-2012) Cesar 2012 (canalplus)
~ (series-fictions) Series / fictions (canalplus)
~ (du-hard-ou-du-cochon) Du hard ou du cochon (canalplus)
~ (divertissement) Divertissement (canalplus)
~ (canal-street) Canal street (canalplus)
~ (musique) Musique (canalplus)
~ (docus-infos) Docus / infos (canalplus)

Signed-off-by: theo <theocrite@theocrite.org>
2012-03-16 17:20:18 +01:00
Laurent Bachelier
006e97a8be PEP8 style fixes and other small style fixes
I used autopep8 on some files and did carefully check the changes.
I ignored E501,E302,E231,E225,E222,E221,E241,E203 in my search, and at
least E501 on any autopep8 run.

Other style fixes not related to PEP8:
* Only use new-style classes. I don't think the usage of old-style
  classes was voluntary. Old-style classes are removed in Python 3.
* Convert an if/else to a one-liner in mediawiki, change docstring style
  change to a comment something that wasn't really appropriate for a
  docstring.
* Unneeded first if condition in meteofrance
2012-03-14 04:51:46 +01:00
Laurent Bachelier
fae4470101 Prepare for objects that are also Collections
Don't force objects to have an id, especially since that id was
incorrect. "plap/plop" would have the same id as "plop", i.e. "plop".
We don't rely on the id for handling Collections anymore.

Change to use more unique property names.

Change the display, instead of using '*', we use '~', and there is no
"Collection" header anymore.
Updated formatters could use that way of showing the object is also a
collection too.

refs #774
2012-03-13 22:08:46 +01:00
Laurent Bachelier
f4dbefb6ef Add some useful properties to Collection 2012-03-13 22:08:46 +01:00
Laurent Bachelier
e70a125ab9 Make collection validation more powerful
Handle and use exceptions.
An example is provided with the redmine backend (not very useful
though). If you cd into the project title instead of the id, it is
accepted and the path is corrected.
2012-03-13 22:08:46 +01:00
Laurent Bachelier
c0121ae6ab Fix crash when entering unicode paths
prompt must be str, not unicode, so we encode it
2012-03-13 22:08:46 +01:00
Laurent Bachelier
b6021d4732 Better path changing support
* Create a get_collection method similar to get_* methods for objects.
* Fix title initialization of a collection
* Remove the hack were both id and title were allowed when CDing.
  That hack only worked with the canalplus module, and failed with
  others like redmine (but they still showed in suggestions).
  Moreover, the canalplus module now has friendlier IDs
  so this is not really needed anymore.
* Allow backends to tell if a path is valid or not.
  For instance, it now allows to cd in a Redmine project with no issues
  in it. It also won't display "404" for invalid project IDs.
  By default, we still use the unreliable method of checking there is at
  least one result in iter_resources().
* Fix cd completion to work with unicode strings (all strings after an
  unicode string were ignored!)
* Do not suggest '..' when completing cd in the root

refs #774
2012-03-13 22:08:45 +01:00
Laurent Bachelier
b4b7182960 Make Collection more safe and sane
* Remove callbacks in Collection object
  Make Collection a "dumb" object (and also a base object,
  though it isn't very useful for now)
* Rename Path to WorkingPath, because it is more about managing state
  than being a single path.
* Rewrite almost all WorkingPath, because the code was overly
  complicated for no reason (I tried some special cases and it turned
  out that fromstring didn't handle them, and that the
  quote-escape-unquote was just unecessary). I also rewrote it to be
  more pythonic (no more lambdas and maps) and added tests.
* Require the full split path when creating a Collection. Because, come to
  think of it, an object needs an unique identifier; in the case of
  Collections, it is the full path, not only its last part.
  I might even replace the id by the full split path in the future.
* There is now only one way to get items of a Collection: calling
  iter_resources().
* Rewrite flatten_resources to iter_resources_flat(), which just calls
  iter_resources() recursively.
* Rewrite the collection part of the canalplus module. There is no more
  callback or a page calling the browser to check another page!
  The logic is only in iter_resources().
  The resulting code is not very pretty, but it should get better.
  As a bonus, avoid to reload the main XML file when we already have it
  open.
* change_path() now expects a split path and not a string.
* up/home special cases for "cd" are handled in the same place, and
  store the previous place properly (but are not yet exploitable by
  an user command).

This is a big commit but it would be hard to split it in *working*
commits.

If you read this entire commit message, I will buy you a beer.

refs #774
fixes #773
2012-03-13 22:08:45 +01:00
Laurent Bachelier
062f2c4c3e Fix Python 2.5 support
And fix some PEP8 style issues (mostly about spaces) while I was there.

refs #806
2012-03-13 12:36:02 +01:00
Romain Bignon
fbe9ccec04 fix crash when trying to add twice a same module 2012-02-25 13:43:58 +01:00
Romain Bignon
3eddf8e6dd fix unicode issue 2012-02-19 18:34:33 +01:00
Romain Bignon
9162f1c09e convert arguments to unicode even if no locales are set 2012-02-17 14:43:09 +01:00
Romain Bignon
07f105910e add new application qflatboob 2012-02-16 16:29:40 +01:00
Laurent Bachelier
9c5326c0e4 Make CapCollection a bit more useable
Collections are not stored in replapplication.objects anymore, but in
replapplication.collections. This fixes the IDs issue. There was no gain
from storing them in objects.

Completion right after cd should be faster (and should always have been
like that, it was pretty much a bug).

The display of do_ls() should be much clearer. Collections are always at
the end, have ids/title/backend like objects (but using a formatter
would be better than my current hack).

There are still many issues with the current implementation.
refs #774
closes #785
2012-02-12 15:49:08 +01:00
Laurent Bachelier
c805f4c866 Information is an uncountable noun 2012-02-10 01:28:40 +01:00
Romain Bignon
dfb52a2624 verbose error messages in Qt applications (closes #775) 2012-02-05 17:19:36 +01:00
Laurent Bachelier
bfb3689456 Add object type filtering to iter_resources 2012-02-05 13:30:02 +01:00
Laurent Bachelier
53915bf6b5 Better way of testing the start of a string 2012-02-04 02:08:56 +01:00
Laurent Bachelier
baab16b931 Fix completion with new Collection objects 2012-02-03 00:07:45 +01:00
Laurent Bachelier
682e14c86a Make CapCollection understandable and useable by humans
* Make the declaration of fct and it in the constructor Collection,
 instead of adding them from the outside
* Add a function to flatten a list containing collection (solves the
 radioob search crash)
* Better display of collections in the "ls" command (and display both id
 and title)
* The "cd" command goes to the root of the path (like the UNIX cd)
* Move the Video object of canalplus in a correct path
* Make Collection iterable
* Add comments to CapCollection
* Cache the result of fct in a Collection; it is only called once
* CollectionNotFound errors can be more explicit by providing a path
* Require utf-8 in collection paths
* Code cleanups
2012-02-02 23:44:13 +01:00
Romain Bignon
10215d1e4c add a repositories editor in weboob-config-qt 2012-02-02 17:18:15 +01:00
Romain Bignon
8bf985ad86 do not prompt password when empty 2012-02-02 15:57:34 +01:00
Romain Bignon
33d7a8d466 fetch icons asynchronously (closes #756) 2012-02-02 15:36:36 +01:00
Romain Bignon
c009b26864 fix crash when a command doesn't have a docstring 2012-02-02 08:44:00 +01:00
Romain Bignon
de1326fcb2 improve message when trying to add a backend with missing dependancies 2012-01-29 14:16:16 +01:00
Romain Bignon
0c1b79cd42 enhancements of the 'a' choice in menu of first launch
- Don't add backends already existing
- ^C stop all backends adding
- Better presentation
- Exit menu after using 'a'
2012-01-29 12:05:22 +01:00
theo
6f27b02865 Add all backends at once
When no backends are loaded, a prompt pops up and
suggest to add some.

This patch adds the possibility to select all at once.

Signed-off-by: theo <theocrite@theocrite.org>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
2012-01-29 11:53:24 +01:00
Romain Bignon
3a3bbd377e support XDG Base Directory Specification (closes #765) 2012-01-27 17:34:08 +01:00
Romain Bignon
5bd0aeed41 setup a default logging handler at app startup, before parsing args (-vdq) 2012-01-27 17:34:08 +01:00
Romain Bignon
fd22eb5367 do not ask before installing a module 2012-01-19 10:50:27 +01:00
Romain Bignon
b3c797978a automatically install missing modules referenced in ~/.weboob/backends 2012-01-19 10:48:26 +01:00
Romain Bignon
ae2f417e0b fix crash when trying to edit a backend of an unexistant module 2012-01-18 00:13:46 +01:00
Romain Bignon
14a7a1d362 support repositories to manage backends (closes #747) 2012-01-17 17:00:05 +01:00
Romain Bignon
d8a3a4360e fix unicode error 2011-12-07 15:07:16 +01:00
Romain Bignon
b0d84fff2a fix unicode issue (closes #703) 2011-10-04 08:57:04 +02:00
Romain Bignon
5337e53b49 split BaseBrowser into new class StandardBrowser which is usable without inheriting it 2011-09-23 09:59:12 +02:00
Romain Bignon
a698e16104 sort backends list by names 2011-08-27 18:35:35 +02:00
Romain Bignon
367d996d50 get_object doesn't request the backend name in IDs (dedicated to fucking nigger pankkake) 2011-08-12 15:46:40 +02:00
Romain Bignon
18dd9e2b8f always flush formatter after calling a command 2011-08-12 09:56:30 +02:00
Romain Bignon
ddda7f88e4 sort backends by name when querying user to select one 2011-07-22 21:02:21 +02:00