当前位置: 首页>>代码示例>>Python>>正文


Python page.Page类代码示例

本文整理汇总了Python中page.Page的典型用法代码示例。如果您正苦于以下问题:Python Page类的具体用法?Python Page怎么用?Python Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_init

    def on_init(self):
        Page.on_init(self)
        self.set_background_color(255, 255, 255)
        self.insert_vertical_image("%s-vertical.bmp" % self.info.cd_distro.name)

        # navigation
        self.insert_navigation(_("< Back"), _("Finish"), _("Cancel"), default=2)
        self.navigation.button1.on_click = self.on_back
        self.navigation.button2.on_click = self.on_finish
        self.navigation.button3.on_click = self.on_cancel

        # main container
        self.insert_main()
        self.main.set_background_color(255, 255, 255)
        self.main.title = ui.Label(self.main, 40, 20, self.main.width - 80, 60, _("Reboot required"))
        self.main.title.set_font(size=20, bold=True, family="Arial")
        txt = _(
            "To start the Live CD you need to reboot your machine leaving the CD in the tray. If your machine cannot boot from the CD, the last option should work in most cases."
        )
        self.main.label = ui.Label(self.main, 40, 90, self.main.width - 80, 40, txt)
        self.main.reboot_now = ui.RadioButton(self.main, 60, 150, self.main.width - 100, 20, _("Reboot now"))
        self.main.reboot_later = ui.RadioButton(
            self.main, 60, 180, self.main.width - 100, 20, _("I want to manually reboot Later")
        )
        self.main.cd_boot = ui.RadioButton(self.main, 60, 210, self.main.width - 100, 20, _("Help me to boot from CD"))
        self.main.reboot_later.set_check(True)
开发者ID:hakuna-m,项目名称:wubiuefi,代码行数:26,代码来源:cd_finish_page.py

示例2: Game

class Game():   
    
    def __init__(self, gru_file=None):
        
        self.compiler = Compiler()
        if gru_file:
            self.stream = self.compiler.decompile(gru_file) 
        else:            
            self.stream = self.compiler.compile(None)   
        self.metadata = self.stream.metadata   
        self.flags = Flags(self.stream)
        self.wheel = Wheel(config)
        self.title = Title(config)
        self.inventory = Inventory(self.stream, self.flags, config)
        self.combiner = Combiner(self.stream, self.flags, self.inventory)
        self.page = Page(config, self.flags, self.combiner, self.inventory)
        self.state = State(self.stream, self.flags, self.inventory, self.wheel, self.combiner, self.title, self.page)               
        if self.metadata.has_key("start"):
            start = self.metadata["start"]
            self.state.update(start)
        else:
            self.state.update("start")

    def draw(self, tick):
        self.inventory.draw()
        self.wheel.draw()
        self.title.draw()
        self.page.draw(tick)

    
        
        
        
开发者ID:Teognis,项目名称:GruEngine,代码行数:28,代码来源:game.py

示例3: create

    def create(cls, key, label, user, description=None, locale=None):
        from group import Group
        from membership import Membership
        from page import Page

        instance = Instance(unicode(key).lower(), label, user)
        instance.description = description
        instance.default_group = Group.by_code(Group.INSTANCE_DEFAULT)
        if locale is not None:
            instance.locale = locale
        meta.Session.add(instance)
        supervisor_group = Group.by_code(Group.CODE_SUPERVISOR)
        membership = Membership(user, instance, supervisor_group,
                                approved=True)
        meta.Session.add(membership)
        if config.get_bool('adhocracy.create_initial_instance_page'):
            Page.create(instance, label, u"", user)

        # Autojoin the user in instances
        config_autojoin = config.get('adhocracy.instances.autojoin')
        if (config_autojoin and
                (config_autojoin == 'ALL' or
                 key in (k.strip() for k in config_autojoin.split(',')))):
            users = adhocracy.model.User.all()
            for u in users:
                autojoin_membership = Membership(u, instance,
                                                 instance.default_group)
                meta.Session.add(autojoin_membership)

        meta.Session.flush()
        return instance
开发者ID:rowanthorpe,项目名称:adhocracy,代码行数:31,代码来源:instance.py

