本文整理汇总了Python中main_window.MainWindow.show_all方法的典型用法代码示例。如果您正苦于以下问题:Python MainWindow.show_all方法的具体用法?Python MainWindow.show_all怎么用?Python MainWindow.show_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main_window.MainWindow
的用法示例。
在下文中一共展示了MainWindow.show_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Application
# 需要导入模块: from main_window import MainWindow [as 别名]
# 或者: from main_window.MainWindow import show_all [as 别名]
class Application(Gtk.Application):
def __init__(self, *args, **kwargs):
super().__init__(*args, application_id="easy-ebook-viewer",
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
**kwargs)
self.window = None
self.file_path = None
GLib.set_application_name('Easy eBook Viewer')
GLib.set_prgname('easy-ebook-viewer')
GLib.setenv('PULSE_PROP_application.icon_name', 'easy-ebook-viewer', True)
def do_startup(self):
Gtk.Application.do_startup(self)
action = Gio.SimpleAction.new("about", None)
action.connect("activate", self.on_about)
self.add_action(action)
action = Gio.SimpleAction.new("quit", None)
action.connect("activate", self.on_quit)
self.add_action(action)
def do_activate(self):
GObject.threads_init()
gettext.install('easy-ebook-viewer', '/usr/share/easy-ebook-viewer/locale')
# We only allow a single window and raise any existing ones
if not self.window:
# Windows are associated with the application
# when the last one is closed the application shuts down
self.window = MainWindow(file_path=self.file_path)
self.window.connect("delete-event", self.on_quit)
self.window.set_wmclass("easy-ebook-viewer", "easy-ebook-viewer")
self.window.show_all()
if not self.window.book_loaded:
self.window.header_bar_component.hide_jumping_navigation()
Gtk.main()
def do_command_line(self, command_line):
# If book came from arguments ie. was oppened using "Open with..." method etc.
if len(sys.argv) > 1:
# Check if that file really exists
if os.path.exists(sys.argv[1]):
self.file_path = sys.argv[1]
self.activate()
return 0
def on_about(self, action, param):
dialog = about_dialog.AboutDialog()
dialog.show_all()
def on_quit(self, action, param):
Gdk.threads_leave()
Gtk.main_quit()
self.quit()