Skip to content

Commit

Permalink
Merge pull request #126 from paxapos/v1.0.3
Browse files Browse the repository at this point in the history
refactor: Update build workflow to include separate specifications for Windows and Linux builds and improve artifact upload process
  • Loading branch information
alevilar authored Sep 12, 2024
2 parents b1ea421 + 0fc0e95 commit 002903d
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 54 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/desktop.build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Build Desktop Ejecutables - on Release

on:
push:
branches:
- main
on: push

jobs:
build-windows:
Expand Down Expand Up @@ -115,8 +112,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.0.2
release_name: Release v1.0.2
tag_name: v1.0.3
release_name: Release v1.0.3
draft: false
prerelease: false

Expand Down
6 changes: 3 additions & 3 deletions buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source.dir = src
#source.include_exts = py,png,jpg,kv,atlas

# (list) List of inclusions using pattern matching
source.include_patterns = src/fiscalberry_app/assets/*
source.include_patterns = src/assets/*

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec
Expand Down Expand Up @@ -44,10 +44,10 @@ requirements = python3,kivy,python-escpos,python-socketio,simple-websocket,uuid,
# requirements.source.kivy = ../../kivy

# (str) Presplash of the application
presplash.filename = %(source.dir)s/fiscalberry_app/assets/fiscalberry.png
presplash.filename = %(source.dir)s/assets/fiscalberry.png

# (str) Icon of the application
icon.filename = %(source.dir)s/fiscalberry_app/assets/fiscalberry.png
icon.filename = %(source.dir)s/assets/fiscalberry.png

# (list) Supported orientations
# Valid options are: landscape, portrait, portrait-reverse or landscape-reverse
Expand Down
2 changes: 1 addition & 1 deletion fiscalberry-lin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ exe = EXE(
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['src/fiscalberry_app/assets/fiscalberry.ico'],
icon=['src/assets/fiscalberry.ico'],
)
2 changes: 1 addition & 1 deletion fiscalberry-win.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ exe = EXE(
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['src/fiscalberry_app/assets/fiscalberry.ico'],
icon=['src/assets/fiscalberry.ico'],
)
1 change: 0 additions & 1 deletion requirements.cli.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ aiohttp==3.10.2
argparse==1.4.0
uuid==1.30
appdirs==1.4.4
python-dotenv==1.0.1
platformdirs==4.2.2
1 change: 0 additions & 1 deletion requirements.kivy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ aiohttp==3.10.2
argparse==1.4.0
uuid==1.30
appdirs==1.4.4
python-dotenv==1.0.1
platformdirs==4.2.2
kivy==2.3.0
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ wsproto==1.2.0
aiohttp==3.10.2
argparse==1.4.0
uuid==1.30
python-dotenv==1.0.1
platformdirs==4.2.2
kivy==2.3.0
cython==3.0.11
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'uuid==1.30',
'appdirs==1.4.4',
'kivy==2.3.0',
'python-dotenv==1.0.1',
'platformdirs==4.2.2',
],
entry_points={
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
16 changes: 8 additions & 8 deletions src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import os
import logging

from dotenv import load_dotenv
load_dotenv()
from common.Configberry import Configberry

configberry = Configberry()

environment = configberry.config.get("SERVIDOR", "environment", fallback="production")

# configuro logger segun ambiente
environment = os.getenv('ENVIRONMENT', 'production')
if environment == 'development':
print("* * * * * Modo de desarrollo * * * * *")
logging.basicConfig(level=logging.DEBUG)
Expand All @@ -22,14 +23,12 @@


# importo el modulo que se encarga de la comunicacion con el servidor
from fiscalberry_sio import FiscalberrySio
from common.fiscalberry_sio import FiscalberrySio
from common.discover import send_discover_in_thread
from common.Configberry import Configberry



def main():
configberry = Configberry()
def start():

while True:
logger.info("Preparando Fiscalberry Server")
Expand All @@ -42,5 +41,6 @@ def main():
logger.warning("Termino ejecucion de server socketio?.. reconectando en 5s")
time.sleep(5)


if __name__ == "__main__":
main()
start()
1 change: 1 addition & 0 deletions src/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# archivo init del modulo common
32 changes: 13 additions & 19 deletions src/fiscalberry_sio.py → src/common/fiscalberry_sio.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FiscalberrySio():
stop_event = threading.Event()

def __init__(self, sockeiIoServer, uuid, namespaces = ["/paxaprinter"]) -> None:
self.sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=2, reconnection_delay_max=15, logger=sioLogger, engineio_logger=False)
self.sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=2, reconnection_delay_max=15, logger=sioLogger, engineio_logger=sioLogger)

self.sockeiIoServer = sockeiIoServer
self.uuid = uuid
Expand Down Expand Up @@ -65,24 +65,18 @@ def start_only_status_in_thread(self) -> threading.Thread:
return self.thread

def __run(self):
while not self.stop_event.is_set():
try:
self.sio.connect(self.sockeiIoServer, namespaces=self.namespaces, headers={"X_UUID":self.uuid})
logger.info("Iniciado SioClient en %s con uuid %s" % (self.sockeiIoServer, self.uuid))
self.sio.wait()

except socketio.exceptions.ConnectionError as e:
logger.error(f"socketio Connection error: {e}")
self.sio.disconnect()
except Exception as e:
self.sio.disconnect()
logger.error(f"An unexpected error occurred: {e}")

logger.info("FiscalberrySio: stopped, reconectando en 3s")
for i in range(3, 0, -1):
time.sleep(1)
logger.info(f"FiscalberrySio: stopped, reconectando en {i}s")

try:
logger.info("FiscalberrySio: ******************************* CONECTANDO *******************************")
self.sio.connect(self.sockeiIoServer, namespaces=self.namespaces, headers={"X_UUID":self.uuid})
logger.info("Iniciado SioClient en %s con uuid %s" % (self.sockeiIoServer, self.uuid))
self.sio.wait()

except socketio.exceptions.ConnectionError as e:
logger.error(f"socketio Connection error: {e}")
self.sio.disconnect()
except Exception as e:
self.sio.disconnect()
logger.error(f"An unexpected error occurred: {e}")


def start_print_server(self):
Expand Down
2 changes: 1 addition & 1 deletion src/fiscalberryservice.android.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


# importo el modulo que se encarga de la comunicacion con el servidor
from fiscalberry_sio import FiscalberrySio
from common.fiscalberry_sio import FiscalberrySio
from common.discover import send_discover_in_thread
from common.Configberry import Configberry

Expand Down
34 changes: 24 additions & 10 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import os
import logging

from dotenv import load_dotenv
load_dotenv()
from common.Configberry import Configberry

__version__ = "0.1.0"
configberry = Configberry()

environment = configberry.config.get("SERVIDOR", "environment", fallback="production")


# Configuro logger según ambiente
environment = os.getenv('ENVIRONMENT', 'production')
if environment == 'development':
print("* * * * * Modo de desarrollo * * * * *")
logging.basicConfig(level=logging.DEBUG)
Expand All @@ -18,13 +18,27 @@
logging.basicConfig(level=logging.WARNING)


from fiscalberry_app.fiscalberry_app import FiscalberryApp
import sys


if __name__ == "__main__":
__version__ = "0.1.0"

# Crear la aplicación Kivy
app = FiscalberryApp()

# Ejecutar la aplicación Kivy
app.run()
if __name__ == "__main__":

if len(sys.argv) > 1 and sys.argv[1] == "cli":
import cli as cli

cli.start()

else:
from ui.fiscalberry_app import FiscalberryApp

# Llamar a la función que maneja la interfaz de usuario
start_ui()
# Crear la aplicación Kivy
app = FiscalberryApp()

# Ejecutar la aplicación Kivy
app.run()

Empty file added src/ui/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, **kwargs):


class FiscalberryApp(App):
assetpath = os.path.dirname(os.path.abspath(__file__))
assetpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

background_image = StringProperty(f"{assetpath}/assets/bg.jpg")
logo_image = StringProperty(f"{assetpath}/assets/fiscalberry.png")
Expand Down

0 comments on commit 002903d

Please sign in to comment.