Mercurial > hg > RemoteViewer
changeset 1:fe8a1645b632
connect the ui elements directly to the Connection object
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 19 Sep 2014 04:17:06 +0200 |
parents | f889ad584f0a |
children | 71c9c315cfad |
files | RemoteViewer/Connection.py RemoteViewer/NewConnectionDialog.py RemoteViewer/NewConnectionDialog.ui |
diffstat | 3 files changed, 16 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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)
--- 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 @@ </hint> </hints> </connection> - <connection> - <sender>type</sender> - <signal>activated(QString)</signal> - <receiver>NewConnectionDialog</receiver> - <slot>typeSelected(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>112</x> - <y>21</y> - </hint> - <hint type="destinationlabel"> - <x>32</x> - <y>147</y> - </hint> - </hints> - </connection> - <connection> - <sender>hostname</sender> - <signal>textChanged(QString)</signal> - <receiver>NewConnectionDialog</receiver> - <slot>setHost(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>102</x> - <y>52</y> - </hint> - <hint type="destinationlabel"> - <x>64</x> - <y>160</y> - </hint> - </hints> - </connection> - <connection> - <sender>username</sender> - <signal>textChanged(QString)</signal> - <receiver>NewConnectionDialog</receiver> - <slot>setUser(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>97</x> - <y>84</y> - </hint> - <hint type="destinationlabel"> - <x>43</x> - <y>136</y> - </hint> - </hints> - </connection> - <connection> - <sender>geometry</sender> - <signal>textChanged(QString)</signal> - <receiver>NewConnectionDialog</receiver> - <slot>setGeometry(QString)</slot> - <hints> - <hint type="sourcelabel"> - <x>121</x> - <y>118</y> - </hint> - <hint type="destinationlabel"> - <x>41</x> - <y>176</y> - </hint> - </hints> - </connection> </connections> <slots> <slot>typeSelected(QString)</slot>