Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6d78f082
authored
Feb 21, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
laborgui: Added rdp waiting screen.
parent
a34e071a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
miscellaneous/laborclient/cloudgui/rdp.py
+31
-4
No files found.
miscellaneous/laborclient/cloudgui/rdp.py
View file @
6d78f082
...
...
@@ -6,11 +6,19 @@ import os
import
sys
import
gtk
import
gobject
from
multiprocessing
import
Manager
,
Process
import
threading
import
signal
import
time
class
RDP
:
def
__init__
(
self
,
uri
):
gobject
.
threads_init
()
self
.
scheme
,
self
.
username
,
self
.
password
,
self
.
host
,
self
.
port
=
uri
.
split
(
':'
,
4
)
self
.
manager
=
Manager
()
self
.
global_vars
=
self
.
manager
.
Namespace
()
self
.
global_vars
.
pid
=
0
self
.
box
=
gtk
.
MessageDialog
(
parent
=
None
,
flags
=
gtk
.
DIALOG_MODAL
,
type
=
gtk
.
MESSAGE_INFO
,
buttons
=
gtk
.
BUTTONS_CANCEL
,
message_format
=
"Connecting to RDP..."
)
def
dialog_box
(
self
,
text
):
# Window = gtk.Window()
# Window.set_size_request(250, 100)
...
...
@@ -24,7 +32,20 @@ class RDP:
def
connect
(
self
):
#rdp:cloud:qYSv3eQJYY:152.66.243.62:23037
if
self
.
scheme
==
"rdp"
:
self
.
connect_rdp
()
#print self.global_vars.pid
p
=
threading
.
Thread
(
target
=
self
.
connect_rdp
,
args
=
[
self
.
global_vars
])
p
.
start
()
while
self
.
global_vars
.
pid
==
0
:
time
.
sleep
(
1
)
#print "Rdesktop pid: "+str(self.global_vars.pid)
#print self.box
return_value
=
self
.
box
.
run
()
#print "Box return value: "+str(return_value)
if
return_value
!=
-
5
:
#p.terminate()
if
self
.
global_vars
.
pid
>
0
:
os
.
kill
(
self
.
global_vars
.
pid
,
signal
.
SIGKILL
)
p
.
join
()
elif
self
.
scheme
==
"nx"
:
self
.
connect_nx
()
elif
self
.
scheme
==
"sshterm"
:
...
...
@@ -49,15 +70,21 @@ class RDP:
except
:
self
.
dialog_box
(
"Unable to connect to host: "
+
self
.
host
+
" at port "
+
self
.
port
)
def
connect_rdp
(
self
):
def
connect_rdp
(
self
,
global_vars
):
rdp_command
=
[
"rdesktop"
,
"-khu"
,
"-E"
,
"-P"
,
"-0"
,
"-f"
,
"-u"
,
self
.
username
,
"-p"
,
self
.
password
,
self
.
host
+
":"
+
self
.
port
]
try
:
proc
=
subprocess
.
check_call
(
rdp_command
,
stdout
=
subprocess
.
PIPE
)
proc
=
subprocess
.
Popen
(
rdp_command
,
stdout
=
subprocess
.
PIPE
)
global_vars
.
pid
=
proc
.
pid
proc
.
wait
()
except
subprocess
.
CalledProcessError
as
e
:
if
e
.
returncode
!=
1
:
print
e
print
e
.
returncode
self
.
dialog_box
(
"Unable to connect to host: "
+
self
.
host
+
" at port "
+
self
.
port
)
finally
:
#print "Finally: "
#print self.box
global_vars
.
pid
=
0
self
.
box
.
response
(
-
5
)
def
connect_nx
(
self
):
#Generate temproary config
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment