Beispiel #1
0
    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)
Beispiel #2
0
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)

    
        
        
        
Beispiel #3
0
    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
Beispiel #4
0
    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)
Beispiel #5
0
    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()
Beispiel #6
0
    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)
Beispiel #7
0
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)
Beispiel #8
0
 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))
Beispiel #9
0
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
Beispiel #10
0
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")
Beispiel #11
0
    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)
Beispiel #12
0
    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
Beispiel #13
0
 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) 
Beispiel #14
0
    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()
 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))
Beispiel #16
0
    def __init__(self):
        self.duration = 0.0       # Druation of current song.
        self.posBarPressed = False  # Set song position from backend in slider.
        self.posBarDownVal = -1

        Page.__init__(self);
        self.cfg.get_backend().connect(Signals.VOLUME_CHANGED,self.volume_changed)
        self.cfg.get_backend().connect(Signals.RANDOM_CHANGED,self.random_changed)
        self.cfg.get_backend().connect(Signals.REPEAT_CHANGED,self.repeat_changed)
        self.cfg.get_backend().connect(Signals.SONG_CHANGED,self.song_changed)
        self.cfg.get_backend().connect(Signals.POS_CHANGED,self.pos_changed)
        self.cfg.get_backend().connect(Signals.STATE_CHANGED,self.state_changed)

        self.btn_prev = ImageButton(gtk.STOCK_MEDIA_PREVIOUS)
        self.btnbox.add(self.btn_prev)
        self.btn_stop = ImageButton(gtk.STOCK_MEDIA_STOP)
        self.btnbox.add(self.btn_stop)
        self.btn_pause = ImageButton(gtk.STOCK_MEDIA_PAUSE)
        self.btnbox.add(self.btn_pause)
        self.btn_play = ImageButton(gtk.STOCK_MEDIA_PLAY)
        self.btnbox.add(self.btn_play)
        self.btn_next = ImageButton(gtk.STOCK_MEDIA_NEXT)
        self.btnbox.add(self.btn_next)


        self.btn_play.connect("clicked", self.btn_clicked)
        self.btn_stop.connect("clicked", self.btn_clicked)
        self.btn_prev.connect("clicked", self.btn_clicked)
        self.btn_next.connect("clicked", self.btn_clicked)
        self.btn_pause.connect("clicked", self.btn_clicked)

        self.volevent = False
    def on_init(self):
        Page.on_init(self)
        self.frontend.set_title(_("%s Uninstaller") % self.info.previous_distro_name)

        #header
        msg = _("You Sure ?")
        self.insert_header(
            msg,
            "",
            "StartOS-header.bmp")#% self.info.previous_distro_name[0:7])

        #navigation
        self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
        self.navigation.button2.on_click = self.on_cancel
        self.navigation.button1.on_click = self.on_continue

        msg = _("Uninstaller will remove below directroys, if them contain your\
        usefull things ,please click <cancel> and backup them")

        msg = msg + "\r\n\r\n" + self.info.previous_target_dir
        if self.info.pre_install_path and os.path.isdir(self.info.pre_install_path)\
            and self.info.previous_target_dir.lower() != self.info.pre_install_path.lower():
                msg = msg + "\r\n" + self.info.pre_install_path # 这里确定要不要增加X:\startos-loop
        if self.info.pre_install_path2 and os.path.isdir(self.info.pre_install_path2)\
            and self.info.previous_target_dir.lower() != self.info.pre_install_path2.lower():
                msg = msg + "\r\n" + self.info.pre_install_path2 # 这里确定要不要增加X:\startos-livecd
        
        #Main control container
        self.insert_main()
        
        self.uninstall_label = ui.Label(
            self.main,
            40, 40, self.main.width - 80, 80,# x,y, width, height
            "")
        self.uninstall_label.set_text(msg)
Beispiel #18
0
    def on_init(self):
        Page.on_init(self)
        self.frontend.set_title(_("%s Uninstaller") % self.info.previous_distro_name)

        #header
        if self.info.uninstall_before_install:
            msg = _("Uninstallation required")
        else:
            msg = _("You are about to uninstall %s") % self.info.previous_distro_name
        self.insert_header(
            msg,
            "",
            "%s-header.bmp" % self.info.previous_distro_name)

        #navigation
        self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
        self.navigation.button2.on_click = self.on_cancel
        self.navigation.button1.on_click = self.on_uninstall

        #Main control container
        self.insert_main()
        if self.info.uninstall_before_install:
            msg = _("A previous installation was detected, it needs to be uninstalled before continuing")
        else:
            msg = _("Are you sure you want to uninstall?")

        self.uninstall_label = ui.Label(
            self.main,
            40, 40, self.main.width - 80, 30,
            msg)
