xpra icon
Bug tracker and wiki

Opened 3 weeks ago

Last modified 92 minutes ago

#1761 new task

refactoring to avoid large modules

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 2.3
Component: core Version: 2.2.x
Keywords: Cc:

Description

As of r18260, we have some modules that are just too big.

$ find xpra/ -type f -name "*.py" -exec bash -c 'cat {}|wc -l|xargs echo -n;echo " {}"' \;  | sort -n | tail -n 40
589 xpra/client/window_backing_base.py
602 xpra/x11/desktop_server.py
678 xpra/platform/win32/lsa_logon_lib.py
714 xpra/x11/gtk2/models/base.py
720 xpra/x11/gtk2/models/core.py
733 xpra/client/client_window_base.py
733 xpra/x11/xkbhelper.py
736 xpra/os_util.py
747 xpra/platform/win32/wndproc_events.py
770 xpra/x11/gtk2/models/window.py
773 xpra/net/file_transfer.py
798 xpra/util.py
834 xpra/platform/darwin/gui.py
890 xpra/x11/x11_server_core.py
895 xpra/sound/gstreamer_util.py
919 xpra/clipboard/clipboard_base.py
946 xpra/server/proxy/proxy_instance_process.py
950 xpra/platform/xposix/gui.py
1014 xpra/client/gtk_base/client_launcher.py
1031 xpra/client/client_base.py
1068 xpra/scripts/server.py
1100 xpra/client/gl/gl_window_backing_base.py
1100 xpra/net/protocol.py
1103 xpra/gtk_common/gtk_util.py
1173 xpra/client/gtk_base/session_info.py
1208 xpra/platform/win32/gui.py
1241 xpra/x11/server.py
1307 xpra/client/gtk_base/gtk_client_base.py
1379 xpra/scripts/config.py
1474 xpra/client/gtk_base/gtk_tray_menu_base.py
1528 xpra/client/gtk_base/gtk_client_window_base.py
1780 xpra/server/server_core.py
1934 xpra/server/window/window_video_source.py
2088 xpra/net/mdns/pybonjour.py
2276 xpra/server/window/window_source.py
2632 xpra/server/source.py
3402 xpra/scripts/main.py
3794 xpra/server/server_base.py
3904 xpra/client/ui_client_base.py
4717 xpra/platform/win32/constants.py

Some of those are fine: constants or external modules (ie: pybonjour), others deserve to be refactored.

This ticket is also in preparation for #1700.

Change History (1)

comment:1 Changed 94 minutes ago by Antoine Martin

First round:

  • r18499: server base: split control commands
  • r18498: main: split command line parsing
  • r18495 + r18497: server base: logical groups of methods
  • r18496: server core: logical groups of methods
  • r18492: ui client: split rpc bits
  • r18491: ui client: split audio bits
  • r18489: ui client: split webcam bits

Result:

  • xpra/scripts/main.py: 2229
  • xpra/server/server_base.py: 3341 lines
  • xpra/client/ui_client_base.py: 3009 lines

Still big, but more readable and manageable.

Some of those changes can also help us write better unit tests.(#847)

Last edited 92 minutes ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.