Commit graph libervia-backend/frontends/src/jp/base.py
Author SHA1 Message Date
Goffi
80ef13612b core, setup: huge cleaning:
- moved directories from src and frontends/src to sat and sat_frontends, which is the recommanded naming convention
- move twisted directory to root
- removed all hacks from setup.py, and added missing dependencies, it is now clean
- use https URL for website in setup.py
- removed "Environment :: X11 Applications :: GTK", as wix is deprecated and removed
- renamed sat.sh to sat and fixed its installation
- added python_requires to specify Python version needed
- replaced glib2reactor which use deprecated code by gtk3reactor

sat can now be installed directly from virtualenv without using --system-site-packages anymore \o/
2018-04-02 19:44:50 +02:00
Goffi
d4511e8e3a jp (base): fixed URI's item with use_pubsub 2018-04-01 20:41:03 +02:00
Goffi
060d4a065f jp (base): added C.ITEM pubsub flag when --item is required 2018-03-31 18:40:54 +02:00
Goffi
60eab27872 jp (base): new confirmOrQuit helper method to ask confirmation to user, and quit if he cancel 2018-03-31 18:21:56 +02:00
Goffi
31c8a752bb jp: new argument pubsub_default can be used in Commands to replace default value in help string 2018-03-31 17:10:43 +02:00
Goffi
d2dadbaf46 jp (base): add --max option:
when MULTI_ITEMS is set, --max options is automatically added, except if NO_MAX flag is set.
2018-03-29 08:59:38 +02:00
Goffi
b7e2de70d7 jp (base): fixed use_pubsub when pubsub_flags is not needed 2018-03-29 08:57:27 +02:00
Goffi
6f8834f9da jp: pubsub options refactoring:
There is now only "use_pubsub", and specification are set using "pubsub_flags" argument when instantiating CommandBase.
Options are more Python Zen compliant by using explicit arguments for item, draft, url instead of trying to guess with magic keyword and type detection.
Pubsub node and item are now always using respecively "-n" and "-i" even when required, this way shell history can be used to change command more easily, and it's globally less confusing for user.
if --pubsub-url is used, elements can be overwritten with individual option (e.g. change item id with --item).
New "use_draft" argument in CommandBase, to re-use current draft or open a file path as draft.
Item can now be specified when using a draft. If it already exists, its content will be added to current draft (with a separator), to avoid loosing data.
common.BaseEdit.getItemPath could be simplified thanks to those changes.
Pubsub URI handling has been moved to base.py.
2018-03-21 19:13:22 +01:00
Goffi
d80dd87bcc jp (base): added verbosity property to CommandBase 2018-02-28 18:28:29 +01:00
Goffi
9ab577462d jp (base): fixed assertion error when using CommandAnswering 2018-01-30 08:43:52 +01:00
Goffi
387c10cc0d dates update 2018-01-26 11:14:13 +01:00
Goffi
d95aeb2bd3 jp (base): added exitCb generic callback to display a message and quit 2017-12-12 00:11:27 +01:00
Goffi
f5f25e8ab5 misc: date update (yes it's a bit late :p ) 2017-11-03 14:31:42 +01:00
Goffi
3927da13c3 jp (ad-hoc): new "list" and "run" commands:
- list just display commands available at ad-hoc entry point. --verbose allows to display values names, which is useful for automation.

- run can either run interactively a command, or execute a workflow to automate them.
2017-10-31 23:20:04 +01:00
Goffi
3c79544cc4 jp (base): fixed CommandAnswering and progress bar 2017-10-01 12:21:23 +02:00
Goffi
62c17395bd jp (shell): use of subprocess instead of running commands in the same process:
when a command is calling host.quit() in a D-Bus callback, GLib mainloop is exiting and quit the whole process without (apparently?) any way to block it. Couldn't find a good way to avoid that, so subprocess are now used as a workaround, instead of launching commands in the same process. When we'll get rid of python-dbus, there may be an other way.

Execuring external commands is now possible through the shell/! command.
2017-07-07 22:33:55 +02:00
Goffi
783d14bfc7 jp (base): typo 2017-07-07 12:45:28 +02:00
Goffi
6672bfc57b jp (shell): shell command (REPL mode), first draft:
This command launch jp in REPL mode, allowing do normal jp commands with some facilities.
Command can be selected with "cmd" (e.g. "cmd blog").
An argument can be fixed with "use" (e.g. "use output fancy").
Command is launched with "do", or directly with its name if it doesn't conflict with a shell command.
Arguments completion is still TODO (only shell commands are completed so far).
2017-07-06 20:28:25 +02:00
Goffi
e8409b13e6 jp (base): added no_lf in disp() to avoid printing a line feed 2017-06-28 01:21:49 +02:00
Goffi
c8b4b77908 jp: fixed progress 2017-05-04 00:36:03 +02:00
Goffi
e12e25d1bf jp: added use_pubsub and use_pubsub_node_req arguments to CommandBase
pubsub add --node and --service arguments
    pubsub_node_req add --service and a positional node argument (i.e. mandatory)
2017-04-27 01:01:43 +02:00
Goffi
f7657610f4 jp (base): added msg and exit_code argument to errback so it's more generic 2017-03-29 19:42:44 +02:00
Goffi
b6c9073322 jp (base): raise InternalError if output is used when use_output is not declared 2017-03-13 23:14:00 +01:00
Goffi
4d96b85178 jp (base): output can now specify a default when registering 2017-03-12 23:33:26 +01:00
Goffi
09bf7b9b11 jp (base): replaced log.warning by stderr prints 2017-03-12 23:32:43 +01:00
Goffi
a860999204 jp (outputs): moved output options parsing and checking to base methods 2017-03-12 23:31:06 +01:00
Goffi
90824a69b0 jp (base): added generic errback to CommandBase + show error message on plugin ImportError 2017-03-09 23:09:18 +01:00
Goffi
085ed041e7 core, bridge: renamed getProfileName to profileNameGet according to new conventions 2017-03-05 21:36:01 +01:00
Goffi
c4c57e7d42 jp (base): improved module import:
module import now display a warning were suitable on import issue
2017-02-21 21:01:40 +01:00
Goffi
8155bc3ee8 jp (base, blog, output(std)): fixed bad unicode handling in stdout, use of jp.disp instead of simple print 2017-02-21 21:01:40 +01:00
Goffi
127744dd5b jp (core): added extra_outputs:
- extra outputs are output locals to a command which can be used in addition to the generic one which are compatible
    - added --output_option argument(s) to specify option specific to selected output
    - Jp.command now references the running command
2017-02-16 00:49:46 +01:00
Goffi
3e795fde5c jp (info/disco): added --node argument 2017-02-12 21:17:56 +01:00
Goffi
b5f1e45d4e core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet) 2017-02-06 22:54:43 +01:00
Goffi
e4000b4f3b jp (core): fixed signal registration for progressions 2017-01-15 16:00:40 +01:00
Goffi
1e09016747 jp (info/session): added a command to get data on current session 2017-01-05 22:22:26 +01:00
Goffi
0a5fd6f3f4 primitivus, jp: dynamic bridge + fixed D-Bus bridge:
Primitivus and jp can now load the bridge specified in sat.conf, but they are only working with D-Bus so far (need to change all sync calls to async).
    Exit code 3 is used for Bridge init error.
