Skip to content

Commit

Permalink
move all dialogs and examples to gtk_common
Browse files Browse the repository at this point in the history
that way, we can still use them even if the client is not installed
  • Loading branch information
totaam committed Sep 28, 2023
1 parent 39d65bf commit 7aaaccd
Show file tree
Hide file tree
Showing 125 changed files with 193 additions and 250 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,21 @@ tests/unittests/test-file*
/xpra/buffers/cyxor.c
/xpra/client/*/*.c
/xpra/client/*.c
/xpra/clipboard/*.c
/xpra/codecs/nvidia/*/*.c
/xpra/codecs/nvidia/*/*.cpp
/xpra/codecs/*/*.cpp
/xpra/codecs/*/*.c
/xpra/codecs/*.c
/xpra/gtk_common/*.c
/xpra/gtk_common/gtk3/*.c
/xpra/gtk_common/dialogs/*.c
/xpra/gtk_common/examples/*.c
/xpra/gstreamer/*.c
/xpra/keyboard/*.c
/xpra/net/*/*/*.c
/xpra/net/*/*.c
/xpra/net/*.c
/xpra/notifications/*.c
/xpra/platform/*/*.c
/xpra/platform/*.c
/xpra/scripts/*.c
Expand Down
2 changes: 1 addition & 1 deletion fs/libexec/xpra/auth_dialog
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import sys

from xpra.gtk_common.auth_dialog import main
from xpra.gtk_common.dialogs.auth_dialog import main
sys.exit(main())
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ def clean():
"xpra/codecs/jpeg/decoder.c",
"xpra/codecs/openh264/encoder.c",
"xpra/codecs/openh264/decoder.c",
"xpra/codecs/v4l2/pusher.c",
"xpra/codecs/v4l2/virtual.c",
"xpra/codecs/v4l2/constants.pxi",
"xpra/codecs/evdi/capture.cpp",
"xpra/codecs/drm/drm.c",
Expand Down Expand Up @@ -1564,8 +1564,8 @@ def add_service_exe(script, icon, base_name):
add_gui_exe("xpra/platform/win32/scripts/shadow_server.py", "server-notconnected.ico", "Xpra-Shadow")
add_gui_exe("fs/bin/xpra_launcher", "xpra.ico", "Xpra-Launcher")
add_console_exe("fs/bin/xpra_launcher", "xpra.ico", "Xpra-Launcher-Debug")
add_gui_exe("xpra/gtk_common/view_keyboard.py", "keyboard.ico", "GTK_Keyboard_Test")
add_gui_exe("xpra/scripts/bug_report.py", "bugs.ico", "Bug_Report")
add_gui_exe("xpra/gtk_common/dialogs/view_keyboard.py", "keyboard.ico", "GTK_Keyboard_Test")
add_gui_exe("xpra/gtk_common/dialogs/bug_report.py", "bugs.ico", "Bug_Report")
add_gui_exe("xpra/platform/win32/gdi_screen_capture.py", "screenshot.ico", "Screenshot")
if server_ENABLED:
add_gui_exe("fs/libexec/xpra/auth_dialog", "authentication.ico", "Auth_Dialog")
Expand All @@ -1577,7 +1577,7 @@ def add_service_exe(script, icon, base_name):
add_console_exe("xpra/scripts/gtk_info.py", "gtk.ico", "GTK_info")
add_console_exe("xpra/gtk_common/keymap.py", "keymap.ico", "Keymap_info")
add_console_exe("xpra/platform/keyboard.py", "keymap.ico", "Keyboard_info")
add_gui_exe("xpra/client/gtk3/example/tray.py", "xpra.ico", "SystemTray_Test")
add_gui_exe("xpra/gtk_common/examples/tray.py", "xpra.ico", "SystemTray_Test")
add_gui_exe("xpra/client/gtk3/u2f_tool.py", "authentication.ico", "U2F_Tool")
if client_ENABLED or server_ENABLED:
add_console_exe("xpra/platform/win32/scripts/exec.py", "python.ico", "Python_exec_cmd")
Expand Down Expand Up @@ -2103,7 +2103,7 @@ def bundle_tests():
toggle_packages(client_ENABLED and gtk3_ENABLED, "xpra.client.gtk3", "xpra.client.gtk3", "xpra.client.gui")
toggle_packages((client_ENABLED and gtk3_ENABLED) or (audio_ENABLED and WIN32 and MINGW_PREFIX), "gi")
toggle_packages(client_ENABLED and opengl_ENABLED and gtk3_ENABLED, "xpra.client.gl.gtk3")
toggle_packages(client_ENABLED and gtk3_ENABLED and example_ENABLED, "xpra.client.gtk3.example")
toggle_packages(client_ENABLED and gtk3_ENABLED and example_ENABLED, "xpra.gtk_common.examples")
if client_ENABLED and WIN32 and MINGW_PREFIX:
ace("xpra.platform.win32.propsys,xpra/platform/win32/setappid.cpp",
language="c++",
Expand Down Expand Up @@ -2245,7 +2245,7 @@ def bundle_tests():
toggle_packages(gstreamer_ENABLED, "xpra.codecs.gstreamer", "xpra.gstreamer")

toggle_packages(v4l2_ENABLED, "xpra.codecs.v4l2")
tace(v4l2_ENABLED, "xpra.codecs.v4l2.pusher")
tace(v4l2_ENABLED, "xpra.codecs.v4l2.virtual")

#network:
#workaround this warning on MS Windows with Cython 3.0.0b1:
Expand Down Expand Up @@ -2298,6 +2298,9 @@ def ax(base):
ax("xpra.gstreamer")
if gtk3_ENABLED:
ax("xpra.gtk_common")
ax("xpra.gtk_common.dialogs")
if example_ENABLED:
ax("xpra.gtk_common.examples")
if keyboard_ENABLED:
ax("xpra.keyboard")
if http_ENABLED:
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/unit/codecs/image_wrapper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import unittest
from time import monotonic

from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.util.env import envbool

SHOW_PERF = envbool("XPRA_SHOW_PERF")
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/unit/codecs/pillow_encoder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import unittest

from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.codecs.pillow.encoder import (
get_encodings, encode,
get_version, get_type, get_info,
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/unit/codecs/rgb_transform_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import unittest

from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.codecs import rgb_transform

X = 0
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/unit/codecs/video_colorspace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

from xpra.util.types import typedict
from xpra.os_util import hexstr
from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.codecs.constants import get_subsampling_divs, get_plane_name
from xpra.codecs.checks import make_test_image
from xpra.codecs.video_helper import (
from xpra.codecs.video import (
getVideoHelper,
ALL_VIDEO_ENCODER_OPTIONS, ALL_CSC_MODULE_OPTIONS, ALL_VIDEO_DECODER_OPTIONS,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/unit/net/rfb/rfb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import unittest

from xpra.util.types import AdHocStruct
from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.server.rfb.source import RFBSource

def noop(*_args):
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/unit/server/shadow_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from xpra.util.types import typedict
from xpra.os_util import pollwait, which, OSX, POSIX
from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from unit.server_test_util import ServerTestUtil


Expand Down
2 changes: 1 addition & 1 deletion tests/xpra/codecs/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from time import monotonic

from xpra.util.str_fn import csv
from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper

N = 10
#Q = (20, 99)
Expand Down
2 changes: 1 addition & 1 deletion tests/xpra/codecs/benchmark_picture_encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from xpra.net import compression
from xpra.util.env import envbool
from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.codecs.loader import load_codec

N = 10
Expand Down
2 changes: 1 addition & 1 deletion tests/xpra/codecs/test_single_frame_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from xpra.util.types import typedict
from xpra.util.env import envbool
from xpra.os_util import memoryview_to_bytes
from xpra.codecs.image_wrapper import ImageWrapper
from xpra.codecs.image import ImageWrapper
from xpra.codecs.loader import load_codec


Expand Down
7 changes: 5 additions & 2 deletions xpra/client/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

from xpra.log import Logger
from xpra.scripts.config import InitExit
from xpra.common import SPLASH_EXIT_DELAY, FULL_INFO, LOG_HELLO, ConnectionMessage, disconnect_is_an_error, noerr
from xpra.common import (
SPLASH_EXIT_DELAY, FULL_INFO, LOG_HELLO,
ConnectionMessage, disconnect_is_an_error, noerr, NotificationID,
)
from xpra.util.child_reaper import getChildReaper, reaper_cleanup
from xpra.net import compression
from xpra.net.common import (
Expand Down Expand Up @@ -243,7 +246,7 @@ def get_challenge_handler(self, auth, import_error_logger):
return None


def may_notify(self, nid:int, summary:str, body:str, *args, **kwargs):
def may_notify(self, nid:int|NotificationID, summary:str, body:str, *args, **kwargs):
notifylog = Logger("notify")
notifylog("may_notify(%s, %s, %s, %s, %s)", nid, summary, body, args, kwargs)
notifylog.info("%s", summary)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions xpra/client/gl/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
def get_gl_client_window_module(force_enable=False) -> tuple[dict,Any]:
log("get_gl_client_window_module()")
try:
from xpra.client.gl.gtk3 import nativegl_client_window
from xpra.client.gl.gtk3 import native_window
except ImportError as e:
log("cannot import opengl window module", exc_info=True)
log.warn("Warning: cannot import native OpenGL module")
log.warn(" %s", e)
return {}, None
opengl_props = nativegl_client_window.check_support(force_enable)
opengl_props = native_window.check_support(force_enable)
log("check_support(%s)=%s", force_enable, opengl_props)
if opengl_props:
return opengl_props, nativegl_client_window
return opengl_props, native_window
return {}, None


Expand Down
16 changes: 8 additions & 8 deletions xpra/client/gtk3/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def show_server_commands(self, *_args) -> None:
log.warn(" the feature is not available on the server")
return
if self.server_commands is None:
from xpra.client.gtk3.server_commands import getServerCommandsWindow
from xpra.gtk_common.dialogs.server_commands import getServerCommandsWindow
self.server_commands = getServerCommandsWindow(self)
self.server_commands.show()

Expand All @@ -488,7 +488,7 @@ def show_start_new_command(self, *args) -> None:
return
log(f"show_start_new_command{args} current start_new_command={self.start_new_command}, flag={self.server_start_new_commands}")
if self.start_new_command is None:
from xpra.client.gtk3.start_new_command import getStartNewCommand
from xpra.gtk_common.dialogs.start_new_command import getStartNewCommand
def run_command_cb(command, sharing=True):
self.send_start_command(command, command, False, sharing)
self.start_new_command = getStartNewCommand(run_command_cb,
Expand All @@ -514,7 +514,7 @@ def ask_data_request(self, cb_answer, send_id, dtype, url, filesize, printit, op
self.idle_add(self.do_ask_data_request, cb_answer, send_id, dtype, url, filesize, printit, openit)

def do_ask_data_request(self, cb_answer, send_id, dtype, url, filesize, printit, openit):
from xpra.client.gtk3.open_requests import getOpenRequestsWindow
from xpra.gtk_common.dialogs.open_requests import getOpenRequestsWindow
timeout = self.remote_file_ask_timeout
def rec_answer(accept, newopenit=openit):
from xpra.net.file_transfer import ACCEPT
Expand All @@ -533,7 +533,7 @@ def close_ask_data_dialog(self):
fad.destroy()

def show_ask_data_dialog(self, *_args):
from xpra.client.gtk3.open_requests import getOpenRequestsWindow
from xpra.gtk_common.dialogs.open_requests import getOpenRequestsWindow
self.file_ask_dialog = getOpenRequestsWindow(self.show_file_upload, self.cancel_download)
self.file_ask_dialog.show()

Expand Down Expand Up @@ -662,7 +662,7 @@ def file_upload_ready(self, gfile, result, user_data):


def show_about(self, *_args) -> None:
from xpra.gtk_common.about import about
from xpra.gtk_common.dialogs.about import about
force_focus()
about()

Expand All @@ -675,7 +675,7 @@ def show_shortcuts(self, *_args) -> None:
force_focus()
self.shortcuts_info.present()
return
from xpra.client.gtk3.show_shortcuts import ShortcutInfo
from xpra.gtk_common.dialogs.show_shortcuts import ShortcutInfo
kh = self.keyboard_helper
assert kh, "no keyboard helper"
self.shortcuts_info = ShortcutInfo(kh.shortcut_modifiers, kh.key_shortcuts)
Expand All @@ -690,7 +690,7 @@ def show_session_info(self, *args) -> None:
return
p = self._protocol
conn = p._conn if p else None
from xpra.client.gtk3.session_info import SessionInfo
from xpra.gtk_common.dialogs.session_info import SessionInfo
self.session_info = SessionInfo(self, self.session_name, conn)
self.session_info.set_args(*args)
force_focus()
Expand All @@ -702,7 +702,7 @@ def show_bug_report(self, *_args) -> None:
force_focus()
self.bug_report.show()
return
from xpra.client.gtk3.bug_report import BugReport
from xpra.gtk_common.dialogs.bug_report import BugReport
self.bug_report = BugReport()
def init_bug_report():
#skip things we aren't using:
Expand Down
6 changes: 3 additions & 3 deletions xpra/client/gtk3/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from xpra.os_util import WIN32, OSX
from xpra.net.common import DEFAULT_PORT
from xpra.util.thread import start_thread
from xpra.gtk_common.about import about
from xpra.gtk_common.dialogs.about import about
from xpra.scripts.main import (
connect_to, make_client,
configure_network, configure_env, configure_logging,
Expand Down Expand Up @@ -250,7 +250,7 @@ def do_create_window(self):
self.bug_tool = None
def bug(*_args):
if self.bug_tool is None:
from xpra.client.gtk3.bug_report import BugReport
from xpra.gtk_common.dialogs.bug_report import BugReport
self.bug_tool = BugReport()
self.bug_tool.init(show_about=False)
self.bug_tool.show()
Expand All @@ -259,7 +259,7 @@ def bug(*_args):
self.mdns_gui = None
def mdns(*_args):
if self.mdns_gui is None:
from xpra.client.gtk3.mdns_gui import mdns_sessions
from xpra.gtk_common.dialogs.mdns_gui import mdns_sessions
self.mdns_gui = mdns_sessions(self.config)
def close_mdns():
self.mdns_gui.destroy()
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/gtk3/menu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
menuitem,
get_pixbuf_from_data, scaled_image,
)
from xpra.gtk_common.about import about, close_about
from xpra.gtk_common.dialogs.about import about, close_about
from xpra.platform.gui import get_icon_size
from xpra.platform.paths import get_icon_dir
from xpra.log import Logger
Expand Down Expand Up @@ -446,7 +446,7 @@ def make_aboutmenuitem(self) -> Gtk.ImageMenuItem:

def make_updatecheckmenuitem(self) -> Gtk.ImageMenuItem:
def show_update_window(*_args):
from xpra.client.gtk3.update_status import getUpdateStatusWindow
from xpra.gtk_common.dialogs.update_status import getUpdateStatusWindow
w = getUpdateStatusWindow()
w.show()
w.check()
Expand Down
64 changes: 0 additions & 64 deletions xpra/client/gtk3/spinner.py

This file was deleted.

Loading

0 comments on commit 7aaaccd

Please sign in to comment.