def on_uiButtonBox_clicked(self, button): """ Slot called when a button of the uiButtonBox is clicked. :param button: button that was clicked (QAbstractButton) """ try: from gns3.main_window import MainWindow if button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply): self.applySettings() elif button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset): self.resetSettings() elif button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Cancel): HTTPClient.setProgressCallback(Progress(MainWindow.instance())) QtGui.QDialog.reject(self) else: self.applySettings() HTTPClient.setProgressCallback(Progress(MainWindow.instance())) QtGui.QDialog.accept(self) except ConfigurationError: pass
def __init__(self, node_items, parent): QtGui.QDialog.__init__(self, parent) self.setupUi(self) self._node_items = node_items self._parent_items = {} self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(False) self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(False) self.previousItem = None self.previousPage = None # load the empty page widget by default self.uiEmptyPageWidget = self.uiConfigStackedWidget.findChildren(QtGui.QWidget, "uiEmptyPageWidget")[0] self.uiConfigStackedWidget.setCurrentWidget(self.uiEmptyPageWidget) self._loadNodeItems() self.splitter.setSizes([250, 600]) self.uiNodesTreeWidget.itemClicked.connect(self.showConfigurationPageSlot) HTTPClient.setProgressCallback(Progress(self, min_duration=0))