Beispiel #19
0
    def get(self):


        p = Page()

        bodark = Character()
        bodark.name="Bodark Bjorn"
        bodark.str = 15
        bodark.dex = 7
        bodark.chr = 8
        bodark.int = 3
        bodark.con = 10


        nock = Character()
        nock.name= "Nock Fletching"
        nock.str = 7
        nock.dex = 15
        nock.chr = 12
        nock.int = 6
        nock.con = 3

        magnar = Character()
        magnar.name="Magnar Magnil"
        magnar.str = 16
        magnar.dex = 17
        magnar.chr = 10
        magnar.int = 2
        magnar.con = 8


        lina = Character()
        lina.name= "Lina Medina"
        lina.str = 5
        lina.dex = 5
        lina.chr = 3
        lina.int = 15
        lina.con = 15

        players = {
            "bodark":bodark,
            "nock":nock,
            "magnar":magnar,
            "lina":lina
        }

        p.character = players["bodark"]
        render =  p.print_info()

        if self.request.GET:
            if self.request.GET.has_key('char'):

                character = self.request.GET['char']

                if players.has_key(character):
                    p.character= players[character]
                    render = p.print_info()

        self.response.write(render)
Beispiel #20
0
	def __init__(self, path):
		Page.__init__(self)

		module,name=path.rsplit('.', 1)

		app=__import__(module, fromlist=[ name ])

		self.app=getattr(app, name)()
 def googleSearch(self, term, numPages = 1):
     term = self.convertToUrlReady(term, 'google')
     links = []
     for start in range(0,numPages):
         url = "http://www.google.com/search?q=" + term +"&start=" + str(start*10)
         page = Page(url)
         links.append(page.gSoupToLinks())
     return links
 def amazonSearch(self, term, numPages = 1):
     term = self.convertToUrlReady(term, 'amazon')
     links = []
     for start in range(0, numPages):
         url = 'http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=' + term +'&page=' + str(start) + '&rh=i%3Aaps%2Ck%3A' + term
         page = Page(url, domain='amazon')
         links.append(page.aSoupToLinks())
     return links
Beispiel #23
0
 def __init__(self):
     Page.__init__(self)
     self._current_line = 0
     self._tail = False
     self._content = ""
     with open("/tmp/clazy.json", 'r') as f:
         self._parse_lines(f.read())
         f.close()
Beispiel #24
0
 def __init__(self):
     Page.__init__(self)
     self._current_line = 0
     self._code = [
         "NumberWrapper* wrap3 = nullptr;",
         "",
         "//Check if the URI is complete or short",
         "const bool hasAtSign = uri.hasHostname();",
         "",
         "// Append the account hostname, this should always reach the same destination",
         "// as long as the server implementation isn't buggy.",
         "const auto extendedUri = (hasAtSign || !account) ? uri : URI(QStringLiteral(\"%[email protected]%2\")",
         "    .arg(uri)",
         "    .arg(account->hostname()));",
         "",
         "//Try to see if there is a better candidate with a suffix (LAN only)",
         "if ( !hasAtSign && account ) {",
         "",
         "    // Attempt an early candidate using the extended URI. The later",
         "    // `confirmedCandidate2` will attempt a similar, but less likely case.",
         "    if ((wrap2 = d_ptr->m_hDirectory.value(extendedUri))) {",
         "        if (auto cm = d_ptr->fillDetails(wrap2, extendedUri, account, contact, type))",
         "        return cm;",
         "    }",
         "}",
         "",
         "//Check",
         "ContactMethod* confirmedCandidate = d_ptr->fillDetails(wrap,uri,account,contact,type);",
         "",
         "//URIs can be represented in multiple way, check if a more verbose version",
         "//already exist",
         "ContactMethod* confirmedCandidate2 = nullptr;",
         "",
         "//Try to use a ContactMethod with a contact when possible, work only after the",
         "//contact are loaded",
         "if (confirmedCandidate && confirmedCandidate->contact())",
         "    confirmedCandidate2 = d_ptr->fillDetails(wrap2,uri,account,contact,type);",
         "",
         "ContactMethod* confirmedCandidate3 = nullptr;",
         "",
         "//Else, try to see if the hostname correspond to the account and flush it",
         "//This have to be done after the parent if as the above give \"better\"",
         "//results. It cannot be merged with wrap2 as this check only work if the",
         "//candidate has an account.",
         "if (hasAtSign && account && uri.hostname() == account->hostname()) {",
         "    if ((wrap3 = d_ptr->m_hDirectory.value(uri.userinfo()))) {",
         "        foreach(ContactMethod* number, wrap3->numbers) {",
         "        if (number->account() == account) {",
         "            if (contact && ((!number->contact()) || (contact->uid() == number->contact()->uid())))",
         "                number->setPerson(contact); //TODO Check all cases from fillDetails()",
         "            //TODO add alternate URI",
         "            confirmedCandidate3 = number;",
         "            break;",
         "        }",
         "        }",
         "    }",
         "}",
     ]
