Esempio n. 1
0
def hello():
  title = request.args.get("title", "No Title Was Found")
  body = request.args.get("body", "No Body Was Found")
  presentation = Presentation(title, body)  
  response = send_file(presentation.generate(),
                     attachment_filename=title + ".pptx",
                     as_attachment=False)
  return response
Esempio n. 2
0
 def __init__(self, protocol, args):
     Presentation.__init__(self, protocol, args)
     self._unpackFunc = { \
         self.CONNECTION: self.unpackConnection,
         self.DISCONNECTION: self.unpackDisconnection,
         self.FEATURES: self.unpackFeatures,
         self.CREATE: self.unpackCreateItem,
         self.DESTROY: self.unpackDestroyItem,
         self.EVENT: self.unpackEvent}
Esempio n. 3
0
def main(input_file, output_file):
    """Auditing tool for Nagios"""
    presentation_obj = Presentation(input_file)
    presentation_obj.printAll()
    if output_file != None:
        if presentation_obj.writeToFile(output_file):
            print("File %s saved successfully" % (output_file, ))
        else:
            print("This is some problem in writing to file %s" %
                  (output_file, ))
Esempio n. 4
0
 def handle_previous(self, item, args):
     if self.actual_screen == 0:
         from presentation import Presentation
         presentation = Presentation(self.game, 3)
         self.game.set_stage(presentation)
     else:
         self.show_previous_screen()
Esempio n. 5
0
  def post(self,unused):
    # Get the post parameters and ensure they are valid
    name = self.request.get('name')                                 # Name of presentation
    num_slides = self.request.get('slides')                         # Number of slides

    if (name == '' or not num_slides.isdigit()):                       # If the parameters aren't correct then let them know
      self.error(500)
      self.response.out.write("The post parameters 'name' and 'slides' are required.  'slides' must also be a number\n")
    else:
      p = Presentation(Name=name, NumberSlides=int(num_slides))     # Create a new presentation
      p.put()                                                       # creates a default basic presentation

      token = channel.create_channel(str(p.key().id()));              

      self.response.headers['Content-Type'] = 'application/json'
      self.response.out.write(simplejson.dumps({"id": p.key().id(), "token": token})) # Send out the json id and optional channel token
Esempio n. 6
0
 def handle_level_change(self):
     if self.game.datastore.datamodel.level < 4:
         from presentation import Presentation
         presentation = Presentation(self.game, 3)
         self.game.datastore.changed_data = True
         self.game.set_stage(presentation)
     else:
         self.game.set_stage(Map(self.game))
Esempio n. 7
0
def decompose_pages(pages, infos=None):
    frames = create_frames(pages)

    rawPatchCount, uniquePatchCount = find_identical_rects(frames)

    for frame in frames:
        frame.content()[:] = join_close_rects(frame)
        # content[:] = join_compatible_rects(content)

    extract_patches(frames)

    classify_navigation(frames)

    # could alternatively be done before filtering duplicates, but this is faster:
    result = Presentation(infos)
    result.addFrames(frames)

    monochromePatchCount = sum(bool(patch.flag(Patch.FLAG_MONOCHROME)) for patch in result.patchSet())
    monochromeColorCount = len(
        set(patch.color().rgb() for patch in result.patchSet() if patch.flag(Patch.FLAG_MONOCHROME))
    )

    print "%d slides, %d frames, %d distinct patches (of %d) before merging, %d monochrome (%d colors)" % (
        result.slideCount(),
        result.frameCount(),
        uniquePatchCount,
        rawPatchCount,
        monochromePatchCount,
        monochromeColorCount,
    )
    return result