2016-12-18 16:28:51 +01:00
Goffi
372f54ec2a bridge (D-Bus): bad design fixes:
- renamed outputed module to dbus_bridge (to avoid uppercase and conflict with dbus module)
    - class name is now Bridge for both frontend and core (make discovery/import more easy)
    - register renamed to register_method in core, and register_signal in frontend
2016-10-03 21:15:39 +02:00
Goffi
b8e62dd69c jp: --output option:
- new --output option can be added wich use_output. use_output can be True (in which case it wild default to C.OUTPUT_TEXT), or any of C.OUTPUT_TYPES (currently text, list and dict)
    - output change the output format mainly to make command result parsing more easy, but it can also be use to add fancy effects (like coloration)
    - outputs are added with plugins in the same way as commands (import of both is done in the same method)
    - in the command class, output need to be declared with use_output=C.OUTPUT_xxx, then the data only need to be processed with self.output(data)
    - outputs can have description (not used yet)
    - use_xxx argument handling has been refactored (minor refactoring) to be more generic
    - first outputs are "default", "json" (pretty printed) and "json_raw" (compact json)
    - the first command to use them is "profile list"
2016-04-23 23:10:03 +02:00
Goffi
bf45c1d91c jp: forgotten shebang fixes 2016-04-19 20:09:02 +02:00
Goffi
d0fb849398 jp: fixed traceback shown on a normal quit when a progression is finished 2016-03-21 19:44:16 +01:00
Goffi
4b941591c5 jp: moved KeyboardInterrupt catch one level higher, so it is also catched if the loop is not started 2016-03-05 18:00:56 +01:00
Goffi
5704cb4586 jp (blog/edit): editor arguments can now be specified on sat.conf, and default on are applied for known editors:
- vim and gvim will open content and metadata file in a splitted window
    - gvim use --nofork option
    - installed a workaround for shlex.split not handling unicode before Python 2.7.3
    - some fixes
2016-03-03 15:57:06 +01:00
Goffi
b67ee6bb47 jp (base): fixed Jp.quit when exit code is 0 2016-03-02 19:45:02 +01:00
Goffi
89f6fe8605 jp (base): refactored need_loop so it is set only when the command is run. It can now be set in __init__ methods of commands classes 2016-02-29 16:52:51 +01:00
Goffi
19bdc872c6 jp (base): added a CommandBase.start method which is called by run or connected, so subclasses can implement it (this is for simplicity sake, as it's not always clear if run or connected must be used) 2016-02-29 16:52:51 +01:00
Goffi
fea3296b89 jp (base): use need_connect attribue to detect if connection is needed instead of self.args.profile, as profile argument can be used by any command even if use_profile is False 2016-02-29 16:52:51 +01:00
souliane
c18f64f4fb frontends (jp): onActionNew displays xmlui message if no meta_type is defined and xmlui is defined 2016-02-04 11:48:37 +01:00
Goffi
d1fed06699 jp: an onProgressUpdate method is now called on each progress update, allowing to handle metadata 2016-01-23 20:04:28 +01:00
Goffi
348be27934 copyright update 2016-01-03 16:28:30 +01:00
Goffi
11d7dfa8fe jp (base): progressStarted signals are cached until progress_id is known, this avoid missing the progression if we have the signal before the id. 2015-11-22 17:37:19 +01:00