Beispiel #25
0
    def on_init(self):
        Page.on_init(self)

        if self.info.needfix != 0:
            wintitle = _("%s Uninstaller/Fixer") % self.info.previous_distro_name
            if self.info.uninstall_before_install:
                msg = _("Uninstallation/fixed required")
            else:
                msg = _("You are about to uninstall/Fix %s") % self.info.previous_distro_name
        else:
            wintitle = _("%s Uninstaller") % self.info.previous_distro_name
        #header
            if self.info.uninstall_before_install:
                 msg = _("Uninstallation required")
            else:
                 msg = _("You are about to uninstall %s") % self.info.previous_distro_name

        self.frontend.set_title(wintitle)
        self.insert_header(
            msg,
            "",
            "StartOS-header.bmp")#% self.info.previous_distro_name[0:7])
            
        #navigation
        if self.info.needfix != 0:# and self.info.registry:
            self.insert_navigation(_("Fix"), _("Uninstall"), _("Cancel"), default=3)
            self.navigation.button3.on_click = self.on_cancel
            self.navigation.button2.on_click = self.on_uninstall
            self.navigation.button1.on_click = self.run_fixboot
        else:
            self.insert_navigation(_("Uninstall"), _("Cancel"), default=2)
            self.navigation.button2.on_click = self.on_cancel
            self.navigation.button1.on_click = self.on_uninstall
        
        #Main control container
        self.insert_main()
        if self.info.uninstall_before_install:
            if self.info.inst == "uninstall.exe":
                msg = _("Do you want to uninstall %s?") % self.info.previous_distro_name
            else:
                msg = _("A previous installation was detected, it needs to be uninstalled before continuing")
        else:
            msg = _("Are you sure you want to uninstall?")

        FIXLABEL_HEIGHT = 60
        self.uninstall_label = ui.Label(
            self.main,
            40, 40, self.main.width - 80, 30 + FIXLABEL_HEIGHT,# x,y, width, height
            "")
        if self.info.needfix:
            msg = msg + _("\r\n\r\nNote: Installer found that your previous installation was broken, but the loop device is still exists, and advises you to <fix> first !")
        self.uninstall_label.set_text(msg)

        self.backup_iso = ui.CheckButton(
            self.main, 80, 70, self.main.width - 120, 12,
            _("Backup the downloaded files (ISO)"))
        self.backup_iso.set_check(False)
        self.backup_iso.hide()
Beispiel #26
0
	def run_job(self):
		self.status = {}
		self.status["scope"] = "running crawl job"
		if self.query is None:
			self.status["msg"] = "Unable to start crawl: no query has been set."
			self.status["code"] = 600.1
			self.status["status"] = False
			return False 
		else:
			query = Query(self.query)
			
		seeds = self.collect_sources()
		if self.db.sources.count() == 0:
			self.status["msg"] = "Unable to start crawl: no seeds have been set."
			self.status["code"] = 600.1
			self.status["status"] = False
			return False
		else:
			self.send_seeds_to_queue()
		
		start = datetime.now()
		if self.db.queue.count == 0:
			self.status["msg"] = "Error while sending urls into queue: queue is empty"
			self.status["code"] = 600.1
			self.status["status"] = False
			return False
			
		else:
			self.status["msg"] = "running crawl on %i sources with query '%s'" %(len(self.db.sources.distinct("url")), self.query)
				
			while self.db.queue.count > 0:	
				for url in self.db.queue.distinct("url"):
					if url != "":
						page = Page(url)
						if page.check() and page.request() and page.control():
							article = page.extract("article")
							if article.status is True:
								if article.is_relevant(query):			
									self.db.results.insert(article.repr())
									if article.outlinks is not None and len(article.outlinks) > 0:
										self.db.queue.insert(article.outlinks)
							else:	
								self.db.logs.insert(article.logs)
						else:
							self.db.logs.insert(page.status)	
					self.db.queue.remove({"url": url})
					
					if self.db.queue.count() == 0:		
						break
				if self.db.queue.count() == 0:		
						break
			end = datetime.now()
			elapsed = end - start
			delta = end-start

			self.status["msg"] = "%s. Crawl done sucessfully in %s s" %(self.status["msg"],str(elapsed))
			self.status["status"] = True
			return True
