def operation_started(self, operation_id): """ Forward the "operation_started" from the spool to the operations manager """ log("[op-start] %s" % Operation.get_by_id(operation_id)) operation = Operation.get_by_id(operation_id) self.parent().emit(SIGNALS['%s_started' % operation.name], operation_id) self.parent().emit(SIGNALS['operation_started'], operation_id)
def operation_ended(self, operation_id): """ Forward the "operation_ended" from the spool to the operations manager """ # get the corresponding operation operation = Operation.get_by_id(operation_id) # update the spool self.running.remove(operation) if operation.status == 'done': self.done.append(operation) else: self.errors.append(operation) # alert that an operation has finished log("[op-end] %s" % operation) self.parent().emit(SIGNALS['operation_ended'], operation_id) # then alert for this specific operation status = 'done' operation = Operation.get_by_id(operation_id) if operation.status != 'done': status = 'error' self.parent().emit(SIGNALS['%s_%s' % (operation.name, status)], operation_id)
def set_current_item(self, item): """ Display the specified item it the view """ try: self.start_loading() self.current_item = item self.update_title() # mark the item as read if item.unread: self.trigger_read(True) # display content self.current_page_is_content = True self.ui.webView.stop() self.ui.webView.setHtml("") self.ui.webView.setHtml(item.content) self.ui.webView.setZoomFactor(self.current_zoom_factor) self.ui.webView.setFocus(Qt.OtherFocusReason) # toolbars previous = self.controller.get_previous_item() next = self.controller.get_next_item() if previous: self.leftToolbar.set_tooltip(previous.title) self.leftToolbar.enable() else: self.leftToolbar.disable() if next: self.rightToolbar.set_tooltip(next.title) self.rightToolbar.enable() else: self.rightToolbar.disable() self.toolbar_manager.display() # menus self.action_read.setChecked(not item.unread) self.action_read.setDisabled(not item.can_unread) self.action_shared.setChecked(item.shared) self.action_starred.setChecked(item.starred) self.manage_actions() str = "%s - " % item.title statuses = [] if item.unread: statuses.append('unread') else: statuses.append('read') if item.shared: statuses.append('shared') if item.starred: statuses.append('starred') self.display_banner("%s [%s]" % (item.title, ', '.join(statuses))) except Exception, e: log("ERROR WHILE DISPLAYING ITEM : %s" % e) return False
def add_error(self, error): """ Add the error in the errors list and print it on stderr """ self.errors.append(error) log(self.str_error(error))
# -*- coding: utf-8 -*- """ Item content view """ from ..mobile.itemview import ItemViewView as MobileItemViewView from engine import log ZOOMKEYS_ACTIVATED = False try: from utils.zoomkeys import grab as grab_zoom_keys ZOOMKEYS_ACTIVATED = True except Exception, e: log("ZOOMKEYS ERROR : %s" % e) class ItemViewView(MobileItemViewView): def __init__(self, *args, **kwargs): super(ItemViewView, self).__init__(*args, **kwargs) # allow zoomkeys to be used to zoom if ZOOMKEYS_ACTIVATED: try: grab_zoom_keys(self.win.winId(), True) except Exception, e: pass