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
45 changes: 44 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# IDE配置文件
.vscode/
.idea/

# Python编译文件
__pycache__/
*.pyc
*.pyc
*.pyo
*.pyd
.Python

# 虚拟环境
env/
venv/
ENV/
env.bak/
venv.bak/

# 历史记录文件(可选择是否忽略)
app/settings/history.json

# 日志文件
*.log

# 操作系统生成的文件
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# 备份文件
*.bak
*.tmp
*.temp

# 测试覆盖率报告
.coverage
htmlcov/

# 分发包
build/
dist/
*.egg-info/
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<div align='center'>
<h1>Calculadora Tk</h1>
<img src='./demo/demo.gif' title='Demo da calculadora' width='340px' />
<h1>Calculator Tk</h1>
<img src='./demo/demo.gif' title='Calculator demo' width='340px' />
</div>

## Motivação
O projeto tem por objetivo incentivar iniciantes na programação em python a contribuir com projetos open source que vão além do Terminal, de modo que seja mais visual o desenvolvimento.
## Motivation
The project aims to encourage programming beginners in Python to contribute to open source projects that go beyond the Terminal, making development more visual.

Sendo assim, foi criado a Calculadora Tk com funcionalidades matemáticas básicas e com alguns erros propositais para que as correções e ampliações de novas funcionalidades sejam feitas pelo público alvo (Iniciantes).
Therefore, Calculator Tk was created with basic mathematical functionalities and some intentional errors so that corrections and expansions of new features can be made by the target audience (Beginners).

## Para contribuir
Siga os passos abaixo:
## How to contribute
Follow the steps below:

