58 lines
1.3 KiB
Python
Executable File
58 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from kivy.app import App
|
|
from kivy.uix.widget import Widget
|
|
from kivy.uix.boxlayout import BoxLayout
|
|
from kivy.config import Config
|
|
import sys
|
|
|
|
from cross import Cross,Cross_painter
|
|
from status_bar import Status_bar
|
|
from command_prompt import Command_prompt
|
|
|
|
# App class
|
|
class Jam_app(App):
|
|
# name of .kv file for main interface
|
|
kv_file="jam.kv"
|
|
|
|
def __init__(self,**kwargs):
|
|
# the file open for editing
|
|
self.openfile=kwargs.get("openfile","")
|
|
|
|
# readonly mode
|
|
self.readonly=False
|
|
|
|
super(Jam_app,self).__init__()
|
|
|
|
|
|
def build(self):
|
|
layout=BoxLayout(orientation="vertical")
|
|
|
|
# painter
|
|
self.painter=Cross_painter(self)
|
|
# status bar
|
|
self.status_bar=Status_bar(self)
|
|
# command prompt
|
|
self.command_prompt=Command_prompt(self)
|
|
|
|
layout.add_widget(self.painter)
|
|
layout.add_widget(self.status_bar)
|
|
layout.add_widget(self.command_prompt)
|
|
|
|
return layout
|
|
|
|
|
|
# disable red circles on right click
|
|
Config.set('input', 'mouse', 'mouse,disable_multitouch')
|
|
# do not exit on escape
|
|
Config.set('kivy', 'exit_on_escape', 0)
|
|
|
|
# read cli
|
|
openfile=""
|
|
if len(sys.argv)==2:
|
|
openfile=sys.argv[1]
|
|
|
|
# run
|
|
if __name__ == '__main__':
|
|
Jam_app(openfile=openfile).run()
|