def upgrade(self, serv, new_vers): db = self.db() old_vers = upgrade_utils.get_pool_server_version(serv, db=db) u_kcls = upgrade_utils.get_suitable_upgrade(old_vers, new_vers) u_obj = u_kcls() dialog = QtGui.QProgressDialog("Upgrading %s to %s..." % ( serv, new_vers), "Abort", 0, 100, self) dialog.setAutoClose(True) dialog.setMinimumDuration(0) import time for msg, percentage in u_obj.upgrade(db, serv, old_vers, new_vers): dialog.setLabelText(msg) dialog.setValue(percentage) time.sleep(0.1) dialog = QtGui.QMessageBox() dialog.setWindowTitle("Success!!!") dialog.setText("Do you wish to upgrade another Sardana?") dialog.setInformativeText("Selecting No will exit this wizard") dialog.setIcon(QtGui.QMessageBox.Question) dialog.addButton(QtGui.QMessageBox.Yes) dialog.addButton(QtGui.QMessageBox.No) dialog.setDefaultButton(QtGui.QMessageBox.Yes) return dialog.exec_() == QtGui.QMessageBox.Yes
def upgrade(self, serv, new_vers): db = self.db() old_vers = upgrade_utils.get_pool_server_version(serv, db=db) u_kcls = upgrade_utils.get_suitable_upgrade(old_vers, new_vers) u_obj = u_kcls() dialog = QtGui.QProgressDialog( "Upgrading %s to %s..." % (serv, new_vers), "Abort", 0, 100, self) dialog.setAutoClose(True) dialog.setMinimumDuration(0) import time for msg, percentage in u_obj.upgrade(db, serv, old_vers, new_vers): dialog.setLabelText(msg) dialog.setValue(percentage) time.sleep(0.1) dialog = QtGui.QMessageBox() dialog.setWindowTitle("Success!!!") dialog.setText("Do you wish to upgrade another Sardana?") dialog.setInformativeText("Selecting No will exit this wizard") dialog.setIcon(QtGui.QMessageBox.Question) dialog.addButton(QtGui.QMessageBox.Yes) dialog.addButton(QtGui.QMessageBox.No) dialog.setDefaultButton(QtGui.QMessageBox.Yes) return dialog.exec_() == QtGui.QMessageBox.Yes
def initializePage(self): serv = self.pool() db = self.db() self.setSubTitle('Please select to which version you want to upgrade %s to' % serv) self.versionCB.clear() curr_vers = upgrade_utils.get_pool_server_version(serv, db=db) possible_new_vers = upgrade_utils.get_possible_upgrades(serv, db=db) if not possible_new_vers: self.statusLabel.setText('There are no suitable upgrades for version %s' % curr_vers) else: self.versionCB.addItems(possible_new_vers)
def initializePage(self): serv = self.pool() db = self.db() self.setSubTitle( 'Please select to which version you want to upgrade %s to' % serv) self.versionCB.clear() curr_vers = upgrade_utils.get_pool_server_version(serv, db=db) possible_new_vers = upgrade_utils.get_possible_upgrades(serv, db=db) if not possible_new_vers: self.statusLabel.setText( 'There are no suitable upgrades for version %s' % curr_vers) else: self.versionCB.addItems(possible_new_vers)
def isComplete(self): idx = self.instanceCB.currentIndex() if idx >= 0: db = self.db() serv = str(self.instanceCB.currentText()) curr_vers = upgrade_utils.get_pool_server_version(serv, db=db) txt = 'Current version is %s' % curr_vers possible_upgrades = upgrade_utils.get_possible_upgrades(serv, db=db) if not possible_upgrades: txt += ". There are no possible upgrades for this version" self.statusLabel.setText(txt) return len(possible_upgrades) else: self.statusLabel.setText('No instance selected') return False