示例4: on_init

    def on_init(self):
        Page.on_init(self)
        self.set_background_color(255,255,255)
        self.frontend.set_title(_("%s CD Boot Helper") % self.info.cd_distro.name)
        self.insert_vertical_image("%s-vertical.bmp" % self.info.cd_distro.name)

        #sanity checks
        self.info.distro = self.info.cd_distro
        self.info.target_drive = None
        for drive in [self.info.system_drive] + self.info.drives:
            if drive.free_space_mb > self.info.distro.max_iso_size/1000000:
                self.info.target_drive = drive
                break
        if not self.info.target_drive:
            self.frontend.show_error_message(_("Not enough disk space to proceed"))

        #navigation
        self.insert_navigation(_("Accessibility"), _("Install"), _("Cancel"), default=2)
        self.navigation.button3.on_click = self.on_cancel
        self.navigation.button2.on_click = self.on_install
        self.navigation.button1.on_click = self.on_accessibility

        #main container
        self.insert_main()
        self.main.set_background_color(255,255,255)
        self.main.title = ui.Label(self.main, 40, 20, self.main.width - 80, 60, _("Install CD boot helper"))
        self.main.title.set_font(size=20, bold=True, family="Arial")
        txt = _("If your machine cannot boot off the CD, this program will install a new boot menu entry to help you boot from CD. In most cases this program is not needed, and it is sufficient to reboot with the CD-Rom in the tray.\n\nDo you want to proceed and install the CD booter?")
        self.main.label = ui.Label(self.main, 40, 90, self.main.width - 80, 80, txt)
开发者ID:Karho,项目名称:mint4win,代码行数:29,代码来源:cdboot_page.py

示例5: crawl

    def crawl(self):
        """ The crawling is done in two phases after the URL pops from the queue
        1. Add URL with some info to notes (if source is more than 40k chars incl. html)
        2. Push children URLs to queue if they pass all crawling validations

        """
        link = self.queue.pop(0)
        #for link in nea:
        #one_level
        f = open("crawler.log", "a")
        f.write("+++++++++++" + link)
        # todo implement timeout!!!
        request = urllib2.Request(link)
        opener = urllib2.build_opener()

        # source = urllib.urlopen(link).read()
        parser = Parser()
        source = opener.open(request, timeout=None).read()
        parser.feed(source) # parses all the html source
        parser.close()
        opener.close()
        if source.__len__() > 1000:  # Change page character limit
            f.write(" [" + str(source.__len__()) + "]  * \n")
            self.notes[link]="working"
            webPage = Page(link, source)
            webPage.flash()
            #webPage.flashTkn()
        for url in parser.urls:
            if 'http' not in url:
               url = link + url
            if url not in self.history:
                self.queue.append(url)
                self.history.append(url)
                f.write(url + "\n")
        f.close()
开发者ID:nvasilakis,项目名称:lang-process,代码行数:35,代码来源:crawler.py

示例6: __init__

    def __init__(self):
        self.model = gtk.ListStore(object,str,str,str)
        Page.__init__(self)

        self.cfg = PythmConfig()

        self.btn_connect = ImageButton(gtk.STOCK_CONNECT)
        self.btnbox.add(self.btn_connect)
        self.btn_connect.connect("clicked",self.btn_connect_clicked)

        self.btn_start = ImageButton(gtk.STOCK_EXECUTE)
        self.btnbox.add(self.btn_start)
        self.btn_start.connect("clicked",self.btn_start_clicked)

        self.btn_stop = ImageButton(gtk.STOCK_STOP)
        self.btnbox.add(self.btn_stop)
        self.btn_stop.connect("clicked",self.btn_stop_clicked)

        self.btn_refresh = ImageButton(gtk.STOCK_REFRESH)
        self.btnbox.add(self.btn_refresh)
        self.btn_refresh.connect("clicked",self.btn_refresh_clicked)

        self.mgr = BackendManager()

        if self.cfg.get_backend() != None:
            self.start_backend(self.cfg.get_backend())

        self.refresh()
        self.row_selected(None)
        self.set_sensitive(True)