Esempio n. 8
0
def main():
  """Main function."""
  cliparser = argparse.ArgumentParser(prog=__appname__, description='MaTiSSe.py, Markdown To Impressive Scientific Slides')
  cliparser.add_argument('-v', '--version', action='version', help='Show version', version='%(prog)s ' + __version__)
  cliparser.add_argument('-i', '--input', required=False, action='store', default=None, help='Input file name of markdown source to be parsed')
  cliparser.add_argument('-o', '--output', required=False, action='store', default=None, help='Output directory name containing the presentation files')
  cliparser.add_argument('-t', '--theme', required=False, action='store', default=None, help='Select a builtin theme for initializing a new sample presentation')
  cliparser.add_argument('-hs', '--highlight-style', required=False, action='store', default='github.css', help='Select the highlight.js style (default github.css); select "disable" to disable highligth.js', metavar='STYLE.CSS')
  cliparser.add_argument('-s', '--sample', required=False, action='store', default=None, help='Generate a new sample presentation as skeleton of your one')
  cliparser.add_argument('--toc-at-chap-beginning', required=False, action='store', default=None, help='Insert Table of Contents at each chapter beginning (default no): to activate indicate the TOC depth', metavar='TOC-DEPTH')
  cliparser.add_argument('--toc-at-sec-beginning', required=False, action='store', default=None, help='Insert Table of Contents at each section beginning (default no): to activate indicate the TOC depth', metavar='TOC-DEPTH')
  cliparser.add_argument('--toc-at-subsec-beginning', required=False, action='store', default=None, help='Insert Table of Contents at each subsection beginning (default no): to activate indicate the TOC depth', metavar='TOC-DEPTH')
  cliparser.add_argument('--print-preamble', required=False, action='store_true', default=None, help='Print the preamble data as parsed from source')
  cliparser.add_argument('--print-css', required=False, action='store_true', default=None, help='Print the css as parsed from source (if done)')
  cliparser.add_argument('--print-options', required=False, action='store_true', default=None, help='Print the available options for each presentation element')
  cliparser.add_argument('--print-highlight-styles', required=False, action='store_true', default=None, help='Print the available highlight.js style (default github.css)')
  cliparser.add_argument('--print-themes', required=False, action='store_true', default=None, help='Print the list of the builtin themes')
  cliparser.add_argument('--verbose', required=False, action='store_true', default=False, help='More verbose printing messages (default no)')
  cliparser.add_argument('--online-MathJax', required=False, action='store_true', default=None, help='Use online rendering of LaTeX equations by means of online MathJax service; default use offline, local copy of MathJax engine')
  cliargs = cliparser.parse_args()
  config = MatisseConfig(cliargs=cliargs)
  if cliargs.print_themes:
    print(config.str_themes())
  if cliargs.input:
    if not os.path.exists(cliargs.input):
      sys.stderr.write('Error: input file "' + cliargs.input + '" not found!')
      sys.exit(1)
    else:
      if cliargs.output:
        output = cliargs.output
      else:
        output = os.path.splitext(os.path.basename(cliargs.input))[0]
      output = os.path.normpath(output)
      config.make_output_tree(output=output)
      with open(cliargs.input, 'r') as mdf:
        source = mdf.read()
      presentation = Presentation()
      if config.verbose:
        print('Parsing source ' + cliargs.input)
      if config.theme is not None:
        source = config.put_theme(source=source, output=output)
      presentation.parse(config=config, source=source)
      presentation.save(config=config, output=output)