Beispiel #27
0
    def get(self):
		page = Page()

		# redPanda class that gets all the attributes from the AbstractAnimals class
		red_panda = Sound()
		red_panda.name = "Red Panda"
		red_panda.phylum = "Chordata"
		red_panda.cclass = "Mammalia"
		red_panda.order = "Carnivora"
		red_panda.family = "Ailuridae"
		red_panda.genus = "Ailurus"
		red_panda.url = "http://animaldiversity.ummz.umich.edu/collections/contributors/Kjeldsen_Per/Red_Panda7208/large.jpg"
		red_panda.alifespan = "The maximum lifespan of the red panda is 14 years, but the average is eight to ten."
		red_panda.habitat = "Red pandas live in temperate climates in deciduous and coniferous forests. There is usually an understory of bamboo and hollow trees. The average temperature is 10 to 25 degrees Celsius, and the average annual rainfall is 350 centimeters."
		red_panda.geolocation = "Red pandas are found throughout the Himalayan mountains between 2,200 and 4,800 meters in elevation in northern Burma, Nepal, Sikkim region of India, and the districts of western Sichuan and Yunnan in China. Their geographic range is bounded in the north by the Namlung Valley in the Mugo District and the Lake Rara region of northern Nepal, in the south by the Liakiang Range of western Yunnan, and the northern and eastern boundary is the upper Min Valley of western Sichuan."
		red_panda.sound = "Wieuw Wieuw"
		red_panda.update()

		# great_auk class that gets all the attributes from the AbstractAnimals class
		great_auk = Sound();
		great_auk.name = "Great Auk"
		great_auk.phylum = "Chordata"
		great_auk.cclass = "Aves"
		great_auk.order = "Charadriiformes"
		great_auk.family = "Alcidae"
		great_auk.genus = "Pinguinus"
		great_auk.url = "http://animaldiversity.ummz.umich.edu/collections/contributors/grzimek_birds/Alcidae/pinguinus_impennis/medium.jpg"
		great_auk.alifespan = "As in other large seabirds, annual survival is thought to have been relatively high. Estimated lifespan was from 20 to 25 years."
		great_auk.habitat = "In recorded history, great auks were found breeding only on isolated, rocky islands in the North Atlantic. They foraged in the open ocean when not breeding."
		great_auk.geolocation = "The last great auk was seen in 1852 off the Newfoundland Banks. They were extinct in the western Atlantic before 1800 and persisted a bit longer in some parts of the eastern Atlantic and off the coast of Iceland. They lived and bred on scattered, offshore islands in the northern Atlantic in recorded history, although it is possible they once occurred on continental coastlines but were extirpated from those areas earlier. They were found from Canada, Greenland, and Iceland to the British Isles and Scandinavia. Colonies in the western Atlantic may have been less numerous than in the eastern Atlantic. Archeological records indicate they once occurred as far south as southern Spain and New England in the United States, Pleistocene records indicate great auks occurred as far south as Italy and other parts of the Mediterranean. Great auks became extinct before any natural history studies were conducted, so little is known about their lives except for a few studies of lone, captive birds and the casual records of mariners."
		great_auk.sound = "Wrah Wrah"
		great_auk.update()

		# Leopard Cat class that gets all the attributes from the AbstractAnimals class
		leopard_cat = Sound()
		leopard_cat.name = "Leopard Cat"
		leopard_cat.phylum = "Chordata"
		leopard_cat.cclass = "Mammalia"
		leopard_cat.order = "Carnivora"
		leopard_cat.family = "Felidae"
		leopard_cat.genus = "Prionailurus"
		leopard_cat.url = "http://animaldiversity.ummz.umich.edu/collections/contributors/tanya_dewey/leopardcat/large.jpg"
		leopard_cat.alifespan = "In the wild, leopard cats have an average lifespan of about 4 years, and have been known to live up to 20 years in captivity. The lifespan of captive individuals varies greatly as individuals may die from the stress of transport. When leopard cats are released into non-native environments by breeders, they usually die not long after."
		leopard_cat.habitat = "Prionailurus bengalensis is found in tropical and temperate forests, coniferous forests, shrub land habitat, and grasslands. Its distribution is limited to areas with less than 10 cm of snow annually, and it is not found in steppe or arid climates. Prionailurus bengalensis has a fairly diverse diet and is able to find food in most habitats. It seems relatively impervious to human disturbance as populations in secondary growth and disturbed areas are stable and it is often found near agricultural fields and rural settlements. Prionailurus bengalensis is an exceptional swimmer, possibly explaining its distribution on islands, and is intolerant of temperatures above 35 C, possibly explaining its absence from central India. It is capable of living at higher elevations (i.e., 3000 m) with minimal snow fall."
		leopard_cat.geolocation = "Prionailurus bengalensis is one of the most widespread carnivore species in Asia, and can be found throughout most of southern Asia. Prionailurus bengalensis occupies eastern Afghanistan and northern Pakistan, northern and coastal India, Myanmar, Laos, Thailand, Indonesia, Malaysia, Vietnam, Taiwan, Sumatra, Java, Bali, Borneo, Nepal, Korea, Cambodia, parts of the Philippines, and Eastern China. Prionailurus bengalensis has been divided into a number of subspecies over its range that differ in coloration, pelage, body length, and reproductive cycles."	
		leopard_cat.sound = "Whish Whish"
		leopard_cat	.update()

		#Array with all the animals in it
		animals = [red_panda,great_auk,leopard_cat]

		self.response.write(page.head())
		self.response.write(page.nav())
		if self.request.GET:
			indexAnimal = int(self.request.GET['animal']) #Grabs the index number out of the URL on the top of the browser
			self.response.write(page.content(animals[indexAnimal])) #fills the templating in with the index number 
		 #Buttons on the page
		self.response.write(page.foot()) # Footer of the page. Currently blank		
