Ejemplo n.º 1
0
 def get(self):
     p = Page()
     p.title = "My page!"
     p.css = "css/style.css"
     p.body = "Miss Piggy likes Kermit De Frog!  "
     #p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 2
0
    def get(self):
        p = Page()
        p.title = "My page"
        p.css = "css/styles.css"
        p.body = "Miss Piggy like Kermit De Frog"

        self.response.write(p.whole_page)
Ejemplo n.º 3
0
    def get(self):
    	p = Page()
    	lib = FavoriteMovies() #instance for the FavoriteMovies
        #movie title  (this is part of our assignment, making it user input)
        #year movie was made(this is part of our assignment)(this is our assignment)
        #director of the film (this is part of our assignment)
        #for this demo we will be hard-coding the above three line values do not normally do this
        #page for class (if/else for 2 different page views for assignment)

        md1 = MovieData()
        md1.title = "The Princess Bride"
        md1.year = 1989  #actually calling a function 
        md1.director = "Rob Reiner"
        
        md2 = MovieData()
        md2.title = "Dune"
        md2.year = 1986  #actually calling a function 
        md2.director = "David Lynch"
        

        md3 = MovieData()
        md3.title = "Star Wars"
        md3.year = 1977  #actually calling a function 
        md3.director = "George Lucas"
        

        #lib.calc_time_span()    #adds this to run but we need to add it to the printing out list below
        p.body = lib.compile_list() + lib.calc_time_span() #adds the compile list to the body tag of the html in the page.py
        self.response.write(p.print_out()) #sends the info out to browser as a big string
Ejemplo n.º 4
0
    def get(self):
        p = Page()
        p.title = "My page!"
        p.css = "css/style.css"
        p.body = "Miss Piggy likes Kermit De Frog!" #modify body element

        self.response.write(p.whole_page)
Ejemplo n.º 5
0
Archivo: main.py Proyecto: dellbby/dpwp
    def get(self):

        #page for class
        p = Page()
        lib = FavoriteMovies()

        #movie title
        #year movie was made
        #director of the film
        md1 = MovieData()
        md1.title = "The Princess Bride"
        md1.year = 1989 #actually calling a function
        md1.director = "Rob Reiner"
        lib.add_movie(md1)

        md2 = MovieData()
        md2.title = "Dune"
        md2.year = 1986 #actually calling a function
        md2.director = "David Lynch"
        lib.add_movie(md2)

        md2 = MovieData()
        md2.title = "Star wars"
        md2.year = 1977 #actually calling a function
        md2.director = "George Lucas"
        lib.add_movie(md2)

        p.body = lib.compile_list() + lib.calc_time_span()
        self.response.write(p.print_out())

        def main(name, GPA):
        print "The GPA for", name,"is",GPA
        return 0
Ejemplo n.º 6
0
    def get(self):

        p = Page()
        lib = FavoriteMovies()

        #USER ENTRY
        #Movie Title
        #Year Made
        #Directory
        md1 = MovieData()
        md1.title = "The Princess Bride"
        md1.director = "Rob Reiner"
        md1.year = 1989
        lib.add_movie(md1)

        md2 = MovieData()
        md2.title = "Dune"
        md2.director = "David Lynch"
        md2.year = 1986
        lib.add_movie(md2)

        md3 = MovieData()
        md3.title = "Star Wars"
        md3.director = "George Lucas"
        md3.year = 1977
        lib.add_movie(md3)

        p.body = lib.compile_list()

        self.response.write(p.print_out(p.body, lib.calc_time_span()))
Ejemplo n.º 7
0
 def get(self):
     p = Page()
     p.title = "My Page"
     p.css = "css/style.css"
     p.body = "this is the body"
     
     self.response.write(p.whole_page)
Ejemplo n.º 8
0
    def get(self):

        # page for class
        p = Page()
        lib = FavoriteMovies()

        #use form to get this info
        #movie title
        #movie year
        #director

        md1 = MovieData()
        md1.title = "Star Wars"
        md1.year = 1989
        md1.director = "George Lucas"
        lib.add_movie(md1)

        md2 = MovieData()
        md2.title = "Forrest Gump"
        md2.year = 1999
        md2.director = "Pedro Lopez"
        lib.add_movie(md2)

        lib.calc_time_span()
        p.body = lib.compile_list() + lib.calc_time_span()
        self.response.write(p.print_out())