开发者ID:frownmonkey,项目名称:pythm,代码行数:30,代码来源:pagebackend.py

示例7: Main

class Main(object):
	def __init__(self, delegate, input):
		self.delegate = delegate
		self.input = input
		self.work = []
		self.page = Page()

	def run(self):
		try:
			while not self.input.closed:
				line = self.input.readline()
				if line is None or line.strip() == EOF:
					break
				line = line.strip()
				if line:
					self.process_line(line)
		except KeyboardInterrupt:
			pass
		except StandardError:
			print "UI process input loop received exception:"
			import traceback
			traceback.print_exc()
		finally:
			self.delegate.exit()
	
	def process_line(self, line):
		node = Data.decode(line)
		self.page.process_node(node)
		self.delegate.update(self.page)
开发者ID:rca,项目名称:autonose,代码行数:29,代码来源:main.py

示例8: process_pages

 def process_pages(self):
     skipped = []
     pbar = ProgressBar(widgets=['Processing pages: ', SimpleProgress()], maxval=len(self.urls)).start()
     i = 0
     
     for (num, url) in self.urls:
         pbar.update(int(num))
         if (num and url):
             html = helpers.get_html(num, url)
             if html is not None:
                 self.urls_with_nums[url] = num
                 soup = BeautifulSoup(html.encode('utf-8', 'ignore'), 'lxml')
                 page = Page(title=soup.title.string, num=num, html=soup.prettify(), url=url, text=soup.body.get_text())
                 page.index = i
                 self.indices_with_pages[i] = page
                 if page.ID not in self.pages_with_ids.keys():
                     self.pages_with_ids[page.ID] = page
                 else:
                     raise RuntimeError('COLLISION: %s collides with %s with hash %s.' % (page.num, self.pages_with_ids[page.ID].num, page.ID))
                 for link in soup.find_all('a'):
                     if link.get('href') and 'mailto:' != link.get('href').strip()[0:7]:
                         page.a.append(link)
                 self.pages.append(page)
                 i += 1
             else:
                 skipped.append(num)
         else:
             skipped.append(num)
     pbar.finish()
     print "Skipped page(s) %s because of an error." % (', '.join(skipped))
开发者ID:parkr,项目名称:gargle,代码行数:30,代码来源:brain.py

示例9: create_templates

def create_templates(arg, dirname, names):

    output_dir = dirname.replace(arg["repo_dir"], "")
    e = output_dir.split("/")
    output_dirname = e[-1]

    template_path = os.path.join(
            arg['output_dir'], "templates/") + output_dirname

    # Check if template dir exists, if not create

    if not os.path.exists(template_path):
        os.makedirs(template_path)

    print "Searching For Markdown Templates in %s/" % output_dirname

    files = find_markdown_templates(dirname)

    for f in files:

        file_path = os.path.join(arg["repo_dir"], 'md', output_dirname, f)
        """
        created = time.ctime(os.path.getctime(file_path))
        modified = time.ctime(os.path.getmtime(file_path))
        """
        created = os.path.getctime(file_path)
        modified = os.path.getmtime(file_path)


        page = Page(output_dirname, f, created, modified)
        page.write_html_file(arg["output_dir"], dirname)
        arg["page_list"].append(page)
        print "Generated Page At %s" % page.handler
开发者ID:sirvaliance,项目名称:hoggle,代码行数:33,代码来源:__main__.py

示例10: main

def main():
    """"""
    mainUrl = "http://events.cnbloggercon.org/event/cnbloggercon2007/"
    content = Page(mainUrl).Content
    soup = BeautifulSoup(content)

    links = soup("a")
    peopleList = []
    for item in links:
        href = item["href"]
        if href.lower()[:8] == "/people/":
            peopleList.append("http://events.cnbloggercon.org" + href + "profile/")

    pageLink = []
    for link in peopleList:
        print link
        ct = Page(str(link.encode("utf-8")).lower()).Content
        pos = ct.find("个人网站")
        if pos == -1:
            continue
        ct = ct[pos:]
        so = BeautifulSoup(ct)
        fLink = so("a")[0]["href"]
        pageLink.append(fLink)

    f = file("abcde.txt", "w")
    for i in pageLink:
        f.write(i)
        f.write("\r\n")
