Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated #17

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
dc14075
Added Django ORM
NADOOITChristophBa Jan 20, 2024
2818178
Merge branch 'beeware:main' into main
NADOOITChristophBa Mar 13, 2024
e476230
Added a bunch of bolderplate and features from NadooLaw
NADOOITChristophBa Mar 13, 2024
e13bcdc
up
NADOOITChristophBa Mar 13, 2024
95935ad
Delete models.py
NADOOITChristophBa Mar 13, 2024
6ab2f60
changed default app
NADOOITChristophBa Mar 13, 2024
0484ad3
Merge pull request #1 from NADOOIT/v0.3.16
NADOOITChristophBa Mar 13, 2024
84d6359
Update pyproject.toml
NADOOITChristophBa Mar 14, 2024
830327e
Merge pull request #2 from NADOOIT/v0.3.16
NADOOITChristophBa Mar 14, 2024
5fe37aa
Update app.py
NADOOITChristophBa Mar 14, 2024
d45fcec
Update app.py
NADOOITChristophBa Mar 14, 2024
b898226
Merge pull request #3 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 14, 2024
934af2f
add logo_script for mac icons
NADOOITChristophBa Mar 14, 2024
0b39cc6
Merge pull request #4 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 14, 2024
f040da7
Update requirements.txt
NADOOITChristophBa Mar 14, 2024
7a728f6
Merge pull request #5 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 14, 2024
52daa5b
Create MainStreamExampleComponent.py
NADOOITChristophBa Mar 14, 2024
ac1ee48
Merge pull request #6 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 14, 2024
ebdcb52
Update MainStreamExampleComponent.py
NADOOITChristophBa Mar 15, 2024
a9ae4ff
Merge pull request #7 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 15, 2024
edf1a31
backgroundremoval added
NADOOITChristophBa Mar 18, 2024
531c1bd
Update logo_script.py
NADOOITChristophBa Mar 18, 2024
0728262
Merge pull request #8 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 18, 2024
ecc513e
Update logo_script.py
NADOOITChristophBa Mar 20, 2024
2cd9e2c
Merge pull request #9 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 22, 2024
7883ed0
Update app.py
NADOOITChristophBa Mar 22, 2024
0869b9a
Merge pull request #10 from NADOOIT/v0.3.16
NADOOITChristophBa Mar 22, 2024
3d2cdcd
Update app.py
NADOOITChristophBa Mar 22, 2024
8c9ef0e
Update app.py
NADOOITChristophBa Mar 22, 2024
48eb63d
Update app.py
NADOOITChristophBa Mar 22, 2024
fcd3da6
Update app.py
NADOOITChristophBa Mar 22, 2024
e4090cb
Merge pull request #11 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 22, 2024
e6ba984
Update app.py
NADOOITChristophBa Mar 22, 2024
917623c
Merge pull request #12 from NADOOIT/v0.3.17
NADOOITChristophBa Mar 22, 2024
d569c74
Startcomponente hinzugefügt
NADOOITChristophBa Mar 25, 2024
0601da4
Update app.py
NADOOITChristophBa Mar 25, 2024
1edf9d1
Merge pull request #13 from NADOOIT/v0.3.16
NADOOITChristophBa Mar 25, 2024
45003cb
Update Startfenster.py
NADOOITChristophBa Mar 25, 2024
3127e63
Update Startfenster.py
NADOOITChristophBa Mar 25, 2024
84e609a
Create EinklappbarerContainer.py
NADOOITChristophBa Mar 25, 2024
f0fba1c
Update UpdateWindow.py
NADOOITChristophBa Mar 26, 2024
6ad466d
Merge pull request #14 from NADOOIT/v0.3.16
NADOOITChristophBa Mar 26, 2024
059e9ed
Settings
NADOOITChristophBa Mar 28, 2024
f8db8b6
fix + httpx for API
NADOOITChristophBa Apr 2, 2024
4d92dd0
Update Startfenster.py
NADOOITChristophBa Apr 2, 2024
1021a99
Update Startfenster.py
NADOOITChristophBa Apr 2, 2024
db512ea
Update services.py
NADOOITChristophBa Apr 3, 2024
509bb64
Update UpdateWindow.py
NADOOITChristophBa Apr 4, 2024
4a0d2ea
added. services and utils
NADOOITLaurinK Apr 6, 2024
6884990
updated
NADOOITLaurinK Apr 10, 2024
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
.vscode
.idea
__pycache__


