Ejemplo n.º 1
0
class Contact(HtmlPage):

    def __init__(self):
        HtmlPage.__init__(self, 'Pics Page')
        self.style_sheets.append('css/vpics.css')
        #self.style_sheets.append('css/contact.css')
        self.javascript_src.append('js.googleanalytics')

        # navigation
        self.nav = Nav()
        self.style_sheets.append(self.nav.style_sheets())

    def getHtmlContent(self):
        return \
            self.header() +\
            self.navAndDisplayArea()
                       
    def navAndDisplayArea(self):
        table = HtmlTable()
        table.addRow([self.nav.nav(name='Contact Info'),
                      self.displayArea()])
        table.setRowVAlign(1,'top')
        return center(table.getTable())

    def header(self):
        text = 'David Link'
        return div(h2(text), id='header')

    def displayArea(self):
        return div(text(), id='displayArea')
Ejemplo n.º 2
0
	def __init__(self):
		"""
			load libraries
		"""
		from build.bundle import Bundle
		from nav import Nav
		
		self.bundle = Bundle()
		self.nav = Nav()
Ejemplo n.º 3
0
 def configure_side_bar(self):
     self.configurations.append(Nav(frame=self, controller=config1.Config1(self.joystick)))
     self.configurations.append(Nav(frame=self, controller=config2.Config2(self.joystick)))
     self.configurations.append(Nav(frame=self, controller=config3.Config3(self.joystick)))
     self.configurations.append(Nav(frame=self, controller=config4.Config4(self.joystick)))
     for c in range(4):
         self.configurations[c].config(text=self.configurations[c].controller.name, borderwidth=3, relief="raised")
         self.configurations[c].grid(row=c, column=0, stick=N+W+E+S)
         self.configurations[c].bind("<Button-1>", lambda e, i=c: self.set_config(i))
     self.configurations[self.selected].config(bg="blue", relief="sunken")
Ejemplo n.º 4
0
 def goto_fleetcomp_presets(self):
     """Method to navigate to the fleet preset recall submenu of the fleet
     composition menu.
     """
     Nav.goto(self.regions, 'fleetcomp')
     self.regions['upper'].wait('shiplist_button.png', 10)
     Util.wait_and_click_and_wait(
         self.regions['lower_left'],
         Pattern('fleetswitch_submenu.png').exact(),
         self.regions['lower_left'],
         Pattern('fleetswitch_submenu_active.png').exact())
Ejemplo n.º 5
0
    def __init__(self):
        HtmlPage.__init__(self, 'Pics Page')
        self.style_sheets.append('css/vpics.css')
        #self.style_sheets.append('css/contact.css')
        self.javascript_src.append('js.googleanalytics')

        # navigation
        self.nav = Nav()
        self.style_sheets.append(self.nav.style_sheets())
Ejemplo n.º 6
0
    def __init__(self):
        HtmlPage.__init__(self, 'Pics Page')
        self.style_sheets.append('css/vpics.css')
        self.style_sheets.append('css/collection.css')
        self.javascript_src.append('js/googleanalytics.js')

        # navigation
        self.nav = Nav()
        self.style_sheets.append(self.nav.style_sheets())

        self.env = Env()
        self.pages = Pages()
        self.page = None
Ejemplo n.º 7
0
Archivo: oneup.py Proyecto: dlink/vpics
    def __init__(self):
        HtmlPage.__init__(self, 'Oneup')
        self.style_sheets.append('css/vpics.css')
        self.style_sheets.append('css/oneup.css')
        self.javascript_src.append('js/googleanalytics.js')

        # nav
        self.nav = Nav()
        self.style_sheets.append(self.nav.style_sheets())

        self.env = Env()
        self.pages = Pages()
        self.pics = Pics()
        self.pic = None
