def removeCurrentAlias(self, checked=False): item = self.currentItem() if not item: return name = item.alias.name # item will get recreated after question dialog shows so keep only index pos = self.indexOfTopLevelItem(item) 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: self.previousSelected = pos self.takeTopLevelItem(pos) del self.aliases[name] self.updatePosNumbers() if pos >= self.topLevelItemCount() - 1: pos = self.topLevelItemCount() - 1 self.previousSelected = pos if pos != -1: new_item = self.topLevelItem(pos) self.setCurrentItem(new_item) self.setItemSelected(new_item, True) self.aliasRemoved.emit(name)
def clear_clicked(self, checked=False): thumbnail_dir = system.get_vistrails_directory("thumbs.cacheDir") res = show_question('VisTrails', ("All files in %s will be removed. " "Are you sure? " % thumbnail_dir), buttons=[YES_BUTTON, NO_BUTTON], default=NO_BUTTON) if res == YES_BUTTON: ThumbnailCache.getInstance().clear()
def clear_clicked(self, checked=False): thumbnail_dir = system.get_vistrails_directory("thumbs.cacheDir") res = show_question('VisTrails', ("All files in %s will be removed. " "Are you sure? " % thumbnail_dir), buttons = [YES_BUTTON,NO_BUTTON], default = NO_BUTTON) if res == YES_BUTTON: ThumbnailCache.getInstance().clear()
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 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 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 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() if not item: return name = item.alias.name # item will get recreated after question dialog shows so keep only index pos = self.indexOfTopLevelItem(item) 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: self.previousSelected = pos self.takeTopLevelItem(pos) del self.aliases[name] self.updatePosNumbers() if pos >= self.topLevelItemCount() - 1: pos = self.topLevelItemCount() - 1 self.previousSelected = pos if pos != -1: new_item = self.topLevelItem(pos) self.setCurrentItem(new_item) self.setItemSelected(new_item, True) self.aliasRemoved.emit(name)