Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/dijkstra.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/helper.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/mlmodel.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/mltext.cpython-39.pyc
Binary file not shown.
35 changes: 2 additions & 33 deletions dijkstra.py

Large diffs are not rendered by default.

Binary file added font/Montserrat-Bold.ttf
Binary file not shown.
Binary file added font/Montserrat-Medium.ttf
Binary file not shown.
61 changes: 61 additions & 0 deletions interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from kivymd.app import MDApp
from kivy.lang.builder import Builder
from kivymd.uix.dialog import MDDialog
from kivymd.uix.textfield import MDTextField
from kivymd.uix.button import MDRectangleFlatButton, MDFlatButton
from kivymd.uix.navigationdrawer import NavigationLayout
from kivymd.uix.list import MDList
from kivymd.uix.boxlayout import BoxLayout
from kivymd.theming import ThemableBehavior
from kivy.core.text import LabelBase
import requests
import webbrowser
from dijkstra import *

LabelBase.register(name="MontserratBold", fn_regular="font/Montserrat-Bold.ttf")
LabelBase.register(name="Montserrat", fn_regular="font/Montserrat-Medium.ttf")


class FactCheckerApp(MDApp):

class ContentNavigationDrawer(BoxLayout):
pass

class DrawerList(ThemableBehavior, MDList):
pass

def build(self):
self.file = Builder.load_file('projeto.kv')
self.theme_cls.theme_style = "Light"
self.theme_cls.primary_palette = "Amber"
return self.file

def press(self):
text_1 = self.root.ids.input_box_1.text
text_2 = self.root.ids.input_box_2.text
answer = dijkstra(text_1)
if answer[text_2] == float('infinity'):
name = f"Infelizmente não encontramos uma boa rota para esses pontos :("
else:
name = f"A menor distância entre {text_1} e {text_2} é de {answer[text_2]} milhas nauticas"
close_button = MDFlatButton(text='Close', on_release=self.close_dialog)
self.dialog = MDDialog(title='Resultado', text=name, size_hint=(0.5, 1), buttons=[close_button])
self.dialog.open()

def close_dialog(self, obj):
self.dialog.dismiss()

def check(self, checkbox, active):
if active:
self.answer = 'True'

def check1(self, checkbox, active):
if active:
self.answer = 'Fake'

def access(self):
webbrowser.open("https://drive.google.com/file/d/1Mi-AFcJArAtvtSc354WMdS31BLtrTL67/view?usp=sharing")


if __name__ == '__main__':
FactCheckerApp().run()
168 changes: 168 additions & 0 deletions projeto.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
Screen:
id: screen1
NavigationLayout:
id: navigation
ScreenManager:
id: screen_manager
Screen:
id: check
name: 'check'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: "Menu"
elevation: 10
left_action_items: [['menu', lambda x: nav_drawer.set_state()]]
Widget:
MDLabel:
text: "Descubra a melhor rota para o seu navio!"
font_size: 28
font_name: "MontserratBold"
pos_hint: {'center_x': 0.62, 'center_y': 0.75}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDTextField:
id: input_box_1
hint_text: "Ponto de partida"
font_size: 18
pos_hint: {'center_x': 0.5, 'center_y': 0.58}
size_hint_x: None
width: 500
multiline: True
helper_text: "Digite seu ponto de partida"
helper_text_mode: "on_focus"
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)
line_color_normal: (13/255, 59/255, 102/255, 1)

MDTextField:
id: input_box_2
hint_text: "Destino final"
font_size: 18
pos_hint: {'center_x': 0.5, 'center_y': 0.40}
size_hint_x: None
width: 500
multiline: True
helper_text: "Digite seu destino final"
helper_text_mode: "on_focus"
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)
line_color_normal: (13/255, 59/255, 102/255, 1)

MDRectangleFlatButton:
text: "Todos a bordo!"
pos_hint: {'center_x': 0.5, 'center_y': 0.25}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)
on_press: app.press()

MDLabel:
markup: True
text: "<Developed by: [color=#363636]Caio Barreto and Sofia Diniz[/color]>"
font_name: "Montserrat"
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)
pos_hint: {'center_x': 0.78, 'center_y': 0.1}
Screen:
name: 'relatorio'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: "Menu"
elevation: 10
left_action_items: [['menu', lambda x: nav_drawer.set_state()]]

Widget:
MDLabel:
text: "Relátorio do projeto"
font_size: 40
font_name: "MontserratBold"
pos_hint: {'center_x': 0.725, 'center_y': 0.75}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDLabel:
text: "Acesse o relatório do projeto apertando no botão abaixo:"
font_size: 20
pos_hint: {'center_x': 0.67, 'center_y': 0.60}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDRectangleFlatButton:
text: "Acesse"
pos_hint: {'center_x': 0.5, 'center_y': 0.45}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)
on_press: app.access()

Screen:
name: 'instrucoes'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: "Menu"
elevation: 10
left_action_items: [['menu', lambda x: nav_drawer.set_state()]]
Widget:
MDLabel:
text: "Instruções"
font_size: 56
font_name: "MontserratBold"
pos_hint: {'center_x': 0.8, 'center_y': 0.75}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDLabel:
text: "1. Acesse o arquivo avaliable_vertices.txt na pasta do algoritmo"
font_size: 20
pos_hint: {'center_x': 0.67, 'center_y': 0.60}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDLabel:
text: "2. Escolha um ponto de partida e outro de chegada"
font_size: 20
pos_hint: {'center_x': 0.67, 'center_y': 0.55}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDLabel:
text: "3. Cole nos respectivos inputs"
font_size: 20
pos_hint: {'center_x': 0.67, 'center_y': 0.5}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDLabel:
text: "4. E boa viagem! :)"
font_size: 20
pos_hint: {'center_x': 0.67, 'center_y': 0.45}
theme_text_color: "Custom"
text_color: (13/255, 59/255, 102/255, 1)

MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
ScrollView:
DrawerList:
id: md_list

MDList:
OneLineIconListItem:
text: "Algoritmo"
on_press: screen_manager.current = "check"
IconLeftWidget:
icon: "home"

OneLineIconListItem:
text: "Relatório do projeto"
on_press: screen_manager.current = "relatorio"
IconLeftWidget:
icon: "clipboard-list"

OneLineIconListItem:
text: "Instruções"
on_press: screen_manager.current = "instrucoes"
IconLeftWidget:
icon: "circle-edit-outline"