Compare commits

...

2 commits
v0.1 ... main

Author SHA1 Message Date
L3D
8801b75245 Update 'README.md'
All checks were successful
Build / Build for Android (push) Successful in 42m49s
Signed-off-by: L3D <l3d@c3woc.de>
2023-05-15 02:44:57 +02:00
L3D
a505a6be32
Build example Editor
All checks were successful
Build / Build for Android (push) Successful in 33m19s
2023-05-12 20:05:16 +02:00
4 changed files with 126 additions and 32 deletions

View file

@ -42,3 +42,6 @@ There is a Github Action for building kivy apps for android using bulldozer. We
### Releasing ### Releasing
Sadly gitea/forgejo does not support artifacts jet. So we have multiple different options for releasing our build binarys. Publishing them to other servers, put them in a new git repo or maybe there is a fancy way to attatch them to a release. For now we skipped this option and waiting for artifacts to become available. Sadly gitea/forgejo does not support artifacts jet. So we have multiple different options for releasing our build binarys. Publishing them to other servers, put them in a new git repo or maybe there is a fancy way to attatch them to a release. For now we skipped this option and waiting for artifacts to become available.
In the meantime we use https://transfer.sh/ for uploading our files quick and dirty. In the meantime we use https://transfer.sh/ for uploading our files quick and dirty.
## App Status:
THis app does not work. I did not manage to get the right permissions for android 13 and canceled the process.

View file

@ -29,7 +29,7 @@ source.include_exts = py,png,jpg,kv,atlas
#source.exclude_patterns = license,images/*/*.jpg #source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1) # (str) Application versioning (method 1)
version = 0.1 version = 0.2
# (str) Application versioning (method 2) # (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"] # version.regex = __version__ = ['"](.*)['"]

View file

@ -0,0 +1,69 @@
Root:
text_input: text_input
BoxLayout:
orientation: 'vertical'
BoxLayout:
size_hint_y: None
height: 30
Button:
text: 'Load'
on_release: root.show_load()
Button:
text: 'Save'
on_release: root.show_save()
BoxLayout:
TextInput:
id: text_input
text: ''
RstDocument:
text: text_input.text
show_errors: True
<LoadDialog>:
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserListView:
id: filechooser
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Load"
on_release: root.load(filechooser.path, filechooser.selection)
<SaveDialog>:
text_input: text_input
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserListView:
id: filechooser
on_selection: text_input.text = self.selection and self.selection[0] or ''
TextInput:
id: text_input
size_hint_y: None
height: 30
multiline: False
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Save"
on_release: root.save(filechooser.path, text_input.text)

View file

@ -1,42 +1,64 @@
#/usr/bin/env python3 #/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from kivy.app import App from kivy.app import App
from kivy.uix.boxlayout import BoxLayout from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image from kivy.factory import Factory
from kivy.uix.button import Button from kivy.properties import ObjectProperty
from kivy.uix.filechooser import FileChooserIconView from kivy.uix.popup import Popup
class ImageChooser(BoxLayout): import os
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.orientation = 'vertical'
self.file_chooser = FileChooserIconView()
self.add_widget(self.file_chooser)
self.open_button = Button(text='Open Image')
self.open_button.bind(on_press=self.open_image)
self.add_widget(self.open_button)
def open_image(self, instance): class LoadDialog(FloatLayout):
if self.file_chooser.selection: load = ObjectProperty(None)
# Show Image cancel = ObjectProperty(None)
self.image = Image()
self.add_widget(self.image)
# Load Image
image_path = self.file_chooser.selection[0]
self.image.source = image_path
# Hide other Elements class SaveDialog(FloatLayout):
self.remove_widget(self.file_chooser) save = ObjectProperty(None)
self.remove_widget(self.open_button) text_input = ObjectProperty(None)
cancel = ObjectProperty(None)
class Root(FloatLayout):
loadfile = ObjectProperty(None)
savefile = ObjectProperty(None)
text_input = ObjectProperty(None)
def dismiss_popup(self):
self._popup.dismiss()
def show_load(self):
content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
self._popup = Popup(title="Load file", content=content,
size_hint=(0.9, 0.9))
self._popup.open()
def show_save(self):
content = SaveDialog(save=self.save, cancel=self.dismiss_popup)
self._popup = Popup(title="Save file", content=content,
size_hint=(0.9, 0.9))
self._popup.open()
def load(self, path, filename):
with open(os.path.join(path, filename[0])) as stream:
self.text_input.text = stream.read()
self.dismiss_popup()
def save(self, path, filename):
with open(os.path.join(path, filename), 'w') as stream:
stream.write(self.text_input.text)
self.dismiss_popup()
class DeutschlandTicket(App): class DeutschlandTicket(App):
def build(self): pass
return ImageChooser()
Factory.register('Root', cls=Root)
Factory.register('LoadDialog', cls=LoadDialog)
Factory.register('SaveDialog', cls=SaveDialog)
if __name__ == '__main__': if __name__ == '__main__':
app = DeutschlandTicket() app = DeutschlandTicket()