Commit graph libervia-backend/sat_frontends/jp/base.py
Author SHA1 Message Date
Goffi
e84436adfd cli: helper method to retrieve profile's jid:
rel 369
2022-07-10 16:15:09 +02:00
Goffi
da7a90abd2 CLI: don't fail when calling getContacts with a component profile 2022-05-13 19:15:30 +02:00
Goffi
14d00a9dda merge bookmark @ 2021-11-12 17:21:24 +01:00
Goffi
2cc637cdfe cli (base): use XTERM_VERSION to detect XTerm:
Using `TERM` is not good as it is used by other terminal emulators which are incompatible
with ANSI sequences (seen with `cool-retro-term`).
2021-11-06 18:53:00 +01:00
Goffi
1419f29df6 cli (debug/theme): display currently used background 2021-11-06 17:09:28 +01:00
Goffi
b1529c1ebf cli (base): better background detection:
- ANSI escape code detection is only used on terminals known to be compatible (currently
  xterm, konsole, and all VTE based ones)
- `COLORFGBG` environment variable is used as fallback
- if both methods fail, `dark` is used

This should avoid problems with incompatible terminals (e.g. on QTerminal, users had to
press `[ENTER]` each time).

fix 406
2021-11-06 17:08:50 +01:00
Goffi
33fc985410 merge branche "@" 2021-09-01 13:47:17 +02:00
Goffi
25a31896cb cli: call bridge.getReady() after bridge connection 2021-09-01 13:46:43 +02:00
Goffi
d10ce3ad7a jp (base): add flag for use_pubsub to add cache skipping option 2021-07-29 22:51:01 +02:00
Goffi
f2a06bbcbf plugin XEP-0060: getItems extra is now serialised dict 2021-07-28 23:01:15 +02:00
Goffi
7adbf3ead8 core, frontends: fix invalid translatable strings.
Some f-strings where used in translatable text, this has been fixed by using explicit
`format()` call (using a script based on `tokenize`).

As tokenize messes with spaces, a reformating tool (`black`) has been applied to some
files afterwards.
2021-06-14 18:35:12 +02:00
Goffi
8b3d900922 cli: update constants to use new name 2021-06-09 17:29:29 +02:00
Goffi
9442835ddb jp: fix background guessing when stdin is redirected 2021-06-04 15:23:24 +02:00
Goffi
24a4b12ac4 frontends: use new EXIT_BACKEND_NOT_FOUND exit code:
- new EXIT_BACKEND_NOT_FOUND (5) is used when frontend can't find backend with the bridge.
  It differs from EXIT_BRIDGE_ERROR (3) which is used when something went wrong when
  connecting to backend.
- use this exit code in quick app and in jp
2021-03-23 21:21:00 +01:00
Goffi
686ea30b22 jp: config section is now cli instead of jp following global renaming 2021-03-21 18:16:09 +01:00
Goffi
1955c94725 core (setup), jp, primitivus: update console scripts + classifiers:
- console scripts have been updated following the renaming with:
    - "libervia-cli" and "libervia-tui" for "jp" and "primitivus"
    - "li" alias as a shortcut for libervia-cli
    - "jp" and "primitivus" are kept as alias
- updated classifiers to reflect Python 3.9 support
2021-03-20 20:42:07 +01:00
Goffi
dc86957043 date update 2021-03-19 15:45:14 +01:00
Goffi
d818f1737b jp (base, pubsub/set): new --quiet argument:
`--quiet` can be used to only return essential data from command. This is notably useful
to remove message and trailing line feed when returning a data which must be parsed by an
other program.
2020-11-12 14:53:16 +01:00
Goffi
f1ec7b4d43 jp: new confirm method:
it completes `confirmOrQuit` method to ask confirmation without quitting.
2020-11-12 14:53:16 +01:00
Goffi
ed39d5340d jp (file/send): don't add main resource to bare jid anymore:
bare jid sending is now managed by backend (at least for Jingle), so resource must not be
added automatically anymore.
2020-11-12 14:53:16 +01:00
Goffi
f4c7f5e55e jp: replace no_lf argument by end in disp (same as in print) 2020-11-12 14:53:16 +01:00
Goffi
4c2c9b4f04 jp: don't guess background when stdout is not a tty 2020-10-15 14:44:42 +02:00
Goffi
a39349fe64 dates update 2020-01-29 09:50:54 +01:00
Goffi
4e9b0f0d54 jp: default to "dark" if background is not set and can't be detected 2019-10-03 22:17:19 +02:00
Goffi
36ccde03b9 jp: password is now prompted if needed:
if password is not specified on command line, it is now prompted if it is needed to start
a profile session or connect it. The password is prompted with echo disabled, so somebody
seing the computer screen can't see the password.

fix 207
2019-10-01 22:49:11 +02:00
Goffi
1efb60a429 jp: dark and light theme:
- `background` setting can now be used in sat.conf to indicate if the terminal use a
  `dark` or a `light` colour
- if `background` is not set or set to `auto`, the background colour is autodetected
- Jp.get_config (or CommandBase.get_config) method can now be used to retrieve a setting
2019-10-01 22:49:10 +02:00
Goffi
c61f6237a4 jp: handle dbus bridge with asyncio:
D-Bus bridge is now working again, using the new AsyncIO version. To make it work, the
GLib loop is run in a separated thread.

Loops have been moved to the `loops` module.
2019-10-01 22:49:10 +02:00
Goffi
76aadbb3fb jp: jp asyncio port:
/!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\