Ejemplo n.º 9
0
def new_index_page(page_to_copy, page_num, count, total_posts, posts_per_page, path):
    index_page = Page()
    index_page.copy(page_to_copy)
    index_page.url = '/' + path + '/index-%s' % count
    index_page.template = template.get_template('post.html')

    apply_filter('page-head', index_page)
    apply_filter('page-meta', index_page)
    apply_filter('page-menu', index_page)
    apply_filter('page-foot', index_page)

    total_pages = math.ceil(total_posts / posts_per_page) - 1

    if page_num > 0:
        index_page.template.set_value('prevpage', '<< Newer posts')
        if page_num - 1 == 0:
            index_page.template.set_attribute('prevpage', 'href', 'index.html')
        else:
            index_page.template.set_attribute('prevpage', 'href', 'index-%s.html' % (page_num - 1))

    if page_num < total_pages:
        index_page.template.set_value('nextpage', 'Older posts >>')
        index_page.template.set_attribute('nextpage', 'href', 'index-%s.html' % (page_num + 1))

    if page_num > 0 and page_num < total_pages:
        index_page.template.set_value('pagelinksep', ' | ')

    index_page.template.repeat('posts', min(posts_per_page, total_posts - count))
    return index_page
Ejemplo n.º 10
0
    def get(self):
        p = Page()
        p.title ="My page"
        p.css ="css/styles.css"
        p.body = "Miss Piggy like Kermit De Frog"

        self.response.write(p.whole_page)
Ejemplo n.º 11
0
    def get(self):

        #page for class
        p = Page()
        lib = FavoriteMovies()  #lib object

        #movie title
        #year movie was made
        #director of film
        md1 = MovieData()
        md1.title = "The Princess Bride"
        md1.year = 1989  #calling a function
        md1.director = "Rob Reiner"
        lib.add_movie(md1)

        md2 = MovieData()
        md2.title = "Dune"
        md2.year = 1986  #calling a function
        md2.director = "David Lynch"
        lib.add_movie(md2)

        md2 = MovieData()
        md2.title = "Star Wars"
        md2.year = 1977  #calling a function
        md2.director = "George Lucas"
        lib.add_movie(md2)

        p.body = lib.compile_list() + lib.calc_time_span()
        #lib.movie_list = [md1, md2] = if it was public
        self.response.write(p.print_out())
Ejemplo n.º 12
0
    def get(self):
        # create an instance of the page class - creates a page using this class - it will also call the constructor method
        p = Page()
        p.title = "MyPage!"
        p.body = "Miss piggy loves Kermit da Frog"

        self.response.write(p.whole_page)
Ejemplo n.º 13
0
    def get(self):

        p = Page()# created instance of Page
        do = DataObject() #created instance of Data Object
        d = Data()

        #p.data = d.werewolf.name

        self.response.write(p.print_initial())
Ejemplo n.º 14
0
 def get(self):
     p = Page()
     p.title = "My page!"
     p.css = "css/style.css"
     p.body = "Miss Piggy likes Kermit de Frog" #this will replace the body text below in self.body
     #print p.print_out()#this will print out in the google engine console
     #self.response.write(p.print_out())# this will print out in browser (removed for getter/setter example)
    # p.update() #replacing the above #self.response......
     #let's remove p.update() from here and add to main.py to have it auto update whenever data changes; it won't be p.update it will be self.update over there
     self.response.write(p.whole_page)
Ejemplo n.º 15
0
    def get(self):
        p = Page()   #I want to make an instance of page
        p.li = [['home'],['boy'],['girl'],['nature'],['animals']]
        p.css = "css/styles.css"
        #d = Data()

        #d.home = self.request.GET['home']
        #d.boy = self.request.GET['boy']
        #d.girl = self.request.GET['girl']
        #d.nature = self.request.GET['nature']
        #d.animals = self.request.GET['animals']
        self.response.write(p.print_out())
Ejemplo n.º 16
0
    def get(self):

        if self.request.GET:  # if you can get these items then print this material
            first = self.request.GET['first']  # this is storing form info in a variable and then using that info for printing
            last = self.request.GET['last']   # this is storing form info in a variable and then using that info for printing
            email = self.request.GET['email']   # this is storing form info in a variable and then using that info for printing
            radio = self.request.GET['gender']   # this is storing form info in a variable and then using that info for printing
            check = self.request.GET['experience']   # this is storing form info in a variable and then using that info for printing
            select = self.request.GET['education']   # this is storing form info in a variable and then using that info for printing
            number = self.request.GET['quantity']   # this is storing form info in a variable and then using that info for printing
            self.response.write(first + ' ' + last + ' ' + email + ' ' + radio + ' ' + check + ' ' + select + ' ' + number) # this compiles all of the variable info from the form and prints it to the browser.
        else:
            p = Page()  # this makes an instance of the page class from the pages.py file
            self.response.write(p.print_out())  # this prints it out to the window
