commit 71ab48fac57c3b9edc53646af0ec09d9ae406876 Author: zlaxy Date: Tue Jun 6 11:40:32 2017 +0300 Initial commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..830a2a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +pyGtkRDP + +pyGtkRDP is released under the DWTW license. + +This program is free software; you can redistribute it and/or modify it under the terms of the Do What Thou Wilt License. + +DO WHAT THAU WILT +TO PUBLIC LICENSE + +Version 2.5 + +Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. Do what thou wilt shall be the whole of the Law. + +Anyone is allowed to copy and distribute the copies of this license agreement in whole or in part, as well as modify it without any other limitations. + +DWTW – a license with a single requirement: DO WHAT THOU WILT + +The license provides more freedom than any other one (such as GPL or BSD) and does not require saving the license text on copying. + +DWTW – an accomplished and eligible license for free text (including the software, documentation and artwork). + +The license does not contain "no warranty" clause. DWTW can be used in countries that do not legally acknowledge the transition to public domain. + +Summary: + +An author-creator gives his or her source code to the world for free, without becoming distracted by worldly thinking regarding how and why the others will use it. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3aad4f0 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +pyGtkRDP version 0.99 + +Simple GUI application for freerdp or rdesktop connection + +Current command line adapted for nightly builds of FreeRDP ( https://github.com/FreeRDP/FreeRDP/wiki/PreBuilds ). +If you want to use rdesktop or another RDP client, change the source accordingly. diff --git a/pygtkrdp.png b/pygtkrdp.png new file mode 100644 index 0000000..a1dcbd0 Binary files /dev/null and b/pygtkrdp.png differ diff --git a/pygtkrdp.py b/pygtkrdp.py new file mode 100644 index 0000000..8358cbb --- /dev/null +++ b/pygtkrdp.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# example table.py + +import pygtk +pygtk.require('2.0') +import gtk +import subprocess + +# ===== Connection settings: ====== +# ===== freerdp-x11: + +string_l = "xfreerdp /drive:share,/media /f /bpp:15 /jpeg /cert-ignore /v:192.168.1.128" +string_r = "xfreerdp /drive:share,/media /f /bpp:8 /jpeg /cert-ignore /v:external.domain:3389" + +# ===== rdesktop: +#string_l = "rdesktop -z -a 15 -k en-us -r disk:share=/media -f 192.168.1.128" +#string_r = "rdesktop -z -a 8 -k en-us -r disk:share=/media -f external.domain:3389" +# ============================== + +class Table: + + def callback(self, widget, data=None): + name = login_entry.get_text() + password = password_entry.get_text() + if ( data == "local" ): +# ===== freerdp-x11: + string = string_l + " /u:" + name + " /p:" + password +# ===== rdesktop: +# string = string_l + " -u " + name + " -p " + password + if ( data == "remote" ): +# ===== freerdp-x11: + string = string_r + " /u:" + name + " /p:" + password +# ===== rdesktop: +# string = string_r + " -u " + name + " -p " + password + p = subprocess.Popen(string, shell=True, stderr=subprocess.PIPE, ) + streamdata = p.communicate()[0] + rc = p.returncode + + if ( (rc == 0) or (rc == 62)): + gtk.main_quit() + else: + if (rc == 132): + status_entry_label.set_markup('Error: wrong login or password'); + else: + status_entry_label.set_markup('Error: check your connection'); + +# Uncomment to check errorcode: +# print "Error code", rc + + def delete_event(self, widget, event, data=None): + gtk.main_quit() + return False + + def __init__(self): + self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.window.set_title("Connection...") + self.window.connect("delete_event", self.delete_event) + self.window.set_border_width(10) + table = gtk.Table(7, 2, True) + self.window.add(table) + + login_entry_label = gtk.Label ("Username:") + table.attach(login_entry_label, 0, 2, 0, 1) + login_entry_label.show() + + login_entry.set_max_length(20) + table.attach(login_entry, 0, 2, 1, 2) + login_entry.show() + + password_entry_label = gtk.Label ("Password:") + table.attach(password_entry_label, 0, 2, 2, 3) + password_entry_label.show() + + password_entry.set_max_length(30) + password_entry.set_visibility(False) + table.attach(password_entry, 0, 2, 3, 4) + password_entry.show() + + table.attach(status_entry_label, 0, 2, 4, 5) + status_entry_label.show() + + local_button = gtk.Button("Local connection") + local_button.connect("clicked", self.callback, "local") + table.attach(local_button, 0, 1, 5, 6) + local_button.show() + + remote_button = gtk.Button("External connection") + remote_button.connect("clicked", self.callback, "remote") + table.attach(remote_button, 1, 2, 5, 6) + remote_button.show() + + button = gtk.Button("Exit") + button.connect("clicked", lambda w: gtk.main_quit()) + table.attach(button, 0, 2, 6, 7) + button.show() + + table.show() + self.window.show() + +def main(): + gtk.main() + return 0 + +login_entry = gtk.Entry() +password_entry = gtk.Entry() +status_entry_label = gtk.Label ("CTRL+ALT+ENTER - toggle fullscreen") + +if __name__ == "__main__": + Table() + main()