Example #1
0
def yhesugusedkaandelopud():
    h.h3('Ühesugused käändelõpud')
    sql = """SELECT COUNT(nr) AS palju, nr,om,os FROM käändsõnad_vro GROUP BY nr,om,os ORDER BY nr,palju DESC ;;"""
    h.tabel_a()
    h.kr("<tr><td>palju</td><td>nr</td><td>om</td><td>os</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['palju'], 'd')
        h.td(r['nr'], 'd')
        h.td(r['om'], 'd')
        h.td(r['os'], 'd')
        h.tr_l()
    h.tabel_l()
Example #2
0
def kaanded():
    h.h3('Käänded')
    sql = """SELECT nr,nim,om,os from käändsõnad_vro ORDER BY nim,om,os;"""
    h.tabel_a()
    h.kr("<tr><td>nr</td><td>nim</td><td>om</td><td>os</td></tr>")
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['nr'], 'd')
        h.td(r['nim'], 'd')
        h.td(r['om'], 'd')
        h.td(r['os'], 'd')
        h.tr_l()
    h.tabel_l()
Example #3
0
def kaandeloppuderuhmad():
    h.h3('Käändelõppude rühmad')
    sql = """with algus as (select count(nr) as mitu, nr as käändk,om as omastav,os as osastav from käändsõnad_vro  group by nr,om,os order by nr,mitu desc) select mitu,käändk,omastav,osastav from algus where mitu > 1 order by omastav,osastav;"""
    h.tabel_a()
    h.kr(
        "<tr><td>sõnadearv</td><td>käändkonna nr</td><td>omastav</td><td>osastav</td></tr>"
    )
    for r in s.sqle(d.n, sql):
        h.tr_a()
        h.td(r['mitu'], 'd')
        h.td(r['käändk'], 'd')
        h.td(r['omastav'], 'd')
        h.td(r['osastav'], 'd')
        h.tr_l()
    h.tabel_l()
Example #4
0
def doit(fileroot='observations'):
    '''
	Do something useful
	'''
    records = per_list.read_ordered_list0(fileroot)

    Dir = './Summary'

    progs = []
    for record in records:
        progs.append(record[2])

    progs = set(progs)
    progs = sorted(progs)

    if os.path.exists(Dir) == False:
        try:
            os.mkdir(Dir)
            permissions.set(Dir)
        except OSError:
            print '!NOK Could not create %s' % (Dir)

    # Create each of the individual html files

    pi = []
    for prog in progs:
        print prog
        sum = subtract_sum.read_sum_file(fileroot, 'All', prog)
        records = per_list.read_ordered_list_progid(fileroot, prog)
        pi.append(records[0][16])

        for one in sum:
            print one
            # subtract_sum.make_html(sum,Dir+'/prog_%s.html'% prog)
            prog_html(sum, records, Dir + '/prog_%s.html' % prog)

    # Now create the master summary file

    page = html.begin('Persistence Summary by Program ID')
    string = '''This page is intended to help those who have IR images evaluate whether they need to be 
	concerned about persistence.  It provides a link to each program with IR images.  Simply follow the
	link to specific infomation about your program'''
    page = page + html.h3(string)
    # Now create a list of lines, we will put in a list

    sum_lines = []
    i = 0
    while i < len(progs):
        prog = progs[i]
        one_pi = pi[i]
        xstring = html.link(prog, 'prog_%s.html' % prog) + '-- %s' % one_pi
        sum_lines.append(xstring)
        i = i + 1

    page = page + html.add_list(sum_lines)

    page = page + html.end()

    g = open(Dir + '/Summary.html', 'w')
    g.write(page)
Example #5
0
def format_post(post):
    id = post["data"]["id"]
    title = post["data"]["title"]
    url = post["data"]["url"]

    def formatted(x):
        name, callback = x
        return "%s: %s" % (name, callback(post))

    items = map(formatted,
                decoders) + [html.a("Permalink", href="/?id=%s" % id)]

    return html.div(html.a(name=id),
                    html.h3(html.a(html.escape(title), href=url)),
                    html.ul(*items),
                    id="post-%s" % id)
Example #6
0
def format_post(post):
	id = post["data"]["id"]
	title = post["data"]["title"]
	url = post["data"]["url"]

	def formatted(x):
		name, callback = x
		return "%s: %s" % (name, callback(post))

	items = map(formatted, decoders) + [
		html.a("Permalink", href="/?id=%s" % id)
	]

	return html.div(html.a(name=id),
	                html.h3(html.a(html.escape(title), href=url)),
	                html.ul(*items),
	                id="post-%s" % id)