Ejemplo n.º 17
0
 def go(self, pagename):
     current = self.get_current()
     if (current != None and
     Page.normalize_name(current) == Page.normalize_name(pagename)):
         return
     if len(self._hst) == 0:
         self._hst.append(pagename)
         self._pos = 0
         return
     self._hst = self._hst[0:self._pos+1]
     if Page.normalize_name(self._hst[-1]) != Page.normalize_name(pagename):
         self._hst.append(pagename)
         if len(self._hst) > self.max_items:
             self._hst = self._hst[-self.max_items:]
         self._pos = len(self._hst) - 1
Ejemplo n.º 18
0
    def get(self):

        p = Page(
        )  #set our Page() class equal to p, this makes it easier to type out

        page_head = p.head  #set the self.head attribute in Page() equal to the variable page_head for later use
        page_form = p.form  #set the self.form attribute in Page() equal to the variable page_form for later use
        page_close = p.close  #set the self.close attribute in Page() equal to the variable page_close for later use
        page_results = p.results  #set the self.results attribute in Page() equal to the variable page_results for later use

        if self.request.GET:  #start the if/else that will determine what to write to the browser depending on user input or lack of input, in this case, when user inputs we:
            username = self.request.GET[
                'su_name']  #set the input value of the form field su_name equal to username
            god = self.request.GET[
                'fav_god']  #set the input value of the form field fav_god equal to username
            role = self.request.GET[
                'role']  #set the input value of the form field role equal to username
            mode = self.request.GET[
                'game_mode']  #set the input value of the form field game_mode equal to username
            self.response.write(page_head + page_results +
                                "<p class='results'>" + username + " | " +
                                god + " | " + role + " | " + mode + "</p>" +
                                page_close)
            #In the above line, we concatenate everything we want the page to write if the user has entered input.
            #We write the page_head html, followed by the page_results html, then we write the entered username/god/role/mode and wrap it in a <p> tag
            #with a class of 'results'. Finally, we add the page_close html, completing the web page.
        else:
            self.response.write(page_head + page_form + page_close)
Ejemplo n.º 19
0
 def get(self):
     # create instance of the view
     p = Page()
     # create instance of the converter class
     u = MetricUnitConverter()
     # create instance of the data library class
     data = DataHolder()
     # if/ else statement to determine which view to throw
     if self.request.GET:
         # form inputs are stores in the data library
         data.name = self.request.GET['name']
         data.feet = self.request.GET['feet']
         data.inches = self.request.GET['inches']
         data.pounds = self.request.GET['weight']
         # calculations are returned to the data library
         data.meters = u.height_converter(data.feet, data.inches)
         data.kilograms = u.weight_converter(data.pounds)
         # english BMI requires height to be in inches only
         data.total_inches = u.inches_only(data.feet, data.inches)
         p.english_bmi = u.english_bmi_calculator(data.pounds, data.total_inches)
         p.metric_bmi = u.metric_bmi_calculator(data.kilograms, data.meters)
         # name is stored in the data library as well
         p.name = data.name
         # Custom message is injected into the h1 tag
         p.message = "Thanks for filling out our form!"
         # generate the results view
         self.response.write(p.write_answer())
     # else statement to hold the form view (1st view)
     else:
         # generate the form view (1st view)
         self.response.write(p.write_form())
Ejemplo n.º 20
0
def create_from_pages(session: orm.session.Session):
    module_pages = Page.get_module_pages(session)
    for module_page in module_pages:
        file_path = 'Module/' + module_page.title + '.lua'
        directory = os.path.dirname(file_path)
        if not os.path.exists(directory):
            os.makedirs(directory)
        with open(file_path, 'w+') as f:
            f.write(module_page.text)
Ejemplo n.º 21
0
    def get(self):
        #create a shortcut to the Page() class
        p = Page()

        #if the GET method is invoked, grab the form values and set them to the proper keys
        if self.request.GET:

            #create a shortcut for self.request
            sr = self.request

            #set the page title.
            p.title = "Eric Rogers | Thank You!"

            #set the Page().name attribute to the input value submitted.
            p.name = sr.GET['name']

            #set the Page().telephone attribute to the input value submitted.
            p.telephone = sr.GET['telephone']

            #set the Page().email attribute to the input value submitted.
            p.email = sr.GET['email']

            #set the Page().interest attribute to the input value submitted.
            p.interest = sr.GET['interest']

            #set the Page().return_customer attribute to reflect the user's choice when checked.
            p.return_customer = 'Yes, please give me a 10% discount.'

            #try to grab the Page().return_customer checkbox value
            try:
                sr.GET['return_customer']

            #if there is no value, the server throws a KeyError meaning the box is not checked.
            except KeyError:

                #set the Page().return_customer attribute to reflect the user's choice when not checked.
                p.return_customer = 'No, I am a new customer.'

            #output Page().view2 to the page.
            self.response.write(p.view2())

        #otherwise, output Page().view1 to the page.
        else:
            self.response.write(p.view1())