Beispiel #28
0
    def get(self):
        #import page
        page = Page()

        #airJordan Shoe Instance

        airj = Shoe()
        airj.name = 'Air Jordans'
        airj.price = 180 #$
        airj.limit = 2 #pairs
        airj.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        #nikeFoampositePro Shoe Instance

        nfp = Shoe()
        nfp.name = 'Nike Foamposite Pro'
        nfp.price = 220 #$
        nfp.limit = 1 #pairs
        nfp.img = "http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        #nikeFoampositeOne Shoe Instance

        nfo = Shoe()
        nfo.name = 'Nike Foamposite One'
        nfo.price = 220 #$
        nfo.limit = 1 #pairs
        nfo.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        #lebron Shoe Instance

        leb = Shoe()
        leb.name = 'LeBrons'
        leb.price = 200 #$
        leb.limit = 1 #pairs
        leb.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"


        #kobe Shoe Instance

        kobe = Shoe()
        kobe.name = 'Kobes'
        kobe.price = 120 #$
        kobe.limit = 4 #pairs
        kobe.img ="http://upload.wikimedia.org/wikipedia/en/3/37/Jumpman_logo.svg"

        shoes = [
            airj,nfp,nfo,leb,kobe
        ]

        #HTML
        self.response.write(page.header())
        self.response.write(page.form())
        if self.request.GET:
            heat = (int(self.request.GET['heat']))-1
            print heat
            self.response.write(self.html(shoes[heat]))
        self.response.write(page.footer())
Beispiel #29
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.altom_logo = Element(self.driver, (By.XPATH, ".//*[@id='site-title']/a/img"))
     self.sidebar = Element(self.driver, (By.CLASS_NAME, "sidebar"))
     self.main_content = Element(self.driver, (By.ID, "mainContent"))
     self.main_menu = Element(self.driver, (By.ID, "mainMenu"))
     self.video = Element(self.driver, (By.ID, "presentation"))
     self.phone_number = Element(self.driver, (By.CLASS_NAME, "mainPhone"))
     self.blocks = Element(self.driver, (By.CLASS_NAME, "blocks"))
 def update(self):
     logging.info("Checking sources for updates")
     for id, values in PageImporter.pages.iteritems():
         logging.info("Checking page: " + id + " (" + values['country'] + ")")
         page = Page(id, values['country'], values['url'])
         if page.import_tables() == 0:
             logging.info(id + " not modified")
         else:
             logging.info("Finished importing page: " + id + " (" + values['country'] + ")")