Ejemplo n.º 8
0
class Project:
	"""
		Build a project
		Make files::
			
			index.html
			assets/template.html
			assets/js/core.min.js
			assets/timestamps.json
	"""	
	def __init__(self):
		"""
			load libraries
		"""
		from build.bundle import Bundle
		from nav import Nav
		
		self.bundle = Bundle()
		self.nav = Nav()

	def boot(self):
		"""
			returns bootstrap js
		"""
		import json

		corejs = open('lib/js/core.min.js', 'r')
		v = int(self.vc.repo.get_value('last_version_number') or 0) + 1
		
		boot = ('window._version_number="%s"' % str(v)) + \
			'\n' + corejs.read()

		corejs.close()
		
		return boot

	def render_templates(self):
		"""
			Generate static files from templates
		"""

		# render templates
		import os
		from jinja2 import Environment, FileSystemLoader
		from build.markdown2_extn import Markdown2Extension

		env = Environment(loader=FileSystemLoader('templates'), extensions=[Markdown2Extension])

		# dynamic boot info
		env.globals['boot'] = self.boot()
		env.globals['nav'] = self.nav.html()
		page_info = self.nav.page_info()
		
		for wt in os.walk('templates'):
			for fname in wt[2]:
				if fname.split('.')[-1]=='html' and not fname.startswith('template'):
					fpath = os.path.relpath(os.path.join(wt[0], fname), 'templates')
					temp = env.get_template(fpath)
					
					env.globals.update(self.nav.page_info_template)
					env.globals.update(page_info.get(fpath, {}))
					
					# out file in parent folder of template
					f = open(fpath, 'w')
					f.write(temp.render())
					f.close()
					print "Rendered %s | %.2fkb" % (fpath, os.path.getsize(fpath) / 1024.0)
				

	def build(self):
		"""
			Build all js files, index.html and template.html
		"""
		from build.version import VersionControl
		
		self.vc = VersionControl()
		self.vc.add_all()
		
		# index, template if framework is dirty
		if self.vc.repo.uncommitted():
			self.bundle.bundle(self.vc)
			self.render_templates()

			# again add all bundles
			self.vc.add_all()
			self.vc.repo.commit()
		
		self.vc.close()
Ejemplo n.º 9
0
 def goto_fleetcomp(self):
     """Method to navigate to the fleet composition menu.
     """
     Nav.goto(self.regions, 'fleetcomp')
     self.module_regions['panels'][0].wait('shiplist_button.png', 2)
     self.current_shiplist_page = 1
Ejemplo n.º 10
0
import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
import dash_core_components as dcc

colors = {'background': '#111111', 'text': '#FF603F', 'footer': '#B8B8B8'}

from navbar import Navbar
navbar = Navbar()

from nav import Nav
nav = Nav()