Ejemplo n.º 22
0
def categorization():
    category_filename = f'{blog.output_path}/categories'
    category_path = Path(category_filename)
    category_path.mkdir(parents=True, exist_ok=True)
    write_page(f'{category_path}/all.html', Page(template='categories.html',
        topic_list=[c for c in blog.categories]).html)

    for category in blog.categories:
        write_page(f'{category_path}/{category}.html',
                Page(template='blog_list.html',
                    post_list=blog.categories[category], output_path=blog.output_path).html)
    
    tag_path = Path(f'{blog.output_path}/tag')
    tag_path.mkdir(parents=True, exist_ok=True)
    write_page(f'{tag_path}/all.html', Page(template='categories.html',
        topic_list=[t for t in blog.tags]).html)
    for tag in blog.tags:
        write_page(f'{tag_path}/{tag}.html', Page(template='blog_list.html',
            post_list=blog.categories[category], output_path=blog.output_path).html)
Ejemplo n.º 23
0
    def get(self):  #indent here. This function starts everything. below is html5 within the python there is a page head, body and close definied by '''.
        p = Page() #I want to make an instance
        p.format_all()
        if self.request.GET: #has to be in handler
            #stores info we got from the form

            f_name = self.request.GET['f_name']  #needs variables to work
            l_name = self.request.GET['l_name']  #needs variables to work
            address = self.request.GET['address']
            state = self.request.GET['state']
            zip = self.request.GET['zip']
            email = self.request.GET['email']
            p.email = email
            content = self.request.GET['content']
            #terms = self.request.GET['terms']
            #dropdown = self.request.GET['terms']
            self.response.write(p.head + ' ' + p.body + "<div id='wrapper'>"+ "<h3>" "Congratulations on becoming a member of Veronica Vineyards!" + "</h3>" + ' ' + "<div id='name'>" + f_name + ' ' + l_name + "</div>" + "<div id='contact'>" + address + "</div>" + "<div id='state_zip'>" + ' ' + state + ' ' + zip + "</div>" + ' ' + "</br>" + "Look for your email confirmation at:" + ' ' + email + ' ' + "If errors occurred or you would like to update your address please contact us at [email protected]" + "</div>" + p.close)  #this is what I want printed whe returned...I'm not sure how to do the css for this?
        else:
            self.response.write(p.head + p.body + p.close) #prints the information on the page
Ejemplo n.º 24
0
def process_path(path, output_path, pages):
    sorted_posts = sorted(filter_pages(path, pages.values()), key=lambda x: x.url[len(path)+1:len(path)+11], reverse=True)
    total_posts = len(sorted_posts)

    if total_posts == 0:
        return

    posts_per_page = get_posts_per_page(sorted_posts)

    count = 0
    page_num = 0
    index = 0

    if path.startswith('/'):
        path = path[1:]

    index_page = new_index_page(sorted_posts[0], page_num, count, total_posts, posts_per_page, path)

    do_action('post-meta-reset')
    for page in sorted_posts:
        cpage = Page()
        cpage.copy(page)
        cpage.template = index_page.template

        # TODO: this isn't right, need to fix later
        apply_filter('pre-markdown', cpage)

        content = apply_filter('markdown', page.content)

        cpage.template.set_value('content', content, index)
        apply_filter('post-meta', cpage, index)
        index += 1
        count += 1
        if index >= posts_per_page:
            write_index_page(index_page, output_path, path, page_num)
            do_action('post-meta-reset')
            index = 0
            page_num += 1
            index_page = new_index_page(sorted_posts[0], page_num, count, total_posts, posts_per_page, path)

    if index > 0:
        write_index_page(index_page, output_path, path, page_num)
Ejemplo n.º 25
0
 def get(self):
     #self.response.write('Hello world!')
     p = Page()
     p.title = "My Page"
     p.css = "css/style.css"
     p.body = "This is Stacy's Python Example"
     #self.response.write(p.print_out())
     p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 26
0
 def get(self):
    p = Page()
    p.title = 'My Page!'
    p.css = 'css/main.css'
    p.body = "Miss Piggy is aweful!"
    p.update()
    self.response.write(p.whole_page)
