Browse Source

[App] Override autostart in Viewer

- Option added in preferences to override auto-switching to Viewer when
opening a presentation file.

Fixes #4
master
octogene 3 years ago
parent
commit
fbce336325
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      hadaly/app.py

+ 6
- 1
hadaly/app.py View File

@ -69,9 +69,11 @@ class HadalyApp(App):
return root
def build_config(self, config):
config.add_section('general')
config.add_section('viewer')
config.add_section('editor')
config.add_section('search')
config.set('general', 'switch_on_start', 1)
config.set('editor', 'autosave_time', '15')
config.set('editor', 'autosave', '0')
config.set('editor', 'font_size', '12')
@ -92,17 +94,20 @@ class HadalyApp(App):
if argv[1].endswith('.opah') and tarfile.is_tarfile(argv[1]):
self.load_presentation(os.path.dirname(argv[1]), [os.path.basename(argv[1])])
Logger.info('Application: file \'{file}\' loaded'.format(file=self.filename))
self.root.current = 'viewer'
except IndexError:
pass
def load_presentation(self, path, filename):
if len(self.root.get_screen('editor').slides_view.grid_layout.children) > 0:
self.clear()
self.extract_opah(path, filename)
self.load_json()
self.load_slides(path, filename)
if self.config.getint('general', 'switch_on_start'):
self.root.current = 'viewer'
def extract_opah(self, path, filename):
try:


Loading…
Cancel
Save