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 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 import subprocess # @Reimport
params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable
tools.addTaskToWait(subprocess.Popen(params)) tools.addTaskToWait(subprocess.Popen(params))
def execRdesktop(parent, rdesktop): def execRdesktop(rdesktop):
import subprocess # @Reimport import subprocess # @Reimport
params = [rdesktop] + sp['as_rdesktop_params'] + [sp['address']] # @UndefinedVariable params = [rdesktop] + sp['as_rdesktop_params'] + [sp['address']] # @UndefinedVariable
p = subprocess.Popen(params, stdin=subprocess.PIPE) p = subprocess.Popen(params, stdin=subprocess.PIPE)
@ -26,9 +32,11 @@ def execRdesktop(parent, rdesktop):
p.stdin.close() p.stdin.close()
tools.addTaskToWait(p) 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) # 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') xfreerdp = tools.findApp('xfreerdp')
rdesktop = tools.findApp('rdesktop') rdesktop = tools.findApp('rdesktop')
udsrdp = tools.findApp('udsrdp')
fnc, app = None, None fnc, app = None, None
if rdesktop is not 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 except Exception as e: # Valid version not found, pass to check rdesktop
pass pass
if udsrdp is not None:
fnc, app = execUdsRdp, udsrdp
if app is None or fnc is None: 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> 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>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> <p>Also note that xfreerdp prior to version 1.1 will not be taken into consideration.</p>
''') ''')
else: else:
fnc(parent, app) # @UndefinedVariable fnc(app) # @UndefinedVariable

View File

@ -12,13 +12,19 @@ from uds import tools # @UnresolvedImport
import six 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 import subprocess # @Reimport
params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # @UndefinedVariable params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # @UndefinedVariable
tools.addTaskToWait(subprocess.Popen(params)) tools.addTaskToWait(subprocess.Popen(params))
def execRdesktop(parent, rdesktop, port): def execRdesktop(rdesktop, port):
import subprocess # @Reimport import subprocess # @Reimport
params = [rdesktop] + sp['as_rdesktop_params'] + ['127.0.0.1:{}'.format(port)] # @UndefinedVariable params = [rdesktop] + sp['as_rdesktop_params'] + ['127.0.0.1:{}'.format(port)] # @UndefinedVariable
p = subprocess.Popen(params, stdin=subprocess.PIPE) p = subprocess.Popen(params, stdin=subprocess.PIPE)
@ -27,9 +33,11 @@ def execRdesktop(parent, rdesktop, port):
p.stdin.close() p.stdin.close()
tools.addTaskToWait(p) 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) # 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') xfreerdp = tools.findApp('xfreerdp')
rdesktop = tools.findApp('rdesktop') rdesktop = tools.findApp('rdesktop')
udsrdp = tools.findApp('udsrdp')
fnc, app = None, None fnc, app = None, None
if rdesktop is not 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 # QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok) # @UndefinedVariable
pass pass
if udsrdp is not None:
fnc, app = execUdsRdp, udsrdp
if app is None or fnc is None: 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> 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> <p>Please, install apropiate package for your system.</p>
@ -65,4 +76,4 @@ else:
if forwardThread.status == 2: if forwardThread.status == 2:
raise Exception('Unable to open tunnel') raise Exception('Unable to open tunnel')
fnc(parent, app, port) # @UndefinedVariable fnc(app, port) # @UndefinedVariable