Skip to content

Commit

Permalink
使用kivymd
Browse files Browse the repository at this point in the history
  • Loading branch information
lr committed Apr 21, 2020
1 parent 6b62cf1 commit 2803f5f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 65 deletions.
Binary file removed 4.png
Binary file not shown.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 9 additions & 27 deletions main.kv
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
#: import MDTextField kivymd.textfields.MDTextField
#: import MDRaisedButton kivymd.button.MDRaisedButton
#: import MDLabel kivymd.label.MDLabel


<MyLayout>:
orientation:'vertical'
padding:(36,36)
id:bl
Button:
text:'Buildozer在线打包工具(点我有惊喜)'
MDRectangleFlatButton:
text:'Buildozer在线打包工具'
size_hint:1,0.4
background_normal:'4.png'
on_release:popup.open()
Popup:
id:popup
title:'惊喜'
on_parent:
if self.parent==bl:self.parent.remove_widget(self)
BoxLayout:
orientation:'vertical'
MDLabel:
id:label
font_size:35
color:1,1,1,1
text: '1. 路径填写kivy项目路径, 主程序必须为main.py\n\n2. app名称必须为英文, 不然会打包失败\n\n3. 覆盖通知栏参数为True或False\n\n4. 注意包名的格式是xxx.xxx.xxx\n\n5. python版本可以为python2或python3, py3仅支持纯py库\n\n6. 屏幕方向参数对应坚屏横屏自动:portrait,landscape,all\n\n7. 若想自定义图标, icon.png放在项目路径下即可\n\n8. 欢迎到https://github.com/liyuanrui/buildozer-online 提issue'
Label:
Label:
size_hint_y:0.15
MDTextField:
id:project
size_hint_y:0.4
hint_text:'项目路径'
hint_text:'项目路径(包含main.py)'
text:'/sdcard/qpython/projects/KivySample'
BoxLayout:
orientation:'horizontal'
Expand Down Expand Up @@ -61,8 +42,8 @@
size_hint:1,0.4
MDTextField:
id:pyver
hint_text:'python版本'
text:'python2'
hint_text:'编译版本'
text:'arm64-v8a'
MDTextField:
id:orientation
hint_text:'屏幕方向'
Expand All @@ -71,8 +52,8 @@
MDTextField:
id:requirements
size_hint_y:0.4
hint_text:'第三方库'
text:'kivy' if pyver.text=='python2' else 'python3crystax,kivy'
hint_text:'编译依赖'
text:'python3,kivy'
MDTextField:
id:permissions
size_hint_y:0.4
Expand All @@ -81,7 +62,7 @@
MDTextField:
id:email
size_hint_y:0.4
hint_text:'邮箱'
hint_text:'接收邮箱'
MDRaisedButton:
id:button
text:
Expand All @@ -90,6 +71,7 @@
on_press:button.text='上传中...'
on_release:
root.start()
MDLabel:



Expand Down
31 changes: 15 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import kivy


from kivy.app import App
from kivymd.app import MDApp
from kivy.uix.boxlayout import BoxLayout
from kivymd.theming import ThemeManager
from kivy.core.text import LabelBase
from kivy.core.window import WindowBase
from kivy.clock import Clock
Expand Down Expand Up @@ -76,17 +75,17 @@ def start(self):
S.action=True
self.ids.button.text='上传中...'
c = rpyc.connect('111.230.24.37',30033)

c._config['sync_request_timeout'] = 600
pcount = c.root.start(pyver,project,dirs,title,name,domain,version,requirements,permissions,email,fullscreen,orientation)
c.close()

self.ids.button.text='队列位置:%s, 预计等待%s分钟'%(pcount,pcount*3)
self.ids.button.text='队列位置:%s, 预计等待%s分钟'%(pcount,pcount*30)


class MainApp(App):
theme_cls = ThemeManager()
class MainApp(MDApp):

def build(self):
self.theme_cls.theme_style = 'Dark'
#self.theme_cls.theme_style = 'Dark'
return MyLayout()

def checkinput(self,nap):
Expand All @@ -108,42 +107,42 @@ def checkinput(self,nap):
project.hint_text='非法参数(路径或main.py不存在)'
S.a1=False
else:
project.hint_text='项目路径'
project.hint_text='项目路径(包含main.py)'
S.a1=True
# a2
if not ('@' in email.text and '.' in email.text):
email.hint_text='非法参数(请输入邮箱)'
S.a2=False
else:
email.hint_text='邮箱'
email.hint_text='接收邮箱'
S.a2=True
# a3
if checkcn(title.text) or title.text=='':
title.hint_text='非法参数(只能英文)'
S.a3=False
else:
title.hint_text='app名称'
title.hint_text='app名称(只能英文)'
S.a3=True
#a4
if not fullscreen.text in ('True','False'):
fullscreen.hint_text='非法参数(True or False)'
S.a4=False
else:
fullscreen.hint_text='覆盖通知栏'
fullscreen.hint_text='覆盖通知栏(True, False)'
S.a4=True
#a5
if not (len(package.text.split('.'))==3 and package.text.split('.')[-1]!=''):
package.hint_text='非法参数(x.y.z)'
package.hint_text='非法参数(test.org.app)'
S.a5=False
else:
package.hint_text='app包名'
package.hint_text='app包名(test.org.app)'
S.a5=True
#a6
if not orientation.text in ('portrait','landscape','all'):
orientation.hint_text='非法参数'
orientation.hint_text='非法参数(portrait,landscape)'
S.a6=False
else:
orientation.hint_text='屏幕方向'
orientation.hint_text='屏幕方向(portrait,landscape)'
S.a6=True
#a7
if version.text=='':
Expand All @@ -157,7 +156,7 @@ def checkinput(self,nap):
pyver.hint_text='非法参数'
S.a8=False
else:
pyver.hint_text='python版本'
pyver.hint_text='编译版本'
S.a8=True


Expand Down
Binary file added screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 0 additions & 22 deletions test_tornado.py

This file was deleted.

0 comments on commit 2803f5f

Please sign in to comment.