# HG changeset patch # User Dirk Olmes # Date 1411093026 -7200 # Node ID fe8a1645b6323d34fb8032327f6cb47314102ee6 # Parent f889ad584f0a2d05347188040cb12407b58eede1 connect the ui elements directly to the Connection object diff -r f889ad584f0a -r fe8a1645b632 RemoteViewer/Connection.py --- a/RemoteViewer/Connection.py Fri Sep 19 04:02:38 2014 +0200 +++ b/RemoteViewer/Connection.py Fri Sep 19 04:17:06 2014 +0200 @@ -10,5 +10,17 @@ def __str__(self): return 'connection "{}" of type {} to {} with user {} and geometry {}'.format(self.title, self.type, self.host, self.user, self.geometry) + def setType(self, type): + self.type = type + + def setHost(self, hostname): + self.host = hostname + + def setUser(self, user): + self.user= user + + def setGeometry(self, geometry): + self.geometry = geometry + def validate(self): pass diff -r f889ad584f0a -r fe8a1645b632 RemoteViewer/NewConnectionDialog.py --- a/RemoteViewer/NewConnectionDialog.py Fri Sep 19 04:02:38 2014 +0200 +++ b/RemoteViewer/NewConnectionDialog.py Fri Sep 19 04:17:06 2014 +0200 @@ -19,19 +19,10 @@ 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 + self.ui.type.activated[str].connect(self.connection.setType) + self.ui.hostname.textChanged.connect(self.connection.setHost) + self.ui.username.textChanged.connect(self.connection.setUser) + self.ui.geometry.textChanged.connect(self.connection.setGeometry) def accept(self): print(self.connection) diff -r f889ad584f0a -r fe8a1645b632 RemoteViewer/NewConnectionDialog.ui --- a/RemoteViewer/NewConnectionDialog.ui Fri Sep 19 04:02:38 2014 +0200 +++ b/RemoteViewer/NewConnectionDialog.ui Fri Sep 19 04:17:06 2014 +0200 @@ -119,70 +119,6 @@ - - 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)