Esempio n. 9
0
def main():
  """Main function."""
  cliparser = argparse.ArgumentParser(prog=__appname__, description='MaTiSSe.py, Markdown To Impressive Scientific Slides')
  cliparser.add_argument('-v', '--version', action='version', help='Show version', version='%(prog)s ' + __version__)
  cliparser.add_argument('-i', '--input', required=False, action='store', default=None, help='Input file name of markdown source to be parsed')
  cliparser.add_argument('-o', '--output', required=False, action='store', default=None, help='Output directory name containing the presentation files')
  cliparser.add_argument('-t', '--theme', required=False, action='store', default=None, help='Select a builtin theme for initializing a new sample presentation')
  cliparser.add_argument('-hs', '--highlight-style', required=False, action='store', default='github.css', help='Select the highlight.js style (default github.css); select "disable" to disable highligth.js', metavar='STYLE.CSS')
  cliparser.add_argument('-s', '--sample', required=False, action='store', default=None, help='Generate a new sample presentation as skeleton of your one')
  cliparser.add_argument('--toc-at-chap-beginning', required=False, action='store', default=None, help='Insert Table of Contents at each chapter beginning (default no): to activate indicate the TOC depth', metavar='TOC-DEPTH')
  cliparser.add_argument('--toc-at-sec-beginning', required=False, action='store', default=None, help='Insert Table of Contents at each section beginning (default no): to activate indicate the TOC depth', metavar='TOC-DEPTH')
  cliparser.add_argument('--toc-at-subsec-beginning', required=False, action='store', default=None, help='Insert Table of Contents at each subsection beginning (default no): to activate indicate the TOC depth', metavar='TOC-DEPTH')
  cliparser.add_argument('--print-preamble', required=False, action='store_true', default=None, help='Print the preamble data as parsed from source')
  cliparser.add_argument('--print-css', required=False, action='store_true', default=None, help='Print the css as parsed from source (if done)')
  cliparser.add_argument('--print-options', required=False, action='store_true', default=None, help='Print the available options for each presentation element')
  cliparser.add_argument('--print-highlight-styles', required=False, action='store_true', default=None, help='Print the available highlight.js style (default github.css)')
  cliparser.add_argument('--print-themes', required=False, action='store_true', default=None, help='Print the list of the builtin themes')
  cliparser.add_argument('--verbose', required=False, action='store_true', default=False, help='More verbose printing messages (default no)')
  cliparser.add_argument('--online-MathJax', required=False, action='store_true', default=None, help='Use online rendering of LaTeX equations by means of online MathJax service; default use offline, local copy of MathJax engine')
  cliargs = cliparser.parse_args()
  config = MatisseConfig(cliargs=cliargs)
  if cliargs.input:
    if not os.path.exists(cliargs.input):
      sys.stderr.write('Error: input file "' + cliargs.input + '" not found!')
      sys.exit(1)
    else:
      with open(cliargs.input, 'r') as mdf:
        source = mdf.read()
      presentation = Presentation()
      if config.verbose:
        print('Parsing source ' + cliargs.input)
      presentation.parse(config=config, source=source)
      if cliargs.output:
        output = cliargs.output
      else:
        output = os.path.splitext(os.path.basename(cliargs.input))[0]
      output = os.path.normpath(output)
      config.make_output_tree(output=output)
      presentation.save(config=config, output=output)
Esempio n. 10
0
def make_presentation(config, source, output):
  """Make the presentation.

  Parameters
  ----------
  config: MatisseConfig()
  source: str
    source markdown
  output: str
    output path

  Returns
  -------
  source: str
    the parsed source
  """
  config.make_output_tree(output=output)
  if config.theme is not None:
    source = config.put_theme(source=source, output=output)
  presentation = Presentation()
  presentation.parse(config=config, source=source)
  presentation.save(config=config, output=output)
  return source
Esempio n. 11
0
from postprocessing import PostProcessing
from presentation import Presentation
from processing.latex.latex import Latex

if __name__ == "__main__":
    processing = PostProcessing()
    processing.start_processing()

    latex = Latex()
    fig = latex.create_diagram()
    latex.plot_graph(fig)

    presentation = Presentation(processing)
    #presentation.plot()
Esempio n. 12
0
                'SEMLEX_AVG_POLY': res['SEMLEX_POLY_INDEX']
            })
        else:
            res.update({
                'SEMLEX_AVG_MANULEX': res['SEMLEX_MANULEX'] / nb_words,
                'SEMLEX_AVG_POLY': res['SEMLEX_POLY_INDEX'] / nb_words
            })
        # Indices on HTML
        res.update(reperage_images_liens_viki(data=html_brut))
        res.update(reperage_ponctuation(data=html_brut))
    except Exception as e:
        html += '<span style="background-color: red; color: white;">Error while calculating Indices</span>'
        raise e
    # Build Indices output
    html += '<h2 id="ind">Indices</h2><a href="#sum">Back to summary</a><br><br><div style="background-color: #EFEFEF; border: 1px solid grey;">'
    p = Presentation('templates/maquette2.html')
    p.populate(res, name='article')
    html += p.output_html_string(header=False)
    html += '</div>'
    # Build output footer
    html += """</div>
    </body>
    </html>
    """