user_app = dbc.Card([
    dbc.CardHeader(html.H2("Hate Speech Automatic Detector"),
                   style={
                       'textAlign': 'center',
                       'color': colors['text'],
                       'margin-top': "10px",
                       'margin-down': "15px"
                   }),
    dbc.CardBody([
        html.
        P('''Hate speech is any form of expression through which speakers intend to vilify, humiliate, or incite hatred against a group or a class of persons
            on the basis of race, religion, skin color sexual identity, gender identity, ethnicity, disability, or national origin.
            '''),
        html.
        P('''This application will allow you to check whether a certain type of text in English can be considered as hate speech, as an offensive language or neither.'''
          ),
        dbc.Input(id='input_text',
                  className="mb-3",
Ejemplo n.º 11
0
from nav import Nav

AI = Nav()
#print(AI.location)
#AI.markWall(3)
#AI.markVisited((4,4))
x = AI.calculate()
'''
 0,0 --> 1,0
UP
1. blackout() --> void
2. Undo action
3. calculate() --> will give you a list of commands
4. proceed

when you call black out
1. wall off dest., mark as visited
2. Revert back to previous position (0,0)
2. calculate(): calculate how to go to next closest unvisited square
3. Return a set of commands

'''
Ejemplo n.º 12
0
 def goto_repair(self):
     """Method to navigate to the repair menu.
     """
     Nav.goto(self.regions, 'repair')
Ejemplo n.º 13
0
Archivo: oneup.py Proyecto: dlink/vpics
class Oneup(HtmlPage):

    def __init__(self):
        HtmlPage.__init__(self, 'Oneup')
        self.style_sheets.append('css/vpics.css')
        self.style_sheets.append('css/oneup.css')
        self.javascript_src.append('js/googleanalytics.js')

        # nav
        self.nav = Nav()
        self.style_sheets.append(self.nav.style_sheets())

        self.env = Env()
        self.pages = Pages()
        self.pics = Pics()
        self.pic = None

    def process(self):
        pic_name = self.form['id'].value
        self.pic = Pic(pic_name)

    def getHtmlContent(self):
        return \
            self.header() +\
            self.navAndDisplayArea()
           
    def navAndDisplayArea(self):
        table = HtmlTable()
        table.addRow([self.nav.nav(),
                      self.displayArea()])
        table.setRowVAlign(1,'top')
        return center(table.getTable())

    def header(self):
        text = self.pages.site_name
        return div(h2(text), id='header')

    def displayArea(self):
        return div(self.pic_div(), id='displayArea')

    def pic_div(self):
        pic_url = "/%s/%s/%s" % (self.env.media_url,
                                 self.pic.page_name,
                                 self.pic.filename)
        pic_img = img(src=pic_url, class_='picImage')
        picNav = self.picNav()
        caption = self.picCaption() 
        description = self.picDescription()
        return div(picNav + pic_img + caption + hr() + description,
                   class_='pic')

    def picNav(self):
        page = Page(self.pic.page_name)

        prev_pic_name = None
        next_pic_name = None
        old_pic_name = None
        found = 0

        # loop thru first page of pics, find prev and next pic_names
        for pic in page.pics:
            pic_name = pic.name
            if found:
                next_pic_name = pic_name
                break
            if pic_name == self.pic.name:
                if old_pic_name:
                    prev_pic_name = old_pic_name
                found = 1
            old_pic_name = pic_name

        #prev
        if prev_pic_name:
            prev = a('prev', href='oneup.py?id=%s' % prev_pic_name)
        else:
            prev = font('prev', color='lightgrey')

        # next
        if next_pic_name:
            next = a('next', href='oneup.py?id=%s' % next_pic_name)
        else:
            next = font('next', color='lightgrey')
        return div('%s | %s' % (prev, next), class_='picNav')

    def picCaption(self):
        return div('<i>%s </i><small>%s</small>' % (self.pic.name,
                                                    self.pic.caption),
                 class_='picCaption')

    def picDescription(self):
        return div(self.pic.description or '', class_='picDescription')
Ejemplo n.º 14
0
class Collection(HtmlPage):

    def __init__(self):
        HtmlPage.__init__(self, 'Pics Page')
        self.style_sheets.append('css/vpics.css')
        self.style_sheets.append('css/collection.css')
        self.javascript_src.append('js/googleanalytics.js')

        # navigation
        self.nav = Nav()
        self.style_sheets.append(self.nav.style_sheets())

        self.env = Env()
        self.pages = Pages()
        self.page = None

    def getHtmlContent(self):
        return \
            self.header() +\
            self.messageLine() +\
            self.navAndDisplayArea()

    def process(self):
        if 'id' in self.form:
            self.page = Page(self.form['id'].value)
        else:
            self.page = self.pages.first_page

    def messageLine(self):
        if self.pages.site_message:
            #msg_lines = ['user message']
            return center(self.pages.site_message)
        return ''

    def navAndDisplayArea(self):
        table = HtmlTable()
        table.addRow([self.nav.nav(self.page.name),
                      self.displayArea()])
        table.setRowVAlign(1,'top')
        return center(table.getTable())

    def header(self):
        text = self.pages.site_name
        return div(h2(text), id='header')

    def displayArea(self):
        return div(self.textArea() + \
                   self.pictureArea(), id='displayArea')

    def textArea(self):
        '''Return TextArea used inside Display Area'''
        o = ''
        if self.page.html:
            filename = '%s/%s/%s' % (self.env.base_dir,
                                     self.page.name,
                                     self.page.html.filename)
            try:
                o = open(filename, 'r').read()
                o = self._applyTemplate(o)
            except Exception, e:
                o = 'Unable to read from %s: %s' % (self.page.html.filename, e)
        return div(o, id='textArea')
Ejemplo n.º 15
0
import pytesseract

#pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'


def clearFile():
    print("Clearing file!")
    filePtr = open('wall.txt', 'w+')
    filePtr.truncate(0)
    filePtr.write('20 20 V\n')
    filePtr.close()


clearFile()
# Initialize the AI Navigator
AI = Nav()
#Visual = visual()

# create the Robot instance.
robot = Robot()

posLeft = 0
posRight = 0
angle = 0
newangle = 0
prevAngle = 0
pos = 0
frontl = 0
frontr = 0
left = 0
right = 0
Ejemplo n.º 16
0
import logging
from nav import Nav, WaypointNav
import sys

logging.basicConfig(level=logging.INFO)

input_file = 'input'
if len(sys.argv) >= 2:
    input_file = sys.argv[1]
with open(input_file) as fin:
    my_input = [l.strip() for l in fin.readlines()]

n = Nav()
wn = WaypointNav()
for line in my_input:
    n.move(line)
    wn.move(line)

logging.info("Part 1: manhattan distance {}".format(n.manhattan()))
logging.info("Part 2: manhattan distance {}".format(wn.manhattan()))