# HG changeset patch # User Dirk Olmes # Date 1411092158 -7200 # Node ID f889ad584f0a2d05347188040cb12407b58eede1 initial import diff -r 000000000000 -r f889ad584f0a .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,5 @@ +.e4p +.eric5project +.pyc +PyQtLib +Ui_* \ No newline at end of file diff -r 000000000000 -r f889ad584f0a RemoteViewer/Connection.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RemoteViewer/Connection.py Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,14 @@ + +class Connection(object): + def __init__(self): + self.geometry = None + self.host = None + self.title = None + self.type = 'rdp' + self.user = None + + def __str__(self): + return 'connection "{}" of type {} to {} with user {} and geometry {}'.format(self.title, self.type, self.host, self.user, self.geometry) + + def validate(self): + pass diff -r 000000000000 -r f889ad584f0a RemoteViewer/NewConnectionDialog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RemoteViewer/NewConnectionDialog.py Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,38 @@ +from PyQt4.QtGui import QDialog +from .Connection import Connection +from .Ui_NewConnectionDialog import Ui_NewConnectionDialog + +class NewConnectionDialog(QDialog): + def __init__(self): + super(QDialog, self).__init__() + self.__initDefaultValues() + self.__initUi() + self.__connectConnection() + + def __initDefaultValues(self): + self.connection = Connection() + + def __initUi(self): + self.ui = Ui_NewConnectionDialog() + self.ui.setupUi(self) + self.ui.type.addItem('rdp') + self.ui.type.addItem('vnc') + + def __connectConnection(self): + pass + + def typeSelected(self, type): + self.connection.type = type + + def setHost(self, hostname): + self.connection.host = hostname + + def setUser(self, user): + self.connection.user = user + + def setGeometry(self, geometry): + self.connection.geometry = geometry + + def accept(self): + print(self.connection) + super(NewConnectionDialog, self).accept() diff -r 000000000000 -r f889ad584f0a RemoteViewer/NewConnectionDialog.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RemoteViewer/NewConnectionDialog.ui Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,193 @@ + + + NewConnectionDialog + + + + 0 + 0 + 400 + 181 + + + + New Connection + + + + + + Type: + + + type + + + + + + + + + + Host: + + + hostname + + + + + + + + + + User: + + + username + + + + + + + Geometry: + + + geometry + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + type + hostname + username + geometry + buttonBox + + + + + buttonBox + accepted() + NewConnectionDialog + accept() + + + 330 + 171 + + + 157 + 274 + + + + + buttonBox + rejected() + NewConnectionDialog + reject() + + + 390 + 171 + + + 286 + 274 + + + + + type + activated(QString) + NewConnectionDialog + typeSelected(QString) + + + 112 + 21 + + + 32 + 147 + + + + + hostname + textChanged(QString) + NewConnectionDialog + setHost(QString) + + + 102 + 52 + + + 64 + 160 + + + + + username + textChanged(QString) + NewConnectionDialog + setUser(QString) + + + 97 + 84 + + + 43 + 136 + + + + + geometry + textChanged(QString) + NewConnectionDialog + setGeometry(QString) + + + 121 + 118 + + + 41 + 176 + + + + + + typeSelected(QString) + setHost(QString) + setUser(QString) + setGeometry(QString) + + diff -r 000000000000 -r f889ad584f0a RemoteViewer/RemoteViewer.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RemoteViewer/RemoteViewer.py Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,16 @@ +from PyQt4.QtGui import QMainWindow +from PyQtLib.ExceptionSafeSlot import ExceptionSafeSlot + +from .NewConnectionDialog import NewConnectionDialog +from .Ui_RemoteViewer import Ui_RemoteViewer + +class RemoteViewer(QMainWindow): + def __init__(self): + super(RemoteViewer, self).__init__() + self.ui = Ui_RemoteViewer() + self.ui.setupUi(self) + + @ExceptionSafeSlot() + def newConnection(self): + dialog = NewConnectionDialog() + dialog.exec_() diff -r 000000000000 -r f889ad584f0a RemoteViewer/RemoteViewer.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RemoteViewer/RemoteViewer.ui Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,98 @@ + + + RemoteViewer + + + + 0 + 0 + 439 + 410 + + + + Remote + + + + + + + + + + + + 0 + 0 + 439 + 23 + + + + + File + + + + + + + + + + + Quit + + + Ctrl+Q + + + + + New + + + Ctrl+N + + + + + + + actionQuit + triggered() + RemoteViewer + close() + + + -1 + -1 + + + 399 + 299 + + + + + actionNew + triggered() + RemoteViewer + newConnection() + + + -1 + -1 + + + 219 + 204 + + + + + + newConnection() + + diff -r 000000000000 -r f889ad584f0a __init__.py diff -r 000000000000 -r f889ad584f0a __main__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/__main__.py Fri Sep 19 04:02:38 2014 +0200 @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +# see http://stackoverflow.com/questions/6238193/pyqt-new-api-with-python-2 +import sip +sip.setapi('QString', 2) +sip.setapi('QVariant', 2) + +import sys +from PyQt4.QtGui import QApplication +from RemoteViewer.RemoteViewer import RemoteViewer + +if __name__ == '__main__': + app = QApplication(sys.argv) + window = RemoteViewer() + window.show() + sys.exit(app.exec_())