Skip to content

Commit

Permalink
Merge pull request #25 from unball/6-criar-um-modo-de-atuacao-dos-rob…
Browse files Browse the repository at this point in the history
…os-para-posicionamento-automatico

Pull request aprovado
  • Loading branch information
ayssag authored Nov 7, 2023
2 parents f87fd9c + af6e797 commit f0d8a03
Show file tree
Hide file tree
Showing 38 changed files with 2,388 additions and 161 deletions.
141 changes: 141 additions & 0 deletions ALP-GUI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

*~
*#
15 changes: 15 additions & 0 deletions ALP-GUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ALP-GUI

Interface gráfica que recebe objetos para serem desenhados no campo via socket UDP. Este repositório contém um cliente que pode ser usado pela sua aplicação para mostrar os objetos.

## Cliente

O cliente se encontra em `src/app/classes/client.py` e pode ser usado de forma singleton, por exemplo para mostrar um robô:

```python3
from app.classes.client import clientProvider

clientProvider().drawRobot(robot.id, robot.x, robot.y, robot.thvec_raw.vec[0], robot.direction)
```

Os objetos são identificados por id, e caso chame-se `drawRobot` mais de uma vez com o mesmo id, ele reposicionará o robô.
53 changes: 53 additions & 0 deletions ALP-GUI/src/app/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.logo {
background-image: url('../assets/UnBall_orange.png');
background-size: 100% auto;
background-position: 0px -10px;
}

.recordControlBox {
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.4);
border-radius: 10px;
margin-bottom: 10px;
background-color: rgba(0,0,0,0.8);
}

.recordScale highlight {
background-color: #ffffff;
}

.recordScale slider {
background: rgb(255, 255, 255);
}

.recordingControlBox {
}

.recordScaleBox {
}

/* .recordButton {
background: #bb0d0d;
}
.recordPlayButton {
background: #1ff318;
} */

.recordControlButton {
padding-top: 7px;
padding-bottom: 7px;
border-radius: 50px;
border: none;
background: none;
}

.recordButtonRecording image {
color: red;
}

.recordButtonNotRecording image {
color: white;
}
47 changes: 47 additions & 0 deletions ALP-GUI/src/app/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import gi
gi.require_version('Gtk', '3.0')

from gi.repository import Gtk, Gdk
from helpers.path import relPath
from .drawer.drawer import Drawer
from .recorder.recorder import Recorder
from app.drawer.world import World

class App:
def __init__(self, world: World, onDestroy = None):
self.world = world
self.externalOnDestroy = onDestroy

def onDestroy(self, window: Gtk.Window):
if self.onDestroy: self.externalOnDestroy()
Gtk.main_quit()

def run(self):
# Builds static ui elements
builder = Gtk.Builder.new_from_file(relPath("app.ui"))

# Load CSS
css_provider = Gtk.CssProvider()
css_provider.load_from_path(relPath("app.css"))
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

# Get and show app window
window = builder.get_object("AppWindow")

# Connect to destroy event
window.connect("destroy", self.onDestroy)

# Get drawing area
drawingArea = builder.get_object("AppDrawingArea")

# Creates recorder
recorder = Recorder(builder, self.world)

# Creates drawer
drawer = Drawer(drawingArea, recorder.worldProvider)

# Show content
window.show_all()

# Start application
Gtk.main()
Loading

0 comments on commit f0d8a03

Please sign in to comment.