1 # Copyright (c) 2010 Citrix Systems, Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from OVEStandard import *
16 from OVELogger import *
17 from Ui_HostWindow import *
19 class OVEHostWindow(QtGui.QDialog):
20 DEFAULT_CONNECT_TARGET = 'unix:/var/run/openvswitch/db.sock'
21 def __init__(self, parent, currentValues = None):
22 QtGui.QDialog.__init__(self, parent)
23 self.ui = Ui_HostWindow()
26 self.connect(self.ui.buttonBox, QtCore.SIGNAL("clicked(QAbstractButton *)"), self.xon_actionButton_Box_clicked)
27 if currentValues is not None:
28 self.ui.hostAddressEdit.setText(currentValues['address'])
29 self.ui.hostPasswordEdit.setText(currentValues['password'])
30 self.ui.hostConnectTarget.setText(currentValues.get('connectTarget', self.DEFAULT_CONNECT_TARGET))
31 self.uuid = currentValues.get('uuid', str(uuid.uuid4()))
33 self.ui.hostConnectTarget.setText(self.DEFAULT_CONNECT_TARGET)
34 self.uuid = str(uuid.uuid4())
37 def xon_actionButton_Box_clicked(self, button):
38 role = self.ui.buttonBox.buttonRole(button)
39 if role == QtGui.QDialogButtonBox.AcceptRole:
42 elif role == QtGui.QDialogButtonBox.RejectRole:
48 'accepted' : self.accepted,
50 'address' : str(self.ui.hostAddressEdit.text()),
51 'password' : str(self.ui.hostPasswordEdit.text()),
52 'connectTarget' : str(self.ui.hostConnectTarget.text())