Merge remote-tracking branch 'origin/v2.2'

This commit is contained in:
Adolfo Gómez García 2018-04-12 13:11:01 +02:00
commit af9e372d6b
2 changed files with 28 additions and 6 deletions

View File

@ -11,13 +11,19 @@ from uds import tools # @UnresolvedImport
import six
def execNewXFreeRdp(parent, xfreerdp):
def execUdsRdp(udsrdp):
import subprocess
params = [udsrdp] + {m.r.as_new_xfreerdp_params} + ['/v:{m.r.address}'] # @UndefinedVariable
tools.addTaskToWait(subprocess.Popen(params))
def execNewXFreeRdp(xfreerdp):
import subprocess # @Reimport
params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable
tools.addTaskToWait(subprocess.Popen(params))
def execRdesktop(parent, rdesktop):
def execRdesktop(rdesktop):
import subprocess # @Reimport
params = [rdesktop] + sp['as_rdesktop_params'] + [sp['address']] # @UndefinedVariable
p = subprocess.Popen(params, stdin=subprocess.PIPE)
@ -26,9 +32,11 @@ def execRdesktop(parent, rdesktop):
p.stdin.close()
tools.addTaskToWait(p)
# Try to locate a "valid" version of xfreerdp as first option (<1.1 does not allows drive redirections, so it will not be used if found)
xfreerdp = tools.findApp('xfreerdp')
rdesktop = tools.findApp('rdesktop')
udsrdp = tools.findApp('udsrdp')
fnc, app = None, None
if rdesktop is not None:
@ -51,10 +59,13 @@ if xfreerdp is not None:
except Exception as e: # Valid version not found, pass to check rdesktop
pass
if udsrdp is not None:
fnc, app = execUdsRdp, udsrdp
if app is None or fnc is None:
raise Exception('''<p>You need to have installed xfreerdp (>= 1.1) or rdesktop, and have them in your PATH in order to connect to this UDS service.</p>
<p>Please, install the proper package for your system.</p>
<p>Also note that xfreerdp prior to version 1.1 will not be taken into consideration.</p>
''')
else:
fnc(parent, app) # @UndefinedVariable
fnc(app) # @UndefinedVariable

View File

@ -12,13 +12,19 @@ from uds import tools # @UnresolvedImport
import six
def execNewXFreeRdp(parent, xfreerdp, port):
def execUdsRdp(udsrdp, port):
import subprocess
params = [udsrdp] + {m.r.as_new_xfreerdp_params} + ['/v:127.0.0.1:{{}}'.format(port)] # @UndefinedVariable
tools.addTaskToWait(subprocess.Popen(params))
def execNewXFreeRdp(xfreerdp, port):
import subprocess # @Reimport
params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # @UndefinedVariable
tools.addTaskToWait(subprocess.Popen(params))
def execRdesktop(parent, rdesktop, port):
def execRdesktop(rdesktop, port):
import subprocess # @Reimport
params = [rdesktop] + sp['as_rdesktop_params'] + ['127.0.0.1:{}'.format(port)] # @UndefinedVariable
p = subprocess.Popen(params, stdin=subprocess.PIPE)
@ -27,9 +33,11 @@ def execRdesktop(parent, rdesktop, port):
p.stdin.close()
tools.addTaskToWait(p)
# Try to locate a "valid" version of xfreerdp as first option (<1.1 does not allows drive redirections, so it will not be used if found)
xfreerdp = tools.findApp('xfreerdp')
rdesktop = tools.findApp('rdesktop')
udsrdp = tools.findApp('udsrdp')
fnc, app = None, None
if rdesktop is not None:
@ -53,6 +61,9 @@ if xfreerdp is not None:
# QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok) # @UndefinedVariable
pass
if udsrdp is not None:
fnc, app = execUdsRdp, udsrdp
if app is None or fnc is None:
raise Exception('''<p>You need to have installed xfreerdp (>= 1.1) or rdesktop, and have them in your PATH in order to connect to this UDS service.</p>
<p>Please, install apropiate package for your system.</p>
@ -65,4 +76,4 @@ else:
if forwardThread.status == 2:
raise Exception('Unable to open tunnel')
fnc(parent, app, port) # @UndefinedVariable
fnc(app, port) # @UndefinedVariable