1
0
Fork 0
mirror of https://gitlab.com/oloturia/fumcaso.git synced 2024-11-01 01:38:16 +01:00

Added Android app

This commit is contained in:
oloturia 2019-11-26 19:06:50 +01:00
parent 8772f145c0
commit ce52d1b06c
5 changed files with 32 additions and 14 deletions

BIN
android.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

26
android_main.py Normal file
View file

@ -0,0 +1,26 @@
import kivy
from kivy.app import App
from kivy.uix.image import Image
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from randstrip import createStrip
class strip_Layout(App):
img = Image(source="./android.png")
def build(self):
layout = BoxLayout(orientation="vertical")
newStrip_Button = Button(text="New Strip", size_hint=(1,.3))
newStrip_Button.bind(on_press=self.newStrip)
layout.add_widget(self.img)
layout.add_widget(newStrip_Button)
return layout
def newStrip(self,instance):
createStrip("android.png",30)
self.img.reload()
if __name__=="__main__":
app = strip_Layout()
app.run()

View file

@ -87,7 +87,7 @@ def addThing(indVign):
return row[random.randint(3,len(row)-1)],row[1],row[2]
return 0
def writeStrip(story):
def writeStrip(story,fontSize):
"""This function creates the strip returning an image object that could be saved or viewed. It takes an array with filenames as parameter
The first image is always 000, then appends to strip the files, then decorates it fetching text and adding objects"""
strip = []
@ -95,15 +95,7 @@ def writeStrip(story):
if indVign!="000":
vign = Image.open(fileDir+indVign).convert('RGBA')
addtext = ImageDraw.Draw(vign)
fnt = ImageFont.truetype(fileDir+"ubuntu.ttf",22)
#if indVign[0] == 'A':
# textVign = fetchText(indVign)
# if textVign !=0:
# text1 = textVign[2]
# if text1.find('$') != -1:
# text1 = replaceText(text1)
# addtext.multiline_text((int(textVign[0]),int(textVign[1])),text1,fill="#000000",font=fnt,align="center")
#else:
fnt = ImageFont.truetype(fileDir+"ubuntu.ttf",fontSize)
textVign = fetchText(indVign)
if textVign!=0:
@ -128,12 +120,12 @@ def writeStrip(story):
xshift += 600
return image
def createStrip(name):
def createStrip(name,fontSize=22):
"""Create strip and save it
createStrip(str path/filename)"""
try:
story = fetchVign()
finalStrip = writeStrip(story)
finalStrip = writeStrip(story,fontSize)
finalStrip.save(fileDir+name)
return 0
except Exception as err:
@ -141,5 +133,5 @@ def createStrip(name):
if __name__ == "__main__":
story = fetchVign()
finalStrip = writeStrip(story)
finalStrip = writeStrip(story,22)
finalStrip.show()

View file

@ -42,4 +42,4 @@ B25.1.png;131;87;349;73;Uahahah!; ;Che ridere!; ;Ridicolo!; ;Da sbellicarsi!; ;O
B26.0.png;
B26.1.png;
B27.png;157;119;0;0;Vado a dormire@che è meglio; ;Basta TV per oggi; ;Bha; ;Che TV degrado; ;Basta con questa TV@spazzatura, vado a farmi un@panino al $FOOD@;
B28.png;138;43;470;92;Vorrei $FOOD@con contorno di $SIDEDISH@e $FOOD in@$DRESSING;Subito@monsieur
B28.png;118;43;470;92;Vorrei $FOOD@con contorno di $SIDEDISH@e $FOOD in@$DRESSING;Subito@monsieur

Can't render this file because it contains an unexpected character in line 34 and column 122.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 KiB

After

Width:  |  Height:  |  Size: 396 KiB