Ejemplo n.º 27
0
 def get(self):
     p = Page()
     p.title = "My Page"
     p.css = "/css/style.css"
     p.body = "Changer"
     p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 28
0
Archivo: main.py Proyecto: NenaH77/DPW
 def get(self):
     p = Page()
     p.title = "My page!" #Setter was created so we could change
     p.css = "css/style.css"
     p.body = "Miss Piggy likes Kermit de Frog!"
     p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 29
0
 def get(self):
     p = Page()
     p.title = 'My Page!'
     p.css = 'css/style.css'
     p.body = 'Miss Piggy likes Kermit de Frog'
     p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 30
0
def my_handler(proc, image, closure):
    # print "handler invoked"
    global previous
    # meta={"symbols":[{"location":copy(s.location), "data":copy(s.data)} for s in image.symbols]}
    # if meta['symbols'][0]['data']==previous:
    #     return
    # previous=meta['symbols'][0]['data']
    
    global lastPage

    page=Page()
    lastPage=page
    # print "New page object"
    pilImage=Image.fromstring("RGB",image.size,image.data).convert('L')
    # print "make pilImage"
    page.pilImage=pilImage
    # print "set page.pilImage"
    # page.pilImage.show()
    page.symbols=image.symbols
    # print "page.symbols="

    page.read_grade_marks()
Ejemplo n.º 31
0
    def get(self):
        #Pull in the page class and store it.
        page = Page()

        #If there is a GET request store the variables from GET and write page.
        if self.request.GET:
            #NAME VARIABLES
            fname = self.request.GET['fname']  #First Name
            lname = self.request.GET['lname']  #Last Name
            name = fname + ' ' + lname  #Concat first and last name

            #TITLE VARIABLE
            title = self.request.GET['job_title']  #Title
            #If title is empty insert a page break.
            if title == "":
                title = "<br>"

            #CONTACT VARIABLES
            email = self.request.GET['email']  #Email
            #PHONE NUMBER PARTS
            phone1 = self.request.GET['phone1']  #Phone section 1
            phone2 = self.request.GET['phone2']  #Phone section 2
            phone3 = self.request.GET['phone3']  #Phone section 3
            phone_style = self.request.GET[
                'phone_sep']  #Formatting style for phone number
            #Check for the phone style type and store the results as phone
            if phone_style == "classic":  #Format as classic
                phone = "(" + str(phone1) + ") " + str(phone2) + "-" + str(
                    phone3)
            elif phone_style == "dot":  #Format with dot
                phone = str(phone1) + "." + str(phone2) + "." + str(phone3)
            elif phone_style == "dash":  #Format with dash
                phone = str(phone1) + "-" + str(phone2) + "-" + str(phone3)
            #ADDRESS PARTS
            street = self.request.GET['street']  #Street Address
            city = self.request.GET['city']  #City
            zip_code = self.request.GET['zip_code']  #Zip Code
            #Concat city and zip code.
            city = city + ' ' + zip_code
            #Pull in the card page template from the page class.
            card_page = page.card_page
            #Format the template with the locals provided by GET
            card_page = card_page.format(**locals())
            #Write the card_page variable to the page.
            self.response.write(card_page)
        #If no GET write the form page.
        else:
            #Pull in the form pagefrom the page class.
            form_page = page.form_page
            #Write the form_page variable to the page.
            self.response.write(form_page)
Ejemplo n.º 32
0
 def get(self):
     #self.response.write('Hello world!')
     p = Page()
     p.title = "My Page"
     p.css = "css/style.css"
     p.body = "This is Stacy's Python Example"
     #self.response.write(p.print_out())
     p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 33
0
Archivo: main.py Proyecto: klarski/DPWP
    def get(self):
        p = Page()
        lib = FavoriteMovies()

        md1 = MovieData()
        md1.title = "The Princess Bride"
        md1.year = 1989  # actually calling a function
        md1.director = "Rob Reiner"
        lib.add_movie(md1)

        md2 = MovieData()
        md2.title = "Dune"
        md2.year = 1986
        md2.director = "David Lynch"
        lib.add_movie(md2)

        md3 = MovieData()
        md3.title = "Star Wars"
        md3.year = 1977
        md3.director = "George Lucus"
        lib.add_movie(md3)

        p.body = lib.compile_list() + lib.calc_time_span()
        self.response.write(p.print_out())
