mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-16 10:52:29 +12:00
Fix issues with menu events and adjusted startup script
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
fdb5f854f6
commit
988fa62d61
|
@ -5,9 +5,14 @@ import os
|
|||
import sys
|
||||
|
||||
realpath = os.path.realpath(__file__)
|
||||
app_path = os.path.join(os.path.dirname(realpath), '..')
|
||||
|
||||
sys.path.insert(1, os.path.join(os.path.dirname(realpath), '..'))
|
||||
sys.path.insert(1, app_path)
|
||||
os.chdir(app_path)
|
||||
|
||||
from manuskript import main
|
||||
from manuskript.ui import MainWindow
|
||||
|
||||
main.run()
|
||||
path = os.path.join(os.getcwd(), "sample-projects/book-of-acts")
|
||||
|
||||
window = MainWindow(path + ".msk")
|
||||
window.run()
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
realpath = os.path.realpath(__file__)
|
||||
|
||||
sys.path.insert(1, os.path.join(os.path.dirname(realpath), '..'))
|
||||
|
||||
from manuskript.ui import MainWindow
|
||||
|
||||
path = os.path.join(sys.path[1], "sample-projects/book-of-acts")
|
||||
|
||||
window = MainWindow(path + ".msk")
|
||||
window.run()
|
|
@ -97,21 +97,24 @@ class MainWindow:
|
|||
def getProject(self):
|
||||
return self.project
|
||||
|
||||
def _openAction(self, menuItem: Gtk.MenuItem):
|
||||
def openProject(self):
|
||||
pass
|
||||
|
||||
def closeProject(self):
|
||||
self.hide()
|
||||
self.startupWindow.show()
|
||||
|
||||
def _openAction(self, menuItem: Gtk.MenuItem):
|
||||
self.openProject()
|
||||
|
||||
def _saveAction(self, menuItem: Gtk.MenuItem):
|
||||
self.getProject().save()
|
||||
|
||||
def _closeAction(self, menuItem: Gtk.MenuItem):
|
||||
self.hide()
|
||||
self.startupWindow.show()
|
||||
self.closeProject()
|
||||
|
||||
def _quitAction(self, menuItem: Gtk.MenuItem):
|
||||
for window in self.windows:
|
||||
window.hide()
|
||||
|
||||
self.exit()
|
||||
self.exit(True)
|
||||
|
||||
def getSettings(self):
|
||||
return self.getProject().settings
|
||||
|
@ -138,7 +141,11 @@ class MainWindow:
|
|||
self.show()
|
||||
Gtk.main()
|
||||
|
||||
def exit(self):
|
||||
def exit(self, force=False):
|
||||
if force:
|
||||
for window in self.windows:
|
||||
window.hide()
|
||||
|
||||
for window in self.windows:
|
||||
if window.isVisible():
|
||||
self.hide()
|
||||
|
|
|
@ -45,10 +45,10 @@ class StartupWindow(AbstractDialog):
|
|||
GObject.BindingFlags.SYNC_CREATE |
|
||||
GObject.BindingFlags.INVERT_BOOLEAN)
|
||||
|
||||
bindMenuItem(builder, "open_menu_item", self.mainWindow.openAction)
|
||||
bindMenuItem(builder, "quit_menu_item", self.mainWindow.quitAction)
|
||||
bindMenuItem(builder, "open_menu_item", self._openAction)
|
||||
bindMenuItem(builder, "quit_menu_item", self._quitAction)
|
||||
|
||||
bindMenuItem(builder, "about_menu_item", self.mainWindow.aboutAction)
|
||||
bindMenuItem(builder, "about_menu_item", self._aboutAction)
|
||||
|
||||
self.templatesStore = builder.get_object("templates_store")
|
||||
|
||||
|
@ -150,3 +150,12 @@ class StartupWindow(AbstractDialog):
|
|||
|
||||
self.template.addGoal()
|
||||
self.loadTemplate(self.template)
|
||||
|
||||
def _openAction(self, menuItem: Gtk.MenuItem):
|
||||
self.mainWindow.openProject()
|
||||
|
||||
def _quitAction(self, menuItem: Gtk.MenuItem):
|
||||
self.mainWindow.exit(True)
|
||||
|
||||
def _aboutAction(self, menuItem: Gtk.MenuItem):
|
||||
self.mainWindow.aboutDialog.show()
|
||||
|
|
Loading…
Reference in a new issue