{{ cookiecutter.app_name|lower|replace('-', '_') }}/src/{{ cookiecutter.app_name|lower|replace('-', '_') }}/resources/kundendaten/vorlagen/*.docx
{{ cookiecutter.app_name|lower|replace('-', '_') }}/src/{{ cookiecutter.app_name|lower|replace('-', '_') }}/resources/kundendaten/*.json
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ pre-commit == 3.5.0
pytest == 7.4.3
toml == 0.10.2
tox == 4.11.3
screeninfo == 1.5.0
toga
pillow
63 changes: 63 additions & 0 deletions {{ cookiecutter.app_name }}/logo_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from PIL import Image
import os
from rembg import remove

# HOW TO USE
# 1. Put Logo into the src/{{ cookiecutter.module_name }} folder
# 2. Install dependencies: pip install -r requirements.txt
# 3. Run script with: python logo_script.py
def remove_background(image_path):
# Load the image
img = Image.open(image_path)

# Remove the background
output = remove(img)

# Save the image with the background removed
output.save(image_path)

def create_icon_files(src_path, dist_path):
# Ensure the source logo.png exists
logo_path = os.path.join(src_path, "logo.png")
if not os.path.exists(logo_path):
raise FileNotFoundError(f"The source file {logo_path} does not exist.")

remove_background(logo_path)

# Open the source image
img = Image.open(logo_path)

# Define icon sizes for .ico file
icon_sizes = [(16, 16), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]

# Create the .ico file
img.save(
os.path.join(dist_path, "{{ cookiecutter.module_name }}.ico"), format="ICO", sizes=icon_sizes
)

# For .icns, macOS typically uses 10 different sizes
icns_sizes = [16, 32, 64, 128, 256, 512, 1024]
iconset_path = os.path.join(dist_path, "{{ cookiecutter.module_name }}.iconset")
os.makedirs(iconset_path, exist_ok=True)

for size in icns_sizes:
icon = img.resize((size, size), Image.LANCZOS)
icon.save(os.path.join(iconset_path, f"icon_{size}x{size}.png"))

# Use `iconutil` to create the .icns file from the .iconset directory
os.system(
f'iconutil -c icns {iconset_path} -o {os.path.join(dist_path, "{{ cookiecutter.module_name }}.icns")}'
)

# Clean up the .iconset directory after creating the .icns file
for file in os.listdir(iconset_path):
os.remove(os.path.join(iconset_path, file))
os.rmdir(iconset_path)


# Paths
source_path = "."
dist_path = "src/{{ cookiecutter.module_name }}/resources/"

# Create the icon files
create_icon_files(source_path, dist_path)
9 changes: 9 additions & 0 deletions {{ cookiecutter.app_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ sources = [
test_sources = [
"tests",
]

requires = [
"python-dotenv",
"toml",
"screeninfo",
"toga",
"httpx",
]

{{- cookiecutter.pyproject_table_briefcase_app_extra_content }}
{% if cookiecutter.pyproject_table_macOS %}

Expand Down
1 change: 1 addition & 0 deletions {{ cookiecutter.app_name }}/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rembg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE_ORDNER_NAME_APP = "updates"
UPDATE_ORDNER_NAME_USER = "Updates"
BASE_DIR = "{{ cookiecutter.app_name|lower|replace('-', '_') }}"
ARCHIV_ORDNER = "Archive"
KUNDENDATEN_ORDNER_APP = "kundendaten"
SETTINGS_ORDNER = "Settings"
226 changes: 220 additions & 6 deletions {{ cookiecutter.app_name }}/src/{{ cookiecutter.module_name }}/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,226 @@
"""
{{ cookiecutter.description|escape_toml }}
"""
{% if cookiecutter.app_source %}
{{ cookiecutter.app_source }}
{% else %}
import os
import sys
import subprocess
from datetime import datetime

import toga
from toga.style.pack import COLUMN
from toga.style import Pack
from toga import Command, Group

from {{ cookiecutter.app_name|lower|replace('-', '_') }}.components.LicenseWindow import LicenseWindow
from {{ cookiecutter.app_name|lower|replace('-', '_') }}.components.UpdateWindow import UpdateWindow

from {{ cookiecutter.app_name|lower|replace('-', '_') }}.services import get_base_dir, open_file, get_help_file_path,update_in_updates_ordner_uebertragen, get_updates_datei_user,update_daten_laden_app,setup_folders,update_daten_laden_user

from {{ cookiecutter.app_name|lower|replace('-', '_') }}.components.Startfenster import Startfenster
from {{ cookiecutter.app_name|lower|replace('-', '_') }}.components.SettingsWindow import SettingsWindow

from screeninfo import get_monitors

class {{ cookiecutter.app_name|lower|replace('-', '_') }}(toga.App):

# Define the action handlers for the commands
def show_settings(self, widget):
# Instantiate the LicenseWindow
license_window = SettingsWindow(title="Einstellungen")

# Show the license window
license_window.show()
def show_license(self, widget):
# Instantiate the LicenseWindow
license_window = LicenseWindow(title="Lizenzinformationen")

# Show the license window
license_window.show()

def show_updates(self, *argv):
# Instantiate the UpdateWindow
update_window = UpdateWindow(title="Updateinformationen")

# Show the update window
update_window.show()

def show_help(self, widget):
help_file_path = get_help_file_path(self.app)
if os.path.exists(help_file_path):
open_file(help_file_path)

def base_ordner_offnen(self, widget):
# Retrieve the template folder path
base_folder_path = get_base_dir()

# Open the template folder in the system's file explorer
if sys.platform == "win32":
os.startfile(base_folder_path)
elif sys.platform == "darwin":
subprocess.Popen(["open", base_folder_path])
else: # 'linux', 'linux2', 'cygwin', 'os2', 'os2emx', 'riscos', 'atheos'
subprocess.Popen(["xdg-open", base_folder_path])

def aktualisierung_anzeigen(self):
self.show_updates()

#fixed indenting
def überprüfung_auf_erstausführung_nach_aktualisierung_oder_installation(self):
#beim start ausführen
update_daten = update_daten_laden_user()
neues_update_wurde_installiert = update_daten.get("neues_update_wurde_installiert")
if neues_update_wurde_installiert:
return True
else:
return False

def neues_update_existiert(self):
updates_user = update_daten_laden_user()['Updates']
update_keys_user = list(updates_user.keys()) # Extrahiere alle Schlüssel
anzahl_update_user = len(update_keys_user)
updates_app = update_daten_laden_app(self)['Updates']
update_keys_app = list(updates_app.keys()) # Extrahiere alle Schlüssel
anzahl_update_app = len(update_keys_app)
if anzahl_update_app > anzahl_update_user:
return True
else:
return False

def startup(self):

# Erstellen von Vorraussetung damit die App funktioniert.
setup_folders()

# Menü
help_group = Group("Help", order=100)
settings_group = Group("Settings", order=50)

# Define commands
license_command = Command(
action=self.show_license,
text="Lizenzinformationen",
tooltip="Zeigt die Lizenzinformationen der verwendeten Pakete an",
group=help_group,
)
open_help_file_command = Command(
action=self.show_help,
text="Hilfe öffnen",
tooltip="Öffent die Hilfe PDF",
group=help_group,
)
update_command = Command(
action=self.show_updates,
text="Updateinformationen",
tooltip="Zeigt die Veränderung in der Software an",
group=help_group,
)
basis_ordner_öffnen_command = Command(
action=self.base_ordner_offnen,
text="Basis Ordner öffnen",
tooltip="Öffnet den Programmordner",
group=settings_group,
)

# Menü
help_group = Group("Help", order=100)
settings_group = Group("Settings", order=50)

# Define commands
license_command = Command(
action=self.show_license,
text="Lizenzinformationen",
tooltip="Zeigt die Lizenzinformationen der verwendeten Pakete an",
group=help_group,
)

open_help_file_command = Command(
action=self.show_help,
text="Hilfe öffnen",
tooltip="Öffent die Hilfe PDF",
group=help_group,
)

update_command = Command(
action=self.show_updates,
text="Updateinformationen",
tooltip="Zeigt die Veränderung in der Software an",
group=help_group,
)

basis_ordner_öffnen_command = Command(
action=self.base_ordner_offnen,
text="Basis Ordner öffnen",
tooltip="Öffnet den Programmordner",
group=settings_group,
)
settings_command = Command(
action=self.show_settings,
text="Einstellungen",
tooltip="Zeigt die Einstellungen an",
group=settings_group,
)

# Add commands to the app
self.commands.add(
license_command,
open_help_file_command,
basis_ordner_öffnen_command,
update_command,
settings_command,
)

# Get the size of the primary monitor
monitor = get_monitors()[0]
screen_width, screen_height = monitor.width, monitor.height

# Calculate half screen width and use full screen height
half_screen_width = screen_width // 2

# Main layout Box
self.main_box = toga.Box(
style=Pack(
direction=COLUMN,
padding_left=30,
padding_right=60,
#width=half_screen_width * 0.95,
flex=1,
)
)

# ScrollContainer to allow infinite scrolling
self.scroll_container = toga.ScrollContainer(
content=self.main_box, style=Pack(direction=COLUMN, flex=1), vertical=True
)
self.main_window = toga.MainWindow(
title=self.formal_name, size=(half_screen_width, screen_height * 80 / 100)
)
self.main_window.content = (
self.scroll_container
) # Set the ScrollContainer as the main content

# Set the window position to the right side of the screen
self.main_window.position = (half_screen_width, 0)

# Datei Auswahl
startfenster = Startfenster(app = self.app)

# Create the main window
self.main_box.add(
toga.Label(
"Willkommen bei {{ cookiecutter.project_name|escape_toml }}",
style=Pack(font_size=20, padding_top=10, padding_bottom=10),
),
startfenster
)


self.main_window.show()

if not os.path.isfile(get_updates_datei_user()) or self.neues_update_existiert():
update_in_updates_ordner_uebertragen(self.app)
self.aktualisierung_anzeigen()


def main():
# This should start and launch your app!
pass
{% endif %}
return {{ cookiecutter.app_name|lower|replace('-', '_') }}()

Loading
Loading