Skip to content

Commit

Permalink
support for special "help" value for both "encoding" and "encodings" …
Browse files Browse the repository at this point in the history
…command line options

git-svn-id: https://xpra.org/svn/Xpra/trunk@12147 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 14, 2016
1 parent 63f7660 commit 253e41a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,14 +1426,17 @@ def connect():
except RuntimeError as e:
#exceptions at this point are still initialization exceptions
raise InitException(e.message)
ehelp = "help" in opts.encodings
if ehelp:
from xpra.codecs.loader import PREFERED_ENCODING_ORDER
opts.encodings = PREFERED_ENCODING_ORDER
app.init(opts)
if opts.encoding:
#fix old encoding names if needed:
err = opts.encoding not in app.get_encodings()
if opts.encoding or ehelp:
err = opts.encoding and (opts.encoding not in app.get_encodings())
info = ""
if err and opts.encoding!="help":
info = "invalid encoding: %s\n" % opts.encoding
if opts.encoding=="help" or err:
if opts.encoding=="help" or ehelp or err:
from xpra.codecs.loader import encodings_help
raise InitInfo(info+"%s xpra client supports the following encodings:\n * %s" % (app.client_toolkit(), "\n * ".join(encodings_help(app.get_encodings()))))
def handshake_complete(*args):
Expand Down
9 changes: 5 additions & 4 deletions src/xpra/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def run_server(error_cb, opts, mode, xpra_file, extra_args, desktop_display=None
if opts.password_file and not (opts.auth or opts.tcp_auth):
raise InitException("when specifying a password-file, you must use auth or tcp-auth")
validate_encryption(opts)
if opts.encoding and opts.encoding=="help":
if opts.encoding=="help" or "help" in opts.encodings:
#avoid errors and warnings:
opts.encoding = ""
opts.clipboard = False
Expand All @@ -898,13 +898,14 @@ def run_server(error_cb, opts, mode, xpra_file, extra_args, desktop_display=None
from xpra.server.server_base import ServerBase
sb = ServerBase()
sb.init_options(opts)
#ensures that the threaded video helper init has completed
#(by running it again, which will block on the init lock)
from xpra.codecs.loader import PREFERED_ENCODING_ORDER, HELP_ORDER
if "help" in opts.encodings:
sb.allowed_encodings = PREFERED_ENCODING_ORDER
from xpra.codecs.video_helper import getVideoHelper
getVideoHelper().init()
sb.init_encodings()
from xpra.codecs.loader import encoding_help
for e in sb.encodings:
for e in (x for x in HELP_ORDER if x in sb.encodings):
print(" * %s" % encoding_help(e))
return 0

Expand Down

0 comments on commit 253e41a

Please sign in to comment.