本文整理匯總了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()