コード例 #1
0
ファイル: wgo_contest.py プロジェクト: pquentin/gimp-web
def folio_init(title=""):
  wgo.http_preamble(["Content-Type: text/html"])
  wgo.header("page", title, [{"rel" : "stylesheet", "href" : config.contest_dir + "wgo-contest.css", "type" : "text/css"}])
  return
コード例 #2
0
ファイル: gallery.py プロジェクト: pquentin/gimp-web
def display_slideshow(form):
  names = get_gallery_names()

  if len(names) == 0:
    wgo_contest.folio_init()
    wgo_contest.folio_fini()
    return
  
  name = os.path.basename(form.getvalue("image", names[0]))
  refresh = int(form.getvalue("refresh", "5"))
  fullscreen = form.getvalue("fullscreen", "")
  style = form.getvalue("style", "")
  if refresh < 2:
    refresh = 2

  entry = wgo_contest.gallery_image(name)

  image_file = wgo_contest.gallery_file(entry["name"], ".png")

  next_name = name[0]
  for i in range(0, len(names)):
    if names[i] == name:
      next_name = names[(i + 1) % len(names)]
      break
    pass

  url = "gallery.cgi?display=slideshow&image=%s" % (next_name)
  if (fullscreen == "true"):
    fullscreen_attr = "&fullscreen=true"
    refresh_attr    = "&refresh=%d" % (refresh)
    if style != "":
      style_attr      = "&style=" + style
    else:
      style_attr    = ""
    
    wgo.http_preamble(["Content-Type: text/html", "Refresh: " + str(refresh) + ";url=" + url + refresh_attr + fullscreen_attr + style_attr])

    print xhtml.html.init()
    print xhtml.head()
    print xhtml.body.init({"style" : "background: black; color: white;"})
    if style == "":
      fill_window = xhtml.hyperlink({"style" : "color: gray;", "href" : url + refresh_attr + fullscreen_attr + "&style=width:100%;"}, "[fill window]")
    else:
      fill_window = xhtml.hyperlink({"style" : "color: gray;", "href" : url + refresh_attr + fullscreen_attr}, "[normal size]")
    
    print xhtml.span({"style" : "font-size: small; margin-top: 10ex; margin-bottom: 5ex;"},
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (5)}, "5s") +  " " + 
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (10)}, "10s") + " " +
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (15)}, "15s") + " " +
                     xhtml.hyperlink({"style" : "color: gray;", "href" : url + fullscreen_attr + style_attr + "&refresh=%s" % (20)}, "20s") + " " +
                     fill_window
                     )

    print xhtml.table.init({"style" : "text-align: center; vertical-align: middle; width: 100%;"})
    print xhtml.table.row(
      xhtml.table.cell(xhtml.image({"style" : "%s" % (style), "src" : image_file})) +
      xhtml.table.cell({"style" : "font-size: xx-large; text-align: right; padding-right: 5%;" },
                       "<i>" + entry["title"] + "</i><br />&nbsp;" + entry["author"])
      )
    print xhtml.table.fini()

    print xhtml.body.fini()
    print xhtml.html.fini()
    pass
  else:
    url = "gallery.cgi?display=slideshow&image=%s&refresh=%d" % (next_name, refresh)
    wgo.http_preamble(["Content-Type: text/html", "Refresh: %s;url=%s" % (refresh, url)])
    wgo.header("page", "GIMP Splash Image Slideshow", [{"rel" : "stylesheet", "href" : wgo_contest.config.contest_dir + "wgo-contest.css", "type" : "text/css"}])

    print xhtml.span({"style" : "font-size: small; margin-bottom: 5ex;"},
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 5)}, "[5s]") +  " " + 
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 10)}, "[10s]") + " " +
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 15)}, "[15s]") + " " +
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s" % (next_name, 20)}, "[20s]") + " " +
                     xhtml.hyperlink({"href" : "gallery.cgi?display=slideshow&image=%s&refresh=%s&fullscreen=true" % (next_name, refresh)}, "[full window]")
                     )
    print xhtml.table.init({"class" : "splash-slideshow"})
    print xhtml.table.row(
      xhtml.table.cell(xhtml.image({"src" : image_file})) +
      xhtml.table.cell("<i>" + entry["title"] + "</i><br />&nbsp;" + entry["author"])
      )
    print xhtml.table.fini()

    wgo_contest.folio_fini()
    pass
  return