set openfile on cli
This commit is contained in:
parent
12f2d0e0f2
commit
fa1821d6a6
18
jam
18
jam
@ -4,6 +4,7 @@ from kivy.app import App
|
|||||||
from kivy.uix.widget import Widget
|
from kivy.uix.widget import Widget
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.config import Config
|
from kivy.config import Config
|
||||||
|
import sys
|
||||||
|
|
||||||
from cross import Cross,Cross_painter
|
from cross import Cross,Cross_painter
|
||||||
from status_bar import Status_bar
|
from status_bar import Status_bar
|
||||||
@ -14,12 +15,16 @@ class Jam_app(App):
|
|||||||
# name of .kv file for main interface
|
# name of .kv file for main interface
|
||||||
kv_file="jam.kv"
|
kv_file="jam.kv"
|
||||||
|
|
||||||
|
def __init__(self,**kwargs):
|
||||||
|
# the file open for editing
|
||||||
|
self.openfile=kwargs.get("openfile","")
|
||||||
|
|
||||||
|
super(Jam_app,self).__init__()
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
layout=BoxLayout(orientation="vertical")
|
layout=BoxLayout(orientation="vertical")
|
||||||
|
|
||||||
# the file open for editing
|
|
||||||
self.openfile=""
|
|
||||||
|
|
||||||
# painter
|
# painter
|
||||||
self.painter=Cross_painter(self)
|
self.painter=Cross_painter(self)
|
||||||
# status bar
|
# status bar
|
||||||
@ -39,6 +44,11 @@ Config.set('input', 'mouse', 'mouse,disable_multitouch')
|
|||||||
# do not exit on escape
|
# do not exit on escape
|
||||||
Config.set('kivy', 'exit_on_escape', 0)
|
Config.set('kivy', 'exit_on_escape', 0)
|
||||||
|
|
||||||
|
# read cli
|
||||||
|
openfile=""
|
||||||
|
if len(sys.argv)==2:
|
||||||
|
openfile=sys.argv[1]
|
||||||
|
|
||||||
# run
|
# run
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Jam_app().run()
|
Jam_app(openfile=openfile).run()
|
||||||
|
Loading…
Reference in New Issue
Block a user