1. Faça o `Fork` do projeto [Calculadora Tk](<https://github.com/matheusfelipeog/calculadora-tk.git>) no canto superior direito da tela;
2. Clone o projeto do seu repositório no github (`git clone https://github.com/SEU_USUARIO/calculadora-tk.git`);
3. Crie sua branch para realizar sua modificação (`git checkout -b feature/nome_da_modificação`);
4. Após ter realizado suas modificações, faça um `commit` (`git commit -m "Descrição da modificação"`);
5. Faça o `Push` para seu repositório (`git push origin feature/nome_modificação`);
6. No seu repositório no *Github* crie uma `Pull Request` para que seja avaliada a suas modificações para ser feito o `merge` no projeto principal.
1. Fork the [Calculator Tk](<https://github.com/matheusfelipeog/calculadora-tk.git>) project in the upper right corner of the screen;
2. Clone the project from your GitHub repository (`git clone https://github.com/YOUR_USERNAME/calculadora-tk.git`);
3. Create your branch to make your modification (`git checkout -b feature/modification_name`);
4. After making your modifications, make a `commit` (`git commit -m "Description of modification"`);
5. Push to your repository (`git push origin feature/modification_name`);
6. In your GitHub repository, create a `Pull Request` so that your modifications can be evaluated for merging into the main project.

## Contribuidores
## Contributors

| [<img src="https://avatars2.githubusercontent.com/u/25591464?s=115" /><br /><sub>@aguiarcandre</sub>](https://github.com/aguiarcandre) | [<img src="https://avatars2.githubusercontent.com/u/52337966?s=115" /><br /><sub>@carlos3g</sub>](https://github.com/carlos3g) | [<img src="https://avatars0.githubusercontent.com/u/67281981?s=115" /><br /><sub>@ericllma</sub>](https://github.com/ericllma) | [<img src="https://avatars0.githubusercontent.com/u/61357388?s=115" width="115px" height="115px" /><br /><sub>@sam-chami</sub>](https://github.com/sam-chami) | [<img src="https://avatars1.githubusercontent.com/u/64209523?s=115" /><br /><sub>@taisbferreira</sub>](https://github.com/taisbferreira) | [<img src="https://avatars.githubusercontent.com/u/85250817?v=4" width="115px" height="115px"/><br /><sub>@edilsonmatola</sub>](https://github.com/edilsonmatola) |
|:-:|:-:|:-:|:-:|:-:|:-:|
| [<img src="https://avatars.githubusercontent.com/u/65002100?s=115" /><br /><sub>@maguzzz</sub>](https://github.com/maguzzz) | [<img src="https://avatars.githubusercontent.com/u/60383210?s=115" /><br /><sub>@vinayyak</sub>](https://github.com/vinayyak) |

## Para ideias/Bugs
Caso encontre algum bug crie uma `issue` descrevendo o Bug encontrado que tem que ser resolvido, informando o passo a passo para replicá-lo.
## For ideas/Bugs
If you find any bug, create an `issue` describing the Bug found that needs to be resolved, providing step-by-step instructions to replicate it.

E caso tenha alguma ideia de nova funcionalidade que possa ser implementada por outros iniciantes, crie uma `issue` descrevendo essa ideia. ;)
And if you have any idea for new functionality that can be implemented by other beginners, create an `issue` describing this idea. ;)

## Start
```
$ python main.py
```

ou crie seu próprio arquivo com o seguinte script, e depois siga o procedimento acima com o nome correspondente:
or create your own file with the following script, and then follow the procedure above with the corresponding name:
```Python
# -*- coding: utf-8 -*-

Expand All @@ -50,8 +50,8 @@ if __name__ == '__main__':
main.start()
```

## Guias
- Tkinter: [Documentação](https://docs.python.org/3/library/tkinter.html) - *Existe diversos outros guias em mostra logo no ínicio do página*
- Git e Github: [Tutorial no Tableless](https://tableless.com.br/tudo-que-voce-queria-saber-sobre-git-e-github-mas-tinha-vergonha-de-perguntar/) - *Leitura*
- Git e Github: [Tutorial no Youtube](https://www.youtube.com/playlist?list=PLQCmSnNFVYnRdgxOC_ufH58NxlmM6VYd1) - *Vídeo Aula*
- Pull Request no GitHub: [Tutorial DigitalOcean](https://www.digitalocean.com/community/tutorials/como-criar-um-pull-request-no-github-pt) - *Leitura*
## Guides
- Tkinter: [Documentation](https://docs.python.org/3/library/tkinter.html) - *There are several other guides shown right at the beginning of the page*
- Git and Github: [Tutorial on Tableless](https://tableless.com.br/tudo-que-voce-queria-saber-sobre-git-e-github-mas-tinha-vergonha-de-perguntar/) - *Reading*
- Git and Github: [Tutorial on Youtube](https://www.youtube.com/playlist?list=PLQCmSnNFVYnRdgxOC_ufH58NxlmM6VYd1) - *Video Tutorial*
- Pull Request on GitHub: [DigitalOcean Tutorial](https://www.digitalocean.com/community/tutorials/como-criar-um-pull-request-no-github-pt) - *Reading*
18 changes: 9 additions & 9 deletions app/calculador.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# -*- coding: utf-8 -*-

# @autor: Matheus Felipe
# @author: Matheus Felipe
# @github: github.com/matheusfelipeog

class Calculador(object):
"""Classe responsável por realizar todos os calculos da calculadora"""
"""Class responsible for performing all calculator computations"""

def calculation(self, calc):
"""Responsável por receber o calculo a ser realizado, retornando
o resultado ou uma mensagem de erro em caso de falha.
"""Responsible for receiving the calculation to be performed, returning
the result or an error message in case of failure.

"""
return self.__calculation_validation(calc=calc)

def __calculation_validation(self, calc):
"""Responsável por verificar se o calculo informado é possível ser feito"""
"""Responsible for verifying if the informed calculation is possible to be done"""

try:
result = eval(calc)

return self.__format_result(result=result)
except (NameError, ZeroDivisionError, SyntaxError, ValueError):
return 'Erro'
return 'Error'

def __format_result(self, result):
"""Formata o resultado em notação cientifica caso seja muito grande
e retorna o valor formatado em tipo string"""
"""Formats the result in scientific notation if it's too large
and returns the formatted value as string type"""

result = str(result)
if len(result) > 15:
result = '{:5.5E}'.format(float(result))

return result
return result
Loading