Ejemplo n.º 34
0
def index():
    links = (Link(
                name="Productivity In Tech",
                url="https://productivityintech.transistor.fm",
                image="https://s3-us-west-2.amazonaws.com/kjaymiller/images/pit-podcast.png",
                ), 
            Link(
                name=".Net Core Show",
                url="https://dotnetcore.show",
                image="https://dotnetcore.show/content/images/2018/08/jamie-taylor-logo-podcast.svg"
                ),
            Link(
                name="Ask A Brit",
                url="https://askabrit.transistor.fm",
                image="https://kjaymiller.s3-us-west-2.amazonaws.com/images/AskABritv4.png"
                )
                )
    return Page(template='index.html', links=links).html
Ejemplo n.º 35
0
 def set_home_page(self):
     """
     Clean previous pages and create home page and render it to the screen
     :return: None
     """
     self.refresh()
     body = Page(self.main_frame.frame)
     body.add_object(tk.Label,
                     text='HI welcome to Learning Log',
                     font=body.font,
                     width=50)
     body.apply()
     self.main_frame.update(body.name)
Ejemplo n.º 36
0
    def get(self):
        # Establishes variables to allow interaction with designated class.
        a1 = Snake()
        a2 = Bird()
        a3 = Person()
        # Stores all animals defined in object
        self.animals = [a1, a2, a3]
        # Defines p as referring to Page class
        p = Page()
        # Runs the update command on page to concatinate the first pages info
        p.update()

        # Listens for an occurance of animal in the browsers request. Essentially listening for a button click
        if "animal" in self.request.GET:
            # Sets current animals value based on which request was made
            p.current_animal = self.animals[int(self.request.GET["animal"])]
            # Changes the Title of the page to match the selected animal
            p.title = self.animals[int(self.request.GET["animal"])].name
            # plays the sound specific for that animal
            p.loud_noises = self.animals[int(self.request.GET["animal"])].sound
            # Writes contents of whole page to the browser. The update function assembles this
            self.response.write(p.whole_page)
        else:
            self.response.write(p.whole_page)
Ejemplo n.º 37
0
Archivo: main.py Proyecto: msaner/DPW
 def get(self):
     p = Page()
     self.response.write(p.print_out())
Ejemplo n.º 38
0
    def get(self):
        #Adding 4 placehodler products using the Products class and it's add_product method
        p1 = Product()
        p1.add_product("Shells & White Cheddar", "Annie's", 16.17, 4.5, "lb")

        p2 = Product()
        p2.add_product("Three Cheesy Mini-Shell Pasta", "Kraft", 9.73, 3.625,
                       "lb")

        p3 = Product()
        p3.add_product("Organic Shells and Cheese", "Back to Nature", 3.11, 6,
                       "oz")

        p4 = Product()
        p4.add_product("Shells & White Cheddar", "Pasta Roni", 1.00, 6.2, "oz")
        #Using the productData class to hold the products for the main page.
        products = productData()
        products.add_to_array(p1)
        products.add_to_array(p2)
        products.add_to_array(p3)
        products.add_to_array(p4)
        #Using the Page class to setup the beginnings of the HTML page.
        pg = Page()
        #Checking for GET, if GET render the compare products page, otherwise render the main page.
        if self.request.GET:
            #Using the producData class to hold products for the compare page.
            compare_products = productData()
            #Creating a new product with the CompareProduct class using the info from GET and add it to the compare_products instance of the productData class.
            new_product = CompareProduct()
            new_product.add_product(self.request.GET['pName'],
                                    self.request.GET['pBrand'],
                                    self.request.GET['pPrice'],
                                    self.request.GET['pWeight'],
                                    self.request.GET['pUnit'])
            compare_products.add_to_array(new_product)
            #For each product from the main page create a new instance of the CompareProduct class.
            for p in products.items:
                cp = CompareProduct()
                #Populate the cp instance with the information from the original products.
                cp.add_product(p.name, p.brand, p.price, p.weight,
                               p.weight_unit)
                #Add it to the compare_products instance of the productData class.
                compare_products.add_to_array(cp)
            #Using the CompareHTML class create the compare_page instance.
            compare_page = CompareHTML()
            #For each of the compare_products items created a new_column instance of the compareColumn() class.
            for p in compare_products.items:
                new_column = compareColumn()
                #Create the column using the info from the compare_products item and the creat_column method from the compareColumn class.
                new_column.create_column(p)
                #Add it to the array in the compare_page that holds the columns using the add_product_method.
                compare_page.add_product_column(new_column)
            #Create the compare_html from the create_compare method in the compare_page instance of the CompareHTML class with the array of columns from the same instance.
            compare_html = compare_page.create_compare(compare_page)
            #Create the page HTML with the compare_page css and html using the create_page method from the pg instance of the Page() class.
            html = pg.create_page(compare_page.css, compare_html)
        #If no GET create the form page
        else:
            #Create an instance of the FormHTML class named form_page
            form_page = FormHTML()
            #Create the form_html from the creat_form method in the form_page instance of the FormHTML class with the array of columns from the same instance.
            form_html = form_page.create_form(products.items)
            #Create the page HTML with the form_page css and html using the create_page method from teh pg instance of the Page() class.
            html = pg.create_page(form_page.css, form_html)
        #Write the HTML to the page.
        self.response.write(html)
