Jam/jam

55 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-10-16 23:22:39 +00:00
#!/usr/bin/env python3
2021-09-28 01:20:22 +00:00
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
2021-09-28 01:20:22 +00:00
from kivy.config import Config
2021-10-18 18:23:31 +00:00
import sys
2021-09-28 01:20:22 +00:00
2021-09-28 19:23:06 +00:00
from cross import Cross,Cross_painter
from status_bar import Status_bar
2021-10-02 21:38:26 +00:00
from command_prompt import Command_prompt
2021-09-28 19:23:06 +00:00
2021-09-28 01:20:22 +00:00
# App class
class Jam_app(App):
# name of .kv file for main interface
kv_file="jam.kv"
2021-09-28 01:20:22 +00:00
2021-10-18 18:23:31 +00:00
def __init__(self,**kwargs):
# the file open for editing
self.openfile=kwargs.get("openfile","")
super(Jam_app,self).__init__()
2021-09-28 01:20:22 +00:00
def build(self):
layout=BoxLayout(orientation="vertical")
2021-10-02 21:38:26 +00:00
2021-10-16 20:19:22 +00:00
# painter
self.painter=Cross_painter(self)
2021-10-16 20:19:22 +00:00
# status bar
self.status_bar=Status_bar(self)
2021-10-16 20:19:22 +00:00
# command prompt
2021-10-02 21:38:26 +00:00
self.command_prompt=Command_prompt(self)
layout.add_widget(self.painter)
layout.add_widget(self.status_bar)
2021-10-02 21:38:26 +00:00
layout.add_widget(self.command_prompt)
return layout
2021-09-28 01:20:22 +00:00
# disable red circles on right click
Config.set('input', 'mouse', 'mouse,disable_multitouch')
2021-10-16 23:19:39 +00:00
# do not exit on escape
Config.set('kivy', 'exit_on_escape', 0)
2021-09-28 01:20:22 +00:00
2021-10-18 18:23:31 +00:00
# read cli
openfile=""
if len(sys.argv)==2:
openfile=sys.argv[1]
2021-09-28 01:20:22 +00:00
# run
if __name__ == '__main__':
2021-10-18 18:23:31 +00:00
Jam_app(openfile=openfile).run()