Example #7
0
def main_page(state):
    global page

    startPage("Highly Experimental RIF Demonstration Page")	
    page << h.h2("Highly Experimental RIF Demonstration Page")
    page << h.p("This page currently only does translations between RIF XML and RIF PS, but the idea is to have various non-RIF languages supported as well")

    #for k in state.keys():
    #    page << h.p(`k`, '=', `state[k]`)

    form = h.form(method="GET", class_="f")	
    
    form << h.h3("Step 1: Select Input Processor") 
    select_input_processor(form, state)

    form << h.h3("Step 2: Provide Input") 
    select_input(form, state)

    form << h.h3("Step 3: (Optional) Select transform or analysis plugins") 
    select_middle(form, state)
    
    analysis_div = h.div()
    page << analysis_div

    form << h.h3("Step 4: Select Output Processor") 
    select_output_processor(form, state)

    form << h.h3("Step 5: Begin Processing") 

    form << h.br()

    output_div = h.div()
    output_done = run(output_div, state, analysis_div)
    page << form
    page << output_div

    if output_done:
        form <<  h.input(type="submit",  name="action", 
                         value="Update Output Below")
    else:
        form <<  h.input(type="submit",  name="action", 
                         value="Generate Output Below")

    #form <<  h.Raw("&nbsp;")
    #form <<  h.Raw("&nbsp;")
    #form <<  h.Raw("&nbsp;")
    #form <<  h.Raw("&nbsp;")
    #form <<  h.Raw("&nbsp;")
    #form <<  h.input(type="submit",  name="action", value="Generate Output on New Page")



    if 0:
        page << h.h3('Translates to...')

        input = input.replace("\r\n", "\n")
        action=args.getfirst("action") 
        if action:
            (notes, output) = translate(input, action)
        else:
            notes = "select a processing option"
            output = ""

        if notes:
            page << h.h4('Processor Message:')
            page << h.pre(notes, style="padding:0.5em; border: 2px solid red;")


        if output:
            page << h.pre(output, style="padding:0.5em; border: 2px solid black;")
        else:
            page << h.p("-- No Output --")

    page << h.hr()

    page << h.p("This page/software was developed by [email protected].   It's too buggy right now to use.   Please don't even bother to report bugs.")

    print page
    def __init__(self, year=None, month=None, attr=None, indent=None, db_tbl_col=None, db_func=None):
        """
        SUMMARY:
            This class represents a month calendar built with a table Elem.
            The table header is always the day of the week that the body dates
            fall on.

            The first week of each month begins on some weekday. This day is first
            determined with the datetime.now() method. The number of days
            in the month is also variable, ranging from 28 to 31. The end date is
            determined by incrementing a number from 28 until datetime raises a
            ValueError for a date that does not exist. This is done in the
            last_day() method.

            For each key and value in db_tbl_col, where key is table name and value
            is column name, are specified the method checks the db for day_ids
            that match the given dates in the calendar. It then checks if
            any of db_tbl_col's rows contain a matching day_id. If so the column in
            that record is appended to the proper day's div in the table.

        FIELDS:
            The 'attr' and 'indent' args are identical to that of their parent
            class.

            The 'year' and 'month' args specify which month to show. If no year or
            month is passed the current month is shown. Year must be an int,
            however month can be either the name of the month as a string or an
            int representing the number of the month.

            The 'db_tbl' should a dict that matches table names to column names
            in the db that will be loaded into the month. The tables must have
            a day_id column for every element in the db table. If 'db_tbl_col' is
            None nothing is added to each day.

            The 'db_func' passes a function to perform on each 'db_tbl_col' day
            item before adding it to the td of the table Elem. If it is None raw
            text from the table is added to the calendar.
        """
        CalendarTable.__init__(self, year=year, month=month, attr=attr, indent=indent,
                                db_tbl_col=db_tbl_col, db_func=db_func)

        start_day = datetime(self.year, self.month, 1).weekday()
        end_day = self.last_day() + (start_day - 1)

        self.head = [[h3(self.month_str(self.month).title())],
                                   ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
                                    'Friday', 'Saturday', 'Sunday']]
        d = db()
        for week in xrange(0, end_day, 7):
            self.body.append([])
            for day in range(week, week + 7):
                true_day = day - (start_day - 1)  # Day is off by start_day-1
                # --- (First Week) ---
                if day < start_day:
                    self.body[0].append(None)
                elif day < 7:
                    self.body[0].append(self.day_div(true_day))

                # --- (2nd - Last Weeks) ---
                elif day < end_day:
                    self.body[-1].append(self.day_div(true_day))
                else:
                    break