Ejemplo n.º 39
0
 def get(self):
     #self.response.write('Hello world!')
     p = Page()
     p.body = "This is Stacys Python Example"
     self.response.write(p.print_out())
 def __init__(self, parent, controller):
     Page.__init__(self, parent, controller, "Page 3")
Ejemplo n.º 41
0
 def get(self):
     p = Page()
     p.body = "Hello World"
     self.response.write(p.print_out())
Ejemplo n.º 42
0
class Planner:

    driver = webdriver.Chrome()
    loginPage = Page.LoginPage(driver)
    loginPage.navigate()
    loginPage.setLogin('gerardkunze')
    loginPage.setPassword('123456')
    loginPage.submit()

    def wait_homePage(driver):
        wait = WebDriverWait(driver, 10)
        wait.until(
            EC.presence_of_all_elements_located(
                (By.CLASS_NAME, 'employees-item')))

    wait_homePage(driver)

    #case 1: parental leave
    link = driver.find_element_by_xpath("//i[@class='dropdown__caret']")
    link.click()
    link = driver.find_element_by_xpath("//a[contains(text(),'TimeOff')]")
    link.click()
    timeOff = driver.find_element_by_xpath(
        "//a[@class='btn btn-success js-vacation_add']")
    timeOff.click()
    type = driver.find_element_by_xpath(
        "//select[@class='form-control js-type-select']")
    wait = WebDriverWait(driver, 10)
    wait.until(
        EC.element_to_be_clickable(
            (By.XPATH, "//select[@class='form-control js-type-select']")))
    dropdown = Select(type)
    dropdown.select_by_value("500")
    notify = driver.find_element_by_xpath(
        "//input[@placeholder='QALead or DevLead, PM and Department Head']")
    notify.click()
    time.sleep(10)
    notify.send_keys("Abigale Rippin")
    wait = WebDriverWait(driver, 10)
    notifier = driver.find_element_by_xpath(
        "//ul//li[contains(.,'Abigale Rippin')]")
    wait.until(EC.visibility_of(notifier)).click()
    driver.find_element_by_xpath(
        "//form[@id='form']//button[@type='submit']").click()
    time.sleep(3)
    driver.find_element_by_xpath(
        "//div[@id='date-intersection-modal']//button[@type='submit']").click(
        )
    time.sleep(3)

    homePage = Page.HomePage(driver)
    homePage.navigate()
    wait_homePage(driver)

    #case 2: find employee by name
    link = driver.find_element_by_xpath(
        "//a[contains(text(),'Abraham Swift')]")
    link.click()
    link = driver.find_element_by_xpath("//a[@class='navbar-brand']")
    link.click()

    homePage.navigate()
    wait_homePage(driver)

    #case 3: click Working
    filter = driver.find_element_by_xpath("//span[contains(text(),'Working')]")
    filter.click()

    # case 5: click Skill
    filter = driver.find_element_by_xpath(
        "//button[@class='btn btn-default js-toggle-skills']")
    filter.click()
    time.sleep(2)
    skills = driver.find_element_by_xpath(
        "//input[@placeholder='Type to find skill']")
    skills.send_keys("A")
    driver.find_element_by_xpath(
        "//div[@class='autocomplete-suggestions']//div[2]").click()
    driver.find_element_by_xpath(
        "/html[1]/body[1]/div[3]/div[1]/div[1]/div[3]/button[1]").click()

    homePage.navigate()
    wait_homePage(driver)

    #case 4: click Department
    filter = driver.find_element_by_xpath(
        "//button[@class='btn btn-default js-toggle-department']")
    filter.click()
    department = driver.find_element_by_xpath(
        "//div[@class='checkbox-filter__options-list']//div[9]//div[1]//label[1]//i[1]"
    )
    department.click()
    driver.find_element_by_xpath(
        "//button[@class='btn btn-sm btn-primary js-apply']").click()

    homePage.navigate()
    wait_homePage(driver)

    #case 6: delete goal and undo
    link = driver.find_element_by_xpath("//i[@class='dropdown__caret']")
    link.click()
    goalsMenu = driver.find_element_by_xpath("//a[contains(text(),'Goals')]")
    goalsMenu.click()
    try:
        driver.find_element_by_xpath(
            "//div[@class='goals-container js-goals-container js-inprogress-goals-container']//div[1]//div[3]//button[1]"
        ).click()
    except NoSuchElementException:
        print("Goals is empty")
    else:
        delete = driver.find_element_by_xpath(
            "//div[@class='goal-actions open']//li[@title='Delete']//a")
        delete.click()
        time.sleep(2)
        undo = driver.find_element_by_xpath(
            "//button[@class='dscrd-btn btn btn-primary js-goal-undo-delete-goal']"
        )
        undo.click()

    driver.close()