This patch implements the port of jp to asyncio, so it is now correctly using the bridge
asynchronously, and it can be used with bridges like `pb`. This also simplify the code,
notably for things which were previously implemented with many callbacks (like pagination
with RSM).

During the process, some behaviours have been modified/fixed, in jp and backends, check
diff for details.
2019-09-25 08:56:41 +02:00
Goffi
fbfe96c505 Python 3 port:
/!\ this is a huge commit
/!\ starting from this commit, SàT is needs Python 3.6+
/!\ SàT maybe be instable or some feature may not work anymore, this will improve with time

This patch port backend, bridge and frontends to Python 3.

Roughly this has been done this way:

- 2to3 tools has been applied (with python 3.7)
- all references to python2 have been replaced with python3 (notably shebangs)
- fixed files not handled by 2to3 (notably the shell script)
- several manual fixes
- fixed issues reported by Python 3 that where not handled in Python 2
- replaced "async" with "async_" when needed (it's a reserved word from Python 3.7)
- replaced zope's "implements" with @implementer decorator
- temporary hack to handle data pickled in database, as str or bytes may be returned,
  to be checked later
- fixed hash comparison for password
- removed some code which is not needed anymore with Python 3
- deactivated some code which needs to be checked (notably certificate validation)
- tested with jp, fixed reported issues until some basic commands worked
- ported Primitivus (after porting dependencies like urwid satext)
- more manual fixes
2019-08-13 19:08:41 +02:00
Goffi
d85f1b364f jp, plugin merge-requests: used u'' as default for item id in pubsub arguments + fixed some required arguments:
u"" is now used as defaut item id instead of node, as it needs to be serialised anyway. This is temporary solution, as empty string can be used for item id (not forbidden by XEP-0060), but for now this is not handled correctly in jp/SàT (see https://bugs.goffi.org/bugs/view/289). Correct solution will probably need to use a special key in extra to mark empty string in id.
Added/removed some required values for node or item when it made sense.
2019-04-14 08:21:51 +02:00
Goffi
0dad996942 jp (base): fixed default values for --max-items and --max when using pubsub 2019-01-12 16:50:58 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
7a9ee35cfc misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext) 2019-01-11 11:13:15 +01:00
Goffi
fa0179f87e jp (base): MAM and RSM arguments can now be used for pubsub commands:
- RSM and MAM args arguments have been added to pubsub group, and activated when multiple items are possible
- /!\ --max-items (i.e. pubsub original max) short option has been change for -M, and -m is now used for RSM max
- pubsub/search -m option has been renamed -M for same reason as above
- pubsub/search -o option has been replaced by -k (for keep), to avoid conflict with order-by (and long version is now --node-max)
2019-01-11 10:18:02 +01:00
Goffi
169165e4ee jp (base, pubsub, ticket): handle order-by:
--order-by has been added to pubsub group.
New getPubsubExtra helper method generate extra dict according to arguments.
getPubsubExtra is used for pubsub/get, blog/get and and ticket/get.
2019-01-06 17:39:57 +01:00
Goffi
93b23f1cc8 jp (base): pubsub legacy --max option renamed to --max-item to prepare the use of --max for RSM. 2018-12-01 10:47:59 +01:00
Goffi
32af40e098 jp (base): new own_jid host attribute:
this attribute is None by default and must be filled at runtime if needed by a command.
2018-12-01 10:42:25 +01:00
Goffi
31eae6db71 jp (base): new date_decoder to specify dates in arguments 2018-12-01 10:41:37 +01:00
Goffi
cee59f42ae jp (base): fixed connection when start_session arg exists but is False 2018-11-18 15:49:55 +01:00
Goffi
aa10a033b9 jp: fixed bad call to quit 2018-09-14 16:44:34 +02:00
Goffi
e70405cfc2 tools (common/template), jp: refactoring to handle multiple sites:
- site can now be specified in template header before theme, for instance: (some_site/some_theme)path/to/template.ext
- absolute template paths are now implemented, but Renderer must be instanciated with trusted to True for security reason (it's the case for jp)
- a new "front_url_filter" callable can be given to Renderer, which will convert template path to URL seen by end-user (default to real path).
- the "front_url_filter" can be used in templates with… "front_url" filter
- template_data is a new named tuple available in templates, which give site, theme and template relative URL
- search order is site/theme, site/default_theme, and default/default_theme where default link to sat_pubsub templates
- when loading CSS files, files with _noscript suffixes are now loaded, and used when javascript is not available
- "styles_extra.css" is also loaded before "styles.css", useful when a theme want to reuse default style, and just override some rules
- new site can be specified in sat.conf [DEFAULT] section, using sites_path_public_dict or sites_path_private_dict (where sites_path_private_dict won't be used in public frontends, like Libervia)
- "private" argument of Renderer tells the renderer to load private sites or not
- templates are now loaded from "templates" subdirectory, to differenciate them from other data like i18n
- jp template output has been updated to handle those changes, and to manage absolute templates
2018-09-10 08:58:18 +02:00
Goffi
e92971ff09 tools (misc): do not remove flags while using them anymore, instead added "all_used" and "unused" properties in FlagsHandler 2018-06-21 01:21:44 +02:00
Goffi
485dfdf705 jp (event): fixed crash on missing item in get and inviteeGet by making it mandatory. 2018-06-21 01:21:44 +02:00
Goffi
edff42a743 jp (base): do not crash when item is specified (e.g. in URL) but not needed in command, but display a message on stderr. 2018-06-06 19:24:15 +02:00
Goffi
fa9c118d5e jp (base): fixed jid encoding 2018-05-22 10:01:00 +02:00
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
Renamed from frontends/src/jp/base.py (Browse further)