Ejemplo n.º 1
0
def post(st):
    i = 0
    for n in st['notes']:
        for c in n.cards():
            mw.reviewer.cardQueue.append(c)
            i += 1
    st['browser'].close()
    st['__reset'] = False
    tooltip(_('Immediately reviewing %d cards' % i))
Ejemplo n.º 2
0
def post( st ):
    i = 0
    for n in st['notes']:
        for c in n.cards():
            mw.reviewer.cardQueue.append( c )
            i += 1
    st['browser'].close()
    st['__reset'] = False
    tooltip( _( 'Immediately reviewing %d cards' % i ) )
Ejemplo n.º 3
0
def markFocusSeen( self, n ):
    '''Mark a focusMorph as already seen so future new cards with the same focus
    will be skipped. Also prints number of cards to be skipped if enabled'''
    global seenMorphs
    try:
        if not focus( n ): return
        q = u'%s:%s' % ( focusName( n ), focus( n ) )
    except KeyError: return
    seenMorphs.add( focus(n) )
    numSkipped = len( self.mw.col.findNotes( q ) ) -1
    if numSkipped and cfg1('print number of alternatives skipped'):
        tooltip( _( '%d alternatives will be skipped' % numSkipped ) )
Ejemplo n.º 4
0
def markFocusSeen(self, n):
    '''Mark a focusMorph as already seen so future new cards with the same focus
    will be skipped. Also prints number of cards to be skipped if enabled'''
    global seenMorphs
    try:
        if not focus(n): return
        q = u'%s:%s' % (focusName(n), focus(n))
    except KeyError:
        return
    seenMorphs.add(focus(n))
    numSkipped = len(self.mw.col.findNotes(q)) - 1
    if numSkipped and cfg1('print number of alternatives skipped'):
        tooltip(_('%d alternatives will be skipped' % numSkipped))
Ejemplo n.º 5
0
def add_import(code, class_name, order):
    if class_name=="":
        tooltip("No class found")
    elif "\n" in class_name:
        tooltip("Exception: "+class_name)
    else:
        lines = code.split("\n")
        last_import_idx = 0
        for idx, l in enumerate(lines):
            if "{" in l: break
            if "import" in l: last_import_idx = idx
        doc = "\n".join(lines[:last_import_idx+1] + ["import "+class_name+";"] + lines[last_import_idx+1:])
        return doc
    return code
Ejemplo n.º 6
0
def display_problems(problems):
    cmd = DIALOG + " -l"
    popen = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE, shell=True)
    out, err = popen.communicate()
    if JAVA_BUILD_ERRORS_WINDOW in out:
        windows = out.splitlines()
        for w in windows:
            m1 = re.match(r"(\d*) \((.*)\)", w)
            if m1.group(2) == JAVA_BUILD_ERRORS_WINDOW:
                token = m1.group(1)
        update_error_window(token, problems)
    else:
        show_error_window(problems)


if __name__ == "__main__":
    try:
        if sys.argv[1] == "--update":
            project, file = get_context()
            problems = update_java_src(project, file)
            # tooltip(problems)
            refresh_file(project, file)
            display_problems(problems_to_dict(problems))
    except NotInEclipseProjectException, e:
        # die silently
        print "-1"
    except Exception, e:
        tooltip(str(e))
        print "-1"