def saveTriggered(self): (pid, pname) = self.mshpController.findFirstTaggedParent(self.mshpController.currentVersion) if pid >= 1: res = show_question("VisTrails::Mashups", """You've decided to keep a modified version of '%s'. Would you like to update it (this will move the tag to the current version)? Click on No to create a new tag.""" %pname, [CANCEL_BUTTON, YES_BUTTON, NO_BUTTON], 0) if res == YES_BUTTON: #move tag self.mshpController.moveTag(pid, self.mshpController.currentVersion, pname) elif res == NO_BUTTON: # show createNewtag dialog tag_exists = True ok = True while ok and tag_exists: (text, ok) = QtGui.QInputDialog.getText(self, "VisTrails::Mashups", "Enter a new tag:", text="") if ok and not text.isEmpty(): tag = str(text) if self.mshpController.updateCurrentTag(tag): tag_exists = False
def saveTriggered(self): (pid, pname) = self.mshpController.findFirstTaggedParent( self.mshpController.currentVersion) if pid >= 1: res = show_question( "VisTrails::Mashups", """You've decided to keep a modified version of '%s'. Would you like to update it (this will move the tag to the current version)? Click on No to create a new tag.""" % pname, [CANCEL_BUTTON, YES_BUTTON, NO_BUTTON], 0) if res == YES_BUTTON: #move tag self.mshpController.moveTag(pid, self.mshpController.currentVersion, pname) elif res == NO_BUTTON: # show createNewtag dialog tag_exists = True ok = True while ok and tag_exists: (text, ok) = QtGui.QInputDialog.getText(self, "VisTrails::Mashups", "Enter a new tag:", text="") if ok and not text.isEmpty(): tag = str(text) if self.mshpController.updateCurrentTag(tag): tag_exists = False
def closeEvent(self, event): choice = show_question('Delete %s?'%self.var_name, 'Are you sure you want to permanently delete the VisTrail variable "%s"?\n\nNote: Any workflows using this variable will be left in an invalid state.'%self.var_name, [NO_BUTTON,YES_BUTTON], NO_BUTTON) if choice == NO_BUTTON: event.ignore() return self.emit(QtCore.SIGNAL('deleted(QWidget*)'), self)
def clear_thumbs_cache_pressed(self): """clear_thumbs_cache_pressed() -> None Will delete all files in thumbs.cacheDirectory if user clicks yes """ res = show_question('VisTrails', "All files in %s will be removed. Are you sure? " % (self._temp_configuration.thumbs.cacheDirectory), buttons=[YES_BUTTON, NO_BUTTON], default=NO_BUTTON) if res == YES_BUTTON: self._cache.clear()
def askToSaveChanges(self): if self.checkForChanges(): message = ('Configuration panel contains unsaved changes. ' 'Do you want to save changes before proceeding?') res = show_question('VisTrails', message, buttons=[SAVE_BUTTON, DISCARD_BUTTON]) if res == SAVE_BUTTON: self.saveTriggered() return True else: self.resetTriggered() return False
def askToSaveChanges(self): if self.state_changed: message = ('Configuration panel contains unsaved changes. ' 'Do you want to save changes before proceeding?' ) res = show_question('VisTrails', message, buttons = [SAVE_BUTTON, DISCARD_BUTTON]) if res == SAVE_BUTTON: self.saveTriggered() return True else: self.resetTriggered() return False
def clear_thumbs_cache_pressed(self): """clear_thumbs_cache_pressed() -> None Will delete all files in thumbs.cacheDirectory if user clicks yes """ res = show_question( "VisTrails", "All files in %s will be removed. Are you sure? " % (self._temp_configuration.thumbs.cacheDirectory), buttons=[YES_BUTTON, NO_BUTTON], default=NO_BUTTON, ) if res == YES_BUTTON: self._cache.clear()
def showEvent(self, e): """showEvent(e: QShowEvent) -> None If the use doesn't have any connection set up, we will ask him to create one. """ if self.connectionList.count() == 0: text = "You don't seem to have any connection available. \ Would you like to create one?" res = show_question("Vistrails", text, [NO_BUTTON, YES_BUTTON], NO_BUTTON) if res == YES_BUTTON: self.showConnConfig() else: self.updateDBObjectsList()
def showEvent(self, e): """showEvent(e: QShowEvent) -> None If the use doesn't have any connection set up, we will ask him to create one. """ if self.connectionList.count() == 0: text = "You don't seem to have any connection available. \ Would you like to create one?" res = show_question('Vistrails', text, [NO_BUTTON, YES_BUTTON], NO_BUTTON) if res == YES_BUTTON: self.showConnConfig() else: self.updateDBObjectsList()
def removeCurrentAlias(self, checked=False): item = self.currentItem() name = item.alias.name res = show_question("Mashups", "Are you sure do you want to remove '%s' from the mashup?"%name, [YES_BUTTON, NO_BUTTON], NO_BUTTON) if res == YES_BUTTON: old_alias = item.alias.name del self.aliases[old_alias] pos = self.indexOfTopLevelItem(item) self.takeTopLevelItem(pos) self.updatePosNumbers() if pos < self.topLevelItemCount() -1: new_item = self.topLevelItem(pos) else: new_item = self.topLevelItem(pos-1) self.setCurrentItem(new_item) self.aliasRemoved.emit(name)
def removeCurrentAlias(self, checked=False): item = self.currentItem() name = item.alias.name res = show_question( "Mashups", "Are you sure do you want to remove '%s' from the mashup?" % name, [YES_BUTTON, NO_BUTTON], NO_BUTTON) if res == YES_BUTTON: old_alias = item.alias.name del self.aliases[old_alias] pos = self.indexOfTopLevelItem(item) self.takeTopLevelItem(pos) self.updatePosNumbers() if pos < self.topLevelItemCount() - 1: new_item = self.topLevelItem(pos) else: new_item = self.topLevelItem(pos - 1) self.setCurrentItem(new_item) self.aliasRemoved.emit(name)