开发者ID:Zacchy,项目名称:nickcheng-python,代码行数:29,代码来源:get.py

示例11: get

    def get(self):
        '''
        if form has been entered try the urgent_info form field, if it has been entered, change the value to a string
        if it does not exist, create a different string
         create a concatenated string to pass into a new Form instance print method
         otherwise call the default print method of the Form class for default results
        '''
        if self.request.GET:

            try:
                urgent_updates = self.request.GET["urgent_info"]
                if urgent_updates:
                    urgent_updates = "- You will also receive updates."
            except StandardError:
                urgent_updates = "- You <em>will not</em> receive any updates."

            form_fields = ("<div id='confirm'><p>" +self.request.GET["first_name"] + " " + self.request.GET["last_name"] + "<br>"
                + self.request.GET["address"] + "<br>"
                + self.request.GET["city"] + ", " + self.request.GET["state"] + " " + self.request.GET["zipcode"] + "</p><p>"
                + "<a href='mailto:" + self.request.GET["email"] + "'>" + self.request.GET["email"] + "</a><br>"
                + urgent_updates + "</p></div>")
            page = Page(self)
            self.response.write(page.print_form_results(form_fields))

        else:
            page = Page(self)
            base = page.print_form_results()
            self.response.write(base)
开发者ID:LyteiaHF1,项目名称:DPW,代码行数:28,代码来源:main.py

示例12: __init__

    def __init__(self, testsetup):
        Page.__init__(self, testsetup)

        handles = self.selenium.window_handles
        for i in handles:
            self.selenium.switch_to_window(i)
            if self.selenium.title == "BrowserID": break
开发者ID:gerv,项目名称:FlightDeck-selenium,代码行数:7,代码来源:browser_id.py

示例13: get

 def get(self, url):
     p = Page.all().filter('url =', url).get()
     if p:
         h = Page.all().filter('url =', url).order('-created').fetch(15)
         self.render('history.html', history = h, user=self.user)
     else:
         self.redirect('/_edit'+url) 
开发者ID:kevinhughes27,项目名称:cs253_wiki,代码行数:7,代码来源:main.py

示例14: on_init

    def on_init(self):
        Page.on_init(self)

        #header
        if self.info.distro:
            distro_name = self.info.distro.name
        elif self.info.previous_distro_name:
            distro_name = self.info.previous_distro_name
        self.insert_header(
            _("Installing %(distro)s-%(version)s") % dict(distro=distro_name, version=self.info.version),
            _("Please wait"),
            "%s-header.bmp" % distro_name)

        #navigation
        self.insert_navigation(_("Cancel"))
        self.navigation.button1.on_click = self.on_cancel

        #main container
        self.insert_main()
        self.main.task_label = ui.Label(self.main, 20, 20, self.width - 40, 20)
        self.main.progressbar = ui.ProgressBar(self.main, 20, 50, self.width - 40, 20)
        self.main.subtask_label = ui.Label(self.main, 20, 80, self.width - 40, 20)
        self.main.subprogressbar = ui.ProgressBar(self.main, 20, 110, self.width - 40, 20)
        self.main.localiso_button = ui.Button(self.main, 20, 150, 200, 20, _("Do not download, use a local file"))

        self.main.localiso_button.hide()
        self.main.subtask_label.hide()
        self.main.subprogressbar.hide()
开发者ID:hakuna-m,项目名称:wubiuefi,代码行数:28,代码来源:progress_page.py

示例15: __init__

 def __init__(self, testsetup, lookup):
     Page.__init__(self, testsetup)
     self.lookup = lookup
     if type(lookup) is int:
         self._root_locator = (self._base_locator[0], "%s[%i]" % (self._base_locator[1], lookup))
     elif type(lookup) is unicode:
         self._root_locator = (self._base_locator[0], "%s[h3[normalize-space(text()) = '%s']]" % (self._base_locator[1], lookup))
开发者ID:AlexLakatos,项目名称:FlightDeck-selenium,代码行数:7,代码来源:dashboard_page.py


注:本文中的page.Page类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。