def write(self, s): """write(s) -> None adds the string s to the message list and displays it """ # adds the string s to the list and s = str(s).strip() msgs = s.split('\n') text = msgs[3] if len(msgs) > 2 else '' item = QtGui.QListWidgetItem(text) item.setData(32, s) item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable) self.list.addItem(item) if msgs[0] == "INFO": item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_INFO_COLOR)) self.list.setItemHidden(item, not self.infoFilter.isChecked()) elif msgs[0] == "WARNING": item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_WARNING_COLOR)) self.list.setItemHidden(item, not self.warningFilter.isChecked()) elif msgs[0] == "CRITICAL": item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_CRITICAL_COLOR)) self.list.setItemHidden(item, not self.criticalFilter.isChecked()) if not get_vistrails_configuration().noDebugPopups: if self.isVisible() and not \ getattr(get_vistrails_configuration(),'alwaysShowDebugPopup',False): self.raise_() self.activateWindow() modal = get_vistrails_application().activeModalWidget() if modal: # need to beat modal window self.showMessageBox(item) else: self.showMessageBox(item)
def write(self, s): """write(s) -> None adds the string s to the message list and displays it """ # adds the string s to the list and s = str(s).strip() msgs = s.split('\n') text = msgs[3] if len(msgs)>2 else '' item = QtGui.QListWidgetItem(text) item.setData(32, s) item.setFlags(item.flags()&~QtCore.Qt.ItemIsEditable) self.list.addItem(item) if msgs[0] == "INFO": item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_INFO_COLOR)) self.list.setItemHidden(item, not self.infoFilter.isChecked()) elif msgs[0] == "WARNING": item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_WARNING_COLOR)) self.list.setItemHidden(item, not self.warningFilter.isChecked()) elif msgs[0] == "CRITICAL": item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_CRITICAL_COLOR)) self.list.setItemHidden(item, not self.criticalFilter.isChecked()) if not get_vistrails_configuration().noDebugPopups: if self.isVisible() and not \ getattr(get_vistrails_configuration(),'alwaysShowDebugPopup',False): self.raise_() self.activateWindow() modal = get_vistrails_application().activeModalWidget() if modal: # need to beat modal window self.showMessageBox(item) else: self.showMessageBox(item)
def sendError(self): data = {} data['platform'] = platform.uname()[0] data['platform_version'] = platform.uname()[2] data['hashed_hostname'] = hashlib.sha1(platform.uname()[1]).hexdigest() data['hashed_username'] = hashlib.sha1(os.getlogin()).hexdigest() data['source'] = 'UV-CDAT' data['source_version'] = '1.2.1' data['description'] = self.getDescription() data['stack_trace'] = self.errorDetails.toPlainText() data['severity'] = 'FATAL' data['comments'] = self.userComments.toPlainText() if get_vistrails_configuration().output != '': fname = get_vistrails_configuration().output # read at most last 5000 chars from output log with open(fname, "r") as f: f.seek (0, 2) # Seek @ EOF fsize = f.tell() # Get Size f.seek (max (fsize-5000, 0), 0) # Set pos @ last n chars data['execution_log'] = f.read() print urlencode(data) print "http://uvcdat.llnl.gov/UVCDATUsage/log/add/error/" result = urlopen("http://uvcdat.llnl.gov/UVCDATUsage/log/add/error/", urlencode(data))
def tab_changed(self, index): """ tab_changed(index: int) -> None Keep general and advanced configurations in sync """ self._configuration_tab.configuration_changed( get_vistrails_persistent_configuration(), get_vistrails_configuration()) self._general_tab.update_state( get_vistrails_persistent_configuration(), get_vistrails_configuration())
def __call__(self, *args, **kw): if Collection._instance is None: config = get_vistrails_configuration() if config: self.dotVistrails = config.dotVistrails else: self.dotVistrails = core.system.default_dot_vistrails() config = get_vistrails_configuration() path = os.path.join(self.dotVistrails, "index.db") obj = Collection(path) Collection._instance = obj return Collection._instance
def create_general_tab(self): """ create_general_tab() -> QGeneralConfiguration """ return QGeneralConfiguration(self, get_vistrails_persistent_configuration(), get_vistrails_configuration())
def create_thumbs_tab(self): """ create_thumbs_tab() -> QThumbnailConfiguration """ return QThumbnailConfiguration(self, get_vistrails_persistent_configuration(), get_vistrails_configuration())
def __init__(self, view=None): """ QVistrailViewToolBar(view: QVistrailView) -> QVistrailViewToolBar Construct default buttons and tabbar for the toolbar """ QtGui.QToolBar.__init__(self, view) self.setWindowTitle('Vistrail Controller') self.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.addAction(self.executeAction()) self.addSeparator() self.detachedHistoryView = getattr(get_vistrails_configuration(), 'detachHistoryView') self.addAction(self.pipelineViewAction()) if not self.detachedHistoryView: self.addAction(self.historyViewAction()) self.addAction(self.queryViewAction()) self.addAction(self.exploreViewAction()) self.connect(self.executeAction(), QtCore.SIGNAL('triggered(bool)'), self.execute) self.connect(self.parent(), QtCore.SIGNAL('changeViewState(int)'), self.changeViewState) self.connect(self.parent(), QtCore.SIGNAL('executeEnabledChanged(bool)'), self.executeEnabledChanged) self.currentViewIndex = 0
def create_thumbs_tab(self): """ create_thumbs_tab() -> QThumbnailConfiguration """ return QThumbnailConfiguration( self, get_vistrails_persistent_configuration(), get_vistrails_configuration())
def __init__(self): self.elements = {} self.vtelements = {} self.conf = None conf = get_vistrails_configuration() if conf.has('thumbs'): self.conf = conf.thumbs self.init_cache()
def get_current_theme(): """get_current_theme() -> subclass of DefaultTheme Instantiates the theme according to the current platform """ theme = get_vistrails_configuration().uvcdat.theme if theme == 'Minimal': return UVCDATMinimalTheme() else: return UVCDATDefaultTheme()
def untitled_locator(): basename = 'untitled' + vistrails_default_file_type() config = get_vistrails_configuration() if config: dot_vistrails = config.dotVistrails else: dot_vistrails = default_dot_vistrails() fullname = os.path.join(dot_vistrails, basename) return FileLocator(fullname)
def get_save_file_locator_from_gui(parent, obj_type, locator=None): # Ignore current locator for now # In the future, use locator to guide GUI for better starting directory suffixes = "*" + " *".join(suffix_map[obj_type]) fileName = QtGui.QFileDialog.getSaveFileName( parent, "Save Vistrail...", core.system.vistrails_file_directory(), "VisTrails files (%s)" % suffixes, # filetypes.strip() None, QtGui.QFileDialog.DontConfirmOverwrite) if fileName.isEmpty(): return None f = str(fileName) # check for proper suffix found_suffix = False for suffix in suffix_map[obj_type]: if f.endswith(suffix): found_suffix = True break if not found_suffix: if obj_type == 'vistrail': f += get_vistrails_configuration().defaultFileType else: f += suffix_map[obj_type][0] if os.path.isfile(f): msg = QtGui.QMessageBox(QtGui.QMessageBox.Question, "VisTrails", "File exists. Overwrite?", (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), parent) if msg.exec_() == QtGui.QMessageBox.No: return None dirName = os.path.dirname(str(f)) setattr(get_vistrails_persistent_configuration(), 'fileDirectory', dirName) setattr(get_vistrails_configuration(), 'fileDirectory', dirName) core.system.set_vistrails_file_directory(dirName) return FileLocator(f)
def createDetachedViews(self): """ createDetachedViews() -> None Create a set of QStackedWidget for displaying detached views based on the input configuration """ if getattr(get_vistrails_configuration(), 'detachHistoryView'): self.historyView = QDetachedView('History View') self.historyView.show() else: self.historyView = None
def uvcdatAutoExecuteActionTriggered(self, checked): """uvcdatAutoExecuteActionTriggered(checked: boolean) -> None When the check state changes the configuration needs to be updated. """ from core.configuration import get_vistrails_persistent_configuration,\ get_vistrails_configuration from gui.application import get_vistrails_application _app = get_vistrails_application() get_vistrails_persistent_configuration().uvcdat.autoExecute = checked get_vistrails_configuration().uvcdat.autoExecute = checked _app.save_configuration()
def __init__(self, locals=None, parent=None): """Constructor. The optional 'locals' argument specifies the dictionary in which code will be executed; it defaults to a newly created dictionary with key "__name__" set to "__console__" and key "__doc__" set to None. The optional 'log' argument specifies the file in which the interpreter session is to be logged. The optional 'parent' argument specifies the parent widget. If no parent widget has been specified, it is possible to exit the interpreter by Ctrl-D. """ QtGui.QTextEdit.__init__(self, parent) self.setReadOnly(False) self.setWindowTitle("Console") # to exit the main interpreter by a Ctrl-D if QShell has no parent if parent is None: self.eofKey = QtCore.Qt.Key_D else: self.eofKey = None # flag for knowing when selecting text self.selectMode = False self.interpreter = None self.controller = None # storing current state #this is not working on mac #self.prev_stdout = sys.stdout #self.prev_stdin = sys.stdin #self.prev_stderr = sys.stderr # capture all interactive input/output #sys.stdout = self #sys.stderr = self #sys.stdin = self # user interface setup self.setAcceptRichText(False) self.setWordWrapMode(QtGui.QTextOption.WrapAnywhere) conf = get_vistrails_configuration() shell_conf = conf.shell # font font = QtGui.QFont(shell_conf.font_face, shell_conf.font_size) font.setFixedPitch(1) self.setFont(font) self.reset(locals)
def uvcdatMinimalThemeActionTriggered(self, checked): """uvcdatMinimalThemeActionTriggered(checked: boolean) -> None When the check state changes the configuration needs to be updated. """ from core.configuration import get_vistrails_persistent_configuration,\ get_vistrails_configuration from gui.application import get_vistrails_application _app = get_vistrails_application() get_vistrails_persistent_configuration().uvcdat.theme = "Minimal" get_vistrails_configuration().uvcdat.theme = "Minimal" _app.save_configuration() self.uvcdat_show_changes_message()
def get_load_file_locator_from_gui(parent, obj_type): suffixes = "*" + " *".join(suffix_map[obj_type]) fileName = QtGui.QFileDialog.getOpenFileName( parent, "Open %s..." % obj_type.capitalize(), core.system.vistrails_file_directory(), "VisTrails files (%s)\nOther files (*)" % suffixes) if fileName.isEmpty(): return None filename = os.path.abspath(str(fileName)) dirName = os.path.dirname(filename) setattr(get_vistrails_persistent_configuration(), 'fileDirectory', dirName) setattr(get_vistrails_configuration(), 'fileDirectory', dirName) core.system.set_vistrails_file_directory(dirName) return FileLocator(filename)
def change_configuration(self, item, col): if item.flags() & QtCore.Qt.ItemIsEditable: new_value = self.indexFromItem(item, col).data().toString() item.change_value(new_value) # option-specific code if item._name == 'dbDefault': # Update the state of the icons if changing between db and # file support print "dbDefault", new_value dbState = getattr(get_vistrails_configuration(), 'dbDefault') if new_value != dbState: from gui.vistrails_window import _app _app.setDBDefault(dbState) self.emit(QtCore.SIGNAL('configuration_changed'), item, new_value)
def change_configuration(self, item, col): if item.flags() & QtCore.Qt.ItemIsEditable: new_value = self.indexFromItem(item, col).data().toString() item.change_value(new_value) # option-specific code if item._name == "dbDefault": # Update the state of the icons if changing between db and # file support print "dbDefault", new_value dbState = getattr(get_vistrails_configuration(), "dbDefault") if new_value != dbState: from gui.vistrails_window import _app _app.setDBDefault(dbState) self.emit(QtCore.SIGNAL("configuration_changed"), item, new_value)
def __init__(self, parent=None): """ QInteractiveGraphicsView(parent: QWidget) -> QInteractiveGraphicsView Initialize the graphics view with interactive options """ QtGui.QGraphicsView.__init__(self, parent) self.setInteractive(True) # self.setCacheMode(QtGui.QGraphicsView.CacheBackground) self.setResizeAnchor(QtGui.QGraphicsView.AnchorViewCenter) self.setRenderHints (QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing | QtGui.QPainter.SmoothPixmapTransform) self.scaleMax = 2000 self.scaleRatio = self.scaleMax/10 self.currentScale = self.scaleMax/2 self.startScroll = (0,0) self.lastPos = QtCore.QPoint(0,0) self.pipScene = None self.pipFrame = None self.resetButton = None self.selectionBox = QGraphicsRubberBandItem(None) self.startSelectingPos = None self.setProperty('captureModifiers', QtCore.QVariant(1)) self.defaultCursorState = 0 self.setCursorState(self.defaultCursorState) self.canSelectBackground = True self.canSelectRectangle = True if QtCore.QT_VERSION >= 0x40600: self.viewport().grabGesture(QtCore.Qt.PinchGesture) self.gestureStartScale = None conf = get_vistrails_configuration() conf.subscribe('showScrollbars', self.setScrollbarPolicy) self.setScrollbarPolicy('showScrollbars', conf.showScrollbars)
def package_dependencies(): import core.packagemanager manager = core.packagemanager.get_package_manager() reg = core.modules.module_registry.get_module_registry() conf = get_vistrails_configuration() if conf.check("abstractionsDirectory"): abstraction_dir = conf.abstractionsDirectory p = re.compile(r".*\.xml") all_packages = set() for abstraction in os.listdir(abstraction_dir): if p.match(abstraction): abs_fname = os.path.join(abstraction_dir, abstraction) try: vistrail = read_vistrail(abs_fname) dependencies = get_abstraction_dependencies(vistrail) except core.modules.module_registry.MissingPackage, e: dependencies = {e._identifier: set()} add_abstraction = True inter_depends = [] for package, depends in dependencies.iteritems(): if package != identifier: if not manager.has_package(package): add_abstraction = False break else: inter_depends.append(depends) if add_abstraction: # print 'adding', abstraction[:-4] all_packages.update(p for p in dependencies.iterkeys() if p != identifier) vistrails[abstraction[:-4]] = \ (vistrail, abs_fname, inter_depends) else: debug.critical( ("Subworkflow '%s' is missing packages it " + "depends on") % abstraction)
def __init__(self, parent=None): """ QInteractiveGraphicsView(parent: QWidget) -> QInteractiveGraphicsView Initialize the graphics view with interactive options """ QtGui.QGraphicsView.__init__(self, parent) self.setInteractive(True) # self.setCacheMode(QtGui.QGraphicsView.CacheBackground) self.setResizeAnchor(QtGui.QGraphicsView.AnchorViewCenter) self.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing | QtGui.QPainter.SmoothPixmapTransform) self.scaleMax = 2000 self.scaleRatio = self.scaleMax / 10 self.currentScale = self.scaleMax / 2 self.startScroll = (0, 0) self.lastPos = QtCore.QPoint(0, 0) self.pipScene = None self.pipFrame = None self.resetButton = None self.selectionBox = QGraphicsRubberBandItem(None) self.startSelectingPos = None self.setProperty('captureModifiers', QtCore.QVariant(1)) self.defaultCursorState = 0 self.setCursorState(self.defaultCursorState) self.canSelectBackground = True self.canSelectRectangle = True if QtCore.QT_VERSION >= 0x40600: self.viewport().grabGesture(QtCore.Qt.PinchGesture) self.gestureStartScale = None conf = get_vistrails_configuration() conf.subscribe('showScrollbars', self.setScrollbarPolicy) self.setScrollbarPolicy('showScrollbars', conf.showScrollbars)
def package_dependencies(): import core.packagemanager manager = core.packagemanager.get_package_manager() reg = core.modules.module_registry.get_module_registry() conf = get_vistrails_configuration() if conf.check("abstractionsDirectory"): abstraction_dir = conf.abstractionsDirectory p = re.compile(r".*\.xml") all_packages = set() for abstraction in os.listdir(abstraction_dir): if p.match(abstraction): abs_fname = os.path.join(abstraction_dir, abstraction) try: vistrail = read_vistrail(abs_fname) dependencies = get_abstraction_dependencies(vistrail) except core.modules.module_registry.MissingPackage, e: dependencies = {e._identifier: set()} add_abstraction = True inter_depends = [] for package, depends in dependencies.iteritems(): if package != identifier: if not manager.has_package(package): add_abstraction = False break else: inter_depends.append(depends) if add_abstraction: # print 'adding', abstraction[:-4] all_packages.update(p for p in dependencies.iterkeys() if p != identifier) vistrails[abstraction[:-4]] = \ (vistrail, abs_fname, inter_depends) else: debug.critical(("Subworkflow '%s' is missing packages it " + "depends on") % abstraction)
def create_configuration_tab(self): return QConfigurationWidget(self, get_vistrails_persistent_configuration(), get_vistrails_configuration(), self._status_bar)
def uvcdatPreferencesAction(self): """ uvcdatAutoExecuteAction(self) -> QAction It will show a popup with preferences """ from core.configuration import get_vistrails_configuration if not hasattr(self, 'uvcdatPreferencesVar'): self.uvcdatPreferencesVar = QtGui.QAction(UVCDATTheme.PREFERENCES_ICON, 'Sheet Options', self) self.uvcdatPreferencesVar.setStatusTip("Show Sheet Options") prefMenu = QtGui.QMenu(self) executeAction = prefMenu.addAction("Auto-Execute") executeAction.setStatusTip( 'Execute visualization automatically after changes') executeAction.setCheckable(True) conf = get_vistrails_configuration() checked = True if conf.has('uvcdat'): checked = conf.uvcdat.check('autoExecute') executeAction.setChecked(checked) aspectAction = prefMenu.addAction("Keep Aspect Ratio in VCS plots") aspectAction.setStatusTip("Keep Aspect Ratio in VCS plots") aspectAction.setCheckable(True) checked = True if conf.has('uvcdat'): checked = conf.uvcdat.check('aspectRatio') aspectAction.setChecked(checked) exportMenu = prefMenu.addMenu("Export Sheet") singleAction = exportMenu.addAction('As a Single Image...') multiAction = exportMenu.addAction('Separately...') self.connect(singleAction, QtCore.SIGNAL('triggered()'), self.exportSheetToSingleImageActionTriggered) self.connect(multiAction, QtCore.SIGNAL('triggered()'), self.exportSheetToSeparateImagesActionTriggered) themeMenu = prefMenu.addMenu("Icons Theme") defaultThemeAction = themeMenu.addAction("Default") defaultThemeAction.setCheckable(True) defaultThemeAction.setStatusTip("Use the default theme (the application must be restarted for changes to take effect)") minimalThemeAction = themeMenu.addAction("Minimal") minimalThemeAction.setCheckable(True) minimalThemeAction.setStatusTip("Use the minimal theme (the application must be restarted for changes to take effect)") themegroup = QtGui.QActionGroup(self) themegroup.addAction(defaultThemeAction) themegroup.addAction(minimalThemeAction) if conf.uvcdat.theme == "Default": defaultThemeAction.setChecked(True) elif conf.uvcdat.theme == "Minimal": minimalThemeAction.setChecked(True) self.uvcdatPreferencesVar.setMenu(prefMenu) self.connect(executeAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatAutoExecuteActionTriggered) self.connect(aspectAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatAspectRatioActionTriggered) self.connect(defaultThemeAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatDefaultThemeActionTriggered) self.connect(minimalThemeAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatMinimalThemeActionTriggered) return self.uvcdatPreferencesVar
def run_and_get_results(w_list, parameters='', workflow_info=None, update_vistrail=True, extra_info=None, reason='Console Mode Execution'): """run_and_get_results(w_list: list of (locator, version), parameters: str, workflow_info:str, update_vistrail: boolean, extra_info:dict) Run all workflows in w_list, and returns an interpreter result object. version can be a tag name or a version id. """ elements = parameters.split("$&$") aliases = {} result = [] for locator, workflow in w_list: (v, abstractions , thumbnails, mashups) = load_vistrail(locator) controller = VistrailController(auto_save=update_vistrail) controller.set_vistrail(v, locator, abstractions, thumbnails, mashups) if type(workflow) == type("str"): version = v.get_version_number(workflow) elif type(workflow) in [ type(1), long]: version = workflow elif workflow is None: version = controller.get_latest_version_in_graph() else: msg = "Invalid version tag or number: %s" % workflow raise VistrailsInternalError(msg) controller.change_selected_version(version) for e in elements: pos = e.find("=") if pos != -1: key = e[:pos].strip() value = e[pos+1:].strip() if controller.current_pipeline.has_alias(key): aliases[key] = value if workflow_info is not None and controller.current_pipeline is not None: if is_running_gui(): from gui.pipeline_view import QPipelineView pipeline_view = QPipelineView() pipeline_view.scene().setupScene(controller.current_pipeline) base_fname = "%s_%s_pipeline.pdf" % (locator.short_name, version) filename = os.path.join(workflow_info, base_fname) pipeline_view.scene().saveToPDF(filename) del pipeline_view else: debug.critical("Cannot save pipeline figure when not " "running in gui mode") base_fname = "%s_%s_pipeline.xml" % (locator.short_name, version) filename = os.path.join(workflow_info, base_fname) core.db.io.save_workflow(controller.current_pipeline, filename) if not update_vistrail: conf = get_vistrails_configuration() if conf.has('thumbs'): conf.thumbs.autoSave = False (results, _) = \ controller.execute_current_workflow(custom_aliases=aliases, extra_info=extra_info, reason=reason) new_version = controller.current_version if new_version != version: debug.warning("Version '%s' (%s) was upgraded. The actual " "version executed was %s" % \ (workflow, version, new_version)) run = results[0] run.workflow_info = (locator.name, new_version) run.pipeline = controller.current_pipeline if update_vistrail: controller.write_vistrail(locator) result.append(run) return result
def run_and_get_results(w_list, parameters='', workflow_info=None, update_vistrail=True, extra_info=None, reason='Console Mode Execution'): """run_and_get_results(w_list: list of (locator, version), parameters: str, workflow_info:str, update_vistrail: boolean, extra_info:dict) Run all workflows in w_list, and returns an interpreter result object. version can be a tag name or a version id. """ elements = parameters.split("$&$") aliases = {} result = [] for locator, workflow in w_list: (v, abstractions, thumbnails, mashups) = load_vistrail(locator) controller = VistrailController(auto_save=update_vistrail) controller.set_vistrail(v, locator, abstractions, thumbnails, mashups) if type(workflow) == type("str"): version = v.get_version_number(workflow) elif type(workflow) in [type(1), long]: version = workflow elif workflow is None: version = controller.get_latest_version_in_graph() else: msg = "Invalid version tag or number: %s" % workflow raise VistrailsInternalError(msg) controller.change_selected_version(version) for e in elements: pos = e.find("=") if pos != -1: key = e[:pos].strip() value = e[pos + 1:].strip() if controller.current_pipeline.has_alias(key): aliases[key] = value if workflow_info is not None and controller.current_pipeline is not None: if is_running_gui(): from gui.pipeline_view import QPipelineView pipeline_view = QPipelineView() pipeline_view.scene().setupScene(controller.current_pipeline) base_fname = "%s_%s_pipeline.pdf" % (locator.short_name, version) filename = os.path.join(workflow_info, base_fname) pipeline_view.scene().saveToPDF(filename) del pipeline_view else: debug.critical("Cannot save pipeline figure when not " "running in gui mode") base_fname = "%s_%s_pipeline.xml" % (locator.short_name, version) filename = os.path.join(workflow_info, base_fname) core.db.io.save_workflow(controller.current_pipeline, filename) if not update_vistrail: conf = get_vistrails_configuration() if conf.has('thumbs'): conf.thumbs.autoSave = False (results, _) = \ controller.execute_current_workflow(custom_aliases=aliases, extra_info=extra_info, reason=reason) new_version = controller.current_version if new_version != version: debug.warning("Version '%s' (%s) was upgraded. The actual " "version executed was %s" % \ (workflow, version, new_version)) run = results[0] run.workflow_info = (locator.name, new_version) run.pipeline = controller.current_pipeline if update_vistrail: controller.write_vistrail(locator) result.append(run) return result
def warning(self, msg): print "WARNING: %s" % msg if not get_vistrails_configuration().noDebugPopups: QtGui.QMessageBox.warning(self, "Warning", msg)
def from_link_file(filename): """from_link_file(filename: str) -> DBLocator This will parse a '.vtl' file and will create a DBLocator. .vtl files are vistrail link files and they are used to point vistrails to open vistrails from the database on the web. """ def convert_from_str(value,type): def bool_conv(x): s = str(x).upper() if s == 'TRUE': return True if s == 'FALSE': return False if value is not None: if type == 'str': return str(value) elif value.strip() != '': if type == 'long': return long(value) elif type == 'float': return float(value) elif type == 'int': return int(value) elif type == 'bool': return bool_conv(value) elif type == 'base64': return base64.b64decode(value) return None def guess_extension_from_contents(contents): if contents.startswith("<vistrail"): return ".xml" else: return ".vt" tree = ElementTree.parse(filename) node = tree.getroot() if node.tag != 'vtlink': return None #read attributes data = node.get('host', None) host = convert_from_str(data, 'str') data = node.get('port', None) port = convert_from_str(data,'int') data = node.get('database', None) database = convert_from_str(data,'str') data = node.get('vtid') vt_id = convert_from_str(data, 'int') data = node.get('version') version = convert_from_str(data, 'str') data = node.get('tag') tag = convert_from_str(data, 'str') data = node.get('execute') execute = convert_from_str(data, 'bool') data = node.get('showSpreadsheetOnly') showSpreadsheetOnly = convert_from_str(data, 'bool') data = node.get('url', None) url = convert_from_str(data,'str') data = node.get('vtcontent', None) vtcontent = convert_from_str(data,'base64') data = node.get('filename', None) vtname = convert_from_str(data, 'str') data = node.get('forceDB',None) forceDB = convert_from_str(data,'bool') data = node.get('mashuptrail', None) mashuptrail = convert_from_str(data, 'str') data = node.get('mashupVersion', None) mashupVersion = convert_from_str(data, 'int') #if execute is False, we will show the builder too if showSpreadsheetOnly and not execute: showSpreadsheetOnly = False try: version = int(version) except: pass if tag is None: tag = ''; ## execute and showSpreadsheetOnly should be written to the current ## configuration config = get_vistrails_configuration() config.executeWorkflows = execute config.showSpreadsheetOnly = showSpreadsheetOnly if not forceDB: if vtcontent is not None: if url is not None: basename = url.split('/')[-1] base,ext = os.path.splitext(basename) dirname = os.path.dirname(filename) fname = os.path.join(dirname,basename) else: basename = os.path.basename(filename) base,ext = os.path.splitext(basename) ext = guess_extension_from_contents(vtcontent) dirname = os.path.dirname(filename) fname = os.path.join(dirname,"%s%s"%(base,ext)) create_file = True if os.path.exists(fname): #file was extracted before create_file = False oldf = open(fname) oldcontents = oldf.read() if oldcontents != vtcontent: import gui.extras.core.db.locator as db_gui (overwrite, newname) = \ db_gui.ask_to_overwrite_file(None, 'vistrail') create_file = True if newname: fname = newname elif overwrite == False: i=1 while os.path.exists(fname): newbase = "%s_%s%s" % (base, i, ext) fname = os.path.join(dirname,newbase) i+=1 if create_file: f = open(fname,'wb') f.write(vtcontent) f.close() return FileLocator(fname, version_node=version, version_tag=tag, mashuptrail=mashuptrail, mashupVersion=mashupVersion) if host is not None: user = "" passwd = "" return DBLocator(host, port, database, user, passwd, None, obj_id=vt_id, obj_type='vistrail',connection_id=None, version_node=version, version_tag=tag, mashuptrail=mashuptrail, mashupVersion=mashupVersion) elif vtname is not None: if os.path.dirname(vtname) == '': #check if file exists in the same directory as the .vtl file dirname = os.path.dirname(filename) newvtname = os.path.join(dirname,vtname) if os.path.exists(newvtname): vtname = newvtname print vtname, version, tag, mashuptrail,mashupVersion return FileLocator(vtname, version_node=version, versin_tag=tag, mashuptrail=mashuptrail, mashupVersion=mashupVersion)
def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog base_layout = QtGui.QVBoxLayout(self) top = QtGui.QFrame(self) bottom = QtGui.QFrame(self) base_layout.addWidget(top) base_layout.addWidget(bottom, 1) # TODO: this '/' check should probably be done in core/configuration.py self.config = get_vistrails_configuration() if self.config.webRepositoryURL[-1] == '/': self.config.webRepositoryURL = self.config.webRepositoryURL[:-1] # check if the web repository url has changed while logged in if self.dialog.cookie_url and \ self.dialog.cookie_url != self.config.webRepositoryURL: self.dialog.cookiejar = None ###################################################################### # Detail Table bottom_layout = QtGui.QVBoxLayout(bottom) bottom_layout.setMargin(2) bottom_layout.setSpacing(2) # Show what workflows are unrunnble on the repository # and for what reasons self._unrunnable_table = QtGui.QTableWidget(0, 2, top) self._unrunnable_table.horizontalHeader().setStretchLastSection(True) bottom_layout.addWidget(self._unrunnable_table) self._repository_status = {} ###################################################################### # Push info top_layout = QtGui.QVBoxLayout(top) self._vistrail_status_label = QtGui.QLabel("") self._vistrail_status_label.setWordWrap(True) top_layout.addWidget(self._vistrail_status_label) self.serverCombo = QtGui.QComboBox() self.connect(self.serverCombo, QtCore.SIGNAL("currentIndexChanged(int)"), self.check_dependencies) top_layout.addWidget(self.serverCombo) """ self._default_perm_label = QtGui.QLabel("Default Global Permissions:") top_layout.addWidget(self._default_perm_label) self.perm_view = QtGui.QCheckBox("view") self.perm_download = QtGui.QCheckBox("download") self.perm_edit = QtGui.QCheckBox("edit") top_layout.addWidget(self.perm_view) top_layout.addWidget(self.perm_download) top_layout.addWidget(self.perm_edit) self.perm_view.setEnabled(True) """ self.permission_gb = QtGui.QGroupBox(self) self.permission_gb.setTitle("Default Global Permissions") glayout = QtGui.QHBoxLayout() self.perm_view = QtGui.QCheckBox("view") self.perm_download = QtGui.QCheckBox("download") self.perm_edit = QtGui.QCheckBox("edit") glayout.addWidget(self.perm_view) glayout.addWidget(self.perm_download) glayout.addWidget(self.perm_edit) self.perm_view.setChecked(True) self.perm_download.setChecked(True) self.permission_gb.setLayout(glayout) top_layout.addWidget(self.permission_gb) self._details_label = QtGui.QLabel("") self._details_label.setWordWrap(True) top_layout.addWidget(self._details_label) for lbl in [self._details_label, self._vistrail_status_label]: lbl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) lbl.setWordWrap(True) self._push_button = QtGui.QPushButton("&Push") self._push_button.setEnabled(False) self.connect(self._push_button, QtCore.SIGNAL("clicked()"), self.push_vistrail_to_repository) self._branch_button = QtGui.QPushButton("&Branch") self._branch_button.hide() self.connect(self._branch_button, QtCore.SIGNAL("clicked()"), (lambda branching=True : self.push_vistrail_to_repository(branching))) button_box = QtGui.QDialogButtonBox() button_box.addButton(self._push_button, QtGui.QDialogButtonBox.ActionRole) button_box.addButton(self._branch_button, QtGui.QDialogButtonBox.ActionRole) bottom_layout.addWidget(button_box)
def uvcdatPreferencesAction(self): """ uvcdatAutoExecuteAction(self) -> QAction It will show a popup with preferences """ from core.configuration import get_vistrails_configuration if not hasattr(self, 'uvcdatPreferencesVar'): self.uvcdatPreferencesVar = QtGui.QAction( UVCDATTheme.PREFERENCES_ICON, 'Preferences', self) self.uvcdatPreferencesVar.setStatusTip("Show Preferences") prefMenu = QtGui.QMenu(self) executeAction = prefMenu.addAction("Auto-Execute") executeAction.setStatusTip( 'Execute visualization automatically after changes') executeAction.setCheckable(True) conf = get_vistrails_configuration() checked = True if conf.has('uvcdat'): checked = conf.uvcdat.check('autoExecute') executeAction.setChecked(checked) aspectAction = prefMenu.addAction("Keep Aspect Ratio in VCS plots") aspectAction.setStatusTip("Keep Aspect Ratio in VCS plots") aspectAction.setCheckable(True) checked = True if conf.has('uvcdat'): checked = conf.uvcdat.check('aspectRatio') aspectAction.setChecked(checked) themeMenu = prefMenu.addMenu("Icons Theme") defaultThemeAction = themeMenu.addAction("Default") defaultThemeAction.setCheckable(True) defaultThemeAction.setStatusTip( "Use the default theme (the application must be restarted for changes to take effect)" ) minimalThemeAction = themeMenu.addAction("Minimal") minimalThemeAction.setCheckable(True) minimalThemeAction.setStatusTip( "Use the minimal theme (the application must be restarted for changes to take effect)" ) themegroup = QtGui.QActionGroup(self) themegroup.addAction(defaultThemeAction) themegroup.addAction(minimalThemeAction) if conf.uvcdat.theme == "Default": defaultThemeAction.setChecked(True) elif conf.uvcdat.theme == "Minimal": minimalThemeAction.setChecked(True) self.uvcdatPreferencesVar.setMenu(prefMenu) self.connect(executeAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatAutoExecuteActionTriggered) self.connect(aspectAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatAspectRatioActionTriggered) self.connect(defaultThemeAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatDefaultThemeActionTriggered) self.connect(minimalThemeAction, QtCore.SIGNAL('triggered(bool)'), self.uvcdatMinimalThemeActionTriggered) return self.uvcdatPreferencesVar
def from_link_file(filename): """from_link_file(filename: str) -> DBLocator This will parse a '.vtl' file and will create a DBLocator. .vtl files are vistrail link files and they are used to point vistrails to open vistrails from the database on the web. """ def convert_from_str(value, type): def bool_conv(x): s = str(x).upper() if s == 'TRUE': return True if s == 'FALSE': return False if value is not None: if type == 'str': return str(value) elif value.strip() != '': if type == 'long': return long(value) elif type == 'float': return float(value) elif type == 'int': return int(value) elif type == 'bool': return bool_conv(value) elif type == 'base64': return base64.b64decode(value) return None def guess_extension_from_contents(contents): if contents.startswith("<vistrail"): return ".xml" else: return ".vt" tree = ElementTree.parse(filename) node = tree.getroot() if node.tag != 'vtlink': return None #read attributes data = node.get('host', None) host = convert_from_str(data, 'str') data = node.get('port', None) port = convert_from_str(data, 'int') data = node.get('database', None) database = convert_from_str(data, 'str') data = node.get('vtid') vt_id = convert_from_str(data, 'int') data = node.get('version') version = convert_from_str(data, 'str') data = node.get('tag') tag = convert_from_str(data, 'str') data = node.get('execute') execute = convert_from_str(data, 'bool') data = node.get('showSpreadsheetOnly') showSpreadsheetOnly = convert_from_str(data, 'bool') data = node.get('url', None) url = convert_from_str(data, 'str') data = node.get('vtcontent', None) vtcontent = convert_from_str(data, 'base64') data = node.get('filename', None) vtname = convert_from_str(data, 'str') data = node.get('forceDB', None) forceDB = convert_from_str(data, 'bool') data = node.get('mashuptrail', None) mashuptrail = convert_from_str(data, 'str') data = node.get('mashupVersion', None) mashupVersion = convert_from_str(data, 'int') #if execute is False, we will show the builder too if showSpreadsheetOnly and not execute: showSpreadsheetOnly = False try: version = int(version) except: pass if tag is None: tag = '' ## execute and showSpreadsheetOnly should be written to the current ## configuration config = get_vistrails_configuration() config.executeWorkflows = execute config.showSpreadsheetOnly = showSpreadsheetOnly if not forceDB: if vtcontent is not None: if url is not None: basename = url.split('/')[-1] base, ext = os.path.splitext(basename) dirname = os.path.dirname(filename) fname = os.path.join(dirname, basename) else: basename = os.path.basename(filename) base, ext = os.path.splitext(basename) ext = guess_extension_from_contents(vtcontent) dirname = os.path.dirname(filename) fname = os.path.join(dirname, "%s%s" % (base, ext)) create_file = True if os.path.exists(fname): #file was extracted before create_file = False oldf = open(fname) oldcontents = oldf.read() if oldcontents != vtcontent: import gui.extras.core.db.locator as db_gui (overwrite, newname) = \ db_gui.ask_to_overwrite_file(None, 'vistrail') create_file = True if newname: fname = newname elif overwrite == False: i = 1 while os.path.exists(fname): newbase = "%s_%s%s" % (base, i, ext) fname = os.path.join(dirname, newbase) i += 1 if create_file: f = open(fname, 'wb') f.write(vtcontent) f.close() return FileLocator(fname, version_node=version, version_tag=tag, mashuptrail=mashuptrail, mashupVersion=mashupVersion) if host is not None: user = "" passwd = "" return DBLocator(host, port, database, user, passwd, None, obj_id=vt_id, obj_type='vistrail', connection_id=None, version_node=version, version_tag=tag, mashuptrail=mashuptrail, mashupVersion=mashupVersion) elif vtname is not None: if os.path.dirname(vtname) == '': #check if file exists in the same directory as the .vtl file dirname = os.path.dirname(filename) newvtname = os.path.join(dirname, vtname) if os.path.exists(newvtname): vtname = newvtname print vtname, version, tag, mashuptrail, mashupVersion return FileLocator(vtname, version_node=version, versin_tag=tag, mashuptrail=mashuptrail, mashupVersion=mashupVersion)
def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog base_layout = QtGui.QVBoxLayout(self) top = QtGui.QFrame(self) bottom = QtGui.QFrame(self) base_layout.addWidget(top) base_layout.addWidget(bottom, 1) # TODO: this '/' check should probably be done in core/configuration.py self.config = get_vistrails_configuration() if self.config.webRepositoryURL[-1] == '/': self.config.webRepositoryURL = self.config.webRepositoryURL[:-1] # check if the web repository url has changed while logged in if self.dialog.cookie_url and \ self.dialog.cookie_url != self.config.webRepositoryURL: self.dialog.cookiejar = None ###################################################################### # Detail Table bottom_layout = QtGui.QVBoxLayout(bottom) bottom_layout.setMargin(2) bottom_layout.setSpacing(2) # Show what workflows are unrunnble on the repository # and for what reasons self._unrunnable_table = QtGui.QTableWidget(0, 2, top) self._unrunnable_table.horizontalHeader().setStretchLastSection(True) bottom_layout.addWidget(self._unrunnable_table) self._repository_status = {} ###################################################################### # Push info top_layout = QtGui.QVBoxLayout(top) self._vistrail_status_label = QtGui.QLabel("") self._vistrail_status_label.setWordWrap(True) top_layout.addWidget(self._vistrail_status_label) self.serverCombo = QtGui.QComboBox() self.connect(self.serverCombo, QtCore.SIGNAL("currentIndexChanged(int)"), self.check_dependencies) top_layout.addWidget(self.serverCombo) """ self._default_perm_label = QtGui.QLabel("Default Global Permissions:") top_layout.addWidget(self._default_perm_label) self.perm_view = QtGui.QCheckBox("view") self.perm_download = QtGui.QCheckBox("download") self.perm_edit = QtGui.QCheckBox("edit") top_layout.addWidget(self.perm_view) top_layout.addWidget(self.perm_download) top_layout.addWidget(self.perm_edit) self.perm_view.setEnabled(True) """ self.permission_gb = QtGui.QGroupBox(self) self.permission_gb.setTitle("Default Global Permissions") glayout = QtGui.QHBoxLayout() self.perm_view = QtGui.QCheckBox("view") self.perm_download = QtGui.QCheckBox("download") self.perm_edit = QtGui.QCheckBox("edit") glayout.addWidget(self.perm_view) glayout.addWidget(self.perm_download) glayout.addWidget(self.perm_edit) self.perm_view.setChecked(True) self.perm_download.setChecked(True) self.permission_gb.setLayout(glayout) top_layout.addWidget(self.permission_gb) self._details_label = QtGui.QLabel("") self._details_label.setWordWrap(True) top_layout.addWidget(self._details_label) for lbl in [self._details_label, self._vistrail_status_label]: lbl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) lbl.setWordWrap(True) self._push_button = QtGui.QPushButton("&Push") self._push_button.setEnabled(False) self.connect(self._push_button, QtCore.SIGNAL("clicked()"), self.push_vistrail_to_repository) self._branch_button = QtGui.QPushButton("&Branch") self._branch_button.hide() self.connect( self._branch_button, QtCore.SIGNAL("clicked()"), (lambda branching=True: self.push_vistrail_to_repository(branching) )) button_box = QtGui.QDialogButtonBox() button_box.addButton(self._push_button, QtGui.QDialogButtonBox.ActionRole) button_box.addButton(self._branch_button, QtGui.QDialogButtonBox.ActionRole) bottom_layout.addWidget(button_box)
def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog base_layout = QtGui.QHBoxLayout(self) main = QtGui.QFrame(self) base_layout.addWidget(main) self.config = get_vistrails_configuration() # TODO: this '/' check should probably be done in core/configuration.py if self.config.webRepositoryURL[-1] == '/': self.config.webRepositoryURL = self.config.webRepositoryURL[:-1] ###################################################################### # main half, Login info main_layout = QtGui.QVBoxLayout(main) login_frame = QtGui.QFrame(main) login_layout = QtGui.QVBoxLayout(login_frame) grid_frame = QtGui.QFrame(login_frame) grid_frame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) login_layout.addWidget(grid_frame) grid_layout = QtGui.QGridLayout(grid_frame) grid_layout.setSpacing(10) l1 = QtGui.QLabel("Repository location: %s" % \ self.config.webRepositoryURL, grid_frame) grid_layout.addWidget(l1, 0, 0) l2 = QtGui.QLabel("Username:"******"", grid_frame) self.dialog.loginUser.setFixedWidth(200) self.dialog.loginUser.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) grid_layout.addWidget(self.dialog.loginUser, 1, 1) l3 = QtGui.QLabel("Password:"******"", grid_frame) self.loginPassword.setEchoMode(2) self.loginPassword.setFixedWidth(200) self.loginPassword.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) grid_layout.addWidget(self.loginPassword, 2, 1) self.saveLogin = QtGui.QCheckBox("Save username", grid_frame) if self.config.check('webRepositoryLogin'): self.saveLogin.setChecked(True) grid_layout.addWidget(self.saveLogin, 3, 0) self._login_status_label= QtGui.QLabel("", grid_frame) grid_layout.addWidget(self._login_status_label, 4, 0) self._login_button = QtGui.QPushButton("&Login", grid_frame) self._logout_button = QtGui.QPushButton("Log&out", grid_frame) self.connect(self._login_button, QtCore.SIGNAL("clicked()"), self.clicked_on_login) self.connect(self._logout_button, QtCore.SIGNAL("clicked()"), self.clicked_on_logout) button_box = QtGui.QDialogButtonBox() button_box.addButton(self._login_button, QtGui.QDialogButtonBox.ActionRole) button_box.addButton(self._logout_button, QtGui.QDialogButtonBox.ActionRole) grid_layout.addWidget(button_box, 5, 0) for lbl in [l1, l2, l3, self.dialog.loginUser, self.loginPassword, self._login_status_label]: lbl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) grid_layout.setRowStretch(1, 1) grid_layout.setColumnStretch(1, 1) main_layout.addWidget(login_frame) self.dialog.loginUser.setEnabled(True) self.loginPassword.setEnabled(True) self._logout_button.setEnabled(False) self._login_button.setEnabled(True) self.saveLogin.setEnabled(True) if self.dialog.cookiejar and \ 'sessionid' in [cookie.name for cookie in self.dialog.cookiejar]: self.dialog.loginUser.setEnabled(False) self.loginPassword.setEnabled(False) self._login_button.setEnabled(False) self.saveLogin.setEnabled(False) self._logout_button.setEnabled(True) else: self.clicked_on_logout()
def __init__(self, parent, status_bar, dialog): QtGui.QWidget.__init__(self, parent) self._status_bar = status_bar self.dialog = dialog base_layout = QtGui.QHBoxLayout(self) main = QtGui.QFrame(self) base_layout.addWidget(main) self.config = get_vistrails_configuration() # TODO: this '/' check should probably be done in core/configuration.py if self.config.webRepositoryURL[-1] == '/': self.config.webRepositoryURL = self.config.webRepositoryURL[:-1] ###################################################################### # main half, Login info main_layout = QtGui.QVBoxLayout(main) login_frame = QtGui.QFrame(main) login_layout = QtGui.QVBoxLayout(login_frame) grid_frame = QtGui.QFrame(login_frame) grid_frame.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) login_layout.addWidget(grid_frame) grid_layout = QtGui.QGridLayout(grid_frame) grid_layout.setSpacing(10) l1 = QtGui.QLabel("Repository location: %s" % \ self.config.webRepositoryURL, grid_frame) grid_layout.addWidget(l1, 0, 0) l2 = QtGui.QLabel("Username:"******"", grid_frame) self.dialog.loginUser.setFixedWidth(200) self.dialog.loginUser.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) grid_layout.addWidget(self.dialog.loginUser, 1, 1) l3 = QtGui.QLabel("Password:"******"", grid_frame) self.loginPassword.setEchoMode(2) self.loginPassword.setFixedWidth(200) self.loginPassword.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) grid_layout.addWidget(self.loginPassword, 2, 1) self.saveLogin = QtGui.QCheckBox("Save username", grid_frame) if self.config.check('webRepositoryLogin'): self.saveLogin.setChecked(True) grid_layout.addWidget(self.saveLogin, 3, 0) self._login_status_label = QtGui.QLabel("", grid_frame) grid_layout.addWidget(self._login_status_label, 4, 0) self._login_button = QtGui.QPushButton("&Login", grid_frame) self._logout_button = QtGui.QPushButton("Log&out", grid_frame) self.connect(self._login_button, QtCore.SIGNAL("clicked()"), self.clicked_on_login) self.connect(self._logout_button, QtCore.SIGNAL("clicked()"), self.clicked_on_logout) button_box = QtGui.QDialogButtonBox() button_box.addButton(self._login_button, QtGui.QDialogButtonBox.ActionRole) button_box.addButton(self._logout_button, QtGui.QDialogButtonBox.ActionRole) grid_layout.addWidget(button_box, 5, 0) for lbl in [ l1, l2, l3, self.dialog.loginUser, self.loginPassword, self._login_status_label ]: lbl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) grid_layout.setRowStretch(1, 1) grid_layout.setColumnStretch(1, 1) main_layout.addWidget(login_frame) self.dialog.loginUser.setEnabled(True) self.loginPassword.setEnabled(True) self._logout_button.setEnabled(False) self._login_button.setEnabled(True) self.saveLogin.setEnabled(True) if self.dialog.cookiejar and \ 'sessionid' in [cookie.name for cookie in self.dialog.cookiejar]: self.dialog.loginUser.setEnabled(False) self.loginPassword.setEnabled(False) self._login_button.setEnabled(False) self.saveLogin.setEnabled(False) self._logout_button.setEnabled(True) else: self.clicked_on_logout()