Commit graph libervia-backend/sat_frontends/quick_frontend/quick_widgets.py
Author SHA1 Message Date
Goffi
6a6f15707a massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.

However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.

To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.

This is a massive change, and may result in some bugs.
2023-04-08 13:54:42 +02:00
Goffi
dc86957043 date update 2021-03-19 15:45:14 +01:00
Goffi
aa203d4a49 quick frontends (widgets): added widgetNew and widgetDelete listeners:
- `widgetNew` is called when a brand new widget is created (not when a new instance is
  created if there is already an existing one)
- `widgetDelete` is called when all instances of a widget (with a given widget_hash) have
  been deleted.
2020-02-12 19:46:14 +01:00
Goffi
e8aaa9fd43 quick frontend(widget): added with_duplicates argument to getWidgets:
when this argument is False, widgets with the same widget_hash are filtered to only return
first one. It is True by default to keep former behaviour.
2020-02-12 19:38:32 +01:00
Goffi
5ef5f4aabf quick_frontend (app, widget): CagouWidget.onSelected is called when the widget is selected:
A property is now used to manage `selected_widget` in QuickApp, and widget's onSelected
method is called when suitable.
2020-02-09 23:50:21 +01:00
Goffi
9a9adb36cb quick frontend (app): added "explicit_close" to deleteWidget, and use it on mucRoomLeftHandler:
This flag can be used by frontends to decide if the widget must be really closed or not
(otherwise, it may be interesting to keep a widget in memory to avoir recreating a new one
each time that the chat must be displayed).
2020-02-06 00:01:36 +01:00
Goffi
e1a44cf4e4 fixed shebangs 2020-01-29 10:07:00 +01:00
Goffi
a39349fe64 dates update 2020-01-29 09:50:54 +01:00
Goffi
eca0f773cf quick frontend (widgets): don't use *args for onDelete + more debug logs 2020-01-17 20:27:35 +01:00
Goffi
d9e1ba8ce1 quick frontend (widgets): some more errors handling in getOrCreateWidget 2020-01-17 18:47:02 +01:00
Goffi
6bff1bdc33 quick frontend (widgets): fixed widget creation in getOrCreateWidget:
when a new widget was created, it was overwritting the exiting instances list. This patch
fixes it.
2020-01-17 17:55:57 +01:00
Goffi
f1372b6b94 quick frontend (widgets): added "widget_hash" helper property 2020-01-17 15:26:44 +01:00
Goffi
ced601a824 quick_frontend (widget): typo 2020-01-03 20:10:58 +01: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
34207a8969 quick_frontend (widgets): fixed crash on getWidgets when target doesn't correspond to any widget 2019-04-07 15:04:28 +02:00
Goffi
4ca9acadf9 quick frontend(widgets): added QuickWidget.target property as a helper method to get a single target:
a single target is the most common case, but QuickWidget handle multiple targets. When a single target is requested and multiple exist, a random one is returned.
This is a temporary situation, targetting should be improved in a future version to manage multiple targets in hash.
2019-03-10 18:04:27 +01:00
Goffi
da54c69eaa quick frontend (widgets): improved deletion of widget:
QuickWidget deletion has been improved a bit. A new "all_instances" kwarg can be used to completely delete all instances of a widget.
2019-03-10 18:03:41 +01:00
Goffi
7cf0180731 quick frontend(widgets): improved handling of multiple instances of widgets:
when a widget was recreated, a new hash was created with a suffix, making hash matching difficult and bug prone.
This has been changed to use a list of instances instead, this simplify the code and avoid issues while looking for existing instances of a widget.
2019-03-10 18:03:14 +01:00
Goffi
4c8f108192 quick_frontend (widget, chat): implementation of new sync mechanism, first draft:
QuickWidget implement base of sync mechanism with a sync property which can be overriden, and resync method which is called when resynchronisation is needed.
When resync is required, chat widget get missing occupant and history elements
A new callable argument can be used with historyPrint, when set it is called when history has been fully printed.
2019-03-10 18:03:11 +01:00
Goffi
fe4a6abfae quick frontend (app): new synchronisation mechanism:
on some frontend (notably on mobiles) frontend can be paused and lose synchronisation with backend, this can also happen if backend restart a connexion without resuming using stream management. To manage that, QuickApp now has a sync attribute which is True when the backend is in sync with frontend.
When synchronisation has been lost and is possible again, all widget will have their "resync" method called, which can be used to do necessary calls to update the status.
It's the responsability of each widget to then reset the "sync" attribute, once everything has been resynchronised.
2019-03-09 16:33:31 +01:00
Goffi
687ef5b6bd quick frontend (chat): use right type in getOrCreateWidget on new message 2019-01-22 18:52:16 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
744cb0c503 code style reformatting using black 2018-06-27 20:14:46 +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/quick_frontend/quick_widgets.py (Browse further)