From f7b78b7e1cc0b397f46f92321a76814bd2af4c79 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 3 Jan 2018 05:25:58 +0000 Subject: [PATCH] #1702: don't modify window background color and move common window setup code to gtk_util git-svn-id: https://xpra.org/svn/Xpra/trunk@17834 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/client/gtk_base/bug_report.py | 7 +++---- src/xpra/client/gtk_base/client_launcher.py | 5 ++--- src/xpra/client/gtk_base/open_requests.py | 5 ++--- src/xpra/client/gtk_base/server_commands.py | 5 ++--- src/xpra/client/gtk_base/start_new_command.py | 7 +++---- src/xpra/client/gtk_base/update_status.py | 7 +++---- src/xpra/gtk_common/gtk_util.py | 4 ++++ 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/xpra/client/gtk_base/bug_report.py b/src/xpra/client/gtk_base/bug_report.py index d8837c3b74..7f620ee6fe 100755 --- a/src/xpra/client/gtk_base/bug_report.py +++ b/src/xpra/client/gtk_base/bug_report.py @@ -17,7 +17,7 @@ gdk = import_gdk() pango = import_pango() -from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, get_display_info, get_default_root_window, \ +from xpra.gtk_common.gtk_util import window_defaults, gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, get_display_info, get_default_root_window, \ JUSTIFY_LEFT, WIN_POS_CENTER, STATE_NORMAL, FILE_CHOOSER_ACTION_SAVE, choose_file, get_gtk_version_info from xpra.util import nonl, envint, repr_ellipsized from xpra.os_util import strtobytes @@ -39,11 +39,10 @@ def init(self, show_about=True, get_server_info=None, opengl_info=None, includes def setup_window(self): self.window = gtk.Window() + window_defaults(self.window) self.window.connect("destroy", self.close) self.window.set_default_size(400, 300) - self.window.set_border_width(20) self.window.set_title("Xpra Bug Report") - self.window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) icon_pixbuf = self.get_icon("bugs.png") if icon_pixbuf: @@ -89,7 +88,7 @@ def setup_window(self): self.description.set_justification(JUSTIFY_LEFT) self.description.set_border_width(2) self.description.set_size_request(300, 80) - self.description.modify_bg(STATE_NORMAL, gdk.Color(red=32768, green=32768, blue=32768)) + #self.description.modify_bg(STATE_NORMAL, gdk.Color(red=32768, green=32768, blue=32768)) ibox.pack_start(self.description, expand=False, fill=False) # Toggles: diff --git a/src/xpra/client/gtk_base/client_launcher.py b/src/xpra/client/gtk_base/client_launcher.py index c0661d1268..7c972ed0f9 100755 --- a/src/xpra/client/gtk_base/client_launcher.py +++ b/src/xpra/client/gtk_base/client_launcher.py @@ -31,7 +31,7 @@ from xpra.scripts.config import read_config, make_defaults_struct, validate_config, save_config from xpra.codecs.loader import PREFERED_ENCODING_ORDER from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, color_parse, \ - OptionMenu, choose_file, set_use_tray_workaround, \ + OptionMenu, choose_file, set_use_tray_workaround, window_defaults, \ WIN_POS_CENTER, STATE_NORMAL, \ DIALOG_DESTROY_WITH_PARENT, MESSAGE_INFO, BUTTONS_CLOSE, \ FILE_CHOOSER_ACTION_SAVE, FILE_CHOOSER_ACTION_OPEN @@ -161,11 +161,10 @@ def image_button(self, label="", tooltip="", icon_pixbuf=None, clicked_cb=None): def create_window(self): self.window = gtk.Window() + window_defaults(self.window) self.window.connect("destroy", self.destroy) self.window.set_default_size(400, 260) - self.window.set_border_width(20) self.window.set_title("Xpra Launcher") - self.window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) self.window.set_position(WIN_POS_CENTER) diff --git a/src/xpra/client/gtk_base/open_requests.py b/src/xpra/client/gtk_base/open_requests.py index adb69bb795..29ff6a0f75 100755 --- a/src/xpra/client/gtk_base/open_requests.py +++ b/src/xpra/client/gtk_base/open_requests.py @@ -23,7 +23,7 @@ from xpra.os_util import monotonic_time, bytestostr from xpra.simple_stats import std_unit_dec from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, \ - TableBuilder, WIN_POS_CENTER, STATE_NORMAL + TableBuilder, WIN_POS_CENTER, window_defaults from xpra.platform.paths import get_icon_dir from xpra.log import Logger, enable_debug_for log = Logger("util") @@ -46,11 +46,10 @@ def __init__(self, show_file_upload_cb=None): self.requests = [] self.expire_labels = {} self.window = gtk.Window() + window_defaults(self.window) self.window.connect("destroy", self.close) self.window.set_default_size(400, 150) - self.window.set_border_width(20) self.window.set_title("Transfers") - self.window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) icon_pixbuf = self.get_icon("download.png") if icon_pixbuf: diff --git a/src/xpra/client/gtk_base/server_commands.py b/src/xpra/client/gtk_base/server_commands.py index fa268e37f3..d27c9df206 100755 --- a/src/xpra/client/gtk_base/server_commands.py +++ b/src/xpra/client/gtk_base/server_commands.py @@ -23,7 +23,7 @@ from xpra.os_util import monotonic_time from xpra.util import AdHocStruct, typedict from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, \ - get_pixbuf_from_data, TableBuilder, WIN_POS_CENTER, STATE_NORMAL + get_pixbuf_from_data, window_defaults, TableBuilder, WIN_POS_CENTER from xpra.platform.paths import get_icon_dir from xpra.log import Logger, enable_debug_for log = Logger("util") @@ -46,11 +46,10 @@ def __init__(self, client): self.commands_info = {} self.table = None self.window = gtk.Window() + window_defaults(self.window) self.window.connect("destroy", self.close) self.window.set_default_size(400, 150) - self.window.set_border_width(20) self.window.set_title("Server Commands") - self.window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) icon_pixbuf = self.get_icon("list.png") if icon_pixbuf: diff --git a/src/xpra/client/gtk_base/start_new_command.py b/src/xpra/client/gtk_base/start_new_command.py index 28f4cb9e88..7d33225eca 100755 --- a/src/xpra/client/gtk_base/start_new_command.py +++ b/src/xpra/client/gtk_base/start_new_command.py @@ -21,8 +21,8 @@ pango = import_pango() -from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, \ - WIN_POS_CENTER, STATE_NORMAL +from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, window_defaults, \ + WIN_POS_CENTER from xpra.platform.paths import get_icon_dir from xpra.log import Logger, enable_debug_for log = Logger("util") @@ -41,11 +41,10 @@ class StartNewCommand(object): def __init__(self, run_callback=None, can_share=False): self.run_callback = run_callback self.window = gtk.Window() + window_defaults(self.window) self.window.connect("destroy", self.close) self.window.set_default_size(400, 150) - self.window.set_border_width(20) self.window.set_title("Start New Command") - self.window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) icon_pixbuf = self.get_icon("forward.png") if icon_pixbuf: diff --git a/src/xpra/client/gtk_base/update_status.py b/src/xpra/client/gtk_base/update_status.py index 73d3aea524..4af11e6aca 100755 --- a/src/xpra/client/gtk_base/update_status.py +++ b/src/xpra/client/gtk_base/update_status.py @@ -20,8 +20,8 @@ glib = import_glib() -from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, \ - WIN_POS_CENTER, STATE_NORMAL +from xpra.gtk_common.gtk_util import gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, window_defaults, \ + WIN_POS_CENTER from xpra.platform.paths import get_icon_dir from xpra.log import Logger, enable_debug_for log = Logger("util") @@ -39,11 +39,10 @@ class UpdateStatusWindow(object): def __init__(self): self.window = gtk.Window() + window_defaults(self.window) self.window.connect("destroy", self.close) self.window.set_default_size(400, 200) - self.window.set_border_width(20) self.window.set_title("Xpra Version Check") - self.window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) icon = self.get_icon("update.png") if icon: diff --git a/src/xpra/gtk_common/gtk_util.py b/src/xpra/gtk_common/gtk_util.py index 7740a18477..c409b840ab 100644 --- a/src/xpra/gtk_common/gtk_util.py +++ b/src/xpra/gtk_common/gtk_util.py @@ -981,6 +981,10 @@ def title_box(label_str): return eb +def window_defaults(window): + window.set_border_width(20) + #window.modify_bg(STATE_NORMAL, gdk.Color(red=65535, green=65535, blue=65535)) + #utility method to ensure there is always only one CheckMenuItem #selected in a submenu: