Skip to content

Commit

Permalink
Algunos cambios para poder cx_freezar la aplicación para distribución.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrossyamitrano committed May 1, 2021
1 parent 4e4781c commit b32eed2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ __pycache__
/data/savedata.json
/posición de las estrellas.txt
/test.py
/build/
/setup.py
/data/favicon.ico
14 changes: 10 additions & 4 deletions engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from pint import UnitRegistry
from os import getcwd, path
from .backend import *

if path.exists(path.join(getcwd(), "lib")):
ruta = path.join(getcwd(), 'lib', 'engine')
else:
ruta = path.join(getcwd(), 'engine')

ureg = UnitRegistry()
ureg.load_definitions('engine/unit_definitions.txt')
ureg.load_definitions(path.join(ruta, 'unit_definitions.txt'))
q = ureg.Quantity

material_densities = abrir_json('engine/material_densities.json')
molecular_weight = abrir_json('engine/molecular_weight.json')
recomendation = abrir_json('engine/recomendation.json')
material_densities = abrir_json(path.join(ruta, 'material_densities.json'))
molecular_weight = abrir_json(path.join(ruta, 'molecular_weight.json'))
recomendation = abrir_json(path.join(ruta, 'recomendation.json'))
1 change: 1 addition & 0 deletions engine/backend/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from os.path import exists, join
from os import getcwd
from pygame import quit
from sys import exit


def decimal_round(number: float):
Expand Down
6 changes: 5 additions & 1 deletion engine/frontend/graphs/atmograph/atmograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from os import getcwd, path
from engine import q

ruta = path.join(getcwd(), 'engine', 'frontend', 'graphs', 'atmograph', 'atmograph04rev24.png')
if path.exists(path.join(getcwd(), "lib")):
ruta = path.join(getcwd(), 'lib', 'engine', 'frontend', 'graphs', 'atmograph', 'atmograph04rev24.png')
else:
ruta = path.join(getcwd(), 'engine', 'frontend', 'graphs', 'atmograph', 'atmograph04rev24.png')

graph = image.load(ruta).convert_alpha()

pos_psi = [12, 20, 27, 36, 46, 59, 74, 93, 120, 166, 174, 181, 190, 200, 213, 228, 247, 274]
Expand Down
8 changes: 5 additions & 3 deletions engine/frontend/graphs/dwarfgraph/dwarfgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
from pygame import init, quit, Rect, Surface
from engine.backend.randomness import roll
from pygame.sprite import Sprite
from os import getcwd, path
from math import pi, pow
from os.path import join
from os import getcwd
from sys import exit


Expand Down Expand Up @@ -48,8 +47,11 @@ def __init__(self, imagen, **kwargs):
n = Number(mass_imgs[i], right=53, centery=i * 20 + 32)
numbers.add(n)
yes.append(n.rect.y - 16)
if path.exists(path.join(getcwd(), "lib")):
ruta = path.join(getcwd(), 'lib', 'engine', 'frontend', 'graphs', 'dwarfgraph', 'dwarfgraph.png')
else:
ruta = path.join(getcwd(), 'engine', 'frontend', 'graphs', 'dwarfgraph', 'dwarfgraph.png')

ruta = join(getcwd(), 'engine', 'frontend', 'graphs', 'dwarfgraph', 'dwarfgraph.png')
bg = image.load(ruta)
bg_rect = bg.get_rect(topleft=(54, 24))

Expand Down
8 changes: 5 additions & 3 deletions engine/frontend/graphs/gasgraph/gasgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from engine.frontend.globales import WidgetGroup
from pygame.sprite import Sprite
from sys import exit
from os.path import join
from os import getcwd
from os import getcwd, path
from math import pi


Expand All @@ -26,8 +25,11 @@ def density(m, r):
radius_imgs = [fuente.render(str(radius_keys[i]), True, COLOR_TEXTO, COLOR_BOX) for i in range(len(radius_keys))]

exes, yes = [], []
if path.exists(path.join(getcwd(), "lib")):
ruta = path.join(getcwd(), 'lib', 'engine', 'frontend', 'graphs', 'gasgraph', 'gasgraph.png')
else:
ruta = path.join(getcwd(), 'engine', 'frontend', 'graphs', 'gasgraph', 'gasgraph.png')

ruta = join(getcwd(), 'engine', 'frontend', 'graphs', 'gasgraph', 'gasgraph.png')
img_rect = Rect(31, 16, 540, 570)
img = image.load(ruta)

Expand Down
5 changes: 4 additions & 1 deletion engine/frontend/graphs/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
mass_keys.sort()

radius_keys = [0.1] + [i / 10 for i in range(2, 10, 2)] + [float(i) for i in range(1, 12)]
ruta = path.join(getcwd(), 'engine', 'frontend', 'graphs', 'graph', 'data')
if path.exists(path.join(getcwd(), "lib")):
ruta = path.join(getcwd(), 'lib', 'engine', 'frontend', 'graphs', 'graph', 'data')
else:
ruta = path.join(getcwd(), 'engine', 'frontend', 'graphs', 'graph', 'data')

graph = image.load(path.join(ruta, 'graph.png'))
exes = [59, 93, 114, 128, 139, 148, 156, 162, 169, 173, 209, 229, 244, 254, 263, 271, 278, 284, 288, 325, 345, 360, 370,
Expand Down

0 comments on commit b32eed2

Please sign in to comment.