Ejemplo n.º 43
0
Archivo: main.py Proyecto: dellbby/dpwp
 def get(self):
     p = Page() #instance of page
     p.body = "Miss Piggy Likes Kermit De Frog!"
     self.response.write(p.print_out()) #prints out to browser
Ejemplo n.º 44
0
 def get(self):
     p = Page()
     self.response.write(p.print_out())
Ejemplo n.º 45
0
 def get(self):
     p = Page()
     p.title = "My page!"
     p.css = "css/style.css"
     p.body = "Hello World"
     self.response.write(p.whole_page)
Ejemplo n.º 46
0
 def __init__(self, driver, token):
     self.DRIVER = driver
     self.TOKEN = token
     Page.__init__(self, driver)
Ejemplo n.º 47
0
 def set_home_page(self):
     self.main_frame.clean_page()
     body = Page(self.main_frame.frame)
     body.add_object(tk.Label, text='HI welcome to Learning Log', height=20, width=25)
     body.apply()
     self.main_frame.update(body.name)
Ejemplo n.º 48
0
 def get(self):
     p = Page()
     p.body = "Miss Piggy like Kermit De Frog!"
     self.response.write(p.print_out())
Ejemplo n.º 49
0
 def get(self):
     p = Page()
     p.title = "My page!"
     p.css = "css/styles.css"
     p.update()
     self.response.write(p.whole_page)
Ejemplo n.º 50
0
 def get(self):
     p = Page()
     p.body = "Update"
     self.response.write(p.print_out())
Ejemplo n.º 51
0
 def get(self):
     p = Page()
     p.title = "MyPage"
     p.css = "css/styles.css"
     self.response.write(p.whole_page)
Ejemplo n.º 52
0
    def get(self):
        h = hello()
        p = Page()
        p.title = "My New Page"
        p.css = "css/styles.css"
        p.update() #referencing my update class from pages
        h.update_this()

        # I will create an application that calculates the remaining storage for different users

        #now I will hard code the values for each data object



        m = Storage()
        m.pictures = 5
        m.videos = 10
        m.documents = 1
        m.music = 3
        m.apps = 4

        #write the values to the page

        if self.request.GET:
            total = self.request.GET['totalStorage']
            self.response.write(h.user_page_update + "Total storage used is  " + total + " GB <br/> There is  " + str(m.final_storage) + " GB of storage remaining")

        else:
            self.response.write(p.user_page)  #writing the user_page which has has all the html for my application

    #now I am going create the remaining users

        #now I will hard code the values for each data object
        t = Storage()
        t.pictures = 10
        t.videos = 10
        t.documents = 1
        t.music = 20
        t.apps = 7
        #write the values to the page
        # self.response.write(" <br/> Todd has  " + str(t.final_storage) + " GB of storage remaining") #writing the user_page which has has all the html for my application





#now I will hard code the values for each data object
        n = Storage()
        n.pictures = 1
        n.videos = 4
        n.documents = 1
        n.music = 9
        n.apps = 7
        #write the values to the page
        # self.response.write(" <br/> Nancy has  " + str(n.final_storage) + " GB of storage remaining") #writing the user_page which has has all the html for my application


#now I will hard code the values for each data object
        h = Storage()
        h.pictures = 18
        h.videos = 10
        h.documents = 1
        h.music = 6
        h.apps = 7
        #write the values to the page
        # self.response.write(" <br/> Henry has  " + str(h.final_storage) + " GB of storage remaining") #writing the user_page which has has all the html for my application


#now I will hard code the values for each data object
        j = Storage()
        j.pictures = 6
        j.videos = 4
        j.documents = 1
        j.music = 7
        j.apps = 2
Ejemplo n.º 53
0
 def get(self):
     p = Page()
     p.title = "My page!"
     p.css = "css/style.css"
     p.body = "Hello World"
     self.response.write(p.whole_page)
Ejemplo n.º 54
0
 def get(self):
     p = Page()
     p.body = "Miss Piggy like Kermit De Frog"
     self.response.write(p.print_out())