else:
    html = """<!DOCTYPE html>
    <head>
        <title>Analyse article</title>
    </head>
    <body width="100%">
        <center>
Esempio n. 13
0
 def handle_ok(self, item, args):
     from presentation import Presentation
     presentation = Presentation(self.stage.game, 3)
     self.stage.game.set_stage(presentation)
Esempio n. 14
0
import sys
import random
sys.path.extend(('.', '..'))

from presentation import Presentation, slider, typewriter, springy

def multiline(*args):
    return '\n'.join(args)
_ = multiline
mu = multiline

def subtitle(*args):
    return ''.join((args[0].title(), '\n', '\n', multiline(*args[1:])))
st = subtitle

cols = Presentation.get_term_size()[0]

def slide_it(slide):
    return (slide, slider(cols, 0.25))

def type_it(slide):
    return (slide, typewriter(0.05))

def spring_it(slide):
    return (slide, springy(cols, 2))

def alternator(x):
    trans = (slide_it(x), type_it(x), spring_it(x))
    return random.choice(trans)

slides = map(alternator, [
Esempio n. 15
0
#all_res['ortho-tal'] = indices(title='Ortho corpus',
#                               path='ortho-tal',
#                               url='')

all_res['Maupassant'] = indices(title='Maupassant',
                                path='maupassant12.bin',
                                url='https://github.com/m2litl2019/Projet-conception-Vikidia/blob/master/base/maupassant12.bin')

all_res['Vikibest'] = indices(title='Vikibest',
                              path='vikibest',
                              url='https://github.com/m2litl2019/Projet-conception-Vikidia/tree/master/base/vikibest')

all_res['Vikidia "à simplifier"'] = indices(title='Vikidia "à simplifier"',
                                            path='VikiSimply-tal',
                                            url='https://github.com/m2litl2019/Projet-conception-Vikidia/blob/master/base/VikiSimply-tal')

#all_res['Monde Diplomatique'] = indices(title='Monde Diplomatique',
#                                        path='md_fr.bin',
#                                        url='https://github.com/m2litl2019/Projet-conception-Vikidia/tree/master/base/md_fr.tal')

# Output
#--------

p = Presentation('templates/maquette2.html')
nb = 0
for k, res in all_res.items():
    p.populate(res, nb, name=res['GEN_TITLE'])
    nb += 1
p.ouput_all('results/multitests')
Esempio n. 16
0
from texteval import *
from presentation import Presentation
from reperage_passive import reperage_passive
from reperage_pronoms import reperage_pronoms
from reperage_verbeconj_prorel_sub import reperage_verbeconj_prorel_sub
from reperage_tpsV import reperage_tps
from indices_html import reperage_images_liens_viki, reperage_ponctuation
from reperage_def_con import reperage_connecteurs_flesch, reperage_definition
from lexique import extract_lemmas, compare_Manulex, compute_polysemy_index
import datetime

p = Presentation('templates/maquette2.html')

VIKIBEST = 'vikibest'
#print('== VIKIBEST par articles ==')
#data = load(VIKIBEST,automerge = False)

#for i in range(0,len(data)):
#article = data[i]
#res = {
#'GEN_TITLE' : article.tag[:-4],
#'GEN_URL' : '',
#'GEN_DATE' : str(datetime.datetime.now())}
#print()
#res.update(reperage_passive(VIKIBEST+"/"+article.tag))
#print()
#res.update(reperage_pronoms(VIKIBEST+"/"+article.tag))
#print()
#res.update(reperage_verbeconj_prorel_sub(VIKIBEST+"/"+article.tag))
#print()
#res.update(reperage_tps(VIKIBEST+"/"+article.tag))
Esempio n. 17
0
    def ChangePageName(self, pageid, name):
        self.notebook.SetPageText(pageid + 1, name)

    def OnAbout(self, event):
        d = wx.MessageDialog(
            self,
            "Map editor for Game Ramarana made by group 4\nJaime Cornejo, David Fuentes y Eduardo Paz\n\n\nMáster de Desarrollo de Videojuegos UCM 2006/2007",
            "About Map Editor", wx.OK)  # Create a message dialog box
        d.ShowModal()  # Shows it
        d.Destroy()  # finally destroy it when finished.

    def OnExit(self, event):
        self.Close(True)  # Close the frame.

    def OnPageChanged(self, event):
        if event.GetSelection() == 0:
            self.__statusbar.PushStatusText("")
            self.__levelManagerPage.FillList()


if __name__ == "__main__":
    app = wx.App()
    from presentation import Presentation
    presentation = Presentation(None)
    presentation.ShowModal()
    presentation.Destroy()
    editor = Editor()
    editor.Show()
    app.MainLoop()